feat: test인지 아닌지 구분하기위한 파라미터 추가
This commit is contained in:
parent
8f230012ed
commit
c8184210f2
@ -3,8 +3,8 @@ package com.itn.mjonApi.cmn.aop;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.itn.mjonApi.cmn.idgen.service.IdgenService;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.SendFailRestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.SendSucRestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.FailRestResponse;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.SendSucRestResponse;
|
||||
import com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgsRequestVO;
|
||||
@ -193,9 +193,9 @@ public class LogAspect {
|
||||
}
|
||||
// 실패일때 CLASS
|
||||
else if("SendFailRestResponse".equals(classNm)) {
|
||||
SendFailRestResponse sendFailRestResponse = (SendFailRestResponse) dataObject;
|
||||
FailRestResponse failRestResponse = (FailRestResponse) dataObject;
|
||||
|
||||
test_yn = sendFailRestResponse.getTest_yn();
|
||||
test_yn = failRestResponse.getTest_yn();
|
||||
// ApiObjectUtil.getAccessKeyVOToJsonString(sendSucRestResponse);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.itn.mjonApi.cmn.handler;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.cmn.handler
|
||||
* fileName : ExceptionHandler
|
||||
* author : hylee
|
||||
* date : 2023-06-16
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-06-16 hylee 최초 생성
|
||||
*/
|
||||
public class ExceptionHandler {
|
||||
}
|
||||
@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SendFailRestResponse {
|
||||
public class FailRestResponse {
|
||||
|
||||
private String resultCode; // 오류 코드
|
||||
|
||||
@ -24,10 +24,10 @@ public class SendFailRestResponse {
|
||||
* 실패 생성자
|
||||
* @param STAT_CODE
|
||||
*/
|
||||
public SendFailRestResponse(String STAT_CODE) {
|
||||
public FailRestResponse(String STAT_CODE, String test_yn) {
|
||||
this.resultCode=StatMsg.valueOf(STAT_CODE).getCode();
|
||||
this.msg=StatMsg.valueOf(STAT_CODE).getMsg();
|
||||
this.test_yn="YF";
|
||||
this.test_yn=test_yn;
|
||||
}
|
||||
|
||||
}
|
||||
@ -50,7 +50,6 @@ public enum StatMsg {
|
||||
, STAT_4099("4099","기타 시스템 오류")
|
||||
|
||||
//발송가능건수======================================================================
|
||||
|
||||
, STAT_5099("5099","기타 시스템 오류")
|
||||
|
||||
//======================================================================
|
||||
|
||||
@ -2,7 +2,7 @@ package com.itn.mjonApi.mjon.api.inqry.service.impl;
|
||||
|
||||
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.SendFailRestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.FailRestResponse;
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.HstryMapper;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.HstryService;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryDetailVO;
|
||||
@ -210,7 +210,7 @@ public class HstryServiceImpl implements HstryService {
|
||||
}else{
|
||||
// 실패 코드 중 랜덤으로 리턴
|
||||
// return new RestResponse(StatMsg.randomErrorStatCode());
|
||||
return new RestResponse(new SendFailRestResponse("STAT_3099"));
|
||||
return new RestResponse(new FailRestResponse("STAT_4099", "YF"));
|
||||
}
|
||||
}
|
||||
private RestResponse _getTestHstryListReturnData(String testYn)
|
||||
@ -237,7 +237,7 @@ public class HstryServiceImpl implements HstryService {
|
||||
}else{
|
||||
// 실패 코드 중 랜덤으로 리턴
|
||||
// return new RestResponse(StatMsg.randomErrorStatCode());
|
||||
return new RestResponse(new SendFailRestResponse("STAT_3099"));
|
||||
return new RestResponse(new FailRestResponse("STAT_4099", ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,21 +1,20 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.itn.mjonApi.cmn.msg.FailRestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.StatMsg;
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.PriceMapper;
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceResponse;
|
||||
import com.itn.mjonApi.mjon.api.inqry.mapper.domain.PriceVO;
|
||||
import com.itn.mjonApi.mjon.api.inqry.service.PriceService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @packageName : com.itn.mjonApi.mjon.api.inqry.service.impl
|
||||
@ -70,20 +69,7 @@ public class PriceServiceImpl implements PriceService {
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info("selectPrice Error [{}]", e.getMessage());
|
||||
|
||||
String enumStr = "";
|
||||
|
||||
//오류발생 예측이 어렵다..일단 기타시스템 오류로_230524_이준호
|
||||
if(true) {
|
||||
enumStr = "STAT_1099";
|
||||
}
|
||||
|
||||
priceResponse = PriceResponse.builder()
|
||||
//defalut set
|
||||
.resultCode(StatMsg.valueOf(enumStr).getCode())
|
||||
.message(StatMsg.valueOf(enumStr).getMsg())
|
||||
.localDateTime(LocalDateTime.now())
|
||||
.build();
|
||||
return new RestResponse(new FailRestResponse("STAT_5099", ""));
|
||||
}
|
||||
|
||||
return new RestResponse(priceResponse);
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.itn.mjonApi.mjon.api.inqry.service.mapper.domain;
|
||||
|
||||
import lombok.*;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@ -27,8 +26,6 @@ public class HstryResponse {
|
||||
//private HttpStatus status;
|
||||
private int resultCode;
|
||||
|
||||
private String message;
|
||||
|
||||
private LocalDateTime localDateTime;
|
||||
|
||||
|
||||
@ -45,40 +42,7 @@ public class HstryResponse {
|
||||
|
||||
private String next_yn; // 다음 조회 목록여부
|
||||
|
||||
|
||||
/*
|
||||
* 200-OK : 정상접속
|
||||
* 401-Unauthorized : 인증실패
|
||||
*
|
||||
* */
|
||||
|
||||
public HstryResponse(HttpStatus status, String message, LocalDateTime timestamp) {
|
||||
this.resultCode = status.value();
|
||||
checkMessage(status, message);
|
||||
this.localDateTime = timestamp;
|
||||
}
|
||||
|
||||
// public PriceResponse(HttpStatus status
|
||||
// , String message
|
||||
// , LocalDateTime timestamp
|
||||
// , PriceVO priceVO
|
||||
// ) {
|
||||
// this.resultCode = status.value();
|
||||
// checkMessage(status, message);
|
||||
//
|
||||
// this.localDateTime = timestamp;
|
||||
// this.shortPrice = priceVO.getShortPrice();
|
||||
// this.longPrice = priceVO.getLongPrice();
|
||||
// this.picturePrice = priceVO.getPicturePrice();
|
||||
// this.userMoney = priceVO.getUserMoney();
|
||||
// this.shortSendPsbltEa = priceVO.getShortSendPsbltEa();
|
||||
// this.longSendPsbltEa = priceVO.getLongSendPsbltEa();
|
||||
// this.pictureSendPsbltEa = priceVO.getPictureSendPsbltEa();
|
||||
// }
|
||||
|
||||
private void checkMessage(HttpStatus status, String message) {
|
||||
if ("".equals(message)){ this.message = status.name();
|
||||
}else { this.message = message; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.itn.mjonApi.cmn.msg;
|
||||
package com.itn.mjonApi.mjon.api.send.mapper.domain;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
||||
import com.itn.mjonApi.cmn.msg.StatMsg;
|
||||
import lombok.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -2,8 +2,8 @@ package com.itn.mjonApi.mjon.api.send.service.impl;
|
||||
|
||||
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.SendFailRestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.SendSucRestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.FailRestResponse;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.SendSucRestResponse;
|
||||
import com.itn.mjonApi.cmn.msg.StatMsg;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.SendMapper;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
||||
@ -53,14 +53,14 @@ public class SendServiceImpl implements SendService {
|
||||
// 1010
|
||||
msgRequestVO.setCallFrom(MunjaUtil.removeCharactersWithRegex(msgRequestVO.getCallFrom()));
|
||||
if(!sendMapper.findByCallFrom(msgRequestVO)){
|
||||
return new RestResponse("STAT_1010");
|
||||
return new RestResponse(new FailRestResponse("STAT_1010",""));
|
||||
}
|
||||
|
||||
// step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||
// 1020
|
||||
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
||||
if(this.getCallToListChk(msgRequestVO)){
|
||||
return new RestResponse("STAT_1020");
|
||||
return new RestResponse(new FailRestResponse("STAT_1020",""));
|
||||
}
|
||||
|
||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 30분 지연으로 처리됨
|
||||
@ -102,7 +102,7 @@ public class SendServiceImpl implements SendService {
|
||||
if(!munjaSendResponse.getResult().equals("fail")){ // 성공
|
||||
return new RestResponse(SendSucRestResponse.convertMjonDataToApiResponse(munjaSendResponse));
|
||||
}else{ // 실패
|
||||
return new RestResponse(this.convertMjonDataToApiResponse(munjaSendResponse));
|
||||
return new RestResponse(new FailRestResponse(StatMsg.randomErrorStatCode(),""));
|
||||
}
|
||||
|
||||
//step5.발송일시 정상여부 확인
|
||||
@ -119,7 +119,7 @@ public class SendServiceImpl implements SendService {
|
||||
if("YF".equals(testYn))
|
||||
{
|
||||
// 실패 코드 중 랜덤으로 리턴
|
||||
return new RestResponse(new SendFailRestResponse(StatMsg.randomErrorStatCode()));
|
||||
return new RestResponse(new FailRestResponse(StatMsg.randomErrorStatCode(),"YF"));
|
||||
|
||||
|
||||
|
||||
@ -143,7 +143,7 @@ public class SendServiceImpl implements SendService {
|
||||
// YF => 실패 테스트 데이터
|
||||
if("YF".equals(testYn))
|
||||
{
|
||||
return new RestResponse(new SendFailRestResponse(StatMsg.randomErrorStatCode()));
|
||||
return new RestResponse(new FailRestResponse(StatMsg.randomErrorStatCode(),"YF"));
|
||||
}else{ // YS => 성공 테스트 데이터
|
||||
|
||||
|
||||
@ -183,7 +183,7 @@ public class SendServiceImpl implements SendService {
|
||||
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||
// 1010
|
||||
if(!sendMapper.findByCallFrom(msgRequestVOList.get(0))){
|
||||
return new RestResponse("STAT_1010");
|
||||
return new RestResponse(new FailRestResponse("STAT_1010",""));
|
||||
}
|
||||
|
||||
|
||||
@ -230,7 +230,7 @@ public class SendServiceImpl implements SendService {
|
||||
|
||||
private static RestResponse callToErrorReturnData(MsgRequestVO msgRequestVO) {
|
||||
|
||||
SendFailRestResponse stat1020 = new SendFailRestResponse("STAT_1020");
|
||||
FailRestResponse stat1020 = new FailRestResponse("STAT_1020","");
|
||||
String errorMsg = stat1020.getMsg();
|
||||
errorMsg.replace("수신자", "수신자(" + msgRequestVO.getCallToList()[0] + ")");
|
||||
stat1020.setMsg(errorMsg);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user