no message

main
이범준 7 months ago
parent 1d1f0b9438
commit dcceb0818f

@ -61,16 +61,6 @@ public class FormatMaker {
}).style(dateYMD); }).style(dateYMD);
} }
public static Format key(Format format, CellStyle style, String key) {
return format.of(key).value(o -> {
return ((Map) o).get(key);
}).style(style);
}
public static Format key(Format format, String key) {
return format.of(key).value(o -> {
return ((Map) o).get(key);
});
}
} }

@ -131,15 +131,15 @@ public class Crdn06Controller extends ApplicationController {
CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss(); CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss();
Map<String,Object> valueMap = new HashMap<String,Object>(); Map<String,Object> valueMap = new HashMap<String,Object>();
valueMap.put("자료출처", FormatMaker.key(format, center, "CRDN_INPT_SE_NM")); valueMap.put("자료출처", format.of("CRDN_INPT_SE_NM").style(center));
valueMap.put("차량번호", left); valueMap.put("차량번호", left);
valueMap.put("위반일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,dateDT,"CRDN_YMD_TM")); valueMap.put("위반일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,dateDT,"CRDN_YMD_TM"));
valueMap.put("단속장소", left); valueMap.put("단속장소", left);
valueMap.put("사진건수", center); valueMap.put("사진건수", center);
valueMap.put("스티커번호", left); valueMap.put("스티커번호", left);
valueMap.put("장애차량확인", FormatMaker.key(format, center, "PARKNG_PSBLTY_RSLT_NM")); valueMap.put("장애차량확인", format.of("PARKNG_PSBLTY_RSLT_NM").style(center));
valueMap.put("처리상태", FormatMaker.key(format, center, "CRDN_STTS_NM")); valueMap.put("처리상태", format.of("CRDN_STTS_NM").style(center));
valueMap.put("제외사유", FormatMaker.key(format, center, "LEVY_EXCL_RSN_NM")); valueMap.put("제외사유", format.of("LEVY_EXCL_RSN_NM").style(center));
valueMap.put("제외처리일자", FormatMaker.yyyy_mm_dd(format,dateYMD,"LEVY_EXCL_YMD")); valueMap.put("제외처리일자", FormatMaker.yyyy_mm_dd(format,dateYMD,"LEVY_EXCL_YMD"));
valueMap.put("제외내역", left); valueMap.put("제외내역", left);
if(ifEmpty(query.getIncludePhoto(), () -> "").equals("Y")) { if(ifEmpty(query.getIncludePhoto(), () -> "").equals("Y")) {

@ -10,6 +10,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
@ -17,11 +18,12 @@ import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode; 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.service.FileQuery; import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean; 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.ManagedUser;
import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.web.ApplicationController; import cokr.xit.base.web.ApplicationController;
@ -30,6 +32,8 @@ import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.format.CvlcptOrgn; import cokr.xit.fims.cmmn.hwp.format.CvlcptOrgn;
import cokr.xit.fims.cmmn.service.bean.StngBean; 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.Crdn;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.dao.CrdnStngMapper; import cokr.xit.fims.crdn.dao.CrdnStngMapper;
@ -125,49 +129,42 @@ public class Cvlc01Controller extends ApplicationController {
query.setSggCd(sggCd); query.setSggCd(sggCd);
if("xls".equals(query.getDownload())) { if("xls".equals(query.getDownload())) {
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
XLSWriter xlsx = new XLSWriter() ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
.setFilename("민원접수자료 목록.xlsx")
.worksheet(0);
CellStyle center = xlsx.cellStyle(Styler.CENTER); XLSWriter xlsx = new XLSWriter().worksheet(0).trackWidth(CmmnUtil.intArray(cellDefs.size()));
CellStyle dateYMD = xlsx.yyyy_mm_dd(); Format format = new Format(xlsx);
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); CellStyle center = format.cellStyle(new Style().alignment(HorizontalAlignment.CENTER));
CellStyle left = format.cellStyle(new Style().alignment(HorizontalAlignment.LEFT));
List<DataObject> list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0)); CellStyle dateYMD = format.yyyy_mm_dd();
CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss();
Map<String, Object> valueMap = new HashMap<String, Object>(); Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("접수번호", xlsx.style("CVLCPT_RCPT_NO", center)); valueMap.put("접수번호", center);
valueMap.put("목록번호", xlsx.style("CVLCPT_LIST_NO", center)); valueMap.put("목록번호", center);
valueMap.put("등록구분", xlsx.style("CRDN_REG_SE_NM", center)); valueMap.put("등록구분", format.of("CRDN_REG_SE_NM").style(center));
valueMap.put("신고자", xlsx.style("CVLCPT_APLCNT_NM", center)); valueMap.put("신고자", center);
valueMap.put("담당자", xlsx.style("CVLCPT_PRCS_PIC_NM", center)); valueMap.put("담당자", center);
valueMap.put("담당자전화번호", xlsx.style("CVLCPT_PRCS_PIC_TELNO", center)); valueMap.put("담당자전화번호", center);
valueMap.put("접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD)); valueMap.put("접수일자", FormatMaker.yyyy_mm_dd(format,dateYMD,"CVLCPT_RCPT_YMD"));
valueMap.put("처리기한", xlsx.format(o -> { valueMap.put("처리기한", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,dateDT,"CVLCPT_PRCS_PRNMNT_DT"));
if(o.get("CVLCPT_PRCS_PRNMNT_DT") != null && ((String)o.get("CVLCPT_PRCS_PRNMNT_DT")).length() > 8) { valueMap.put("위반일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,dateDT,"CRDN_YMD_TM"));
return xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT")); valueMap.put("위반내용", center);
} else { valueMap.put("차량번호", left);
return xlsx.str2date(o.get("CVLCPT_PRCS_PRNMNT_DT")); valueMap.put("사진건수", center);
}
}).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));
CellDef.setValues(cellDefs, valueMap); CellDef.setValues(cellDefs, valueMap);
xlsx.cell(0, 0) List<DataObject> list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(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);
.addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList()); 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"));
mav.addObject("downloadData", list);
mav.addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList());
return mav;
} }
return setCollectionInfo(new ModelAndView("jsonView"), crdnCvlcptService.getCivilComplaintList(query),"",""); return setCollectionInfo(new ModelAndView("jsonView"), crdnCvlcptService.getCivilComplaintList(query),"","");

Loading…
Cancel
Save