From 44ef69764219fcfb4c4a0cb682a4fdf2d588fcbb Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Tue, 12 Dec 2023 14:44:52 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8B=A8=EC=86=8D=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=97=91=EC=85=80=EB=8B=A4=EC=9A=B4=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/fims/crdn/web/Crdn06Controller.java | 43 +++++++++++++++++++ .../WEB-INF/jsp/fims/crdn/crdn06010-main.jsp | 7 +++ 2 files changed, 50 insertions(+) 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 97841612..c795ccad 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn06Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn06Controller.java @@ -5,9 +5,11 @@ import java.util.Map; 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.user.ManagedUser; import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.web.ApplicationController; @@ -81,6 +83,47 @@ public class Crdn06Controller extends ApplicationController { String sggCd = globalStngMapper.selectSggCd(curDeptCode); query.setSggCd(sggCd); + if("xls".equals(query.getDownload())) { + XLSWriter xlsx = new XLSWriter() + .setTemplate("template/xls/excl-list-tmpl.xlsx") + .setFilename("단속자료 목록.xlsx") + .worksheet(0); + + /* + CellStyle header = xlsx.cellStyle(new XLSWriter.Styler() + .width(20) + .foregroundColor(HSSFColor.HSSFColorPredefined.LIGHT_BLUE.getIndex()) + .configure(styler -> { + Font font = xlsx.workbook().createFont(); + font.setColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex()); + styler.font(font); + }) + ); */ + CellStyle numeric = xlsx.n_nn0(); + + xlsx + /* + .cell(0, 0) + .value("단속자료 목록", XLSWriter.Styler.CENTER) + .merge(0, 15) + .cell(3, 0) + .rowValues(List.of( + "업무구분", header, "부과제외일자", header, "부과제외구분", header, "부과제외사유", header, "기타내용", header, + "민원신청번호", header, "민원접수번호", header, "민원접수일자", header, "단속일시", header, "차량번호", header, + "법정동", header, "단속장소", header, "과태료금액", header, "처리상태", header, "납부자명", header, "납부자생일", header + )) */ + + .cell(4, 0) + .values( + crdnService.getCrackdownList(query.setFetchSize(0)), + "TASK_SE_NM", xlsx.format(r -> xlsx.str2date(r.get("LEVY_EXCL_YMD"))), "LEVY_EXCL_SE_NM", "LEVY_EXCL_RSN_NM", "ETC_CN", + "CVLCPT_APLY_NO", "CVLCPT_RCPT_NO", xlsx.format(r -> xlsx.str2date(r.get("CVLCPT_RCPT_YMD"))), xlsx.format(r -> xlsx.str2date(r.get("CRDN_YMD")) + " " + xlsx.str2time(r.get("CRDN_TM"))), + "VHRNO", "CRDN_STDG_NM", "CRDN_PLC", xlsx.style("FFNLG_AMT", numeric), "CRDN_STTS_NM", "RTPYR_NM", xlsx.format(r -> xlsx.str2date(r.get("RTPYR_BRDT"))) + ); + + return new ModelAndView("xlsView").addObject("xls", xlsx); + } + return setCollectionInfo(new ModelAndView("jsonView"), crdnService.getCrackdownList(query),""); } 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 24efd0c9..8e269e5f 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 @@ -469,6 +469,13 @@ $(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){ + $P.crdnControl.download(); + } else { + alert("조회된 자료가 없습니다."); + } + }); fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollCrdnList);