diff --git a/src/main/java/cokr/xit/fims/excl/web/Excl01Controller.java b/src/main/java/cokr/xit/fims/excl/web/Excl01Controller.java index 2bf6c336..edb8b604 100644 --- a/src/main/java/cokr/xit/fims/excl/web/Excl01Controller.java +++ b/src/main/java/cokr/xit/fims/excl/web/Excl01Controller.java @@ -5,9 +5,13 @@ import java.util.Map; import javax.annotation.Resource; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Font; 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.web.ApplicationController; import cokr.xit.fims.excl.LevyExcl; @@ -82,9 +86,46 @@ public class Excl01Controller extends ApplicationController { * } */ public ModelAndView getLevyExclusionList(LevyExclQuery req) { - List result = levyExclService.getLevyExclList(setFetchSize(req)); - - return setCollectionInfo(new ModelAndView("jsonView"), result, "levyExcl"); + if (!"xls".equals(req.getDownload())) { + List result = levyExclService.getLevyExclList(setFetchSize(req)); + return setCollectionInfo(new ModelAndView("jsonView"), result, "levyExcl"); + } else { + XLSWriter xlsx = new XLSWriter() + .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); + }) + ), + 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( + levyExclService.getLevyExclList(req.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); + } } /**지정한 ID의 부과제외 정보(info)를 반환한다. diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 9f5f4d9f..fd7a1c5c 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -62,9 +62,9 @@ + - diff --git a/src/main/resources/sql/mybatis-config.xml b/src/main/resources/sql/mybatis-config.xml index f2b44261..44b31575 100644 --- a/src/main/resources/sql/mybatis-config.xml +++ b/src/main/resources/sql/mybatis-config.xml @@ -19,7 +19,7 @@ - + \ No newline at end of file diff --git a/src/main/resources/template/xls/excl-list-tmpl.xlsx b/src/main/resources/template/xls/excl-list-tmpl.xlsx new file mode 100644 index 00000000..7650fbc3 Binary files /dev/null and b/src/main/resources/template/xls/excl-list-tmpl.xlsx differ diff --git a/src/main/webapp/WEB-INF/jsp/fims/excl/excl01010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/excl/excl01010-main.jsp index c9bc6792..9552868a 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/excl/excl01010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/excl/excl01010-main.jsp @@ -533,9 +533,7 @@ } // 엑셀 버튼 이벤트 - fnExcel${pageName} = () => { - - } + fnExcel${pageName} = () => ${pageName}Control.download(); // 사용자 조회 버튼 이벤트 fnFindUser${pageName} = () => { diff --git a/src/main/webapp/resources/js/base/dataset.js b/src/main/webapp/resources/js/base/dataset.js index 10ae2aa4..b57068dd 100644 --- a/src/main/webapp/resources/js/base/dataset.js +++ b/src/main/webapp/resources/js/base/dataset.js @@ -1274,6 +1274,7 @@ class DatasetControl { _load() { if (!this.query.pageNum) this.query.pageNum = 1; + ajax.get({ url:this.urls.load, data:this.query, @@ -1286,6 +1287,13 @@ class DatasetControl { } }); } + + download(type) { + this.query.download = type || "xls"; + let query = toQuery(this.query); + this.query.download = null; + document.location.href = this.urls.load + "?" + query; + } setData(obj) { this.dataset.setData(obj);