|
|
|
@ -1,17 +1,20 @@
|
|
|
|
|
package cokr.xit.fims.epst.web;
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
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 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.web.ApplicationController;
|
|
|
|
@ -21,7 +24,6 @@ import cokr.xit.fims.cmmn.service.DeptService;
|
|
|
|
|
import cokr.xit.fims.epst.EpostGdcc;
|
|
|
|
|
import cokr.xit.fims.epst.EpostQuery;
|
|
|
|
|
import cokr.xit.fims.epst.EpostRcptReg;
|
|
|
|
|
import cokr.xit.fims.epst.EpostRcptRslt;
|
|
|
|
|
import cokr.xit.fims.epst.service.EpostGdccService;
|
|
|
|
|
import cokr.xit.fims.epst.service.EpostRcptDtlService;
|
|
|
|
|
import cokr.xit.fims.epst.service.EpostRcptRegService;
|
|
|
|
@ -53,7 +55,6 @@ public class Epst02Controller extends ApplicationController {
|
|
|
|
|
, epostSendingStatusMain = "/030/main.do" // 전자우편 우편발송 메인
|
|
|
|
|
, getEpostSendingStatusList = "/030/list.do" // 전자우편 발송 목록 조회
|
|
|
|
|
, getEpostSendingStatusInfo = "/040/info.do" // 전자우편 발송 상세 정보 조회
|
|
|
|
|
// , updateEpostSendingStatus = "/030/update.do" // 전자우편 발송 수정
|
|
|
|
|
, updateEpostSendingProcessStatus = "/030/updateSttsCd.do" // 전자우편 발송 처리상태코드 수정
|
|
|
|
|
, removeEpostSendingStatus = "/030/remove.do" // 전자우편 발송 삭제
|
|
|
|
|
, epostReceiptResultMain = "/050/main.do" // 전자우편 접수 결과 메인
|
|
|
|
@ -120,56 +121,43 @@ public class Epst02Controller extends ApplicationController {
|
|
|
|
|
List<?> result = epostGdccService.getEpostGdccList(setFetchSize(req));
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), result, "epostGdcc");
|
|
|
|
|
} else {
|
|
|
|
|
// 현재 날짜 구하기
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
String dateTime = dateFormat.format(System.currentTimeMillis());
|
|
|
|
|
|
|
|
|
|
ArrayList<CellDef> cellDefs = fromJson(req.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
|
|
|
|
|
|
|
|
|
|
XLSWriter xlsx = new XLSWriter()
|
|
|
|
|
.setFilename("우편통합 안내문 목록.xlsx")
|
|
|
|
|
.setFilename("우편통합안내문" + "_목록_" + dateTime + ".xlsx")
|
|
|
|
|
.worksheet(0);
|
|
|
|
|
|
|
|
|
|
CellStyle center = xlsx.cellStyle(Styler.CENTER) // 가운데 정렬
|
|
|
|
|
, dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간
|
|
|
|
|
|
|
|
|
|
String[] excelTitle = req.getExcelTitle();
|
|
|
|
|
List<String> titles = new ArrayList<String>();
|
|
|
|
|
for (int iLoop = 0; iLoop < excelTitle.length; iLoop++) {
|
|
|
|
|
String item = excelTitle[iLoop];
|
|
|
|
|
titles.add(item);
|
|
|
|
|
}
|
|
|
|
|
// CellStyle 지정은 여기에서..
|
|
|
|
|
CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬
|
|
|
|
|
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간
|
|
|
|
|
|
|
|
|
|
int[] excelTitleWidth = req.getExcelTitleWidth();
|
|
|
|
|
List<Integer> widths = new ArrayList<>();
|
|
|
|
|
for (int jLoop = 0; jLoop < excelTitleWidth.length; jLoop++) {
|
|
|
|
|
int item = excelTitleWidth[jLoop];
|
|
|
|
|
widths.add(item);
|
|
|
|
|
}
|
|
|
|
|
List<DataObject> list = epostGdccService.getEpostGdccList(req.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
|
|
|
|
|
CellDef.setValues(cellDefs, Map.ofEntries(
|
|
|
|
|
Map.entry("업무구분", xlsx.style("TASK_SE_NM", center))
|
|
|
|
|
, Map.entry("발송구분", xlsx.style("SNDNG_SE_NM", center))
|
|
|
|
|
, Map.entry("사용여부", xlsx.style("USE_YN_NM", center))
|
|
|
|
|
, Map.entry("최종사용일시", xlsx.format(o -> xlsx.str2date(o.get("LAST_USE_DT"))).style(dateDT))
|
|
|
|
|
, Map.entry("제목", "TTL_NM")
|
|
|
|
|
, Map.entry("문구내용", "WORDS_CN")
|
|
|
|
|
, Map.entry("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT))
|
|
|
|
|
, Map.entry("등록사용자", xlsx.style("RGTR_NM", center))
|
|
|
|
|
, Map.entry("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT))
|
|
|
|
|
, Map.entry("수정사용자", xlsx.style("MDFR_NM", center))
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
xlsx.cell(0, 0)
|
|
|
|
|
.value("우편통합 안내문", XLSWriter.Styler.CENTER)
|
|
|
|
|
.merge(0, 9)
|
|
|
|
|
.value("우편통합 안내문", center)
|
|
|
|
|
.merge(0, cellDefs.size() - 1)
|
|
|
|
|
.cell(3, 0)
|
|
|
|
|
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
|
|
|
|
|
|
|
|
|
|
List<DataObject> list = epostGdccService.getEpostGdccList(req.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
BiFunction<String, String, ?> getValue = (titleNm, nothing) -> {
|
|
|
|
|
switch (titleNm) {
|
|
|
|
|
case "업무구분" : return xlsx.style("TASK_SE_NM", center);
|
|
|
|
|
case "발송구분" : return xlsx.style("SNDNG_SE_NM", center);
|
|
|
|
|
case "사용여부" : return xlsx.style("USE_YN_NM", center);
|
|
|
|
|
case "최종사용일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("LAST_USE_DT"))).style(dateDT);
|
|
|
|
|
case "제목" : return "TTL_NM";
|
|
|
|
|
case "문구내용" : return "WORDS_CN";
|
|
|
|
|
case "등록일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT);
|
|
|
|
|
case "등록사용자" : return xlsx.style("RGTR_NM", center);
|
|
|
|
|
case "수정일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT);
|
|
|
|
|
case "수정사용자" : return xlsx.style("MDFR_NM", center);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xlsx.cell(4, 0)
|
|
|
|
|
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
|
|
|
|
|
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
|
|
|
|
|
.cell(4, 0)
|
|
|
|
|
.values(list, CellDef.values(cellDefs));
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("xlsView")
|
|
|
|
|
.addObject("xls", xlsx);
|
|
|
|
@ -312,57 +300,44 @@ public class Epst02Controller extends ApplicationController {
|
|
|
|
|
List<?> result = epostRcptRegService.getEpostRcptRegList(setFetchSize(req));
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), result, "epostRcptReg");
|
|
|
|
|
} else {
|
|
|
|
|
// 현재 날짜 구하기
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
String dateTime = dateFormat.format(System.currentTimeMillis());
|
|
|
|
|
|
|
|
|
|
ArrayList<CellDef> cellDefs = fromJson(req.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
|
|
|
|
|
|
|
|
|
|
XLSWriter xlsx = new XLSWriter()
|
|
|
|
|
.setFilename("우편통합 우편발송 목록.xlsx")
|
|
|
|
|
.setFilename("우편통합우편발송" + "_목록_" + dateTime + ".xlsx")
|
|
|
|
|
.worksheet(0);
|
|
|
|
|
|
|
|
|
|
CellStyle center = xlsx.cellStyle(Styler.CENTER) // 가운데 정렬
|
|
|
|
|
, numeric = xlsx.n_nn0() // 숫자 3자리 콤마(,)
|
|
|
|
|
, dateYMD = xlsx.yyyy_mm_dd() // 연월일
|
|
|
|
|
, dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간
|
|
|
|
|
|
|
|
|
|
String[] excelTitle = req.getExcelTitle();
|
|
|
|
|
List<String> titles = new ArrayList<String>();
|
|
|
|
|
for (int iLoop = 0; iLoop < excelTitle.length; iLoop++) {
|
|
|
|
|
String item = excelTitle[iLoop];
|
|
|
|
|
titles.add(item);
|
|
|
|
|
}
|
|
|
|
|
// CellStyle 지정은 여기에서..
|
|
|
|
|
CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬
|
|
|
|
|
CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,)
|
|
|
|
|
CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일
|
|
|
|
|
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간
|
|
|
|
|
|
|
|
|
|
int[] excelTitleWidth = req.getExcelTitleWidth();
|
|
|
|
|
List<Integer> widths = new ArrayList<>();
|
|
|
|
|
for (int jLoop = 0; jLoop < excelTitleWidth.length; jLoop++) {
|
|
|
|
|
int item = excelTitleWidth[jLoop];
|
|
|
|
|
widths.add(item);
|
|
|
|
|
}
|
|
|
|
|
List<DataObject> list = epostRcptRegService.getEpostRcptRegList(req.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
|
|
|
|
|
CellDef.setValues(cellDefs, Map.ofEntries(
|
|
|
|
|
Map.entry("발송일자", xlsx.format(o -> xlsx.str2date(o.get("SEND_DATE"))).style(dateYMD))
|
|
|
|
|
, Map.entry("발송내역", xlsx.style("JOB_CD", center))
|
|
|
|
|
, Map.entry("취급구분", xlsx.style("DIV_KB_NM", center))
|
|
|
|
|
, Map.entry("접수일자", xlsx.format(o -> xlsx.str2date(o.get("RCEPT_YMD"))).style(dateYMD))
|
|
|
|
|
, Map.entry("자료키", xlsx.style("CON_KEY", center))
|
|
|
|
|
, Map.entry("발송건수", xlsx.style("RECEV_CNT", numeric))
|
|
|
|
|
, Map.entry("우편처리상태", xlsx.style("POST_PRCS_STTS_NM", center))
|
|
|
|
|
, Map.entry("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT))
|
|
|
|
|
, Map.entry("등록사용자", xlsx.style("RGTR_NM", center))
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
xlsx.cell(0, 0)
|
|
|
|
|
.value("우편통합 우편발송", XLSWriter.Styler.CENTER)
|
|
|
|
|
.merge(0, 8)
|
|
|
|
|
.value("우편통합 우편발송", center)
|
|
|
|
|
.merge(0, cellDefs.size() - 1)
|
|
|
|
|
.cell(3, 0)
|
|
|
|
|
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
|
|
|
|
|
|
|
|
|
|
List<DataObject> list = epostRcptRegService.getEpostRcptRegList(req.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
BiFunction<String, String, ?> getValue = (titleNm, nothing) -> {
|
|
|
|
|
switch (titleNm) {
|
|
|
|
|
case "발송일자" : return xlsx.format(o -> xlsx.str2date(o.get("SEND_DATE"))).style(dateYMD);
|
|
|
|
|
case "발송내역" : return xlsx.style("JOB_CD", center);
|
|
|
|
|
case "취급구분" : return xlsx.style("DIV_KB_NM", center);
|
|
|
|
|
case "접수일자" : return xlsx.format(o -> xlsx.str2date(o.get("RCEPT_YMD"))).style(dateYMD);
|
|
|
|
|
case "자료키" : return xlsx.style("CON_KEY", center);
|
|
|
|
|
case "발송건수" : return xlsx.style("RECEV_CNT", numeric);
|
|
|
|
|
case "우편처리상태" : return xlsx.style("POST_PRCS_STTS_NM", center);
|
|
|
|
|
case "등록일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT);
|
|
|
|
|
case "등록사용자" : return xlsx.style("RGTR_NM", center);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xlsx.cell(4, 0)
|
|
|
|
|
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
|
|
|
|
|
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
|
|
|
|
|
.cell(4, 0)
|
|
|
|
|
.values(list, CellDef.values(cellDefs));
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("xlsView")
|
|
|
|
|
.addObject("xls", xlsx);
|
|
|
|
@ -393,60 +368,47 @@ public class Epst02Controller extends ApplicationController {
|
|
|
|
|
.addObject("epostSndngSttsInfo", json ? epostSndngSttsInfo : toJson(epostSndngSttsInfo))
|
|
|
|
|
;
|
|
|
|
|
} else {
|
|
|
|
|
// 현재 날짜 구하기
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
String dateTime = dateFormat.format(System.currentTimeMillis());
|
|
|
|
|
|
|
|
|
|
ArrayList<CellDef> cellDefs = fromJson(req.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
|
|
|
|
|
|
|
|
|
|
XLSWriter xlsx = new XLSWriter()
|
|
|
|
|
.setFilename("우편통합 발송상세 정보.xlsx")
|
|
|
|
|
.setFilename("우편통합발송상세" + "_목록_" + dateTime + ".xlsx")
|
|
|
|
|
.worksheet(0);
|
|
|
|
|
|
|
|
|
|
CellStyle center = xlsx.cellStyle(Styler.CENTER) // 가운데 정렬
|
|
|
|
|
, dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간
|
|
|
|
|
|
|
|
|
|
String[] excelTitle = req.getExcelTitle();
|
|
|
|
|
List<String> titles = new ArrayList<String>();
|
|
|
|
|
for (int iLoop = 0; iLoop < excelTitle.length; iLoop++) {
|
|
|
|
|
String item = excelTitle[iLoop];
|
|
|
|
|
titles.add(item);
|
|
|
|
|
}
|
|
|
|
|
// CellStyle 지정은 여기에서..
|
|
|
|
|
CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬
|
|
|
|
|
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간
|
|
|
|
|
|
|
|
|
|
int[] excelTitleWidth = req.getExcelTitleWidth();
|
|
|
|
|
List<Integer> widths = new ArrayList<>();
|
|
|
|
|
for (int jLoop = 0; jLoop < excelTitleWidth.length; jLoop++) {
|
|
|
|
|
int item = excelTitleWidth[jLoop];
|
|
|
|
|
widths.add(item);
|
|
|
|
|
}
|
|
|
|
|
List<DataObject> list = epostRcptRegService.getEpostSndngSttsInfo(req.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
|
|
|
|
|
CellDef.setValues(cellDefs, Map.ofEntries(
|
|
|
|
|
Map.entry("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT))
|
|
|
|
|
, Map.entry("등기번호", xlsx.style("RGST_NMBR", center))
|
|
|
|
|
, Map.entry("우편번호", xlsx.style("RECEV_CAR_OWNER_ZIPCODE", center))
|
|
|
|
|
, Map.entry("수취인명", "RECEV_CAR_OWNER_NM")
|
|
|
|
|
, Map.entry("배달일시", xlsx.format(o -> xlsx.str2datetime(o.get("DELIV_YMD_TM"))).style(dateDT))
|
|
|
|
|
, Map.entry("배달결과", xlsx.style("DELIVRSLTCD_NM", center))
|
|
|
|
|
, Map.entry("수령인명", "SUBRECPRSNNM")
|
|
|
|
|
, Map.entry("수령인관계", xlsx.style("RELRECPRSNCDNM", center))
|
|
|
|
|
, Map.entry("미배달사유", "NONDELIVREASNCDNM")
|
|
|
|
|
, Map.entry("주소", "RECEV_CAR_OWNER_ADDR")
|
|
|
|
|
, Map.entry("상세주소", "RECEV_CAR_OWNER_DETAILADDR")
|
|
|
|
|
, Map.entry("등록사용자", xlsx.style("RGTR_NM", center))
|
|
|
|
|
, Map.entry("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT))
|
|
|
|
|
, Map.entry("수정사용자", xlsx.style("MDFR_NM", center))
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
xlsx.cell(0, 0)
|
|
|
|
|
.value("우편통합 발송상세", XLSWriter.Styler.CENTER)
|
|
|
|
|
.merge(0, 13)
|
|
|
|
|
.value("우편통합 발송상세", center)
|
|
|
|
|
.merge(0, cellDefs.size() - 1)
|
|
|
|
|
.cell(3, 0)
|
|
|
|
|
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
|
|
|
|
|
|
|
|
|
|
List<DataObject> list = epostRcptRegService.getEpostSndngSttsInfo(req.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
BiFunction<String, String, ?> getValue = (titleNm, nothing) -> {
|
|
|
|
|
switch (titleNm) {
|
|
|
|
|
case "등록일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT);
|
|
|
|
|
case "등기번호" : return xlsx.style("RGST_NMBR", center);
|
|
|
|
|
case "우편번호" : return xlsx.style("RECEV_CAR_OWNER_ZIPCODE", center);
|
|
|
|
|
case "수취인명" : return "RECEV_CAR_OWNER_NM";
|
|
|
|
|
case "배달일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("DELIV_YMD_TM"))).style(dateDT);
|
|
|
|
|
case "배달결과" : return xlsx.style("DELIVRSLTCD_NM", center);
|
|
|
|
|
case "수령인명" : return "SUBRECPRSNNM";
|
|
|
|
|
case "수령인관계" : return "RELRECPRSNCDNM";
|
|
|
|
|
case "미배달사유" : return "NONDELIVREASNCDNM";
|
|
|
|
|
case "주소" : return "RECEV_CAR_OWNER_ADDR";
|
|
|
|
|
case "상세주소" : return "RECEV_CAR_OWNER_DETAILADDR";
|
|
|
|
|
case "등록사용자" : return xlsx.style("RGTR_NM", center);
|
|
|
|
|
case "수정일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT);
|
|
|
|
|
case "수정사용자" : return xlsx.style("MDFR_NM", center);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xlsx.cell(4, 0)
|
|
|
|
|
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
|
|
|
|
|
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
|
|
|
|
|
.cell(4, 0)
|
|
|
|
|
.values(list, CellDef.values(cellDefs));
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("xlsView")
|
|
|
|
|
.addObject("xls", xlsx);
|
|
|
|
@ -547,60 +509,47 @@ public class Epst02Controller extends ApplicationController {
|
|
|
|
|
List<?> result = epostRcptRsltService.getEpostRcptRsltList(setFetchSize(req));
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), result, "epostRcptRslt");
|
|
|
|
|
} else {
|
|
|
|
|
// 현재 날짜 구하기
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
String dateTime = dateFormat.format(System.currentTimeMillis());
|
|
|
|
|
|
|
|
|
|
ArrayList<CellDef> cellDefs = fromJson(req.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
|
|
|
|
|
|
|
|
|
|
XLSWriter xlsx = new XLSWriter()
|
|
|
|
|
.setFilename("우편통합 접수결과 목록.xlsx")
|
|
|
|
|
.setFilename("우편통합접수결과" + "_목록_" + dateTime + ".xlsx")
|
|
|
|
|
.worksheet(0);
|
|
|
|
|
|
|
|
|
|
CellStyle center = xlsx.cellStyle(Styler.CENTER) // 가운데 정렬
|
|
|
|
|
, numeric = xlsx.n_nn0() // 숫자 3자리 콤마(,)
|
|
|
|
|
, dateYMD = xlsx.yyyy_mm_dd() // 연월일
|
|
|
|
|
, dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간
|
|
|
|
|
// CellStyle 지정은 여기에서..
|
|
|
|
|
CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬
|
|
|
|
|
CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,)
|
|
|
|
|
CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일
|
|
|
|
|
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간
|
|
|
|
|
|
|
|
|
|
String[] excelTitle = req.getExcelTitle();
|
|
|
|
|
List<String> titles = new ArrayList<String>();
|
|
|
|
|
for (int iLoop = 0; iLoop < excelTitle.length; iLoop++) {
|
|
|
|
|
String item = excelTitle[iLoop];
|
|
|
|
|
titles.add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int[] excelTitleWidth = req.getExcelTitleWidth();
|
|
|
|
|
List<Integer> widths = new ArrayList<>();
|
|
|
|
|
for (int jLoop = 0; jLoop < excelTitleWidth.length; jLoop++) {
|
|
|
|
|
int item = excelTitleWidth[jLoop];
|
|
|
|
|
widths.add(item);
|
|
|
|
|
}
|
|
|
|
|
List<DataObject> list = epostRcptRsltService.getEpostRcptRsltList(req.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx);
|
|
|
|
|
CellDef.setValues(cellDefs, Map.ofEntries(
|
|
|
|
|
Map.entry("발송자료키", xlsx.style("RELETCDATA", center))
|
|
|
|
|
, Map.entry("우편물코드", xlsx.style("JOB_CD", center))
|
|
|
|
|
, Map.entry("우편물종류", xlsx.style("JOB_CD3_NM", center))
|
|
|
|
|
, Map.entry("발송일자", xlsx.format(o -> xlsx.str2date(o.get("EXTRI_REGYMD"))).style(dateYMD))
|
|
|
|
|
, Map.entry("접수일자", xlsx.format(o -> xlsx.str2date(o.get("RCEPT_YMD"))).style(dateYMD))
|
|
|
|
|
, Map.entry("취급구분", xlsx.style("DIV_KB_NM", center))
|
|
|
|
|
, Map.entry("발송건수", xlsx.style("RCEPT_CNT", numeric))
|
|
|
|
|
, Map.entry("결제금액", xlsx.style("RCEPT_AMT", numeric))
|
|
|
|
|
, Map.entry("제작수수료", xlsx.style("USEFEE_AMT", numeric))
|
|
|
|
|
, Map.entry("우편요금", xlsx.style("TOTPOST_PRC", numeric))
|
|
|
|
|
, Map.entry("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT))
|
|
|
|
|
, Map.entry("등록사용자", xlsx.style("RGTR_NM", center))
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
xlsx.cell(0, 0)
|
|
|
|
|
.value("우편통합 접수결과", XLSWriter.Styler.CENTER)
|
|
|
|
|
.merge(0, 11)
|
|
|
|
|
.value("우편통합 접수결과", center)
|
|
|
|
|
.merge(0, cellDefs.size() - 1)
|
|
|
|
|
.cell(3, 0)
|
|
|
|
|
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers));
|
|
|
|
|
|
|
|
|
|
List<DataObject> list = epostRcptRsltService.getEpostRcptRsltList(req.setFetchSize(0));
|
|
|
|
|
|
|
|
|
|
BiFunction<String, String, ?> getValue = (titleNm, nothing) -> {
|
|
|
|
|
switch (titleNm) {
|
|
|
|
|
case "발송자료키" : return xlsx.style("RELETCDATA", center);
|
|
|
|
|
case "우편물코드" : return xlsx.style("JOB_CD", center);
|
|
|
|
|
case "우편물종류" : return xlsx.style("JOB_CD3_NM", center);
|
|
|
|
|
case "발송일자" : return xlsx.format(r -> xlsx.str2date(r.get("EXTRI_REGYMD"))).style(dateYMD);
|
|
|
|
|
case "접수일자" : return xlsx.format(r -> xlsx.str2date(r.get("RCEPT_YMD"))).style(dateYMD);
|
|
|
|
|
case "취급구분" : return xlsx.style("DIV_KB_NM", center);
|
|
|
|
|
case "발송건수" : return xlsx.style("RCEPT_CNT", numeric);
|
|
|
|
|
case "결제금액" : return xlsx.style("RCEPT_AMT", numeric);
|
|
|
|
|
case "제작수수료" : return xlsx.style("USEFEE_AMT", numeric);
|
|
|
|
|
case "우편요금" : return xlsx.style("TOTPOST_PRC", numeric);
|
|
|
|
|
case "등록일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT);
|
|
|
|
|
case "등록사용자" : return xlsx.style("RGTR_NM", center);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xlsx.cell(4, 0)
|
|
|
|
|
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
|
|
|
|
|
.rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
|
|
|
|
|
.cell(4, 0)
|
|
|
|
|
.values(list, CellDef.values(cellDefs));
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("xlsView")
|
|
|
|
|
.addObject("xls", xlsx);
|
|
|
|
@ -623,47 +572,4 @@ public class Epst02Controller extends ApplicationController {
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**전자우편 접수 결과를 등록한다.
|
|
|
|
|
* @param epostRcptRslt 전자우편 접수 결과 정보
|
|
|
|
|
* @return jsonView
|
|
|
|
|
* <pre><code> {
|
|
|
|
|
* "saved": 등록되었으면 true, 그렇지 않으면 false
|
|
|
|
|
* }</code></pre>
|
|
|
|
|
*/
|
|
|
|
|
// @PostMapping(name = "전자우편 접수 결과 등록", value = "/create.do")
|
|
|
|
|
public ModelAndView create(EpostRcptRslt epostRcptRslt) {
|
|
|
|
|
boolean saved = epostRcptRsltService.create(epostRcptRslt);
|
|
|
|
|
return new ModelAndView("jsonView")
|
|
|
|
|
.addObject("saved", saved);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**전자우편 접수 결과 정보를 수정한다.
|
|
|
|
|
* @param epostRcptRslt 전자우편 접수 결과 정보
|
|
|
|
|
* @return jsonView
|
|
|
|
|
* <pre><code> {
|
|
|
|
|
* "saved": 수정되었으면 true, 그렇지 않으면 false
|
|
|
|
|
* }</code></pre>
|
|
|
|
|
*/
|
|
|
|
|
// @PostMapping(name = "전자우편 접수 결과 수정", value = "/update.do")
|
|
|
|
|
public ModelAndView update(EpostRcptRslt epostRcptRslt) {
|
|
|
|
|
boolean saved = epostRcptRsltService.update(epostRcptRslt);
|
|
|
|
|
return new ModelAndView("jsonView")
|
|
|
|
|
.addObject("saved", saved);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**지정한 전자우편 접수 결과를 제거한다.
|
|
|
|
|
* @param epostRcptRsltIDs 전자우편 접수 결과 아이디
|
|
|
|
|
* @return jsonView
|
|
|
|
|
* <pre><code> {
|
|
|
|
|
* "affected": 저장된 정보수
|
|
|
|
|
* "saved": 저장되었으면 true, 그렇지 않으면 false
|
|
|
|
|
* }</code></pre>
|
|
|
|
|
*/
|
|
|
|
|
// @PostMapping(name = "전자우편 접수 결과 제거", value = "/remove.do")
|
|
|
|
|
public ModelAndView remove(EpostRcptRslt epostRcptRslt) {
|
|
|
|
|
boolean saved = epostRcptRsltService.remove(epostRcptRslt);
|
|
|
|
|
return new ModelAndView("jsonView")
|
|
|
|
|
.addObject("saved", saved);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|