feat: 문자보내는 주석 추가
This commit is contained in:
parent
a7bb2812f3
commit
770b338fb9
@ -2,7 +2,6 @@ package com.itn.mjonApi.cmn.apiServer;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
@ -13,6 +12,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
* author : hylee
|
||||
* date : 2023-05-15
|
||||
* description : API 서버 호출 Service - 호출 후 데이터 정제 까지 구현
|
||||
* 필요한 데이터 정제가 있으면 추가 및 수정 해야 함
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
@ -21,23 +21,28 @@ import org.springframework.web.client.RestTemplate;
|
||||
@Service
|
||||
public class ApiService <T> {
|
||||
|
||||
// RestTemplateConfig.class의 셋팅값으로 생성
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Autowired
|
||||
public ApiService(RestTemplate restTemplate) {
|
||||
this.restTemplate = restTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url
|
||||
* @param request
|
||||
* @param responseType
|
||||
* @discription restTemplate.postForEntity 호출 후 MjonResponseVO에 맞게 데이터 정제
|
||||
* @return MjonResponseVO.class
|
||||
* @throws JsonProcessingException
|
||||
*/
|
||||
public MjonResponseVO postForEntity(String url, Object request, Class<String> responseType) throws JsonProcessingException {
|
||||
ResponseEntity<String> spamChkEntity = (ResponseEntity<String>) restTemplate.postForEntity(
|
||||
url
|
||||
, request
|
||||
, responseType
|
||||
);
|
||||
|
||||
MjonResponseVO spamResponse = MjonResponseVO.getMjonResponse(spamChkEntity);
|
||||
|
||||
|
||||
return spamResponse;
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@ public class MsgRequestVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "전송문자 개별가격", example = "0", hidden = true)
|
||||
private String eachPrice="0";
|
||||
private String sPrice="0"; // 임시
|
||||
|
||||
@ApiModelProperty(value = "전송문자 토탈가격", example = "0", hidden = true)
|
||||
private String totPrice="0";
|
||||
@ -93,15 +94,15 @@ public class MsgRequestVO implements Serializable {
|
||||
private String rep4Str;
|
||||
|
||||
@ApiModelProperty(value = "nameStr 을 |로 split 후 담는 변수", example = "", hidden = true)
|
||||
private String[] nameList;
|
||||
private String[] nameList= new String[0];;
|
||||
@ApiModelProperty(value = "rep1Str 을 |로 split 후 담는 변수", example = "", hidden = true)
|
||||
private String[] rep1List;
|
||||
private String[] rep1List= new String[0];;
|
||||
@ApiModelProperty(value = "rep2Str 을 |로 split 후 담는 변수", example = "", hidden = true)
|
||||
private String[] rep2List;
|
||||
private String[] rep2List= new String[0];;
|
||||
@ApiModelProperty(value = "rep3Str 을 |로 split 후 담는 변수", example = "", hidden = true)
|
||||
private String[] rep3List;
|
||||
private String[] rep3List= new String[0];;
|
||||
@ApiModelProperty(value = "rep4Str 을 |로 split 후 담는 변수", example = "", hidden = true)
|
||||
private String[] rep4List;
|
||||
private String[] rep4List= new String[0];;
|
||||
|
||||
@ApiModelProperty(value = "예약 유무 (Y/N)", example = "N", hidden = true)
|
||||
private String reserveYn="N"; // 예약문자 여부 default N
|
||||
|
||||
@ -3,6 +3,7 @@ package com.itn.mjonApi.mjon.api.send.service.impl;
|
||||
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
||||
import com.itn.mjonApi.cmn.msg.SendRestResponse;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.SendMapper;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||
import com.itn.mjonApi.mjon.api.send.service.SendService;
|
||||
import com.itn.mjonApi.util.MunjaUtil;
|
||||
@ -41,42 +42,33 @@ public class SendServiceImpl implements SendService {
|
||||
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||
// 1010
|
||||
if(!sendMapper.findByCallFrom(msgRequestVO)){
|
||||
return SendRestResponse.builder()
|
||||
.resultStr("STAT1010")
|
||||
.build();
|
||||
return _falseRetunDate("STAT1010");
|
||||
}
|
||||
|
||||
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||
// 1020
|
||||
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
||||
if(StringUtils.isNotEmpty(this.getCallToListChk(msgRequestVO))){
|
||||
return SendRestResponse.builder()
|
||||
.resultStr("STAT1010")
|
||||
.build();
|
||||
return _falseRetunDate("STAT1020");
|
||||
}
|
||||
|
||||
|
||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 안됨
|
||||
// 1030
|
||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 30분 지연으로 처리됨
|
||||
// 1030 => 현재 사용안함
|
||||
// 스팸체크 하는 부분
|
||||
// apiService.postForEntity => restTemplate.postForEntity 호출 후 MjonResponseVO에 맞게 데이터 정제하는 메소드
|
||||
MjonResponseVO spamChkEntity = apiService.postForEntity(
|
||||
"/web/user/login/selectSpamTxtChkAjax.do"
|
||||
, msgRequestVO
|
||||
, String.class
|
||||
);
|
||||
// 스팸체크 결과값이 spams 이면 스팸문자로 처리
|
||||
if("spams".equals(spamChkEntity.getResult())){
|
||||
msgRequestVO.setSpamStatus("Y");
|
||||
};
|
||||
|
||||
//step4.치환명 정상 여부 확인
|
||||
// 1040
|
||||
|
||||
//step5.발송일시 정상여부 확인
|
||||
// 1050
|
||||
|
||||
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
||||
// 1060
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
// 치환데이터 여부 확인
|
||||
msgRequestVO.setTxtReplYn(this.getTxtReplYn(msgRequestVO));
|
||||
|
||||
@ -91,36 +83,47 @@ public class SendServiceImpl implements SendService {
|
||||
}
|
||||
|
||||
|
||||
// 치환데이터 여부 확인
|
||||
msgRequestVO.setTxtReplYn(this.getTxtReplYn(msgRequestVO));
|
||||
// 치환데이터가 있을 경우
|
||||
if("Y".equals(msgRequestVO.getTxtReplYn())){
|
||||
//일괄변환 문자에 콤마(,)가 들어가있으면 배열로 넘길때 문제가 발생하여 특수문자(§)로 치환하여 넘겨주도록 한다.
|
||||
msgRequestVO = this.getReplaceCommaToStrSymbol(msgRequestVO);
|
||||
// 치환 후 단문 장문 개수 구하기
|
||||
msgRequestVO = getLengthOfShortAndLongMsg(msgRequestVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 스팸체크 하는 부분
|
||||
MjonResponseVO spamChkEntity = apiService.postForEntity(
|
||||
"/web/user/login/selectSpamTxtChkAjax.do"
|
||||
, msgRequestVO
|
||||
, String.class
|
||||
);
|
||||
|
||||
if("spams".equals(spamChkEntity.getResult())){
|
||||
msgRequestVO.setSpamStatus("Y");
|
||||
};
|
||||
|
||||
log.info("msgRequestVO.getSpamStatus() :: [[}]",msgRequestVO.getSpamStatus());
|
||||
|
||||
// 문자 전송하는 부분
|
||||
// apiService.postForEntity => restTemplate.postForEntity 호출 후 MjonResponseVO에 맞게 데이터 정제하는 메소드
|
||||
MjonResponseVO munjaSendResponse = apiService.postForEntity(
|
||||
"/web/user/login/sendMsgDataAjax.do"
|
||||
, msgRequestVO
|
||||
, String.class
|
||||
);
|
||||
log.info("munjaSendResponse : [{}]", munjaSendResponse.toString());
|
||||
//step5.발송일시 정상여부 확인
|
||||
// 1050
|
||||
|
||||
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
||||
// 1060
|
||||
|
||||
*/
|
||||
|
||||
|
||||
return null;
|
||||
// return munjaSendResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 리턴 데이터 메소드
|
||||
* @return
|
||||
*/
|
||||
private static SendRestResponse _falseRetunDate(String ststCode) {
|
||||
return SendRestResponse.builder()
|
||||
.resultStr(ststCode)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 치환 후 단문 장문 msg 개수 구하기
|
||||
* @param msgRequestVO
|
||||
|
||||
Loading…
Reference in New Issue
Block a user