From e291bca1d54ce2d68fc9df4c8411ccb283599116 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 15 Dec 2023 14:15:34 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8B=A8=EC=86=8D=EC=9E=90=EB=A3=8C=EA=B2=80?= =?UTF-8?q?=EC=82=AC=20=EC=97=91=EC=85=80=EB=8B=A4=EC=9A=B4=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/fims/crdn/web/Crdn02Controller.java | 66 +++++++++++++++++++ .../xit/fims/crdn/web/Crdn06Controller.java | 55 ++++++---------- .../sql/mapper/fims/crdn/crdn-list-mapper.xml | 7 ++ .../WEB-INF/jsp/fims/crdn/crdn02010-main.jsp | 58 +++++++++++++--- .../WEB-INF/jsp/fims/crdn/crdn06010-main.jsp | 16 +---- .../webapp/resources/js/base/base-fims.js | 21 +++++- 6 files changed, 165 insertions(+), 58 deletions(-) diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn02Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn02Controller.java index 0ed104c3..e13b8161 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn02Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn02Controller.java @@ -1,16 +1,22 @@ package cokr.xit.fims.crdn.web; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.function.BiFunction; import javax.annotation.Resource; +import org.apache.poi.ss.usermodel.CellStyle; import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.code.CommonCode; +import cokr.xit.base.file.xls.XLSWriter; +import cokr.xit.base.file.xls.XLSWriter.Styler; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.web.ApplicationController; +import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.dao.CrdnInfoMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper; @@ -87,6 +93,66 @@ public class Crdn02Controller extends ApplicationController { String sggCd = globalStngMapper.selectSggCd(curDeptCode); query.setSggCd(sggCd); + + if("xls".equals(query.getDownload())) { + String[] excelTitle = query.getExcelTitle(); + List titles = new ArrayList(); + for(int i = 0; i < excelTitle.length; i++) { + String item = excelTitle[i]; + titles.add(item); + } + + int[] excelTitleWidth = query.getExcelTitleWidth(); + List widths = new ArrayList<>(); + for(int i = 0; i < excelTitleWidth.length; i++) { + int item = excelTitleWidth[i]; + widths.add(item); + } + + XLSWriter xlsx = new XLSWriter() + .setFilename("검사자료 목록.xlsx") + .worksheet(0); + List headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx); + CellStyle numeric = xlsx.n_nn0(); + + xlsx.cell(0, 0) + .value("검사자료 목록", XLSWriter.Styler.CENTER) + .merge(0, titles.size()-1) + .cell(3, 0) + .rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers)); + + List list = crdnService.getCrackdownList(query.setFetchSize(0)); + + BiFunction getValue = (titleNm, noting) -> { + switch(titleNm) { + case "단속일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))); + case "자료출처": return "CRDN_INPT_SE_NM"; + case "차량번호": return "VHRNO"; + case "처리상태": return "CRDN_STTS_NM"; + case "단속장소": return "CRDN_PLC"; + case "사진매수": return "ATCH_FILE_CNT"; + case "위반건수": return "CRDN_CNT"; + case "단속건수": return "CRDN_CNT"; + case "검사결과": return "INSP_RSLT"; + case "처리방법": return "PRCS_MTHD"; + case "위반동": return "CRDN_STDG_NM"; + case "단속동": return "CRDN_STDG_NM"; + case "원금액": return xlsx.style("FFNLG_CRDN_AMT", numeric); + case "감경금액": return ""; + case "금액": return xlsx.style("FFNLG_CRDN_AMT", numeric); + case "단속조": return "TEAM_NM"; + case "성명": return "RTPYR_NM"; + case "주민번호": return "RTPYR_NO"; + } + return ""; + }; + + xlsx.cell(4, 0) + .values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray()); + + return new ModelAndView("xlsView").addObject("xls", xlsx); + } + return setCollectionInfo(new ModelAndView("jsonView"), crdnService.getCrackdownList(query),""); } diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn06Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn06Controller.java index acc25762..6ceb0c57 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn06Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn06Controller.java @@ -88,12 +88,6 @@ public class Crdn06Controller extends ApplicationController { query.setSggCd(sggCd); if("xls".equals(query.getDownload())) { - XLSWriter xlsx = new XLSWriter() - .setFilename("단속자료 목록.xlsx") - .worksheet(0); - - CellStyle numeric = xlsx.n_nn0(); - String[] excelTitle = query.getExcelTitle(); List titles = new ArrayList(); for(int i = 0; i < excelTitle.length; i++) { @@ -108,49 +102,38 @@ public class Crdn06Controller extends ApplicationController { widths.add(item); } + XLSWriter xlsx = new XLSWriter() + .setFilename("단속자료 목록.xlsx") + .worksheet(0); List headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx); + CellStyle numeric = xlsx.n_nn0(); xlsx.cell(0, 0) .value("단속자료 목록", XLSWriter.Styler.CENTER) - .merge(0, 15) + .merge(0, titles.size()-1) .cell(3, 0) .rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers)); List list = crdnService.getCrackdownList(query.setFetchSize(0)); - - BiFunction getValue = (title1, noting) -> { - switch(title1) { - case "자료출처": - return "CRDN_INPT_SE_NM"; - case "차량번호": - return "VHRNO"; - case "위반일시": - return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))); - case "단속장소": - return "CRDN_PLC"; - case "체납액": - return ""; - case "사진건수": - return "ATCH_FILE_CNT"; - case "스티커번호": - return "CRDN_SN"; - case "장애차량확인": - return "PARKNG_PSBLTY_RSLT_NM"; - case "처리상태": - return "CRDN_STTS_NM"; - case "제외사유": - return "LEVY_EXCL_RSN_NM"; - case "제외처리일자": - return "LEVY_EXCL_YMD"; - case "제외내역": - return "LEVY_EXCL_ETC_CN"; + BiFunction getValue = (titleNm, noting) -> { + switch(titleNm) { + case "자료출처": return "CRDN_INPT_SE_NM"; + case "차량번호": return "VHRNO"; + case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))); + case "단속장소": return "CRDN_PLC"; + case "체납액": return ""; + case "사진건수": return "ATCH_FILE_CNT"; + case "스티커번호": return "CRDN_SN"; + case "장애차량확인": return "PARKNG_PSBLTY_RSLT_NM"; + case "처리상태": return "CRDN_STTS_NM"; + case "제외사유": return "LEVY_EXCL_RSN_NM"; + case "제외처리일자": return xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD"))); + case "제외내역": return "LEVY_EXCL_ETC_CN"; } return ""; }; - - xlsx.cell(4, 0) .values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray()); 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 12c75b8a..0b9f49b9 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 @@ -13,6 +13,7 @@ SELECT C.CRDN_ID , (SELECT GET_CODE_NM('FIM054', C.TASK_SE_CD) FROM DUAL) AS TASK_SE_NM , C.CRDN_REG_SE_CD , C.CRDN_INPT_SE_CD + , (SELECT GET_CODE_NM('FIM003', C.CRDN_INPT_SE_CD) FROM DUAL) AS CRDN_INPT_SE_NM , C.LINK_TBL_NM , C.LINK_ID , C.RTPYR_ID @@ -68,6 +69,7 @@ SELECT C.CRDN_ID , CA.USE_FUEL_CD , CA.FFNLG_CARMDL_CD , CA.PARKNG_PSBLTY_RSLT_CD + , (SELECT GET_CODE_NM('FIM034', CA.PARKNG_PSBLTY_RSLT_CD) FROM DUAL) AS PARKNG_PSBLTY_RSLT_NM , CA.VLTN_NMTM , CA.OVTIME_YN , CC.CVLCPT_LINK_ID @@ -88,6 +90,7 @@ SELECT C.CRDN_ID , CC.CVLCPT_TRSM_DT , CC.CVLCPT_TRSM_CD , LE.LEVY_EXCL_RSN_CD + , (SELECT GET_CODE_NM('FIM022', LE.LEVY_EXCL_RSN_CD) FROM DUAL) AS LEVY_EXCL_RSN_NM , LE.LEVY_EXCL_YMD , LE.ETC_CN AS LEVY_EXCL_ETC_CN , P.RTPYR_NM @@ -212,9 +215,11 @@ SELECT C.CRDN_ID , C.CRDN_PLC , C.ATCH_FILE_CNT , C.CRDN_STTS_CD + , (SELECT GET_CODE_NM('FIM010', C.CRDN_STTS_CD) FROM DUAL) AS CRDN_STTS_NM , C.FFNLG_CRDN_AMT , C.CRDN_INPT_SE_CD + , (SELECT GET_CODE_NM('FIM003', C.CRDN_INPT_SE_CD) FROM DUAL) AS CRDN_INPT_SE_NM FROM TB_CRDN C INNER JOIN TB_CRDN_ADI CA ON (C.CRDN_ID = CA.CRDN_ID) WHERE C.DEL_YN = 'N' @@ -358,11 +363,13 @@ SELECT C.CRDN_ID , C.TASK_SE_CD , CONCAT(C.CRDN_YMD,'',C.CRDN_TM) AS CRDN_YMD_TM , C.CRDN_INPT_SE_CD + , (SELECT GET_CODE_NM('FIM003', C.CRDN_INPT_SE_CD) FROM DUAL) AS CRDN_INPT_SE_NM , T.TEAM_NM , C.VHRNO , C.CRDN_STDG_NM , C.CRDN_PLC , C.CRDN_STTS_CD + , (SELECT GET_CODE_NM('FIM010', C.CRDN_STTS_CD) FROM DUAL) AS CRDN_STTS_NM , C.FFNLG_CRDN_AMT , P.RTPYR_NM , P.RTPYR_NO diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp index d3908d76..0912a54a 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp @@ -188,7 +188,7 @@ data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}"> No. 단속일시 + style="width: 180px;">단속일시 차량번호 위반건수 @@ -207,7 +207,7 @@ 감경금액 자료출처 + style="width: 120px;">자료출처 @@ -329,9 +329,9 @@ 성명 주민번호(전체) + style="width:160px">주민번호 주민번호(마스크) + style="width:160px">주민번호 @@ -589,11 +589,11 @@ $(document).ready(function(){ $P.fnResetAndChangeBiz = (taskSeCd) => { $P.fnReset(); - $P.photoInspectionControl.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do?inspectionDataType=photo"); + $P.photoInspectionControl.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do"); $P.photoInspectionControl.urls.getInfo = ""; - $P.sameVehicleControl.main.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do?inspectionDataType=sameVehicleMain"); + $P.sameVehicleControl.main.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do"); $P.sameVehicleControl.main.urls.getInfo = ""; - $P.sameVehicleControl.sub.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do?inspectionDataType=sameVehicleSub"); + $P.sameVehicleControl.sub.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do"); $P.sameVehicleControl.sub.urls.getInfo = ""; var clsForTask = taskSeCd.toLowerCase(); @@ -637,17 +637,21 @@ $(document).ready(function(){ switch ($P.currentDisplay) { case "photoInspection": $P.photoInspectionControl.query = $P.getParams(); + $P.photoInspectionControl.query.inspectionDataType = "photo"; $P.photoInspectionControl.load(1); break; case "sameVehicleInspection": $P.sameVehicleControl.main.query = $P.getParams(); + $P.sameVehicleControl.main.query.inspectionDataType = "sameVehicleMain"; $P.sameVehicleControl.main.load(1); break; default: break; } } $P.searchDetailInspectionDataList = (dataKey) => { - $P.sameVehicleControl.sub.query = { "crdnIDs" : dataKey.split(",") }; + $P.sameVehicleControl.sub.query = {}; + $P.sameVehicleControl.sub.query.inspectionDataType = "sameVehicleSub"; + $P.sameVehicleControl.sub.query.crdnIDs = dataKey; $P.sameVehicleControl.sub.query.taskSeCd = $P.sameVehicleControl.main.query.taskSeCd; $P.sameVehicleControl.sub.load(0); } @@ -959,6 +963,44 @@ $(document).ready(function(){ }); $('#btnSearch--${pageName}').on('click', () => $P.searchInspectionList()); //검색버튼 + $('#btnExcel--${pageName}').on('click', function(){ + + if($P.currentDisplay == "photoInspection"){ + if($P.photoInspectionControl.dataset.empty){ + alert("조회된 자료가 없습니다."); + return; + } + + var headerInfo = $("#photoInspection_Table_0--${pageName} thead th").not(".dummy-th").not(":eq(0)").getHeaderInfo(); + $P.photoInspectionControl.query.excelTitle = headerInfo.excelTitle; + $P.photoInspectionControl.query.excelTitleWidth = headerInfo.excelTitleWidth; + $P.photoInspectionControl.download(); + + } else { + + if($P.sameVehicleControl.main.dataset.empty){ + alert("조회된 자료가 없습니다."); + return; + } + + if(confirm("단속건수 엑셀저장은 확인버튼, 상세내역 엑셀저장시 취소버튼을 누르세요.")){ + var headerInfo = $("#sameVehicleInspectionMain_Table_0--${pageName} thead th").not(".dummy-th").getHeaderInfo(); + $P.sameVehicleControl.main.query.excelTitle = headerInfo.excelTitle; + $P.sameVehicleControl.main.query.excelTitleWidth = headerInfo.excelTitleWidth; + $P.sameVehicleControl.main.download(); + } else { + var headerInfo = $("#sameVehicleInspectionSub_Table_0--${pageName} thead th").not(".dummy-th").getHeaderInfo(); + $P.sameVehicleControl.sub.query.excelTitle = headerInfo.excelTitle; + $P.sameVehicleControl.sub.query.excelTitleWidth = headerInfo.excelTitleWidth; + $P.sameVehicleControl.sub.download(); + } + + } + + + + }); + $("#btnInstLevyExcl--${pageName}").on("click", () => $P.openLevyExclPop("1")); //스크롤 테이블 diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp index ef9ad6e7..ac1d8c36 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp @@ -476,19 +476,9 @@ $(document).ready(function(){ return; } - var excelTitle = []; - var excelTitleWidth = []; - $("#crdnThead--${pageName} th").not(".dummy-th").not(":eq(0)").each(function(){ - var title = $(this).text(); - excelTitle.push(title); - var titleWidth = $(this).outerWidth(); - titleWidth = Math.ceil(titleWidth/10); - excelTitleWidth.push(titleWidth); - }); - - $P.crdnControl.query.excelTitle = excelTitle.join(","); - $P.crdnControl.query.excelTitleWidth = excelTitleWidth.join(","); - //return; + var headerInfo = $("#crdnThead--${pageName} th").not(".dummy-th").not(":eq(0)").getHeaderInfo(); + $P.crdnControl.query.excelTitle = headerInfo.excelTitle; + $P.crdnControl.query.excelTitleWidth = headerInfo.excelTitleWidth; $P.crdnControl.download(); }); diff --git a/src/main/webapp/resources/js/base/base-fims.js b/src/main/webapp/resources/js/base/base-fims.js index de4ee51c..fe7754ee 100644 --- a/src/main/webapp/resources/js/base/base-fims.js +++ b/src/main/webapp/resources/js/base/base-fims.js @@ -144,4 +144,23 @@ class FimsFormFields extends FormFields { }); return obj; } -} \ No newline at end of file +} + + +$.fn.getHeaderInfo = function() { + var excelTitle = []; + var excelTitleWidth = []; + + this.each(function(){ + var title = $(this).text(); + excelTitle.push(title); + var titleWidth = $(this).outerWidth(); + titleWidth = Math.ceil(titleWidth/10); + excelTitleWidth.push(titleWidth); + }); + + return { + excelTitle : excelTitle.join(","), + excelTitleWidth : excelTitleWidth.join(",") + }; +}; \ No newline at end of file