From f385cbd62e92219428151edaa435c239502c4432 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Mon, 21 Aug 2023 09:31:45 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8B=B5=EB=B3=80=20=EB=AF=B8=EB=A6=AC?= =?UTF-8?q?=EB=B3=B4=EA=B8=B0=20=EC=A1=B0=ED=9A=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/fims/crdn/CrdnQuery.java | 32 +++++++ .../java/cokr/xit/fims/cvlc/CrdnCvlcpt.java | 5 + .../xit/fims/cvlc/dao/CrdnCvlcptMapper.java | 28 +++--- .../cvlc/service/bean/CrdnCvlcptBean.java | 96 ++++++++++++++++--- .../service/bean/CrdnCvlcptServiceBean.java | 31 ++++-- .../sql/mapper/fims/crdn/crdn-info-mapper.xml | 8 ++ .../sql/mapper/fims/crdn/crdn-list-mapper.xml | 2 +- .../mapper/fims/cvlc/crdnCvlcpt-mapper.xml | 48 ++++++---- 8 files changed, 198 insertions(+), 52 deletions(-) diff --git a/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java b/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java index 81b216d4..fe67af29 100644 --- a/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java +++ b/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java @@ -51,6 +51,8 @@ public class CrdnQuery extends CmmnQuery { private String crdnInptSeCd; private String cvlcptPrcsCd; private String crdnSttsCd; + private String ansSeCd; + private String ansRsnCd; //포함, 제외, 특정 자료 private String schOnlySamePlace; @@ -58,6 +60,9 @@ public class CrdnQuery extends CmmnQuery { private String schExclEnd; private String schExclOvtime; + //YN + private String dstrbncYn; + //기타 private String vhrno; private String cvlcptPrcsPicNm; @@ -125,6 +130,15 @@ public class CrdnQuery extends CmmnQuery { return self(); } + public String getDstrbncYn() { + return ifEmpty(dstrbncYn, () -> null); + } + + public T setDstrbncYn(String dstrbncYn) { + this.dstrbncYn = dstrbncYn; + return self(); + } + public String getVhrno() { return ifEmpty(vhrno, () -> null); } @@ -278,6 +292,24 @@ public class CrdnQuery extends CmmnQuery { return self(); } + public String getAnsSeCd() { + return ifEmpty(ansSeCd, () -> null); + } + + public T setAnsSeCd(String ansSeCd) { + this.ansSeCd = ansSeCd; + return self(); + } + + public String getAnsRsnCd() { + return ifEmpty(ansRsnCd, () -> null); + } + + public T setAnsRsnCd(String ansRsnCd) { + this.ansRsnCd = ansRsnCd; + return self(); + } + public String getAplcnYmd() { return ifEmpty(aplcnYmd, () -> null); } diff --git a/src/main/java/cokr/xit/fims/cvlc/CrdnCvlcpt.java b/src/main/java/cokr/xit/fims/cvlc/CrdnCvlcpt.java index ad8e4a1c..2f7f1a04 100644 --- a/src/main/java/cokr/xit/fims/cvlc/CrdnCvlcpt.java +++ b/src/main/java/cokr/xit/fims/cvlc/CrdnCvlcpt.java @@ -11,6 +11,11 @@ import lombok.Setter; @Getter @Setter public class CrdnCvlcpt extends AbstractEntity { + + public static String MACRO_SEQ = "\\[@일련번호\\]"; + + public static String MACRO_TELNO = "\\[@전화번호\\]"; + /** * 민원 연계 ID */ diff --git a/src/main/java/cokr/xit/fims/cvlc/dao/CrdnCvlcptMapper.java b/src/main/java/cokr/xit/fims/cvlc/dao/CrdnCvlcptMapper.java index 0848801b..2fe04dd4 100644 --- a/src/main/java/cokr/xit/fims/cvlc/dao/CrdnCvlcptMapper.java +++ b/src/main/java/cokr/xit/fims/cvlc/dao/CrdnCvlcptMapper.java @@ -71,6 +71,18 @@ public interface CrdnCvlcptMapper extends AbstractMapper { */ int updateCrdnAddition(Map params); + /** 지정한 단속자료로 단속대장을 복사 등록 처리한다. + * @param params 단속정보 등록 파라미터 + * @return 저장된 정보 수 + */ + int insertCrdnFromSelect(DataObject params); + + /** 지정한 단속자료로 단속부가정보대장을 복사 등록 처리한다. + * @param params 단속정보 등록 파라미터 + * @return 저장된 정보 수 + */ + int insertCrdnAdditionFromSelect(DataObject params); + /**민원답변대상자료 목록을 조회한다.
* {@link cokr.xit.fims.cvlc.service.bean.CrdnCvlcptService#getCivilComplaintList(CrdnQuery)} 참고 * @param query 민원답변대상자료 목록 조회 조건 @@ -95,18 +107,12 @@ public interface CrdnCvlcptMapper extends AbstractMapper { * @param params 답변문구 조회 파라미터 * @return 답변문구 대장 정보 */ - DataObject selectCvlcptAnsWordsInfo(Map params); + DataObject selectCvlcptAnswerWordsInfo(CrdnQuery crdnQuery); - /**지정한 단속자료로 단속대장을 복사 등록 처리한다. - * @param params 단속정보 등록 파라미터 - * @return 저장된 정보 수 - */ - int insertCrdnFromSelect(DataObject params); - - /**지정한 단속자료로 단속부가정보대장을 복사 등록 처리한다. - * @param params 단속정보 등록 파라미터 - * @return 저장된 정보 수 + /**지정한 조건에 따라 민원 답변 문구 대장을 조회하여 반환한다. + * @param params 답변문구 조회 파라미터 + * @return 답변문구 대장 정보 */ - int insertCrdnAdditionFromSelect(DataObject params); + DataObject selectCvlcptAnswerBasicWordsInfo(CrdnQuery crdnQuery); } diff --git a/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptBean.java b/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptBean.java index c8aa88ee..8368f887 100644 --- a/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptBean.java +++ b/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptBean.java @@ -6,8 +6,11 @@ import javax.annotation.Resource; import org.springframework.stereotype.Component; +import cokr.xit.base.user.ManagedUser; +import cokr.xit.base.user.dao.UserMapper; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.dao.CrdnInfoMapper; import cokr.xit.fims.crdn.dao.CrdnInstMapper; import cokr.xit.fims.crdn.dao.CrdnUpdtMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper; @@ -26,12 +29,18 @@ public class CrdnCvlcptBean extends AbstractComponent { @Resource(name = "crdnCvlcptMapper") private CrdnCvlcptMapper crdnCvlcptMapper; + @Resource(name = "crdnInfoMapper") + private CrdnInfoMapper crdnInfoMapper; + @Resource(name = "crdnInstMapper") private CrdnInstMapper crdnInstMapper; @Resource(name = "crdnUpdtMapper") private CrdnUpdtMapper crdnUpdtMapper; + @Resource(name = "userMapper") + private UserMapper userMapper; + @Resource(name="globalStngMapper") protected GlobalStngMapper globalStngMapper; @@ -93,26 +102,12 @@ public class CrdnCvlcptBean extends AbstractComponent { return crdnCvlcptMapper.initCvlcptPrcsRsltCn(crdnCvlcpt) == 1 ? true : false; } - /**지정한 조건에 따라 민원답변문구 대장을 조회하여 반환한다. - * @param taskSeCd 업무구분코드, ansRsnCd 답변 사유 코드 - * @return 답변문구 - */ - DataObject selectCvlcptAnsWordsInfo(String taskSeCd, String ansRsnCd) { - DataObject params = new DataObject(); - - params.set("sggCd", globalStngMapper.selectSggCdForCurrentUser()); - params.set("taskSeCd", taskSeCd); - params.set("ansRsnCd", ansRsnCd); - - return crdnCvlcptMapper.selectCvlcptAnsWordsInfo(params); - } - /**지정한 단속자료로 복사 등록 처리한다. * @param crdnId 단속 ID * @return 복사자료의 단속 ID */ public String insertCrdnFromSelect(String crdnId) { - //Crdn crdn = new Crdn(); + DataObject params = new DataObject(); UserInfo userInfo = currentUser(); params.set("currentUser", userInfo); @@ -128,4 +123,75 @@ public class CrdnCvlcptBean extends AbstractComponent { return (String)params.get("newCrdnId"); } + + /**지정한 민원 자료의 답변 예정 문구를 반환한다. + * @param crdnId 단속 ID + * @return 답변 예정 문구 + */ + public String mappingAnswerWords(String crdnId) { + + DataObject dataInfo = crdnInfoMapper.selectCrdnInfo(crdnId); + + CrdnQuery crdnQuery = new CrdnQuery(); + crdnQuery.setTaskSeCd(dataInfo.string("TASK_SE_CD")); + crdnQuery.setSggCd(dataInfo.string("SGG_CD")); + + if(dataInfo.string("CVLCPT_PRCS_CD").equals("02")) { + crdnQuery.setAnsSeCd("3"); + crdnQuery.setAnsRsnCd("3"+dataInfo.string("VLTN_CD")); + + if(dataInfo.string("DSTRBNC_YN").equals("Y")) { + crdnQuery.setDstrbncYn("Y"); + } + + } else if(dataInfo.string("CVLCPT_PRCS_CD").equals("03") + || dataInfo.string("CVLCPT_PRCS_CD").equals("04")){ + crdnQuery.setAnsSeCd(dataInfo.string("LEVY_EXCL_SE_CD")); + crdnQuery.setAnsRsnCd(dataInfo.string("LEVY_EXCL_RSN_CD")); + } else { + return ""; + } + + DataObject bodyWordsInfo = crdnCvlcptMapper.selectCvlcptAnswerWordsInfo(crdnQuery); + DataObject basicWordsInfo = crdnCvlcptMapper.selectCvlcptAnswerBasicWordsInfo(crdnQuery); + + String body = bodyWordsInfo.string("PRCS_RSLT_CN"); + String head = basicWordsInfo.string("HEADER_CN"); + String tail = basicWordsInfo.string("FOOTER_CN"); + + if(body.equals("")) { + return ""; + } + + String joinWords = head + "\n\n" + body + "\n\n" + tail; + + ManagedUser currentUser = userMapper.getUser(UserInfo.current().getAccount(), UserInfo.current().getInstitute()); + + String completeWords = this.replaceMacroString(joinWords , currentUser.getPhoneNo()); + + return completeWords; + } + + /**문구의 매크로 문자열을 치환한다. + * @param joinWords 전체 문구, telNo 담당자 전화번호 + * @return 치환된 문구 + */ + private String replaceMacroString(String joinWords, String telNo) { + + int seq = 1; + + joinWords = joinWords.replaceAll("@", "@"); + String[] splited = joinWords.split(CrdnCvlcpt.MACRO_SEQ); + var seqCount = splited.length - 1; + if(seqCount > 0){ + for(; seq <= seqCount; seq++){ + joinWords = joinWords.replaceFirst(CrdnCvlcpt.MACRO_SEQ, Integer.toString(seq)); + } + } + + joinWords = joinWords.replace(CrdnCvlcpt.MACRO_TELNO, telNo); + return joinWords; + } + + } diff --git a/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java b/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java index 8c901e02..6ad3c1e1 100644 --- a/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java +++ b/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java @@ -227,7 +227,15 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv @Override public DataObject getAnswerPreview(CrdnQuery query) { - return crdnCvlcptMapper.selectAnswerPreview(query); + DataObject dataObject = crdnCvlcptMapper.selectAnswerPreview(query); + + //저장된 답변이 없으면 + if(ifEmpty(dataObject.string("CVLCPT_PRCS_RSLT_CN"), () -> "").equals("")) { + String resultWords = crdnCvlcptBean.mappingAnswerWords(query.getCrdnId()); + dataObject.set("CVLCPT_PRCS_RSLT_CN", resultWords); + } + + return dataObject; } @Override @@ -311,7 +319,14 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv ansRsnCd = "3"+crdn.getVltnCd(); } - DataObject infoCvlcptAnsWords = crdnCvlcptBean.selectCvlcptAnsWordsInfo(crdn.getTaskSeCd(), ansRsnCd); + CrdnQuery crdnQuery = new CrdnQuery(); + crdnQuery.setSggCd(globalStngMapper.selectSggCdForCurrentUser()); + crdnQuery.setTaskSeCd(crdn.getTaskSeCd()); + crdnQuery.setAnsRsnCd(ansRsnCd); + if(ifEmpty(crdnCvlcpt.getDstrbncYn(), () -> "").equals("Y")) { + crdnQuery.setDstrbncYn("Y"); + } + DataObject infoCvlcptAnsWords = crdnCvlcptMapper.selectCvlcptAnswerWordsInfo(crdnQuery); if(acceptType.equals("someAccept") || acceptType.equals("nonAccept")) { //일부수용,불수용 // 비부과(서손)사유가 민원 답변대상인가? 민원 답변 문구(TB_CVLCPT_ANS_WORDS) 대장에 답변 사유 코드가 존재한다면.. @@ -323,17 +338,19 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv newCvlcptTrsmCd = "03"; // 민원 전송 코드 - 비부과(서손)사유가 전송 미대상 } } else { //수용일 때 - if(infoCvlcptAnsWords == null) { - throw new RuntimeException("단속민원답변 수정에 실패하였습니다."); - } + newCvlcptPrcsCd = "02"; // 민원 처리 코드 - 수용 newCvlcptTrsmCd = "01"; // 민원 전송 코드 - 전송 대상 } crdnCvlcpt.setCvlcptPrcsCd(newCvlcptPrcsCd); // 민원 처리 코드 - if (infoCvlcptAnsWords != null) { - crdnCvlcpt.setCvlcptPrcsSumry(infoCvlcptAnsWords.string("PRCS_SUMRY")); // 민원 처리 요약 + if (acceptType.equals("someAccept")) { + crdnCvlcpt.setCvlcptPrcsSumry("과태료 계고"); // 민원 처리 요약 + } else if(acceptType.equals("accept")) { + crdnCvlcpt.setCvlcptPrcsSumry("과태료부과"); // 민원 처리 요약 + } else if(acceptType.equals("nonAccept")) { + crdnCvlcpt.setCvlcptPrcsSumry("과태료 미부과"); // 민원 처리 요약 } crdnCvlcpt.setCvlcptPrcsPic(UserInfo.current().getId()); // 민원 처리 담당자 diff --git a/src/main/resources/sql/mapper/fims/crdn/crdn-info-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/crdn-info-mapper.xml index 90391db7..93ad6493 100644 --- a/src/main/resources/sql/mapper/fims/crdn/crdn-info-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/crdn-info-mapper.xml @@ -88,6 +88,7 @@ diff --git a/src/main/resources/sql/mapper/fims/crdn/crdn-list-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/crdn-list-mapper.xml index e29adcb7..8971b67c 100644 --- a/src/main/resources/sql/mapper/fims/crdn/crdn-list-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/crdn-list-mapper.xml @@ -96,7 +96,7 @@ FROM TB_CRDN C INNER JOIN TB_CRDN_ADI CA ON (C.CRDN_ID = CA.CRDN_ID) LEFT OUTER JOIN TB_TEAM_INFO TI ON (CA.TEAM_ID = TI.TEAM_ID) LEFT OUTER JOIN TB_CRDN_CVLCPT CC ON (C.CVLCPT_LINK_YN = 'Y' AND C.LINK_ID = CC.CVLCPT_LINK_ID) -LEFT OUTER JOIN TB_LEVY_EXCL LE ON (C.CRDN_ID = LE.CRDN_ID) +LEFT OUTER JOIN TB_LEVY_EXCL LE ON (C.CRDN_ID = LE.CRDN_ID AND LE.DEL_YN = 'N') LEFT OUTER JOIN TB_LEVY L ON (C.LEVY_ID = L.LEVY_ID) WHERE C.DEL_YN = 'N' diff --git a/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml b/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml index aab944ea..e309f2d6 100644 --- a/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml +++ b/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml @@ -160,7 +160,7 @@ FROM TB_CRDN C INNER JOIN TB_CRDN_ADI CA ON (C.CRDN_ID = CA.CRDN_ID) LEFT OUTER JOIN TB_TEAM_INFO TI ON (CA.TEAM_ID = TI.TEAM_ID) INNER JOIN TB_CRDN_CVLCPT CC ON (C.CVLCPT_LINK_YN = 'Y' AND C.LINK_ID = CC.CVLCPT_LINK_ID) -LEFT OUTER JOIN TB_LEVY_EXCL LE ON (C.CRDN_ID = LE.CRDN_ID) +LEFT OUTER JOIN TB_LEVY_EXCL LE ON (C.CRDN_ID = LE.CRDN_ID AND LE.DEL_YN = 'N') LEFT OUTER JOIN TB_LEVY L ON (C.LEVY_ID = L.LEVY_ID) WHERE C.DEL_YN = 'N' @@ -326,22 +326,6 @@ SELECT C.CRDN_ID AND DEL_YN = 'N' - - /* 단속정보 수정(crdnCvlcptMapper.updateCrdn) */ UPDATE TB_CRDN @@ -579,7 +563,7 @@ SELECT C.CRDN_ID END) AS COPY_EXIST_YN FROM TB_CRDN C INNER JOIN TB_CRDN_CVLCPT CC ON (C.CVLCPT_LINK_YN = 'Y' AND C.LINK_ID = CC.CVLCPT_LINK_ID) - LEFT OUTER JOIN TB_LEVY_EXCL LE ON (C.CRDN_ID = LE.CRDN_ID) + LEFT OUTER JOIN TB_LEVY_EXCL LE ON (C.CRDN_ID = LE.CRDN_ID AND LE.DEL_YN = 'N') WHERE C.DEL_YN = 'N' AND C.TASK_SE_CD = #{taskSeCd} AND C.CRDN_STTS_CD IN ('21','81','83') @@ -620,6 +604,34 @@ AND (SELECT VLTN_ARTCL FROM TB_VLTN_INFO WHERE VLTN_ID = C.VLTN_ID) LIKE CONCAT( + + + +