|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
package cokr.xit.fims.excl.web;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.function.BiFunction;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
@ -12,8 +14,10 @@ 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.Styler;
|
|
|
|
|
import cokr.xit.base.user.ManagedUser;
|
|
|
|
|
import cokr.xit.base.web.ApplicationController;
|
|
|
|
|
import cokr.xit.fims.cmmn.CmmnUtil;
|
|
|
|
|
import cokr.xit.fims.excl.LevyExcl;
|
|
|
|
|
import cokr.xit.fims.excl.LevyExclQuery;
|
|
|
|
|
import cokr.xit.fims.excl.service.LevyExclService;
|
|
|
|
@ -91,38 +95,71 @@ public class Excl01Controller extends ApplicationController {
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), result, "levyExcl");
|
|
|
|
|
} else {
|
|
|
|
|
XLSWriter xlsx = new XLSWriter()
|
|
|
|
|
.setFilename("부과제외 목록.xlsx")
|
|
|
|
|
.worksheet(0);
|
|
|
|
|
|
|
|
|
|
XLSWriter.Styler header = new XLSWriter.Styler()
|
|
|
|
|
.width(20)
|
|
|
|
|
.foregroundColor(HSSFColor.HSSFColorPredefined.LIGHT_BLUE.getIndex())
|
|
|
|
|
.configure(styler -> {
|
|
|
|
|
Font font = xlsx.workbook().createFont();
|
|
|
|
|
font.setColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex());
|
|
|
|
|
styler.font(font);
|
|
|
|
|
});
|
|
|
|
|
CellStyle numeric = xlsx.n_nn0();
|
|
|
|
|
.setFilename("부과제외 목록.xlsx")
|
|
|
|
|
.worksheet(0);
|
|
|
|
|
|
|
|
|
|
CellStyle center = xlsx.cellStyle(Styler.CENTER) // 가운데 정렬
|
|
|
|
|
, numeric = xlsx.n_nn0() // 숫자 3자리 콤마(,)
|
|
|
|
|
, dateYMD = xlsx.yyyy_mm_dd() // 연월일
|
|
|
|
|
, dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간
|
|
|
|
|
|
|
|
|
|
String[] excelTitle = req.getExcelTitle();
|
|
|
|
|
List<String> titles = new ArrayList<String>();
|
|
|
|
|
for (int iLoop = 0; iLoop < excelTitle.length; iLoop++) {
|
|
|
|
|
String item = excelTitle[iLoop];
|
|
|
|
|
titles.add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int[] excelTitleWidth = req.getExcelTitleWidth();
|
|
|
|
|
List<Integer> widths = new ArrayList<>();
|
|
|
|
|
for (int jLoop = 0; jLoop < excelTitleWidth.length; jLoop++) {
|
|
|
|
|
int item = excelTitleWidth[jLoop];
|
|
|
|
|
widths.add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
|
|
|
|
|
|
|
|
|
|
xlsx.cell(0, 0)
|
|
|
|
|
.value("부과제외 목록", XLSWriter.Styler.CENTER)
|
|
|
|
|
.merge(0, 15)
|
|
|
|
|
.value("부과제외", XLSWriter.Styler.CENTER)
|
|
|
|
|
.merge(0, 11)
|
|
|
|
|
.cell(3, 0)
|
|
|
|
|
.rowValues(List.of(
|
|
|
|
|
"업무구분", header, "부과제외일자", header, "부과제외구분", header, "부과제외사유", header, "기타내용", header,
|
|
|
|
|
"민원신청번호", header, "민원접수번호", header, "민원접수일자", header, "단속일시", header, "차량번호", header,
|
|
|
|
|
"법정동", header, "단속장소", header, "과태료금액", header, "처리상태", header, "납부자명", header, "납부자생일", header
|
|
|
|
|
))
|
|
|
|
|
.cell(4, 0)
|
|
|
|
|
.values(
|
|
|
|
|
levyExclService.getLevyExclList(req.setFetchSize(0)),
|
|
|
|
|
"TASK_SE_NM", xlsx.format(r -> xlsx.str2date(r.get("LEVY_EXCL_YMD"))), "LEVY_EXCL_SE_NM", "LEVY_EXCL_RSN_NM", "ETC_CN",
|
|
|
|
|
"CVLCPT_APLY_NO", "CVLCPT_RCPT_NO", xlsx.format(r -> xlsx.str2date(r.get("CVLCPT_RCPT_YMD"))), xlsx.format(r -> xlsx.str2date(r.get("CRDN_YMD")) + " " + xlsx.str2time(r.get("CRDN_TM"))),
|
|
|
|
|
"VHRNO", "CRDN_STDG_NM", "CRDN_PLC", xlsx.style("FFNLG_AMT", numeric), "CRDN_STTS_NM", "RTPYR_NM", xlsx.format(r -> xlsx.str2date(r.get("RTPYR_BRDT")))
|
|
|
|
|
);
|
|
|
|
|
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
|
|
|
|
|
|
|
|
|
|
List<DataObject> list = levyExclService.getLevyExclList(req.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
BiFunction<String, String, ?> getValue = (titleNm, nothing) -> {
|
|
|
|
|
switch (titleNm) {
|
|
|
|
|
case "업무구분" : return xlsx.style("TASK_SE_NM", center);
|
|
|
|
|
case "부과제외일자" : return xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD"))).style(dateYMD);
|
|
|
|
|
case "부과제외구분" : return xlsx.style("LEVY_EXCL_SE_NM", center);
|
|
|
|
|
case "부과제외사유" : return xlsx.style("LEVY_EXCL_RSN_NM", center);
|
|
|
|
|
case "기타내용" : return "ETC_CN";
|
|
|
|
|
case "민원신청번호" : return xlsx.style("CVLCPT_APLY_NO", center);
|
|
|
|
|
case "민원접수번호" : return xlsx.style("CVLCPT_RCPT_NO", center);
|
|
|
|
|
case "민원접수일자" : return xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD);
|
|
|
|
|
case "단속일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT);
|
|
|
|
|
case "차량번호" : return "VHRNO";
|
|
|
|
|
case "단속법정동" : return "CRDN_STDG_NM";
|
|
|
|
|
case "단속장소" : return "CRDN_PLC";
|
|
|
|
|
case "위반항목" : return "VLTN_ARTCL";
|
|
|
|
|
case "최초단속금액" : return xlsx.style("FFNLG_CRDN_AMT", numeric);
|
|
|
|
|
case "처리상태" : return "CRDN_STTS_NM";
|
|
|
|
|
case "납부자명" : return "RTPYR_NM";
|
|
|
|
|
case "납부자생일" : return xlsx.style("RTPYR_BRDT_MASK", center);
|
|
|
|
|
case "등록일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT);
|
|
|
|
|
case "등록사용자" : return xlsx.style("RGTR_NM", center);
|
|
|
|
|
case "수정일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT);
|
|
|
|
|
case "수정사용자" : return xlsx.style("MDFR_NM", center);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xlsx.cell(4, 0)
|
|
|
|
|
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("xlsView")
|
|
|
|
|
.addObject("xls", xlsx);
|
|
|
|
|
.addObject("xls", xlsx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -259,3 +296,43 @@ public class Excl01Controller extends ApplicationController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 엑셀 저장 샘플
|
|
|
|
|
if (!"xls".equals(req.getDownload())) {
|
|
|
|
|
List<?> result = levyExclService.getLevyExclList(setFetchSize(req));
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), result, "levyExcl");
|
|
|
|
|
} else {
|
|
|
|
|
XLSWriter xlsx = new XLSWriter()
|
|
|
|
|
.setFilename("부과제외 목록.xlsx")
|
|
|
|
|
.worksheet(0);
|
|
|
|
|
|
|
|
|
|
XLSWriter.Styler header = new XLSWriter.Styler()
|
|
|
|
|
.width(20)
|
|
|
|
|
.foregroundColor(HSSFColor.HSSFColorPredefined.LIGHT_BLUE.getIndex())
|
|
|
|
|
.configure(styler -> {
|
|
|
|
|
Font font = xlsx.workbook().createFont();
|
|
|
|
|
font.setColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex());
|
|
|
|
|
styler.font(font);
|
|
|
|
|
});
|
|
|
|
|
CellStyle numeric = xlsx.n_nn0();
|
|
|
|
|
|
|
|
|
|
xlsx.cell(0, 0)
|
|
|
|
|
.value("부과제외 목록", XLSWriter.Styler.CENTER)
|
|
|
|
|
.merge(0, 15)
|
|
|
|
|
.cell(3, 0)
|
|
|
|
|
.rowValues(List.of(
|
|
|
|
|
"업무구분", header, "부과제외일자", header, "부과제외구분", header, "부과제외사유", header, "기타내용", header,
|
|
|
|
|
"민원신청번호", header, "민원접수번호", header, "민원접수일자", header, "단속일시", header, "차량번호", header,
|
|
|
|
|
"법정동", header, "단속장소", header, "과태료금액", header, "처리상태", header, "납부자명", header, "납부자생일", header
|
|
|
|
|
))
|
|
|
|
|
.cell(4, 0)
|
|
|
|
|
.values(
|
|
|
|
|
levyExclService.getLevyExclList(req.setFetchSize(0)),
|
|
|
|
|
"TASK_SE_NM", xlsx.format(r -> xlsx.str2date(r.get("LEVY_EXCL_YMD"))), "LEVY_EXCL_SE_NM", "LEVY_EXCL_RSN_NM", "ETC_CN",
|
|
|
|
|
"CVLCPT_APLY_NO", "CVLCPT_RCPT_NO", xlsx.format(r -> xlsx.str2date(r.get("CVLCPT_RCPT_YMD"))), xlsx.format(r -> xlsx.str2date(r.get("CRDN_YMD")) + " " + xlsx.str2time(r.get("CRDN_TM"))),
|
|
|
|
|
"VHRNO", "CRDN_STDG_NM", "CRDN_PLC", xlsx.style("FFNLG_AMT", numeric), "CRDN_STTS_NM", "RTPYR_NM", xlsx.format(r -> xlsx.str2date(r.get("RTPYR_BRDT")))
|
|
|
|
|
);
|
|
|
|
|
return new ModelAndView("xlsView")
|
|
|
|
|
.addObject("xls", xlsx);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|