단속관리 엑셀저장 수정

main
이범준 11 months ago
parent 82f4f58b6d
commit 2e1c62e960

@ -1,7 +1,9 @@
package cokr.xit.fims.crdn.web;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import javax.annotation.Resource;
@ -10,9 +12,11 @@ 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.user.dao.UserMapper;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
@ -85,41 +89,70 @@ public class Crdn06Controller extends ApplicationController {
if("xls".equals(query.getDownload())) {
XLSWriter xlsx = new XLSWriter()
.setTemplate("template/xls/excl-list-tmpl.xlsx")
.setFilename("단속자료 목록.xlsx")
.worksheet(0);
/*
CellStyle header = xlsx.cellStyle(new XLSWriter.Styler()
.width(20)
.foregroundColor(HSSFColor.HSSFColorPredefined.LIGHT_BLUE.getIndex())
.configure(styler -> {
Font font = xlsx.workbook().createFont();
font.setColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex());
styler.font(font);
})
); */
.setFilename("단속자료 목록.xlsx")
.worksheet(0);
CellStyle numeric = xlsx.n_nn0();
xlsx
/*
.cell(0, 0)
.value("단속자료 목록", XLSWriter.Styler.CENTER)
.merge(0, 15)
.cell(3, 0)
.rowValues(List.of(
"업무구분", header, "부과제외일자", header, "부과제외구분", header, "부과제외사유", header, "기타내용", header,
"민원신청번호", header, "민원접수번호", header, "민원접수일자", header, "단속일시", header, "차량번호", header,
"법정동", header, "단속장소", header, "과태료금액", header, "처리상태", header, "납부자명", header, "납부자생일", header
)) */
.cell(4, 0)
.values(
crdnService.getCrackdownList(query.setFetchSize(0)),
"TASK_SE_NM", xlsx.format(r -> xlsx.str2date(r.get("LEVY_EXCL_YMD"))), "LEVY_EXCL_SE_NM", "LEVY_EXCL_RSN_NM", "ETC_CN",
"CVLCPT_APLY_NO", "CVLCPT_RCPT_NO", xlsx.format(r -> xlsx.str2date(r.get("CVLCPT_RCPT_YMD"))), xlsx.format(r -> xlsx.str2date(r.get("CRDN_YMD")) + " " + xlsx.str2time(r.get("CRDN_TM"))),
"VHRNO", "CRDN_STDG_NM", "CRDN_PLC", xlsx.style("FFNLG_AMT", numeric), "CRDN_STTS_NM", "RTPYR_NM", xlsx.format(r -> xlsx.str2date(r.get("RTPYR_BRDT")))
);
String[] excelTitle = query.getExcelTitle();
List<String> titles = new ArrayList<String>();
for(int i = 0; i < excelTitle.length; i++) {
String item = excelTitle[i];
titles.add(item);
}
int[] excelTitleWidth = query.getExcelTitleWidth();
List<Integer> widths = new ArrayList<>();
for(int i = 0; i < excelTitleWidth.length; i++) {
int item = excelTitleWidth[i];
widths.add(item);
}
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
xlsx.cell(0, 0)
.value("단속자료 목록", XLSWriter.Styler.CENTER)
.merge(0, 15)
.cell(3, 0)
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
List<DataObject> list = crdnService.getCrackdownList(query.setFetchSize(0));
BiFunction<String, String, ?> getValue = (title1, noting) -> {
switch(title1) {
case "자료출처":
return "CRDN_INPT_SE_NM";
case "차량번호":
return "VHRNO";
case "위반일시":
return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM")));
case "단속장소":
return "CRDN_PLC";
case "체납액":
return "";
case "사진건수":
return "ATCH_FILE_CNT";
case "스티커번호":
return "CRDN_SN";
case "장애차량확인":
return "PARKNG_PSBLTY_RSLT_NM";
case "처리상태":
return "CRDN_STTS_NM";
case "제외사유":
return "LEVY_EXCL_RSN_NM";
case "제외처리일자":
return "LEVY_EXCL_YMD";
case "제외내역":
return "LEVY_EXCL_ETC_CN";
}
return "";
};
xlsx.cell(4, 0)
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
return new ModelAndView("xlsView").addObject("xls", xlsx);
}

Loading…
Cancel
Save