fix: 엑셀 다운로드 반영

dev
Jonguk. Lim 4 months ago
parent ee024ee543
commit d238af94c9

@ -8,6 +8,7 @@ import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -368,13 +369,13 @@ public class AddsNimsController extends ApplicationController {
Map<String, Object> valueMap = new HashMap<>();
valueMap.put("관할관청", format.of("dept_nm").style(center));
valueMap.put("대마", a_slash_ab(format, "대마", "Qy").style(numeric));
valueMap.put("대마", a_slash_ab(format, "대마", "Qy").style(right));
valueMap.put("마약", a_slash_ab(format, "마약", "Qy").style(right));
valueMap.put("한외마약", a_slash_ab(format, "한외마약", "Qy").style(right));
valueMap.put("향정", a_slash_ab(format, "향정", "Qy").style(right));
valueMap.put("향정제외", a_slash_ab(format, "향정제외", "Qy").style(right));
valueMap.put("기타", a_slash_ab(format, "기타", "Qy").style(right));
valueMap.put("마약향정계", a_slash_ab(format, "마약향정계", "Qy").style(right));
valueMap.put("마약향정계", a_slash_ab(format, "마약향정계", "Qy").style(numeric));
valueMap.put("비마약류", a_slash_ab(format, "비마약류", "Qy").style(right));
valueMap.put("일반관리대상", a_slash_ab(format, "일반관리대상", "Qy").style(right));
valueMap.put("중점관리대상", a_slash_ab(format, "중점관리대상", "Qy").style(right));
@ -390,8 +391,8 @@ public class AddsNimsController extends ApplicationController {
});
xlsx.cell(0, 0).value("마약류 제품 구분별 현황").value(center).merge(0, cellDefs.size()-1);
xlsx.cell(2, 1).value("마약/향정 구분").value(headerStyle2).merge(1, 7);
xlsx.cell(2, 8).value("중점/일반 구분").value(headerStyle2).merge(8, 11);
xlsx.cell(2, 1).value("마약/향정 구분(폐기건수 / 폐기수량)").value(headerStyle2).merge(1, 7);
xlsx.cell(2, 8).value("중점/일반 구분(폐기건수 / 폐기수량)").value(headerStyle2).merge(8, 11);
xlsx.cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx)));
xlsx.cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList()));
@ -1021,9 +1022,12 @@ public class AddsNimsController extends ApplicationController {
private static Format a_slash_ab(Format format, String a, String b) {
return format.of(a).value((o) -> {
//return ((Map<?,?>)o).get(a) + " / " + ((Map<?,?>)o).get(a + b);
Number aa = (Number)((Map<?,?>)o).get(a);
Number bb = (Number)((Map<?,?>)o).get(a + b);
return aa.intValue() + " / " + bb.intValue();
//return aa.intValue() + " / " + bb.intValue();
NumberFormat nf = NumberFormat.getInstance();
return nf.format(aa.intValue()) + " / " + nf.format(bb.intValue());
});
}
//-------------------------------------------------------------------------------------------------

@ -164,6 +164,8 @@
, dataGetter: obj => obj.${infoPrefix}List
, appendData: true
, infoSize: "xl"
, formats: {
}
});
// $P.control 설정
$P.control.defaultFetchSize = FETCH_XXS; // 1 페이지당 조회되는 자료 건수 index.jsp에서 확인 FETCH_XS = 30
@ -297,7 +299,7 @@
// DataTables(그리드)
let cellDefs = getCellDefs(
$("#theadTr0--${pageName} th, #theadTr--${pageName} th")
.not(".dummy-th").not(":eq(0)").not("[colspan]"),
.not(".dummy-th").not("[colspan]"),
$($("#${infoPrefix}Row--${pageName}")[0].content).find("td")
.not(".dummy-td").not(":eq(0)").not("[colspan]"));
$P.control.query.cellDefs = cellDefs;

@ -171,6 +171,10 @@
, dataGetter: obj => obj.${infoPrefix}List
, appendData: true
, infoSize: "xl"
, formats: {
마약향정계: numberFormat
, 마약향정계Qy: numberFormat
}
});
// $P.control 설정
$P.control.defaultFetchSize = FETCH_XXS; // 1 페이지당 조회되는 자료 건수 index.jsp에서 확인 FETCH_XS = 30

Loading…
Cancel
Save