|
|
|
@ -10,6 +10,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;
|
|
|
|
@ -17,11 +18,12 @@ 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.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;
|
|
|
|
@ -30,6 +32,8 @@ import cokr.xit.fims.cmmn.Print;
|
|
|
|
|
import cokr.xit.fims.cmmn.PrintOption;
|
|
|
|
|
import cokr.xit.fims.cmmn.hwp.format.CvlcptOrgn;
|
|
|
|
|
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.CrdnStngMapper;
|
|
|
|
@ -125,49 +129,42 @@ public class Cvlc01Controller extends ApplicationController {
|
|
|
|
|
query.setSggCd(sggCd);
|
|
|
|
|
|
|
|
|
|
if("xls".equals(query.getDownload())) {
|
|
|
|
|
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
|
|
|
|
|
|
|
|
|
|
XLSWriter xlsx = new XLSWriter()
|
|
|
|
|
.setFilename("민원접수자료 목록.xlsx")
|
|
|
|
|
.worksheet(0);
|
|
|
|
|
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
|
|
|
|
|
|
|
|
|
|
CellStyle center = xlsx.cellStyle(Styler.CENTER);
|
|
|
|
|
CellStyle dateYMD = xlsx.yyyy_mm_dd();
|
|
|
|
|
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss();
|
|
|
|
|
|
|
|
|
|
List<DataObject> list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0));
|
|
|
|
|
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 dateYMD = format.yyyy_mm_dd();
|
|
|
|
|
CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> valueMap = new HashMap<String, Object>();
|
|
|
|
|
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("접수번호", center);
|
|
|
|
|
valueMap.put("목록번호", center);
|
|
|
|
|
valueMap.put("등록구분", format.of("CRDN_REG_SE_NM").style(center));
|
|
|
|
|
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("위반내용", center);
|
|
|
|
|
valueMap.put("차량번호", left);
|
|
|
|
|
valueMap.put("사진건수", 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));
|
|
|
|
|
List<DataObject> list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
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"));
|
|
|
|
|
mav.addObject("downloadData", list);
|
|
|
|
|
mav.addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList());
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), crdnCvlcptService.getCivilComplaintList(query),"","");
|
|
|
|
|