|
|
|
|
@ -5,6 +5,7 @@ import java.util.Arrays;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
@ -122,7 +123,8 @@ public class Crdn06Controller extends ApplicationController {
|
|
|
|
|
|
|
|
|
|
if ("xls".equals(query.getDownload())) {
|
|
|
|
|
List<CellDef> cellDefs = fromJson(query.getCellDefs(), CellDef.listType());
|
|
|
|
|
if("Y".equals(query.getIncludePhoto())) {
|
|
|
|
|
boolean includePhoto = "Y".equals(query.getIncludePhoto());
|
|
|
|
|
if (includePhoto) {
|
|
|
|
|
cellDefs.add((new CellDef()).setLabel("사진1").setWidth(18).setField("CRDN_PHOTO_PATH1"));
|
|
|
|
|
cellDefs.add((new CellDef()).setLabel("사진2").setWidth(18).setField("CRDN_PHOTO_PATH2"));
|
|
|
|
|
}
|
|
|
|
|
@ -138,44 +140,60 @@ public class Crdn06Controller extends ApplicationController {
|
|
|
|
|
|
|
|
|
|
Map<String,Object> valueMap = new HashMap<String,Object>();
|
|
|
|
|
for (CellDef def : cellDefs) {
|
|
|
|
|
switch(def.getLabel()) {
|
|
|
|
|
case "자료출처"->{ valueMap.put("자료출처", format.of("CRDN_INPT_SE_NM").style(center)); }
|
|
|
|
|
case "차량번호"->{ valueMap.put("차량번호", left); }
|
|
|
|
|
case "위반일시"->{ valueMap.put("위반일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format,"CRDN_YMD_TM").style(dateDT)); }
|
|
|
|
|
case "단속장소"->{ valueMap.put("단속장소", left); }
|
|
|
|
|
case "사진건수"->{ valueMap.put("사진건수", center); }
|
|
|
|
|
case "스티커번호"->{ valueMap.put("스티커번호", left); }
|
|
|
|
|
case "장애차량확인"->{ valueMap.put("장애차량확인", format.of("PRK_PSBLTY_RSLT_NM").style(center)); }
|
|
|
|
|
case "처리상태"->{ valueMap.put("처리상태", format.of("CRDN_STTS_NM").style(center)); }
|
|
|
|
|
case "제외사유"->{ valueMap.put("제외사유", format.of("LEVY_EXCL_RSN_NM").style(center)); }
|
|
|
|
|
case "제외처리일자"->{ valueMap.put("제외처리일자", FormatMaker.yyyy_mm_dd(format,"LEVY_EXCL_YMD").style(dateYMD)); }
|
|
|
|
|
case "제외내역"->{ valueMap.put("제외내역", left); }
|
|
|
|
|
case "사진1"->{ valueMap.put("사진1", FormatMaker.photoCellForApproval(format, comment, "CRDN_PHOTO_PATH1")); }
|
|
|
|
|
case "사진2"->{ valueMap.put("사진2", FormatMaker.photoCellForApproval(format, comment, "CRDN_PHOTO_PATH2")); }
|
|
|
|
|
}
|
|
|
|
|
String label = def.getLabel();
|
|
|
|
|
Object obj = switch (label) {
|
|
|
|
|
case "자료출처" -> format.of("CRDN_INPT_SE_NM").style(center);
|
|
|
|
|
case "차량번호" -> left;
|
|
|
|
|
case "위반일시" -> FormatMaker.yyyy_mm_dd_hh_mm_ss(format,"CRDN_YMD_TM").style(dateDT);
|
|
|
|
|
case "단속장소" -> left;
|
|
|
|
|
case "사진건수" -> center;
|
|
|
|
|
case "스티커번호" -> left;
|
|
|
|
|
case "장애차량확인" -> format.of("PRK_PSBLTY_RSLT_NM").style(center);
|
|
|
|
|
case "상태" -> format.of("CRDN_STTS_NM").style(center);
|
|
|
|
|
case "제외사유" -> format.of("LEVY_EXCL_RSN_NM").style(center);
|
|
|
|
|
case "제외처리일자" -> FormatMaker.yyyy_mm_dd(format,"LEVY_EXCL_YMD").style(dateYMD);
|
|
|
|
|
case "제외내역" -> left;
|
|
|
|
|
case "사진1" -> FormatMaker.photoCellForApproval(format, comment, "CRDN_PHOTO_PATH1");
|
|
|
|
|
case "사진2" -> FormatMaker.photoCellForApproval(format, comment, "CRDN_PHOTO_PATH2");
|
|
|
|
|
default -> null;
|
|
|
|
|
};
|
|
|
|
|
if (obj != null)
|
|
|
|
|
valueMap.put(label, obj);
|
|
|
|
|
}
|
|
|
|
|
CellDef.setValues(cellDefs, valueMap);
|
|
|
|
|
|
|
|
|
|
List<DataObject> list = crdnService.getCrackdownList(query.setFetchSize(0));
|
|
|
|
|
if(ifEmpty(query.getIncludePhoto(), () -> "").equals("Y")) {
|
|
|
|
|
for(DataObject crdn : list) {
|
|
|
|
|
String crdnId = crdn.string("CRDN_ID");
|
|
|
|
|
FileQuery fileQuery = new FileQuery();
|
|
|
|
|
fileQuery.setInfoType(Crdn.INF_TYPE);
|
|
|
|
|
fileQuery.setInfoKeys(crdnId);
|
|
|
|
|
List<DataObject> fileInfoList = fileBean.getFileList(fileQuery);
|
|
|
|
|
if (includePhoto) {
|
|
|
|
|
Map<Object, List<FileInfo>> fileInfoMap = fileBean.getFilesOf(
|
|
|
|
|
Crdn.INF_TYPE,
|
|
|
|
|
list.stream().map(info -> info.string("CRDN_ID")).toList().toArray(new String[list.size()])
|
|
|
|
|
).stream().collect(
|
|
|
|
|
Collectors.groupingBy(info -> info.getInfoKey())
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if(fileInfoList != null && fileInfoList.size() > 0) {
|
|
|
|
|
for (DataObject crdn : list) {
|
|
|
|
|
List<FileInfo> fileInfoList = fileInfoMap.get(crdn.get("CRDN_ID"));
|
|
|
|
|
for (int j = 0; (j < fileInfoList.size()) && (j < 2); j++) {
|
|
|
|
|
crdn.set("CRDN_PHOTO_PATH"+(j+1), fileInfoList.get(j).string("FILE_PATH"));
|
|
|
|
|
}
|
|
|
|
|
crdn.set("CRDN_PHOTO_PATH"+(j+1), fileInfoList.get(j).getPath());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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.cell(0, 0).value("단속자료 목록").value(center).merge(0, cellDefs.size()-1)
|
|
|
|
|
.cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx)))
|
|
|
|
|
.cell(4, 0).values(
|
|
|
|
|
list,
|
|
|
|
|
CellDef.values(
|
|
|
|
|
cellDefs.stream()
|
|
|
|
|
.map(def -> {
|
|
|
|
|
if (def.getValue() instanceof Format) {
|
|
|
|
|
def.setField(null);
|
|
|
|
|
};
|
|
|
|
|
return def;
|
|
|
|
|
})
|
|
|
|
|
.toList()
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("downloadView")
|
|
|
|
|
.addObject("download", xlsx.getDownloadable().setFilename("단속자료 목록.xlsx"))
|
|
|
|
|
|