feat: lettngnrlmber_api_send_msg_log 처리 완료
This commit is contained in:
parent
1f0e5f9769
commit
ecc7e0042f
@ -5,15 +5,19 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import com.itn.mjonApi.cmn.idgen.service.IdgenService;
|
import com.itn.mjonApi.cmn.idgen.service.IdgenService;
|
||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
import com.itn.mjonApi.cmn.msg.SendSucRestResponse;
|
||||||
import com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO;
|
import com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO;
|
||||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryResponse;
|
|
||||||
import com.itn.mjonApi.mjon.log.service.mapper.LettnAccessLogMapper;
|
import com.itn.mjonApi.mjon.log.service.mapper.LettnAccessLogMapper;
|
||||||
|
import com.itn.mjonApi.mjon.log.service.mapper.LettnApiSendMsgLogMapper;
|
||||||
import com.itn.mjonApi.mjon.log.service.mapper.domain.LettnAccessLogVO;
|
import com.itn.mjonApi.mjon.log.service.mapper.domain.LettnAccessLogVO;
|
||||||
|
import com.itn.mjonApi.mjon.log.service.mapper.domain.LettnApiSendMsgLogVO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.annotation.AfterReturning;
|
import org.aspectj.lang.annotation.AfterReturning;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
@ -23,6 +27,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* packageName : com.itn.mjonApi.cmn.aop
|
* packageName : com.itn.mjonApi.cmn.aop
|
||||||
@ -44,9 +49,15 @@ public class LogAspect {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
LettnAccessLogMapper lettnAccessLogMapper;
|
LettnAccessLogMapper lettnAccessLogMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LettnApiSendMsgLogMapper lettnApiSendMsgLogMapper;
|
||||||
@Resource(name = "apiAccessLog")
|
@Resource(name = "apiAccessLog")
|
||||||
private IdgenService idgenApiAccessLogId;
|
private IdgenService idgenApiAccessLogId;
|
||||||
|
|
||||||
|
@Resource(name = "apiSendLog")
|
||||||
|
private IdgenService idgenApiSendLogId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description com.itn.mjonApi.mjon.api 패키지 하위에 모든 *Impl 클래스의 모든 메소드 실행 전
|
* @description com.itn.mjonApi.mjon.api 패키지 하위에 모든 *Impl 클래스의 모든 메소드 실행 전
|
||||||
* @param joinPoint
|
* @param joinPoint
|
||||||
@ -55,7 +66,6 @@ public class LogAspect {
|
|||||||
* - accessKey
|
* - accessKey
|
||||||
*/
|
*/
|
||||||
@Before(value = "execution(* com.itn.mjonApi.mjon.api.*..*Impl.*(..))" )
|
@Before(value = "execution(* com.itn.mjonApi.mjon.api.*..*Impl.*(..))" )
|
||||||
// @Before(value = "execution(* com.itn.mjonApi.mjon.api.send.service.impl.SendServiceImpl.*(..))" )
|
|
||||||
public void before(JoinPoint joinPoint) throws IllegalAccessException {
|
public void before(JoinPoint joinPoint) throws IllegalAccessException {
|
||||||
log.info(" :: AOP before :: ");
|
log.info(" :: AOP before :: ");
|
||||||
|
|
||||||
@ -64,6 +74,8 @@ public class LogAspect {
|
|||||||
// VO 객체를 가져옴
|
// VO 객체를 가져옴
|
||||||
Object objectVO = joinPoint.getArgs()[0];
|
Object objectVO = joinPoint.getArgs()[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// VO 객체의 필드값을 가져옴
|
// VO 객체의 필드값을 가져옴
|
||||||
// 각각 메소드들의 매개변수VO가 다름으로
|
// 각각 메소드들의 매개변수VO가 다름으로
|
||||||
// 필드명으로 구분하여 값을 가져옴
|
// 필드명으로 구분하여 값을 가져옴
|
||||||
@ -75,6 +87,7 @@ public class LogAspect {
|
|||||||
if("accessKey".equals(field.getName())){ accessKey=field.get(objectVO).toString(); }
|
if("accessKey".equals(field.getName())){ accessKey=field.get(objectVO).toString(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String nextStringId = idgenApiAccessLogId.getNextStringId();
|
String nextStringId = idgenApiAccessLogId.getNextStringId();
|
||||||
LettnAccessLogVO lettnAccessLogVO = new LettnAccessLogVO()
|
LettnAccessLogVO lettnAccessLogVO = new LettnAccessLogVO()
|
||||||
.builder()
|
.builder()
|
||||||
@ -114,6 +127,8 @@ public class LogAspect {
|
|||||||
String logId = (String) request.getAttribute("logId");
|
String logId = (String) request.getAttribute("logId");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// lettngnrlmber_access_log 응답값 Udpate
|
// lettngnrlmber_access_log 응답값 Udpate
|
||||||
LettnAccessLogVO lettnAccessLogVO = new LettnAccessLogVO()
|
LettnAccessLogVO lettnAccessLogVO = new LettnAccessLogVO()
|
||||||
.builder()
|
.builder()
|
||||||
@ -121,6 +136,91 @@ public class LogAspect {
|
|||||||
.resCn(this.getJsonToString(returnValue))
|
.resCn(this.getJsonToString(returnValue))
|
||||||
.build();
|
.build();
|
||||||
lettnAccessLogMapper.update(lettnAccessLogVO);
|
lettnAccessLogMapper.update(lettnAccessLogVO);
|
||||||
|
|
||||||
|
String methodNm = getMethodSignature(joinPoint);
|
||||||
|
if("sendMsgData".equals(methodNm) || "sendMsgsData".equals(methodNm)){
|
||||||
|
|
||||||
|
String resultCode = this.getResultCodeString(returnValue);
|
||||||
|
|
||||||
|
|
||||||
|
// resultCode == 0 : 문자 발송이 성공일 때
|
||||||
|
if("0".equals(resultCode)){
|
||||||
|
|
||||||
|
LettnApiSendMsgLogVO apiSendMsgLogVO = this.makeApiSendMsgLogVO(returnValue, logId, methodNm);
|
||||||
|
lettnApiSendMsgLogMapper.insert(apiSendMsgLogVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description lettngnrlmber_api_send_msg_log 테이블에 저장할 데이터 만들기
|
||||||
|
* @param returnValue
|
||||||
|
* @param logId
|
||||||
|
* @param methodNm
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private LettnApiSendMsgLogVO makeApiSendMsgLogVO(Object returnValue, String logId, String methodNm) {
|
||||||
|
RestResponse restResponse = (RestResponse) returnValue;
|
||||||
|
SendSucRestResponse SendSucRestResponse = (SendSucRestResponse) restResponse.getData();
|
||||||
|
|
||||||
|
|
||||||
|
String msgGroupId = null;
|
||||||
|
String msgSendType = null;
|
||||||
|
if("sendMsgData".equals(methodNm)){
|
||||||
|
msgSendType = "msg";
|
||||||
|
msgGroupId = SendSucRestResponse.getMsgGroupId();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else if("sendMsgsData".equals(methodNm)){
|
||||||
|
msgSendType = "msgs";
|
||||||
|
// msgGroupId = SendSucRestResponse.getMsgGroupIdList().toString();
|
||||||
|
|
||||||
|
// list to String
|
||||||
|
msgGroupId = SendSucRestResponse.getMsgGroupIdList().stream()
|
||||||
|
.map(n -> String.valueOf(n))
|
||||||
|
.collect(Collectors.joining("," ));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return LettnApiSendMsgLogVO.builder()
|
||||||
|
.logNo(idgenApiSendLogId.getNextStringId())
|
||||||
|
.mberId(logId)
|
||||||
|
.msgSendType(msgSendType)
|
||||||
|
.msgGroupId(msgGroupId)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description returnCode 가져옴
|
||||||
|
* @param returnValue
|
||||||
|
* @return
|
||||||
|
* @throws IllegalAccessException
|
||||||
|
*/
|
||||||
|
private static String getResultCodeString(Object returnValue) throws IllegalAccessException {
|
||||||
|
|
||||||
|
RestResponse restResponse = (RestResponse) returnValue;
|
||||||
|
Object data = restResponse.getData();
|
||||||
|
|
||||||
|
String resultCode = "";
|
||||||
|
for(Field field : data.getClass().getDeclaredFields()){
|
||||||
|
field.setAccessible(true);
|
||||||
|
if("resultCode".equals(field.getName())){ resultCode =field.get(data).toString(); }
|
||||||
|
}
|
||||||
|
return resultCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description JoinPoint에서 method name 가져옴
|
||||||
|
* @param joinPoint
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private static String getMethodSignature(JoinPoint joinPoint) {
|
||||||
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
|
return signature.getMethod().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -167,11 +267,7 @@ public class LogAspect {
|
|||||||
// .registerModule(new JavaTimeModule()) : LocalDateTime을 json으로 변환하기 위함
|
// .registerModule(new JavaTimeModule()) : LocalDateTime을 json으로 변환하기 위함
|
||||||
return objectMapper.registerModule(new JavaTimeModule()).writeValueAsString(restResponse);
|
return objectMapper.registerModule(new JavaTimeModule()).writeValueAsString(restResponse);
|
||||||
}
|
}
|
||||||
private static String getHstryResponseVOToJsonString(HstryResponse hstryResponse) throws JsonProcessingException {
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
// .registerModule(new JavaTimeModule()) : LocalDateTime을 json으로 변환하기 위함
|
|
||||||
return objectMapper.registerModule(new JavaTimeModule()).writeValueAsString(hstryResponse);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @description : VO를 json으로 변환
|
* @description : VO를 json으로 변환
|
||||||
* @param accessKeyVO
|
* @param accessKeyVO
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
public class ContextIdgen {
|
public class ContextIdgen {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @discription apiLog Ids
|
* @discription apiLoginLog Ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Bean(name="apiLoginLog")
|
@Bean(name="apiLoginLog")
|
||||||
@ -35,7 +35,7 @@ public class ContextIdgen {
|
|||||||
return idgenServiceImpl;
|
return idgenServiceImpl;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @discription apiLog Ids
|
* @discription apiAccessLog Ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Bean(name="apiAccessLog")
|
@Bean(name="apiAccessLog")
|
||||||
@ -43,10 +43,22 @@ public class ContextIdgen {
|
|||||||
IdgenServiceImpl idgenServiceImpl = new IdgenServiceImpl();
|
IdgenServiceImpl idgenServiceImpl = new IdgenServiceImpl();
|
||||||
idgenServiceImpl.setCipers(10); // cipers: prefix를 제외한 아이디의 길이 지정
|
idgenServiceImpl.setCipers(10); // cipers: prefix를 제외한 아이디의 길이 지정
|
||||||
idgenServiceImpl.setFillChar('0'); // fillChar: 0을 대신하여 표현되는 문자
|
idgenServiceImpl.setFillChar('0'); // fillChar: 0을 대신하여 표현되는 문자
|
||||||
// idgenServiceImpl.setPrefix("APILOG_"); // prefix: 아이디의 앞에 고정적으로 붙이고자 하는 설정값 지정
|
|
||||||
idgenServiceImpl.setPrefix("APIACCLOG_"); // prefix: 아이디의 앞에 고정적으로 붙이고자 하는 설정값 지정
|
idgenServiceImpl.setPrefix("APIACCLOG_"); // prefix: 아이디의 앞에 고정적으로 붙이고자 하는 설정값 지정
|
||||||
idgenServiceImpl.setTableName("API_ACCESS_LOG_ID"); // tableName - dataSoure 에 설정된 DB에 SEQ 테이블에 tableName 컬럼에 참조할 값
|
idgenServiceImpl.setTableName("API_ACCESS_LOG_ID"); // tableName - dataSoure 에 설정된 DB에 SEQ 테이블에 tableName 컬럼에 참조할 값
|
||||||
return idgenServiceImpl;
|
return idgenServiceImpl;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @discription apiAccessLog Ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean(name="apiSendLog")
|
||||||
|
public IdgenServiceImpl apiSendLog(){
|
||||||
|
IdgenServiceImpl idgenServiceImpl = new IdgenServiceImpl();
|
||||||
|
idgenServiceImpl.setCipers(9); // cipers: prefix를 제외한 아이디의 길이 지정
|
||||||
|
idgenServiceImpl.setFillChar('0'); // fillChar: 0을 대신하여 표현되는 문자
|
||||||
|
idgenServiceImpl.setPrefix("APISENDLOG_"); // prefix: 아이디의 앞에 고정적으로 붙이고자 하는 설정값 지정
|
||||||
|
idgenServiceImpl.setTableName("API_SEND_MSG_ID"); // tableName - dataSoure 에 설정된 DB에 SEQ 테이블에 tableName 컬럼에 참조할 값
|
||||||
|
return idgenServiceImpl;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,14 +27,6 @@ public class RestResponse{
|
|||||||
this.data=data;
|
this.data=data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 실패 생성자
|
|
||||||
* @param STAT_CODE
|
|
||||||
*/
|
|
||||||
public RestResponse(String STAT_CODE) {
|
|
||||||
this.resultCode=StatMsg.valueOf(STAT_CODE).getCode();
|
|
||||||
this.data=StatMsg.valueOf(STAT_CODE).getMsg();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.itn.mjonApi.cmn.msg;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class SendFailRestResponse {
|
||||||
|
|
||||||
|
private String resultCode; // 오류 코드
|
||||||
|
|
||||||
|
private String msg; // 메세지
|
||||||
|
|
||||||
|
private String test_yn; // 메세지
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 실패 생성자
|
||||||
|
* @param STAT_CODE
|
||||||
|
*/
|
||||||
|
public SendFailRestResponse(String STAT_CODE) {
|
||||||
|
this.resultCode=StatMsg.valueOf(STAT_CODE).getCode();
|
||||||
|
this.msg=StatMsg.valueOf(STAT_CODE).getMsg();
|
||||||
|
this.test_yn="YF";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -13,12 +13,9 @@ import java.util.stream.Collectors;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
public class SendSuccessRestResponse {
|
public class SendSucRestResponse {
|
||||||
|
|
||||||
//private HttpStatus status;
|
private String resultCode="0"; // 성공 코드
|
||||||
// private String resultCode; // 성공 코드
|
|
||||||
|
|
||||||
// private String message; // 메세지
|
|
||||||
|
|
||||||
private String msgGroupId; // 문자 전송 그룹 아이디
|
private String msgGroupId; // 문자 전송 그룹 아이디
|
||||||
|
|
||||||
@ -32,11 +29,8 @@ public class SendSuccessRestResponse {
|
|||||||
|
|
||||||
private String msgType; // 메세지 타입
|
private String msgType; // 메세지 타입
|
||||||
|
|
||||||
// private LocalDateTime localDateTime;
|
private String test_yn; // 메세지 타입
|
||||||
|
|
||||||
/*
|
|
||||||
* 200-OK : 정상접속
|
|
||||||
* */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,14 +38,15 @@ public class SendSuccessRestResponse {
|
|||||||
* @param mjonResponseVO
|
* @param mjonResponseVO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static SendSuccessRestResponse convertMjonDataToApiResponse(MjonResponseVO mjonResponseVO) {
|
public static SendSucRestResponse convertMjonDataToApiResponse(MjonResponseVO mjonResponseVO) {
|
||||||
|
|
||||||
|
|
||||||
return SendSuccessRestResponse.builder()
|
return SendSucRestResponse.builder()
|
||||||
|
.resultCode("0")
|
||||||
.msgGroupId(mjonResponseVO.getMsgGroupId()) // 전송 메세지 그룹 ID
|
.msgGroupId(mjonResponseVO.getMsgGroupId()) // 전송 메세지 그룹 ID
|
||||||
.successCnt(mjonResponseVO.getResultSts()) // 성공 건수
|
.successCnt(mjonResponseVO.getResultSts()) // 성공 건수
|
||||||
.blockCnt(mjonResponseVO.getResultBlockSts()) // 수신거부 건수
|
.blockCnt(mjonResponseVO.getResultBlockSts()) // 수신거부 건수
|
||||||
// .localDateTime(LocalDateTime.now()) // 현재 시간
|
.failCnt("0")
|
||||||
.msgType(StatMsg.valueOf("msgType"+mjonResponseVO.getMsgType()).getMsg())
|
.msgType(StatMsg.valueOf("msgType"+mjonResponseVO.getMsgType()).getMsg())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@ -62,7 +57,7 @@ public class SendSuccessRestResponse {
|
|||||||
* @param mjonResponseVOList
|
* @param mjonResponseVOList
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static SendSuccessRestResponse SendSuccessMsgsRestResponse(List<MjonResponseVO> mjonResponseVOList) {
|
public static SendSucRestResponse SendSuccessMsgsRestResponse(List<MjonResponseVO> mjonResponseVOList) {
|
||||||
|
|
||||||
// 실패 카운트
|
// 실패 카운트
|
||||||
int failCnt = (int) mjonResponseVOList.stream()
|
int failCnt = (int) mjonResponseVOList.stream()
|
||||||
@ -89,9 +84,8 @@ public class SendSuccessRestResponse {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
return SendSuccessRestResponse.builder()
|
return SendSucRestResponse.builder()
|
||||||
// .resultCode(StatMsg.valueOf(enumStr).getCode()) // 성공 코드 200 - StatMsg 참고
|
.resultCode(StatMsg.valueOf("STAT_0").getCode()) // 성공 코드 0 - StatMsg 참고
|
||||||
// .message(StatMsg.valueOf(enumStr).getMsg()) // 성공은 message가 없음 - StatMsg 참고
|
|
||||||
.msgGroupIdList(msgGroupIdList) // 전송 메세지 그룹 ID
|
.msgGroupIdList(msgGroupIdList) // 전송 메세지 그룹 ID
|
||||||
.successCnt(Integer.toString(successCnt)) // 성공 건수
|
.successCnt(Integer.toString(successCnt)) // 성공 건수
|
||||||
.blockCnt(Integer.toString(blockCnt)) // 수신거부 건수
|
.blockCnt(Integer.toString(blockCnt)) // 수신거부 건수
|
||||||
@ -2,6 +2,7 @@ package com.itn.mjonApi.mjon.api.inqry.service.impl;
|
|||||||
|
|
||||||
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
import com.itn.mjonApi.cmn.msg.SendFailRestResponse;
|
||||||
import com.itn.mjonApi.mjon.api.inqry.mapper.HstryMapper;
|
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.HstryService;
|
||||||
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryDetailVO;
|
import com.itn.mjonApi.mjon.api.inqry.service.mapper.domain.HstryDetailVO;
|
||||||
@ -209,7 +210,7 @@ public class HstryServiceImpl implements HstryService {
|
|||||||
}else{
|
}else{
|
||||||
// 실패 코드 중 랜덤으로 리턴
|
// 실패 코드 중 랜덤으로 리턴
|
||||||
// return new RestResponse(StatMsg.randomErrorStatCode());
|
// return new RestResponse(StatMsg.randomErrorStatCode());
|
||||||
return new RestResponse("STAT_3099");
|
return new RestResponse(new SendFailRestResponse("STAT_3099"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private RestResponse _getTestHstryListReturnData(String testYn)
|
private RestResponse _getTestHstryListReturnData(String testYn)
|
||||||
@ -236,7 +237,7 @@ public class HstryServiceImpl implements HstryService {
|
|||||||
}else{
|
}else{
|
||||||
// 실패 코드 중 랜덤으로 리턴
|
// 실패 코드 중 랜덤으로 리턴
|
||||||
// return new RestResponse(StatMsg.randomErrorStatCode());
|
// return new RestResponse(StatMsg.randomErrorStatCode());
|
||||||
return new RestResponse("STAT_3099");
|
return new RestResponse(new SendFailRestResponse("STAT_3099"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,8 @@ package com.itn.mjonApi.mjon.api.send.service.impl;
|
|||||||
|
|
||||||
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
import com.itn.mjonApi.cmn.msg.SendSuccessRestResponse;
|
import com.itn.mjonApi.cmn.msg.SendFailRestResponse;
|
||||||
|
import com.itn.mjonApi.cmn.msg.SendSucRestResponse;
|
||||||
import com.itn.mjonApi.cmn.msg.StatMsg;
|
import com.itn.mjonApi.cmn.msg.StatMsg;
|
||||||
import com.itn.mjonApi.mjon.api.send.mapper.SendMapper;
|
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.MjonResponseVO;
|
||||||
@ -99,7 +100,7 @@ public class SendServiceImpl implements SendService {
|
|||||||
|
|
||||||
// convertMjonDataToApiResponse => MjonResponseVO 데이터를 ApiResponse 데이터로 변환하는 메소드
|
// convertMjonDataToApiResponse => MjonResponseVO 데이터를 ApiResponse 데이터로 변환하는 메소드
|
||||||
if(!munjaSendResponse.getResult().equals("fail")){ // 성공
|
if(!munjaSendResponse.getResult().equals("fail")){ // 성공
|
||||||
return new RestResponse(SendSuccessRestResponse.convertMjonDataToApiResponse(munjaSendResponse));
|
return new RestResponse(SendSucRestResponse.convertMjonDataToApiResponse(munjaSendResponse));
|
||||||
}else{ // 실패
|
}else{ // 실패
|
||||||
return new RestResponse(this.convertMjonDataToApiResponse(munjaSendResponse));
|
return new RestResponse(this.convertMjonDataToApiResponse(munjaSendResponse));
|
||||||
}
|
}
|
||||||
@ -118,10 +119,13 @@ public class SendServiceImpl implements SendService {
|
|||||||
if("YF".equals(testYn))
|
if("YF".equals(testYn))
|
||||||
{
|
{
|
||||||
// 실패 코드 중 랜덤으로 리턴
|
// 실패 코드 중 랜덤으로 리턴
|
||||||
return new RestResponse(StatMsg.randomErrorStatCode());
|
return new RestResponse(new SendFailRestResponse(StatMsg.randomErrorStatCode()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
return new RestResponse(
|
return new RestResponse(
|
||||||
SendSuccessRestResponse.builder()
|
SendSucRestResponse.builder()
|
||||||
.msgGroupId("MSGGID_0000000000000") // 전송 메세지 그룹 ID
|
.msgGroupId("MSGGID_0000000000000") // 전송 메세지 그룹 ID
|
||||||
.successCnt("5") // 성공 건수
|
.successCnt("5") // 성공 건수
|
||||||
.blockCnt("2") // 수신거부 건수
|
.blockCnt("2") // 수신거부 건수
|
||||||
@ -137,16 +141,24 @@ public class SendServiceImpl implements SendService {
|
|||||||
// YF => 실패 테스트 데이터
|
// YF => 실패 테스트 데이터
|
||||||
if("YF".equals(testYn))
|
if("YF".equals(testYn))
|
||||||
{
|
{
|
||||||
// 실패 코드 중 랜덤으로 리턴
|
return new RestResponse(new SendFailRestResponse(StatMsg.randomErrorStatCode()));
|
||||||
return new RestResponse(StatMsg.randomErrorStatCode());
|
}else{ // YS => 성공 테스트 데이터
|
||||||
}else{
|
|
||||||
|
|
||||||
|
|
||||||
|
List<String> gIdList = new ArrayList<>();
|
||||||
|
gIdList.add("MSGGID_0000000000000");
|
||||||
|
gIdList.add("MSGGID_0000000000001");
|
||||||
|
gIdList.add("MSGGID_0000000000002");
|
||||||
|
|
||||||
return new RestResponse(
|
return new RestResponse(
|
||||||
SendSuccessRestResponse.builder()
|
SendSucRestResponse.builder()
|
||||||
.msgGroupId("MSGGID_0000000000000") // 전송 메세지 그룹 ID
|
.msgGroupIdList(gIdList) // 전송 메세지 그룹 ID
|
||||||
.successCnt("5") // 성공 건수
|
.successCnt("2") // 성공 건수
|
||||||
.blockCnt("2") // 수신거부 건수
|
.blockCnt("1") // 수신거부 건수
|
||||||
.msgType("LMS")
|
.msgType("LMS")
|
||||||
.failCnt("0")
|
.failCnt("0")
|
||||||
|
.test_yn("YS")
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -206,17 +218,17 @@ public class SendServiceImpl implements SendService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new RestResponse(SendSuccessRestResponse.SendSuccessMsgsRestResponse(mjonResponseVOList));
|
return new RestResponse(SendSucRestResponse.SendSuccessMsgsRestResponse(mjonResponseVOList));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RestResponse callToErrorReturnData(MsgRequestVO msgRequestVO) {
|
private static RestResponse callToErrorReturnData(MsgRequestVO msgRequestVO) {
|
||||||
RestResponse restResponse = new RestResponse("STAT_1020");
|
|
||||||
|
|
||||||
String errorMsg = restResponse.getData().toString();
|
SendFailRestResponse stat1020 = new SendFailRestResponse("STAT_1020");
|
||||||
|
String errorMsg = stat1020.getMsg();
|
||||||
errorMsg.replace("수신자", "수신자(" + msgRequestVO.getCallToList()[0] + ")");
|
errorMsg.replace("수신자", "수신자(" + msgRequestVO.getCallToList()[0] + ")");
|
||||||
restResponse.setData(errorMsg);
|
stat1020.setMsg(errorMsg);
|
||||||
|
|
||||||
return restResponse;
|
return new RestResponse(stat1020);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.itn.mjonApi.mjon.log.service.mapper;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.mjon.log.service.mapper.domain.LettnApiSendMsgLogVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface LettnApiSendMsgLogMapper {
|
||||||
|
|
||||||
|
int insert(LettnApiSendMsgLogVO lettnApiSendMsgLogVO);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,10 +4,7 @@ package com.itn.mjonApi.mjon.log.service.mapper.domain;
|
|||||||
comment : '내문자 보관함';
|
comment : '내문자 보관함';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.*;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -15,16 +12,14 @@ import java.io.Serializable;
|
|||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
public class LettnApiSendMsgLogVO implements Serializable {
|
public class LettnApiSendMsgLogVO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String LOG_NO; // access log 고유번호
|
private String logNo; // access log 고유번호
|
||||||
private String MBER_ID; // 일반회원ID
|
private String mberId; // 일반회원ID
|
||||||
private String MSG_GROUP_ID; // 문자 그룹 ID
|
private String msgSendType; // 문자 : msg 대량문자 : msgs
|
||||||
private String REQ_REGIST_PNTTM; // 요청등록일시
|
private String msgGroupId; // 문자 그룹 ID
|
||||||
private String REQ_REGISTER_ID; // 요청등록자ID
|
|
||||||
private String RES_UPDT_PNTTM; // 응답수정일시
|
|
||||||
private String RES_UPDUSR_ID;//응답수정자ID
|
|
||||||
|
|
||||||
}
|
}
|
||||||
55
src/main/resources/mapper/log/LettnApiSendMsgLog.xml
Normal file
55
src/main/resources/mapper/log/LettnApiSendMsgLog.xml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.itn.mjonApi.mjon.log.service.mapper.LettnApiSendMsgLogMapper">
|
||||||
|
|
||||||
|
<!-- 공통 테이블 명 -->
|
||||||
|
<sql id="table_name">
|
||||||
|
lettngnrlmber_api_send_msg_log
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- select용 공통 컬럼 명 -->
|
||||||
|
<sql id="select_column_name">
|
||||||
|
|
||||||
|
LOG_NO
|
||||||
|
, MBER_ID
|
||||||
|
, MSG_SEND_TYPE
|
||||||
|
, MSG_GROUP_ID
|
||||||
|
, REQ_REGIST_PNTTM
|
||||||
|
, REQ_REGISTER_ID
|
||||||
|
, RES_UPDT_PNTTM
|
||||||
|
, RES_UPDUSR_ID
|
||||||
|
|
||||||
|
</sql>
|
||||||
|
<!-- 저장용 공통 컬럼 명 -->
|
||||||
|
<sql id="insert_column_name">
|
||||||
|
|
||||||
|
LOG_NO
|
||||||
|
, MBER_ID
|
||||||
|
, MSG_SEND_TYPE
|
||||||
|
, MSG_GROUP_ID
|
||||||
|
, REQ_REGIST_PNTTM
|
||||||
|
, REQ_REGISTER_ID
|
||||||
|
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- access_key 정보 등록 C -->
|
||||||
|
<insert id="insert">
|
||||||
|
INSERT INTO <include refid="table_name"/> (
|
||||||
|
<include refid="insert_column_name"/>
|
||||||
|
)
|
||||||
|
VALUE (
|
||||||
|
#{logNo}
|
||||||
|
, #{mberId}
|
||||||
|
, #{msgSendType}
|
||||||
|
, #{msgGroupId}
|
||||||
|
, now()
|
||||||
|
, #{mberId}
|
||||||
|
)
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user