|
|
|
@ -1,16 +1,22 @@
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
|
|
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.CrdnQuery;
|
|
|
|
|
import cokr.xit.fims.crdn.ExmptnVhcl;
|
|
|
|
|
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
|
|
|
|
@ -71,6 +77,60 @@ public class Crdn08Controller extends ApplicationController {
|
|
|
|
|
String sggCd = globalStngMapper.selectSggCd(curDeptCode);
|
|
|
|
|
query.setSggCd(sggCd);
|
|
|
|
|
|
|
|
|
|
if("xls".equals(query.getDownload())) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XLSWriter xlsx = new XLSWriter()
|
|
|
|
|
.setFilename("면제차량 목록.xlsx")
|
|
|
|
|
.worksheet(0);
|
|
|
|
|
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
|
|
|
|
|
CellStyle numeric = xlsx.n_nn0();
|
|
|
|
|
|
|
|
|
|
xlsx.cell(0, 0)
|
|
|
|
|
.value("면제차량 목록", XLSWriter.Styler.CENTER)
|
|
|
|
|
.merge(0, titles.size()-1)
|
|
|
|
|
.cell(3, 0)
|
|
|
|
|
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
|
|
|
|
|
|
|
|
|
|
List<DataObject> list = crdnStngService.getExemptionVehicleList(query.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
BiFunction<String, String, ?> getValue = (titleNm, noting) -> {
|
|
|
|
|
switch(titleNm) {
|
|
|
|
|
case "차량번호": return "VHRNO";
|
|
|
|
|
case "사유": return "EXMPTN_RSN";
|
|
|
|
|
case "공문번호": return "DOC_NO";
|
|
|
|
|
case "소유주명": return "OWNR_NM";
|
|
|
|
|
case "면제시작일" : return xlsx.format(o -> xlsx.str2date(o.get("EXMPTN_BGNG_YMD")));
|
|
|
|
|
case "면제종료일": return xlsx.format(o -> xlsx.str2date(o.get("EXMPTN_END_YMD")));
|
|
|
|
|
case "입력자": return "RGTR_NM";
|
|
|
|
|
case "입력일시": return xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT")));
|
|
|
|
|
case "수정자": return "MDFR_NM";
|
|
|
|
|
case "수정일시": return xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT")));
|
|
|
|
|
case "삭제자": return "DLTR_NM";
|
|
|
|
|
case "삭제사유": return "DEL_RSN";
|
|
|
|
|
case "삭제일시": return xlsx.format(o -> xlsx.str2datetime(o.get("DEL_DT")));
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xlsx.cell(4, 0)
|
|
|
|
|
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("xlsView").addObject("xls", xlsx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setFetchSize(query);
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), crdnStngService.getExemptionVehicleList(query),"");
|
|
|
|
|
}
|
|
|
|
|