api 로직 수정
This commit is contained in:
parent
1a5ecf869b
commit
179c22e6a8
@ -263,7 +263,8 @@ public final class MsgSendUtils {
|
|||||||
// log.info(" + smsTxtTemp.contains(placeholder) [{}]", smsTxtTemp.contains(placeholder));
|
// log.info(" + smsTxtTemp.contains(placeholder) [{}]", smsTxtTemp.contains(placeholder));
|
||||||
if (smsTxt.contains(placeholder)) {
|
if (smsTxt.contains(placeholder)) {
|
||||||
if (StringUtils.isEmpty(value)) {
|
if (StringUtils.isEmpty(value)) {
|
||||||
statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "치환 문구중 " + placeholder + " 데이터가 없습니다.");
|
// statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "치환 문구중 " + placeholder + " 데이터가 없습니다.");
|
||||||
|
StatusResponse.statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "치환 문구중 " + placeholder + " 데이터가 없습니다.", "STAT_1040");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
smsTxt = smsTxt.replace(placeholder, value);
|
smsTxt = smsTxt.replace(placeholder, value);
|
||||||
@ -293,7 +294,8 @@ public final class MsgSendUtils {
|
|||||||
if (!hasPerformedMsgType) {
|
if (!hasPerformedMsgType) {
|
||||||
msgTypeResult = getMsgTypeWithByteValidation(sendVO, smsTxt);
|
msgTypeResult = getMsgTypeWithByteValidation(sendVO, smsTxt);
|
||||||
if ("INVALID".equals(msgTypeResult)) {
|
if ("INVALID".equals(msgTypeResult)) {
|
||||||
statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "문자 치환 후 전송 문자 길이를 초과하였습니다.");
|
// statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "문자 치환 후 전송 문자 길이를 초과하였습니다.");
|
||||||
|
StatusResponse.statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "문자 치환 후 전송 문자 길이를 초과하였습니다.", "STAT_1050");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
hasPerformedMsgType = true;
|
hasPerformedMsgType = true;
|
||||||
@ -310,7 +312,8 @@ public final class MsgSendUtils {
|
|||||||
// 메시지 타입 체크는 매번 수행
|
// 메시지 타입 체크는 매번 수행
|
||||||
msgTypeResult = getMsgTypeWithByteValidation(sendVO, smsTxt);
|
msgTypeResult = getMsgTypeWithByteValidation(sendVO, smsTxt);
|
||||||
if ("INVALID".equals(msgTypeResult)) {
|
if ("INVALID".equals(msgTypeResult)) {
|
||||||
statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "문자 치환 후 전송 문자 길이를 초과하였습니다.");
|
// statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "문자 치환 후 전송 문자 길이를 초과하였습니다.");
|
||||||
|
StatusResponse.statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "문자 치환 후 전송 문자 길이를 초과하였습니다.", "STAT_1050");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -543,6 +546,7 @@ public final class MsgSendUtils {
|
|||||||
statusResponse.setMessage(msg);
|
statusResponse.setMessage(msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static StatusResponse validateFilesForMessageSending(int fileCount, MjonMsgVO mjonMsgVO) {
|
public static StatusResponse validateFilesForMessageSending(int fileCount, MjonMsgVO mjonMsgVO) {
|
||||||
if (fileCount > 0) {
|
if (fileCount > 0) {
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package itn.let.mail.service;
|
package itn.let.mail.service;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
@ -93,7 +95,6 @@ public class StatusResponse {
|
|||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public StatusResponse(HttpStatus status, String message, Object object) {
|
public StatusResponse(HttpStatus status, String message, Object object) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
@ -109,6 +110,32 @@ public class StatusResponse {
|
|||||||
this.apiReturn = apiReturn;
|
this.apiReturn = apiReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @methodName : statusResponseSet
|
||||||
|
* @author : 이호영
|
||||||
|
* @date : 2025. 6. 24.
|
||||||
|
* @description :
|
||||||
|
* @return : StatusResponse
|
||||||
|
* @param statusResponse
|
||||||
|
* @param httpStatus
|
||||||
|
* @param msg
|
||||||
|
* @param statCode - statCode는 API RETURN를 위한 코드
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static StatusResponse statusResponseSet(StatusResponse statusResponse, HttpStatus httpStatus, String msg, String statCode ) {
|
||||||
|
statusResponse.setStatus(httpStatus);
|
||||||
|
statusResponse.setMessage(msg);
|
||||||
|
|
||||||
|
Map<String, Object> apiReturnMap = new HashMap<>();
|
||||||
|
apiReturnMap.put("statCode", statCode);
|
||||||
|
apiReturnMap.put("result", httpStatus.toString());
|
||||||
|
statusResponse.setApiReturn(apiReturnMap);
|
||||||
|
|
||||||
|
return statusResponse;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3949,6 +3949,8 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
// log.info("mjonMsgVO [{}]", mjonMsgVO.getMjonMsgSendVOList().get(0).getPhone());
|
// log.info("mjonMsgVO [{}]", mjonMsgVO.getMjonMsgSendVOList().get(0).getPhone());
|
||||||
log.info(" :: sendMsgData_advc :: ");
|
log.info(" :: sendMsgData_advc :: ");
|
||||||
log.info(" + mjonMsgVO.toString() :: [{}]", mjonMsgVO.toString());
|
log.info(" + mjonMsgVO.toString() :: [{}]", mjonMsgVO.toString());
|
||||||
|
|
||||||
|
StatusResponse statusResponse = new StatusResponse();
|
||||||
|
|
||||||
Map<String, Object> returnMap = new HashMap<>();
|
Map<String, Object> returnMap = new HashMap<>();
|
||||||
Map<String, Object> apiReturnMap = new HashMap<>();
|
Map<String, Object> apiReturnMap = new HashMap<>();
|
||||||
@ -3975,7 +3977,8 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
// 발신번호가 등록된 유효한 번호인지 확인
|
// 발신번호가 등록된 유효한 번호인지 확인
|
||||||
int sendCallFromCnt = mjonMsgDAO.selectCallFromNumberChk(mjonMsgVO);
|
int sendCallFromCnt = mjonMsgDAO.selectCallFromNumberChk(mjonMsgVO);
|
||||||
if (sendCallFromCnt < 1) {
|
if (sendCallFromCnt < 1) {
|
||||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "등록된 발신번호를 찾을 수 없습니다.");
|
// return new StatusResponse(HttpStatus.BAD_REQUEST, "등록된 발신번호를 찾을 수 없습니다.");
|
||||||
|
return StatusResponse.statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "등록된 발신번호를 찾을 수 없습니다.", "STAT_1010");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3985,8 +3988,10 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
if (!mberSttus) {
|
if (!mberSttus) {
|
||||||
request.getSession().invalidate();
|
request.getSession().invalidate();
|
||||||
// UNAUTHORIZED : 인증되지 않은 사용자가 접근하려고 할 때
|
// UNAUTHORIZED : 인증되지 않은 사용자가 접근하려고 할 때
|
||||||
return new StatusResponse(HttpStatus.UNAUTHORIZED,
|
// return new StatusResponse(HttpStatus.UNAUTHORIZED,
|
||||||
"현재 고객님께서는 문자온 서비스 이용이 정지된 상태로 문자를 발송하실 수 없습니다. 이용정지 해제를 원하시면 고객센터로 연락주시기 바랍니다.");
|
// "현재 고객님께서는 문자온 서비스 이용이 정지된 상태로 문자를 발송하실 수 없습니다. 이용정지 해제를 원하시면 고객센터로 연락주시기 바랍니다.");
|
||||||
|
return StatusResponse.statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "현재 고객님께서는 문자온 서비스 이용이 정지된 상태로 문자를 발송하실 수 없습니다. 이용정지 해제를 원하시면 고객센터로 연락주시기 바랍니다."
|
||||||
|
, "STAT_1070");
|
||||||
}
|
}
|
||||||
|
|
||||||
String smsTxt = mjonMsgVO.getSmsTxtArea();
|
String smsTxt = mjonMsgVO.getSmsTxtArea();
|
||||||
@ -4000,7 +4005,6 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
|
|
||||||
log.debug(" :: smsTxt :: [{}]", smsTxt);
|
log.debug(" :: smsTxt :: [{}]", smsTxt);
|
||||||
|
|
||||||
StatusResponse statusResponse = new StatusResponse();
|
|
||||||
|
|
||||||
// 화면에서 저장한 이미지 가져오기
|
// 화면에서 저장한 이미지 가져오기
|
||||||
mjonMsgVO = setImagesSetting(mjonMsgVO, statusResponse);
|
mjonMsgVO = setImagesSetting(mjonMsgVO, statusResponse);
|
||||||
@ -4027,7 +4031,7 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
apiReturnMap.put("resultBlockSts", deletedCount);
|
apiReturnMap.put("resultBlockSts", deletedCount);
|
||||||
|
|
||||||
if (mjonMsgSendVOList.size() < 1) {
|
if (mjonMsgSendVOList.size() < 1) {
|
||||||
return new StatusResponse(HttpStatus.BAD_REQUEST, "수신거부와 매칭되는 번호 제거 후 \n발송 가능한 수신목록이 존재하지 않습니다.");
|
return StatusResponse.statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "수신거부와 매칭되는 번호 제거 후 \n발송 가능한 수신목록이 존재하지 않습니다.", "STAT_1021");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 전용 전송사 코드 및 대표 전송사 조회
|
// 전용 전송사 코드 및 대표 전송사 조회
|
||||||
@ -4238,7 +4242,7 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
|||||||
statusResponse.setStatus(HttpStatus.OK);
|
statusResponse.setStatus(HttpStatus.OK);
|
||||||
statusResponse.setObject(returnMap);
|
statusResponse.setObject(returnMap);
|
||||||
|
|
||||||
apiReturnMap.put("result", "success");
|
apiReturnMap.put("result", HttpStatus.OK.toString());
|
||||||
apiReturnMap.put("message", "문자 전송이 완료되었습니다.");
|
apiReturnMap.put("message", "문자 전송이 완료되었습니다.");
|
||||||
statusResponse.setApiReturn(apiReturnMap);
|
statusResponse.setApiReturn(apiReturnMap);
|
||||||
return statusResponse;
|
return statusResponse;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user