Merge branch 'hylee'
This commit is contained in:
commit
a7bb2812f3
@ -1,7 +1,6 @@
|
||||
package com.itn.mjonApi.cmn.msg;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@ -9,7 +8,7 @@ import java.util.List;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public class RestResponse {
|
||||
public class RestResponse{
|
||||
|
||||
//private HttpStatus status;
|
||||
private int resultCode;
|
||||
|
||||
34
src/main/java/com/itn/mjonApi/cmn/msg/SendRestResponse.java
Normal file
34
src/main/java/com/itn/mjonApi/cmn/msg/SendRestResponse.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.itn.mjonApi.cmn.msg;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SendRestResponse {
|
||||
|
||||
//private HttpStatus status;
|
||||
private String resultCode;
|
||||
|
||||
private String message;
|
||||
|
||||
private LocalDateTime localDateTime;
|
||||
|
||||
/*
|
||||
* 200-OK : 정상접속
|
||||
* 401-Unauthorized : 인증실패
|
||||
*
|
||||
* */
|
||||
|
||||
@Builder
|
||||
public SendRestResponse(String resultStr) {
|
||||
this.resultCode = StatMsg.valueOf(resultStr).getCode();
|
||||
this.message = StatMsg.valueOf(resultStr).getMsg();
|
||||
this.localDateTime = LocalDateTime.now();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
40
src/main/java/com/itn/mjonApi/cmn/msg/StatMsg.java
Normal file
40
src/main/java/com/itn/mjonApi/cmn/msg/StatMsg.java
Normal file
@ -0,0 +1,40 @@
|
||||
package com.itn.mjonApi.cmn.msg;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.cmn.msg
|
||||
* fileName : statMsg
|
||||
* author : hylee
|
||||
* date : 2023-05-19
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-05-19 hylee 최초 생성
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 사용 예시
|
||||
*
|
||||
* StatMsg.valueOf("STAT1010") :: STAT1010
|
||||
* StatMsg.valueOf("STAT1010").getCode() :: 1010
|
||||
* StatMsg.valueOf("STAT1010").getMsg() :: 발신자 전화번호 사용 불가
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public enum StatMsg {
|
||||
STAT1010("1010","발신자 전화번호 사용 불가")
|
||||
,STAT1020("1020","수신자 전화번호 오류")
|
||||
;
|
||||
|
||||
private final String code;
|
||||
private final String msg;
|
||||
|
||||
StatMsg(String code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
package com.itn.mjonApi.mjon.api.send.service;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
||||
import com.itn.mjonApi.cmn.msg.SendRestResponse;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||
|
||||
public interface SendService {
|
||||
|
||||
|
||||
MjonResponseVO sendMsgData(MsgRequestVO msgRequestVO) throws Exception;
|
||||
SendRestResponse sendMsgData(MsgRequestVO msgRequestVO) throws Exception;
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.itn.mjonApi.mjon.api.send.service.impl;
|
||||
|
||||
import com.itn.mjonApi.cmn.apiServer.ApiService;
|
||||
import com.itn.mjonApi.cmn.msg.SendRestResponse;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.SendMapper;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||
import com.itn.mjonApi.mjon.api.send.service.SendService;
|
||||
import com.itn.mjonApi.util.MunjaUtil;
|
||||
@ -33,34 +33,28 @@ public class SendServiceImpl implements SendService {
|
||||
private static final String replaseStrList = "[*이름*],[*1*],[*2*],[*3*],[*4*]";
|
||||
|
||||
@Override
|
||||
public MjonResponseVO sendMsgData(MsgRequestVO msgRequestVO) throws Exception {
|
||||
|
||||
log.info(" :: sendMsgData ::");
|
||||
|
||||
Boolean byCallFrom = sendMapper.findByCallFrom(msgRequestVO);
|
||||
log.info(" :: byCallFrom ::" + byCallFrom);
|
||||
if(byCallFrom){
|
||||
|
||||
}
|
||||
/*
|
||||
발신번호 체크
|
||||
SELECT PHONE_NUMBER
|
||||
FROM MJ_PHONE_MEMBER
|
||||
WHERE 1=1
|
||||
AND USER_ID = 'goodgkdus'
|
||||
AND AUTH_YN = 'Y'
|
||||
AND PHM_TYPE = '01'
|
||||
ORDER BY BASE_YN DESC
|
||||
* */
|
||||
public SendRestResponse sendMsgData(MsgRequestVO msgRequestVO) throws Exception {
|
||||
|
||||
//sendMsg 문자 발송 전 체크 사항
|
||||
log.info(" :: sendMsgData ::");
|
||||
|
||||
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||
// 1010
|
||||
|
||||
|
||||
if(!sendMapper.findByCallFrom(msgRequestVO)){
|
||||
return SendRestResponse.builder()
|
||||
.resultStr("STAT1010")
|
||||
.build();
|
||||
}
|
||||
|
||||
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||
// 1020
|
||||
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
||||
if(StringUtils.isNotEmpty(this.getCallToListChk(msgRequestVO))){
|
||||
return SendRestResponse.builder()
|
||||
.resultStr("STAT1010")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 안됨
|
||||
// 1030
|
||||
@ -82,16 +76,6 @@ public class SendServiceImpl implements SendService {
|
||||
/*
|
||||
|
||||
|
||||
String message = "";
|
||||
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
||||
message = this.getCallToListChk(msgRequestVO);
|
||||
if(StringUtils.isNotEmpty(message)){
|
||||
return MjonResponseVO.builder()
|
||||
.result("fail")
|
||||
.message(message)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
// 치환데이터 여부 확인
|
||||
msgRequestVO.setTxtReplYn(this.getTxtReplYn(msgRequestVO));
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
package com.itn.mjonApi.mjon.api.send.web;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonResponseVO;
|
||||
import com.itn.mjonApi.cmn.msg.SendRestResponse;
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||
import com.itn.mjonApi.mjon.api.send.service.SendService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -48,9 +49,9 @@ public class SendRestController {
|
||||
@CrossOrigin("*") // 모든 요청에 접근 허용
|
||||
@PostMapping("/api/send/sendMsg")
|
||||
@ApiOperation(value= "단문 문자 전송", notes = "같은 내용으로 여러명에게 보냄")
|
||||
public MjonResponseVO sendTest(MsgRequestVO msgRequestVO) throws Exception {
|
||||
public ResponseEntity<SendRestResponse> sendMsg(MsgRequestVO msgRequestVO) throws Exception {
|
||||
|
||||
return sendService.sendMsgData(msgRequestVO);
|
||||
return ResponseEntity.ok().body(sendService.sendMsgData(msgRequestVO));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user