단속자료검사 엑셀다운 추가

main
이범준 11 months ago
parent 480ee20330
commit e291bca1d5

@ -1,16 +1,22 @@
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.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.dao.CrdnInfoMapper; import cokr.xit.fims.crdn.dao.CrdnInfoMapper;
import cokr.xit.fims.crdn.dao.GlobalStngMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper;
@ -87,6 +93,66 @@ public class Crdn02Controller 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 xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM")));
case "자료출처": return "CRDN_INPT_SE_NM";
case "차량번호": return "VHRNO";
case "처리상태": return "CRDN_STTS_NM";
case "단속장소": return "CRDN_PLC";
case "사진매수": return "ATCH_FILE_CNT";
case "위반건수": return "CRDN_CNT";
case "단속건수": return "CRDN_CNT";
case "검사결과": return "INSP_RSLT";
case "처리방법": return "PRCS_MTHD";
case "위반동": return "CRDN_STDG_NM";
case "단속동": return "CRDN_STDG_NM";
case "원금액": return xlsx.style("FFNLG_CRDN_AMT", numeric);
case "감경금액": return "";
case "금액": return xlsx.style("FFNLG_CRDN_AMT", numeric);
case "단속조": return "TEAM_NM";
case "성명": return "RTPYR_NM";
case "주민번호": return "RTPYR_NO";
}
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),"");
} }

@ -88,12 +88,6 @@ public class Crdn06Controller extends ApplicationController {
query.setSggCd(sggCd); query.setSggCd(sggCd);
if("xls".equals(query.getDownload())) { if("xls".equals(query.getDownload())) {
XLSWriter xlsx = new XLSWriter()
.setFilename("단속자료 목록.xlsx")
.worksheet(0);
CellStyle numeric = xlsx.n_nn0();
String[] excelTitle = query.getExcelTitle(); String[] excelTitle = query.getExcelTitle();
List<String> titles = new ArrayList<String>(); List<String> titles = new ArrayList<String>();
for(int i = 0; i < excelTitle.length; i++) { for(int i = 0; i < excelTitle.length; i++) {
@ -108,49 +102,38 @@ public class Crdn06Controller extends ApplicationController {
widths.add(item); widths.add(item);
} }
XLSWriter xlsx = new XLSWriter()
.setFilename("단속자료 목록.xlsx")
.worksheet(0);
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx); List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
CellStyle numeric = xlsx.n_nn0();
xlsx.cell(0, 0) xlsx.cell(0, 0)
.value("단속자료 목록", XLSWriter.Styler.CENTER) .value("단속자료 목록", XLSWriter.Styler.CENTER)
.merge(0, 15) .merge(0, titles.size()-1)
.cell(3, 0) .cell(3, 0)
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers)); .rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
List<DataObject> list = crdnService.getCrackdownList(query.setFetchSize(0)); List<DataObject> list = crdnService.getCrackdownList(query.setFetchSize(0));
BiFunction<String, String, ?> getValue = (titleNm, noting) -> {
BiFunction<String, String, ?> getValue = (title1, noting) -> { switch(titleNm) {
switch(title1) { case "자료출처": return "CRDN_INPT_SE_NM";
case "자료출처": case "차량번호": return "VHRNO";
return "CRDN_INPT_SE_NM"; case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM")));
case "차량번호": case "단속장소": return "CRDN_PLC";
return "VHRNO"; case "체납액": return "";
case "위반일시": case "사진건수": return "ATCH_FILE_CNT";
return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))); case "스티커번호": return "CRDN_SN";
case "단속장소": case "장애차량확인": return "PARKNG_PSBLTY_RSLT_NM";
return "CRDN_PLC"; case "처리상태": return "CRDN_STTS_NM";
case "체납액": case "제외사유": return "LEVY_EXCL_RSN_NM";
return ""; case "제외처리일자": return xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD")));
case "사진건수": case "제외내역": return "LEVY_EXCL_ETC_CN";
return "ATCH_FILE_CNT";
case "스티커번호":
return "CRDN_SN";
case "장애차량확인":
return "PARKNG_PSBLTY_RSLT_NM";
case "처리상태":
return "CRDN_STTS_NM";
case "제외사유":
return "LEVY_EXCL_RSN_NM";
case "제외처리일자":
return "LEVY_EXCL_YMD";
case "제외내역":
return "LEVY_EXCL_ETC_CN";
} }
return ""; return "";
}; };
xlsx.cell(4, 0) xlsx.cell(4, 0)
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray()); .values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());

@ -13,6 +13,7 @@ SELECT C.CRDN_ID <!-- 단속 ID -->
, (SELECT GET_CODE_NM('FIM054', C.TASK_SE_CD) FROM DUAL) AS TASK_SE_NM , (SELECT GET_CODE_NM('FIM054', C.TASK_SE_CD) FROM DUAL) AS TASK_SE_NM
, C.CRDN_REG_SE_CD <!-- 단속 등록 구분 코드 --> , C.CRDN_REG_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
, C.LINK_TBL_NM <!-- 연계 테이블 명 --> , C.LINK_TBL_NM <!-- 연계 테이블 명 -->
, C.LINK_ID <!-- 연계 ID --> , C.LINK_ID <!-- 연계 ID -->
, C.RTPYR_ID <!-- 납부자 ID --> , C.RTPYR_ID <!-- 납부자 ID -->
@ -68,6 +69,7 @@ SELECT C.CRDN_ID <!-- 단속 ID -->
, CA.USE_FUEL_CD <!-- 사용 연료 코드 --> , CA.USE_FUEL_CD <!-- 사용 연료 코드 -->
, CA.FFNLG_CARMDL_CD <!-- 과태료 차종 코드 --> , CA.FFNLG_CARMDL_CD <!-- 과태료 차종 코드 -->
, CA.PARKNG_PSBLTY_RSLT_CD<!-- 주차 가능 결과 코드 --> , CA.PARKNG_PSBLTY_RSLT_CD<!-- 주차 가능 결과 코드 -->
, (SELECT GET_CODE_NM('FIM034', CA.PARKNG_PSBLTY_RSLT_CD) FROM DUAL) AS PARKNG_PSBLTY_RSLT_NM
, CA.VLTN_NMTM <!-- 위반 횟수 --> , CA.VLTN_NMTM <!-- 위반 횟수 -->
, CA.OVTIME_YN <!-- 시간외 여부 --> , CA.OVTIME_YN <!-- 시간외 여부 -->
, CC.CVLCPT_LINK_ID <!-- 민원 연계 ID --> , CC.CVLCPT_LINK_ID <!-- 민원 연계 ID -->
@ -88,6 +90,7 @@ SELECT C.CRDN_ID <!-- 단속 ID -->
, CC.CVLCPT_TRSM_DT <!-- 민원 전송 일시 --> , CC.CVLCPT_TRSM_DT <!-- 민원 전송 일시 -->
, CC.CVLCPT_TRSM_CD <!-- 민원 전송 코드 --> , CC.CVLCPT_TRSM_CD <!-- 민원 전송 코드 -->
, LE.LEVY_EXCL_RSN_CD <!-- 부과 제외 사유 코드 --> , LE.LEVY_EXCL_RSN_CD <!-- 부과 제외 사유 코드 -->
, (SELECT GET_CODE_NM('FIM022', LE.LEVY_EXCL_RSN_CD) FROM DUAL) AS LEVY_EXCL_RSN_NM
, LE.LEVY_EXCL_YMD <!-- 부과 제외 일자 --> , LE.LEVY_EXCL_YMD <!-- 부과 제외 일자 -->
, LE.ETC_CN AS LEVY_EXCL_ETC_CN <!-- 부과 제외 기타 내용 --> , LE.ETC_CN AS LEVY_EXCL_ETC_CN <!-- 부과 제외 기타 내용 -->
, P.RTPYR_NM <!-- 납부자명 --> , P.RTPYR_NM <!-- 납부자명 -->
@ -212,9 +215,11 @@ SELECT C.CRDN_ID <!-- 단속 ID -->
, C.CRDN_PLC , C.CRDN_PLC
, C.ATCH_FILE_CNT <!-- 사진건수 --> , C.ATCH_FILE_CNT <!-- 사진건수 -->
, C.CRDN_STTS_CD <!-- 단속 상태 코드 --> , C.CRDN_STTS_CD <!-- 단속 상태 코드 -->
, (SELECT GET_CODE_NM('FIM010', C.CRDN_STTS_CD) FROM DUAL) AS CRDN_STTS_NM
, C.FFNLG_CRDN_AMT <!-- 원금액 --> , C.FFNLG_CRDN_AMT <!-- 원금액 -->
<!-- 감경금액 --> <!-- 감경금액 -->
, 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 <!-- 자료출처 -->
FROM TB_CRDN C FROM TB_CRDN C
INNER JOIN TB_CRDN_ADI CA ON (C.CRDN_ID = CA.CRDN_ID) INNER JOIN TB_CRDN_ADI CA ON (C.CRDN_ID = CA.CRDN_ID)
WHERE C.DEL_YN = 'N' WHERE C.DEL_YN = 'N'
@ -358,11 +363,13 @@ SELECT C.CRDN_ID <!-- 단속 ID -->
, C.TASK_SE_CD <!-- 업무 구분 코드 --> , C.TASK_SE_CD <!-- 업무 구분 코드 -->
, CONCAT(C.CRDN_YMD,'',C.CRDN_TM) AS CRDN_YMD_TM <!-- 단속일시 --> , CONCAT(C.CRDN_YMD,'',C.CRDN_TM) AS CRDN_YMD_TM <!-- 단속일시 -->
, 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
, T.TEAM_NM <!-- 단속조 --> , T.TEAM_NM <!-- 단속조 -->
, C.VHRNO <!-- 차량번호 --> , C.VHRNO <!-- 차량번호 -->
, C.CRDN_STDG_NM <!-- 단속 법정동 명 --> , C.CRDN_STDG_NM <!-- 단속 법정동 명 -->
, C.CRDN_PLC <!-- 단속장소 --> , C.CRDN_PLC <!-- 단속장소 -->
, C.CRDN_STTS_CD <!-- 처리상태 --> , C.CRDN_STTS_CD <!-- 처리상태 -->
, (SELECT GET_CODE_NM('FIM010', C.CRDN_STTS_CD) FROM DUAL) AS CRDN_STTS_NM
, C.FFNLG_CRDN_AMT <!-- 금액 --> , C.FFNLG_CRDN_AMT <!-- 금액 -->
, P.RTPYR_NM <!-- 성명 --> , P.RTPYR_NM <!-- 성명 -->
, P.RTPYR_NO <!-- 주민번호 --> , P.RTPYR_NO <!-- 주민번호 -->

@ -188,7 +188,7 @@
data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}"> data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}">
<th style="width: 80px;">No.</th> <th style="width: 80px;">No.</th>
<th onclick="searchFromGridTitle('CRDN_YMD','단속일자','ymd','');" <th onclick="searchFromGridTitle('CRDN_YMD','단속일자','ymd','');"
style="width: 160px;">단속일시</th> style="width: 180px;">단속일시</th>
<th onclick="searchFromGridTitle('VHRNO',this.innerText,'match','part');" <th onclick="searchFromGridTitle('VHRNO',this.innerText,'match','part');"
style="width: 120px;">차량번호</th> style="width: 120px;">차량번호</th>
<th style="width: 100px;" class="text-orange">위반건수</th> <th style="width: 100px;" class="text-orange">위반건수</th>
@ -207,7 +207,7 @@
<th onclick="searchFromGridTitle('UNKNOWN',this.innerText,'match','perfect');" <th onclick="searchFromGridTitle('UNKNOWN',this.innerText,'match','perfect');"
style="width: 100px;">감경금액</th> style="width: 100px;">감경금액</th>
<th onclick="searchFromGridTitle('CRDN_INPT_SE_CD',this.innerText,'codeValue','FIM003');" <th onclick="searchFromGridTitle('CRDN_INPT_SE_CD',this.innerText,'codeValue','FIM003');"
style="width: 100px;">자료출처</th> style="width: 120px;">자료출처</th>
<th class="dummy-th"></th> <th class="dummy-th"></th>
</tr> </tr>
</thead> </thead>
@ -329,9 +329,9 @@
<th onclick="searchFromGridTitle('RTPYR_NM',this.innerText,'match','part');" <th onclick="searchFromGridTitle('RTPYR_NM',this.innerText,'match','part');"
style="width:120px">성명</th> style="width:120px">성명</th>
<th class="privacy" <th class="privacy"
style="width:160px">주민번호(전체)</th> style="width:160px">주민번호</th>
<th class="privacy-mask" <th class="privacy-mask"
style="width:160px">주민번호(마스크)</th> style="width:160px">주민번호</th>
<th class="dummy-th"></th> <th class="dummy-th"></th>
</tr> </tr>
</thead> </thead>
@ -589,11 +589,11 @@ $(document).ready(function(){
$P.fnResetAndChangeBiz = (taskSeCd) => { $P.fnResetAndChangeBiz = (taskSeCd) => {
$P.fnReset(); $P.fnReset();
$P.photoInspectionControl.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do?inspectionDataType=photo"); $P.photoInspectionControl.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do");
$P.photoInspectionControl.urls.getInfo = ""; $P.photoInspectionControl.urls.getInfo = "";
$P.sameVehicleControl.main.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do?inspectionDataType=sameVehicleMain"); $P.sameVehicleControl.main.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do");
$P.sameVehicleControl.main.urls.getInfo = ""; $P.sameVehicleControl.main.urls.getInfo = "";
$P.sameVehicleControl.sub.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do?inspectionDataType=sameVehicleSub"); $P.sameVehicleControl.sub.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn02/020/list.do");
$P.sameVehicleControl.sub.urls.getInfo = ""; $P.sameVehicleControl.sub.urls.getInfo = "";
var clsForTask = taskSeCd.toLowerCase(); var clsForTask = taskSeCd.toLowerCase();
@ -637,17 +637,21 @@ $(document).ready(function(){
switch ($P.currentDisplay) { switch ($P.currentDisplay) {
case "photoInspection": case "photoInspection":
$P.photoInspectionControl.query = $P.getParams(); $P.photoInspectionControl.query = $P.getParams();
$P.photoInspectionControl.query.inspectionDataType = "photo";
$P.photoInspectionControl.load(1); $P.photoInspectionControl.load(1);
break; break;
case "sameVehicleInspection": case "sameVehicleInspection":
$P.sameVehicleControl.main.query = $P.getParams(); $P.sameVehicleControl.main.query = $P.getParams();
$P.sameVehicleControl.main.query.inspectionDataType = "sameVehicleMain";
$P.sameVehicleControl.main.load(1); $P.sameVehicleControl.main.load(1);
break; break;
default: break; default: break;
} }
} }
$P.searchDetailInspectionDataList = (dataKey) => { $P.searchDetailInspectionDataList = (dataKey) => {
$P.sameVehicleControl.sub.query = { "crdnIDs" : dataKey.split(",") }; $P.sameVehicleControl.sub.query = {};
$P.sameVehicleControl.sub.query.inspectionDataType = "sameVehicleSub";
$P.sameVehicleControl.sub.query.crdnIDs = dataKey;
$P.sameVehicleControl.sub.query.taskSeCd = $P.sameVehicleControl.main.query.taskSeCd; $P.sameVehicleControl.sub.query.taskSeCd = $P.sameVehicleControl.main.query.taskSeCd;
$P.sameVehicleControl.sub.load(0); $P.sameVehicleControl.sub.load(0);
} }
@ -959,6 +963,44 @@ $(document).ready(function(){
}); });
$('#btnSearch--${pageName}').on('click', () => $P.searchInspectionList()); //검색버튼 $('#btnSearch--${pageName}').on('click', () => $P.searchInspectionList()); //검색버튼
$('#btnExcel--${pageName}').on('click', function(){
if($P.currentDisplay == "photoInspection"){
if($P.photoInspectionControl.dataset.empty){
alert("조회된 자료가 없습니다.");
return;
}
var headerInfo = $("#photoInspection_Table_0--${pageName} thead th").not(".dummy-th").not(":eq(0)").getHeaderInfo();
$P.photoInspectionControl.query.excelTitle = headerInfo.excelTitle;
$P.photoInspectionControl.query.excelTitleWidth = headerInfo.excelTitleWidth;
$P.photoInspectionControl.download();
} else {
if($P.sameVehicleControl.main.dataset.empty){
alert("조회된 자료가 없습니다.");
return;
}
if(confirm("단속건수 엑셀저장은 확인버튼, 상세내역 엑셀저장시 취소버튼을 누르세요.")){
var headerInfo = $("#sameVehicleInspectionMain_Table_0--${pageName} thead th").not(".dummy-th").getHeaderInfo();
$P.sameVehicleControl.main.query.excelTitle = headerInfo.excelTitle;
$P.sameVehicleControl.main.query.excelTitleWidth = headerInfo.excelTitleWidth;
$P.sameVehicleControl.main.download();
} else {
var headerInfo = $("#sameVehicleInspectionSub_Table_0--${pageName} thead th").not(".dummy-th").getHeaderInfo();
$P.sameVehicleControl.sub.query.excelTitle = headerInfo.excelTitle;
$P.sameVehicleControl.sub.query.excelTitleWidth = headerInfo.excelTitleWidth;
$P.sameVehicleControl.sub.download();
}
}
});
$("#btnInstLevyExcl--${pageName}").on("click", () => $P.openLevyExclPop("1")); $("#btnInstLevyExcl--${pageName}").on("click", () => $P.openLevyExclPop("1"));
//스크롤 테이블 //스크롤 테이블

@ -476,19 +476,9 @@ $(document).ready(function(){
return; return;
} }
var excelTitle = []; var headerInfo = $("#crdnThead--${pageName} th").not(".dummy-th").not(":eq(0)").getHeaderInfo();
var excelTitleWidth = []; $P.crdnControl.query.excelTitle = headerInfo.excelTitle;
$("#crdnThead--${pageName} th").not(".dummy-th").not(":eq(0)").each(function(){ $P.crdnControl.query.excelTitleWidth = headerInfo.excelTitleWidth;
var title = $(this).text();
excelTitle.push(title);
var titleWidth = $(this).outerWidth();
titleWidth = Math.ceil(titleWidth/10);
excelTitleWidth.push(titleWidth);
});
$P.crdnControl.query.excelTitle = excelTitle.join(",");
$P.crdnControl.query.excelTitleWidth = excelTitleWidth.join(",");
//return;
$P.crdnControl.download(); $P.crdnControl.download();
}); });

@ -144,4 +144,23 @@ class FimsFormFields extends FormFields {
}); });
return obj; return obj;
} }
} }
$.fn.getHeaderInfo = function() {
var excelTitle = [];
var excelTitleWidth = [];
this.each(function(){
var title = $(this).text();
excelTitle.push(title);
var titleWidth = $(this).outerWidth();
titleWidth = Math.ceil(titleWidth/10);
excelTitleWidth.push(titleWidth);
});
return {
excelTitle : excelTitle.join(","),
excelTitleWidth : excelTitleWidth.join(",")
};
};
Loading…
Cancel
Save