From 096e174f6b83b3b5e2dbc947f07867d617f1804c Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Tue, 23 Jul 2024 18:03:49 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=8F=90=EA=B8=B0=EB=B3=B4=EA=B3=A0?= =?UTF-8?q?=ED=86=B5=EA=B3=84=20-=20=EB=A7=88=EC=95=BD=EB=A5=98=EA=B5=AC?= =?UTF-8?q?=EB=B6=84=EB=B3=84=ED=86=B5=EA=B3=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nims/dao/DsuseMgtStatisticsMapper.java | 8 +- .../adds/nims/service/AddsNimsService.java | 1 + .../service/bean/AddsNimsServiceBean.java | 5 + .../xit/adds/nims/web/AddsNimsController.java | 61 ++- .../adds/nims/dsuseMgtStatistics-mapper.xml | 175 +++++--- .../dsuseMgtDsuseQyByBsshStatistics-main.jsp | 381 ++++++++++++++++++ 6 files changed, 577 insertions(+), 54 deletions(-) create mode 100644 src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtDsuseQyByBsshStatistics-main.jsp 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 e110755..1501f52 100644 --- a/src/main/java/cokr/xit/adds/nims/dao/DsuseMgtStatisticsMapper.java +++ b/src/main/java/cokr/xit/adds/nims/dao/DsuseMgtStatisticsMapper.java @@ -22,8 +22,14 @@ public interface DsuseMgtStatisticsMapper extends AbstractMapper { /** * 제품별 폐기 현황 - * @return 마약/항정 and 중점/일반 별 통계 목록 + * @return 제품별 폐기 현황 목록 */ List selectDsuseMgtDsuseQyByPrdStatistics(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 f960eb0..2668749 100644 --- a/src/main/java/cokr/xit/adds/nims/service/AddsNimsService.java +++ b/src/main/java/cokr/xit/adds/nims/service/AddsNimsService.java @@ -13,4 +13,5 @@ public interface AddsNimsService { List getDsuseMgtNcrdAndPrtmStatistics(DsuseMgtStatisticsQuery query); List getDsuseMgtDsuseQyByPrdStatistics(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 30ecb67..d52016b 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 @@ -47,4 +47,9 @@ public class AddsNimsServiceBean extends AbstractServiceBean implements AddsNims public List getDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query) { return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByPrdStatistics(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 f49fdeb..e77cf59 100644 --- a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java +++ b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java @@ -443,7 +443,56 @@ public class AddsNimsController extends ApplicationController { 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()); + } + + @RequestMapping(value = "/getDsuseMgtDsuseQyByBsshStatistics.do", name="취급자별 폐기 현황 통계") + public ModelAndView getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query) { + if(!"xls".equals(query.getDownload())) { + return setCollectionInfo(new ModelAndView("jsonView"), + addsNimsService.getDsuseMgtDsuseQyByBsshStatistics(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.getDsuseMgtDsuseQyByBsshStatistics(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()); } @@ -528,6 +577,16 @@ public class AddsNimsController extends ApplicationController { return mav.addObject("pageName", "dsuseMgtDsuseQyByPrdStatistics") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */; } + + @RequestMapping(value = "/dsuseMgtDsuseQyByBsshStatistics.do", name="마약류 취급자별 폐기 현황 메인") + public ModelAndView dsuseMgtDsuseQyByBsshStatistics() { + ModelAndView mav = new ModelAndView("adds/nims/dsuseMgtDsuseQyByBsshStatistics-main"); + setCmmCode("ADDS11", mav); + List deptList = sggDeptService.getDepartmentList(new DepartmentQuery()); + mav.addObject("DEPTList", deptList); + + return mav.addObject("pageName", "dsuseMgtDsuseQyByBsshStatistics") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */; + } //------------------------------------------------------------------------------------------------- // menu 호출 처리 //------------------------------------------------------------------------------------------------- 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 61a071b..e5ce69b 100644 --- a/src/main/resources/sql/mapper/adds/nims/dsuseMgtStatistics-mapper.xml +++ b/src/main/resources/sql/mapper/adds/nims/dsuseMgtStatistics-mapper.xml @@ -6,15 +6,15 @@ /* 마약/항정 and 중점/일반 별 통계 */ WITH tgt AS ( SELECT tdm.dept_cd - , IF(tpi.nrcd_se_nm = '대마', '1', '0') AS '대마' - , IF(tpi.nrcd_se_nm = '마약', '1', '0') AS '마약' - , IF(tpi.nrcd_se_nm = '한외마약', '1', '0') AS '한외마약' - , IF(tpi.nrcd_se_nm = '향정', '1', '0') AS '향정' - , IF(tpi.nrcd_se_nm = '향정제외', '1', '0') AS '향정제외' - , IF(tpi.nrcd_se_nm IS NULL, '1', '0') AS '기타' - , IF(tpi.prtm_se_nm = '비마약류', 1, 0) AS '비마약류' - , IF(tpi.prtm_se_nm = '일반관리대상', 1, 0) AS '일반관리대상' - , IF(tpi.prtm_se_nm = '중점관리대상', 1, 0) AS '중점관리대상' + , IF(tpi.nrcd_se_nm = '대마', '1', '0') AS 대마 + , IF(tpi.nrcd_se_nm = '마약', '1', '0') AS 마약 + , IF(tpi.nrcd_se_nm = '한외마약', '1', '0') AS 한외마약 + , IF(tpi.nrcd_se_nm = '향정', '1', '0') AS 향정 + , IF(tpi.nrcd_se_nm = '향정제외', '1', '0') AS 향정제외 + , IF(tpi.nrcd_se_nm IS NULL, '1', '0') AS 기타 + , IF(tpi.prtm_se_nm = '비마약류', 1, 0) AS 비마약류 + , IF(tpi.prtm_se_nm = '일반관리대상', 1, 0) AS 일반관리대상 + , IF(tpi.prtm_se_nm = '중점관리대상', 1, 0) AS 중점관리대상 , COUNT(tpi.prduct_cd) OVER(PARTITION BY tdm.dept_cd) AS TOTAL FROM tb_dsuse_mgt tdm JOIN tb_dsuse_mgt_dtl tdmd ON tdm.dscdmng_id = tdmd.dscdmng_id @@ -36,37 +36,38 @@ SELECT T.* , ROW_NUMBER() over (ORDER BY T.dept_cd) AS ROW_NUM , IF(td.dept_nm IS NULL, T.dept_cd, dept_nm) AS dept_nm - FROM (SELECT tgt.dept_cd - , SUM(tgt.대마) AS '대마' - , SUM(tgt.마약) AS '마약' - , SUM(tgt.한외마약) AS '한외마약' - , SUM(tgt.향정) AS '향정' - , SUM(tgt.향정제외) AS '향정제외' - , SUM(tgt.기타) AS '기타' - , SUM(tgt.대마 + tgt.마약 + tgt.한외마약 + tgt.향정 + tgt.향정제외 + tgt.기타) AS '마약향정계' - , SUM(tgt.비마약류) AS '비마약류' - , SUM(tgt.일반관리대상) AS '일반관리대상' - , SUM(tgt.중점관리대상) AS '중점관리대상' - , SUM(tgt.비마약류 + tgt.일반관리대상 + tgt.중점관리대상) AS '중점일반계' + FROM ( + SELECT tgt.dept_cd + , SUM(tgt.대마) AS 대마 + , SUM(tgt.마약) AS 마약 + , SUM(tgt.한외마약) AS 한외마약 + , SUM(tgt.향정) AS 향정 + , SUM(tgt.향정제외) AS 향정제외 + , SUM(tgt.기타) AS 기타 + , SUM(tgt.대마 + tgt.마약 + tgt.한외마약 + tgt.향정 + tgt.향정제외 + tgt.기타) AS 마약향정계 + , SUM(tgt.비마약류) AS 비마약류 + , SUM(tgt.일반관리대상) AS 일반관리대상 + , SUM(tgt.중점관리대상) AS 중점관리대상 + , SUM(tgt.비마약류 + tgt.일반관리대상 + tgt.중점관리대상) AS 중점일반계 FROM tgt GROUP BY tgt.dept_cd UNION ALL SELECT 'TOTAL' AS dept_cd - , SUM(tgt.대마) AS '대마' - , SUM(tgt.마약) AS '마약' - , SUM(tgt.한외마약) AS '한외마약' - , SUM(tgt.향정) AS '향정' - , SUM(tgt.향정제외) AS '향정제외' - , SUM(tgt.기타) AS '기타' - , SUM(tgt.대마 + tgt.마약 + tgt.한외마약 + tgt.향정 + tgt.향정제외 + tgt.기타) AS '마약향정계' - , SUM(tgt.비마약류) AS '비마약류' - , SUM(tgt.일반관리대상) AS '일반관리대상' - , SUM(tgt.중점관리대상) AS '중점관리대상' - , SUM(tgt.비마약류 + tgt.일반관리대상 + tgt.중점관리대상) AS '중점일반계' + , SUM(tgt.대마) AS 대마 + , SUM(tgt.마약) AS 마약 + , SUM(tgt.한외마약) AS 한외마약 + , SUM(tgt.향정) AS 향정 + , SUM(tgt.향정제외) AS 향정제외 + , SUM(tgt.기타) AS 기타 + , SUM(tgt.대마 + tgt.마약 + tgt.한외마약 + tgt.향정 + tgt.향정제외 + tgt.기타) AS 마약향정계 + , SUM(tgt.비마약류) AS 비마약류 + , SUM(tgt.일반관리대상) AS 일반관리대상 + , SUM(tgt.중점관리대상) AS 중점관리대상 + , SUM(tgt.비마약류 + tgt.일반관리대상 + tgt.중점관리대상) AS 중점일반계 FROM tgt - ) T - LEFT JOIN tb_dept td - ON T.dept_cd = td.dept_cd + ) T + 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 new file mode 100644 index 0000000..d1494cc --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtDsuseQyByBsshStatistics-main.jsp @@ -0,0 +1,381 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> +폐기 보고 확인 + +
+ +
+ +
+ +
+
+
+ +
+
+ +
+
+
+
+
+
+ + +
+ +
+ + +
+ + +
+ + +