From f5c24deacba915717b0e07e58d7cc4a9cc06eab0 Mon Sep 17 00:00:00 2001 From: leebj Date: Mon, 11 Nov 2024 15:34:35 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=B8=EC=9E=90=EB=B0=9C=EC=86=A1=20?= =?UTF-8?q?=EC=97=B0=EA=B3=84=20=EC=86=8C=EC=8A=A4=20=EC=9D=B4=EB=8F=99(xi?= =?UTF-8?q?t-mms)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 29 +- .../java/cokr/xit/fims/mngt/MsgEntity.java | 413 ------------------ .../java/cokr/xit/fims/mngt/MsgQuery.java | 48 -- .../cokr/xit/fims/mngt/dao/MsgMapper.java | 20 - .../xit/fims/mngt/service/MsgService.java | 17 - .../xit/fims/mngt/service/bean/MsgBean.java | 33 -- .../mngt/service/bean/MsgServiceBean.java | 176 -------- .../xit/fims/mngt/web/Mngt03Controller.java | 30 +- .../rent/web/RentInterfaceController.java | 196 --------- .../sql/mapper/fims/mngt/msg-mapper.xml | 192 -------- 10 files changed, 25 insertions(+), 1129 deletions(-) delete mode 100644 src/main/java/cokr/xit/fims/mngt/MsgEntity.java delete mode 100644 src/main/java/cokr/xit/fims/mngt/MsgQuery.java delete mode 100644 src/main/java/cokr/xit/fims/mngt/dao/MsgMapper.java delete mode 100644 src/main/java/cokr/xit/fims/mngt/service/MsgService.java delete mode 100644 src/main/java/cokr/xit/fims/mngt/service/bean/MsgBean.java delete mode 100644 src/main/java/cokr/xit/fims/mngt/service/bean/MsgServiceBean.java delete mode 100644 src/main/java/cokr/xit/fims/rent/web/RentInterfaceController.java delete mode 100644 src/main/resources/sql/mapper/fims/mngt/msg-mapper.xml diff --git a/pom.xml b/pom.xml index bcb44010..4e742716 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ 2.7.18 - + cokr.xit.app fims-java-rent 1.0.0-SNAPSHOT fims-java-rent 과태료통합관리시스템java-rent jar - + UTF-8 17 @@ -28,7 +28,7 @@ https://nas.xit.co.kr:8888/repository/maven-public/ - + maven-public @@ -41,9 +41,9 @@ - + - + org.egovframe.rte @@ -65,7 +65,7 @@ - + 3rd-party echelon @@ -76,20 +76,27 @@ dguard compile - + - + cokr.xit.app fims-java-public 1.0.0-SNAPSHOT - + + + + cokr.xit.interfaces + xit-mms + 1.0.0-SNAPSHOT + + @@ -210,6 +217,6 @@ - - + + \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/mngt/MsgEntity.java b/src/main/java/cokr/xit/fims/mngt/MsgEntity.java deleted file mode 100644 index db55b767..00000000 --- a/src/main/java/cokr/xit/fims/mngt/MsgEntity.java +++ /dev/null @@ -1,413 +0,0 @@ -package cokr.xit.fims.mngt; - -import org.assertj.core.util.Arrays; - -import cokr.xit.foundation.AbstractEntity; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class MsgEntity extends AbstractEntity { - /** - * 고유번호 - */ - private String msgKey; - - /** - * G/W에 전송할 아이디 - */ - private String subId; - - /** - * 사용자 고유 번호 - */ - private String userKey; - - /** - * 사용자 그룹 - */ - private String userGroup; - - /** - * 사용자 고유 아이디 - */ - private String userId; - - /** - * 사용자 JOB 아이디 - */ - private String userJobid; - - /** - * 전송라인(추후 요구 시 사용) - */ - private String centerKey; - - /** - * 메시지 전송 우선 순위(추후 요구 시 사용) - */ - private String msgPriority; - - /** - * 메시지 상태 값 - */ - private String msgState; - - /** - * 메시지 입력시간(DB 서버 시간 기준) - */ - private String inputDate; - - /** - * 메시지 예약일시 - */ - private String resDate; - - /** - * 메시지를 수집한 시간 - */ - private String queDate; - - /** - * 메시지를 전송한 시간 - */ - private String sentDate; - - /** - * 핸드폰에 전달된 시간 - */ - private String rsltDate; - - /** - * G/W에서 결과를 수신한 시간 - */ - private String reportDate; - - /** - * 결과처리 상세코드 - */ - private String rsltCode; - - /** - * 결과처리 통신사 - */ - private String rsltNet; - - /** - * 결과처리된 메시지 유형 - */ - private String rsltType; - - /** - * 결과처리 히스토리 재전송 횟수 - */ - private String sentCount; - - /** - * 결과처리 히스토리 전송 타입 - */ - private String historyMsgType; - - /** - * 결과처리 히스토리 결과처리 상세코드 - */ - private String historyRsltCode; - - /** - * 메시지 식별자코드 - */ - private String identifier; - - /** - * 수신 번호 - */ - private String phone; - - /** - * 발신 번호 - */ - private String callback; - - /** - * 전송 타입 1번째 - */ - private String msgType1; - - /** - * 메시지 내용에 대한 타입 1번째 - */ - private String contentsType1; - - /** - * 1번째 메시지 수집한 시간 - */ - private String queDate1; - - /** - * 1번째 메시지 전송한 시간 - */ - private String sentDate1; - - /** - * 전송 타입 2번째 - */ - private String msgType2; - - /** - * 메시지 내용에 대한 타입 2번째 - */ - private String contentsType2; - - /** - * 2번째 메시지 수집한 시간 - */ - private String queDate2; - - /** - * 2번째 메시지 전송한 시간 - */ - private String sentDate2; - - /** - * 전송 타입 3번째 - */ - private String msgType3; - - /** - * 메시지 내용에 대한 타입 3번째 - */ - private String contentsType3; - - /** - * 3번째 메시지 수집한 시간 - */ - private String queDate3; - - /** - * 3번째 메시지 전송한 시간 - */ - private String sentDate3; - - /** - * XMS 결과처리 상세코드 - */ - private String xmsRsltCode; - - /** - * XMS 결과처리 통신사 - */ - private String xmsRsltNet; - - /** - * XMS 핸드폰에 전달된 시간 - */ - private String xmsRsltDate; - - /** - * XMS G/W에서 결과를 수신한 시간 - */ - private String xmsReportDate; - - /** - * ALT 결과처리 상세코드 - */ - private String altRsltCode; - - /** - * ALT 결과처리 통신사 - */ - private String altRsltNet; - - /** - * ALT 핸드폰에 전달된 시간 - */ - private String altRsltDate; - - /** - * ALT G/W에서 결과를 수신한 시간 - */ - private String altReportDate; - - /** - * RCS 결과처리 상세코드 - */ - private String rcsRsltCode; - - /** - * RCS 결과처리 통신사 - */ - private String rcsRsltNet; - - /** - * RCS 핸드폰에 전달된 시간 - */ - private String rcsRsltDate; - - /** - * RCS G/W에서 결과를 수신한 시간 - */ - private String rcsReportDate; - - /** - * 메시지 타이틀(LMS/MMS) - */ - private String xmsSubject; - - /** - * 메시지 본문(SMS/LMS/MMS) - */ - private String xmsText; - - /** - * 파일경로를 포함한 파일명1(MMS) - */ - private String xmsFileName1; - - /** - * 파일경로를 포함한 파일명2(MMS) - */ - private String xmsFileName2; - - /** - * 파일경로를 포함한 파일명3(MMS) - */ - private String xmsFileName3; - - /** - * ALT 국가코드(ALT,ALI) - */ - private String altCountryCode; - - /** - * ALT 사용자 아이디(ALT,ALI) - */ - private String altSenderKey; - - /** - * ALT 등록된 템플릿 고유키(ALT,ALI) - */ - private String altTemplateCode; - - /** - * 메시지 본문(ALT,ALI) - */ - private String altJson; - - /** - * RCS 브랜드 키 - */ - private String rcsBrandKey; - - /** - * RCS 메시지 베이스 아이디 - */ - private String rcsMassageBaseId; - - /** - * 메시지 본문(RCS) - */ - private String rcsJson; - - /** - * 실패 사유 - */ - private String failRsn; - - /** - * 1차,2차,3차 메시지 유형 설정 - */ - public void setMsgTypes(String[] types) { - if(types != null) { - if(types.length == 1) { - this.setMsgType1(types[0]); - this.setMsgType2(null); - this.setMsgType3(null); - } else if(types.length == 2) { - this.setMsgType1(types[0]); - this.setMsgType2(types[1]); - this.setMsgType3(null); - } else if(types.length == 3) { - this.setMsgType1(types[0]); - this.setMsgType2(types[1]); - this.setMsgType3(types[2]); - } - } - } - - /** - * 메시지 유형별 콘텐츠 유형 - */ - public static String[] SMS = {"SMS"}; - public static String[] MMS = {"LMS","MMS"}; - public static String[] ALT = {"ALT","ALI","FRT","FRI","FRW"}; - public static String[] RCS = {"RCS","RCL","RCM","RCT","RCD","RCF","RIT"}; - - /** - * (1차,2차,3차 메시지 유형 설정 후)콘텐츠 유형 설정 - */ - public void setContentsTypeN(String contentsType) { - - String msgType = ""; - if(Arrays.asList(SMS).contains(contentsType)) { - msgType = "SMS"; - } else if(Arrays.asList(MMS).contains(contentsType)){ - msgType = "MMS"; - } else if(Arrays.asList(ALT).contains(contentsType)) { - msgType = "ALT"; - } else if(Arrays.asList(RCS).contains(contentsType)) { - msgType = "RCS"; - } - - if(msgType.equals(this.msgType1)) { - this.contentsType1 = contentsType; - } else if(msgType.equals(this.msgType2)) { - this.contentsType2 = contentsType; - } else if(msgType.equals(this.msgType3)) { - this.contentsType3 = contentsType; - } - - } - - /** - * 현재 메시지 엔티티의 RCS의 콘텐츠 유형 반환 - */ - public String getContentsTypeOfRCS() { - if("RCS".equals(this.msgType1)) { - return this.contentsType1; - } else if("RCS".equals(this.msgType2)){ - return this.contentsType2; - } else if("RCS".equals(this.msgType3)){ - return this.contentsType3; - } - return null; - } - - /** - * 현재 메시지 엔티티의 알림톡의 콘텐츠 유형 반환 - */ - public String getContentsTypeOfALT() { - if("ALT".equals(this.msgType1)) { - return this.contentsType1; - } else if("ALT".equals(this.msgType2)){ - return this.contentsType2; - } else if("ALT".equals(this.msgType3)){ - return this.contentsType3; - } - return null; - } - - /** - * 현재 메시지 엔티티의 XMS의 콘텐츠 유형 반환 - */ - public String getContentsTypeOfXMS() { - if("SMS".equals(this.msgType1) || "MMS".equals(this.msgType1)) { - return this.contentsType1; - } else if("SMS".equals(this.msgType2) || "MMS".equals(this.msgType2)) { - return this.contentsType2; - } else if("SMS".equals(this.msgType3) || "MMS".equals(this.msgType3)) { - return this.contentsType3; - } - return null; - } -} diff --git a/src/main/java/cokr/xit/fims/mngt/MsgQuery.java b/src/main/java/cokr/xit/fims/mngt/MsgQuery.java deleted file mode 100644 index 1c1d9c76..00000000 --- a/src/main/java/cokr/xit/fims/mngt/MsgQuery.java +++ /dev/null @@ -1,48 +0,0 @@ -package cokr.xit.fims.mngt; - -import cokr.xit.fims.cmmn.CmmnQuery; - -public class MsgQuery extends CmmnQuery { - - private static final long serialVersionUID = 1L; - - private String schInputYmdFrom; - private String schInputYmdTo; - - private String stngInfoType; //설정정보유형(01:게이트웨이ID,02:송신전화번호,03:서비스사용자ID,04:템플릿) - - private String msgPrps; //고장신고,사전알림,주차신고민원,기타민원 - private String msgDtlPrps; - - private String callback; - private String phone; - private String msgState; - - public String getSchInputYmdFrom() { - return ifEmpty(schInputYmdFrom, () -> null); - } - - public T setSchInputYmdFrom(String schInputYmdFrom) { - this.schInputYmdFrom = schInputYmdFrom; - return self(); - } - - public String getSchInputYmdTo() { - return ifEmpty(schInputYmdTo, () -> null); - } - - public T setSchInputYmdTo(String schInputYmdTo) { - this.schInputYmdTo = schInputYmdTo; - return self(); - } - - public String getStngInfoType() { - return ifEmpty(stngInfoType, () -> null); - } - - public T setStngInfoType(String stngInfoType) { - this.stngInfoType = stngInfoType; - return self(); - } - -} diff --git a/src/main/java/cokr/xit/fims/mngt/dao/MsgMapper.java b/src/main/java/cokr/xit/fims/mngt/dao/MsgMapper.java deleted file mode 100644 index e7a7afe2..00000000 --- a/src/main/java/cokr/xit/fims/mngt/dao/MsgMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package cokr.xit.fims.mngt.dao; - -import java.util.List; - -import org.egovframe.rte.psl.dataaccess.mapper.Mapper; - -import cokr.xit.fims.mngt.MsgEntity; -import cokr.xit.fims.mngt.MsgQuery; -import cokr.xit.foundation.component.AbstractMapper; -import cokr.xit.foundation.data.DataObject; - -@Mapper("msgMapper") -public interface MsgMapper extends AbstractMapper { - - List selectList(MsgQuery msgQuery); - - int insert(MsgEntity msgEntity); - - DataObject selectStng(MsgQuery msgQuery); -} diff --git a/src/main/java/cokr/xit/fims/mngt/service/MsgService.java b/src/main/java/cokr/xit/fims/mngt/service/MsgService.java deleted file mode 100644 index f4579126..00000000 --- a/src/main/java/cokr/xit/fims/mngt/service/MsgService.java +++ /dev/null @@ -1,17 +0,0 @@ -package cokr.xit.fims.mngt.service; - -import java.util.List; -import java.util.Map; - -import cokr.xit.fims.mngt.MsgEntity; -import cokr.xit.fims.mngt.MsgQuery; -import cokr.xit.foundation.data.DataObject; - - -public interface MsgService { - - List getList(MsgQuery msgQuery); - - Map regist(List msgEntity); - -} diff --git a/src/main/java/cokr/xit/fims/mngt/service/bean/MsgBean.java b/src/main/java/cokr/xit/fims/mngt/service/bean/MsgBean.java deleted file mode 100644 index 812939ae..00000000 --- a/src/main/java/cokr/xit/fims/mngt/service/bean/MsgBean.java +++ /dev/null @@ -1,33 +0,0 @@ -package cokr.xit.fims.mngt.service.bean; - -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Component; - -import cokr.xit.fims.mngt.MsgEntity; -import cokr.xit.fims.mngt.MsgQuery; -import cokr.xit.fims.mngt.dao.MsgMapper; -import cokr.xit.foundation.component.AbstractBean; -import cokr.xit.foundation.data.DataObject; - -@Component("msgBean") -public class MsgBean extends AbstractBean { - - @Resource(name="msgMapper") - private MsgMapper msgMapper; - - public List getList(MsgQuery msgQuery) { - if(ifEmpty(msgQuery.getOrderBy(), ()->"").equals("")) { - msgQuery.setOrderBy("MSG_KEY"); - } - return msgMapper.selectList(msgQuery); - } - - public boolean regist(MsgEntity msgEntity) { - int result = msgMapper.insert(msgEntity); - return result == 1 ? true : false; - } - -} 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 deleted file mode 100644 index 51dfa656..00000000 --- a/src/main/java/cokr/xit/fims/mngt/service/bean/MsgServiceBean.java +++ /dev/null @@ -1,176 +0,0 @@ -package cokr.xit.fims.mngt.service.bean; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -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.Service; - -import cokr.xit.applib.AppCmmnUtil; -import cokr.xit.applib.Hangul; -import cokr.xit.fims.mngt.MsgEntity; -import cokr.xit.fims.mngt.MsgQuery; -import cokr.xit.fims.mngt.service.MsgService; -import cokr.xit.foundation.component.AbstractServiceBean; -import cokr.xit.foundation.data.DataObject; - -@Service("msgService") -public class MsgServiceBean extends AbstractServiceBean implements MsgService { - - @Resource(name="databaseIdProvider") - private VendorDatabaseIdProvider databaseIdProvider; - - @Resource(name="dataSource") - private DataSource dataSource; - - @Resource(name="msgBean") - private MsgBean msgBean; - - @Override - public List getList(MsgQuery msgQuery) { - return msgBean.getList(msgQuery); - } - - @Override - public Map regist(List msgEntityList) { - - Map resultMap = new HashMap(); - - List successList = new ArrayList(); - List failList = new ArrayList(); - - String databaseId = databaseIdProvider.getDatabaseId(dataSource); - - for(MsgEntity msgEntity : msgEntityList) { - - boolean isSuccess = false; - - //발신전화 검증 - if(ifEmpty(msgEntity.getCallback(), ()->"").equals("")) { - isSuccess = false; - msgEntity.setFailRsn("발신 전화번호 없음"); - failList.add(msgEntity); - continue; - } - if(!AppCmmnUtil.isTelno(msgEntity.getCallback())) { - isSuccess = false; - msgEntity.setFailRsn("발신 가능한 전화번호 형식이 아님"); - failList.add(msgEntity); - continue; - } - //수신전화 검증 - if(ifEmpty(msgEntity.getPhone(), ()->"").equals("")) { - isSuccess = false; - msgEntity.setFailRsn("수신 전화번호 없음"); - failList.add(msgEntity); - continue; - } - if(!AppCmmnUtil.isReceivePhone(msgEntity.getPhone())) { - isSuccess = false; - msgEntity.setFailRsn("수신 가능한 전화번호 형식이 아님"); - failList.add(msgEntity); - continue; - } - //발송예약일시 검증 - if(!ifEmpty(msgEntity.getResDate(), ()->"").equals("")) { - if(!AppCmmnUtil.isDateTimeDigitPattern(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) { - isSuccess = false; - msgEntity.setFailRsn("알림톡 글자수(1000자) 초과"); - failList.add(msgEntity); - continue; - } - } - - //RCS 검증 - if(!EgovStringUtil.null2void(msgEntity.getRcsBrandKey()).equals("")) { - String rcsJson = msgEntity.getRcsJson(); - // - } - - //XMS 제목 바이트 수 - int xmsSubjectByteCnt = hangul.getByteLength(msgEntity.getXmsSubject()); - - //XMS 내용 바이트 수 - int xmsContentByteCnt = hangul.getByteLength(msgEntity.getXmsText()); - - //XMS 내용 바이트 수 보정(줄바꿈문자) - if(databaseId.equals("mariadb") || databaseId.equals("mysql")) { - int lineChageCount = this.countLineChangeForNuri2Maria(msgEntity.getXmsText()); - xmsContentByteCnt = xmsContentByteCnt - (lineChageCount*3); - } else { - int lineChageCount = this.countLineChangeForNuri2Oracle(msgEntity.getXmsText()); - xmsContentByteCnt = xmsContentByteCnt - lineChageCount; - } - - String contentsTypeOfXMS = msgEntity.getContentsTypeOfXMS(); - - //XMS 검증 - if("SMS".equals(contentsTypeOfXMS) && xmsContentByteCnt > 90) { - isSuccess = false; - msgEntity.setFailRsn("SMS 최대 바이트 수(90byte) 초과"); - failList.add(msgEntity); - continue; - } - if("LMS".equals(contentsTypeOfXMS)) { - if(xmsSubjectByteCnt > 30) { - isSuccess = false; - msgEntity.setFailRsn("LMS 제목 최대 바이트 수(30byte) 초과"); - failList.add(msgEntity); - continue; - } - if(xmsContentByteCnt > 2000) { - isSuccess = false; - msgEntity.setFailRsn("LMS 내용 최대 바이트 수(2000byte) 초과"); - failList.add(msgEntity); - continue; - } - } - - isSuccess = msgBean.regist(msgEntity); - if(isSuccess) { - successList.add(msgEntity); - } else { - failList.add(msgEntity); - } - } - - resultMap.put("successList", successList); - resultMap.put("failList", failList); - - return resultMap; - } - - public int countLineChangeForNuri2Oracle(String str) { - if(str == null || str.equals("")) { - return 0; - } - - return str.split("\r\n",-1).length - 1; - } - public int countLineChangeForNuri2Maria(String str) { - if(str == null || str.equals("")) { - return 0; - } - - return str.split("\\\\r\\\\n",-1).length - 1; - } -} diff --git a/src/main/java/cokr/xit/fims/mngt/web/Mngt03Controller.java b/src/main/java/cokr/xit/fims/mngt/web/Mngt03Controller.java index 457a4266..dc11a8d9 100644 --- a/src/main/java/cokr/xit/fims/mngt/web/Mngt03Controller.java +++ b/src/main/java/cokr/xit/fims/mngt/web/Mngt03Controller.java @@ -1,22 +1,15 @@ package cokr.xit.fims.mngt.web; -import java.util.List; - -import javax.annotation.Resource; - import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; -import cokr.xit.base.web.ApplicationController; -import cokr.xit.fims.mngt.MsgQuery; -import cokr.xit.fims.mngt.dao.MsgMapper; -import cokr.xit.fims.mngt.service.MsgService; -import cokr.xit.foundation.data.DataObject; +import cokr.xit.interfaces.message.MessageQuery; +import cokr.xit.interfaces.message.web.MessageController; @Controller @RequestMapping(name="문자전송 관리", value=Mngt03Controller.CLASS_URL) -public class Mngt03Controller extends ApplicationController { +public class Mngt03Controller extends MessageController { public static final String CLASS_URL = "/mngt/mngt03"; @@ -27,29 +20,20 @@ public class Mngt03Controller extends ApplicationController { ; } - @Resource(name="msgService") - private MsgService msgService; - - @Resource(name="msgMapper") - private MsgMapper msgMapper; - - @RequestMapping(name="문자전송 현황 메인", value=METHOD_URL.main) public ModelAndView main() { ModelAndView mav = new ModelAndView(); + mav.setViewName("fims/mngt/mngt03010-main"); mav.addObject("pageName", "mngt03010"); return mav; } + @Override @RequestMapping(name="문자전송 목록", value=METHOD_URL.list) - public ModelAndView list(MsgQuery msgQuery) { - ModelAndView mav = new ModelAndView("jsonView"); - - List list = msgService.getList(msgQuery); - - return setPagingInfo(mav, list, ""); + public ModelAndView list(MessageQuery messageQuery) { + return super.list(messageQuery); } diff --git a/src/main/java/cokr/xit/fims/rent/web/RentInterfaceController.java b/src/main/java/cokr/xit/fims/rent/web/RentInterfaceController.java deleted file mode 100644 index 589e60b7..00000000 --- a/src/main/java/cokr/xit/fims/rent/web/RentInterfaceController.java +++ /dev/null @@ -1,196 +0,0 @@ -package cokr.xit.fims.rent.web; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -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; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import cokr.xit.base.web.ApplicationController; -import cokr.xit.fims.mngt.MsgEntity; -import cokr.xit.fims.mngt.MsgQuery; -import cokr.xit.fims.mngt.dao.MsgMapper; -import cokr.xit.fims.mngt.service.MsgService; -import net.minidev.json.JSONObject; - -@Controller("rentInterface") -@RequestMapping(value = "/intf/rent", name = "렌트카 관련 연계") -public class RentInterfaceController extends ApplicationController { - - @Resource(name="databaseIdProvider") - private VendorDatabaseIdProvider databaseIdProvider; - - @Resource(name="dataSource") - private DataSource dataSource; - - @Resource(name="msgService") - private MsgService msgService; - - @Resource(name="msgMapper") - private MsgMapper msgMapper; - - public final static String[] m_b_d = { - "{\"msg\":{\"body\":\"{description\":", - "},},}" - }; - public final static String[] t = { - "{\"text\":", - "}" - }; - - @PostMapping(name="문자전송 요청 등록", value="message/regist") - public ModelAndView regist(@RequestBody JSONObject apiSpec) { - ModelAndView mav = new ModelAndView("jsonView"); - - //누리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.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); - - if(databaseId.equals("mariadb") || databaseId.equals("mysql")){ - mssageCn = this.replaceLineChangeForNuri2Maria(mssageCn); - } else { - mssageCn = this.replaceLineChangeForNuri2Oracle(mssageCn); - } - - if(!EgovStringUtil.null2void(resDate).equals("")) { - msgEntity.setResDate(resDate); - } - - boolean able_kko = false; //알림톡 가능 여부 - boolean able_rcs = false; //RCS 가능 여부 - - if(able_kko && able_rcs) { // 알림톡+RCS+XMS - msgEntity.setMsgTypes(new String[]{"ALT","RCS","MMS"}); - msgEntity.setContentsTypeN("ALT"); - msgEntity.setContentsTypeN("RCL"); - msgEntity.setContentsTypeN("LMS"); - } else if(able_kko && !able_rcs) { // 알림톡+XMS - msgEntity.setMsgTypes(new String[]{"ALT","MMS"}); - msgEntity.setContentsTypeN("ALT"); - msgEntity.setContentsTypeN("LMS"); - msgEntity.setXmsText(mssageCn); - } else if(!able_kko && able_rcs){ // RCS+XMS - msgEntity.setMsgTypes(new String[]{"RCS","MMS"}); - msgEntity.setContentsTypeN("RCL"); - msgEntity.setContentsTypeN("LMS"); - msgEntity.setXmsText(mssageCn); - } else {// XMS - msgEntity.setMsgTypes(new String[]{"MMS"}); - msgEntity.setContentsTypeN("LMS"); - } - msgEntity.setXmsText(mssageCn); - - - - - if(able_kko) { - String json = t[0] + mssageCn + t[1]; - - msgEntity.setAltSenderKey("신청한센더키"); - msgEntity.setAltTemplateCode("신청한템플릿코드"); - - msgEntity.setAltJson(json); - - - } - - if(able_rcs) { - - msgEntity.setRcsBrandKey("신청한브랜드키"); - - String json = ""; - String contentsTypeOfRCS = msgEntity.getContentsTypeOfRCS(); - - if("RCS".equals(contentsTypeOfRCS)) { - msgEntity.setRcsMassageBaseId("SS000000"); - } else if("RCL".equals(contentsTypeOfRCS)) { - msgEntity.setRcsMassageBaseId("SL000000"); - } else { - - throw new RuntimeException(""); - //RCT //baseid 발급 필요 - //RLT //RCT의 오타 - //RCD,RCF //baseId 발급 필요,mgov예제에 없는 형식 - //RCM,RIT //baseId 발급 필요,필요하지 않는 형식(미디어 첨부) - } - - json = m_b_d[0] + mssageCn + m_b_d[1]; - - msgEntity.setRcsJson(json); - } - msgEntityList.add(msgEntity); - } - - // - - Map resultMap = msgService.regist(msgEntityList); - - mav.addObject("resultMap", resultMap); - mav.addObject("saved",true); - return mav; - } - - public String replaceLineChangeForNuri2Oracle(String str) { - String result = ""; - result = str.replaceAll("\r",""); - result = result.replaceAll("\n","\r\n"); - return result; - } - - public String replaceLineChangeForNuri2Maria(String str) { - String result = ""; - result = str.replaceAll("\r",""); - result = result.replaceAll("\n", "\\\\r\\\\n"); - return result; - } -} diff --git a/src/main/resources/sql/mapper/fims/mngt/msg-mapper.xml b/src/main/resources/sql/mapper/fims/mngt/msg-mapper.xml deleted file mode 100644 index c67538ff..00000000 --- a/src/main/resources/sql/mapper/fims/mngt/msg-mapper.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - -/* 문자전송 요청 등록(msgMapper.insert) */ -INSERT - INTO NURI2_NRMSG_DATA ( - SUB_ID - , USER_KEY, USER_GROUP, USER_ID, USER_JOBID - , INPUT_DATE - , INPUT_DT - , RES_DATE - , RES_DT - , IDENTIFIER - , PHONE, CALLBACK - , MSG_TYPE_1, CONTENTS_TYPE_1 - , MSG_TYPE_2, CONTENTS_TYPE_2 - , MSG_TYPE_3, CONTENTS_TYPE_3 - , XMS_SUBJECT - , XMS_TEXT - - , ALT_COUNTRY_CODE - , ALT_SENDER_KEY - , ALT_TEMPLATE_CODE - , ALT_JSON - - - , RCS_BRAND_KEY - , RCS_MASSAGE_BASE_ID - , RCS_JSON - - - - - - - - - - - - -) -VALUES ( - #{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} - , #{msgType2}, #{contentsType2} - , #{msgType3}, #{contentsType3} - , #{xmsSubject} - , #{xmsText} - - , '82' - , #{altSenderKey} - , #{altTemplateCode} - , #{altJson} - - - , #{rcsBrandKey} - , #{rcsMassageBaseId} - , #{rcsJson} - - - - - - - - - - - - -) - - - - - \ No newline at end of file