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);