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 7cac2b47..14a1013f 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java @@ -4,11 +4,13 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.BiFunction; import java.util.stream.Stream; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import org.apache.poi.ss.usermodel.CellStyle; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; @@ -16,9 +18,12 @@ import cokr.xit.base.code.CommonCode; import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.FileInfo.Relation; import cokr.xit.base.file.web.FileInfoFactory; +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.CrdnQuery; import cokr.xit.fims.crdn.dao.GlobalStngMapper; @@ -92,6 +97,60 @@ public class Cvlc01Controller 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 = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0)); + + BiFunction getValue = (titleNm, noting) -> { + switch(titleNm) { + case "접수번호": return "CVLCPT_RCPT_NO"; + case "목록번호": return "CVLCPT_LIST_NO"; + case "등록구분": return "CRDN_REG_SE_NM"; + case "신고자": return "CVLCPT_APLCNT_NM"; + case "담당자" : return "CVLCPT_PRCS_PIC_NM"; + case "담당자전화번호": return "CVLCPT_PRCS_PIC_TELNO"; + case "접수일자": return xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))); + case "처리기한": return xlsx.format(o -> xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT"))); + case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))); + case "위반내용": return "VLTN_ARTCL"; + case "차량번호": return "VHRNO"; + case "사진건수": return "ATCH_FILE_CNT"; + + } + 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"), crdnCvlcptService.getCivilComplaintList(query),""); } 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 cdee86e0..f9a102b9 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc02Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc02Controller.java @@ -1,17 +1,23 @@ package cokr.xit.fims.cvlc.web; +import java.util.ArrayList; 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.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.GlobalStngMapper; import cokr.xit.fims.crdn.service.CrdnService; @@ -80,6 +86,59 @@ public class Cvlc02Controller 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 = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0)); + + BiFunction getValue = (titleNm, noting) -> { + switch(titleNm) { + case "접수번호": return "CVLCPT_RCPT_NO"; + case "목록번호": return "CVLCPT_LIST_NO"; + case "신고자": return "CVLCPT_APLCNT_NM"; + case "담당자" : return "CVLCPT_PRCS_PIC_NM"; + case "담당자전화번호": return "CVLCPT_PRCS_PIC_TELNO"; + case "접수일자": return xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))); + case "처리기한": return xlsx.format(o -> xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT"))); + case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))); + case "위반내용": return "VLTN_ARTCL"; + case "차량번호": return "VHRNO"; + case "서손/계고사유": return "LEVY_EXCL_RSN_NM"; + case "특기사항": return "ETC_CN"; + } + 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"), crdnCvlcptService.getCivilComplaintList(query), ""); } 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 159b66a4..73fd4b9c 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc03Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc03Controller.java @@ -1,20 +1,27 @@ package cokr.xit.fims.cvlc.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.GlobalStngMapper; import cokr.xit.fims.crdn.service.CrdnService; import cokr.xit.fims.cvlc.service.CrdnCvlcptService; +import cokr.xit.foundation.data.DataObject; /**민원관리 서비스 웹 컨트롤러.
* {웹 컨텍스트}/cvlc/cvlc03 로 접근할 수 있다. @@ -70,6 +77,61 @@ public class Cvlc03Controller 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 = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0)); + + BiFunction getValue = (titleNm, noting) -> { + switch(titleNm) { + case "접수번호": return "CVLCPT_RCPT_NO"; + case "목록번호": return "CVLCPT_LIST_NO"; + case "등록구분": return "CRDN_REG_SE_NM"; + case "신고자": return "CVLCPT_APLCNT_NM"; + case "담당자" : return "CVLCPT_PRCS_PIC_NM"; + case "담당자전화번호": return "CVLCPT_PRCS_PIC_TELNO"; + case "접수일자": return xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))); + case "처리기한": return xlsx.format(o -> xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT"))); + case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))); + case "위반내용": return "VLTN_ARTCL"; + case "차량번호": return "VHRNO"; + case "사진건수": return "ATCH_FILE_CNT"; + case "서손/계고사유": return "LEVY_EXCL_RSN_NM"; + case "특기사항": return "ETC_CN"; + } + 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"),crdnCvlcptService.getCivilComplaintList(query),""); } } 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 020badc6..d712337d 100644 --- a/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml +++ b/src/main/resources/sql/mapper/fims/cvlc/crdnCvlcpt-mapper.xml @@ -74,6 +74,7 @@ SELECT C.CRDN_ID , C.SGG_CD , C.TASK_SE_CD , C.CRDN_REG_SE_CD + , GET_CODE_NM('FIM026', C.CRDN_REG_SE_CD) AS CRDN_REG_SE_NM , C.CRDN_INPT_SE_CD , C.LINK_TBL_NM , C.LINK_ID @@ -147,6 +148,7 @@ SELECT C.CRDN_ID , CC.CVLCPT_TRSM_DT , CC.CVLCPT_TRSM_CD , LE.LEVY_EXCL_RSN_CD + , GET_CODE_NM('FIM022', LE.LEVY_EXCL_RSN_CD) AS LEVY_EXCL_RSN_NM , LE.LEVY_EXCL_YMD , LE.ETC_CN AS LEVY_EXCL_ETC_CN , C.DEL_YN @@ -219,6 +221,7 @@ AND (SELECT VLTN_ARTCL FROM TB_VLTN WHERE VLTN_ID = C.VLTN_ID) LIKE CONCAT('%', SELECT C.CRDN_ID , C.CRDN_REG_SE_CD + , GET_CODE_NM('FIM026', C.CRDN_REG_SE_CD) AS CRDN_REG_SE_NM , CC.CVLCPT_APLCNT_NM , CC.CVLCPT_PRCS_PIC_NM , (SELECT TELNO @@ -417,6 +420,7 @@ SELECT C.CRDN_ID , CC.CVLCPT_LIST_NO , C.VHRNO , LE.LEVY_EXCL_RSN_CD + , GET_CODE_NM('FIM022', LE.LEVY_EXCL_RSN_CD) AS LEVY_EXCL_RSN_NM , C.ETC_CN , (CASE WHEN C.CRDN_ID IN (SELECT DISTINCT(A.BFR_CRDN_ID) FROM TB_CRDN A WHERE A.DEL_YN = 'N' AND A.CRDN_REG_SE_CD = '04') diff --git a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01010-main.jsp index 1b2cd650..8a3a2ea8 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01010-main.jsp @@ -621,6 +621,19 @@ $(document).ready(function(){ **************************************************************************/ $('#btnReset--${pageName}').on('click', () => $P.fnReset()); $('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList()); + $('#btnExcel--${pageName}').on('click', function(){ + + if($P.crdnControl.dataset.empty){ + alert("조회된 자료가 없습니다."); + 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(); + }); + $("#btnHold--${pageName}").on("click", () => $P.fnHold()); $("#btnDelete--${pageName}").on("click", () => $P.fnRemove()); $("#btnDeleteSameRcptYmd--${pageName}").on("click", () => $P.fnRemoveSameRcptYmd()); diff --git a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc02010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc02010-main.jsp index e4086428..2207ede7 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc02010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc02010-main.jsp @@ -649,6 +649,18 @@ $(document).ready(function(){ **************************************************************************/ $('#btnReset--${pageName}').on('click', () => $P.fnReset()); $('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList()); + $('#btnExcel--${pageName}').on('click', function(){ + + if($P.crdnControl.dataset.empty){ + alert("조회된 자료가 없습니다."); + return; + } + + var headerInfo = $("#crdnThead--${pageName} th").not(".dummy-th").not(":eq(0)").not(":eq(0)").getHeaderInfo(); + $P.crdnControl.query.excelTitle = headerInfo.excelTitle; + $P.crdnControl.query.excelTitleWidth = headerInfo.excelTitleWidth; + $P.crdnControl.download(); + }); $("#btnOpenCvlcptOrgnl--${pageName}").on("click", () => $P.fnOpenCvlcptOrgnl()); $("#btnOpenAnswerPreview--${pageName}").on("click", () => $P.fnOpenAnswerPreview()); $("#btnExecuteAnswer--${pageName}").on("click", () => $P.fnExecuteAnswer()); diff --git a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc03010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc03010-main.jsp index 0d6d1a74..4e1f3c74 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc03010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc03010-main.jsp @@ -525,6 +525,18 @@ $(document).ready(function(){ **************************************************************************/ $('#btnReset--${pageName}').on('click', () => $P.fnReset()); $('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList()); + $('#btnExcel--${pageName}').on('click', function(){ + + if($P.crdnControl.dataset.empty){ + alert("조회된 자료가 없습니다."); + 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(); + }); $("#btnDelete--${pageName}").on("click", () => $P.fnRemove()); $("#btnOpenCvlcptOrgnl--${pageName}").on("click", () => $P.fnOpenCvlcptOrgnl());