diff --git a/src/main/java/cokr/xit/fims/cmmn/xls/FormatMaker.java b/src/main/java/cokr/xit/fims/cmmn/xls/FormatMaker.java index ba1ae247..d0d39fdd 100644 --- a/src/main/java/cokr/xit/fims/cmmn/xls/FormatMaker.java +++ b/src/main/java/cokr/xit/fims/cmmn/xls/FormatMaker.java @@ -56,7 +56,7 @@ public class FormatMaker { public static Format yyyy_mm_dd(Format format, String key) { return format.of(key).value(o -> { - return DataFormat.yyyy_mm_dd_hh_mm_ss(((Map) o).get(key)); + return DataFormat.yyyy_mm_dd(((Map) o).get(key)); }); } diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn02Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn02Controller.java index 6dd2f7e0..e35cbe59 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn02Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn02Controller.java @@ -8,6 +8,7 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @@ -15,14 +16,17 @@ import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.core.type.TypeReference; import cokr.xit.base.code.CommonCode; -import cokr.xit.base.file.xls.XLSWriter; -import cokr.xit.base.file.xls.XLSWriter.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; 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.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.dao.CrdnInfoMapper; import cokr.xit.fims.crdn.service.CrdnService; @@ -107,46 +111,42 @@ public class Crdn02Controller extends ApplicationController { if("xls".equals(query.getDownload())) { ArrayList cellDefs = fromJson(query.getCellDefs(), new TypeReference>() {}); - XLSWriter xlsx = new XLSWriter() - .setFilename("검사자료 목록.xlsx") - .worksheet(0); - - CellStyle center = xlsx.cellStyle(Styler.CENTER); - CellStyle numeric = xlsx.n_nn0(); - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = crdnService.getCrackdownList(query.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("자료출처", xlsx.style("CRDN_INPT_SE_NM", center)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("처리상태", xlsx.style("CRDN_STTS_NM", center)); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("사진매수", xlsx.style("ATCH_FILE_CNT", center)); - valueMap.put("위반건수", xlsx.style("CRDN_CNT", center)); - valueMap.put("단속건수", xlsx.style("CRDN_CNT", center)); - valueMap.put("검사결과", "INSP_RSLT"); - valueMap.put("처리방법", xlsx.style("PRCS_MTHD", center)); - valueMap.put("위반동", xlsx.style("CRDN_STDG_NM", center)); - valueMap.put("단속동", xlsx.style("CRDN_STDG_NM", center)); - valueMap.put("원금액", xlsx.style("FFNLG_CRDN_AMT", numeric)); - valueMap.put("감경금액", xlsx.style("ADVNTCE_AMT", numeric)); - valueMap.put("금액", xlsx.style("FFNLG_CRDN_AMT", numeric)); - valueMap.put("단속조", xlsx.style("TEAM_NM", center)); - valueMap.put("성명", "RTPYR_NM"); - valueMap.put("주민번호", xlsx.style("RTPYR_NO", center)); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("자료출처", format.of("CRDN_INPT_SE_NM").style(center)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("처리상태", format.of("CRDN_STTS_NM").style(center)); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("사진매수", format.of("ATCH_FILE_CNT").style(center)); + valueMap.put("위반건수", format.of("CRDN_CNT").style(center)); + valueMap.put("단속건수", format.of("CRDN_CNT").style(center)); + valueMap.put("검사결과", format.of("INSP_RSLT")); + valueMap.put("처리방법", format.of("PRCS_MTHD").style(center)); + valueMap.put("위반동", format.of("CRDN_STDG_NM").style(center)); + valueMap.put("단속동", format.of("CRDN_STDG_NM").style(center)); + valueMap.put("원금액", format.of("FFNLG_CRDN_AMT").style(numeric)); + valueMap.put("감경금액", format.of("ADVNTCE_AMT").style(numeric)); + valueMap.put("금액", format.of("FFNLG_CRDN_AMT").style(numeric)); + valueMap.put("단속조", format.of("TEAM_NM").style(center)); + valueMap.put("성명", format.of("RTPYR_NM")); + valueMap.put("주민번호", format.of("RTPYR_NO").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("검사자료 목록", center) - .merge(0, cellDefs.size()-1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView").addObject("xls", xlsx) + xlsx.cell(0, 0).value("검사자료 목록").value(center).merge(0, cellDefs.size()-1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("xlsView").addObject("download", xlsx.getDownloadable().setFilename("검사자료 목록.xlsx")) .addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList()); } diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn03Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn03Controller.java index ea0b1b0f..b739dea0 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn03Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn03Controller.java @@ -8,6 +8,7 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @@ -15,13 +16,16 @@ import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.core.type.TypeReference; import cokr.xit.base.code.CommonCode; -import cokr.xit.base.file.xls.XLSWriter; -import cokr.xit.base.file.xls.XLSWriter.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; 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.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.service.CrdnService; @@ -89,35 +93,31 @@ public class Crdn03Controller extends ApplicationController { if("xls".equals(query.getDownload())) { ArrayList cellDefs = fromJson(query.getCellDefs(), new TypeReference>() {}); - XLSWriter xlsx = new XLSWriter() - .setFilename("표지정보미확인자료 목록.xlsx") - .worksheet(0); - - CellStyle center = xlsx.cellStyle(Styler.CENTER); - CellStyle numeric = xlsx.n_nn0(); - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = crdnService.getCrackdownList(query.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("자료출처", xlsx.style("CRDN_INPT_SE_NM", center)); - valueMap.put("위반일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("법정동", xlsx.style("CRDN_STDG_NM", center)); - valueMap.put("잔액", xlsx.style("BLNC", numeric)); - valueMap.put("사진건수", xlsx.style("ATCH_FILE_CNT", center)); - valueMap.put("발행번호", "CRDN_SN"); + valueMap.put("자료출처", format.of("CRDN_INPT_SE_NM").style(center)); + valueMap.put("위반일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("법정동", format.of("CRDN_STDG_NM").style(center)); + valueMap.put("잔액", format.of("BLNC").style(numeric)); + valueMap.put("사진건수", format.of("ATCH_FILE_CNT").style(center)); + valueMap.put("발행번호", format.of(format.of("CRDN_SN"))); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("표지정보미확인자료 목록", center) - .merge(0, cellDefs.size()-1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView").addObject("xls", xlsx) + xlsx.cell(0, 0).value("표지정보미확인자료 목록").value(center).merge(0, cellDefs.size()-1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView").addObject("download", xlsx.getDownloadable().setFilename("표지정보미확인자료 목록.xlsx")) .addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList()); } 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 a9afaab8..2192749b 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn06Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn06Controller.java @@ -127,24 +127,27 @@ public class Crdn06Controller extends ApplicationController { CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); CellStyle dateYMD = format.yyyy_mm_dd(); CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); Map valueMap = new HashMap(); - valueMap.put("자료출처", format.of("CRDN_INPT_SE_NM").style(center)); - valueMap.put("차량번호", left); - valueMap.put("위반일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,"CRDN_YMD_TM").style(dateDT)); - valueMap.put("단속장소", left); - valueMap.put("사진건수", center); - valueMap.put("스티커번호", left); - valueMap.put("장애차량확인", format.of("PARKNG_PSBLTY_RSLT_NM").style(center)); - valueMap.put("처리상태", format.of("CRDN_STTS_NM").style(center)); - valueMap.put("제외사유", format.of("LEVY_EXCL_RSN_NM").style(center)); - valueMap.put("제외처리일자", FormatMaker.yyyy_mm_dd(format,"LEVY_EXCL_YMD").style(dateYMD)); - valueMap.put("제외내역", left); - if(ifEmpty(query.getIncludePhoto(), () -> "").equals("Y")) { - valueMap.put("사진1", FormatMaker.photoCellForApproval(format, comment, "CRDN_PHOTO_PATH1")); - valueMap.put("사진2", FormatMaker.photoCellForApproval(format, comment, "CRDN_PHOTO_PATH2")); + for(CellDef def : cellDefs) { + switch(def.getLabel()) { + case "자료출처"->{ valueMap.put("자료출처", format.of("CRDN_INPT_SE_NM").style(center)); } + case "차량번호"->{ valueMap.put("차량번호", left); } + case "위반일시"->{ valueMap.put("위반일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,"CRDN_YMD_TM").style(dateDT)); } + case "단속장소"->{ valueMap.put("단속장소", left); } + case "사진건수"->{ valueMap.put("사진건수", center); } + case "스티커번호"->{ valueMap.put("스티커번호", left); } + case "장애차량확인"->{ valueMap.put("장애차량확인", format.of("PARKNG_PSBLTY_RSLT_NM").style(center)); } + case "처리상태"->{ valueMap.put("처리상태", format.of("CRDN_STTS_NM").style(center)); } + case "제외사유"->{ valueMap.put("제외사유", format.of("LEVY_EXCL_RSN_NM").style(center)); } + case "제외처리일자"->{ valueMap.put("제외처리일자", FormatMaker.yyyy_mm_dd(format,"LEVY_EXCL_YMD").style(dateYMD)); } + case "제외내역"->{ valueMap.put("제외내역", left); } + case "사진1"->{ valueMap.put("사진1", FormatMaker.photoCellForApproval(format, comment, "CRDN_PHOTO_PATH1")); } + case "사진2"->{ valueMap.put("사진2", FormatMaker.photoCellForApproval(format, comment, "CRDN_PHOTO_PATH2")); } + } } CellDef.setValues(cellDefs, valueMap); diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java index 02e61b87..1a075467 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java @@ -8,6 +8,7 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @@ -15,13 +16,16 @@ import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.core.type.TypeReference; import cokr.xit.base.code.CommonCode; -import cokr.xit.base.file.xls.XLSWriter; -import cokr.xit.base.file.xls.XLSWriter.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; 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.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.fims.crdn.service.CrdnStngService; @@ -86,41 +90,37 @@ public class Crdn08Controller extends ApplicationController { if("xls".equals(query.getDownload())) { ArrayList cellDefs = fromJson(query.getCellDefs(), new TypeReference>() {}); - XLSWriter xlsx = new XLSWriter() - .setFilename("면제차량 목록.xlsx") - .worksheet(0); - - CellStyle center = xlsx.cellStyle(Styler.CENTER); - CellStyle dateYMD = xlsx.yyyy_mm_dd(); - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = crdnStngService.getExemptionVehicleList(query.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("사유", "EXMPTN_RSN"); - valueMap.put("공문번호", "DOC_NO"); - valueMap.put("소유주명", "OWNR_NM"); - valueMap.put("면제시작일", xlsx.format(o -> xlsx.str2date(o.get("EXMPTN_BGNG_YMD"))).style(dateYMD)); - valueMap.put("면제종료일", xlsx.format(o -> xlsx.str2date(o.get("EXMPTN_END_YMD"))).style(dateYMD)); - valueMap.put("입력자", "RGTR_NM"); - valueMap.put("입력일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("수정자", "MDFR_NM"); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("삭제자", "DLTR_NM"); - valueMap.put("삭제사유", "DEL_RSN"); - valueMap.put("삭제일시", xlsx.format(o -> xlsx.str2datetime(o.get("DEL_DT"))).style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("사유", format.of("EXMPTN_RSN")); + valueMap.put("공문번호", format.of("DOC_NO")); + valueMap.put("소유주명", format.of("OWNR_NM")); + valueMap.put("면제시작일", FormatMaker.yyyy_mm_dd(format, "EXMPTN_BGNG_YMD").style(dateYMD)); + valueMap.put("면제종료일", FormatMaker.yyyy_mm_dd(format, "EXMPTN_END_YMD").style(dateYMD)); + valueMap.put("입력자", format.of("RGTR_NM")); + valueMap.put("입력일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("수정자", format.of("MDFR_NM")); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("삭제자", format.of("DLTR_NM")); + valueMap.put("삭제사유", format.of("DEL_RSN")); + valueMap.put("삭제일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "DEL_DT").style(dateDT)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("면제차량 목록", center) - .merge(0, cellDefs.size()-1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView").addObject("xls", xlsx) + xlsx.cell(0, 0).value("면제차량 목록").value(center).merge(0, cellDefs.size()-1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView").addObject("download", xlsx.getDownloadable().setFilename("면제차량 목록.xlsx")) .addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList()); } 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 f99b98db..312fea0c 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java @@ -136,6 +136,7 @@ public class Cvlc01Controller extends ApplicationController { Format format = new Format(xlsx); CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); CellStyle dateYMD = format.yyyy_mm_dd(); CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); @@ -146,9 +147,9 @@ public class Cvlc01Controller extends ApplicationController { valueMap.put("신고자", center); valueMap.put("담당자", center); valueMap.put("담당자전화번호", center); - valueMap.put("접수일자", FormatMaker.yyyy_mm_dd(format,dateYMD,"CVLCPT_RCPT_YMD")); - valueMap.put("처리기한", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,dateDT,"CVLCPT_PRCS_PRNMNT_DT")); - valueMap.put("위반일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,dateDT,"CRDN_YMD_TM")); + valueMap.put("접수일자", FormatMaker.yyyy_mm_dd(format,"CVLCPT_RCPT_YMD").style(dateYMD)); + valueMap.put("처리기한", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,"CVLCPT_PRCS_PRNMNT_DT").style(dateDT)); + valueMap.put("위반일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,"CRDN_YMD_TM").style(dateDT)); valueMap.put("위반내용", center); valueMap.put("차량번호", left); valueMap.put("사진건수", center); 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 29cf0eee..8c584d25 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc02Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc02Controller.java @@ -118,6 +118,7 @@ public class Cvlc02Controller extends ApplicationController { CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); CellStyle dateYMD = format.yyyy_mm_dd(); CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); 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 ff945d15..c2b7cbb1 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc03Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc03Controller.java @@ -8,6 +8,7 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @@ -15,14 +16,17 @@ import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.core.type.TypeReference; import cokr.xit.base.code.CommonCode; -import cokr.xit.base.file.xls.XLSWriter; -import cokr.xit.base.file.xls.XLSWriter.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; 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.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.service.CrdnService; import cokr.xit.fims.cvlc.service.CrdnCvlcptService; @@ -91,49 +95,40 @@ public class Cvlc03Controller extends ApplicationController { if("xls".equals(query.getDownload())) { ArrayList cellDefs = fromJson(query.getCellDefs(), new TypeReference>() {}); - XLSWriter xlsx = new XLSWriter() - .setFilename("민원자료 목록.xlsx") - .worksheet(0); - - CellStyle center = xlsx.cellStyle(Styler.CENTER); - CellStyle dateYMD = xlsx.yyyy_mm_dd(); - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("접수번호", xlsx.style("CVLCPT_RCPT_NO", center)); - valueMap.put("목록번호", xlsx.style("CVLCPT_LIST_NO", center)); - valueMap.put("등록구분", xlsx.style("CRDN_REG_SE_NM", center)); - valueMap.put("신고자", xlsx.style("CVLCPT_APLCNT_NM", center)); - valueMap.put("담당자", xlsx.style("CVLCPT_PRCS_PIC_NM", center)); - valueMap.put("담당자전화번호", xlsx.style("CVLCPT_PRCS_PIC_TELNO", center)); - valueMap.put("접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD)); - valueMap.put("처리기한", xlsx.format(o -> { - if(o.get("CVLCPT_PRCS_PRNMNT_DT") != null && ((String)o.get("CVLCPT_PRCS_PRNMNT_DT")).length() > 8) { - return xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT")); - } else { - return xlsx.str2date(o.get("CVLCPT_PRCS_PRNMNT_DT")); - } - }).style(dateDT)); - valueMap.put("위반일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("위반내용", xlsx.style("VLTN_ARTCL", center)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("사진건수", xlsx.style("ATCH_FILE_CNT", center)); - valueMap.put("서손/계고사유", xlsx.style("LEVY_EXCL_RSN_NM", center)); - valueMap.put("특기사항", "ETC_CN"); + valueMap.put("접수번호", format.of("CVLCPT_RCPT_NO").style(center)); + valueMap.put("목록번호", format.of("CVLCPT_LIST_NO").style(center)); + valueMap.put("등록구분", format.of("CRDN_REG_SE_NM").style(center)); + valueMap.put("신고자", format.of("CVLCPT_APLCNT_NM").style(center)); + valueMap.put("담당자", format.of("CVLCPT_PRCS_PIC_NM").style(center)); + valueMap.put("담당자전화번호", format.of("CVLCPT_PRCS_PIC_TELNO").style(center)); + valueMap.put("접수일자", FormatMaker.yyyy_mm_dd(format, "CVLCPT_RCPT_YMD").style(dateYMD)); + valueMap.put("처리기한", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CVLCPT_PRCS_PRNMNT_DT").style(dateDT)); + valueMap.put("위반일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("위반내용", format.of("VLTN_ARTCL").style(center)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("사진건수", format.of("ATCH_FILE_CNT").style(center)); + valueMap.put("서손/계고사유", format.of("LEVY_EXCL_RSN_NM").style(center)); + valueMap.put("특기사항", format.of("ETC_CN")); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("민원자료 목록", center) - .merge(0, cellDefs.size()-1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView").addObject("xls", xlsx) - .addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList()); + xlsx.cell(0, 0).value("민원자료 목록").value(center).merge(0, cellDefs.size()-1); + xlsx.cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))); + xlsx.cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + ModelAndView mav = new ModelAndView("downloadView"); + mav.addObject("download", xlsx.getDownloadable().setFilename("민원자료 목록.xlsx")); + return mav.addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList()); } return setCollectionInfo(new ModelAndView("jsonView"),crdnCvlcptService.getCivilComplaintList(query),"",""); 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 0c6f1030..3ca35603 100644 --- a/src/main/java/cokr/xit/fims/epst/web/Epst02Controller.java +++ b/src/main/java/cokr/xit/fims/epst/web/Epst02Controller.java @@ -8,18 +8,22 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; 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.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.epst.EpostGdcc; import cokr.xit.fims.epst.EpostQuery; import cokr.xit.fims.epst.EpostRcptReg; @@ -133,41 +137,37 @@ public class Epst02Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("우편통합안내문" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = epostGdccService.getEpostGdccList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("발송구분", xlsx.style("SNDNG_SE_NM", center)); - valueMap.put("사용여부", xlsx.style("USE_YN_NM", center)); - valueMap.put("최종사용일시", xlsx.format(o -> xlsx.str2date(o.get("LAST_USE_DT"))).style(dateDT)); - valueMap.put("제목", "TTL_NM"); - valueMap.put("문구내용", "WORDS_CN"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("발송구분", format.of("SNDNG_SE_NM").style(center)); + valueMap.put("사용여부", format.of("USE_YN_NM").style(center)); + valueMap.put("최종사용일시", FormatMaker.yyyy_mm_dd(format, "LAST_USE_DT").style(dateDT)); + valueMap.put("제목", format.of("TTL_NM")); + valueMap.put("문구내용", format.of("WORDS_CN")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("우편통합 안내문", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("우편통합 안내문").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("우편통합안내문" + "_목록_" + dateTime + ".xlsx")); } } @@ -324,41 +324,35 @@ public class Epst02Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("우편통합우편발송" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = epostRcptRegService.getEpostRcptRegList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("발송일자", xlsx.format(o -> xlsx.str2date(o.get("SEND_DATE"))).style(dateYMD)); - valueMap.put("발송내역", xlsx.style("JOB_CD", center)); - valueMap.put("취급구분", xlsx.style("DIV_KB_NM", center)); - valueMap.put("접수일자", xlsx.format(o -> xlsx.str2date(o.get("RCEPT_YMD"))).style(dateYMD)); - valueMap.put("자료키", xlsx.style("CON_KEY", center)); - valueMap.put("발송건수", xlsx.style("RECEV_CNT", numeric)); - valueMap.put("우편처리상태", xlsx.style("POST_PRCS_STTS_NM", center)); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); + valueMap.put("발송일자", FormatMaker.yyyy_mm_dd(format, "SEND_DATE").style(dateYMD)); + valueMap.put("발송내역", format.of("JOB_CD").style(center)); + valueMap.put("취급구분", format.of("DIV_KB_NM").style(center)); + valueMap.put("접수일자", FormatMaker.yyyy_mm_dd(format, "RCEPT_YMD").style(dateYMD)); + valueMap.put("자료키", format.of("CON_KEY").style(center)); + valueMap.put("발송건수", format.of("RECEV_CNT").style(numeric)); + valueMap.put("우편처리상태", format.of("POST_PRCS_STTS_NM").style(center)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("우편통합 우편발송", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("우편통합 우편발송").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("우편통합우편발송" + "_목록_" + dateTime + ".xlsx")); } } @@ -408,44 +402,40 @@ public class Epst02Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("우편통합발송상세" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = epostRcptRegService.getEpostRcptRegDtlList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등기번호", xlsx.style("RGST_NMBR", center)); - valueMap.put("우편번호", xlsx.style("RECEV_CAR_OWNER_ZIPCODE", center)); - valueMap.put("수취인명", "RECEV_CAR_OWNER_NM"); - valueMap.put("배달일시", xlsx.format(o -> xlsx.str2datetime(o.get("DELIV_YMD_TM"))).style(dateDT)); - valueMap.put("배달결과", xlsx.style("DELIVRSLTCD_NM", center)); - valueMap.put("수령인명", "SUBRECPRSNNM"); - valueMap.put("수령인관계", xlsx.style("RELRECPRSNCDNM", center)); - valueMap.put("미배달사유", "NONDELIVREASNCDNM"); - valueMap.put("주소", "RECEV_CAR_OWNER_ADDR"); - valueMap.put("상세주소", "RECEV_CAR_OWNER_DETAILADDR"); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등기번호", format.of("RGST_NMBR").style(center)); + valueMap.put("우편번호", format.of("RECEV_CAR_OWNER_ZIPCODE").style(center)); + valueMap.put("수취인명", format.of("RECEV_CAR_OWNER_NM")); + valueMap.put("배달일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "DELIV_YMD_TM").style(dateDT)); + valueMap.put("배달결과", format.of("DELIVRSLTCD_NM").style(center)); + valueMap.put("수령인명", format.of("SUBRECPRSNNM")); + valueMap.put("수령인관계", format.of("RELRECPRSNCDNM").style(center)); + valueMap.put("미배달사유", format.of("NONDELIVREASNCDNM")); + valueMap.put("주소", format.of("RECEV_CAR_OWNER_ADDR")); + valueMap.put("상세주소", format.of("RECEV_CAR_OWNER_DETAILADDR")); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("우편통합 발송상세", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("우편통합 발송상세").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("우편통합발송상세" + "_목록_" + dateTime + ".xlsx")); } } @@ -556,44 +546,38 @@ public class Epst02Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("우편통합접수결과" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = epostRcptRsltService.getEpostRcptRsltList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("발송자료키", xlsx.style("RELETCDATA", center)); - valueMap.put("우편물코드", xlsx.style("JOB_CD", center)); - valueMap.put("우편물종류", xlsx.style("JOB_CD3_NM", center)); - valueMap.put("발송일자", xlsx.format(o -> xlsx.str2date(o.get("EXTRI_REGYMD"))).style(dateYMD)); - valueMap.put("접수일자", xlsx.format(o -> xlsx.str2date(o.get("RCEPT_YMD"))).style(dateYMD)); - valueMap.put("취급구분", xlsx.style("DIV_KB_NM", center)); - valueMap.put("발송건수", xlsx.style("RCEPT_CNT", numeric)); - valueMap.put("결제금액", xlsx.style("RCEPT_AMT", numeric)); - valueMap.put("제작수수료", xlsx.style("USEFEE_AMT", numeric)); - valueMap.put("우편요금", xlsx.style("TOTPOST_PRC", numeric)); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); + valueMap.put("발송자료키", format.of("RELETCDATA").style(center)); + valueMap.put("우편물코드", format.of("JOB_CD").style(center)); + valueMap.put("우편물종류", format.of("JOB_CD3_NM").style(center)); + valueMap.put("발송일자", FormatMaker.yyyy_mm_dd(format, "EXTRI_REGYMD").style(dateYMD)); + valueMap.put("접수일자", FormatMaker.yyyy_mm_dd(format, "RCEPT_YMD").style(dateYMD)); + valueMap.put("취급구분", format.of("DIV_KB_NM").style(center)); + valueMap.put("발송건수", format.of("RCEPT_CNT").style(numeric)); + valueMap.put("결제금액", format.of("RCEPT_AMT").style(numeric)); + valueMap.put("제작수수료", format.of("USEFEE_AMT").style(numeric)); + valueMap.put("우편요금", format.of("TOTPOST_PRC").style(numeric)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("우편통합 접수결과", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("우편통합 접수결과").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("우편통합접수결과" + "_목록_" + dateTime + ".xlsx")); } } 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 a2018210..d5e4a5b7 100644 --- a/src/main/java/cokr/xit/fims/excl/web/Excl01Controller.java +++ b/src/main/java/cokr/xit/fims/excl/web/Excl01Controller.java @@ -8,18 +8,22 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; 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.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.excl.LevyExcl; import cokr.xit.fims.excl.LevyExclQuery; import cokr.xit.fims.excl.service.LevyExclService; @@ -110,61 +114,55 @@ public class Excl01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("부과제외" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = levyExclService.getLevyExclList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("부과제외일자", xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD"))).style(dateYMD)); - valueMap.put("부과제외구분", xlsx.style("LEVY_EXCL_SE_NM", center)); - valueMap.put("부과제외사유", "LEVY_EXCL_RSN_NM"); - valueMap.put("기타내용", "ETC_CN"); - valueMap.put("민원신청번호", xlsx.style("CVLCPT_APLY_NO", center)); - valueMap.put("민원접수번호", xlsx.style("CVLCPT_RCPT_NO", center)); - valueMap.put("민원접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD)); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("납부자구분", xlsx.style("RTPYR_SE_NM", center)); - valueMap.put("납부자번호", xlsx.style("RTPYR_NO", center)); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("단속법정동", xlsx.style("CRDN_STDG_NM", center)); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("상세단속장소", "DTL_CRDN_PLC"); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("단속금액", xlsx.style("FFNLG_CRDN_AMT", numeric)); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("단속특별구역", xlsx.style("CRDN_SPAREA_NM", center)); - valueMap.put("사용연료", xlsx.style("USE_FUEL_NM", center)); - valueMap.put("주차가능여부", xlsx.style("PARKNG_PSBLTY_RSLT_NM", center)); - valueMap.put("우편번호", xlsx.style("ZIP", center)); - valueMap.put("주소", "ADDR"); - valueMap.put("상세주소", "DTL_ADDR"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("부과제외일자", FormatMaker.yyyy_mm_dd(format, "LEVY_EXCL_YMD").style(dateYMD)); + valueMap.put("부과제외구분", format.of("LEVY_EXCL_SE_NM").style(center)); + valueMap.put("부과제외사유", format.of("LEVY_EXCL_RSN_NM")); + valueMap.put("기타내용", format.of("ETC_CN")); + valueMap.put("민원신청번호", format.of("CVLCPT_APLY_NO").style(center)); + valueMap.put("민원접수번호", format.of("CVLCPT_RCPT_NO").style(center)); + valueMap.put("민원접수일자", FormatMaker.yyyy_mm_dd(format, "CVLCPT_RCPT_YMD").style(dateYMD)); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center)); + valueMap.put("납부자번호", format.of("RTPYR_NO").style(center)); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM").style(center)); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("상세단속장소", format.of("DTL_CRDN_PLC")); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("단속원금", format.of("FFNLG_CRDN_AMT").style(numeric)); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("단속특별구역", format.of("CRDN_SPAREA_NM").style(center)); + valueMap.put("사용연료", format.of("USE_FUEL_NM").style(center)); + valueMap.put("주차가능여부", format.of("PARKNG_PSBLTY_RSLT_NM").style(center)); + valueMap.put("우편번호", format.of("ZIP").style(center)); + valueMap.put("주소", format.of("ADDR")); + valueMap.put("상세주소", format.of("DTL_ADDR")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("부과제외", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("부과제외").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("부과제외" + "_목록_" + dateTime + ".xlsx")); } } diff --git a/src/main/java/cokr/xit/fims/excl/web/Excl02Controller.java b/src/main/java/cokr/xit/fims/excl/web/Excl02Controller.java index b78b155d..b1302ebb 100644 --- a/src/main/java/cokr/xit/fims/excl/web/Excl02Controller.java +++ b/src/main/java/cokr/xit/fims/excl/web/Excl02Controller.java @@ -9,18 +9,20 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.code.CommonCode; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.service.FileService; import cokr.xit.base.file.web.FileInfoFactory; -import cokr.xit.base.file.xls.XLSWriter; -import cokr.xit.base.file.xls.XLSWriter.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnUtil; @@ -28,6 +30,8 @@ import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.hwp.format.DlbrDecsnList; import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.excl.LevyExclQuery; import cokr.xit.fims.excl.OpnnSbmsn; import cokr.xit.fims.excl.service.OpnnSbmsnService; @@ -133,71 +137,65 @@ public class Excl02Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("의견제출" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = opnnSbmsnService.getOpnnSbmsnList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("접수번호", xlsx.style("RCPT_NO", center)); - valueMap.put("접수일자", xlsx.format(o -> xlsx.str2date(o.get("RCPT_YMD"))).style(dateYMD)); - valueMap.put("접수구분", xlsx.style("RCPT_SE_NM", center)); - valueMap.put("통보구분", xlsx.style("NTFCTN_SE_NM", center)); - valueMap.put("소유주관계", xlsx.style("OWNR_REL_NM", center)); - valueMap.put("진술자명", "STTR_NM"); - valueMap.put("진술자생일", xlsx.style("STTR_BRDT_MASK", center)); - valueMap.put("진술자우편번호", xlsx.style("STTR_ZIP", center)); - valueMap.put("진술자주소", "STTR_ADDR"); - valueMap.put("진술자상세주소", "STTR_DADDR"); - valueMap.put("의견제출상태", xlsx.style("OPNN_SBMSN_STTS_NM", center)); - valueMap.put("의견제출분류", "OPNN_SBMSN_SE_NM"); - valueMap.put("의견제출요지", "OPNN_SBMSN_GIST"); - valueMap.put("문서번호", "DOC_NO"); - valueMap.put("답변일자", xlsx.format(o -> xlsx.str2date(o.get("ANS_YMD"))).style(dateYMD)); - valueMap.put("답변내용", "ANS_CN"); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("납부자구분", xlsx.style("RTPYR_SE_NM", center)); - valueMap.put("납부자번호", xlsx.style("RTPYR_NO", center)); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("단속법정동", xlsx.style("CRDN_STDG_NM", center)); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("상세단속장소", "DTL_CRDN_PLC"); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("단속금액", xlsx.style("FFNLG_CRDN_AMT", numeric)); - valueMap.put("과태료금액", xlsx.style("FFNLG_AMT", numeric)); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("단속특별구역", xlsx.style("CRDN_SPAREA_NM", center)); - valueMap.put("사용연료", xlsx.style("USE_FUEL_NM", center)); - valueMap.put("주차가능여부", xlsx.style("PARKNG_PSBLTY_RSLT_NM", center)); - valueMap.put("우편번호", xlsx.style("ZIP", center)); - valueMap.put("주소", "ADDR"); - valueMap.put("상세주소", "DTL_ADDR"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("접수번호", format.of("RCPT_NO").style(center)); + valueMap.put("접수일자", FormatMaker.yyyy_mm_dd(format, "RCPT_YMD").style(dateYMD)); + valueMap.put("접수구분", format.of("RCPT_SE_NM").style(center)); + valueMap.put("통보구분", format.of("NTFCTN_SE_NM").style(center)); + valueMap.put("소유주관계", format.of("OWNR_REL_NM").style(center)); + valueMap.put("진술자명", format.of("STTR_NM")); + valueMap.put("진술자생일", format.of("STTR_BRDT_MASK").style(center)); + valueMap.put("진술자우편번호", format.of("STTR_ZIP").style(center)); + valueMap.put("진술자주소", format.of("STTR_ADDR")); + valueMap.put("진술자상세주소", format.of("STTR_DADDR")); + valueMap.put("의견제출상태", format.of("OPNN_SBMSN_STTS_NM").style(center)); + valueMap.put("의견제출분류", format.of("OPNN_SBMSN_SE_NM")); + valueMap.put("의견제출요지", format.of("OPNN_SBMSN_GIST")); + valueMap.put("문서번호", format.of("DOC_NO")); + valueMap.put("답변일자", FormatMaker.yyyy_mm_dd(format, "ANS_YMD").style(dateYMD)); + valueMap.put("답변내용", format.of("ANS_CN")); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center)); + valueMap.put("납부자번호", format.of("RTPYR_NO").style(center)); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM").style(center)); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("상세단속장소", format.of("DTL_CRDN_PLC")); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("단속금액", format.of("FFNLG_CRDN_AMT").style(numeric)); + valueMap.put("과태료금액", format.of("FFNLG_AMT").style(numeric)); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("단속특별구역", format.of("CRDN_SPAREA_NM").style(center)); + valueMap.put("사용연료", format.of("USE_FUEL_NM").style(center)); + valueMap.put("주차가능여부", format.of("PARKNG_PSBLTY_RSLT_NM").style(center)); + valueMap.put("우편번호", format.of("ZIP").style(center)); + valueMap.put("주소", format.of("ADDR")); + valueMap.put("상세주소", format.of("DTL_ADDR")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("의견제출", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("의견제출").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("의견제출" + "_목록_" + dateTime + ".xlsx")); } } diff --git a/src/main/java/cokr/xit/fims/excl/web/Excl03Controller.java b/src/main/java/cokr/xit/fims/excl/web/Excl03Controller.java index 519bc721..87c33394 100644 --- a/src/main/java/cokr/xit/fims/excl/web/Excl03Controller.java +++ b/src/main/java/cokr/xit/fims/excl/web/Excl03Controller.java @@ -8,19 +8,23 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; 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.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.excl.CrdnReReg; import cokr.xit.fims.excl.LevyExclQuery; import cokr.xit.fims.excl.service.CrdnReRegService; @@ -105,55 +109,49 @@ public class Excl03Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("단속재등록" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = crdnReRegService.getCrdnReRegList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("재등록일자", xlsx.format(o -> xlsx.str2date(o.get("RE_REG_YMD"))).style(dateYMD)); - valueMap.put("단속등록구분", xlsx.style("CRDN_REG_SE_NM", center)); - valueMap.put("기타내용", "ETC_CN"); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("납부자구분", xlsx.style("RTPYR_SE_NM", center)); - valueMap.put("납부자번호", xlsx.style("RTPYR_NO", center)); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("단속법정동", "CRDN_STDG_NM"); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("상세단속장소", "DTL_CRDN_PLC"); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("단속금액", xlsx.style("FFNLG_CRDN_AMT", numeric)); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("단속특별구역", xlsx.style("CRDN_SPAREA_NM", center)); - valueMap.put("사용연료", xlsx.style("USE_FUEL_NM", center)); - valueMap.put("주차가능여부", xlsx.style("PARKNG_PSBLTY_RSLT_NM", center)); - valueMap.put("우편번호", xlsx.style("ZIP", center)); - valueMap.put("주소", "ADDR"); - valueMap.put("상세주소", "DTL_ADDR"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("재등록일자", FormatMaker.yyyy_mm_dd(format, "RE_REG_YMD").style(dateYMD)); + valueMap.put("단속등록구분", format.of("CRDN_REG_SE_NM").style(center)); + valueMap.put("기타내용", format.of("ETC_CN")); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center)); + valueMap.put("납부자번호", format.of("RTPYR_NO").style(center)); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM")); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("상세단속장소", format.of("DTL_CRDN_PLC")); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("단속금액", format.of("FFNLG_CRDN_AMT").style(numeric)); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("단속특별구역", format.of("CRDN_SPAREA_NM").style(center)); + valueMap.put("사용연료", format.of("USE_FUEL_NM").style(center)); + valueMap.put("주차가능여부", format.of("PARKNG_PSBLTY_RSLT_NM").style(center)); + valueMap.put("우편번호", format.of("ZIP").style(center)); + valueMap.put("주소", format.of("ADDR")); + valueMap.put("상세주소", format.of("DTL_ADDR")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("단속 재등록", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("단속 재등록").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("단속재등록" + "_목록_" + dateTime + ".xlsx")); } } diff --git a/src/main/java/cokr/xit/fims/levy/web/Levy01Controller.java b/src/main/java/cokr/xit/fims/levy/web/Levy01Controller.java index 694867bb..18b6d749 100644 --- a/src/main/java/cokr/xit/fims/levy/web/Levy01Controller.java +++ b/src/main/java/cokr/xit/fims/levy/web/Levy01Controller.java @@ -8,19 +8,23 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; 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.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnQuery; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.levy.Levy; import cokr.xit.fims.levy.LevyQuery; import cokr.xit.fims.levy.service.LevyService; @@ -114,55 +118,50 @@ public class Levy01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("사전감경부과대상" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = levyService.getRductLevyTrgtList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("법정동", "CRDN_STDG_NM"); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("단속금액", xlsx.style("FFNLG_CRDN_AMT", numeric)); - valueMap.put("과태료금액", xlsx.style("FFNLG_AMT", numeric)); - valueMap.put("사전통지금액", xlsx.style("ADVNTCE_AMT", numeric)); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("민원신청번호", xlsx.style("CVLCPT_APLY_NO", center)); - valueMap.put("민원접수번호", xlsx.style("CVLCPT_RCPT_NO", center)); - valueMap.put("민원접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD)); - valueMap.put("민원전송결과", xlsx.style("CVLCPT_TRSM_NM", center)); - valueMap.put("납부자구분", xlsx.style("RTPYR_SE_NM", center)); - valueMap.put("납부자번호", xlsx.style("RTPYR_NO", center)); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("우편번호", xlsx.style("ZIP", center)); - valueMap.put("주소", "ADDR"); - valueMap.put("상세주소", "DTL_ADDR"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("법정동", format.of("CRDN_STDG_NM")); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("단속금액", format.of("FFNLG_CRDN_AMT").style(numeric)); + valueMap.put("과태료금액", format.of("FFNLG_AMT").style(numeric)); + valueMap.put("사전통지금액", format.of("ADVNTCE_AMT").style(numeric)); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("민원신청번호", format.of("CVLCPT_APLY_NO").style(center)); + valueMap.put("민원접수번호", format.of("CVLCPT_RCPT_NO").style(center)); + valueMap.put("민원접수일자", FormatMaker.yyyy_mm_dd(format, "CVLCPT_RCPT_YMD").style(dateYMD)); + valueMap.put("민원전송결과", format.of("CVLCPT_TRSM_NM").style(center)); + valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center)); + valueMap.put("납부자번호", format.of("RTPYR_NO").style(center)); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("우편번호", format.of("ZIP").style(center)); + valueMap.put("주소", format.of("ADDR")); + valueMap.put("상세주소", format.of("DTL_ADDR")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("사전 감경부과 대상", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("사전 감경부과 대상").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("사전감경부과대상" + "_목록_" + dateTime + ".xlsx")); } } @@ -268,84 +267,79 @@ public class Levy01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("부과" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = levyService.getLevyList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("회계연도", xlsx.style("FYR", center)); - valueMap.put("회계코드", xlsx.style("ACNTG_SE_CD", center)); - valueMap.put("세목코드", xlsx.style("TXITM_CD", center)); - valueMap.put("세목명", xlsx.style("TXITM_NM", center)); - valueMap.put("부과번호", xlsx.style("LEVY_NO", center)); - valueMap.put("분납순번", xlsx.style("INSPY_NO", center)); - valueMap.put("부과구분", xlsx.style("LEVY_SE_NM", center)); - valueMap.put("통합구분", xlsx.style("UNTY_SE_NM", center)); - valueMap.put("감경구분", xlsx.style("RDUCT_SE_NM", center)); - valueMap.put("부과일자", xlsx.format(o -> xlsx.str2date(o.get("LEVY_YMD"))).style(dateYMD)); - valueMap.put("최초납기일자", xlsx.format(o -> xlsx.str2date(o.get("FRST_DUDT_YMD"))).style(dateYMD)); - valueMap.put("납기일자", xlsx.format(o -> xlsx.str2date(o.get("DUDT_YMD"))).style(dateYMD)); - valueMap.put("과태료금액", xlsx.style("FFNLG_AMT", numeric)); - valueMap.put("부과본세", xlsx.style("LEVY_PCPTAX", numeric)); - valueMap.put("부과가산금", xlsx.style("LEVY_ADAMT", numeric)); - valueMap.put("분납이자", xlsx.style("INSPY_INT", numeric)); - valueMap.put("수납본세", xlsx.style("RCVMT_PCPTAX", numeric)); - valueMap.put("수납가산금", xlsx.style("RCVMT_ADAMT", numeric)); - valueMap.put("감액본세", xlsx.style("RDCAMT_PCPTAX", numeric)); - valueMap.put("감액가산금", xlsx.style("RDCAMT_ADAMT", numeric)); - valueMap.put("미납금액", xlsx.style("SUM_AMT", numeric)); - valueMap.put("과세물건", "TXTN_THING"); - valueMap.put("체납사유", "NPMNT_RSN_NM"); - valueMap.put("수납일자", xlsx.format(o -> xlsx.str2date(o.get("RCVMT_YMD"))).style(dateYMD)); - valueMap.put("압류일자", xlsx.format(o -> xlsx.str2date(o.get("SZR_YMD"))).style(dateYMD)); - valueMap.put("압류물건", "SZR_THING"); - valueMap.put("대체압류차량", "RPM_SZR_VHRNO"); - valueMap.put("압류해제일자", xlsx.format(o -> xlsx.str2date(o.get("SZR_RMV_YMD"))).style(dateYMD)); - valueMap.put("전자납부번호", "EPAYNO_MASK"); - valueMap.put("은행명", "BANK_NM"); - valueMap.put("가상계좌번호", xlsx.style("VR_ACTNO", center)); - valueMap.put("은행명2", "BANK_NM2"); - valueMap.put("가상계좌번호2", xlsx.style("VR_ACTNO2", center)); - valueMap.put("은행명3", "BANK_NM3"); - valueMap.put("가상계좌번호3", xlsx.style("VR_ACTNO3", center)); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("법정동", "CRDN_STDG_NM"); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("단속금액", xlsx.style("FFNLG_CRDN_AMT", numeric)); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("납부자구분", xlsx.style("RTPYR_SE_NM", center)); - valueMap.put("납부자번호", xlsx.style("RTPYR_NO", center)); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("우편번호", xlsx.style("ZIP", center)); - valueMap.put("주소", "ADDR"); - valueMap.put("상세주소", "DTL_ADDR"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("회계연도", format.of("FYR").style(center)); + valueMap.put("회계코드", format.of("ACNTG_SE_CD").style(center)); + valueMap.put("세목코드", format.of("TXITM_CD").style(center)); + valueMap.put("세목명", format.of("TXITM_NM").style(center)); + valueMap.put("부과번호", format.of("LEVY_NO").style(center)); + valueMap.put("분납순번", format.of("INSPY_NO").style(center)); + valueMap.put("부과구분", format.of("LEVY_SE_NM").style(center)); + valueMap.put("통합구분", format.of("UNTY_SE_NM").style(center)); + valueMap.put("감경구분", format.of("RDUCT_SE_NM").style(center)); + valueMap.put("부과일자", FormatMaker.yyyy_mm_dd(format, "LEVY_YMD").style(dateYMD)); + valueMap.put("최초납기일자", FormatMaker.yyyy_mm_dd(format, "FRST_DUDT_YMD").style(dateYMD)); + valueMap.put("납기일자", FormatMaker.yyyy_mm_dd(format, "DUDT_YMD").style(dateYMD)); + valueMap.put("과태료금액", format.of("FFNLG_AMT").style(numeric)); + valueMap.put("부과본세", format.of("LEVY_PCPTAX").style(numeric)); + valueMap.put("부과가산금", format.of("LEVY_ADAMT").style(numeric)); + valueMap.put("분납이자", format.of("INSPY_INT").style(numeric)); + valueMap.put("수납본세", format.of("RCVMT_PCPTAX").style(numeric)); + valueMap.put("수납가산금", format.of("RCVMT_ADAMT").style(numeric)); + valueMap.put("감액본세", format.of("RDCAMT_PCPTAX").style(numeric)); + valueMap.put("감액가산금", format.of("RDCAMT_ADAMT").style(numeric)); + valueMap.put("미납금액", format.of("SUM_AMT").style(numeric)); + valueMap.put("과세물건", format.of("TXTN_THING")); + valueMap.put("체납사유", format.of("NPMNT_RSN_NM")); + valueMap.put("수납일자", FormatMaker.yyyy_mm_dd(format, "RCVMT_YMD").style(dateYMD)); + valueMap.put("압류일자", FormatMaker.yyyy_mm_dd(format, "SZR_YMD").style(dateYMD)); + valueMap.put("압류물건", format.of("SZR_THING")); + valueMap.put("대체압류차량", format.of("RPM_SZR_VHRNO")); + valueMap.put("압류해제일자", FormatMaker.yyyy_mm_dd(format, "SZR_RMV_YMD").style(dateYMD)); + valueMap.put("전자납부번호", format.of("EPAYNO_MASK")); + valueMap.put("은행명", format.of("BANK_NM")); + valueMap.put("가상계좌번호", format.of("VR_ACTNO").style(center)); + valueMap.put("은행명2", format.of("BANK_NM2")); + valueMap.put("가상계좌번호2", format.of("VR_ACTNO2").style(center)); + valueMap.put("은행명3", format.of("BANK_NM3")); + valueMap.put("가상계좌번호3", format.of("VR_ACTNO3").style(center)); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("법정동", format.of("CRDN_STDG_NM")); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("단속금액", format.of("FFNLG_CRDN_AMT").style(numeric)); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center)); + valueMap.put("납부자번호", format.of("RTPYR_NO").style(center)); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("우편번호", format.of("ZIP").style(center)); + valueMap.put("주소", format.of("ADDR")); + valueMap.put("상세주소", format.of("DTL_ADDR")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("부과", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("부과").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("부과" + "_목록_" + dateTime + ".xlsx")); } } diff --git a/src/main/java/cokr/xit/fims/levy/web/Levy02Controller.java b/src/main/java/cokr/xit/fims/levy/web/Levy02Controller.java index 3f010c8f..142b2168 100644 --- a/src/main/java/cokr/xit/fims/levy/web/Levy02Controller.java +++ b/src/main/java/cokr/xit/fims/levy/web/Levy02Controller.java @@ -8,19 +8,23 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; 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.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; 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.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.levy.LevyQuery; import cokr.xit.fims.levy.Rduct; import cokr.xit.fims.levy.service.RductService; @@ -111,56 +115,50 @@ public class Levy02Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("과태료감경" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = rductService.getRductList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("감경일자", xlsx.format(o -> xlsx.str2date(o.get("RDUCT_YMD"))).style(dateYMD)); - valueMap.put("감경사유", "RDUCT_RSN_CD"); - valueMap.put("기타내용", "ETC_CN"); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("납부자구분", xlsx.style("RTPYR_SE_NM", center)); - valueMap.put("납부자번호", xlsx.style("RTPYR_NO", center)); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("단속법정동", xlsx.style("CRDN_STDG_NM", center)); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("상세단속장소", "DTL_CRDN_PLC"); - valueMap.put("단속금액", xlsx.style("FFNLG_CRDN_AMT", numeric)); - valueMap.put("감경금액", xlsx.style("RDUCT_AMT", numeric)); - valueMap.put("과태료금액", xlsx.style("FFNLG_AMT", numeric)); - valueMap.put("미납금액", xlsx.style("SUM_AMT", numeric)); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("단속특별구역", xlsx.style("CRDN_SPAREA_NM", center)); - valueMap.put("사용연료", xlsx.style("USE_FUEL_NM", center)); - valueMap.put("주차가능여부", xlsx.style("PARKNG_PSBLTY_RSLT_NM", center)); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("감경일자", FormatMaker.yyyy_mm_dd(format, "RDUCT_YMD").style(dateYMD)); + valueMap.put("감경사유", format.of("RDUCT_RSN_CD")); + valueMap.put("기타내용", format.of("ETC_CN")); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center)); + valueMap.put("납부자번호", format.of("RTPYR_NO").style(center)); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM").style(center)); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("상세단속장소", format.of("DTL_CRDN_PLC")); + valueMap.put("단속금액", format.of("FFNLG_CRDN_AMT").style(numeric)); + valueMap.put("감경금액", format.of("RDUCT_AMT").style(numeric)); + valueMap.put("과태료금액", format.of("FFNLG_AMT").style(numeric)); + valueMap.put("미납금액", format.of("SUM_AMT").style(numeric)); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("단속특별구역", format.of("CRDN_SPAREA_NM").style(center)); + valueMap.put("사용연료", format.of("USE_FUEL_NM").style(center)); + valueMap.put("주차가능여부", format.of("PARKNG_PSBLTY_RSLT_NM").style(center)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("과태료감경", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("과태료감경").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("과태료감경" + "_목록_" + dateTime + ".xlsx")); } } diff --git a/src/main/java/cokr/xit/fims/rcvm/web/Rcvm01Controller.java b/src/main/java/cokr/xit/fims/rcvm/web/Rcvm01Controller.java index 18fd4ec1..19eb0235 100644 --- a/src/main/java/cokr/xit/fims/rcvm/web/Rcvm01Controller.java +++ b/src/main/java/cokr/xit/fims/rcvm/web/Rcvm01Controller.java @@ -8,18 +8,22 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; 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.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.rcvm.Rcvmt; import cokr.xit.fims.rcvm.RcvmtQuery; import cokr.xit.fims.rcvm.service.RcvmtService; @@ -109,73 +113,68 @@ public class Rcvm01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("수납" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = rcvmtService.getRcvmtList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("수납입력구분", xlsx.style("RCVMT_INPT_SE_NM", center)); - valueMap.put("수납취소", xlsx.style("RCVMT_RTRCN_NM", center)); - valueMap.put("회계연도", xlsx.style("FYR", center)); - valueMap.put("회계구분", xlsx.style("ACNTG_SE_CD", center)); - valueMap.put("세목코드", xlsx.style("TXITM_CD", center)); - valueMap.put("세목명", "TXITM_NM"); - valueMap.put("부과번호", xlsx.style("LEVY_NO", center)); - valueMap.put("수납일련번호", xlsx.style("RCVMT_SN", center)); - valueMap.put("회계일자", xlsx.format(o -> xlsx.str2date(o.get("ACNTG_YMD"))).style(dateYMD)); - valueMap.put("소인일자", xlsx.format(o -> xlsx.str2date(o.get("PSTMRK_YMD"))).style(dateYMD)); - valueMap.put("수납일자", xlsx.format(o -> xlsx.str2date(o.get("RCVMT_YMD"))).style(dateYMD)); - valueMap.put("수납금액", xlsx.style("RCVMT_AMT", numeric)); - valueMap.put("수납본세", xlsx.style("RCVMT_PCPTAX", numeric)); - valueMap.put("수납가산금", xlsx.style("RCVMT_ADAMT", numeric)); - valueMap.put("수납이자", xlsx.style("RCVMT_INT", numeric)); - valueMap.put("수납은행", "RCVMT_BANK_NM"); - valueMap.put("납부방법", "PAY_MTHD_SE_NM"); - valueMap.put("수납구분", xlsx.style("RCVMT_SE_NM", center)); - valueMap.put("수납상태", xlsx.style("RCVMT_STTS_NM", center)); - valueMap.put("부과일자", xlsx.format(o -> xlsx.str2date(o.get("LEVY_YMD"))).style(dateYMD)); - valueMap.put("최초납기일자", xlsx.format(o -> xlsx.str2date(o.get("FRST_DUDT_YMD"))).style(dateYMD)); - valueMap.put("납기일자", xlsx.format(o -> xlsx.str2date(o.get("DUDT_YMD"))).style(dateYMD)); - valueMap.put("부과본세", xlsx.style("LEVY_PCPTAX", numeric)); - valueMap.put("부과가산금", xlsx.style("LEVY_ADAMT", numeric)); - valueMap.put("분납이자", xlsx.style("INSPY_INT", numeric)); - valueMap.put("압류일자", xlsx.format(o -> xlsx.str2date(o.get("SZR_YMD"))).style(dateYMD)); - valueMap.put("압류물건", "SZR_THING"); - valueMap.put("대체압류차량", "RPM_SZR_VHRNO"); - valueMap.put("압류해제일자", xlsx.format(o -> xlsx.str2date(o.get("SZR_RMV_YMD"))).style(dateYMD)); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("납부자구분", xlsx.style("RTPYR_SE_NM", center)); - valueMap.put("납부자번호", xlsx.style("RTPYR_NO", center)); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("단속법정동", "CRDN_STDG_NM"); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("수납입력구분", format.of("RCVMT_INPT_SE_NM").style(center)); + valueMap.put("수납취소", format.of("RCVMT_RTRCN_NM").style(center)); + valueMap.put("회계연도", format.of("FYR").style(center)); + valueMap.put("회계구분", format.of("ACNTG_SE_CD").style(center)); + valueMap.put("세목코드", format.of("TXITM_CD").style(center)); + valueMap.put("세목명", format.of("TXITM_NM")); + valueMap.put("부과번호", format.of("LEVY_NO").style(center)); + valueMap.put("수납일련번호", format.of("RCVMT_SN").style(center)); + valueMap.put("회계일자", FormatMaker.yyyy_mm_dd(format, "ACNTG_YMD").style(dateYMD)); + valueMap.put("소인일자", FormatMaker.yyyy_mm_dd(format, "PSTMRK_YMD").style(dateYMD)); + valueMap.put("수납일자", FormatMaker.yyyy_mm_dd(format, "RCVMT_YMD").style(dateYMD)); + valueMap.put("수납금액", format.of("RCVMT_AMT").style(numeric)); + valueMap.put("수납본세", format.of("RCVMT_PCPTAX").style(numeric)); + valueMap.put("수납가산금", format.of("RCVMT_ADAMT").style(numeric)); + valueMap.put("수납이자", format.of("RCVMT_INT").style(numeric)); + valueMap.put("수납은행", format.of("RCVMT_BANK_NM")); + valueMap.put("납부방법", format.of("PAY_MTHD_SE_NM")); + valueMap.put("수납구분", format.of("RCVMT_SE_NM").style(center)); + valueMap.put("수납상태", format.of("RCVMT_STTS_NM").style(center)); + valueMap.put("부과일자", FormatMaker.yyyy_mm_dd(format, "LEVY_YMD").style(dateYMD)); + valueMap.put("최초납기일자", FormatMaker.yyyy_mm_dd(format, "FRST_DUDT_YMD").style(dateYMD)); + valueMap.put("납기일자", FormatMaker.yyyy_mm_dd(format, "DUDT_YMD").style(dateYMD)); + valueMap.put("부과본세", format.of("LEVY_PCPTAX").style(numeric)); + valueMap.put("부과가산금", format.of("LEVY_ADAMT").style(numeric)); + valueMap.put("분납이자", format.of("INSPY_INT").style(numeric)); + valueMap.put("압류일자", FormatMaker.yyyy_mm_dd(format, "SZR_YMD").style(dateYMD)); + valueMap.put("압류물건", format.of("SZR_THING")); + valueMap.put("대체압류차량", format.of("RPM_SZR_VHRNO")); + valueMap.put("압류해제일자", FormatMaker.yyyy_mm_dd(format, "SZR_RMV_YMD").style(dateYMD)); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center)); + valueMap.put("납부자번호", format.of("RTPYR_NO").style(center)); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM")); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("수납", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("수납").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("수납" + "_목록_" + dateTime + ".xlsx")); } } diff --git a/src/main/java/cokr/xit/fims/rdca/web/Rdca01Controller.java b/src/main/java/cokr/xit/fims/rdca/web/Rdca01Controller.java index c03c097b..c37cc58d 100644 --- a/src/main/java/cokr/xit/fims/rdca/web/Rdca01Controller.java +++ b/src/main/java/cokr/xit/fims/rdca/web/Rdca01Controller.java @@ -8,16 +8,20 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +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.file.xls.XLSWriter.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.rdca.Rdcamt; import cokr.xit.fims.rdca.RdcamtQuery; import cokr.xit.fims.rdca.service.RdcamtService; @@ -104,61 +108,55 @@ public class Rdca01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("감액" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = rdcamtService.getRdcamtList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("부과제외일자", xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD"))).style(dateYMD)); - valueMap.put("부과제외구분", xlsx.style("LEVY_EXCL_SE_NM", center)); - valueMap.put("부과제외사유", "LEVY_EXCL_RSN_NM"); - valueMap.put("기타내용", "ETC_CN"); - valueMap.put("민원신청번호", xlsx.style("CVLCPT_APLY_NO", center)); - valueMap.put("민원접수번호", xlsx.style("CVLCPT_RCPT_NO", center)); - valueMap.put("민원접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD)); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("납부자구분", xlsx.style("RTPYR_SE_NM", center)); - valueMap.put("납부자번호", xlsx.style("RTPYR_NO", center)); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("단속법정동", xlsx.style("CRDN_STDG_NM", center)); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("상세단속장소", "DTL_CRDN_PLC"); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("단속금액", xlsx.style("FFNLG_CRDN_AMT", numeric)); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("단속특별구역", xlsx.style("CRDN_SPAREA_NM", center)); - valueMap.put("사용연료", xlsx.style("USE_FUEL_NM", center)); - valueMap.put("주차가능여부", xlsx.style("PARKNG_PSBLTY_RSLT_NM", center)); - valueMap.put("우편번호", xlsx.style("ZIP", center)); - valueMap.put("주소", "ADDR"); - valueMap.put("상세주소", "DTL_ADDR"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("부과제외일자", FormatMaker.yyyy_mm_dd(format, "LEVY_EXCL_YMD").style(dateYMD)); + valueMap.put("부과제외구분", format.of("LEVY_EXCL_SE_NM").style(center)); + valueMap.put("부과제외사유", format.of("LEVY_EXCL_RSN_NM")); + valueMap.put("기타내용", format.of("ETC_CN")); + valueMap.put("민원신청번호", format.of("CVLCPT_APLY_NO").style(center)); + valueMap.put("민원접수번호", format.of("CVLCPT_RCPT_NO").style(center)); + valueMap.put("민원접수일자", FormatMaker.yyyy_mm_dd(format, "CVLCPT_RCPT_YMD").style(dateYMD)); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center)); + valueMap.put("납부자번호", format.of("RTPYR_NO").style(center)); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM").style(center)); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("상세단속장소", format.of("DTL_CRDN_PLC")); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("단속금액", format.of("FFNLG_CRDN_AMT").style(numeric)); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("단속특별구역", format.of("CRDN_SPAREA_NM").style(center)); + valueMap.put("사용연료", format.of("USE_FUEL_NM").style(center)); + valueMap.put("주차가능여부", format.of("PARKNG_PSBLTY_RSLT_NM").style(center)); + valueMap.put("우편번호", format.of("ZIP").style(center)); + valueMap.put("주소", format.of("ADDR")); + valueMap.put("상세주소", format.of("DTL_ADDR")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("감액", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("감액").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("감액" + "_목록_" + dateTime + ".xlsx")); } } diff --git a/src/main/java/cokr/xit/fims/sndb/web/Sndb01Controller.java b/src/main/java/cokr/xit/fims/sndb/web/Sndb01Controller.java index 3fbab4d1..971c33a7 100644 --- a/src/main/java/cokr/xit/fims/sndb/web/Sndb01Controller.java +++ b/src/main/java/cokr/xit/fims/sndb/web/Sndb01Controller.java @@ -9,18 +9,20 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.code.CommonCode; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.file.etc.OutsourcingFileWriter; import cokr.xit.base.file.pdf.PDFWriter; import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.bean.FileBean; -import cokr.xit.base.file.xls.XLSWriter; -import cokr.xit.base.file.xls.XLSWriter.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnQuery; @@ -34,6 +36,8 @@ import cokr.xit.fims.cmmn.hwp.format.SvbtcList; import cokr.xit.fims.cmmn.pdf.print.format.Advntce; import cokr.xit.fims.cmmn.service.bean.OutsourcingStngBean; import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.mngt.service.bean.FactionBean; import cokr.xit.fims.mngt.service.bean.TaskBean; @@ -218,61 +222,55 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("계고장발송대상" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = sndngService.getWrngTrgtList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("계고일자", xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD"))).style(dateYMD)); - valueMap.put("계고사유", "LEVY_EXCL_RSN_NM"); - valueMap.put("기타내용", "ETC_CN"); - valueMap.put("민원신청번호", xlsx.style("CVLCPT_APLY_NO", center)); - valueMap.put("민원접수번호", xlsx.style("CVLCPT_RCPT_NO", center)); - valueMap.put("민원접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD)); - valueMap.put("민원처리담당자", xlsx.style("CVLCPT_PRCS_PIC_NM", center)); - valueMap.put("민원처리결과", xlsx.style("CVLCPT_PRCS_NM", center)); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("단속법정동", "CRDN_STDG_NM"); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("상세단속장소", "DTL_CRDN_PLC"); - valueMap.put("단속금액", xlsx.style("FFNLG_CRDN_AMT", numeric)); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("납부자생일", xlsx.style("RTPYR_BRDT_MASK", center)); - valueMap.put("우편번호", xlsx.style("ZIP", center)); - valueMap.put("주소", "ADDR"); - valueMap.put("상세주소", "DTL_ADDR"); - valueMap.put("단속특별구역", xlsx.style("CRDN_SPAREA_NM", center)); - valueMap.put("사용연료", xlsx.style("USE_FUEL_NM", center)); - valueMap.put("주차가능여부", xlsx.style("PARKNG_PSBLTY_RSLT_NM", center)); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("계고일자", FormatMaker.yyyy_mm_dd(format, "LEVY_EXCL_YMD").style(dateYMD)); + valueMap.put("계고사유", format.of("LEVY_EXCL_RSN_NM")); + valueMap.put("기타내용", format.of("ETC_CN")); + valueMap.put("민원신청번호", format.of("CVLCPT_APLY_NO").style(center)); + valueMap.put("민원접수번호", format.of("CVLCPT_RCPT_NO").style(center)); + valueMap.put("민원접수일자", FormatMaker.yyyy_mm_dd(format, "CVLCPT_RCPT_YMD").style(dateYMD)); + valueMap.put("민원처리담당자", format.of("CVLCPT_PRCS_PIC_NM").style(center)); + valueMap.put("민원처리결과", format.of("CVLCPT_PRCS_NM").style(center)); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM")); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("상세단속장소", format.of("DTL_CRDN_PLC")); + valueMap.put("단속금액", format.of("FFNLG_CRDN_AMT").style(numeric)); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("납부자생일", format.of("RTPYR_BRDT_MASK").style(center)); + valueMap.put("우편번호", format.of("ZIP").style(center)); + valueMap.put("주소", format.of("ADDR")); + valueMap.put("상세주소", format.of("DTL_ADDR")); + valueMap.put("단속특별구역", format.of("CRDN_SPAREA_NM").style(center)); + valueMap.put("사용연료", format.of("USE_FUEL_NM").style(center)); + valueMap.put("주차가능여부", format.of("PARKNG_PSBLTY_RSLT_NM").style(center)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("계고장 발송 대상", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("계고장 발송 대상").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("계고장발송대상" + "_목록_" + dateTime + ".xlsx")); } } @@ -375,45 +373,39 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("계고장발송현황" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = sndngService.getWrngSndngList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("등록구분", xlsx.style("SNDNG_REG_SE_NM", center)); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("발송일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_YMD"))).style(dateYMD)); - valueMap.put("납기일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_END_YMD"))).style(dateYMD)); - valueMap.put("총건수", xlsx.style("TNOCS", numeric)); - valueMap.put("총금액", xlsx.style("GRAMT", numeric)); - valueMap.put("문서번호", "DOC_NO"); - valueMap.put("제목", "TTL_NM"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("등록구분", format.of("SNDNG_REG_SE_NM").style(center)); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("발송일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_YMD").style(dateYMD)); + valueMap.put("납기일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_END_YMD").style(dateYMD)); + valueMap.put("총건수", format.of("TNOCS").style(numeric)); + valueMap.put("총금액", format.of("GRAMT").style(numeric)); + valueMap.put("문서번호", format.of("DOC_NO")); + valueMap.put("제목", format.of("TTL_NM")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("계고장 발송 현황", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("계고장 발송 현황").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("계고장발송현황" + "_목록_" + dateTime + ".xlsx")); } } @@ -465,54 +457,48 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("계도장발송상세" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = sndngDtlService.getSndngDtlList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("발송상태", xlsx.style("SNDNG_DTL_STTS_NM", center)); - valueMap.put("등기번호", xlsx.style("RG_NO", center)); - valueMap.put("발송일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_YMD"))).style(dateYMD)); - valueMap.put("납기일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_END_YMD"))).style(dateYMD)); - valueMap.put("성명", "RCPN_NM"); - valueMap.put("우편번호", xlsx.style("RCPN_ZIP", center)); - valueMap.put("주소", "RCPN_ADDR"); - valueMap.put("상세주소", "RCPN_DTL_ADDR"); - valueMap.put("배달일자", xlsx.format(o -> xlsx.str2date(o.get("DLVR_YMD"))).style(dateYMD)); - valueMap.put("배달시각", xlsx.style("DLVR_TM", center)); - valueMap.put("미배달사유", "UNDLVR_RSN_NM"); - valueMap.put("수령인", "ACTL_RCPN_NM"); - valueMap.put("수령인관계", "RCPN_REL_NM"); - valueMap.put("단속일시", xlsx.style("CRDN_DT", center)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("단속법정동", "CRDN_STDG_NM"); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("과태료금액", xlsx.style("FFNLG_AMT", numeric)); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("발송상태", format.of("SNDNG_DTL_STTS_NM").style(center)); + valueMap.put("등기번호", format.of("RG_NO").style(center)); + valueMap.put("발송일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_YMD").style(dateYMD)); + valueMap.put("납기일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_END_YMD").style(dateYMD)); + valueMap.put("성명", format.of("RCPN_NM")); + valueMap.put("우편번호", format.of("RCPN_ZIP").style(center)); + valueMap.put("주소", format.of("RCPN_ADDR")); + valueMap.put("상세주소", format.of("RCPN_DTL_ADDR")); + valueMap.put("배달일자", FormatMaker.yyyy_mm_dd(format, "DLVR_YMD").style(dateYMD)); + valueMap.put("배달시각", format.of("DLVR_TM").style(center)); + valueMap.put("미배달사유", format.of("UNDLVR_RSN_NM")); + valueMap.put("수령인", format.of("ACTL_RCPN_NM")); + valueMap.put("수령인관계", format.of("RCPN_REL_NM")); + valueMap.put("단속일시", format.of("CRDN_DT").style(center)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM")); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("과태료금액", format.of("FFNLG_AMT").style(numeric)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("계도장 발송 상세", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("계도장 발송 상세").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("계도장발송상세" + "_목록_" + dateTime + ".xlsx")); } } @@ -569,59 +555,53 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("사전통지발송대상" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = sndngService.getAdvntceTrgtList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("민원신청번호", xlsx.style("CVLCPT_APLY_NO", center)); - valueMap.put("민원접수번호", xlsx.style("CVLCPT_RCPT_NO", center)); - valueMap.put("민원접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD)); - valueMap.put("민원처리담당자", xlsx.style("CVLCPT_PRCS_PIC_NM", center)); - valueMap.put("민원처리결과", xlsx.style("CVLCPT_PRCS_NM", center)); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("단속법정동", "CRDN_STDG_NM"); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("상세단속장소", "DTL_CRDN_PLC"); - valueMap.put("과태료금액", xlsx.style("FFNLG_AMT", numeric)); - valueMap.put("사전통지금액", xlsx.style("ADVNTCE_AMT", numeric)); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("납부자생일", xlsx.style("RTPYR_BRDT_MASK", center)); - valueMap.put("우편번호", xlsx.style("ZIP", center)); - valueMap.put("주소", "ADDR"); - valueMap.put("상세주소", "DTL_ADDR"); - valueMap.put("단속특별구역", xlsx.style("CRDN_SPAREA_NM", center)); - valueMap.put("사용연료", xlsx.style("USE_FUEL_NM", center)); - valueMap.put("주차가능여부", xlsx.style("PARKNG_PSBLTY_RSLT_NM", center)); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("민원신청번호", format.of("CVLCPT_APLY_NO").style(center)); + valueMap.put("민원접수번호", format.of("CVLCPT_RCPT_NO").style(center)); + valueMap.put("민원접수일자", FormatMaker.yyyy_mm_dd(format, "CVLCPT_RCPT_YMD").style(dateYMD)); + valueMap.put("민원처리담당자", format.of("CVLCPT_PRCS_PIC_NM").style(center)); + valueMap.put("민원처리결과", format.of("CVLCPT_PRCS_NM").style(center)); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM")); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("상세단속장소", format.of("DTL_CRDN_PLC")); + valueMap.put("과태료금액", format.of("FFNLG_AMT").style(numeric)); + valueMap.put("사전통지금액", format.of("ADVNTCE_AMT").style(numeric)); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("납부자생일", format.of("RTPYR_BRDT_MASK").style(center)); + valueMap.put("우편번호", format.of("ZIP").style(center)); + valueMap.put("주소", format.of("ADDR")); + valueMap.put("상세주소", format.of("DTL_ADDR")); + valueMap.put("단속특별구역", format.of("CRDN_SPAREA_NM").style(center)); + valueMap.put("사용연료", format.of("USE_FUEL_NM").style(center)); + valueMap.put("주차가능여부", format.of("PARKNG_PSBLTY_RSLT_NM").style(center)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("사전통지 발송 대상", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("사전통지 발송 대상").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("사전통지발송대상" + "_목록_" + dateTime + ".xlsx")); } } @@ -727,45 +707,39 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("사전통지발송현황" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = sndngService.getAdvntceSndngList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("등록구분", xlsx.style("SNDNG_REG_SE_NM", center)); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("발송일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_YMD"))).style(dateYMD)); - valueMap.put("납기일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_END_YMD"))).style(dateYMD)); - valueMap.put("총건수", xlsx.style("TNOCS", numeric)); - valueMap.put("총금액", xlsx.style("GRAMT", numeric)); - valueMap.put("문서번호", "DOC_NO"); - valueMap.put("제목", "TTL_NM"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("등록구분", format.of("SNDNG_REG_SE_NM").style(center)); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("발송일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_YMD").style(dateYMD)); + valueMap.put("납기일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_END_YMD").style(dateYMD)); + valueMap.put("총건수", format.of("TNOCS").style(numeric)); + valueMap.put("총금액", format.of("GRAMT").style(numeric)); + valueMap.put("문서번호", format.of("DOC_NO")); + valueMap.put("제목", format.of("TTL_NM")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("사전통지 발송 현황", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("사전통지 발송 현황").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("사전통지발송현황" + "_목록_" + dateTime + ".xlsx")); } } @@ -817,61 +791,55 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("사전통지발송상세" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = sndngDtlService.getSndngDtlList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("발송상태", xlsx.style("SNDNG_DTL_STTS_NM", center)); - valueMap.put("등기번호", xlsx.style("RG_NO", center)); - valueMap.put("발송일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_YMD"))).style(dateYMD)); - valueMap.put("발송종료일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_END_YMD"))).style(dateYMD)); - valueMap.put("성명", "RCPN_NM"); - valueMap.put("우편번호", xlsx.style("RCPN_ZIP", center)); - valueMap.put("주소", "RCPN_ADDR"); - valueMap.put("상세주소", "RCPN_DTL_ADDR"); - valueMap.put("배달일자", xlsx.format(o -> xlsx.str2date(o.get("DLVR_YMD"))).style(dateYMD)); - valueMap.put("배달시각", xlsx.style("DLVR_TM", center)); - valueMap.put("미배달사유", "UNDLVR_RSN_NM"); - valueMap.put("수령인", "ACTL_RCPN_NM"); - valueMap.put("수령인관계", "RCPN_REL_NM"); - valueMap.put("단속일시", xlsx.style("CRDN_DT", center)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("단속법정동", "CRDN_STDG_NM"); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("회계연도", xlsx.style("FYR", center)); - valueMap.put("부과번호", xlsx.style("LEVY_NO", center)); - valueMap.put("부과일자", xlsx.format(o -> xlsx.str2date(o.get("LEVY_YMD"))).style(dateYMD)); - valueMap.put("납기일자", xlsx.format(o -> xlsx.str2date(o.get("DUDT_YMD"))).style(dateYMD)); - valueMap.put("과태료금액", xlsx.style("FFNLG_AMT", numeric)); - valueMap.put("본세", xlsx.style("PCPTAX", numeric)); - valueMap.put("가산금", xlsx.style("ADAMT", numeric)); - valueMap.put("미납금액", xlsx.style("SUM_AMT", numeric)); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("발송상태", format.of("SNDNG_DTL_STTS_NM").style(center)); + valueMap.put("등기번호", format.of("RG_NO").style(center)); + valueMap.put("발송일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_YMD").style(dateYMD)); + valueMap.put("발송종료일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_END_YMD").style(dateYMD)); + valueMap.put("성명", format.of("RCPN_NM")); + valueMap.put("우편번호", format.of("RCPN_ZIP").style(center)); + valueMap.put("주소", format.of("RCPN_ADDR")); + valueMap.put("상세주소", format.of("RCPN_DTL_ADDR")); + valueMap.put("배달일자", FormatMaker.yyyy_mm_dd(format, "DLVR_YMD").style(dateYMD)); + valueMap.put("배달시각", format.of("DLVR_TM").style(center)); + valueMap.put("미배달사유", format.of("UNDLVR_RSN_NM")); + valueMap.put("수령인", format.of("ACTL_RCPN_NM")); + valueMap.put("수령인관계", format.of("RCPN_REL_NM")); + valueMap.put("단속일시", format.of("CRDN_DT").style(center)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM")); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("회계연도", format.of("FYR").style(center)); + valueMap.put("부과번호", format.of("LEVY_NO").style(center)); + valueMap.put("부과일자", FormatMaker.yyyy_mm_dd(format, "LEVY_YMD").style(dateYMD)); + valueMap.put("납기일자", FormatMaker.yyyy_mm_dd(format, "DUDT_YMD").style(dateYMD)); + valueMap.put("과태료금액", format.of("FFNLG_AMT").style(numeric)); + valueMap.put("본세", format.of("PCPTAX").style(numeric)); + valueMap.put("가산금", format.of("ADAMT").style(numeric)); + valueMap.put("미납금액", format.of("SUM_AMT").style(numeric)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("사전통지 발송 상세", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("사전통지 발송 상세").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("사전통지발송상세" + "_목록_" + dateTime + ".xlsx")); } } @@ -921,45 +889,39 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("고지서발송현황" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = sndngService.getSndngList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("등록구분", xlsx.style("SNDNG_REG_SE_NM", center)); - valueMap.put("위반항목", "VLTN_ARTCL"); - valueMap.put("발송일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_YMD"))).style(dateYMD)); - valueMap.put("납기일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_END_YMD"))).style(dateYMD)); - valueMap.put("총건수", xlsx.style("TNOCS", numeric)); - valueMap.put("총금액", xlsx.style("GRAMT", numeric)); - valueMap.put("문서번호", "DOC_NO"); - valueMap.put("제목", "TTL_NM"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("등록구분", format.of("SNDNG_REG_SE_NM").style(center)); + valueMap.put("위반항목", format.of("VLTN_ARTCL")); + valueMap.put("발송일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_YMD").style(dateYMD)); + valueMap.put("납기일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_END_YMD").style(dateYMD)); + valueMap.put("총건수", format.of("TNOCS").style(numeric)); + valueMap.put("총금액", format.of("GRAMT").style(numeric)); + valueMap.put("문서번호", format.of("DOC_NO")); + valueMap.put("제목", format.of("TTL_NM")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("고지서 발송 현황", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("고지서 발송 현황").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("고지서발송현황" + "_목록_" + dateTime + ".xlsx")); } } @@ -1011,61 +973,55 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("고지서발송상세" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = sndngDtlService.getSndngDtlList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("발송상태", xlsx.style("SNDNG_DTL_STTS_NM", center)); - valueMap.put("등기번호", xlsx.style("RG_NO", center)); - valueMap.put("발송일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_YMD"))).style(dateYMD)); - valueMap.put("발송종료일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_END_YMD"))).style(dateYMD)); - valueMap.put("성명", "RCPN_NM"); - valueMap.put("우편번호", xlsx.style("RCPN_ZIP", center)); - valueMap.put("주소", "RCPN_ADDR"); - valueMap.put("상세주소", "RCPN_DTL_ADDR"); - valueMap.put("배달일자", xlsx.format(o -> xlsx.str2date(o.get("DLVR_YMD"))).style(dateYMD)); - valueMap.put("배달시각", xlsx.style("DLVR_TM", center)); - valueMap.put("미배달사유", "UNDLVR_RSN_NM"); - valueMap.put("수령인", "ACTL_RCPN_NM"); - valueMap.put("수령인관계", "RCPN_REL_NM"); - valueMap.put("단속일시", xlsx.style("CRDN_DT", center)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("단속법정동", "CRDN_STDG_NM"); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("회계연도", xlsx.style("FYR", center)); - valueMap.put("부과번호", xlsx.style("LEVY_NO", center)); - valueMap.put("부과일자", xlsx.format(o -> xlsx.str2date(o.get("LEVY_YMD"))).style(dateYMD)); - valueMap.put("납기일자", xlsx.format(o -> xlsx.str2date(o.get("DUDT_YMD"))).style(dateYMD)); - valueMap.put("과태료금액", xlsx.style("FFNLG_AMT", numeric)); - valueMap.put("본세", xlsx.style("PCPTAX", numeric)); - valueMap.put("가산금", xlsx.style("ADAMT", numeric)); - valueMap.put("미납금액", xlsx.style("SUM_AMT", numeric)); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("발송상태", format.of("SNDNG_DTL_STTS_NM").style(center)); + valueMap.put("등기번호", format.of("RG_NO").style(center)); + valueMap.put("발송일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_YMD").style(dateYMD)); + valueMap.put("발송종료일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_END_YMD").style(dateYMD)); + valueMap.put("성명", format.of("RCPN_NM")); + valueMap.put("우편번호", format.of("RCPN_ZIP").style(center)); + valueMap.put("주소", format.of("RCPN_ADDR")); + valueMap.put("상세주소", format.of("RCPN_DTL_ADDR")); + valueMap.put("배달일자", FormatMaker.yyyy_mm_dd(format, "DLVR_YMD").style(dateYMD)); + valueMap.put("배달시각", format.of("DLVR_TM").style(center)); + valueMap.put("미배달사유", format.of("UNDLVR_RSN_NM")); + valueMap.put("수령인", format.of("ACTL_RCPN_NM")); + valueMap.put("수령인관계", format.of("RCPN_REL_NM")); + valueMap.put("단속일시", format.of("CRDN_DT").style(center)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM")); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("회계연도", format.of("FYR").style(center)); + valueMap.put("부과번호", format.of("LEVY_NO").style(center)); + valueMap.put("부과일자", FormatMaker.yyyy_mm_dd(format, "LEVY_YMD").style(dateYMD)); + valueMap.put("납기일자", FormatMaker.yyyy_mm_dd(format, "DUDT_YMD").style(dateYMD)); + valueMap.put("과태료금액", format.of("FFNLG_AMT").style(numeric)); + valueMap.put("본세", format.of("PCPTAX").style(numeric)); + valueMap.put("가산금", format.of("ADAMT").style(numeric)); + valueMap.put("미납금액", format.of("SUM_AMT").style(numeric)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("고지서 발송 상세", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("고지서 발송 상세").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("고지서발송상세" + "_목록_" + dateTime + ".xlsx")); } } @@ -1176,59 +1132,53 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("반송현황" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = sndngDtlService.getSndbkList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("고지번호", xlsx.style("GOJI_NO", center)); - valueMap.put("등기번호", xlsx.style("RG_NO", center)); - valueMap.put("배달일자", xlsx.format(o -> xlsx.str2date(o.get("DLVR_YMD"))).style(dateYMD)); - valueMap.put("배달시간", "DLVR_TM"); - valueMap.put("미배달사유", "UNDLVR_RSN_NM"); - valueMap.put("수령인", "ACTL_RCPN_NM"); - valueMap.put("수령인관계", "RCPN_REL_NM"); - valueMap.put("발송구분", xlsx.style("SNDNG_SE_NM", center)); - valueMap.put("발송일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_YMD"))).style(dateYMD)); - valueMap.put("과태료금액", xlsx.style("FFNLG_AMT", numeric)); - valueMap.put("성명", "RCPN_NM"); - valueMap.put("우편번호", xlsx.style("RCPN_ZIP", center)); - valueMap.put("주소", "RCPN_ADDR"); - valueMap.put("상세주소", "RCPN_DTL_ADDR"); - valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("납부자구분", xlsx.style("RTPYR_SE_NM", center)); - valueMap.put("납부자번호", xlsx.style("RTPYR_NO", center)); - valueMap.put("납부자명", "RTPYR_NM"); - valueMap.put("단속법정동", xlsx.style("CRDN_STDG_NM", center)); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("처리상태", "CRDN_STTS_NM"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("고지번호", format.of("GOJI_NO").style(center)); + valueMap.put("등기번호", format.of("RG_NO").style(center)); + valueMap.put("배달일자", FormatMaker.yyyy_mm_dd(format, "DLVR_YMD").style(dateYMD)); + valueMap.put("배달시간", format.of("DLVR_TM")); + valueMap.put("미배달사유", format.of("UNDLVR_RSN_NM")); + valueMap.put("수령인", format.of("ACTL_RCPN_NM")); + valueMap.put("수령인관계", format.of("RCPN_REL_NM")); + valueMap.put("발송구분", format.of("SNDNG_SE_NM").style(center)); + valueMap.put("발송일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_YMD").style(dateYMD)); + valueMap.put("과태료금액", format.of("FFNLG_AMT").style(numeric)); + valueMap.put("성명", format.of("RCPN_NM")); + valueMap.put("우편번호", format.of("RCPN_ZIP").style(center)); + valueMap.put("주소", format.of("RCPN_ADDR")); + valueMap.put("상세주소", format.of("RCPN_DTL_ADDR")); + valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center)); + valueMap.put("납부자번호", format.of("RTPYR_NO").style(center)); + valueMap.put("납부자명", format.of("RTPYR_NM")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM").style(center)); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("처리상태", format.of("CRDN_STTS_NM")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("반송현황", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("반송현황").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("반송현황" + "_목록_" + dateTime + ".xlsx")); } } @@ -1411,43 +1361,37 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("공시송달현황" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = svbtcService.getSvbtcList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("업무구분", xlsx.style("TASK_SE_NM", center)); - valueMap.put("발송구분", xlsx.style("SNDNG_SE_NM", center)); - valueMap.put("공시송달일자", xlsx.format(o -> xlsx.str2date(o.get("SVBTC_YMD"))).style(dateYMD)); - valueMap.put("총건수", xlsx.style("TNOCS", numeric)); - valueMap.put("문서번호", "DOC_NO"); - valueMap.put("제목", "TTL_NM"); - valueMap.put("기타내용", "ETC_CN"); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("업무구분", format.of("TASK_SE_NM").style(center)); + valueMap.put("발송구분", format.of("SNDNG_SE_NM").style(center)); + valueMap.put("공시송달일자", FormatMaker.yyyy_mm_dd(format, "SVBTC_YMD").style(dateYMD)); + valueMap.put("총건수", format.of("TNOCS").style(numeric)); + valueMap.put("문서번호", format.of("DOC_NO")); + valueMap.put("제목", format.of("TTL_NM")); + valueMap.put("기타내용", format.of("ETC_CN")); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("공시송달현황", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("공시송달현황").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("공시송달현황" + "_목록_" + dateTime + ".xlsx")); } } @@ -1499,61 +1443,55 @@ public class Sndb01Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("공시송달상세" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,) - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = svbtcService.getSvbtcDtlList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("발송상태", xlsx.style("SNDNG_DTL_STTS_NM", center)); - valueMap.put("공시송달일자", xlsx.format(o -> xlsx.str2date(o.get("SVBTC_YMD"))).style(dateYMD)); - valueMap.put("등기번호", xlsx.style("RG_NO", center)); - valueMap.put("발송일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_YMD"))).style(dateYMD)); - valueMap.put("발송종료일자", xlsx.format(o -> xlsx.str2date(o.get("SNDNG_END_YMD"))).style(dateYMD)); - valueMap.put("성명", "RCPN_NM"); - valueMap.put("우편번호", xlsx.style("RCPN_ZIP", center)); - valueMap.put("주소", "RCPN_ADDR"); - valueMap.put("상세주소", "RCPN_DTL_ADDR"); - valueMap.put("배달일자", xlsx.format(o -> xlsx.str2date(o.get("DLVR_YMD"))).style(dateYMD)); - valueMap.put("배달시각", xlsx.style("DLVR_TM", center)); - valueMap.put("미배달사유", "UNDLVR_RSN_NM"); - valueMap.put("수령인", "ACTL_RCPN_NM"); - valueMap.put("수령인관계", "RCPN_REL_NM"); - valueMap.put("단속일시", xlsx.style("CRDN_DT", center)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("단속법정동", "CRDN_STDG_NM"); - valueMap.put("단속장소", "CRDN_PLC"); - valueMap.put("회계연도", xlsx.style("FYR", center)); - valueMap.put("부과번호", xlsx.style("LEVY_NO", center)); - valueMap.put("부과일자", xlsx.format(o -> xlsx.str2date(o.get("LEVY_YMD"))).style(dateYMD)); - valueMap.put("납기일자", xlsx.format(o -> xlsx.str2date(o.get("DUDT_YMD"))).style(dateYMD)); - valueMap.put("본세", xlsx.style("PCPTAX", numeric)); - valueMap.put("가산금", xlsx.style("ADAMT", numeric)); - valueMap.put("미납금액", xlsx.style("SUM_AMT", numeric)); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("발송상태", format.of("SNDNG_DTL_STTS_NM").style(center)); + valueMap.put("공시송달일자", FormatMaker.yyyy_mm_dd(format, "SVBTC_YMD").style(dateYMD)); + valueMap.put("등기번호", format.of("RG_NO").style(center)); + valueMap.put("발송일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_YMD").style(dateYMD)); + valueMap.put("발송종료일자", FormatMaker.yyyy_mm_dd(format, "SNDNG_END_YMD").style(dateYMD)); + valueMap.put("성명", format.of("RCPN_NM")); + valueMap.put("우편번호", format.of("RCPN_ZIP").style(center)); + valueMap.put("주소", format.of("RCPN_ADDR")); + valueMap.put("상세주소", format.of("RCPN_DTL_ADDR")); + valueMap.put("배달일자", FormatMaker.yyyy_mm_dd(format, "DLVR_YMD").style(dateYMD)); + valueMap.put("배달시각", format.of("DLVR_TM").style(center)); + valueMap.put("미배달사유", format.of("UNDLVR_RSN_NM")); + valueMap.put("수령인", format.of("ACTL_RCPN_NM")); + valueMap.put("수령인관계", format.of("RCPN_REL_NM")); + valueMap.put("단속일시", format.of("CRDN_DT").style(center)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("단속법정동", format.of("CRDN_STDG_NM")); + valueMap.put("단속장소", format.of("CRDN_PLC")); + valueMap.put("회계연도", format.of("FYR").style(center)); + valueMap.put("부과번호", format.of("LEVY_NO").style(center)); + valueMap.put("부과일자", FormatMaker.yyyy_mm_dd(format, "LEVY_YMD").style(dateYMD)); + valueMap.put("납기일자", FormatMaker.yyyy_mm_dd(format, "DUDT_YMD").style(dateYMD)); + valueMap.put("본세", format.of("PCPTAX").style(numeric)); + valueMap.put("가산금", format.of("ADAMT").style(numeric)); + valueMap.put("미납금액", format.of("SUM_AMT").style(numeric)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("공시송달상세", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("공시송달상세").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("공시송달상세" + "_목록_" + dateTime + ".xlsx")); } } diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java index a8e1847b..928b20f8 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -12,6 +12,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @@ -19,13 +20,14 @@ import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.core.type.TypeReference; import cokr.xit.base.code.CommonCode; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.file.etc.OutsourcingFileWriter; import cokr.xit.base.file.pdf.PDFWriter; import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.bean.FileBean; -import cokr.xit.base.file.xls.XLSWriter; -import cokr.xit.base.file.xls.XLSWriter.CellDef; -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; @@ -45,6 +47,8 @@ import cokr.xit.fims.cmmn.pdf.print.format.Nht; import cokr.xit.fims.cmmn.service.bean.OtptStngBean; import cokr.xit.fims.cmmn.service.bean.OutsourcingStngBean; import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.dao.CrdnListMapper; @@ -222,75 +226,70 @@ public class Sprt01Controller extends ApplicationController { listForExcel = list; } - XLSWriter xlsx = new XLSWriter() - .setFilename(fileName+".xlsx") - .worksheet(0); - - CellStyle center = xlsx.cellStyle(Styler.CENTER); - CellStyle numeric = xlsx.n_nn0(); - CellStyle dateYMD = xlsx.yyyy_mm_dd(); - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); Map valueMap = new HashMap(); - valueMap.put("시군구명" , xlsx.style("SGG_NM", center)); - valueMap.put("과태료명" , xlsx.style("TASK_SE_NM", center)); - valueMap.put("단속입력구분" , xlsx.style("CRDN_INPT_SE_NM", center)); - valueMap.put("단속일시" , xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT)); - valueMap.put("신고자명" , xlsx.style("CVLCPT_APLCNT_NM", center)); - valueMap.put("민원접수번호" , xlsx.style("CVLCPT_RCPT_NO", center)); - valueMap.put("민원접수일자" , xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD)); - valueMap.put("민원목록번호" , xlsx.style("CVLCPT_LIST_NO", center)); - valueMap.put("단속차량번호" , "VHRNO"); - valueMap.put("대체차량번호" , "RPM_SZR_VHRNO"); - valueMap.put("사진건수" , xlsx.style("ATCH_FILE_CNT", center)); - valueMap.put("차량확인" , xlsx.style("PARKNG_PSBLTY_RSLT_NM", center)); - valueMap.put("납부자명" , xlsx.style("RTPYR_NM", center)); - valueMap.put("납부자번호" , xlsx.style("RTPYR_NO", center)); - valueMap.put("처리상태" , xlsx.style("CRDN_STTS_NM", center)); - valueMap.put("제외사유" , "LEVY_EXCL_RSN_NM"); - valueMap.put("제외일자" , xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD"))).style(dateYMD)); - valueMap.put("기타사항" , "ETC_CN"); - valueMap.put("고지번호" , xlsx.style("GOJI_NO", center)); - valueMap.put("처리일자" , xlsx.format(o -> xlsx.str2date(o.get("CRDN_STTS_CHG_YMD"))).style(dateYMD)); - valueMap.put("단속장소" , "CRDN_PLC"); - valueMap.put("단속구분" , xlsx.style("CRDN_SE_NM", center)); - valueMap.put("의견진술여부" , xlsx.style("OPNN_SBMSN_YN_NM", center)); - valueMap.put("의견진술기한" , xlsx.format(o -> xlsx.str2date(o.get("ADVNTCE_DUDT_YMD"))).style(dateYMD)); - valueMap.put("견인여부" , xlsx.style("TOWNG_YN_NM", center)); - valueMap.put("압류일자" , xlsx.format(o -> xlsx.str2date(o.get("SZR_YMD"))).style(dateYMD)); - valueMap.put("압류해제일자" , xlsx.format(o -> xlsx.str2date(o.get("SZR_RMV_YMD"))).style(dateYMD)); - valueMap.put("잔액" , xlsx.style("SUM_AMT", numeric)); - valueMap.put("부과금액" , xlsx.style("LEVY_AMT", numeric)); - valueMap.put("본세" , xlsx.style("LEVY_PCPTAX", numeric)); - valueMap.put("가산금" , xlsx.style("LEVY_ADAMT", numeric)); - valueMap.put("납부기한" , xlsx.format(o -> xlsx.str2date(o.get("DUDT_YMD"))).style(dateYMD)); - valueMap.put("납기후일자" , xlsx.format(o -> xlsx.str2date(o.get("DUDT_AFTR_YMD"))).style(dateYMD)); - valueMap.put("납기후금액" , xlsx.style("DUDT_AFTR_AMT", numeric)); - valueMap.put("가상계좌번호" , xlsx.style("VR_ACTNO", center)); - valueMap.put("전자납부번호" , xlsx.style("EPAYNO", center)); - valueMap.put("수납유형" , xlsx.style("PAY_MTHD_SE_NM", center)); - valueMap.put("수납일자" , xlsx.format(o -> xlsx.str2date(o.get("RCVMT_YMD"))).style(dateYMD)); - valueMap.put("수납금액" , xlsx.style("RCVMT_AMT", numeric)); - valueMap.put("수납본세" , xlsx.style("RCVMT_PCPTAX", numeric)); - valueMap.put("수납가산금" , xlsx.style("RCVMT_ADAMT", numeric)); - valueMap.put("단속등록구분" , xlsx.style("CRDN_REG_SE_NM", center)); - valueMap.put("납부자주소" , "RTPYR_FULL_ADDR"); - valueMap.put("거주상태" , xlsx.style("RTPYR_STTS_NM", center)); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("성명", "RTPYR_NM"); - valueMap.put("주소", "RTPYR_ADDR"); - valueMap.put("번지", "RTPYR_DTL_ADDR"); + valueMap.put("시군구명" , format.of("SGG_NM").style(center)); + valueMap.put("과태료명" , format.of("TASK_SE_NM").style(center)); + valueMap.put("단속입력구분" , format.of("CRDN_INPT_SE_NM").style(center)); + valueMap.put("단속일시" , FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT)); + valueMap.put("신고자명" , format.of("CVLCPT_APLCNT_NM").style(center)); + valueMap.put("민원접수번호" , format.of("CVLCPT_RCPT_NO").style(center)); + valueMap.put("민원접수일자" , FormatMaker.yyyy_mm_dd(format, "CVLCPT_RCPT_YMD").style(dateYMD)); + valueMap.put("민원목록번호" , format.of("CVLCPT_LIST_NO").style(center)); + valueMap.put("단속차량번호" , format.of("VHRNO")); + valueMap.put("대체차량번호" , format.of("RPM_SZR_VHRNO")); + valueMap.put("사진건수" , format.of("ATCH_FILE_CNT").style(center)); + valueMap.put("차량확인" , format.of("PARKNG_PSBLTY_RSLT_NM").style(center)); + valueMap.put("납부자명" , format.of("RTPYR_NM").style(center)); + valueMap.put("납부자번호" , format.of("RTPYR_NO").style(center)); + valueMap.put("처리상태" , format.of("CRDN_STTS_NM").style(center)); + valueMap.put("제외사유" , format.of("LEVY_EXCL_RSN_NM")); + valueMap.put("제외일자" , FormatMaker.yyyy_mm_dd(format, "LEVY_EXCL_YMD").style(dateYMD)); + valueMap.put("기타사항" , format.of("ETC_CN")); + valueMap.put("고지번호" , format.of("GOJI_NO").style(center)); + valueMap.put("처리일자" , FormatMaker.yyyy_mm_dd(format, "CRDN_STTS_CHG_YMD").style(dateYMD)); + valueMap.put("단속장소" , format.of("CRDN_PLC")); + valueMap.put("단속구분" , format.of("CRDN_SE_NM").style(center)); + valueMap.put("의견진술여부" , format.of("OPNN_SBMSN_YN_NM").style(center)); + valueMap.put("의견진술기한" , FormatMaker.yyyy_mm_dd(format, "ADVNTCE_DUDT_YMD").style(dateYMD)); + valueMap.put("견인여부" , format.of("TOWNG_YN_NM").style(center)); + valueMap.put("압류일자" , FormatMaker.yyyy_mm_dd(format, "SZR_YMD").style(dateYMD)); + valueMap.put("압류해제일자" , FormatMaker.yyyy_mm_dd(format, "SZR_RMV_YMD").style(dateYMD)); + valueMap.put("잔액" , format.of("SUM_AMT").style(numeric)); + valueMap.put("부과금액" , format.of("LEVY_AMT").style(numeric)); + valueMap.put("본세" , format.of("LEVY_PCPTAX").style(numeric)); + valueMap.put("가산금" , format.of("LEVY_ADAMT").style(numeric)); + valueMap.put("납부기한" , FormatMaker.yyyy_mm_dd(format, "DUDT_YMD").style(dateYMD)); + valueMap.put("납기후일자" , FormatMaker.yyyy_mm_dd(format, "DUDT_AFTR_YMD").style(dateYMD)); + valueMap.put("납기후금액" , format.of("DUDT_AFTR_AMT").style(numeric)); + valueMap.put("가상계좌번호" , format.of("VR_ACTNO").style(center)); + valueMap.put("전자납부번호" , format.of("EPAYNO").style(center)); + valueMap.put("수납유형" , format.of("PAY_MTHD_SE_NM").style(center)); + valueMap.put("수납일자" , FormatMaker.yyyy_mm_dd(format, "RCVMT_YMD").style(dateYMD)); + valueMap.put("수납금액" , format.of("RCVMT_AMT").style(numeric)); + valueMap.put("수납본세" , format.of("RCVMT_PCPTAX").style(numeric)); + valueMap.put("수납가산금" , format.of("RCVMT_ADAMT").style(numeric)); + valueMap.put("단속등록구분" , format.of("CRDN_REG_SE_NM").style(center)); + valueMap.put("납부자주소" , format.of("RTPYR_FULL_ADDR")); + valueMap.put("거주상태" , format.of("RTPYR_STTS_NM").style(center)); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("성명", format.of("RTPYR_NM")); + valueMap.put("주소", format.of("RTPYR_ADDR")); + valueMap.put("번지", format.of("RTPYR_DTL_ADDR")); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value(fileName, center) - .merge(0, cellDefs.size()-1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(listForExcel, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView").addObject("xls", xlsx) + xlsx.cell(0, 0).value(fileName).value(center).merge(0, cellDefs.size()-1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(listForExcel, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView").addObject("download", xlsx.getDownloadable().setFilename(fileName+".xlsx")) .addObject("downloadData", listForExcel).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList()); } diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt04Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt04Controller.java index 2345ce3f..2033bc20 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt04Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt04Controller.java @@ -8,18 +8,22 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; 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.CellDef; -import cokr.xit.base.file.xls.XLSWriter.Styler; +import cokr.xit.base.docs.xls.CellDef; +import cokr.xit.base.docs.xls.Format; +import cokr.xit.base.docs.xls.Style; +import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.cmmn.xls.FormatMaker; +import cokr.xit.fims.cmmn.xls.StyleMaker; import cokr.xit.fims.sprt.CvlcptDscsn; import cokr.xit.fims.sprt.CvlcptDscsnQuery; import cokr.xit.fims.sprt.service.CvlcptDscsnService; @@ -109,43 +113,38 @@ public class Sprt04Controller extends ApplicationController { List cellDefs = fromJson(req.getCellDefs(), CellDef.listType()); - XLSWriter xlsx = new XLSWriter() - .setFilename("민원상담" + "_목록_" + dateTime + ".xlsx") - .worksheet(0); - - // CellStyle 지정은 여기에서.. - CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬 - CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일 - CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 + XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size())); + Format format = new Format(xlsx); + CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER)); + CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT)); + CellStyle numeric = format.n_nn0(); + CellStyle dateYMD = format.yyyy_mm_dd(); + CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); List list = cvlcptDscsnService.getCvlcptDscsnList(req.setFetchSize(0)); Map valueMap = new HashMap(); - valueMap.put("민원접수구분", xlsx.style("CVLCPT_RCPT_SE_NM", center)); - valueMap.put("상담일자", xlsx.format(o -> xlsx.str2date(o.get("DSCSN_YMD"))).style(dateYMD)); - valueMap.put("요일", xlsx.style("WEEK_NM", center)); - valueMap.put("성명", xlsx.style("CVLPR_NM", center)); - valueMap.put("연락처", xlsx.style("CVLPR_CTTPC", center)); - valueMap.put("상담내용", "DSCSN_CN"); - valueMap.put("차량번호", "VHRNO"); - valueMap.put("납부자번호", xlsx.style("RTPYR_NO", center)); - valueMap.put("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT)); - valueMap.put("등록사용자", xlsx.style("RGTR_NM", center)); - valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT)); - valueMap.put("수정사용자", xlsx.style("MDFR_NM", center)); + valueMap.put("민원접수구분", format.of("CVLCPT_RCPT_SE_NM").style(center)); + valueMap.put("상담일자", FormatMaker.yyyy_mm_dd(format, "DSCSN_YMD").style(dateYMD)); + valueMap.put("요일", format.of("WEEK_NM").style(center)); + valueMap.put("성명", format.of("CVLPR_NM").style(center)); + valueMap.put("연락처", format.of("CVLPR_CTTPC").style(center)); + valueMap.put("상담내용", format.of("DSCSN_CN")); + valueMap.put("차량번호", format.of("VHRNO")); + valueMap.put("납부자번호", format.of("RTPYR_NO").style(center)); + valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT)); + valueMap.put("등록사용자", format.of("RGTR_NM").style(center)); + valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT)); + valueMap.put("수정사용자", format.of("MDFR_NM").style(center)); CellDef.setValues(cellDefs, valueMap); - xlsx.cell(0, 0) - .value("민원상담", center) - .merge(0, cellDefs.size() - 1) - .cell(3, 0) - .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx))) - .cell(4, 0) - .values(list, CellDef.values(cellDefs)); - - return new ModelAndView("xlsView") - .addObject("xls", xlsx); + xlsx.cell(0, 0).value("민원상담").value(center).merge(0, cellDefs.size() - 1) + .cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))) + .cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); + xlsx.autoWidth(); + return new ModelAndView("downloadView") + .addObject("download", xlsx.getDownloadable().setFilename("민원상담" + "_목록_" + dateTime + ".xlsx")); } }