diff --git a/src/main/java/cokr/xit/fims/mngt/MsgEntity.java b/src/main/java/cokr/xit/fims/mngt/MsgEntity.java index 57483533..db55b767 100644 --- a/src/main/java/cokr/xit/fims/mngt/MsgEntity.java +++ b/src/main/java/cokr/xit/fims/mngt/MsgEntity.java @@ -17,7 +17,7 @@ public class MsgEntity extends AbstractEntity { /** * G/W에 전송할 아이디 */ - private String msgSubId; + private String subId; /** * 사용자 고유 번호 diff --git a/src/main/java/cokr/xit/fims/mngt/service/bean/MsgServiceBean.java b/src/main/java/cokr/xit/fims/mngt/service/bean/MsgServiceBean.java index 4516a735..e4af98a7 100644 --- a/src/main/java/cokr/xit/fims/mngt/service/bean/MsgServiceBean.java +++ b/src/main/java/cokr/xit/fims/mngt/service/bean/MsgServiceBean.java @@ -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) 초과"); diff --git a/src/main/java/cokr/xit/fims/rent/web/RentInterfaceController.java b/src/main/java/cokr/xit/fims/rent/web/RentInterfaceController.java index 62c7201f..589e60b7 100644 --- a/src/main/java/cokr/xit/fims/rent/web/RentInterfaceController.java +++ b/src/main/java/cokr/xit/fims/rent/web/RentInterfaceController.java @@ -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 msgEntityList = new ArrayList(); - - 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 msgEntityList = new ArrayList(); List reqs = (List) 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 가능 여부 diff --git a/src/main/resources/sql/mapper/fims/mngt/msg-mapper.xml b/src/main/resources/sql/mapper/fims/mngt/msg-mapper.xml index 078e7a62..e9ad6989 100644 --- a/src/main/resources/sql/mapper/fims/mngt/msg-mapper.xml +++ b/src/main/resources/sql/mapper/fims/mngt/msg-mapper.xml @@ -119,12 +119,24 @@ INSERT ) VALUES ( nextval_msg() - , #{msgSubId} + , #{subId} , #{userKey}, #{userGroup}, #{userId}, #{userJobid} , CURRENT_TIMESTAMP - , + , + + , CURRENT_TIMESTAMP - , + , + + + + , STR_TO_DATE(#{resDate},'%Y%m%d%H%i%s') + + + , TO_DATE(#{resDate},'YYYYMMDDHH24MISS') + + , #{resDate} + , #{identifier} , #{phone}, #{callback} , #{msgType1}, #{contentsType1}