diff --git a/src/main/java/cokr/xit/fims/epst/web/Epst02Controller.java b/src/main/java/cokr/xit/fims/epst/web/Epst02Controller.java index e00a6ed5..e210a6e9 100644 --- a/src/main/java/cokr/xit/fims/epst/web/Epst02Controller.java +++ b/src/main/java/cokr/xit/fims/epst/web/Epst02Controller.java @@ -5,9 +5,14 @@ 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.apache.poi.ss.usermodel.HorizontalAlignment; 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.cmmn.CmmnQuery; @@ -335,6 +340,7 @@ public class Epst02Controller extends ApplicationController { .addObject("pageName", "epst02050") // View(jsp)에서 사용할 id 뒤에 붙일 suffix .addObject("infoPrefix", "epostRcptRslt") // prefix .addObject("sggCd", managedUser.getOrgID()) // 시군구 코드(SGG_CD) + .addObject("deptCd", managedUser.getDeptCode()) // 부서 코드(DEPT_CD) .addObject("EGP002List", commonCodes.get("EGP002")) // 취급 구분(DIV_KB) .addObject("FIM054List", commonCodes.get("FIM054")) // 업무 구분 코드(TASK_SE_CD) .addObject("FIM082List", commonCodes.get("FIM082")) // 작업 코드 3(JOB_CD) @@ -356,9 +362,53 @@ public class Epst02Controller extends ApplicationController { * } */ public ModelAndView getEpostReceiptResultList(EpostQuery req) { - List result = epostRcptRsltService.getEpostRcptRsltList(setFetchSize(req)); - - return setCollectionInfo(new ModelAndView("jsonView"), result, "epostRcptRslt"); + if (!"xls".equals(req.getDownload())) { + List result = epostRcptRsltService.getEpostRcptRsltList(setFetchSize(req)); + return setCollectionInfo(new ModelAndView("jsonView"), result, "epostRcptRslt"); + } else { + XLSWriter xlsx = new XLSWriter() + .setFilename("우편통합 접수결과 목록.xlsx") + .worksheet(0); + + CellStyle header = xlsx.cellStyle(new XLSWriter.Styler() + .width(32) + .foregroundColor(HSSFColor.HSSFColorPredefined.LIGHT_BLUE.getIndex()) + .configure(styler -> { + Font font = xlsx.workbook().createFont(); + font.setColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex()); + styler.font(font); + styler.alignment(HorizontalAlignment.CENTER); + }) + ) + , numeric = xlsx.n_nn0(); + + xlsx.cell(0, 0) + .value("우편통합 접수결과 목록", XLSWriter.Styler.CENTER) + .merge(0, 11) + .cell(3, 0) + .rowValues(List.of( + "발송자료키", header, "우편물코드", header, "우편물종류", header, "발송일자", header, "접수일자", header + , "취급구분", header, "발송건수", header, "결제금액", header, "제작수수료", header, "우편요금", header + , "등록일시", header, "등록사용자", header + )) + .cell(4, 0) + .values( epostRcptRsltService.getEpostRcptRsltList(req.setFetchSize(0)) + , xlsx.style("RELETCDATA", XLSWriter.Styler.CENTER) + , xlsx.style("JOB_CD", XLSWriter.Styler.CENTER) + , xlsx.style("JOB_CD3_NM", XLSWriter.Styler.CENTER) + , xlsx.format(r -> xlsx.str2date(r.get("EXTRI_REGYMD"))) + , xlsx.format(r -> xlsx.str2date(r.get("RCEPT_YMD"))) + , xlsx.style("DIV_KB_NM", XLSWriter.Styler.CENTER) + , xlsx.style("RCEPT_CNT", numeric) + , xlsx.style("RCEPT_AMT", numeric) + , xlsx.style("USEFEE_AMT", numeric) + , xlsx.style("TOTPOST_PRC", numeric) + , "REG_DT", "RGTR_NM" + ); + + return new ModelAndView("xlsView") + .addObject("xls", xlsx); + } } /**지정하는 단속 ID의 단속, 납부자 정보를 반환한다. diff --git a/src/main/webapp/WEB-INF/jsp/fims/epst/epst02050-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/epst/epst02050-main.jsp index fcd3240c..f3b0440e 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/epst/epst02050-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/epst/epst02050-main.jsp @@ -31,6 +31,7 @@
+