From 591ddd2ad4202707fd42d0fa399bcead44c938d1 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 18 Aug 2023 13:05:08 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B3=B5=EC=82=AC=20=EB=93=B1=EB=A1=9D=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/fims/cvlc/dao/CrdnCvlcptMapper.java | 12 ++ .../fims/cvlc/service/CrdnCvlcptService.java | 6 + .../cvlc/service/bean/CrdnCvlcptBean.java | 22 +++ .../service/bean/CrdnCvlcptServiceBean.java | 38 +++++ .../xit/fims/cvlc/web/Cvlc01Controller.java | 2 +- .../mapper/fims/cvlc/crdnCvlcpt-mapper.xml | 138 ++++++++++++++++++ .../WEB-INF/jsp/fims/cvlc/cvlc01020-info.jsp | 6 +- 7 files changed, 222 insertions(+), 2 deletions(-) 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 1702aa6d..0848801b 100644 --- a/src/main/java/cokr/xit/fims/cvlc/dao/CrdnCvlcptMapper.java +++ b/src/main/java/cokr/xit/fims/cvlc/dao/CrdnCvlcptMapper.java @@ -97,4 +97,16 @@ public interface CrdnCvlcptMapper extends AbstractMapper { */ DataObject selectCvlcptAnsWordsInfo(Map params); + /**지정한 단속자료로 단속대장을 복사 등록 처리한다. + * @param params 단속정보 등록 파라미터 + * @return 저장된 정보 수 + */ + int insertCrdnFromSelect(DataObject params); + + /**지정한 단속자료로 단속부가정보대장을 복사 등록 처리한다. + * @param params 단속정보 등록 파라미터 + * @return 저장된 정보 수 + */ + int insertCrdnAdditionFromSelect(DataObject params); + } diff --git a/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java b/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java index 4dab15a6..cb8b502f 100644 --- a/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java +++ b/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java @@ -50,5 +50,11 @@ public interface CrdnCvlcptService { */ boolean updateCvlcptPrcsSe(Map nonQueryRequest, CrdnCvlcpt crdnCvlcpt, Crdn crdn, List newFileInfoList); + /** 단속민원 자료를 복사하여 신규단속자료를 생성한다. + * @param crdnId 단속 ID + * @return 저장여부 + */ + boolean copyCvlcptCrdnInfo(String crdnId); + } 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 8576c675..c8aa88ee 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 @@ -106,4 +106,26 @@ public class CrdnCvlcptBean extends AbstractComponent { 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); + params.set("crdnId", crdnId); + + if(crdnCvlcptMapper.insertCrdnFromSelect(params) != 1) { + throw new RuntimeException("단속민원 복사 등록 중 단속대장 등록에 실패하였습니다."); + } + + if(crdnCvlcptMapper.insertCrdnAdditionFromSelect(params) != 1) { + throw new RuntimeException("단속민원 복사 등록 중 단속대장 등록에 실패하였습니다."); + } + + return (String)params.get("newCrdnId"); + } } 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 30021a45..8c901e02 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 @@ -15,8 +15,10 @@ import org.springframework.stereotype.Service; import org.springframework.util.ResourceUtils; import cokr.xit.base.file.FileInfo; +import cokr.xit.base.file.FileInfo.Relation; import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.bean.FileBean; +import cokr.xit.base.file.web.FileInfoFactory; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CrdnPayerHstry; import cokr.xit.fims.cmmn.CrdnSttsHstry; @@ -478,5 +480,41 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv return saved; } + @Override + public boolean copyCvlcptCrdnInfo(String crdnId) { + + FileQuery fileQuery = new FileQuery().setInfoType(Crdn.INF_TYPE).setInfoKeys(crdnId); + List orgnlCrdnFileList = fileBean.getFileList(fileQuery); + + + String newCrdnId = crdnCvlcptBean.insertCrdnFromSelect(crdnId); + if(ifEmpty(newCrdnId, () -> "").equals("")) { + throw new RuntimeException("단속민원 복사 등록 중 단속대장 등록에 실패하였습니다."); + } + + + if (!orgnlCrdnFileList.isEmpty() && orgnlCrdnFileList.size() > 0) { + List fileInfoList = new ArrayList(); + + List files = new ArrayList<>(); + for (int iLoop = 0; iLoop < orgnlCrdnFileList.size(); iLoop++) { + files.add(new File(orgnlCrdnFileList.get(iLoop).string("FILE_PATH"))); + } + + Relation relation = new Relation(); + relation.setInfoType(Crdn.INF_TYPE); + relation.setInfoKey(newCrdnId); + fileInfoList = new FileInfoFactory().createFileInfos(relation, files); + for (int iLoop = 0; iLoop < fileInfoList.size(); iLoop++) { + fileInfoList.get(iLoop).setName(orgnlCrdnFileList.get(iLoop).string("FILE_NM")); + } + int effected = fileBean.create(fileInfoList); + if(effected == 0) { + throw new RuntimeException("단속민원 복사 등록 중 파일복사에 실패하였습니다."); + } + } + + return true; + } } diff --git a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java index 3d290fbf..a360ba19 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java @@ -305,7 +305,7 @@ public class Cvlc01Controller extends ApplicationController { boolean saved = false; - //TODO:민원정보,단속정보 복사 + saved = crdnCvlcptService.copyCvlcptCrdnInfo(crdnId); return new ModelAndView("jsonView") .addObject("saved", saved); 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 8f33f9ee..a99e4c52 100644 --- a/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml +++ b/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml @@ -482,4 +482,142 @@ SELECT A.ANS_WORDS_ID WHERE CRDN_ID = #{crdn.crdnId} /* 단속 ID */ + +/* 단속정보 복사(crdnCvlcptMapper.insertCrdnFromSelect) */ + +SELECT + CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(CRDN_ID,5)) + 1, 1) AS INT), 16, '0')) + AS NEW_ID +FROM TB_CRDN + +INSERT + INTO TB_CRDN ( + CRDN_ID + , BFR_CRDN_ID + , CRDN_REG_SE_CD + , CRDN_STTS_CD + , OPNN_SBMSN_YN + , DEL_YN + , REG_DT + , RGTR + , MDFCN_DT + , MDFR + , SGG_CD + , TASK_SE_CD + , CRDN_INPT_SE_CD + , CVLCPT_LINK_YN + , LINK_TBL_NM + , LINK_ID + , RTPYR_ID + , CRDN_YMD + , CRDN_TM + , VHRNO + , CRDN_STDG_NM + , CRDN_ROAD_NM + , CRDN_PLC + , VLTN_ID + , GPS_X + , GPS_Y + , ATCH_FILE_CNT + , VIN + , VHCL_NM + , VHCL_COLOR + , FFNLG_AMT + , FFNLG_RDUCT_RT + , LEVY_AMT + , ADVNTCE_LEVY_AMT + , ETC_CN +) +SELECT #{newCrdnId} + , #{crdnId} + , '04' + , '01' + , 'N' + , 'N' + , + , #{currentUser.id} + , + , #{currentUser.id} + , SGG_CD + , TASK_SE_CD + , CRDN_INPT_SE_CD + , CVLCPT_LINK_YN + , LINK_TBL_NM + , LINK_ID + , RTPYR_ID + , CRDN_YMD + , CRDN_TM + , VHRNO + , CRDN_STDG_NM + , CRDN_ROAD_NM + , CRDN_PLC + , VLTN_ID + , GPS_X + , GPS_Y + , ATCH_FILE_CNT + , VIN + , VHCL_NM + , VHCL_COLOR + , FFNLG_AMT + , FFNLG_RDUCT_RT + , LEVY_AMT + , ADVNTCE_LEVY_AMT + , ETC_CN + FROM TB_CRDN + WHERE CRDN_ID = #{crdnId} + + + +/* 단속 부가정보 복사(crdnCvlcptMapper.insertCrdnAdditionFromSelect) */ +INSERT + INTO TB_CRDN_ADI ( + CRDN_ID + , CRDN_SE_CD + , TEAM_ID + , DTL_CRDN_PLC + , CRDN_SPAREA_CD + , CRDN_BGNG_TM + , CRDN_END_TM + , CRDN_SN + , MOSC_X + , MOSC_Y + , TOWNG_YN + , USE_FUEL_CD + , FFNLG_CARMDL_CD + , PARKNG_PSBLTY_RSLT_CD + , VLTN_NMTM + , OVTIME_YN + , OVTIME_PRTTN_YN + , DEL_YN + , REG_DT + , RGTR + , MDFCN_DT + , MDFR +) +SELECT #{newCrdnId} + , CRDN_SE_CD + , TEAM_ID + , DTL_CRDN_PLC + , CRDN_SPAREA_CD + , CRDN_BGNG_TM + , CRDN_END_TM + , CRDN_SN + , MOSC_X + , MOSC_Y + , TOWNG_YN + , USE_FUEL_CD + , FFNLG_CARMDL_CD + , PARKNG_PSBLTY_RSLT_CD + , VLTN_NMTM + , OVTIME_YN + , OVTIME_PRTTN_YN + , DEL_YN + , + , #{currentUser.id} + , + , #{currentUser.id} + FROM TB_CRDN_ADI + WHERE CRDN_ID = #{crdnId} + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01020-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01020-info.jsp index 9e43cf7c..29bee5f5 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01020-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01020-info.jsp @@ -697,7 +697,11 @@ $(document).ready(function(){ ajax.get({ url : $P.crdnControl.urls.create, data : { crdnId : crdnId }, - success : resp => { } + success : resp => { + if (resp.saved) { + dialog.alert("복사 자료가 생성되었습니다."); + } + } });