refactor: 프로젝트 구조 변경 및 코드 수정
This commit is contained in:
parent
2d87b5b5f7
commit
e7b0d509e0
8
pom.xml
8
pom.xml
@ -104,6 +104,14 @@
|
|||||||
<artifactId>springfox-swagger-ui</artifactId>
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.itn.mjonApi.cmn.interceptor;
|
|||||||
|
|
||||||
//import java.sql.Date;
|
//import java.sql.Date;
|
||||||
|
|
||||||
import com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO;
|
import com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO;
|
||||||
import com.itn.mjonApi.mjon.log.service.mapper.domain.LettnLoginLogVO;
|
import com.itn.mjonApi.mjon.log.service.mapper.domain.LettnLoginLogVO;
|
||||||
import com.itn.mjonApi.cmn.idgen.service.IdgenService;
|
import com.itn.mjonApi.cmn.idgen.service.IdgenService;
|
||||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package com.itn.mjonApi.mjon.api.access.service;
|
package com.itn.mjonApi.mjon.api.access.service;
|
||||||
|
|
||||||
import com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO;
|
import com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO;
|
||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
|
||||||
public interface AccessKeyService {
|
public interface AccessKeyService {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package com.itn.mjonApi.mjon.api.access.service;
|
package com.itn.mjonApi.mjon.api.access.service;
|
||||||
|
|
||||||
import com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO;
|
import com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO;
|
||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
|
|
||||||
public interface AccessTokenService {
|
public interface AccessTokenService {
|
||||||
|
|||||||
@ -1,16 +1,15 @@
|
|||||||
package com.itn.mjonApi.mjon.api.access.service.impl;
|
package com.itn.mjonApi.mjon.api.access.service.impl;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||||
import java.util.List;
|
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.service.AccessKeyService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO;
|
import java.time.LocalDateTime;
|
||||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
import java.util.List;
|
||||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
|
||||||
import com.itn.mjonApi.mjon.api.access.service.mapper.AccessKeyMapper;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class AccessKeyServiceImpl implements AccessKeyService {
|
public class AccessKeyServiceImpl implements AccessKeyService {
|
||||||
|
|||||||
@ -7,11 +7,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO;
|
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.service.AccessTokenService;
|
||||||
import com.itn.mjonApi.mjon.api.access.service.mapper.AccessTokenMapper;
|
import com.itn.mjonApi.mjon.api.access.mapper.AccessTokenMapper;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class AccessTokenServiceImpl implements AccessTokenService {
|
public class AccessTokenServiceImpl implements AccessTokenService {
|
||||||
|
|||||||
@ -1,23 +1,17 @@
|
|||||||
package com.itn.mjonApi.mjon.api.access.web;
|
package com.itn.mjonApi.mjon.api.access.web;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import org.json.simple.JSONObject;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.itn.mjonApi.mjon.api.access.service.mapper.domain.SendMsgVO;
|
|
||||||
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.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.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author User
|
* @author User
|
||||||
@ -98,24 +92,7 @@ public class AccessKeyRestController {
|
|||||||
//System.out.println(p_name_1);
|
//System.out.println(p_name_1);
|
||||||
//System.out.println(p_name_2);
|
//System.out.println(p_name_2);
|
||||||
|
|
||||||
//sendMsg 문자 발송 전 체크 사항
|
|
||||||
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
|
||||||
// 1010
|
|
||||||
|
|
||||||
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
|
||||||
// 1020
|
|
||||||
|
|
||||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 안됨
|
|
||||||
// 1030
|
|
||||||
|
|
||||||
//step4.치환명 정상 여부 확인
|
|
||||||
// 1040
|
|
||||||
|
|
||||||
//step5.발송일시 정상여부 확인
|
|
||||||
// 1050
|
|
||||||
|
|
||||||
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
|
||||||
// 1060
|
|
||||||
|
|
||||||
return ResponseEntity.ok(
|
return ResponseEntity.ok(
|
||||||
new RestResponse(
|
new RestResponse(
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.itn.mjonApi.mjon.api.send.mapper;
|
||||||
|
|
||||||
|
import com.itn.mjonApi.mjon.api.send.mapper.domain.MsgRequestVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* packageName : com.itn.mjonApi.mjon.api.send.mapper.domain
|
||||||
|
* fileName : SendMapper
|
||||||
|
* author : hylee
|
||||||
|
* date : 2023-05-19
|
||||||
|
* description :
|
||||||
|
* ===========================================================
|
||||||
|
* DATE AUTHOR NOTE
|
||||||
|
* -----------------------------------------------------------
|
||||||
|
* 2023-05-19 hylee 최초 생성
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SendMapper {
|
||||||
|
|
||||||
|
Boolean findByCallFrom(MsgRequestVO msgRequestVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,14 +1,21 @@
|
|||||||
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.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;
|
||||||
import com.itn.mjonApi.mjon.api.send.service.SendService;
|
import com.itn.mjonApi.mjon.api.send.service.SendService;
|
||||||
|
import com.itn.mjonApi.util.MunjaUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.catalina.connector.Response;
|
import org.apache.catalina.connector.Response;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@ -16,16 +23,93 @@ public class SendServiceImpl implements SendService {
|
|||||||
|
|
||||||
private ApiService<Response> apiService;
|
private ApiService<Response> apiService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SendMapper sendMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
public SendServiceImpl(ApiService<Response> apiService) {
|
public SendServiceImpl(ApiService<Response> apiService) {
|
||||||
this.apiService = apiService;
|
this.apiService = apiService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String replaseStrList = "[*이름*],[*1*],[*2*],[*3*],[*4*]";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MjonResponseVO sendMsgData(MsgRequestVO msgRequestVO) throws Exception {
|
public MjonResponseVO sendMsgData(MsgRequestVO msgRequestVO) throws Exception {
|
||||||
|
|
||||||
log.info("msgRequestVO.getReserveYn() :: [{}]",msgRequestVO.getReserveYn());
|
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
|
||||||
|
* */
|
||||||
|
|
||||||
|
//sendMsg 문자 발송 전 체크 사항
|
||||||
|
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||||
|
// 1010
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||||
|
// 1020
|
||||||
|
|
||||||
|
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 안됨
|
||||||
|
// 1030
|
||||||
|
|
||||||
|
//step4.치환명 정상 여부 확인
|
||||||
|
// 1040
|
||||||
|
|
||||||
|
//step5.발송일시 정상여부 확인
|
||||||
|
// 1050
|
||||||
|
|
||||||
|
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
||||||
|
// 1060
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
String message = "";
|
||||||
|
// 폰번호 확인 - 빈 값 -> 유효성 정규식
|
||||||
|
message = this.getCallToListChk(msgRequestVO);
|
||||||
|
if(StringUtils.isNotEmpty(message)){
|
||||||
|
return MjonResponseVO.builder()
|
||||||
|
.result("fail")
|
||||||
|
.message(message)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 치환데이터 여부 확인
|
||||||
|
msgRequestVO.setTxtReplYn(this.getTxtReplYn(msgRequestVO));
|
||||||
|
|
||||||
|
if("Y".equals(msgRequestVO.getTxtReplYn())){
|
||||||
|
|
||||||
|
//일괄변환 문자에 콤마(,)가 들어가있으면 배열로 넘길때 문제가 발생하여 특수문자(§)로 치환하여 넘겨주도록 한다.
|
||||||
|
msgRequestVO = this.getReplaceCommaToStrSymbol(msgRequestVO);
|
||||||
|
|
||||||
|
// 치환 후 단문 장문 개수 구하기
|
||||||
|
msgRequestVO = getLengthOfShortAndLongMsg(msgRequestVO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 스팸체크 하는 부분
|
// 스팸체크 하는 부분
|
||||||
MjonResponseVO spamChkEntity = apiService.postForEntity(
|
MjonResponseVO spamChkEntity = apiService.postForEntity(
|
||||||
"/web/user/login/selectSpamTxtChkAjax.do"
|
"/web/user/login/selectSpamTxtChkAjax.do"
|
||||||
@ -37,6 +121,8 @@ public class SendServiceImpl implements SendService {
|
|||||||
msgRequestVO.setSpamStatus("Y");
|
msgRequestVO.setSpamStatus("Y");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
log.info("msgRequestVO.getSpamStatus() :: [[}]",msgRequestVO.getSpamStatus());
|
||||||
|
|
||||||
// 문자 전송하는 부분
|
// 문자 전송하는 부분
|
||||||
MjonResponseVO munjaSendResponse = apiService.postForEntity(
|
MjonResponseVO munjaSendResponse = apiService.postForEntity(
|
||||||
"/web/user/login/sendMsgDataAjax.do"
|
"/web/user/login/sendMsgDataAjax.do"
|
||||||
@ -44,10 +130,190 @@ public class SendServiceImpl implements SendService {
|
|||||||
, String.class
|
, String.class
|
||||||
);
|
);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
return munjaSendResponse;
|
return null;
|
||||||
// return spamChkEntity;
|
// return munjaSendResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 치환 후 단문 장문 msg 개수 구하기
|
||||||
|
* @param msgRequestVO
|
||||||
|
* @return msgRequestVO
|
||||||
|
* @throws UnsupportedEncodingException
|
||||||
|
*/
|
||||||
|
private static MsgRequestVO getLengthOfShortAndLongMsg(MsgRequestVO msgRequestVO) throws UnsupportedEncodingException {
|
||||||
|
String charset = "euc-kr";
|
||||||
|
int totListCnt = msgRequestVO.getCallToList().length;
|
||||||
|
|
||||||
|
int shortMsgCnt=0; // 치환 후 단문 개수
|
||||||
|
int longMsgCnt=0; // 치환 후 장문 개수
|
||||||
|
for(int i=0; i < totListCnt; i ++) {
|
||||||
|
String smsTxt = msgRequestVO.getSmsTxt().replaceAll(String.valueOf((char)13), ""); //발송 문자 내용
|
||||||
|
|
||||||
|
String[] nameList = msgRequestVO.getNameList(); //치환 이름 리스트
|
||||||
|
String[] phone = msgRequestVO.getCallToList(); //수신자 휴대폰 번호
|
||||||
|
String[] rep1 = msgRequestVO.getRep1List(); //치환 문자1 리스트
|
||||||
|
String[] rep2 = msgRequestVO.getRep2List(); //치환 문자2 리스트
|
||||||
|
String[] rep3 = msgRequestVO.getRep3List(); //치환 문자3 리스트
|
||||||
|
String[] rep4 = msgRequestVO.getRep4List(); //치환 문자4 리스트
|
||||||
|
|
||||||
|
if (smsTxt.indexOf("[*이름*]") > -1) {
|
||||||
|
if(nameList.length > i && StringUtils.isNotEmpty(nameList[i])) {
|
||||||
|
smsTxt = smsTxt.replaceAll("\\[\\*이름\\*\\]", MunjaUtil.getString(nameList[i].replaceAll("§", ",")));
|
||||||
|
}else {
|
||||||
|
smsTxt = smsTxt.replaceAll("\\[\\*이름\\*\\]", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (smsTxt.indexOf("[*1*]") > -1) {
|
||||||
|
if(rep1.length > i && StringUtils.isNotEmpty(rep1[i])) {
|
||||||
|
smsTxt = smsTxt.replaceAll("\\[\\*1\\*\\]", MunjaUtil.getString(rep1[i].replaceAll("§", ",")));
|
||||||
|
}else {
|
||||||
|
smsTxt = smsTxt.replaceAll("\\[\\*1\\*\\]", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (smsTxt.indexOf("[*2*]") > -1) {
|
||||||
|
if(rep2.length > i && StringUtils.isNotEmpty(rep2[i])) {
|
||||||
|
smsTxt = smsTxt.replaceAll("\\[\\*2\\*\\]", MunjaUtil.getString(rep2[i].replaceAll("§", ",")));
|
||||||
|
}else {
|
||||||
|
smsTxt = smsTxt.replaceAll("\\[\\*2\\*\\]", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (smsTxt.indexOf("[*3*]") > -1) {
|
||||||
|
if(rep3.length > i && StringUtils.isNotEmpty(rep3[i])) {
|
||||||
|
smsTxt = smsTxt.replaceAll("\\[\\*3\\*\\]", MunjaUtil.getString(rep3[i].replaceAll("§", ",")));
|
||||||
|
}else {
|
||||||
|
smsTxt = smsTxt.replaceAll("\\[\\*3\\*\\]", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (smsTxt.indexOf("[*4*]") > -1) {
|
||||||
|
if(rep4.length > i && StringUtils.isNotEmpty(rep4[i])) {
|
||||||
|
smsTxt = smsTxt.replaceAll("\\[\\*4\\*\\]", MunjaUtil.getString(rep4[i].replaceAll("§", ",")));
|
||||||
|
}else {
|
||||||
|
smsTxt = smsTxt.replaceAll("\\[\\*4\\*\\]", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int bytes = smsTxt.getBytes(charset).length;
|
||||||
|
|
||||||
|
if(bytes > 90) {//장문문자 리스트 만들기
|
||||||
|
longMsgCnt++;
|
||||||
|
}else {//단문문자 리스트 만들기
|
||||||
|
shortMsgCnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
msgRequestVO.setLongMsgCnt(Integer.toString(longMsgCnt));
|
||||||
|
msgRequestVO.setShortMsgCnt(Integer.toString(shortMsgCnt));
|
||||||
|
|
||||||
|
return msgRequestVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 치환문자가 있으면 , => §로 치환
|
||||||
|
* @param msgRequestVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static MsgRequestVO getReplaceCommaToStrSymbol(MsgRequestVO msgRequestVO) {
|
||||||
|
|
||||||
|
AtomicInteger index = new AtomicInteger();
|
||||||
|
|
||||||
|
// 이름 배열
|
||||||
|
if(StringUtils.isNotEmpty(msgRequestVO.getNameStr()))
|
||||||
|
{
|
||||||
|
msgRequestVO.setNameList(msgRequestVO.getNameStr().split("\\|"));
|
||||||
|
String[] nameList = new String[msgRequestVO.getNameList().length];
|
||||||
|
Arrays.stream(msgRequestVO.getNameList()).forEach(name -> {
|
||||||
|
nameList[index.getAndIncrement()] = MunjaUtil.replaceCommaToStrSymbol(name);
|
||||||
|
});
|
||||||
|
msgRequestVO.setNameList(nameList);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rep1 배열
|
||||||
|
if(StringUtils.isNotEmpty(msgRequestVO.getRep1Str()))
|
||||||
|
{
|
||||||
|
index.set(0);
|
||||||
|
msgRequestVO.setRep1List(msgRequestVO.getRep1Str().split("\\|"));
|
||||||
|
String[] rep1List = new String[msgRequestVO.getRep1List().length];
|
||||||
|
Arrays.stream(msgRequestVO.getRep1List()).forEach(str -> {
|
||||||
|
rep1List[index.getAndIncrement()] = MunjaUtil.replaceCommaToStrSymbol(str);
|
||||||
|
});
|
||||||
|
msgRequestVO.setRep1List(rep1List);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rep2 배열
|
||||||
|
if(StringUtils.isNotEmpty(msgRequestVO.getRep2Str()))
|
||||||
|
{
|
||||||
|
index.set(0);
|
||||||
|
msgRequestVO.setRep2List(msgRequestVO.getRep2Str().split("\\|"));
|
||||||
|
String[] rep2List = new String[msgRequestVO.getRep2List().length];
|
||||||
|
Arrays.stream(msgRequestVO.getRep2List()).forEach(str -> {
|
||||||
|
rep2List[index.getAndIncrement()] = MunjaUtil.replaceCommaToStrSymbol(str);
|
||||||
|
});
|
||||||
|
msgRequestVO.setRep2List(rep2List);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rep3 배열
|
||||||
|
if(StringUtils.isNotEmpty(msgRequestVO.getRep3Str()))
|
||||||
|
{
|
||||||
|
index.set(0);
|
||||||
|
msgRequestVO.setRep3List(msgRequestVO.getRep3Str().split("\\|"));
|
||||||
|
String[] rep3List = new String[msgRequestVO.getRep3List().length];
|
||||||
|
Arrays.stream(msgRequestVO.getRep3List()).forEach(str -> {
|
||||||
|
rep3List[index.getAndIncrement()] = MunjaUtil.replaceCommaToStrSymbol(str);
|
||||||
|
});
|
||||||
|
msgRequestVO.setRep3List(rep3List);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rep4 배열
|
||||||
|
if(StringUtils.isNotEmpty(msgRequestVO.getRep4Str()))
|
||||||
|
{
|
||||||
|
index.set(0);
|
||||||
|
msgRequestVO.setRep4List(msgRequestVO.getRep4Str().split("\\|"));
|
||||||
|
String[] rep4List = new String[msgRequestVO.getRep4List().length];
|
||||||
|
Arrays.stream(msgRequestVO.getRep4List()).forEach(str -> {
|
||||||
|
rep4List[index.getAndIncrement()] = MunjaUtil.replaceCommaToStrSymbol(str);
|
||||||
|
});
|
||||||
|
msgRequestVO.setRep4List(rep4List);
|
||||||
|
}
|
||||||
|
return msgRequestVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 치환 문자 여부 확인
|
||||||
|
* @param msgRequestVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String getTxtReplYn(MsgRequestVO msgRequestVO) {
|
||||||
|
|
||||||
|
int callLen = msgRequestVO.getCallToList().length;
|
||||||
|
// 치환 데이터 확인
|
||||||
|
Arrays.stream(replaseStrList.split(",")).forEach(
|
||||||
|
str -> {
|
||||||
|
if(msgRequestVO.getSmsTxt().indexOf(str) > -1){
|
||||||
|
msgRequestVO.setTxtReplYn("Y");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return msgRequestVO.getTxtReplYn();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 수신자 목록 번호 검증
|
||||||
|
* @param msgRequestVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String getCallToListChk(MsgRequestVO msgRequestVO) {
|
||||||
|
String message = "";
|
||||||
|
for(String callTo : msgRequestVO.getCallToList()){
|
||||||
|
if(!MunjaUtil.checkPhoneNumberEmpty(callTo)){
|
||||||
|
message = "수신 목록에 핸드폰 번호가 없는 항목이 있습니다."; break;};
|
||||||
|
if(!MunjaUtil.validatePNumWithRegex(callTo)){
|
||||||
|
message = "휴대폰 번호가 올바르지 않습니다. : " + callTo; break;};
|
||||||
|
}
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,10 @@ package com.itn.mjonApi.mjon.api.send.web;
|
|||||||
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;
|
||||||
import com.itn.mjonApi.mjon.api.send.service.SendService;
|
import com.itn.mjonApi.mjon.api.send.service.SendService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
@ -43,7 +45,9 @@ public class SendRestController {
|
|||||||
* @Discription 문자 발송 테스트
|
* @Discription 문자 발송 테스트
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/api/send/sendTest")
|
@CrossOrigin("*") // 모든 요청에 접근 허용
|
||||||
|
@PostMapping("/api/send/sendMsg")
|
||||||
|
@ApiOperation(value= "단문 문자 전송", notes = "같은 내용으로 여러명에게 보냄")
|
||||||
public MjonResponseVO sendTest(MsgRequestVO msgRequestVO) throws Exception {
|
public MjonResponseVO sendTest(MsgRequestVO msgRequestVO) throws Exception {
|
||||||
|
|
||||||
return sendService.sendMsgData(msgRequestVO);
|
return sendService.sendMsgData(msgRequestVO);
|
||||||
|
|||||||
20
src/main/resources/mapper/Send/SendMapper.xml
Normal file
20
src/main/resources/mapper/Send/SendMapper.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?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.api.send.mapper.SendMapper">
|
||||||
|
|
||||||
|
<select id="findByCallFrom" resultType="boolean">
|
||||||
|
SELECT IF(COUNT(*), 1, 0)
|
||||||
|
FROM MJ_PHONE_MEMBER
|
||||||
|
WHERE 1=1
|
||||||
|
AND USER_ID = #{mberId}
|
||||||
|
AND AUTH_YN = 'Y'
|
||||||
|
AND PHM_TYPE = '01'
|
||||||
|
AND PHONE_NUMBER = #{callFrom}
|
||||||
|
ORDER BY BASE_YN DESC
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -3,9 +3,9 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
<mapper namespace="com.itn.mjonApi.mjon.api.access.service.mapper.AccessKeyMapper">
|
<mapper namespace="com.itn.mjonApi.mjon.api.access.mapper.AccessKeyMapper">
|
||||||
|
|
||||||
<select id="findAll" resultType="com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO">
|
<select id="findAll" resultType="com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO">
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM lettngnrlmber_access_key
|
FROM lettngnrlmber_access_key
|
||||||
@ -74,7 +74,7 @@
|
|||||||
<!-- access_key 정보 R -->
|
<!-- access_key 정보 R -->
|
||||||
<!-- <include refid="AccessKeyDAO.select_column_name"/> -->
|
<!-- <include refid="AccessKeyDAO.select_column_name"/> -->
|
||||||
<!-- <include refid="AccessKeyDAO.table_name"/> a -->
|
<!-- <include refid="AccessKeyDAO.table_name"/> a -->
|
||||||
<select id="selectR" resultType="com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO">
|
<select id="selectR" resultType="com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO">
|
||||||
SELECT
|
SELECT
|
||||||
<include refid="select_column_name"/>
|
<include refid="select_column_name"/>
|
||||||
FROM
|
FROM
|
||||||
@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRKey" resultType="com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO">
|
<select id="selectRKey" resultType="com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO">
|
||||||
SELECT
|
SELECT
|
||||||
<include refid="select_column_name"/>
|
<include refid="select_column_name"/>
|
||||||
FROM
|
FROM
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
<mapper namespace="com.itn.mjonApi.mjon.api.access.service.mapper.AccessTokenMapper">
|
<mapper namespace="com.itn.mjonApi.mjon.api.access.mapper.AccessTokenMapper">
|
||||||
|
|
||||||
<select id="findAll" resultType="com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO">
|
<select id="findAll" resultType="com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO">
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM lettngnrlmber_access_token
|
FROM lettngnrlmber_access_token
|
||||||
@ -74,7 +74,7 @@
|
|||||||
<!-- access_key 정보 R -->
|
<!-- access_key 정보 R -->
|
||||||
<!-- <include refid="AccessKeyDAO.select_column_name"/> -->
|
<!-- <include refid="AccessKeyDAO.select_column_name"/> -->
|
||||||
<!-- <include refid="AccessKeyDAO.table_name"/> a -->
|
<!-- <include refid="AccessKeyDAO.table_name"/> a -->
|
||||||
<select id="selectR" resultType="com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO">
|
<select id="selectR" resultType="com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO">
|
||||||
SELECT
|
SELECT
|
||||||
<include refid="select_column_name"/>
|
<include refid="select_column_name"/>
|
||||||
FROM
|
FROM
|
||||||
@ -85,7 +85,7 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRToken" resultType="com.itn.mjonApi.mjon.api.access.service.mapper.domain.AccessKeyVO">
|
<select id="selectRToken" resultType="com.itn.mjonApi.mjon.api.access.mapper.domain.AccessKeyVO">
|
||||||
SELECT
|
SELECT
|
||||||
<include refid="select_column_name"/>
|
<include refid="select_column_name"/>
|
||||||
FROM
|
FROM
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user