엑셀저장 수정

main
이범준 11 months ago
parent f61ad60c84
commit 1e2031bbd3

@ -1,17 +1,20 @@
package cokr.xit.fims.crdn.web;
import java.util.ArrayList;
import java.util.HashMap;
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 com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CellDef;
import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
@ -95,63 +98,47 @@ public class Crdn02Controller extends ApplicationController {
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);
}
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
XLSWriter xlsx = new XLSWriter()
.setFilename("검사자료 목록.xlsx")
.worksheet(0);
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
CellStyle center = xlsx.cellStyle(Styler.CENTER);
CellStyle numeric = xlsx.n_nn0();
CellStyle dateYMD = xlsx.yyyy_mm_dd();
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss();
xlsx.cell(0, 0)
.value("검사자료 목록", 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, nothing) -> {
switch(titleNm) {
case "단속일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT);
case "자료출처": return xlsx.style("CRDN_INPT_SE_NM", center);
case "차량번호": return "VHRNO";
case "처리상태": return xlsx.style("CRDN_STTS_NM", center);
case "단속장소": return "CRDN_PLC";
case "사진매수": return xlsx.style("ATCH_FILE_CNT", center);
case "위반건수": return xlsx.style("CRDN_CNT", center);
case "단속건수": return xlsx.style("CRDN_CNT", center);
case "검사결과": return "INSP_RSLT";
case "처리방법": return xlsx.style("PRCS_MTHD", center);
case "위반동": return xlsx.style("CRDN_STDG_NM", center);
case "단속동": return xlsx.style("CRDN_STDG_NM", center);
case "원금액": return xlsx.style("FFNLG_CRDN_AMT", numeric);
case "감경금액": return xlsx.style("ADVNTCE_AMT", numeric);
case "금액": return xlsx.style("FFNLG_CRDN_AMT", numeric);
case "단속조": return xlsx.style("TEAM_NM", center);
case "성명": return "RTPYR_NM";
case "주민번호": return xlsx.style("RTPYR_NO", center);
}
return "";
};
Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT));
valueMap.put("자료출처", xlsx.style("CRDN_INPT_SE_NM", center));
valueMap.put("차량번호", "VHRNO");
valueMap.put("처리상태", xlsx.style("CRDN_STTS_NM", center));
valueMap.put("단속장소", "CRDN_PLC");
valueMap.put("사진매수", xlsx.style("ATCH_FILE_CNT", center));
valueMap.put("위반건수", xlsx.style("CRDN_CNT", center));
valueMap.put("단속건수", xlsx.style("CRDN_CNT", center));
valueMap.put("검사결과", "INSP_RSLT");
valueMap.put("처리방법", xlsx.style("PRCS_MTHD", center));
valueMap.put("위반동", xlsx.style("CRDN_STDG_NM", center));
valueMap.put("단속동", xlsx.style("CRDN_STDG_NM", center));
valueMap.put("원금액", xlsx.style("FFNLG_CRDN_AMT", numeric));
valueMap.put("감경금액", xlsx.style("ADVNTCE_AMT", numeric));
valueMap.put("금액", xlsx.style("FFNLG_CRDN_AMT", numeric));
valueMap.put("단속조", xlsx.style("TEAM_NM", center));
valueMap.put("성명", "RTPYR_NM");
valueMap.put("주민번호", xlsx.style("RTPYR_NO", center));
CellDef.setValues(cellDefs, valueMap);
xlsx.cell(4, 0)
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
xlsx.cell(0, 0)
.value("검사자료 목록", center)
.merge(0, cellDefs.size()-1)
.cell(3, 0)
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
.cell(4, 0)
.values(list, CellDef.values(cellDefs));
return new ModelAndView("xlsView").addObject("xls", xlsx);
}

@ -1,17 +1,20 @@
package cokr.xit.fims.crdn.web;
import java.util.ArrayList;
import java.util.HashMap;
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 com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CellDef;
import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
@ -81,52 +84,36 @@ public class Crdn03Controller extends ApplicationController {
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);
}
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
XLSWriter xlsx = new XLSWriter()
.setFilename("표지정보미확인자료 목록.xlsx")
.worksheet(0);
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
CellStyle center = xlsx.cellStyle(Styler.CENTER);
CellStyle numeric = xlsx.n_nn0();
CellStyle dateYMD = xlsx.yyyy_mm_dd();
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss();
xlsx.cell(0, 0)
.value("표지정보미확인자료 목록", 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, nothing) -> {
switch(titleNm) {
case "자료출처": return xlsx.style("CRDN_INPT_SE_NM", center);
case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT);
case "차량번호": return "VHRNO";
case "법정동": return xlsx.style("CRDN_STDG_NM", center);
case "잔액": return xlsx.style("BLNC", numeric);
case "사진건수": return xlsx.style("ATCH_FILE_CNT", center);
case "발행번호": return "CRDN_SN";
}
return "";
};
Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("자료출처", xlsx.style("CRDN_INPT_SE_NM", center));
valueMap.put("위반일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT));
valueMap.put("차량번호", "VHRNO");
valueMap.put("법정동", xlsx.style("CRDN_STDG_NM", center));
valueMap.put("잔액", xlsx.style("BLNC", numeric));
valueMap.put("사진건수", xlsx.style("ATCH_FILE_CNT", center));
valueMap.put("발행번호", "CRDN_SN");
CellDef.setValues(cellDefs, valueMap);
xlsx.cell(4, 0)
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
xlsx.cell(0, 0)
.value("표지정보미확인자료 목록", center)
.merge(0, cellDefs.size()-1)
.cell(3, 0)
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
.cell(4, 0)
.values(list, CellDef.values(cellDefs));
return new ModelAndView("xlsView").addObject("xls", xlsx);
}

@ -1,17 +1,20 @@
package cokr.xit.fims.crdn.web;
import java.util.ArrayList;
import java.util.HashMap;
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 com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CellDef;
import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
@ -78,58 +81,42 @@ public class Crdn08Controller extends ApplicationController {
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);
}
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
XLSWriter xlsx = new XLSWriter()
.setFilename("면제차량 목록.xlsx")
.worksheet(0);
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
CellStyle center = xlsx.cellStyle(Styler.CENTER);
CellStyle numeric = xlsx.n_nn0();
CellStyle dateYMD = xlsx.yyyy_mm_dd();
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss();
xlsx.cell(0, 0)
.value("면제차량 목록", 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, nothing) -> {
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"))).style(dateYMD);
case "면제종료일": return xlsx.format(o -> xlsx.str2date(o.get("EXMPTN_END_YMD"))).style(dateYMD);
case "입력자": return "RGTR_NM";
case "입력일시": return xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT);
case "수정자": return "MDFR_NM";
case "수정일시": return xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT);
case "삭제자": return "DLTR_NM";
case "삭제사유": return "DEL_RSN";
case "삭제일시": return xlsx.format(o -> xlsx.str2datetime(o.get("DEL_DT"))).style(dateDT);
}
return "";
};
Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("차량번호", "VHRNO");
valueMap.put("사유", "EXMPTN_RSN");
valueMap.put("공문번호", "DOC_NO");
valueMap.put("소유주명", "OWNR_NM");
valueMap.put("면제시작일", xlsx.format(o -> xlsx.str2date(o.get("EXMPTN_BGNG_YMD"))).style(dateYMD));
valueMap.put("면제종료일", xlsx.format(o -> xlsx.str2date(o.get("EXMPTN_END_YMD"))).style(dateYMD));
valueMap.put("입력자", "RGTR_NM");
valueMap.put("입력일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT));
valueMap.put("수정자", "MDFR_NM");
valueMap.put("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT));
valueMap.put("삭제자", "DLTR_NM");
valueMap.put("삭제사유", "DEL_RSN");
valueMap.put("삭제일시", xlsx.format(o -> xlsx.str2datetime(o.get("DEL_DT"))).style(dateDT));
CellDef.setValues(cellDefs, valueMap);
xlsx.cell(4, 0)
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
xlsx.cell(0, 0)
.value("면제차량 목록", center)
.merge(0, cellDefs.size()-1)
.cell(3, 0)
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
.cell(4, 0)
.values(list, CellDef.values(cellDefs));
return new ModelAndView("xlsView").addObject("xls", xlsx);
}

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.stream.Stream;
import javax.annotation.Resource;
@ -14,11 +13,14 @@ import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.FileInfo;
import cokr.xit.base.file.FileInfo.Relation;
import cokr.xit.base.file.web.FileInfoFactory;
import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CellDef;
import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
@ -98,58 +100,47 @@ public class Cvlc01Controller extends ApplicationController {
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);
}
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
XLSWriter xlsx = new XLSWriter()
.setFilename("민원접수자료 목록.xlsx")
.worksheet(0);
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
CellStyle center = xlsx.cellStyle(Styler.CENTER);
CellStyle numeric = xlsx.n_nn0();
CellStyle dateYMD = xlsx.yyyy_mm_dd();
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss();
xlsx.cell(0, 0)
.value("민원접수자료 목록", center)
.merge(0, titles.size()-1)
.cell(3, 0)
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
List<DataObject> list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0));
BiFunction<String, String, ?> getValue = (titleNm, nothing) -> {
switch(titleNm) {
case "접수번호": return xlsx.style("CVLCPT_RCPT_NO", center);
case "목록번호": return xlsx.style("CVLCPT_LIST_NO", center);
case "등록구분": return xlsx.style("CRDN_REG_SE_NM", center);
case "신고자": return xlsx.style("CVLCPT_APLCNT_NM", center);
case "담당자" : return xlsx.style("CVLCPT_PRCS_PIC_NM", center);
case "담당자전화번호": return xlsx.style("CVLCPT_PRCS_PIC_TELNO", center);
case "접수일자": return xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD);
case "처리기한": return xlsx.format(o -> xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT"))).style(dateDT);
case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT);
case "위반내용": return xlsx.style("VLTN_ARTCL", center);
case "차량번호": return "VHRNO";
case "사진건수": return xlsx.style("ATCH_FILE_CNT", center);
Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("접수번호", xlsx.style("CVLCPT_RCPT_NO", center));
valueMap.put("목록번호", xlsx.style("CVLCPT_LIST_NO", center));
valueMap.put("등록구분", xlsx.style("CRDN_REG_SE_NM", center));
valueMap.put("신고자", xlsx.style("CVLCPT_APLCNT_NM", center));
valueMap.put("담당자", xlsx.style("CVLCPT_PRCS_PIC_NM", center));
valueMap.put("담당자전화번호", xlsx.style("CVLCPT_PRCS_PIC_TELNO", center));
valueMap.put("접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD));
valueMap.put("처리기한", xlsx.format(o -> {
if(o.get("CVLCPT_PRCS_PRNMNT_DT") != null && ((String)o.get("CVLCPT_PRCS_PRNMNT_DT")).length() > 8) {
return xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT"));
} else {
return xlsx.str2date(o.get("CVLCPT_PRCS_PRNMNT_DT"));
}
return "";
};
}).style(dateDT));
valueMap.put("위반일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT));
valueMap.put("위반내용", xlsx.style("VLTN_ARTCL", center));
valueMap.put("차량번호", "VHRNO");
valueMap.put("사진건수", xlsx.style("ATCH_FILE_CNT", center));
CellDef.setValues(cellDefs, valueMap);
xlsx.cell(4, 0)
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
xlsx.cell(0, 0)
.value("민원접수자료 목록", center)
.merge(0, cellDefs.size()-1)
.cell(3, 0)
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
.cell(4, 0)
.values(list, CellDef.values(cellDefs));
return new ModelAndView("xlsView").addObject("xls", xlsx);
}

@ -1,9 +1,9 @@
package cokr.xit.fims.cvlc.web;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -11,8 +11,11 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CellDef;
import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
@ -87,57 +90,47 @@ public class Cvlc02Controller extends ApplicationController {
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);
}
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
XLSWriter xlsx = new XLSWriter()
.setFilename("민원답변대상자료 목록.xlsx")
.worksheet(0);
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
CellStyle center = xlsx.cellStyle(Styler.CENTER);
CellStyle numeric = xlsx.n_nn0();
CellStyle dateYMD = xlsx.yyyy_mm_dd();
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss();
xlsx.cell(0, 0)
.value("민원답변대상자료 목록", center)
.merge(0, titles.size()-1)
.cell(3, 0)
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
List<DataObject> list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0));
BiFunction<String, String, ?> getValue = (titleNm, nothing) -> {
switch(titleNm) {
case "접수번호": return xlsx.style("CVLCPT_RCPT_NO", center);
case "목록번호": return xlsx.style("CVLCPT_LIST_NO", center);
case "신고자": return xlsx.style("CVLCPT_APLCNT_NM", center);
case "담당자" : return xlsx.style("CVLCPT_PRCS_PIC_NM", center);
case "담당자전화번호": return xlsx.style("CVLCPT_PRCS_PIC_TELNO", center);
case "접수일자": return xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD);
case "처리기한": return xlsx.format(o -> xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT"))).style(dateDT);
case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT);
case "위반내용": return xlsx.style("VLTN_ARTCL", center);
case "차량번호": return "VHRNO";
case "서손/계고사유": return xlsx.style("LEVY_EXCL_RSN_NM", center);
case "특기사항": return "ETC_CN";
Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("접수번호", xlsx.style("CVLCPT_RCPT_NO", center));
valueMap.put("목록번호", xlsx.style("CVLCPT_LIST_NO", center));
valueMap.put("신고자", xlsx.style("CVLCPT_APLCNT_NM", center));
valueMap.put("담당자", xlsx.style("CVLCPT_PRCS_PIC_NM", center));
valueMap.put("담당자전화번호", xlsx.style("CVLCPT_PRCS_PIC_TELNO", center));
valueMap.put("접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD));
valueMap.put("처리기한", xlsx.format(o -> {
if(o.get("CVLCPT_PRCS_PRNMNT_DT") != null && ((String)o.get("CVLCPT_PRCS_PRNMNT_DT")).length() > 8) {
return xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT"));
} else {
return xlsx.str2date(o.get("CVLCPT_PRCS_PRNMNT_DT"));
}
return "";
};
}).style(dateDT));
valueMap.put("위반일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT));
valueMap.put("위반내용", xlsx.style("VLTN_ARTCL", center));
valueMap.put("차량번호", "VHRNO");
valueMap.put("서손/계고사유", xlsx.style("LEVY_EXCL_RSN_NM", center));
valueMap.put("특기사항", "ETC_CN");
CellDef.setValues(cellDefs, valueMap);
xlsx.cell(4, 0)
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
xlsx.cell(0, 0)
.value("민원답변대상자료 목록", center)
.merge(0, cellDefs.size()-1)
.cell(3, 0)
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
.cell(4, 0)
.values(list, CellDef.values(cellDefs));
return new ModelAndView("xlsView").addObject("xls", xlsx);
}

@ -1,17 +1,20 @@
package cokr.xit.fims.cvlc.web;
import java.util.ArrayList;
import java.util.HashMap;
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 com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CellDef;
import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
@ -78,59 +81,49 @@ public class Cvlc03Controller extends ApplicationController {
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);
}
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
XLSWriter xlsx = new XLSWriter()
.setFilename("민원자료 목록.xlsx")
.worksheet(0);
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
CellStyle center = xlsx.cellStyle(Styler.CENTER);
CellStyle numeric = xlsx.n_nn0();
CellStyle dateYMD = xlsx.yyyy_mm_dd();
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss();
xlsx.cell(0, 0)
.value("민원자료 목록", center)
.merge(0, titles.size()-1)
.cell(3, 0)
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
List<DataObject> list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0));
BiFunction<String, String, ?> getValue = (titleNm, nothing) -> {
switch(titleNm) {
case "접수번호": return xlsx.style("CVLCPT_RCPT_NO", center);
case "목록번호": return xlsx.style("CVLCPT_LIST_NO", center);
case "등록구분": return xlsx.style("CRDN_REG_SE_NM", center);
case "신고자": return xlsx.style("CVLCPT_APLCNT_NM", center);
case "담당자" : return xlsx.style("CVLCPT_PRCS_PIC_NM", center);
case "담당자전화번호": return xlsx.style("CVLCPT_PRCS_PIC_TELNO", center);
case "접수일자": return xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD);
case "처리기한": return xlsx.format(o -> xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT"))).style(dateDT);
case "위반일시": return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT);
case "위반내용": return xlsx.style("VLTN_ARTCL", center);
case "차량번호": return "VHRNO";
case "사진건수": return xlsx.style("ATCH_FILE_CNT", center);
case "서손/계고사유": return xlsx.style("LEVY_EXCL_RSN_NM", center);
case "특기사항": return "ETC_CN";
Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("접수번호", xlsx.style("CVLCPT_RCPT_NO", center));
valueMap.put("목록번호", xlsx.style("CVLCPT_LIST_NO", center));
valueMap.put("등록구분", xlsx.style("CRDN_REG_SE_NM", center));
valueMap.put("신고자", xlsx.style("CVLCPT_APLCNT_NM", center));
valueMap.put("담당자", xlsx.style("CVLCPT_PRCS_PIC_NM", center));
valueMap.put("담당자전화번호", xlsx.style("CVLCPT_PRCS_PIC_TELNO", center));
valueMap.put("접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD));
valueMap.put("처리기한", xlsx.format(o -> {
if(o.get("CVLCPT_PRCS_PRNMNT_DT") != null && ((String)o.get("CVLCPT_PRCS_PRNMNT_DT")).length() > 8) {
return xlsx.str2datetime(o.get("CVLCPT_PRCS_PRNMNT_DT"));
} else {
return xlsx.str2date(o.get("CVLCPT_PRCS_PRNMNT_DT"));
}
return "";
};
}).style(dateDT));
valueMap.put("위반일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT));
valueMap.put("위반내용", xlsx.style("VLTN_ARTCL", center));
valueMap.put("차량번호", "VHRNO");
valueMap.put("사진건수", xlsx.style("ATCH_FILE_CNT", center));
valueMap.put("서손/계고사유", xlsx.style("LEVY_EXCL_RSN_NM", center));
valueMap.put("특기사항", "ETC_CN");
CellDef.setValues(cellDefs, valueMap);
xlsx.cell(4, 0)
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
xlsx.cell(0, 0)
.value("민원자료 목록", center)
.merge(0, cellDefs.size()-1)
.cell(3, 0)
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
.cell(4, 0)
.values(list, CellDef.values(cellDefs));
return new ModelAndView("xlsView").addObject("xls", xlsx);
}

@ -3,9 +3,9 @@ package cokr.xit.fims.sprt.web;
import java.io.File;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -15,8 +15,11 @@ import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CellDef;
import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
@ -158,19 +161,7 @@ public class Sprt01Controller extends ApplicationController {
List<DataObject> downList = list.stream().filter(item -> item.string("RCVMT_ETC_YN").equals("Y")).toList();
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);
}
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
String fileName = "통합조회자료 목록";
List<DataObject> listForExcel;
@ -187,75 +178,70 @@ public class Sprt01Controller extends ApplicationController {
XLSWriter xlsx = new XLSWriter()
.setFilename(fileName+".xlsx")
.worksheet(0);
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
CellStyle center = xlsx.cellStyle(Styler.CENTER);
CellStyle numeric = xlsx.n_nn0();
CellStyle dateYMD = xlsx.yyyy_mm_dd();
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss();
Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("시군구명" , xlsx.style("SGG_NM", center));
valueMap.put("과태료명" , xlsx.style("TASK_SE_NM", center));
valueMap.put("단속입력구분" , xlsx.style("CRDN_INPT_SE_NM", center));
valueMap.put("단속일시" , xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT));
valueMap.put("신고자명" , xlsx.style("CVLCPT_APLCNT_NM", center));
valueMap.put("민원접수번호" , xlsx.style("CVLCPT_RCPT_NO", center));
valueMap.put("민원접수일자" , xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD));
valueMap.put("민원목록번호" , xlsx.style("CVLCPT_LIST_NO", center));
valueMap.put("단속차량번호" , "VHRNO");
valueMap.put("대체차량번호" , "RPM_SZR_VHRNO");
valueMap.put("사진건수" , xlsx.style("ATCH_FILE_CNT", center));
valueMap.put("차량확인" , xlsx.style("PARKNG_PSBLTY_RSLT_NM", center));
valueMap.put("납부자명" , xlsx.style("RTPYR_NM", center));
valueMap.put("납부자번호" , xlsx.style("RTPYR_NO", center));
valueMap.put("처리상태" , xlsx.style("CRDN_STTS_NM", center));
valueMap.put("제외사유" , "LEVY_EXCL_RSN_NM");
valueMap.put("제외일자" , xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD"))).style(dateYMD));
valueMap.put("기타사항" , "ETC_CN");
valueMap.put("고지번호" , xlsx.style("GOJI_NO", center));
valueMap.put("처리일자" , xlsx.format(o -> xlsx.str2date(o.get("CRDN_STTS_CHG_YMD"))).style(dateYMD));
valueMap.put("단속장소" , "CRDN_PLC");
valueMap.put("단속구분" , xlsx.style("CRDN_SE_NM", center));
valueMap.put("의견진술여부" , xlsx.style("OPNN_SBMSN_YN_NM", center));
valueMap.put("의견진술기한" , xlsx.format(o -> xlsx.str2date(o.get("ADVNTCE_DUDT_YMD"))).style(dateYMD));
valueMap.put("견인여부" , xlsx.style("TOWNG_YN_NM", center));
valueMap.put("압류일자" , xlsx.format(o -> xlsx.str2date(o.get("SZR_YMD"))).style(dateYMD));
valueMap.put("압류해제일자" , xlsx.format(o -> xlsx.str2date(o.get("SZR_RMV_YMD"))).style(dateYMD));
valueMap.put("잔액" , xlsx.style("SUM_AMT", numeric));
valueMap.put("부과금액" , xlsx.style("LEVY_AMT", numeric));
valueMap.put("본세" , xlsx.style("LEVY_PCPTAX", numeric));
valueMap.put("가산금" , xlsx.style("LEVY_ADAMT", numeric));
valueMap.put("납부기한" , xlsx.format(o -> xlsx.str2date(o.get("DUDT_YMD"))).style(dateYMD));
valueMap.put("납기후일자" , xlsx.format(o -> xlsx.str2date(o.get("DUDT_AFTR_YMD"))).style(dateYMD));
valueMap.put("납기후금액" , xlsx.style("DUDT_AFTR_AMT", numeric));
valueMap.put("가상계좌번호" , xlsx.style("VR_ACTNO", center));
valueMap.put("전자납부번호" , xlsx.style("EPAYNO", center));
valueMap.put("수납유형" , xlsx.style("PAY_MTHD_SE_NM", center));
valueMap.put("수납일자" , xlsx.format(o -> xlsx.str2date(o.get("RCVMT_YMD"))).style(dateYMD));
valueMap.put("수납금액" , xlsx.style("RCVMT_AMT", numeric));
valueMap.put("수납본세" , xlsx.style("RCVMT_PCPTAX", numeric));
valueMap.put("수납가산금" , xlsx.style("RCVMT_ADAMT", numeric));
valueMap.put("단속등록구분" , xlsx.style("CRDN_REG_SE_NM", center));
valueMap.put("납부자주소" , "RTPYR_FULL_ADDR");
valueMap.put("거주상태" , xlsx.style("RTPYR_STTS_NM", center));
valueMap.put("차량번호", "VHRNO");
valueMap.put("성명", "RTPYR_NM");
valueMap.put("주소", "RTPYR_ADDR");
valueMap.put("번지", "RTPYR_DTL_ADDR");
CellDef.setValues(cellDefs, valueMap);
xlsx.cell(0, 0)
.value(fileName, center)
.merge(0, titles.size()-1)
.merge(0, cellDefs.size()-1)
.cell(3, 0)
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
BiFunction<String, String, ?> getValue = (titleNm, nothing) -> {
switch(titleNm) {
case "시군구명" : return xlsx.style("SGG_NM", center);
case "과태료명" : return xlsx.style("TASK_SE_NM", center);
case "단속입력구분" : return xlsx.style("CRDN_INPT_SE_NM", center);
case "단속일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT);
case "신고자명" : return xlsx.style("CVLCPT_APLCNT_NM", center);
case "민원접수번호" : return xlsx.style("CVLCPT_RCPT_NO", center);
case "민원접수일자" : return xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD);
case "민원목록번호" : return xlsx.style("CVLCPT_LIST_NO", center);
case "단속차량번호" : return "VHRNO";
case "대체차량번호" : return "RPM_SZR_VHRNO";
case "사진건수" : return xlsx.style("ATCH_FILE_CNT", center);
case "차량확인" : return xlsx.style("PARKNG_PSBLTY_RSLT_NM", center);
case "납부자명" : return xlsx.style("RTPYR_NM", center);
case "납부자번호" : return xlsx.style("RTPYR_NO", center);
case "처리상태" : return xlsx.style("CRDN_STTS_NM", center);
case "제외사유" : return "LEVY_EXCL_RSN_NM";
case "제외일자" : return xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD"))).style(dateYMD);
case "기타사항" : return "ETC_CN";
case "고지번호" : return xlsx.style("GOJI_NO", center);
case "처리일자" : return xlsx.format(o -> xlsx.str2date(o.get("CRDN_STTS_CHG_YMD"))).style(dateYMD);
case "단속장소" : return "CRDN_PLC";
case "단속구분" : return xlsx.style("CRDN_SE_NM", center);
case "의견진술여부" : return xlsx.style("OPNN_SBMSN_YN_NM", center);
case "의견진술기한" : return xlsx.format(o -> xlsx.str2date(o.get("ADVNTCE_DUDT_YMD"))).style(dateYMD);
case "견인여부" : return xlsx.style("TOWNG_YN_NM", center);
case "압류일자" : return xlsx.format(o -> xlsx.str2date(o.get("SZR_YMD"))).style(dateYMD);
case "압류해제일자" : return xlsx.format(o -> xlsx.str2date(o.get("SZR_RMV_YMD"))).style(dateYMD);
case "잔액" : return xlsx.style("SUM_AMT", numeric);
case "부과금액" : return xlsx.style("LEVY_AMT", numeric);
case "본세" : return xlsx.style("LEVY_PCPTAX", numeric);
case "가산금" : return xlsx.style("LEVY_ADAMT", numeric);
case "납부기한" : return xlsx.format(o -> xlsx.str2date(o.get("DUDT_YMD"))).style(dateYMD);
case "납기후일자" : return xlsx.format(o -> xlsx.str2date(o.get("DUDT_AFTR_YMD"))).style(dateYMD);
case "납기후금액" : return xlsx.style("DUDT_AFTR_AMT", numeric);
case "가상계좌번호" : return xlsx.style("VR_ACTNO", center);
case "전자납부번호" : return xlsx.style("EPAYNO", center);
case "수납유형" : return xlsx.style("PAY_MTHD_SE_NM", center);
case "수납일자" : return xlsx.format(o -> xlsx.str2date(o.get("RCVMT_YMD"))).style(dateYMD);
case "수납금액" : return xlsx.style("RCVMT_AMT", numeric);
case "수납본세" : return xlsx.style("RCVMT_PCPTAX", numeric);
case "수납가산금" : return xlsx.style("RCVMT_ADAMT", numeric);
case "단속등록구분" : return xlsx.style("CRDN_REG_SE_NM", center);
case "납부자주소" : return "RTPYR_FULL_ADDR";
case "거주상태" : return xlsx.style("RTPYR_STTS_NM", center);
case "차량번호": return "VHRNO";
case "성명": return "RTPYR_NM";
case "주소": return "RTPYR_ADDR";
case "번지": return "RTPYR_DTL_ADDR";
}
return "";
};
xlsx.cell(4, 0)
.values(listForExcel, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
.cell(4, 0)
.values(listForExcel, CellDef.values(cellDefs));
return new ModelAndView("xlsView").addObject("xls", xlsx);
}

Loading…
Cancel
Save