|
|
|
|
@ -2,6 +2,7 @@ package cokr.xit.fims.sndb.web;
|
|
|
|
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
@ -481,23 +482,34 @@ public class Sndb01Controller extends ApplicationController {
|
|
|
|
|
return new ModelAndView("downloadView")
|
|
|
|
|
.addObject("download", xlsx.getDownloadable().setFilename("계고장 발송상세" + "_목록_" + now() + ".xlsx"));
|
|
|
|
|
} else {
|
|
|
|
|
List<DataObject> sorted = list.stream()
|
|
|
|
|
.collect(Collectors.groupingBy(row -> row.string("RCPN_NM"))).entrySet().stream()
|
|
|
|
|
.map(entry -> {
|
|
|
|
|
List<DataObject> rows = entry.getValue();
|
|
|
|
|
DataObject first = rows.get(0).set("TNOCS", rows.size());
|
|
|
|
|
return first;
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toCollection(ArrayList::new));
|
|
|
|
|
sorted.sort(Comparator.comparing(row -> row.string("RCPN_NM")));
|
|
|
|
|
|
|
|
|
|
try (InputStream input = new ClassPathResource("template/" + template).getInputStream()) {
|
|
|
|
|
int rowIndex = 1;
|
|
|
|
|
XLSWriter xlsx = new XLSWriter().template(input).worksheet(0);
|
|
|
|
|
|
|
|
|
|
for (DataObject row: list) {
|
|
|
|
|
for (DataObject row: sorted) {
|
|
|
|
|
xlsx.cell(rowIndex, 0)
|
|
|
|
|
.rowValues(List.of("보통", "환부", "규격", 25))
|
|
|
|
|
.cell(rowIndex, 4)
|
|
|
|
|
.rowValues(List.of("규격", 25)) // 규격, 중량
|
|
|
|
|
.cell(rowIndex, 2)
|
|
|
|
|
.rowValues(List.of(
|
|
|
|
|
row.get("RCPN_NM"),
|
|
|
|
|
row.get("RCPN_ZIP"),
|
|
|
|
|
row.get("RCPN_ADDR"),
|
|
|
|
|
row.get("RCPN_DTL_ADDR"),
|
|
|
|
|
ifEmpty(row.get("RTPYR_MBL_TELNO"), () -> row.get("RTPYR_TELNO")),
|
|
|
|
|
row.get("SNDNG_DTL_ID"),
|
|
|
|
|
row.get("TTL_NM"),
|
|
|
|
|
row.get("ETC_CN")
|
|
|
|
|
ifEmpty(row.get("TNOCS"), () -> 0), // 통수
|
|
|
|
|
row.get("RCPN_NM"), // 수취인
|
|
|
|
|
row.get("RCPN_ZIP"), // 우편번호
|
|
|
|
|
row.get("RCPN_ADDR"), // 기본주소
|
|
|
|
|
row.get("RCPN_DTL_ADDR"), // 상세주소
|
|
|
|
|
blankIfEmpty(row.get("RTPYR_MBL_TELNO")), // 휴대폰
|
|
|
|
|
row.get("SNDNG_DTL_ID"), // 문서번호 <- 발송상세아이디
|
|
|
|
|
row.get("TTL_NM"), // 문서제목
|
|
|
|
|
blankIfEmpty(row.get("ETC_CN")) // 비고
|
|
|
|
|
));
|
|
|
|
|
++rowIndex;
|
|
|
|
|
}
|
|
|
|
|
|