fix: 엑셀 다운로드 반영

dev
Jonguk. Lim 4 months ago
parent 93575a9499
commit ee024ee543

@ -1,16 +0,0 @@
package cokr.xit.adds.cmmn.xls;
import java.util.Map;
import cokr.xit.base.docs.xls.Format;
public class FormatMaker {
@SuppressWarnings("rawtypes")
public 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);
});
}
}

@ -361,23 +361,24 @@ public class AddsNimsController extends ApplicationController {
XLSWriter xlsx = new XLSWriter().worksheet(0); XLSWriter xlsx = new XLSWriter().worksheet(0);
Format format = new Format(xlsx); Format format = new Format(xlsx);
CellStyle center = format.cellStyle(Style.CENTER); CellStyle center = format.cellStyle(Style.CENTER);
CellStyle right = format.cellStyle(Style.RIGHT);
CellStyle numeric = format.n_nn0(); CellStyle numeric = format.n_nn0();
List<DataObject> list = addsNimsService.getDsuseMgtNcrdAndPrtmStatistics(query); List<DataObject> list = addsNimsService.getDsuseMgtNcrdAndPrtmStatistics(query);
Map<String, Object> valueMap = new HashMap<String, Object>(); Map<String, Object> valueMap = new HashMap<>();
valueMap.put("관할관청", format.of("dept_nm").style(center)); valueMap.put("관할관청", format.of("dept_nm").style(center));
valueMap.put("대마", format.of("대마").style(numeric)); valueMap.put("대마", a_slash_ab(format, "대마", "Qy").style(numeric));
valueMap.put("마약", format.of("마약").style(numeric)); valueMap.put("마약", a_slash_ab(format, "마약", "Qy").style(right));
valueMap.put("한외마약", format.of("한외마약").style(numeric)); valueMap.put("한외마약", a_slash_ab(format, "한외마약", "Qy").style(right));
valueMap.put("향정", format.of("향정").style(numeric)); valueMap.put("향정", a_slash_ab(format, "향정", "Qy").style(right));
valueMap.put("향정제외", format.of("향정제외").style(numeric)); valueMap.put("향정제외", a_slash_ab(format, "향정제외", "Qy").style(right));
valueMap.put("기타", format.of("기타").style(numeric)); valueMap.put("기타", a_slash_ab(format, "기타", "Qy").style(right));
valueMap.put("마약향정 계", format.of("마약향정계").style(numeric)); valueMap.put("마약향정계", a_slash_ab(format, "마약향정계", "Qy").style(right));
valueMap.put("비마약류", format.of("비마약류").style(numeric)); valueMap.put("비마약류", a_slash_ab(format, "비마약류", "Qy").style(right));
valueMap.put("일반관리대상", format.of("일반관리대상").style(numeric)); valueMap.put("일반관리대상", a_slash_ab(format, "일반관리대상", "Qy").style(right));
valueMap.put("중점관리대상", format.of("중점관리대상").style(numeric)); valueMap.put("중점관리대상", a_slash_ab(format, "중점관리대상", "Qy").style(right));
valueMap.put("중점일반 계", format.of("중점일반계").style(numeric)); valueMap.put("중점일반계", a_slash_ab(format, "중점일반계", "Qy").style(right));
CellDef.setValues(cellDefs, valueMap); CellDef.setValues(cellDefs, valueMap);
@ -416,7 +417,7 @@ public class AddsNimsController extends ApplicationController {
Map<String, Object> valueMap = new HashMap<String, Object>(); Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("관할관청", format.of("dept_nm").style(center)); valueMap.put("관할관청", format.of("dept_nm").style(center));
valueMap.put("대마", format.of("대마").style(numeric)); valueMap.put("제품코드", format.of("prduct_cd").style(numeric));
valueMap.put("마약", format.of("마약").style(numeric)); valueMap.put("마약", format.of("마약").style(numeric));
valueMap.put("한외마약", format.of("한외마약").style(numeric)); valueMap.put("한외마약", format.of("한외마약").style(numeric));
valueMap.put("향정", format.of("향정").style(numeric)); valueMap.put("향정", format.of("향정").style(numeric));
@ -1017,6 +1018,14 @@ public class AddsNimsController extends ApplicationController {
byteOut.write(("Content-Type: application/json; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8)); byteOut.write(("Content-Type: application/json; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8));
byteOut.write((dsuseMgtJsonStr + lineSeparator).getBytes(StandardCharsets.UTF_8)); byteOut.write((dsuseMgtJsonStr + lineSeparator).getBytes(StandardCharsets.UTF_8));
} }
private static Format a_slash_ab(Format format, String a, String b) {
return format.of(a).value((o) -> {
Number aa = (Number)((Map<?,?>)o).get(a);
Number bb = (Number)((Map<?,?>)o).get(a + b);
return aa.intValue() + " / " + bb.intValue();
});
}
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
// private method // private method
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------

@ -98,11 +98,11 @@
<th class="cmn" style="width: 90px;">향정</th> <th class="cmn" style="width: 90px;">향정</th>
<th class="cmn" style="width: 90px;">향정제외</th> <th class="cmn" style="width: 90px;">향정제외</th>
<th class="cmn" style="width: 90px;">기타</th> <th class="cmn" style="width: 90px;">기타</th>
<th class="cmn text-blue" style="width: 90px;">계</th> <th class="cmn text-blue" style="width: 90px;">마약향정계</th>
<th class="cmn" style="width: 90px;">비마약류</th> <th class="cmn" style="width: 90px;">비마약류</th>
<th class="cmn" style="width: 120px;">일반관리대상</th> <th class="cmn" style="width: 120px;">일반관리대상</th>
<th class="cmn" style="width: 120px;">중점관리대상</th> <th class="cmn" style="width: 120px;">중점관리대상</th>
<th class="cmn text-blue" style="width: 90px;">계</th> <th class="cmn text-blue" style="width: 90px;">중점일반계</th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody--${pageName}"> <tbody id="tbody--${pageName}">
@ -314,11 +314,10 @@
// DataTables(그리드) // DataTables(그리드)
let cellDefs = getCellDefs( let cellDefs = getCellDefs(
$("#theadTr0--${pageName} th, #theadTr--${pageName} th") $("#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") $($("#${infoPrefix}Row--${pageName}")[0].content).find("td")
.not(".dummy-td").not(":eq(0)").not("[colspan]")); .not(".dummy-td").not(":eq(0)").not("[colspan]"));
debugger console.table("cellDefs", cellDefs);
debug.log("cellDefs", cellDefs);
$P.control.query.cellDefs = cellDefs; $P.control.query.cellDefs = cellDefs;
$P.control.download(); $P.control.download();

Loading…
Cancel
Save