|
|
|
@ -1,21 +1,28 @@
|
|
|
|
|
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.Crdn;
|
|
|
|
|
import cokr.xit.fims.crdn.CrdnQuery;
|
|
|
|
|
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
|
|
|
|
|
import cokr.xit.fims.crdn.service.CrdnService;
|
|
|
|
|
import cokr.xit.fims.crdn.service.CrdnStngService;
|
|
|
|
|
import cokr.xit.foundation.data.DataObject;
|
|
|
|
|
|
|
|
|
|
/**표지정보확인 서비스 웹 컨트롤러.<br />
|
|
|
|
|
* {웹 컨텍스트}/crdn/crdn03 로 접근할 수 있다.
|
|
|
|
@ -72,6 +79,55 @@ public class Crdn03Controller 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 = crdnService.getCrackdownList(query.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
BiFunction<String, String, ?> getValue = (titleNm, noting) -> {
|
|
|
|
|
switch(titleNm) {
|
|
|
|
|
case "자료출처": return "CRDN_INPT_SE_NM";
|
|
|
|
|
case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM")));
|
|
|
|
|
case "차량번호": return "VHRNO";
|
|
|
|
|
case "법정동": return "CRDN_STDG_NM";
|
|
|
|
|
case "잔액": return xlsx.style("BLNC", numeric);
|
|
|
|
|
case "사진건수": return "ATCH_FILE_CNT";
|
|
|
|
|
case "발행번호": return "CRDN_SN";
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xlsx.cell(4, 0)
|
|
|
|
|
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("xlsView").addObject("xls", xlsx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), crdnService.getCrackdownList(query),"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|