diff --git a/src/main/java/cokr/xit/adds/nims/dao/DsuseMgtStatisticsMapper.java b/src/main/java/cokr/xit/adds/nims/dao/DsuseMgtStatisticsMapper.java index 1501f52..08dea16 100644 --- a/src/main/java/cokr/xit/adds/nims/dao/DsuseMgtStatisticsMapper.java +++ b/src/main/java/cokr/xit/adds/nims/dao/DsuseMgtStatisticsMapper.java @@ -27,7 +27,13 @@ public interface DsuseMgtStatisticsMapper extends AbstractMapper { List selectDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query); /** - * 취급자별별 폐기 현황 + * 취급자 업종별 폐기 현황 + * @return 취급자 업종별 폐기 현황 목록 + */ + List selectDsuseMgtDsuseQyByIndutyStatistics(DsuseMgtStatisticsQuery query); + + /** + * 취급자별 폐기 현황 * @return 취급자별 폐기 현황 목록 */ List selectDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query); diff --git a/src/main/java/cokr/xit/adds/nims/service/AddsNimsService.java b/src/main/java/cokr/xit/adds/nims/service/AddsNimsService.java index 2668749..f7e4b57 100644 --- a/src/main/java/cokr/xit/adds/nims/service/AddsNimsService.java +++ b/src/main/java/cokr/xit/adds/nims/service/AddsNimsService.java @@ -13,5 +13,6 @@ public interface AddsNimsService { List getDsuseMgtNcrdAndPrtmStatistics(DsuseMgtStatisticsQuery query); List getDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query); + List getDsuseMgtDsuseQyByIndutyStatistics(DsuseMgtStatisticsQuery query); List getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query); } diff --git a/src/main/java/cokr/xit/adds/nims/service/bean/AddsNimsServiceBean.java b/src/main/java/cokr/xit/adds/nims/service/bean/AddsNimsServiceBean.java index d52016b..f4f6fb6 100644 --- a/src/main/java/cokr/xit/adds/nims/service/bean/AddsNimsServiceBean.java +++ b/src/main/java/cokr/xit/adds/nims/service/bean/AddsNimsServiceBean.java @@ -48,6 +48,11 @@ public class AddsNimsServiceBean extends AbstractServiceBean implements AddsNims return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByPrdStatistics(query); } + @Override + public List getDsuseMgtDsuseQyByIndutyStatistics(DsuseMgtStatisticsQuery query) { + return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByIndutyStatistics(query); + } + @Override public List getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query) { return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByBsshStatistics(query); diff --git a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java index e77cf59..284e936 100644 --- a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java +++ b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java @@ -372,11 +372,11 @@ public class AddsNimsController extends ApplicationController { 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); @@ -387,14 +387,14 @@ public class AddsNimsController extends ApplicationController { styl.alignment(HorizontalAlignment.CENTER); }); - xlsx.cell(0, 0).value("마약류 구분별 현황").value(center).merge(0, cellDefs.size()-1); + 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")); + mav.addObject("download", xlsx.getDownloadable().setFilename("마약류 제품 구분별 통계.xlsx")); return mav.addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList()); } @@ -448,6 +448,55 @@ public class AddsNimsController extends ApplicationController { return mav.addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList()); } + @RequestMapping(value = "/getDsuseMgtDsuseQyByIndutyStatistics.do", name="취급자 업종별 폐기 현황 통계") + public ModelAndView getDsuseMgtDsuseQyByIndutyStatistics(DsuseMgtStatisticsQuery query) { + if(!"xls".equals(query.getDownload())) { + return setCollectionInfo(new ModelAndView("jsonView"), + addsNimsService.getDsuseMgtDsuseQyByIndutyStatistics(query), "", ""); + } + List 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 list = addsNimsService.getDsuseMgtDsuseQyByIndutyStatistics(query); + + Map valueMap = new HashMap(); + 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()); + } + @RequestMapping(value = "/getDsuseMgtDsuseQyByBsshStatistics.do", name="취급자별 폐기 현황 통계") public ModelAndView getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query) { if(!"xls".equals(query.getDownload())) { @@ -578,6 +627,16 @@ public class AddsNimsController extends ApplicationController { return mav.addObject("pageName", "dsuseMgtDsuseQyByPrdStatistics") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */; } + @RequestMapping(value = "/dsuseMgtDsuseQyByIndutyStatistics.do", name="마약류 취급자 업종별 폐기 현황 메인") + public ModelAndView dsuseMgtDsuseQyByIndutyStatistics() { + ModelAndView mav = new ModelAndView("adds/nims/dsuseMgtDsuseQyByIndutyStatistics-main"); + setCmmCode("ADDS11", mav); + List deptList = sggDeptService.getDepartmentList(new DepartmentQuery()); + mav.addObject("DEPTList", deptList); + + return mav.addObject("pageName", "dsuseMgtDsuseQyByIndutyStatistics") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */; + } + @RequestMapping(value = "/dsuseMgtDsuseQyByBsshStatistics.do", name="마약류 취급자별 폐기 현황 메인") public ModelAndView dsuseMgtDsuseQyByBsshStatistics() { ModelAndView mav = new ModelAndView("adds/nims/dsuseMgtDsuseQyByBsshStatistics-main"); diff --git a/src/main/resources/sql/mapper/adds/nims/dsuseMgtStatistics-mapper.xml b/src/main/resources/sql/mapper/adds/nims/dsuseMgtStatistics-mapper.xml index e5ce69b..02369a9 100644 --- a/src/main/resources/sql/mapper/adds/nims/dsuseMgtStatistics-mapper.xml +++ b/src/main/resources/sql/mapper/adds/nims/dsuseMgtStatistics-mapper.xml @@ -103,7 +103,7 @@ ) SELECT T.* -- , ROW_NUMBER() over (order by prduct_nm) AS ROW_NUM - , ROW_NUMBER() OVER (ORDER BY T.dept_cd, T.prduct_nm) AS ROW_NUM + , ROW_NUMBER() OVER (ORDER BY T.dept_cd, T.prduct_nm, T.prduct_cd) AS ROW_NUM , IF(td.dept_nm IS NULL, T.dept_cd, dept_nm) AS dept_nm FROM ( SELECT tgt.dept_cd @@ -133,8 +133,8 @@ ON T.dept_cd = td.dept_cd - + /* 마약류취급자 업종별 폐기 현황 */ WITH tgt AS ( SELECT tdm.bssh_cd , tbi.bssh_nm @@ -202,4 +202,70 @@ LEFT JOIN tb_dept td ON T.dept_cd = td.dept_cd + + diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtDsuseQyByBsshStatistics-main.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtDsuseQyByBsshStatistics-main.jsp index ffd82aa..9f3445f 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtDsuseQyByBsshStatistics-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtDsuseQyByBsshStatistics-main.jsp @@ -1,6 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> -폐기 보고 확인 +마약류 취급자별 현황