|
|
|
@ -19,6 +19,10 @@ import java.util.stream.IntStream;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
import org.apache.poi.hssf.util.HSSFColor;
|
|
|
|
|
import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Font;
|
|
|
|
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
|
|
|
|
import org.json.simple.JSONObject;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
@ -49,7 +53,12 @@ import cokr.xit.adds.nims.service.DsuseMgtDocService;
|
|
|
|
|
import cokr.xit.adds.nims.service.DsuseMgtReceiptService;
|
|
|
|
|
import cokr.xit.applib.Print;
|
|
|
|
|
import cokr.xit.applib.PrintOption;
|
|
|
|
|
import cokr.xit.applib.xls.StyleMaker;
|
|
|
|
|
import cokr.xit.base.code.CommonCode;
|
|
|
|
|
import cokr.xit.base.docs.xls.CellDef;
|
|
|
|
|
import cokr.xit.base.docs.xls.Format;
|
|
|
|
|
import cokr.xit.base.docs.xls.Style;
|
|
|
|
|
import cokr.xit.base.docs.xls.XLSWriter;
|
|
|
|
|
import cokr.xit.base.file.FileInfo;
|
|
|
|
|
import cokr.xit.base.file.FileInfo.Relation;
|
|
|
|
|
import cokr.xit.base.file.service.FileQuery;
|
|
|
|
@ -344,7 +353,48 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
public ModelAndView getDsuseMgtNcrdAndPrtmStatistics(DsuseMgtStatisticsQuery query) {
|
|
|
|
|
//query.setOrderBy("dsuse_de DESC, dsuse_mth_cd, dscdmng_id");
|
|
|
|
|
//setFetchSize(query);
|
|
|
|
|
|
|
|
|
|
if("xls".equals(query.getDownload())) {
|
|
|
|
|
List<CellDef> cellDefs = fromJson(query.getCellDefs(), CellDef.listType());
|
|
|
|
|
XLSWriter xlsx = new XLSWriter().worksheet(0);
|
|
|
|
|
Format format = new Format(xlsx);
|
|
|
|
|
CellStyle center = format.cellStyle(Style.CENTER);
|
|
|
|
|
CellStyle numeric = format.n_nn0();
|
|
|
|
|
|
|
|
|
|
List<DataObject> list = addsNimsService.getDsuseMgtNcrdAndPrtmStatistics(query);
|
|
|
|
|
|
|
|
|
|
Map<String, Object> valueMap = new HashMap<String, Object>();
|
|
|
|
|
valueMap.put("관할관청", format.of("dept_nm").style(center));
|
|
|
|
|
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));
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
CellDef.setValues(cellDefs, valueMap);
|
|
|
|
|
|
|
|
|
|
Style headerStyle2 = new Style().foregroundColor(HSSFColor.HSSFColorPredefined.GREY_50_PERCENT.getIndex())
|
|
|
|
|
.configure(styl -> {
|
|
|
|
|
Font font = xlsx.workbook().createFont();
|
|
|
|
|
font.setColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
|
|
|
|
|
styl.alignment(HorizontalAlignment.CENTER);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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(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()));
|
|
|
|
|
|
|
|
|
|
ModelAndView mav = new ModelAndView("downloadView");
|
|
|
|
|
mav.addObject("download", xlsx.getDownloadable().setFilename("폐기보고 통계.xlsx"));
|
|
|
|
|
return mav.addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList());
|
|
|
|
|
}
|
|
|
|
|
return setCollectionInfo(new ModelAndView("jsonView"), addsNimsService.getDsuseMgtNcrdAndPrtmStatistics(query),"","");
|
|
|
|
|
// return addsNimsService.getDsuseMgtNcrdAndPrtmStatistics(query);
|
|
|
|
|
}
|
|
|
|
|