feat: RestResponse 수정 Ref : https://wildeveloperetrain.tistory.com/240 2-2 방식으로
This commit is contained in:
parent
0dc0bb0773
commit
2508460283
6
pom.xml
6
pom.xml
@ -122,6 +122,12 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains</groupId>
|
||||||
|
<artifactId>annotations</artifactId>
|
||||||
|
<version>16.0.1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -4,9 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
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.FailRestResponse;
|
|
||||||
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.mjon.api.send.mapper.domain.MsgRequestVO;
|
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||||
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.domain.LettnAccessLogVO;
|
import com.itn.mjonApi.mjon.log.service.mapper.domain.LettnAccessLogVO;
|
||||||
@ -104,18 +102,7 @@ public class SendAspect {
|
|||||||
|
|
||||||
RestResponse restResponse = (RestResponse) returnValue;
|
RestResponse restResponse = (RestResponse) returnValue;
|
||||||
|
|
||||||
// TODO :: 성공 실패에 따른 로그 처리 예정
|
|
||||||
if(restResponse.getObject().toString().indexOf("SendSuccessRestResponse") > -1){
|
|
||||||
log.info(" :: SendSuccessRestResponse :: ");
|
|
||||||
|
|
||||||
SendSuccessRestResponse sendSuccessRestResponse = (SendSuccessRestResponse) restResponse.getObject();
|
|
||||||
resutlCode = sendSuccessRestResponse.getResultCode();
|
|
||||||
}else{
|
|
||||||
log.info(" :: FailRestResponse :: ");
|
|
||||||
|
|
||||||
FailRestResponse failRestResponse = (FailRestResponse) restResponse.getObject();
|
|
||||||
resutlCode = failRestResponse.getResultCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
// lettngnrlmber_access_log 응답값 Udpate
|
// lettngnrlmber_access_log 응답값 Udpate
|
||||||
LettnAccessLogVO lettnAccessLogVO = new LettnAccessLogVO()
|
LettnAccessLogVO lettnAccessLogVO = new LettnAccessLogVO()
|
||||||
|
|||||||
@ -1,65 +0,0 @@
|
|||||||
package com.itn.mjonApi.cmn.msg;
|
|
||||||
|
|
||||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class FailRestResponse {
|
|
||||||
|
|
||||||
//private HttpStatus status;
|
|
||||||
private String resultCode;
|
|
||||||
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 200-OK : 정상접속
|
|
||||||
* 401-Unauthorized : 인증실패
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
|
|
||||||
|
|
||||||
public static FailRestResponse getSendFailResponse(String resultCode) {
|
|
||||||
FailRestResponse sendFailResponse = new FailRestResponse();
|
|
||||||
sendFailResponse.setResultCode(StatMsg.valueOf(resultCode).getCode());
|
|
||||||
sendFailResponse.setMessage(StatMsg.valueOf(resultCode).getMsg());
|
|
||||||
|
|
||||||
return sendFailResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MjonResponseVO -> 변환 -> SendFailRestResponse
|
|
||||||
* @param mjonResponseVO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static FailRestResponse convertMjonDataToApiResponse(MjonResponseVO mjonResponseVO) {
|
|
||||||
String result = mjonResponseVO.getResult();
|
|
||||||
String message = mjonResponseVO.getMessage();
|
|
||||||
String enumStr = "";
|
|
||||||
switch (result) {
|
|
||||||
case "statusFail" : enumStr = "1070"; // 회원 정지
|
|
||||||
break;
|
|
||||||
case "smsLengFail" : enumStr = "1080"; // 문자 길이 초과
|
|
||||||
break;
|
|
||||||
case "fail" : // 문자온 프로젝트에서 result가 fail로 다양한 에러가 리턴하여 분기처리함
|
|
||||||
if(message.indexOf("문자 치환 후 전송 문자 길이를 초과하였습니다.")>-1)
|
|
||||||
enumStr = "1050"; // 치환 후 문자 길이 초과
|
|
||||||
if(message.indexOf("치환문자 데이터가 없습니다")>-1)
|
|
||||||
enumStr = "1040"; // 치환 데이터 오류
|
|
||||||
if(message.indexOf("치환 후 전송 문자 길이를 초과")>-1)
|
|
||||||
enumStr = "1050"; // 치환 데이터 오류
|
|
||||||
break;
|
|
||||||
default: enumStr = "1099"; // 기타 시스템 오류
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getSendFailResponse(enumStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,53 +1,63 @@
|
|||||||
package com.itn.mjonApi.cmn.msg;
|
package com.itn.mjonApi.cmn.msg;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.Getter;
|
||||||
import org.springframework.http.HttpStatus;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
public class RestResponse{
|
public class RestResponse{
|
||||||
|
|
||||||
//private HttpStatus status;
|
private String resultCode = "0";
|
||||||
private int resultCode;
|
|
||||||
|
|
||||||
private String message;
|
private Object data;
|
||||||
|
|
||||||
private LocalDateTime localDateTime;
|
private LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
|
|
||||||
private Object object;
|
/**
|
||||||
|
* 성공 생성자
|
||||||
|
* 성공은 resultCode = 0
|
||||||
|
*/
|
||||||
|
public RestResponse(Object 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();
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* 200-OK : 정상접속
|
|
||||||
* 401-Unauthorized : 인증실패
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
|
|
||||||
public RestResponse(HttpStatus status, String message, LocalDateTime timestamp) {
|
public RestResponse(HttpStatus status, String message, LocalDateTime timestamp) {
|
||||||
|
|
||||||
this.resultCode = status.value();
|
this.resultCode = status.value();
|
||||||
checkMessage(status, message);
|
checkMessage(status, message);
|
||||||
this.localDateTime = timestamp;
|
this.localDateTime = timestamp;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
public RestResponse(HttpStatus status, String message, LocalDateTime timestamp, Object object) {
|
public RestResponse(HttpStatus status, String message, LocalDateTime timestamp, Object object) {
|
||||||
this.resultCode = status.value();
|
this.resultCode = status.value();
|
||||||
checkMessage(status, message);
|
checkMessage(status, message);
|
||||||
this.object= object;
|
this.data = object;
|
||||||
this.localDateTime = timestamp;
|
this.localDateTime = timestamp;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public RestResponse(HttpStatus status, String message, LocalDateTime timestamp, List<?> objectList) {
|
/* public RestResponse(HttpStatus status, String message, LocalDateTime timestamp, List<?> objectList) {
|
||||||
this.resultCode = status.value();
|
this.resultCode = status.value();
|
||||||
checkMessage(status, message);
|
checkMessage(status, message);
|
||||||
|
|
||||||
this.localDateTime = timestamp;
|
this.localDateTime = timestamp;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
private void checkMessage(HttpStatus status, String message) {
|
/*private void checkMessage(HttpStatus status, String message) {
|
||||||
if ("".equals(message)){ this.message = status.name();
|
if ("".equals(message)){ this.message = status.name();
|
||||||
}else { this.message = message; }
|
}else { this.message = message; }
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
|||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -17,9 +16,9 @@ import java.util.stream.Collectors;
|
|||||||
public class SendSuccessRestResponse {
|
public class SendSuccessRestResponse {
|
||||||
|
|
||||||
//private HttpStatus status;
|
//private HttpStatus status;
|
||||||
private String resultCode; // 성공 코드
|
// private String resultCode; // 성공 코드
|
||||||
|
|
||||||
private String message; // 메세지
|
// private String message; // 메세지
|
||||||
|
|
||||||
private String msgGroupId; // 문자 전송 그룹 아이디
|
private String msgGroupId; // 문자 전송 그룹 아이디
|
||||||
|
|
||||||
@ -33,7 +32,7 @@ public class SendSuccessRestResponse {
|
|||||||
|
|
||||||
private String msgType; // 메세지 타입
|
private String msgType; // 메세지 타입
|
||||||
|
|
||||||
private LocalDateTime localDateTime;
|
// private LocalDateTime localDateTime;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 200-OK : 정상접속
|
* 200-OK : 정상접속
|
||||||
@ -45,16 +44,14 @@ public class SendSuccessRestResponse {
|
|||||||
* @param mjonResponseVO
|
* @param mjonResponseVO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static SendSuccessRestResponse convertMjonDataToApiResponse(MjonResponseVO mjonResponseVO, String STAT_CODE) {
|
public static SendSuccessRestResponse convertMjonDataToApiResponse(MjonResponseVO mjonResponseVO) {
|
||||||
|
|
||||||
|
|
||||||
return SendSuccessRestResponse.builder()
|
return SendSuccessRestResponse.builder()
|
||||||
.resultCode(StatMsg.valueOf(STAT_CODE).getCode()) // 성공 코드 200 - StatMsg 참고
|
|
||||||
.message(StatMsg.valueOf(STAT_CODE).getMsg()) // 성공은 message가 없음 - StatMsg 참고
|
|
||||||
.msgGroupId(mjonResponseVO.getMsgGroupId()) // 전송 메세지 그룹 ID
|
.msgGroupId(mjonResponseVO.getMsgGroupId()) // 전송 메세지 그룹 ID
|
||||||
.successCnt(mjonResponseVO.getResultSts()) // 성공 건수
|
.successCnt(mjonResponseVO.getResultSts()) // 성공 건수
|
||||||
.blockCnt(mjonResponseVO.getResultBlockSts()) // 수신거부 건수
|
.blockCnt(mjonResponseVO.getResultBlockSts()) // 수신거부 건수
|
||||||
.localDateTime(LocalDateTime.now()) // 현재 시간
|
// .localDateTime(LocalDateTime.now()) // 현재 시간
|
||||||
.msgType(StatMsg.valueOf("msgType"+mjonResponseVO.getMsgType()).getMsg())
|
.msgType(StatMsg.valueOf("msgType"+mjonResponseVO.getMsgType()).getMsg())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@ -99,7 +96,7 @@ public class SendSuccessRestResponse {
|
|||||||
.successCnt(Integer.toString(successCnt)) // 성공 건수
|
.successCnt(Integer.toString(successCnt)) // 성공 건수
|
||||||
.blockCnt(Integer.toString(blockCnt)) // 수신거부 건수
|
.blockCnt(Integer.toString(blockCnt)) // 수신거부 건수
|
||||||
.failCnt(Integer.toString(failCnt)) // 수신거부 건수
|
.failCnt(Integer.toString(failCnt)) // 수신거부 건수
|
||||||
.localDateTime(LocalDateTime.now()) // 현재 시간
|
// .localDateTime(LocalDateTime.now()) // 현재 시간
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,11 @@ package com.itn.mjonApi.cmn.msg;
|
|||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* packageName : com.itn.mjonApi.cmn.msg
|
* packageName : com.itn.mjonApi.cmn.msg
|
||||||
* fileName : statMsg
|
* fileName : statMsg
|
||||||
@ -35,7 +40,7 @@ public enum StatMsg {
|
|||||||
, STAT_1060("1060","발송 비용 부족")
|
, STAT_1060("1060","발송 비용 부족")
|
||||||
, STAT_1070("1070","서비스 이용 정지 회원")
|
, STAT_1070("1070","서비스 이용 정지 회원")
|
||||||
, STAT_1080("1080","문자 길이 초과")
|
, STAT_1080("1080","문자 길이 초과")
|
||||||
, STAT_1090("1090","요청 발송일시에 발송 불가")
|
, STAT_1090("1090","요청 발송일시에 발송 불가") // 아직 사용 안함
|
||||||
, STAT_1099("1099","기타 시스템 오류")
|
, STAT_1099("1099","기타 시스템 오류")
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
@ -43,9 +48,6 @@ public enum StatMsg {
|
|||||||
, msgType6("장문","LMS")
|
, msgType6("장문","LMS")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
@ -56,4 +58,21 @@ public enum StatMsg {
|
|||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Random을 만들기 위한 코드
|
||||||
|
private static final List<StatMsg> VALUES = Collections.unmodifiableList(Arrays.asList(values()));
|
||||||
|
private static final int SIZE = VALUES.size();
|
||||||
|
private static final Random RANDOM = new Random();
|
||||||
|
public static String randomErrorStatCode() {
|
||||||
|
String errorCode = "";
|
||||||
|
while(true){
|
||||||
|
errorCode = VALUES.get(RANDOM.nextInt(SIZE)).getCode();
|
||||||
|
if(errorCode.length() > 3){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "STAT_"+errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,10 +5,8 @@ import com.itn.mjonApi.mjon.api.access.mapper.AccessKeyMapper;
|
|||||||
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.access.service.AccessKeyService;
|
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -21,20 +19,23 @@ public class AccessKeyServiceImpl implements AccessKeyService {
|
|||||||
@Override
|
@Override
|
||||||
public RestResponse insert(AccessKeyVO accessKeyVO) {
|
public RestResponse insert(AccessKeyVO accessKeyVO) {
|
||||||
int i_ret = accessKeyMapper.insert(accessKeyVO);
|
int i_ret = accessKeyMapper.insert(accessKeyVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
return null;
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse selectR(AccessKeyVO accessKeyVO) {
|
public RestResponse selectR(AccessKeyVO accessKeyVO) {
|
||||||
AccessKeyVO MyMsgListVO = accessKeyMapper.selectR(accessKeyVO);
|
AccessKeyVO MyMsgListVO = accessKeyMapper.selectR(accessKeyVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
return null;
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse selectL(AccessKeyVO accessKeyVO) {
|
public RestResponse selectL(AccessKeyVO accessKeyVO) {
|
||||||
List<AccessKeyVO> MyMsgListVO = accessKeyMapper.selectL(accessKeyVO);
|
List<AccessKeyVO> MyMsgListVO = accessKeyMapper.selectL(accessKeyVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
return null;
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -56,12 +57,14 @@ public class AccessKeyServiceImpl implements AccessKeyService {
|
|||||||
@Override
|
@Override
|
||||||
public RestResponse update(AccessKeyVO accessKeyVO) {
|
public RestResponse update(AccessKeyVO accessKeyVO) {
|
||||||
int i_ret = accessKeyMapper.update(accessKeyVO);
|
int i_ret = accessKeyMapper.update(accessKeyVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
return null;
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse delete(AccessKeyVO accessKeyVO) {
|
public RestResponse delete(AccessKeyVO accessKeyVO) {
|
||||||
int i_ret = accessKeyMapper.delete(accessKeyVO);
|
int i_ret = accessKeyMapper.delete(accessKeyVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
return null;
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +1,14 @@
|
|||||||
package com.itn.mjonApi.mjon.api.access.service.impl;
|
package com.itn.mjonApi.mjon.api.access.service.impl;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO;
|
|
||||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
import com.itn.mjonApi.mjon.api.access.service.AccessTokenService;
|
|
||||||
import com.itn.mjonApi.mjon.api.access.mapper.AccessTokenMapper;
|
import com.itn.mjonApi.mjon.api.access.mapper.AccessTokenMapper;
|
||||||
|
import com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO;
|
||||||
|
import com.itn.mjonApi.mjon.api.access.service.AccessTokenService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class AccessTokenServiceImpl implements AccessTokenService {
|
public class AccessTokenServiceImpl implements AccessTokenService {
|
||||||
@ -23,26 +20,30 @@ public class AccessTokenServiceImpl implements AccessTokenService {
|
|||||||
@Override
|
@Override
|
||||||
public RestResponse findAll() {
|
public RestResponse findAll() {
|
||||||
List<IdgenVO> MyMsgListVO = accessTokenMapper.findAll();
|
List<IdgenVO> MyMsgListVO = accessTokenMapper.findAll();
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
return new RestResponse(MyMsgListVO);
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse insert(AccessKeyVO accessKeyVO) {
|
public RestResponse insert(AccessKeyVO accessKeyVO) {
|
||||||
int i_ret = accessTokenMapper.insert(accessKeyVO);
|
int i_ret = accessTokenMapper.insert(accessKeyVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
return null;
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse selectR(AccessKeyVO accessKeyVO) {
|
public RestResponse selectR(AccessKeyVO accessKeyVO) {
|
||||||
AccessKeyVO MyMsgListVO = accessTokenMapper.selectR(accessKeyVO);
|
AccessKeyVO MyMsgListVO = accessTokenMapper.selectR(accessKeyVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
return new RestResponse(MyMsgListVO);
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse selectL(AccessKeyVO accessKeyVO) {
|
public RestResponse selectL(AccessKeyVO accessKeyVO) {
|
||||||
List<AccessKeyVO> MyMsgListVO = accessTokenMapper.selectL(accessKeyVO);
|
List<AccessKeyVO> MyMsgListVO = accessTokenMapper.selectL(accessKeyVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
return new RestResponse(MyMsgListVO);
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -64,12 +65,14 @@ public class AccessTokenServiceImpl implements AccessTokenService {
|
|||||||
@Override
|
@Override
|
||||||
public RestResponse update(AccessKeyVO accessKeyVO) {
|
public RestResponse update(AccessKeyVO accessKeyVO) {
|
||||||
int i_ret = accessTokenMapper.update(accessKeyVO);
|
int i_ret = accessTokenMapper.update(accessKeyVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
return null;
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse delete(AccessKeyVO accessKeyVO) {
|
public RestResponse delete(AccessKeyVO accessKeyVO) {
|
||||||
int i_ret = accessTokenMapper.delete(accessKeyVO);
|
int i_ret = accessTokenMapper.delete(accessKeyVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
return null;
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,17 +2,14 @@ package com.itn.mjonApi.mjon.api.access.web;
|
|||||||
|
|
||||||
import com.itn.mjonApi.cmn.msg.PlainResponse;
|
import com.itn.mjonApi.cmn.msg.PlainResponse;
|
||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
import com.itn.mjonApi.mjon.api.access.mapper.domain.SendMsgVO;
|
||||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||||
import com.itn.mjonApi.mjon.api.access.service.AccessTokenService;
|
import com.itn.mjonApi.mjon.api.access.service.AccessTokenService;
|
||||||
import com.itn.mjonApi.mjon.api.access.mapper.domain.SendMsgVO;
|
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author User
|
* @author User
|
||||||
*
|
*
|
||||||
@ -40,13 +37,14 @@ public class AccessKeyRestController {
|
|||||||
SendMsgVO sendMsgVO
|
SendMsgVO sendMsgVO
|
||||||
){
|
){
|
||||||
|
|
||||||
return ResponseEntity.ok(
|
return null;
|
||||||
|
/* return ResponseEntity.ok(
|
||||||
new RestResponse(
|
new RestResponse(
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
, HttpStatus.OK.getReasonPhrase()
|
, HttpStatus.OK.getReasonPhrase()
|
||||||
, LocalDateTime.now()
|
, LocalDateTime.now()
|
||||||
)
|
)
|
||||||
);
|
);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -94,6 +92,8 @@ public class AccessKeyRestController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
/*
|
||||||
return ResponseEntity.ok(
|
return ResponseEntity.ok(
|
||||||
new RestResponse(
|
new RestResponse(
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
@ -101,7 +101,7 @@ public class AccessKeyRestController {
|
|||||||
, LocalDateTime.now()
|
, LocalDateTime.now()
|
||||||
, "grp100"
|
, "grp100"
|
||||||
)
|
)
|
||||||
);
|
); */
|
||||||
|
|
||||||
//AccessKeyVO
|
//AccessKeyVO
|
||||||
}
|
}
|
||||||
@ -149,14 +149,15 @@ public class AccessKeyRestController {
|
|||||||
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
||||||
// 1060
|
// 1060
|
||||||
|
|
||||||
return this.MakePlainResponseResult(
|
return null;
|
||||||
new PlainResponse(
|
// return this.MakePlainResponseResult(
|
||||||
HttpStatus.OK
|
// new PlainResponse(
|
||||||
, ""
|
// HttpStatus.OK
|
||||||
, LocalDateTime.now()
|
// , ""
|
||||||
)
|
// , LocalDateTime.now()
|
||||||
, "grp100"
|
// )
|
||||||
);
|
// , "grp100"
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -198,14 +199,15 @@ public class AccessKeyRestController {
|
|||||||
jsonObject.put("LMS", "30");
|
jsonObject.put("LMS", "30");
|
||||||
jsonObject.put("MMS", "20");
|
jsonObject.put("MMS", "20");
|
||||||
|
|
||||||
return ResponseEntity.ok(
|
return null;
|
||||||
new RestResponse(
|
// return ResponseEntity.ok(
|
||||||
HttpStatus.OK
|
// new RestResponse(
|
||||||
, ""
|
// HttpStatus.OK
|
||||||
, LocalDateTime.now()
|
// , ""
|
||||||
, jsonObject
|
// , LocalDateTime.now()
|
||||||
)
|
// , jsonObject
|
||||||
);
|
// )
|
||||||
|
// );
|
||||||
|
|
||||||
//AccessKeyVO
|
//AccessKeyVO
|
||||||
}
|
}
|
||||||
@ -239,14 +241,15 @@ public class AccessKeyRestController {
|
|||||||
//step1.잔액 확인 여부 체크
|
//step1.잔액 확인 여부 체크
|
||||||
// 5010
|
// 5010
|
||||||
|
|
||||||
return this.MakePlainResponseResult(
|
return null;
|
||||||
new PlainResponse(
|
// return this.MakePlainResponseResult(
|
||||||
HttpStatus.OK
|
// new PlainResponse(
|
||||||
, ""
|
// HttpStatus.OK
|
||||||
, LocalDateTime.now()
|
// , ""
|
||||||
)
|
// , LocalDateTime.now()
|
||||||
, "50|30|20"
|
// )
|
||||||
);
|
// , "50|30|20"
|
||||||
|
// );
|
||||||
|
|
||||||
//AccessKeyVO
|
//AccessKeyVO
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,6 +115,7 @@ public class MsgRequestVO implements Serializable {
|
|||||||
@ApiModelProperty(value = "문자 종류 일반:N, 광고:A, 선거:C", example = "N", hidden = true)
|
@ApiModelProperty(value = "문자 종류 일반:N, 광고:A, 선거:C", example = "N", hidden = true)
|
||||||
private String msgKind="N"; // '문자 종류 일반:N, 광고:A, 선거:C',
|
private String msgKind="N"; // '문자 종류 일반:N, 광고:A, 선거:C',
|
||||||
|
|
||||||
|
private String test_yn; // 테스트 여부
|
||||||
|
|
||||||
|
|
||||||
// private String msgId ;// '문자ID',
|
// private String msgId ;// '문자ID',
|
||||||
|
|||||||
@ -117,6 +117,7 @@ public class MsgsRequestVO implements Serializable {
|
|||||||
@ApiModelProperty(value = "문자 종류 일반:N, 광고:A, 선거:C", example = "N", hidden = true)
|
@ApiModelProperty(value = "문자 종류 일반:N, 광고:A, 선거:C", example = "N", hidden = true)
|
||||||
private String msgKind = "N"; // '문자 종류 일반:N, 광고:A, 선거:C',
|
private String msgKind = "N"; // '문자 종류 일반:N, 광고:A, 선거:C',
|
||||||
|
|
||||||
|
private String test_yn; // 테스트 여부
|
||||||
|
|
||||||
// 수신자 발송txt 각각 _1~_100
|
// 수신자 발송txt 각각 _1~_100
|
||||||
// 교차로 있어야 로직이 가능함
|
// 교차로 있어야 로직이 가능함
|
||||||
|
|||||||
@ -3,12 +3,11 @@ package com.itn.mjonApi.mjon.api.send.service;
|
|||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgsRequestVO;
|
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgsRequestVO;
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
|
|
||||||
public interface SendService {
|
public interface SendService {
|
||||||
|
|
||||||
|
|
||||||
RestResponse sendMsgData(MsgRequestVO msgRequestVO) throws Exception;
|
RestResponse sendMsgData(MsgRequestVO msgRequestVO) throws Exception;
|
||||||
|
|
||||||
ResponseEntity<?> sendMsgsData(MsgsRequestVO msgsRequestVO) throws Exception;
|
RestResponse sendMsgsData(MsgsRequestVO msgsRequestVO) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package com.itn.mjonApi.mjon.api.send.service.impl;
|
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.FailRestResponse;
|
|
||||||
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.SendSuccessRestResponse;
|
||||||
|
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;
|
||||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||||
@ -15,13 +15,10 @@ import org.apache.catalina.connector.Response;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -49,19 +46,23 @@ public class SendServiceImpl implements SendService {
|
|||||||
@Override
|
@Override
|
||||||
public RestResponse sendMsgData(MsgRequestVO msgRequestVO) throws Exception {
|
public RestResponse sendMsgData(MsgRequestVO msgRequestVO) throws Exception {
|
||||||
|
|
||||||
|
if(StringUtils.isNotEmpty(msgRequestVO.getTest_yn())){
|
||||||
|
// YF => 실패 테스트 데이터
|
||||||
|
return this._getTestReturnData(msgRequestVO.getTest_yn());
|
||||||
|
}
|
||||||
//sendMsg 문자 발송 전 체크 사항
|
//sendMsg 문자 발송 전 체크 사항
|
||||||
|
|
||||||
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||||
// 1010
|
// 1010
|
||||||
if(!sendMapper.findByCallFrom(msgRequestVO)){
|
if(!sendMapper.findByCallFrom(msgRequestVO)){
|
||||||
return new RestResponse(HttpStatus.OK,"", LocalDateTime.now(), _falseRetunDate("STAT_1010"));
|
return new RestResponse("STAT_1010");
|
||||||
}
|
}
|
||||||
|
|
||||||
// step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
// step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||||
// 1020
|
// 1020
|
||||||
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
||||||
if(StringUtils.isNotEmpty(this.getCallToListChk(msgRequestVO))){
|
if(StringUtils.isNotEmpty(this.getCallToListChk(msgRequestVO))){
|
||||||
return new RestResponse(HttpStatus.OK,"", LocalDateTime.now(), _falseRetunDate("STAT_1020"));
|
return new RestResponse("STAT_1020");
|
||||||
}
|
}
|
||||||
|
|
||||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 30분 지연으로 처리됨
|
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 30분 지연으로 처리됨
|
||||||
@ -80,29 +81,13 @@ public class SendServiceImpl implements SendService {
|
|||||||
|
|
||||||
//step4.치환명 정상 여부 확인
|
//step4.치환명 정상 여부 확인
|
||||||
// 1040
|
// 1040
|
||||||
|
|
||||||
// 치환데이터 여부 확인
|
|
||||||
msgRequestVO.setTxtReplYn(this.getTxtReplYn(msgRequestVO));
|
|
||||||
|
|
||||||
if("Y".equals(msgRequestVO.getTxtReplYn())){
|
|
||||||
|
|
||||||
//일괄변환 문자에 콤마(,)가 들어가있으면 배열로 넘길때 문제가 발생하여 특수문자(§)로 치환하여 넘겨주도록 한다.
|
|
||||||
msgRequestVO = this.getReplaceCommaToStrSymbol(msgRequestVO);
|
|
||||||
|
|
||||||
// 치환 후 단문 장문 개수 구하기
|
|
||||||
msgRequestVO = getLengthOfShortAndLongMsg(msgRequestVO);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 치환데이터 여부 확인
|
|
||||||
msgRequestVO.setTxtReplYn(this.getTxtReplYn(msgRequestVO));
|
msgRequestVO.setTxtReplYn(this.getTxtReplYn(msgRequestVO));
|
||||||
// 치환데이터가 있을 경우
|
// 치환데이터가 있을 경우
|
||||||
if("Y".equals(msgRequestVO.getTxtReplYn())){
|
if("Y".equals(msgRequestVO.getTxtReplYn())){
|
||||||
//일괄변환 문자에 콤마(,)가 들어가있으면 배열로 넘길때 문제가 발생하여 특수문자(§)로 치환하여 넘겨주도록 한다.
|
//일괄변환 문자에 콤마(,)가 들어가있으면 배열로 넘길때 문제가 발생하여 특수문자(§)로 치환하여 넘겨주도록 한다.
|
||||||
msgRequestVO = this.getReplaceCommaToStrSymbol(msgRequestVO);
|
msgRequestVO = this.getReplaceCommaToStrSymbol(msgRequestVO);
|
||||||
// 치환 후 단문 장문 개수 구하기
|
// 치환 후 단문 장문 개수 구하기
|
||||||
msgRequestVO = getLengthOfShortAndLongMsg(msgRequestVO);
|
msgRequestVO = this.getLengthOfShortAndLongMsg(msgRequestVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 문자 전송하는 부분
|
// 문자 전송하는 부분
|
||||||
@ -116,9 +101,9 @@ public class SendServiceImpl implements SendService {
|
|||||||
|
|
||||||
// convertMjonDataToApiResponse => MjonResponseVO 데이터를 ApiResponse 데이터로 변환하는 메소드
|
// convertMjonDataToApiResponse => MjonResponseVO 데이터를 ApiResponse 데이터로 변환하는 메소드
|
||||||
if(munjaSendResponse.getResult() != "fail"){ // 성공
|
if(munjaSendResponse.getResult() != "fail"){ // 성공
|
||||||
return new RestResponse(HttpStatus.OK, "", LocalDateTime.now(), SendSuccessRestResponse.convertMjonDataToApiResponse(munjaSendResponse, STAT_CODE));
|
return new RestResponse(SendSuccessRestResponse.convertMjonDataToApiResponse(munjaSendResponse));
|
||||||
}else{ // 실패
|
}else{ // 실패
|
||||||
return new RestResponse(HttpStatus.OK, "", LocalDateTime.now(), FailRestResponse.convertMjonDataToApiResponse(munjaSendResponse));
|
return new RestResponse(this.convertMjonDataToApiResponse(munjaSendResponse));
|
||||||
}
|
}
|
||||||
|
|
||||||
//step5.발송일시 정상여부 확인
|
//step5.발송일시 정상여부 확인
|
||||||
@ -129,9 +114,30 @@ public class SendServiceImpl implements SendService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private RestResponse _getTestReturnData(String testYn)
|
||||||
public ResponseEntity<?> sendMsgsData(MsgsRequestVO msgsRequestVO) throws Exception {
|
{
|
||||||
|
if("YF".equals(testYn))
|
||||||
|
{
|
||||||
|
return new RestResponse(StatMsg.randomErrorStatCode());
|
||||||
|
}else{
|
||||||
|
return new RestResponse(SendSuccessRestResponse.builder()
|
||||||
|
.msgGroupId("MSGGID_0000000000000") // 전송 메세지 그룹 ID
|
||||||
|
.successCnt("5") // 성공 건수
|
||||||
|
.blockCnt("2") // 수신거부 건수
|
||||||
|
.msgType("LMS")
|
||||||
|
.failCnt("0")
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestResponse sendMsgsData(MsgsRequestVO msgsRequestVO) throws Exception {
|
||||||
|
|
||||||
|
if(StringUtils.isNotEmpty(msgsRequestVO.getTest_yn())){
|
||||||
|
// YF => 실패 테스트 데이터
|
||||||
|
return this._getTestReturnData(msgsRequestVO.getTest_yn());
|
||||||
|
}
|
||||||
// msgsVO -> msgVO List로 변환
|
// msgsVO -> msgVO List로 변환
|
||||||
List<MsgRequestVO> msgRequestVOList = this.getDataCleaning(msgsRequestVO);
|
List<MsgRequestVO> msgRequestVOList = this.getDataCleaning(msgsRequestVO);
|
||||||
|
|
||||||
@ -143,25 +149,22 @@ public class SendServiceImpl implements SendService {
|
|||||||
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||||
// 1010
|
// 1010
|
||||||
if(!sendMapper.findByCallFrom(msgRequestVOList.get(0))){
|
if(!sendMapper.findByCallFrom(msgRequestVOList.get(0))){
|
||||||
return ResponseEntity.ok().body(_falseRetunDate("STAT_1010"));
|
return new RestResponse("STAT_1010");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MjonResponseVO> mjonResponseVOList = new ArrayList<MjonResponseVO>();
|
|
||||||
for(MsgRequestVO msgRequestVO : msgRequestVOList){
|
|
||||||
|
|
||||||
|
|
||||||
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||||
// 1020
|
// 1020
|
||||||
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
||||||
|
for(MsgRequestVO msgRequestVO : msgRequestVOList){
|
||||||
if(StringUtils.isNotEmpty(this.getCallToListChk(msgRequestVO))){
|
if(StringUtils.isNotEmpty(this.getCallToListChk(msgRequestVO))){
|
||||||
FailRestResponse failRestResponse = _falseRetunDate("STAT_1020");
|
return callToErrorReturnData(msgRequestVO);
|
||||||
String returnMsg = failRestResponse.getMessage();
|
|
||||||
returnMsg = returnMsg.replace("수신자", "수신자(" + msgRequestVO.getCallToList()[0] + ")");
|
|
||||||
failRestResponse.setMessage(returnMsg);
|
|
||||||
|
|
||||||
return ResponseEntity.ok().body(failRestResponse);
|
|
||||||
// return ResponseEntity.ok().body(_falseRetunDate("STAT_1020"));
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<MjonResponseVO> mjonResponseVOList = new ArrayList<MjonResponseVO>();
|
||||||
|
for(MsgRequestVO msgRequestVO : msgRequestVOList){
|
||||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 30분 지연으로 처리됨
|
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 30분 지연으로 처리됨
|
||||||
// 1030 => 현재 사용안함
|
// 1030 => 현재 사용안함
|
||||||
// 스팸체크 하는 부분
|
// 스팸체크 하는 부분
|
||||||
@ -187,11 +190,17 @@ public class SendServiceImpl implements SendService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK
|
return new RestResponse(SendSuccessRestResponse.SendSuccessMsgsRestResponse(mjonResponseVOList));
|
||||||
, ""
|
}
|
||||||
, LocalDateTime.now()
|
|
||||||
, SendSuccessRestResponse.SendSuccessMsgsRestResponse(mjonResponseVOList))
|
private static RestResponse callToErrorReturnData(MsgRequestVO msgRequestVO) {
|
||||||
);
|
RestResponse restResponse = new RestResponse("STAT_1020");
|
||||||
|
|
||||||
|
String errorMsg = restResponse.getData().toString();
|
||||||
|
errorMsg.replace("수신자", "수신자(" + msgRequestVO.getCallToList()[0] + ")");
|
||||||
|
restResponse.setData(errorMsg);
|
||||||
|
|
||||||
|
return restResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -267,13 +276,6 @@ public class SendServiceImpl implements SendService {
|
|||||||
return msgRequestVOList;
|
return msgRequestVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 리턴 데이터 메소드
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static FailRestResponse _falseRetunDate(String ststCode) {
|
|
||||||
return FailRestResponse.getSendFailResponse(ststCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 치환 후 단문 장문 msg 개수 구하기
|
* 치환 후 단문 장문 msg 개수 구하기
|
||||||
@ -454,4 +456,35 @@ public class SendServiceImpl implements SendService {
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MjonResponseVO -> 변환 -> SendFailRestResponse
|
||||||
|
* @param mjonResponseVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String convertMjonDataToApiResponse(MjonResponseVO mjonResponseVO) {
|
||||||
|
String result = mjonResponseVO.getResult();
|
||||||
|
String message = mjonResponseVO.getMessage();
|
||||||
|
String statCode = "";
|
||||||
|
switch (result) {
|
||||||
|
case "statusFail" : statCode = "1070"; // 회원 정지
|
||||||
|
break;
|
||||||
|
case "smsLengFail" : statCode = "1080"; // 문자 길이 초과
|
||||||
|
break;
|
||||||
|
case "fail" : // 문자온 프로젝트에서 result가 fail로 다양한 에러가 리턴하여 분기처리함
|
||||||
|
if(message.indexOf("문자 치환 후 전송 문자 길이를 초과하였습니다.")>-1)
|
||||||
|
statCode = "1050"; // 치환 후 문자 길이 초과
|
||||||
|
if(message.indexOf("치환문자 데이터가 없습니다")>-1)
|
||||||
|
statCode = "1040"; // 치환 데이터 오류
|
||||||
|
if(message.indexOf("치환 후 전송 문자 길이를 초과")>-1)
|
||||||
|
statCode = "1050"; // 치환 데이터 오류
|
||||||
|
break;
|
||||||
|
default: statCode = "1099"; // 기타 시스템 오류
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return statCode;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,8 +67,8 @@ public class SendRestController {
|
|||||||
@CrossOrigin("*") // 모든 요청에 접근 허용
|
@CrossOrigin("*") // 모든 요청에 접근 허용
|
||||||
@PostMapping("/api/send/sendMsgs")
|
@PostMapping("/api/send/sendMsgs")
|
||||||
@ApiOperation(value= "문자 전송", notes = "[문자 발송] 다른 내용으로 여려명에게 보냄")
|
@ApiOperation(value= "문자 전송", notes = "[문자 발송] 다른 내용으로 여려명에게 보냄")
|
||||||
public ResponseEntity<?> sendMsgs(MsgsRequestVO msgsRequestVO) throws Exception {
|
public ResponseEntity<RestResponse> sendMsgs(MsgsRequestVO msgsRequestVO) throws Exception {
|
||||||
return sendService.sendMsgsData(msgsRequestVO);
|
return ResponseEntity.ok().body(sendService.sendMsgsData(msgsRequestVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,8 @@ import com.itn.mjonApi.mjon.log.service.LettnLoginLogService;
|
|||||||
import com.itn.mjonApi.mjon.log.service.mapper.LettnLoginLogMapper;
|
import com.itn.mjonApi.mjon.log.service.mapper.LettnLoginLogMapper;
|
||||||
import com.itn.mjonApi.mjon.log.service.mapper.domain.LettnLoginLogVO;
|
import com.itn.mjonApi.mjon.log.service.mapper.domain.LettnLoginLogVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -21,20 +19,23 @@ public class LettnLoginLogServiceImpl implements LettnLoginLogService {
|
|||||||
@Override
|
@Override
|
||||||
public RestResponse insert(LettnLoginLogVO lettnLoginLogVO) {
|
public RestResponse insert(LettnLoginLogVO lettnLoginLogVO) {
|
||||||
int i_ret = lettnLoginLogMapper.insert(lettnLoginLogVO);
|
int i_ret = lettnLoginLogMapper.insert(lettnLoginLogVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
return new RestResponse(new Object());
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse selectR(LettnLoginLogVO lettnLoginLogVO) {
|
public RestResponse selectR(LettnLoginLogVO lettnLoginLogVO) {
|
||||||
LettnLoginLogVO MyMsgListVO = lettnLoginLogMapper.selectR(lettnLoginLogVO);
|
LettnLoginLogVO MyMsgListVO = lettnLoginLogMapper.selectR(lettnLoginLogVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
return new RestResponse(MyMsgListVO);
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse selectL(LettnLoginLogVO lettnLoginLogVO) {
|
public RestResponse selectL(LettnLoginLogVO lettnLoginLogVO) {
|
||||||
List<LettnLoginLogVO> MyMsgListVO = lettnLoginLogMapper.selectL(lettnLoginLogVO);
|
List<LettnLoginLogVO> MyMsgListVO = lettnLoginLogMapper.selectL(lettnLoginLogVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
return new RestResponse(MyMsgListVO);
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -56,13 +57,15 @@ public class LettnLoginLogServiceImpl implements LettnLoginLogService {
|
|||||||
@Override
|
@Override
|
||||||
public RestResponse update(LettnLoginLogVO lettnLoginLogVO) {
|
public RestResponse update(LettnLoginLogVO lettnLoginLogVO) {
|
||||||
int i_ret = lettnLoginLogMapper.update(lettnLoginLogVO);
|
int i_ret = lettnLoginLogMapper.update(lettnLoginLogVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
return new RestResponse(new Object());
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestResponse delete(LettnLoginLogVO lettnLoginLogVO) {
|
public RestResponse delete(LettnLoginLogVO lettnLoginLogVO) {
|
||||||
int i_ret = lettnLoginLogMapper.delete(lettnLoginLogVO);
|
int i_ret = lettnLoginLogMapper.delete(lettnLoginLogVO);
|
||||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
return new RestResponse(new Object());
|
||||||
|
// return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user