From 836c55370caf5c27c1fc725fb0fc5ce9d078dff0 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 15 Dec 2023 16:31:44 +0900 Subject: [PATCH] =?UTF-8?q?=ED=86=B5=ED=95=A9=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=97=91=EC=85=80=EC=A0=80=EC=9E=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/crdn/web/Crdn02Controller.java | 2 +- .../xit/fims/crdn/web/Crdn03Controller.java | 2 +- .../xit/fims/crdn/web/Crdn06Controller.java | 2 +- .../xit/fims/crdn/web/Crdn08Controller.java | 2 +- .../xit/fims/cvlc/web/Cvlc01Controller.java | 2 +- .../xit/fims/cvlc/web/Cvlc02Controller.java | 2 +- .../xit/fims/cvlc/web/Cvlc03Controller.java | 2 +- .../java/cokr/xit/fims/sprt/SprtQuery.java | 11 ++ .../xit/fims/sprt/web/Sprt01Controller.java | 106 +++++++++++++++++- .../WEB-INF/jsp/fims/sprt/sprt01010-main.jsp | 23 ++++ 10 files changed, 143 insertions(+), 11 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 e13b8161..c8fddf94 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn02Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn02Controller.java @@ -123,7 +123,7 @@ public class Crdn02Controller extends ApplicationController { List list = crdnService.getCrackdownList(query.setFetchSize(0)); - BiFunction getValue = (titleNm, noting) -> { + BiFunction getValue = (titleNm, nothing) -> { switch(titleNm) { case "단속일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))); case "자료출처": return "CRDN_INPT_SE_NM"; diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn03Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn03Controller.java index d6fc58af..362461a7 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn03Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn03Controller.java @@ -109,7 +109,7 @@ public class Crdn03Controller extends ApplicationController { List list = crdnService.getCrackdownList(query.setFetchSize(0)); - BiFunction getValue = (titleNm, noting) -> { + BiFunction getValue = (titleNm, nothing) -> { switch(titleNm) { case "자료출처": return "CRDN_INPT_SE_NM"; case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))); 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 6ceb0c57..6ac91398 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn06Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn06Controller.java @@ -116,7 +116,7 @@ public class Crdn06Controller extends ApplicationController { List list = crdnService.getCrackdownList(query.setFetchSize(0)); - BiFunction getValue = (titleNm, noting) -> { + BiFunction getValue = (titleNm, nothing) -> { switch(titleNm) { case "자료출처": return "CRDN_INPT_SE_NM"; case "차량번호": return "VHRNO"; diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java index 8ccdbda6..9f879e4d 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java @@ -106,7 +106,7 @@ public class Crdn08Controller extends ApplicationController { List list = crdnStngService.getExemptionVehicleList(query.setFetchSize(0)); - BiFunction getValue = (titleNm, noting) -> { + BiFunction getValue = (titleNm, nothing) -> { switch(titleNm) { case "차량번호": return "VHRNO"; case "사유": return "EXMPTN_RSN"; 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 14a1013f..4c1c5b3e 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java @@ -126,7 +126,7 @@ public class Cvlc01Controller extends ApplicationController { List list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0)); - BiFunction getValue = (titleNm, noting) -> { + BiFunction getValue = (titleNm, nothing) -> { switch(titleNm) { case "접수번호": return "CVLCPT_RCPT_NO"; case "목록번호": return "CVLCPT_LIST_NO"; diff --git a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc02Controller.java b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc02Controller.java index f9a102b9..95ed10c5 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc02Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc02Controller.java @@ -115,7 +115,7 @@ public class Cvlc02Controller extends ApplicationController { List list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0)); - BiFunction getValue = (titleNm, noting) -> { + BiFunction getValue = (titleNm, nothing) -> { switch(titleNm) { case "접수번호": return "CVLCPT_RCPT_NO"; case "목록번호": return "CVLCPT_LIST_NO"; diff --git a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc03Controller.java b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc03Controller.java index 73fd4b9c..baa7ef69 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc03Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc03Controller.java @@ -106,7 +106,7 @@ public class Cvlc03Controller extends ApplicationController { List list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0)); - BiFunction getValue = (titleNm, noting) -> { + BiFunction getValue = (titleNm, nothing) -> { switch(titleNm) { case "접수번호": return "CVLCPT_RCPT_NO"; case "목록번호": return "CVLCPT_LIST_NO"; diff --git a/src/main/java/cokr/xit/fims/sprt/SprtQuery.java b/src/main/java/cokr/xit/fims/sprt/SprtQuery.java index 367ccb27..1114d2e7 100644 --- a/src/main/java/cokr/xit/fims/sprt/SprtQuery.java +++ b/src/main/java/cokr/xit/fims/sprt/SprtQuery.java @@ -25,6 +25,7 @@ public class SprtQuery extends CmmnQuery { private List ischKeywordSet; // 통합조회 키워드 private List ischOnlyDataSet; // 특정자료만 조회 private List ischExclDataSet; // 특정자료 제외 + private String gridType; private String vhrno; // 차량번호 private String rtpyrNo; // 납부자 번호 @@ -157,6 +158,16 @@ public class SprtQuery extends CmmnQuery { return self(); } + public String getGridType() { + return ifEmpty(gridType, () -> null); + } + + public T setGridType(String gridType) { + this.gridType = gridType; + + return self(); + } + public String getVhrno() { return ifEmpty(vhrno, () -> null); } diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java index 7425d937..9afc6777 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -5,18 +5,23 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Map; +import java.util.function.BiFunction; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.apache.commons.io.FilenameUtils; +import org.apache.poi.ss.usermodel.CellStyle; import org.springframework.web.multipart.MultipartFile; 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.Crdn; import cokr.xit.fims.crdn.dao.GlobalStngMapper; import cokr.xit.fims.sprt.Keyword; @@ -148,14 +153,107 @@ public class Sprt01Controller extends ApplicationController { this.makeIntegrationSearchQuery(query, req); - List list = null; - list = sprt01Service.getIntegrationDataList(query); - + List list = sprt01Service.getIntegrationDataList(query); List upList = list.stream().filter(item -> item.string("RCVMT_ETC_YN").equals("N")).toList(); List downList = list.stream().filter(item -> item.string("RCVMT_ETC_YN").equals("Y")).toList(); + + 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); + } + + String fileName = "통합조회자료 목록"; + List listForExcel; + if(ifEmpty(query.getGridType(), () -> "").equals("up")) { + fileName += "(미납자료)"; + listForExcel = upList; + } else if(ifEmpty(query.getGridType(), () -> "").equals("down")) { + fileName += "(수납,기타)"; + listForExcel = downList; + } else { + listForExcel = list; + } + + XLSWriter xlsx = new XLSWriter() + .setFilename(fileName+".xlsx") + .worksheet(0); + List headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx); + CellStyle numeric = xlsx.n_nn0(); + + xlsx.cell(0, 0) + .value(fileName, XLSWriter.Styler.CENTER) + .merge(0, titles.size()-1) + .cell(3, 0) + .rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers)); + + BiFunction getValue = (titleNm, nothing) -> { + switch(titleNm) { + case "시군구명": return "SGG_NM"; + case "과태료명": return "TASK_SE_NM"; + case "단속입력구분": return "CRDN_INPT_SE_NM"; + case "단속일시": return "CRDN_YMD_TM"; + case "신고자명": return "CVLCPT_APLCNT_NM"; + case "민원접수번호": return "CVLCPT_RCPT_NO"; + case "민원접수일자": return xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))); + case "민원목록번호": return "CVLCPT_LIST_NO"; + case "단속차량번호": return "VHRNO"; + case "대체차량번호": return "RPM_SZR_VHRNO"; + case "사진건수": return "ATCH_FILE_CNT"; + case "차량확인": return "PARKNG_PSBLTY_RSLT_NM"; + case "납부자명": return "RTPYR_NM"; + case "납부자번호": return "RTPYR_NO"; + 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 "ETC_CN"; + case "고지번호": return "GOJI_NO"; + case "처리일자": return xlsx.format(o -> xlsx.str2date(o.get("CRDN_STTS_CHG_YMD"))); + case "단속장소": return "CRDN_PLC"; + case "단속구분": return "CRDN_SE_NM"; + case "의견진술여부": return "OPNN_SBMSN_YN_NM"; + case "의견진술기한": return xlsx.format(o -> xlsx.str2date(o.get("ADVNTCE_DUDT_YMD"))); + case "견인여부": return "TOWNG_YN_NM"; + case "압류일자": return xlsx.format(o -> xlsx.str2date(o.get("SZR_YMD"))); + case "압류해제일자": return xlsx.format(o -> xlsx.str2date(o.get("SZR_RMV_YMD"))); + case "잔액": return xlsx.style("SUM_AMT", numeric); + case "부과금액": return xlsx.style("LEVY_AMT", numeric); + case "본세": return xlsx.style("LEVY_PCPTAX", numeric); + case "가산금": return xlsx.style("LEVY_ADAMT", numeric); + case "납부기한": return xlsx.format(o -> xlsx.str2date(o.get("DUDT_YMD"))); + case "납기후일자": return xlsx.format(o -> xlsx.str2date(o.get("DUDT_AFTR_YMD"))); + case "납기후금액": return xlsx.style("DUDT_AFTR_AMT", numeric); + case "가상계좌번호": return "VR_ACTNO"; + case "전자납부번호": return "EPAYNO"; + case "수납유형": return "PAY_MTHD_SE_NM"; + case "수납일자": return xlsx.format(o -> xlsx.str2date(o.get("RCVMT_YMD"))); + case "수납금액": return xlsx.style("RCVMT_AMT", numeric); + case "수납본세": return xlsx.style("RCVMT_PCPTAX", numeric); + case "수납가산금": return xlsx.style("RCVMT_ADAMT", numeric); + case "단속등록구분": return "CRDN_REG_SE_NM"; + case "납부자주소": return "RTPYR_FULL_ADDR"; + case "거주상태": return "RTPYR_STTS_NM"; + } + return ""; + }; + + xlsx.cell(4, 0) + .values(listForExcel, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray()); + + return new ModelAndView("xlsView").addObject("xls", xlsx); + } + mav.addObject("upList", upList); mav.addObject("downList", downList); - return mav; } diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01010-main.jsp index b2448dd8..047a5f29 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01010-main.jsp @@ -297,7 +297,30 @@ integrationSearch.renderList = (updown, tabGroup) => { // 엑셀 integrationSearch.fnExcel = (updown) => { + var headerInfo; + + if(updown == "up"){ + if(integrationSearchControl.updataset.empty){ + alert("조회된 자료가 없습니다."); + return; + } + + headerInfo = $("#upTheadTr--${pageName} th").not(".dummy-th").not(":eq(0)").getHeaderInfo(); + integrationSearchControl.query.gridType = "up"; + } else { + if(integrationSearchControl.downdataset.empty){ + alert("조회된 자료가 없습니다."); + return; + } + + headerInfo = $("#downTheadTr--${pageName} th").not(".dummy-th").not(":eq(0)").getHeaderInfo(); + integrationSearchControl.query.gridType = "down"; + } + integrationSearchControl.query.excelTitle = headerInfo.excelTitle; + integrationSearchControl.query.excelTitleWidth = headerInfo.excelTitleWidth; + integrationSearchControl.download(); + } //납부자번호 복사