표지정보 미확인자료 엑셀다운 추가

main
이범준 11 months ago
parent e291bca1d5
commit 3ae19995f7

@ -1,21 +1,28 @@
package cokr.xit.fims.crdn.web; package cokr.xit.fims.crdn.web;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.BiFunction;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.CommonCode; 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.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;
import cokr.xit.fims.cmmn.CmmnUtil;
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.GlobalStngMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.crdn.service.CrdnService; import cokr.xit.fims.crdn.service.CrdnService;
import cokr.xit.fims.crdn.service.CrdnStngService; import cokr.xit.fims.crdn.service.CrdnStngService;
import cokr.xit.foundation.data.DataObject;
/** .<br /> /** .<br />
* { }/crdn/crdn03 . * { }/crdn/crdn03 .
@ -72,6 +79,55 @@ public class Crdn03Controller extends ApplicationController {
String sggCd = globalStngMapper.selectSggCd(curDeptCode); String sggCd = globalStngMapper.selectSggCd(curDeptCode);
query.setSggCd(sggCd); 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),""); return setCollectionInfo(new ModelAndView("jsonView"), crdnService.getCrackdownList(query),"");
} }

@ -391,6 +391,7 @@ SELECT C.CRDN_ID <!-- 단속 ID -->
, C.SGG_CD <!-- 시군구 코드 --> , C.SGG_CD <!-- 시군구 코드 -->
, C.TASK_SE_CD <!-- 업무 구분 코드 --> , C.TASK_SE_CD <!-- 업무 구분 코드 -->
, C.CRDN_INPT_SE_CD <!-- 단속 입력 구분 코드 --> , C.CRDN_INPT_SE_CD <!-- 단속 입력 구분 코드 -->
, (SELECT GET_CODE_NM('FIM003', C.CRDN_INPT_SE_CD) FROM DUAL) AS CRDN_INPT_SE_NM
, CONCAT(C.CRDN_YMD,'',C.CRDN_TM) AS CRDN_YMD_TM <!-- 단속 일시 --> , CONCAT(C.CRDN_YMD,'',C.CRDN_TM) AS CRDN_YMD_TM <!-- 단속 일시 -->
, C.VHRNO <!-- 차량번호 --> , C.VHRNO <!-- 차량번호 -->
, C.CRDN_STDG_NM <!-- 단속 법정동 명 --> , C.CRDN_STDG_NM <!-- 단속 법정동 명 -->

@ -300,6 +300,18 @@ $(document).ready(function(){
**************************************************************************/ **************************************************************************/
$('#btnReset--${pageName}').on('click', () => $P.fnReset()); $('#btnReset--${pageName}').on('click', () => $P.fnReset());
$('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList()); $('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList());
$('#btnExcel--${pageName}').on('click', function(){
if($P.crdnControl.dataset.empty){
alert("조회된 자료가 없습니다.");
return;
}
var headerInfo = $("#crdnTheadTr--${pageName} th").not(".dummy-th").not(":eq(0)").getHeaderInfo();
$P.crdnControl.query.excelTitle = headerInfo.excelTitle;
$P.crdnControl.query.excelTitleWidth = headerInfo.excelTitleWidth;
$P.crdnControl.download();
});
fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollCrdnList); fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollCrdnList);

Loading…
Cancel
Save