문자전송 수정(발송예약일시 입력)

main
이범준 1 week ago
parent 43e7b9a12c
commit 11e0d03241

@ -17,7 +17,7 @@ public class MsgEntity extends AbstractEntity {
/**
* G/W
*/
private String msgSubId;
private String subId;
/**
*

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import javax.annotation.Resource;
import javax.sql.DataSource;
@ -51,7 +52,7 @@ public class MsgServiceBean extends AbstractServiceBean implements MsgService {
boolean isSuccess = false;
//발신전화
//발신전화 검증
if(ifEmpty(msgEntity.getCallback(), ()->"").equals("")) {
isSuccess = false;
msgEntity.setFailRsn("발신 전화번호 없음");
@ -64,7 +65,7 @@ public class MsgServiceBean extends AbstractServiceBean implements MsgService {
failList.add(msgEntity);
continue;
}
//수신전화
//수신전화 검증
if(ifEmpty(msgEntity.getPhone(), ()->"").equals("")) {
isSuccess = false;
msgEntity.setFailRsn("수신 전화번호 없음");
@ -77,10 +78,20 @@ public class MsgServiceBean extends AbstractServiceBean implements MsgService {
failList.add(msgEntity);
continue;
}
//발송예약일시 검증
if(!ifEmpty(msgEntity.getResDate(), ()->"").equals("")) {
String regex_dt = "^\\d{4}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])([0-1][0-9]|2[0-3])([0-5][0-9])([0-5][0-9])$";
if(!Pattern.matches(regex_dt, msgEntity.getResDate())) {
isSuccess = false;
msgEntity.setFailRsn("발송예약일시가 연월일시분초 형식이 아님");
failList.add(msgEntity);
continue;
}
}
Hangul hangul = new Hangul(2);
//알림톡
//알림톡 검증
if(!EgovStringUtil.null2void(msgEntity.getAltSenderKey()).equals("")) {
String altJson = msgEntity.getAltJson();
if(altJson.length() > 1000) {
@ -91,7 +102,7 @@ public class MsgServiceBean extends AbstractServiceBean implements MsgService {
}
}
//RCS
//RCS 검증
if(!EgovStringUtil.null2void(msgEntity.getRcsBrandKey()).equals("")) {
String rcsJson = msgEntity.getRcsJson();
//
@ -114,6 +125,7 @@ public class MsgServiceBean extends AbstractServiceBean implements MsgService {
String contentsTypeOfXMS = msgEntity.getContentsTypeOfXMS();
//XMS 검증
if("SMS".equals(contentsTypeOfXMS) && xmsContentByteCnt > 90) {
isSuccess = false;
msgEntity.setFailRsn("SMS 최대 바이트 수(90byte) 초과");

@ -8,6 +8,7 @@ import javax.annotation.Resource;
import javax.sql.DataSource;
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -50,36 +51,47 @@ public class RentInterfaceController extends ApplicationController {
public ModelAndView regist(@RequestBody JSONObject apiSpec) {
ModelAndView mav = new ModelAndView("jsonView");
List<MsgEntity> msgEntityList = new ArrayList<MsgEntity>();
String reqSys = (String) apiSpec.get("reqSys"); //요청시스템(이노,진우,엑스아이티)
String msgPrps = (String) apiSpec.get("msgPrps"); //목적(고장신고,사전알림,주차신고민원,기타민원)
String msgDtlPrps = (String) apiSpec.get("msgDtlPrps"); //상세목적
String sggCd = (String) apiSpec.get("sggCd"); //시군구코드
//누리2모듈 아이디 찾기
MsgQuery msgQuery = new MsgQuery();
msgQuery.setStngInfoType("01");
msgQuery.setSggCd(System.getProperty("sgg"));
String nuri2Id = msgMapper.selectStng(msgQuery).string("MODULE_ID");
if(ifEmpty(nuri2Id, ()->"").equals("")) {
mav.addObject("failRsn", "문자발송모듈아이디 찾기 실패");
mav.addObject("saved", false);
return mav;
}
String reqSys = (String) apiSpec.get("reqSys"); //요청시스템(이노,진우,엑스아이티)
if(EgovStringUtil.null2void(reqSys).equals("")) {
mav.addObject("failRsn", "요청시스템이 없습니다.");
mav.addObject("saved", false);
return mav;
}
String msgPrps = (String) apiSpec.get("msgPrps"); //목적(고장신고,사전알림,주차신고민원,기타민원)
if(EgovStringUtil.null2void(msgPrps).equals("")) {
mav.addObject("failRsn", "메시지 발송 목적이 없습니다.");
mav.addObject("saved", false);
return mav;
}
String msgDtlPrps = (String) apiSpec.get("msgDtlPrps"); //상세목적
String sggCd = (String) apiSpec.get("sggCd"); //시군구코드
String databaseId = databaseIdProvider.getDatabaseId(dataSource);
List<MsgEntity> msgEntityList = new ArrayList<MsgEntity>();
List<Map> reqs = (List<Map>) apiSpec.get("reqs");
for(Map req : reqs) {
MsgEntity msgEntity = new MsgEntity();
msgEntity.setMsgSubId(nuri2Id);
msgEntity.setSubId(nuri2Id);
String trnsmisNo = (String) req.get("trnsmisNo");
String recptnNo = (String) req.get("recptnNo");
String mssageCn = (String) req.get("mssageCn");
String resDate = (String) req.get("resDate");
msgEntity.setCallback(trnsmisNo);
msgEntity.setPhone(recptnNo);
@ -90,6 +102,10 @@ public class RentInterfaceController extends ApplicationController {
mssageCn = this.replaceLineChangeForNuri2Oracle(mssageCn);
}
if(!EgovStringUtil.null2void(resDate).equals("")) {
msgEntity.setResDate(resDate);
}
boolean able_kko = false; //알림톡 가능 여부
boolean able_rcs = false; //RCS 가능 여부

@ -119,12 +119,24 @@ INSERT
)
VALUES (
nextval_msg()
, #{msgSubId}
, #{subId}
, #{userKey}, #{userGroup}, #{userId}, #{userJobid}
, CURRENT_TIMESTAMP <!-- 메시지 입력 일시 -->
, <include refid="utility.now"/> <!-- 메시지 입력 연월일(사용자정의컬럼) -->
, <include refid="utility.now"/> <!-- 메시지 입력 일시(사용자정의컬럼) -->
<if test="resDate == null">
, CURRENT_TIMESTAMP <!-- 메시지 예약 일시 -->
, <include refid="utility.now"/> <!-- 메시지 예약 연월일(사용자정의컬럼) -->
, <include refid="utility.now"/> <!-- 메시지 예약 일시(사용자정의컬럼) -->
</if>
<if test="resDate != null">
<if test="_databaseId == 'mariadb'">
, STR_TO_DATE(#{resDate},'%Y%m%d%H%i%s') <!-- 메시지 예약 일시 -->
</if>
<if test="_databaseId == 'oracle'">
, TO_DATE(#{resDate},'YYYYMMDDHH24MISS') <!-- 메시지 예약 일시 -->
</if>
, #{resDate} <!-- 메시지 예약 일시(사용자정의컬럼) -->
</if>
, #{identifier}
, #{phone}, #{callback} <!-- 수신번호,발신번호 -->
, #{msgType1}, #{contentsType1}

Loading…
Cancel
Save