|
|
|
|
@ -2,7 +2,6 @@ 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;
|
|
|
|
|
@ -482,26 +481,15 @@ 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: sorted) {
|
|
|
|
|
for (DataObject row: list) {
|
|
|
|
|
xlsx.cell(rowIndex, 0)
|
|
|
|
|
.rowValues(List.of("규격", 25)) // 규격, 중량
|
|
|
|
|
.cell(rowIndex, 2)
|
|
|
|
|
.rowValues(List.of("규격", 25, 1)) // 규격, 중량, 통수
|
|
|
|
|
.cell(rowIndex, 3)
|
|
|
|
|
.rowValues(List.of(
|
|
|
|
|
ifEmpty(row.get("TNOCS"), () -> 0), // 통수
|
|
|
|
|
row.get("RCPN_NM"), // 수취인
|
|
|
|
|
row.get("RCPN_ZIP"), // 우편번호
|
|
|
|
|
row.get("RCPN_ADDR"), // 기본주소
|
|
|
|
|
|