diff --git a/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgInBean.java b/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgReceiverBean.java similarity index 89% rename from src/main/java/cokr/xit/interfaces/smg/service/bean/SmgInBean.java rename to src/main/java/cokr/xit/interfaces/smg/service/bean/SmgReceiverBean.java index 02ed10d..9006607 100644 --- a/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgInBean.java +++ b/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgReceiverBean.java @@ -15,16 +15,16 @@ import org.springframework.stereotype.Component; import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.foundation.data.XML; -import cokr.xit.foundation.web.Http; +import cokr.xit.foundation.web.WebClient; import cokr.xit.interfaces.filejob.service.bean.FileJobBean; import cokr.xit.interfaces.smg.Petition; import cokr.xit.interfaces.smg.dao.SmgMapper; -/**국민 신문고 수신 민원 파일 작업 Bean +/**국민신문고 민원파일 수신작업 Bean * @author mjkhan */ -@Component("smgInBean") -public class SmgInBean extends FileJobBean { +@Component("smgReceiverBean") +public class SmgReceiverBean extends FileJobBean { @Resource(name = "smgMapper") private SmgMapper smgMapper; @Resource(name = "fileBean") @@ -36,7 +36,7 @@ public class SmgInBean extends FileJobBean { */ @Override public String jobName() { - return "smg-in"; + return "smg-receive"; } /**지정한 인터페이스 키의 민원 목록을 반환한다. @@ -147,9 +147,11 @@ public class SmgInBean extends FileJobBean { String alert = config("alert"); if (isEmpty(alert)) return; - new Http().post(new Http.Conf() - .url(alert) - .param("interfaceSequences", String.join(",", interfaceSequences)) + new WebClient().post(req -> + req.uri(alert) + .data("interfaceSequences", interfaceSequences) + .json(true) + .async(true) ); } } \ No newline at end of file diff --git a/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgOutBean.java b/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgSenderBean.java similarity index 86% rename from src/main/java/cokr/xit/interfaces/smg/service/bean/SmgOutBean.java rename to src/main/java/cokr/xit/interfaces/smg/service/bean/SmgSenderBean.java index 351ecaa..610e9b3 100644 --- a/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgOutBean.java +++ b/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgSenderBean.java @@ -17,16 +17,16 @@ import javax.annotation.Resource; import org.springframework.stereotype.Component; import cokr.xit.foundation.data.XML; -import cokr.xit.foundation.web.Http; +import cokr.xit.foundation.web.WebClient; import cokr.xit.interfaces.filejob.service.bean.FileJobBean; import cokr.xit.interfaces.smg.Petition; import cokr.xit.interfaces.smg.dao.SmgMapper; -/**민원의 답변/반송 파일 작업 Bean +/**민원 답변/반송 파일 전송작업 Bean * @author mjkhan */ -@Component("smgOutBean") -public class SmgOutBean extends FileJobBean { +@Component("smgSenderBean") +public class SmgSenderBean extends FileJobBean { private static final SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyyMMddhhmmss"); @Resource(name = "smgMapper") @@ -37,7 +37,7 @@ public class SmgOutBean extends FileJobBean { */ @Override public String jobName() { - return "smg-out"; + return "smg-send"; } /**지정하는 인터페이스 키의 민원의 답변/반송 목록을 반환한다. @@ -154,15 +154,17 @@ public class SmgOutBean extends FileJobBean { if (isEmpty(alert)) return; Map> processed = replies.stream().collect(Collectors.groupingBy(Petition::getSendStatus)); - List list = processed.get("Y"); - String success = list != null ? list.stream().map(Petition::getInterfaceSeqN).collect(Collectors.joining(",")) : ""; - list = processed.get("N"); - String fail = list != null ? list.stream().map(Petition::getInterfaceSeqN).collect(Collectors.joining(",")) : ""; - - new Http().post(new Http.Conf() - .url(alert) - .param("success", success) - .param("fail", fail) + List list = ifEmpty(processed.get("Y"), Collections::emptyList); + List success = list.stream().map(Petition::getInterfaceSeqN).toList(); + list = ifEmpty(processed.get("N"), Collections::emptyList); + List fail = list.stream().map(Petition::getInterfaceSeqN).toList(); + + new WebClient().post(req -> + req.uri(alert) + .data("success", success) + .data("fail", fail) + .json(true) + .async(true) ); } } \ No newline at end of file diff --git a/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgServiceBean.java b/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgServiceBean.java index 666cc04..e16aea0 100644 --- a/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgServiceBean.java +++ b/src/main/java/cokr/xit/interfaces/smg/service/bean/SmgServiceBean.java @@ -11,41 +11,41 @@ import cokr.xit.interfaces.smg.Petition; import cokr.xit.interfaces.smg.service.SmgService; /**국민 신문고 민원 연계 서비스의 구현체 - *
  • 민원 수신은 {@link SmgInBean}
  • - *
  • 민원 답변/회수는 {@link SmgOutBean}
  • + *
    • 민원 수신은 {@link SmgReceiverBean}
    • + *
    • 민원 답변/회수는 {@link SmgSenderBean}
    • *
    * 이 처리한다. * @author mjkhan */ @Service("smgService") public class SmgServiceBean extends FileJobServiceBean implements SmgService { - @Resource(name = "smgInBean") - private SmgInBean smgIn; - @Resource(name = "smgOutBean") - private SmgOutBean smgOut; + @Resource(name = "smgReceiverBean") + private SmgReceiverBean smgReceiver; + @Resource(name = "smgSenderBean") + private SmgSenderBean smgSender; @Override public List getPetitions(List interfaceSequences) { - return smgIn.getPetitions(interfaceSequences); + return smgReceiver.getPetitions(interfaceSequences); } @Override public List receivePetitions() { - return execute(smgIn, smgIn::receivePetitions); + return execute(smgReceiver, smgReceiver::receivePetitions); } @Override public List getReplies(List interfaceSequences) { - return smgOut.getReplies(interfaceSequences); + return smgSender.getReplies(interfaceSequences); } @Override public boolean createReply(Petition reply) { - return smgOut.createReply(reply); + return smgSender.createReply(reply); } @Override public List sendReplies() { - return execute(smgOut, smgOut::sendReplies); + return execute(smgSender, smgSender::sendReplies); } } \ No newline at end of file diff --git a/src/main/resources/sql/mapper/smg/smg-mapper.xml b/src/main/resources/sql/mapper/smg/smg-mapper.xml new file mode 100644 index 0000000..19f9689 --- /dev/null +++ b/src/main/resources/sql/mapper/smg/smg-mapper.xml @@ -0,0 +1,386 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/* smgMapper.insertPetition(국민신문고 수신 민원 등록) */ +INSERT INTO TB_ESB_INTERFACE ( + INTERFACE_SEQ_N + , SYS_GUBUN_C + , ANC_CODE_V + , PETI_GUBUN_C + , PETI_ANC_CODE_V + , PETI_NO_C + , CIVIL_NO_C + , PETER_NAME_V + , ZIP_CODE_C + , ADDRESS_V + , EMAIL_V + , CEL_NO_V + , TEL_NO_V + , PETI_TITLE_V + , PETI_REASON_L + , OPEN_YN_C + , PETI_REG_D + , PETI_REASON_ATTACH_YN_C + , CIVIL_GIST_V + , CIVIL_ABSTRACT_L + , PCD_DEPT_V + , PCD_DEPT_NM_V + , DUTY_ID_V + , PCD_EMAIL_V + , PCD_TEL_V + , PCD_RST_CONT_L + , DO_REG_D + , PCD_RST_CONT_ATTACH_YN_C + , PCD_ANC_CODE_V + , PETI_PROC_DUR_N + , PETI_END_D + , ANC_REG_D + , MORE_AGAIN_V + , SATISFY_C + , SATISFY2_C + , SATISFY3_C + , SATISFY_REG_D + , REG_D + , SEND_YN_C + , SEND_D + , APPLY_D + , APPLY_GUBUN_C + , PCD_GUBUN_V + , PCD_GUBUN2_V + , PCD_GUBUN3_V + , PETI_PATH_GUBUN_C + , ORGNL_FILE_NM + , REG_DT + , RGTR +) VALUES ( + #{interfaceSeqN} + , #{sysGubunC} + , #{ancCodeV} + , #{petiGubunC} + , #{petiAncCodeV} + , #{petiNoC} + , #{civilNoC} + , #{peterNameV} + , #{zipCodeC} + , #{addressV} + , #{emailV} + , #{celNoV} + , #{telNoV} + , #{petiTitleV} + , #{petiReasonL} + , #{openYnC} + , #{petiRegD} + , #{petiReasonAttachYnC} + , #{civilGistV} + , #{civilAbstractL} + , #{pcdDeptV} + , #{pcdDeptNmV} + , #{dutyIdV} + , #{pcdEmailV} + , #{pcdTelV} + , #{pcdRstContL} + , #{doRegD} + , #{pcdRstContAttachYnC} + , #{pcdAncCodeV} + , #{petiProcDurN} + , #{petiEndD} + , #{ancRegD} + , #{moreAgainV} + , #{satisfyC} + , #{satisfy2C} + , #{satisfy3C} + , #{satisfyRegD} + , #{regD} + , #{sendYnC} + , #{sendD} + , #{applyD} + , #{applyGubunC} + , #{pcdGubunV} + , #{pcdGubun2V} + , #{pcdGubun3V} + , #{petiPathGubunC} + , #{originalFilename} + , + , #{createdBy} +) + +/* smgMapper.insertFile(국민신문고 수신 민원 첨부파일 등록) */ +INSERT INTO TB_ESB_INTERFACE_FILE ( + INTERFACE_SEQ_N + + , PETI_FILE_SIZE_N + , PETI_FILE_PATH1_V + , PETI_FILE_PATH2_V + , PETI_FILE_PATH3_V + , PETI_FILE_PATH4_V + , PETI_FILE_PATH5_V + + , PCD_FILE_SIZE_N + , PCD_FILE_PATH1_V + , PCD_FILE_PATH2_V + , PCD_FILE_PATH3_V + , PCD_FILE_PATH4_V + , PCD_FILE_PATH5_V + + , STRG_ATCHFILE_NM1 + , STRG_ATCHFILE_NM2 + , STRG_ATCHFILE_NM3 + , STRG_ATCHFILE_NM4 + , STRG_ATCHFILE_NM5 +) VALUES ( + #{interfaceSeqN} + + , #{petiFileSizeN} + , #{petiFilePath1V} + , #{petiFilePath2V} + , #{petiFilePath3V} + , #{petiFilePath4V} + , #{petiFilePath5V} + + , #{pcdFileSizeN} + , #{pcdFilePath1V} + , #{pcdFilePath1V} + , #{pcdFilePath1V} + , #{pcdFilePath1V} + , #{pcdFilePath1V} + + , #{attachmentPath1} + , #{attachmentPath2} + , #{attachmentPath3} + , #{attachmentPath4} + , #{attachmentPath5} +) + + + +/* smgMapper.insertReply(답변/반송 등록)*/ +INSERT INTO TB_ESB_INTERFACE_TRSM ( + INTERFACE_SEQ_N + , SYS_GUBUN_C + , ANC_CODE_V + , PETI_GUBUN_C + , PETI_ANC_CODE_V + , PETI_NO_C + , CIVIL_NO_C + , CIVIL_GIST_V + , CIVIL_ABSTRACT_L + , PCD_DEPT_V + , PCD_DEPT_NM_V + , DUTY_ID_V + , PCD_EMAIL_V + , PCD_TEL_V + , PCD_RST_CONT_L + , DO_REG_D + , PCD_RST_CONT_ATTACH_YN_C + , PCD_ANC_CODE_V + , REG_D + , SEND_YN_C + , SEND_D + , APPLY_D + , APPLY_GUBUN_C + , PCD_GUBUN_V + , PCD_GUBUN2_V + , PCD_GUBUN3_V + , TRSM_INTERFACE_SEQ_N + , TRSM_STTS_CD + , TRSM_STTS_MSG + , REG_DT + , RGTR + , MDFCN_DT + , MDFR +) VALUES ( + #{reply.interfaceSeqN} + , #{reply.sysGubunC} + , #{reply.ancCodeV} + , #{reply.petiGubunC} + , #{reply.petiAncCodeV} + , #{reply.petiNoC} + , #{reply.civilNoC} + , #{reply.civilGistV} + , #{reply.civilAbstractL} + , #{reply.pcdDeptV} + , #{reply.pcdDeptNmV} + , #{reply.dutyIdV} + , #{reply.pcdEmailV} + , #{reply.pcdTelV} + , #{reply.pcdRstContL} + , #{reply.doRegD} + , #{reply.pcdRstContAttachYnC} + , #{reply.pcdAncCodeV} + , #{reply.regD} + , #{reply.sendYnC} + , #{reply.sendD} + , #{reply.applyD} + , #{reply.applyGubunC} + , #{reply.pcdGubunV} + , #{reply.pcdGubun2V} + , #{reply.pcdGubun3V} + , #{reply.sendInterfaceSeqN} + , #{reply.sendStatus} + , #{reply.sendStatusMsg} + , + , #{currentUser.id} + , + , #{currentUser.id} +) + +/* smgMapper.updateSendStatus(답변/반송 전송상태 업데이트) */ +UPDATE TB_ESB_INTERFACE_TRSM A + , ( + SELECT #{reply.interfaceSeqN} INTERFACE_SEQ_N, #{reply.sendInterfaceSeqN} TRSM_INTERFACE_SEQ_N, #{reply.sendD} SEND_D, #{reply.applyD} APPLY_D, #{reply.applyGubunC} APPLY_GUBUN_C, #{reply.sendStatus} TRSM_STTS_CD, #{reply.sendStatusMsg} TRSM_STTS_MSG + ) B + SET A.TRSM_INTERFACE_SEQ_N = B.TRSM_INTERFACE_SEQ_N + , A.SEND_D = B.SEND_D + , A.APPLY_D = B.APPLY_D + , A.APPLY_GUBUN_C = B.APPLY_GUBUN_C + , A.TRSM_STTS_CD = B.TRSM_STTS_CD + , A.TRSM_STTS_MSG = B.TRSM_STTS_MSG + , A.MDFCN_DT = #{now} + , A.MDFR = #{currentUser.id} + WHERE A.INTERFACE_SEQ_N = B.INTERFACE_SEQ_N + + \ No newline at end of file