fix: 폐기보고통계 - 마약류 업종별 폐기 현황 추가

dev
Jonguk. Lim 4 months ago
parent 15ff7d4e46
commit 2684ea2945

@ -27,7 +27,13 @@ public interface DsuseMgtStatisticsMapper extends AbstractMapper {
List<DataObject> selectDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query); List<DataObject> selectDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query);
/** /**
* *
* @return
*/
List<DataObject> selectDsuseMgtDsuseQyByIndutyStatistics(DsuseMgtStatisticsQuery query);
/**
*
* @return * @return
*/ */
List<DataObject> selectDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query); List<DataObject> selectDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query);

@ -13,5 +13,6 @@ public interface AddsNimsService {
List<DataObject> getDsuseMgtNcrdAndPrtmStatistics(DsuseMgtStatisticsQuery query); List<DataObject> getDsuseMgtNcrdAndPrtmStatistics(DsuseMgtStatisticsQuery query);
List<DataObject> getDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query); List<DataObject> getDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query);
List<DataObject> getDsuseMgtDsuseQyByIndutyStatistics(DsuseMgtStatisticsQuery query);
List<DataObject> getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query); List<DataObject> getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query);
} }

@ -48,6 +48,11 @@ public class AddsNimsServiceBean extends AbstractServiceBean implements AddsNims
return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByPrdStatistics(query); return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByPrdStatistics(query);
} }
@Override
public List<DataObject> getDsuseMgtDsuseQyByIndutyStatistics(DsuseMgtStatisticsQuery query) {
return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByIndutyStatistics(query);
}
@Override @Override
public List<DataObject> getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query) { public List<DataObject> getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query) {
return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByBsshStatistics(query); return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByBsshStatistics(query);

@ -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));
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); CellDef.setValues(cellDefs, valueMap);
@ -387,14 +387,14 @@ public class AddsNimsController extends ApplicationController {
styl.alignment(HorizontalAlignment.CENTER); 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, 1).value("마약/향정 구분").value(headerStyle2).merge(1, 7);
xlsx.cell(2, 8).value("중점/일반 구분").value(headerStyle2).merge(8, 11); xlsx.cell(2, 8).value("중점/일반 구분").value(headerStyle2).merge(8, 11);
xlsx.cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx))); 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())); 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"); 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()); 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()); 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<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.getDsuseMgtDsuseQyByIndutyStatistics(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());
}
@RequestMapping(value = "/getDsuseMgtDsuseQyByBsshStatistics.do", name="취급자별 폐기 현황 통계") @RequestMapping(value = "/getDsuseMgtDsuseQyByBsshStatistics.do", name="취급자별 폐기 현황 통계")
public ModelAndView getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query) { public ModelAndView getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query) {
if(!"xls".equals(query.getDownload())) { if(!"xls".equals(query.getDownload())) {
@ -578,6 +627,16 @@ public class AddsNimsController extends ApplicationController {
return mav.addObject("pageName", "dsuseMgtDsuseQyByPrdStatistics") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */; 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<DataObject> deptList = sggDeptService.getDepartmentList(new DepartmentQuery());
mav.addObject("DEPTList", deptList);
return mav.addObject("pageName", "dsuseMgtDsuseQyByIndutyStatistics") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */;
}
@RequestMapping(value = "/dsuseMgtDsuseQyByBsshStatistics.do", name="마약류 취급자별 폐기 현황 메인") @RequestMapping(value = "/dsuseMgtDsuseQyByBsshStatistics.do", name="마약류 취급자별 폐기 현황 메인")
public ModelAndView dsuseMgtDsuseQyByBsshStatistics() { public ModelAndView dsuseMgtDsuseQyByBsshStatistics() {
ModelAndView mav = new ModelAndView("adds/nims/dsuseMgtDsuseQyByBsshStatistics-main"); ModelAndView mav = new ModelAndView("adds/nims/dsuseMgtDsuseQyByBsshStatistics-main");

@ -103,7 +103,7 @@
) )
SELECT T.* SELECT T.*
-- , ROW_NUMBER() over (order by prduct_nm) AS ROW_NUM -- , 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 , IF(td.dept_nm IS NULL, T.dept_cd, dept_nm) AS dept_nm
FROM ( FROM (
SELECT tgt.dept_cd SELECT tgt.dept_cd
@ -133,8 +133,8 @@
ON T.dept_cd = td.dept_cd ON T.dept_cd = td.dept_cd
</select> </select>
<select id="selectDsuseMgtDsuseQyByBsshStatistics" parameterType="map" resultType="dataobject"> <select id="selectDsuseMgtDsuseQyByIndutyStatistics" parameterType="map" resultType="dataobject">
/* 마약류취급자 유형별 폐기 현황 */ /* 마약류취급자 업종별 폐기 현황 */
WITH tgt AS ( WITH tgt AS (
SELECT tdm.bssh_cd SELECT tdm.bssh_cd
, tbi.bssh_nm , tbi.bssh_nm
@ -202,4 +202,70 @@
LEFT JOIN tb_dept td LEFT JOIN tb_dept td
ON T.dept_cd = td.dept_cd ON T.dept_cd = td.dept_cd
</select> </select>
<select id="selectDsuseMgtDsuseQyByBsshStatistics" parameterType="map" resultType="dataobject">
/* 마약류취급자별 폐기 현황 */
WITH tgt AS (
SELECT tdm.bssh_cd
, tbi.bssh_nm
, tbi.induty_nm
, tbi.rprsntv_nm
, tdm.dscdmng_id
, tdm.dept_cd
, tdmd.dsuse_qy
, IF(tdm.prgrs_stts_cd = '01', 1, 0) AS receipt
, IF(tdm.prgrs_stts_cd = '06', 1, 0) AS rslt
, IF(tdm.prgrs_stts_cd = '21', 1, 0) AS mapping
, IF(tdm.prgrs_stts_cd = '99', 1, 0) AS cplt
FROM tb_dsuse_mgt tdm
JOIN tb_dsuse_mgt_dtl tdmd
ON tdm.dscdmng_id = tdmd.dscdmng_id
JOIN tb_bssh_info tbi
ON tdm.bssh_cd = tbi.bssh_cd
WHERE tdm.use_yn = 'Y'
<if test="schSggCd != null">
AND tdm.dept_cd = #{schSggCd} <!-- 관할 관청 -->
</if>
<if test="schDateFrom != null">
AND tdm.dsuse_de <![CDATA[>=]]> #{schDateFrom} <!-- 폐기 일자 시작 -->
</if>
<if test="schDateTo != null">
AND tdm.dsuse_de <![CDATA[<=]]> #{schDateTo} <!-- 폐기 일자 종료 -->
</if>
<if test="schSttsCd != null">
AND tdm.prgrs_stts_cd = #{schSttsCd} <!-- 진행 상태 -->
</if>
)
SELECT T.*
, ROW_NUMBER() over (ORDER BY T.dept_cd, T.bssh_nm, T.bssh_cd) AS ROW_NUM
, IF(td.dept_nm IS NULL, T.dept_cd, dept_nm) AS dept_nm
FROM (
SELECT tgt.dept_cd
, tgt.bssh_cd
, tgt.bssh_nm
, MAX(tgt.rprsntv_nm) AS rprsntv_nm
, SUM(tgt.receipt) AS receiptCnt
, SUM(tgt.rslt) AS rsltCnt
, SUM(tgt.mapping) AS mappingCnt
, SUM(tgt.cplt) AS cpltCnt
, COUNT(tgt.dscdmng_id) AS dsuseCnt
, SUM(tgt.dsuse_qy) AS dsuseQy
FROM tgt
GROUP BY tgt.dept_cd, tgt.bssh_nm, tgt.bssh_cd
UNION ALL
SELECT 'TOTAL' AS dept_cd
, '' AS bssh_cd
, '' AS bssh_nm
, '' AS rprsntv_nm
, SUM(tgt.receipt) AS receiptCnt
, SUM(tgt.rslt) AS rsltCnt
, SUM(tgt.mapping) AS mappingCnt
, SUM(tgt.cplt) AS cpltCnt
, count(tgt.dscdmng_id) AS dsuseCnt
, sum(tgt.dsuse_qy) AS dsuseQy
FROM tgt
) T
LEFT JOIN tb_dept td
ON T.dept_cd = td.dept_cd
</select>
</mapper> </mapper>

@ -1,6 +1,6 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">폐기 보고 확인</c:set> <c:set var="prefixName" scope="request">마약류 취급자별 현황</c:set>
<!-- Page Body --> <!-- Page Body -->
<div class="container-page-btn"> <div class="container-page-btn">
<button type="button" class="btn btn-outline-dark w-px-120" id="btnReset--${pageName}" title="초기화"> <button type="button" class="btn btn-outline-dark w-px-120" id="btnReset--${pageName}" title="초기화">
@ -82,32 +82,37 @@
<div class="table-responsive ox-scroll oy-scroll" style="height: 580px !important;" id="table-responsive--${pageName}"> <div class="table-responsive ox-scroll oy-scroll" style="height: 580px !important;" id="table-responsive--${pageName}">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info"> <table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info">
<thead class="sticky-thead"> <thead class="sticky-thead">
<tr id="theadTr0--${pageName}">
<th class="cmn text-center align-content-center p-1" style="width: 60px;" rowspan="2">NO.</th>
<th class="cmn align-content-center p-1" style="width: 170px;" rowspan="2">관할관청</th>
<th class="cmn align-content-center p-1" style="width: 140px;" rowspan="2">취급자번호</th>
<th class="cmn align-content-center p-1" style="width: 280px;" rowspan="2">취급업체명</th>
<th class="cmn align-content-center p-1" style="width: 120px;" rowspan="2">대표자</th>
<th class="cmn fw-bold" colspan="4">처리상태별 건수</th>
<th class="cmn align-content-center p-1 text-blue" style="width: 100px;" rowspan="2">폐기건수</th>
<th class="cmn align-content-center p-1 text-blue" style="width: 100px;" rowspan="2">폐기수량</th>
</tr>
<tr id="theadTr--${pageName}" <tr id="theadTr--${pageName}"
data-by="by--${pageName}" data-by-output="byOutput--${pageName}" data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}"> data-by="by--${pageName}" data-by-output="byOutput--${pageName}" data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}">
<th class="cmn" style="width: 170px;">관할관청</th> <th class="cmn" style="width: 100px;">접수건수</th>
<th class="cmn" style="width: 120px;">마약류취급의료업</th> <th class="cmn" style="width: 100px;">결과처리건수</th>
<th class="cmn" style="width: 100px;">마약류소매업</th> <th class="cmn" style="width: 100px;">보고확인건수</th>
<th class="cmn" style="width: 100px;">마약류도매업</th> <th class="cmn" style="width: 100px;">완료건수</th>
<th class="cmn" style="width: 100px;">마약류제조업</th>
<th class="cmn" style="width: 100px;">마약류수출입업</th>
<th class="cmn" style="width: 100px;">마약류원료사용</th>
<th class="cmn" style="width: 120px;">마약류취급학술연구</th>
<th class="cmn text-blue" style="width: 100px;">폐기건수</th>
<th class="cmn text-blue" style="width: 100px;">폐기수량</th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody--${pageName}"> <tbody id="tbody--${pageName}">
</tbody> </tbody>
<template id="${infoPrefix}Row--${pageName}"> <template id="${infoPrefix}Row--${pageName}">
<tr data-key="{dept_cd}" class="{fw-bold-if-total}"> <tr data-key="{bssh_cd}" class="{fw-bold-if-total}">
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ROW_NUM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{dept_nm}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{dept_nm}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류취급의료업}</td> <td class="text-center" onclick="{onclick}" ondblclick="{ondblclick}">{bssh_cd}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류소매업}</td> <td class="text-start" onclick="{onclick}" ondblclick="{ondblclick}">{bssh_nm}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류도매업}</td> <td class="text-start" onclick="{onclick}" ondblclick="{ondblclick}">{rprsntv_nm}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류제조업}</td> <td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{receiptCnt}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류수출입업}</td> <td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{rsltCnt}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류원료사용}</td> <td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{mappingCnt}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류취급학술연구}</td> <td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{cpltCnt}</td>
<td class="text-end text-blue" onclick="{onclick}" ondblclick="{ondblclick}">{dsuseCnt}</td> <td class="text-end text-blue" onclick="{onclick}" ondblclick="{ondblclick}">{dsuseCnt}</td>
<td class="text-end text-blue" onclick="{onclick}" ondblclick="{ondblclick}">{dsuseQy}</td> <td class="text-end text-blue" onclick="{onclick}" ondblclick="{ondblclick}">{dsuseQy}</td>
</tr> </tr>
@ -141,6 +146,7 @@
* script 진입 * script 진입
**************************************************************************/ **************************************************************************/
$(document).ready(function() { $(document).ready(function() {
let totalDs = null;
// pageObject // pageObject
let $P = pageObject["${pageName}"]; let $P = pageObject["${pageName}"];
@ -157,7 +163,18 @@
, prefix: "dsuseMgtDsuseQyByBsshStatistics" , prefix: "dsuseMgtDsuseQyByBsshStatistics"
, prefixName: "제품별 폐기 현황" , prefixName: "제품별 폐기 현황"
, keymapper: info => info ? info.dept_cd : "" , keymapper: info => info ? info.dept_cd : ""
, dataGetter: obj => obj.${infoPrefix}List , dataGetter: obj => {
let list = obj.${infoPrefix}List;
// TOTAL 데이터
totalDs = new Dataset({
keymapper: info => info? info.bssh_cd : ''
, dataGetter: obj => obj
});
totalDs.setData(list.filter(d => d.dept_cd === 'TOTAL'));
return list.filter(d => d.dept_cd !== 'TOTAL');
}
, appendData: true , appendData: true
, infoSize: "xl" , infoSize: "xl"
}); });
@ -173,6 +190,14 @@
// Dataset 변경 이벤트 // Dataset 변경 이벤트
$P.control.onDatasetChange = (obj) => { $P.control.onDatasetChange = (obj) => {
$P.renderList(obj.${infoPrefix}Total); $P.renderList(obj.${infoPrefix}Total);
$("#${infoPrefix}Paging--${pageName}").setPagingInfo({
list: $P.control.dataset
, prefix: "${infoPrefix}Paging--${pageName}"
, start: obj.${infoPrefix}Start
, totalSize: $P.control.dataset.length
, fetchSize: obj.${infoPrefix}Fetch
, func: "pageObject['${pageName}'].control.load({index})"
});
}; };
// 현재 선택 자료 변경 이벤트 // 현재 선택 자료 변경 이벤트
@ -204,12 +229,8 @@
}); });
let replacer = (str, dataItem) => { let replacer = (str, dataItem) => {
str = str.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("dept_cd") + "');") str = str.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("bssh_cd") + "');")
if(dataItem.getValue("dept_cd") == "TOTAL"){ str = str.replace(/{fw-bold-if-total}/gi, "");
str = str.replace(/{fw-bold-if-total}/gi, "fw-bold");
} else {
str = str.replace(/{fw-bold-if-total}/gi, "");
}
return str; return str;
} }
@ -218,6 +239,17 @@
: ${infoPrefix}List.inStrings(foundTr.outerHTML, replacer); : ${infoPrefix}List.inStrings(foundTr.outerHTML, replacer);
$("#tbody--${pageName}").html(trs.join()); $("#tbody--${pageName}").html(trs.join());
// TOTAL 데이터 추가
let replacer2 = (str, dataItem) => {
str = str.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("prduct_cd") + "');")
str = str.replace(/{fw-bold-if-total}/gi, "fw-bold");
str = str.replace(/{ROW_NUM}/gi, "");
return str;
}
let tr = totalDs.inStrings(foundTr.outerHTML, replacer2);
$("#tbody--${pageName}").append(tr);
} }
$P.control.getBsshInfo = (gdccId) => { $P.control.getBsshInfo = (gdccId) => {
@ -239,17 +271,6 @@
}); });
} }
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 사용자검색 callback
$P.callbackFindUser = (userId, userNm) => {
$("#schRgtrCd--${pageName}").val(userId); // 사용자 ID
$("#schRgtrNm--${pageName}").val(userNm); // 사용자 명
}
// 업체 검색 버튼 이벤트 // 업체 검색 버튼 이벤트
$P.fnSearchBssh = () => { $P.fnSearchBssh = () => {
$P.control.getBsshInfo(); $P.control.getBsshInfo();

@ -0,0 +1,379 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">마약류 취급자 업종별 현황</c:set>
<!-- Page Body -->
<div class="container-page-btn">
<button type="button" class="btn btn-outline-dark w-px-120" id="btnReset--${pageName}" title="초기화">
초기화
</button>
</div>
<form id="frmSearch--${pageName}" name="frmSearch">
<div class="container-search">
<div class="row g-1">
<div class="col-4">
<label class="form-label fw-bold form-search-title text-end" for="schSggCd--${pageName}">관할관청</label>
<select class="form-select" id="schSggCd--${pageName}" name="schSggCd" style="pointer-events: none;">
<option value="">전체</option>
<c:forEach items="${DEPTList}" var="item">
<option value="${item.DEPT_CD}">${item.DEPT_NM}</option>
</c:forEach>
</select>
</div>
<div class="col-4">
<label class="form-label fw-bold form-search-title text-end">폐기일자</label>
<span class="form-search-linebox" id="inputHdrDe">
<input type="text" class="form-control form-date" id="schDateFrom--${pageName}" name="schDateFrom" data-fmt-type="day" autocomplete="off" title="시작 날짜 선택" />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
~
<input type="text" class="form-control form-date" id="schDateTo--${pageName}" name="schDateTo" data-fmt-type="day" autocomplete="off" title="종료 날짜 선택" />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
</span>
<input type="checkbox" id="chkDsuseDe--${pageName}" name="chkDsuseDe" title="폐기일자 적용" style="align-items: baseline"/>&nbsp;<strong>폐기일자 적용</strong>
</div>
<!-- 업체명 -->
<%-- <div class="col-5">--%>
<%-- <label class="form-label fw-bold form-search-title text-end" for="schBsshNm--${pageName}">업체명</label>--%>
<%-- <input type="text" class="form-control w-px-160" id="schBsshNM--${pageName}" name="schBsshNm" data-map="bsshNm" autocomplete="off" readonly/>--%>
<%-- <input type="hidden" id="schBsshCd--${pageName}" name="schBsshCd" data-map="bsshCd" autocomplete="off" />--%>
<%-- <button type="button" class="btn btn-search w-px-120" id="btnBsshSearch--${pageName}" title="업체 검색">--%>
<%-- 업체 검색--%>
<%-- </button>--%>
<%-- </div>--%>
<!-- 처리상태 -->
<%-- <div class="col-6">--%>
<%-- <label class="form-label fw-bold form-search-title text-end" for="schSttsCd--${pageName}">처리상태</label>--%>
<%-- <select class="form-select" id="schSttsCd--${pageName}" name="schSttsCd">--%>
<%-- <option value="">전체</option>--%>
<%-- <c:forEach items="${ADDS11}" var="item">--%>
<%-- <option value="${item.code}">${item.value}</option>--%>
<%-- </c:forEach>--%>
<%-- </select>--%>
<%-- </div>--%>
<div class="col-1">
<button type="button" class="btn btn-search w-px-120" id="btnSearch--${pageName}" title="검색">
검색
</button>
</div>
</div>
</div>
</form>
<div class="mt-3">
<div class="float-end">
<button type="button" class="btn btn-excel w-px-120" id="btnExcel--${pageName}" title="엑셀 저장">
엑셀
</button>
</div>
</div>
<!-- 업무 버튼 및 건수 표시 -->
<div class="d-flex flex-row justify-content-between p-3">
<div>
<div class="input-group" id="DataTables_Table_0_length">
</div>
</div>
</div>
<!-- DataTables(그리드) -->
<div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}">
<div class="table-responsive ox-scroll oy-scroll" style="height: 580px !important;" id="table-responsive--${pageName}">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info">
<thead class="sticky-thead">
<tr id="theadTr--${pageName}"
data-by="by--${pageName}" data-by-output="byOutput--${pageName}" data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}">
<th class="cmn" style="width: 170px;">관할관청</th>
<th class="cmn" style="width: 120px;">마약류취급의료업</th>
<th class="cmn" style="width: 100px;">마약류소매업</th>
<th class="cmn" style="width: 100px;">마약류도매업</th>
<th class="cmn" style="width: 100px;">마약류제조업</th>
<th class="cmn" style="width: 100px;">마약류수출입업</th>
<th class="cmn" style="width: 100px;">마약류원료사용</th>
<th class="cmn" style="width: 120px;">마약류취급학술연구</th>
<th class="cmn text-blue" style="width: 100px;">폐기건수</th>
<th class="cmn text-blue" style="width: 100px;">폐기수량</th>
</tr>
</thead>
<tbody id="tbody--${pageName}">
</tbody>
<template id="${infoPrefix}Row--${pageName}">
<tr data-key="{dept_cd}" class="{fw-bold-if-total}">
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{dept_nm}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류취급의료업}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류소매업}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류도매업}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류제조업}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류수출입업}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류원료사용}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류취급학술연구}</td>
<td class="text-end text-blue" onclick="{onclick}" ondblclick="{ondblclick}">{dsuseCnt}</td>
<td class="text-end text-blue" onclick="{onclick}" ondblclick="{ondblclick}">{dsuseQy}</td>
</tr>
</template>
<template id="${infoPrefix}NotFound--${pageName}">
<tr class="odd">
<td valign="top" colspan="13" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
</div>
</div>
<!-- / DataTables(그리드) -->
<div class="d-flex flex-row p-3 justify-content-between">
<label id="${infoPrefix}Paging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="${infoPrefix}Paging--${pageName}" class="pagination pagination-primary" style="display: none;">
</ul>
</div>
<script>
<!--/ Page Body -->
/**************************************************************************
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = {};
/**************************************************************************
* script 진입
**************************************************************************/
$(document).ready(function() {
// pageObject
let $P = pageObject["${pageName}"];
// FormFields
$P.formFields = new AddsFormFields("#frmSearch--${pageName}");
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.control = new DatasetControl({
urls : {
load : wctx.url("/adds/nims/getDsuseMgtDsuseQyByIndutyStatistics.do")
}
, prefix: "dsuseMgtDsuseQyByIndutyStatistics"
, prefixName: "제품별 폐기 현황"
, keymapper: info => info ? info.dept_cd : ""
, dataGetter: obj => obj.${infoPrefix}List
, appendData: true
, infoSize: "xl"
});
// $P.control 설정
$P.control.defaultFetchSize = FETCH_XXS; // 1 페이지당 조회되는 자료 건수 index.jsp에서 확인 FETCH_XS = 30
//$P.control.query = { pageNum : 1, fetchSize : $P.control.defaultFetchSize };
$P.control.beforeCurrent = null;
/**************************************************************************
* DatasetControl 이벤트
**************************************************************************/
// Dataset 변경 이벤트
$P.control.onDatasetChange = (obj) => {
$P.renderList(obj.${infoPrefix}Total);
};
// 현재 선택 자료 변경 이벤트
$P.control.onCurrentChange = (item) => {
if (!item) {
return;
}
let key = item.data.dept_cd;
$("#tbody--${pageName}").setCurrentRow(key);
};
/**************************************************************************
* DataTables 이벤트
**************************************************************************/
// DataTables에 click, dbclick 이벤트
$P.renderList = (totalSize) => {
let ${infoPrefix}List = $P.control.dataset;
let empty = ${infoPrefix}List.empty;
// 업무별 DataTables(그리드) tr, td
let foundContent = document.getElementById("${infoPrefix}Row--${pageName}").content;
let foundTr = $(foundContent).find("tr")[0].cloneNode(false);
let foundTds = $(foundContent).find("td");
foundTds.each(function() {
foundTr.appendChild(this.cloneNode(true));
});
let replacer = (str, dataItem) => {
str = str.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("dept_cd") + "');")
if(dataItem.getValue("dept_cd") == "TOTAL"){
str = str.replace(/{fw-bold-if-total}/gi, "fw-bold");
} else {
str = str.replace(/{fw-bold-if-total}/gi, "");
}
return str;
}
let trs = empty ? [document.getElementById("${infoPrefix}NotFound--${pageName}").content.outerHTML]
: ${infoPrefix}List.inStrings(foundTr.outerHTML, replacer);
$("#tbody--${pageName}").html(trs.join());
}
$P.control.getBsshInfo = (gdccId) => {
let dialogTitle = "마약류 취급업체 조회";
let params = {openPage : "frmSearch--${pageName}"};
ajax.get({
url : wctx.url("/adds/nims/bssh-popup.do")
, data : params
, success : resp => {
dialog.open({
id : "bsshPopupDialog"
, title : dialogTitle
, content : resp
, size : $P.control.infoSize
, onClose : () => { }
});
}
});
}
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 사용자검색 callback
$P.callbackFindUser = (userId, userNm) => {
$("#schRgtrCd--${pageName}").val(userId); // 사용자 ID
$("#schRgtrNm--${pageName}").val(userNm); // 사용자 명
}
// 업체 검색 버튼 이벤트
$P.fnSearchBssh = () => {
$P.control.getBsshInfo();
}
/**************************************************************************
* 버튼 clickEvent
**************************************************************************/
// 업무 구분 변경 이벤트
$P.fnReset = () => {
//$P.control.dataset.clear();
// 초기 기본 설정
$P.initForm();
// dataset 초기화
}
// 검색 버튼 클릭 이벤트
$P.fnSearchList = () => {
// 검색조건
$P.control.query = $P.formFields.get(); // 검색 조건
if(!$('#chkDsuseDe--${pageName}').is(":checked")){
$P.control.query.schDateFrom = '';
$P.control.query.schDateTo = '';
}
$P.control.query.fetchSize = $P.control.defaultFetchSize; // 한번에 조회되는 자료 건수
$P.control.query.delYn = "N"; // 삭제 여부
$P.control.load();
}
// 엑셀 버튼 클릭 이벤트
$P.fnExcel = () => {
if ($P.control.dataset.empty) {
dialog.alert({
content: "검색된 자료가 없습니다."
, onOK: () => { }
});
return;
}
// DataTables(그리드)
let cellDefs = getCellDefs(
$("#theadTr0--${pageName} th, #theadTr--${pageName} th")
.not(".dummy-th").not(":eq(0)").not("[colspan]"),
$($("#${infoPrefix}Row--${pageName}")[0].content).find("td")
.not(".dummy-td").not(":eq(0)").not("[colspan]"));
$P.control.query.cellDefs = cellDefs;
$P.control.download();
}
/**************************************************************************
* 초기 설정
**************************************************************************/
// 이벤트 설정
$P.setEvent = () => {
// 기본 버튼 이벤트
$("#btnReset--${pageName}").on("click", () => $P.fnReset()); // 초기화
$("#btnSearch--${pageName}").on("click", () => $P.fnSearchList()); // 검색
$("#btnExcel--${pageName}").on("click", () => $P.fnExcel()); // 엑셀
// 동적검색에서 엔터(Enter) 키를 누르면 검색한다.
$("#term--${pageName}").keypress(function(e) {
if (e.keyCode == 13) {
$P.fnSearchList();
}
});
// form-date 항목에서 키보드로 입력시 날짜 포맷팅 적용
$("#frmSearch--${pageName}").find(".form-date").each(function() {
$(this).on("input", function() {
let value = this.value.replaceAll("-", "");
if (value.length > 7) {
this.value = value.substring(0, 4) + "-" + value.substring(4, 6) + "-" + value.substring(6);
} else if (value.length > 5) {
this.value = value.substring(0, 4) + "-" + value.substring(4);
}
});
});
// 업체 검색 버튼 이벤트
$("#btnBsshSearch--${pageName}").on("click", function() {
$P.fnSearchBssh();
});
// DataTables width 변경 조정 (업무별 그리드가 존재 한다면.. crdn06010-main.jsp 참고)
fnMakeResizableTable($("#table-responsive--${pageName}")[0]);
}
// 초기 화면 설정
$P.initForm = () => {
// 화면 초기화
$("#frmSearch--${pageName}")[0].reset();
// input, select 초기화
let searchForm = $("#frmSearch--${pageName}");
searchForm.find("input[type='checkbox']").prop("checked", false);
searchForm.find("input[type='text']").val("");
searchForm.find("input[type='hidden']").val("");
searchForm.find("select").each(function() { $(this).find("option:eq(0)").prop("selected", true); });
// 기본 데이터 설정
initDatepicker("frmSearch--${pageName}"); // 달력 초기화
$("#schDateFrom--${pageName}").datepicker("setDate", DateUtil.getDateDay(-7).date); // 부과 제외 일자 시작
$("#schDateTo--${pageName}").datepicker("setDate", new Date()); // 부과 제외 일자 종료
$('#schSggCd--${pageName}').val("${currentUser.deptCode}");
$P.fnSearchList();
}
/**************************************************************************
* 최초 실행 함수
**************************************************************************/
// 1. 이벤트 설정
$P.setEvent();
// 2. 초기 설정 및 업무 구분 변경
$P.fnReset();
});
</script>

@ -1,6 +1,6 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">폐기 보고 확인</c:set> <c:set var="prefixName" scope="request">마약류 제품별 현황</c:set>
<!-- Page Body --> <!-- Page Body -->
<div class="container-page-btn"> <div class="container-page-btn">
<button type="button" class="btn btn-outline-dark w-px-120" id="btnReset--${pageName}" title="초기화"> <button type="button" class="btn btn-outline-dark w-px-120" id="btnReset--${pageName}" title="초기화">
@ -270,17 +270,6 @@
}); });
} }
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 사용자검색 callback
$P.callbackFindUser = (userId, userNm) => {
$("#schRgtrCd--${pageName}").val(userId); // 사용자 ID
$("#schRgtrNm--${pageName}").val(userNm); // 사용자 명
}
// 업체 검색 버튼 이벤트 // 업체 검색 버튼 이벤트
$P.fnSearchBssh = () => { $P.fnSearchBssh = () => {
$P.control.getBsshInfo(); $P.control.getBsshInfo();
@ -389,7 +378,6 @@
$("#schDateFrom--${pageName}").datepicker("setDate", DateUtil.getDateDay(-7).date); // 부과 제외 일자 시작 $("#schDateFrom--${pageName}").datepicker("setDate", DateUtil.getDateDay(-7).date); // 부과 제외 일자 시작
$("#schDateTo--${pageName}").datepicker("setDate", new Date()); // 부과 제외 일자 종료 $("#schDateTo--${pageName}").datepicker("setDate", new Date()); // 부과 제외 일자 종료
$('#schSttsCd--${pageName}').val('06');
$('#schSggCd--${pageName}').val("${currentUser.deptCode}"); $('#schSggCd--${pageName}').val("${currentUser.deptCode}");
$P.fnSearchList(); $P.fnSearchList();

@ -1,6 +1,6 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">폐기 보고 확인</c:set> <c:set var="prefixName" scope="request">마약류 제품 구분별 현황</c:set>
<!-- Page Body --> <!-- Page Body -->
<div class="container-page-btn"> <div class="container-page-btn">
<button type="button" class="btn btn-outline-dark w-px-120" id="btnReset--${pageName}" title="초기화"> <button type="button" class="btn btn-outline-dark w-px-120" id="btnReset--${pageName}" title="초기화">
@ -309,6 +309,8 @@
.not(".dummy-th").not(":eq(0)").not("[colspan]"), .not(".dummy-th").not(":eq(0)").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
debug.log("cellDefs", cellDefs);
$P.control.query.cellDefs = cellDefs; $P.control.query.cellDefs = cellDefs;
$P.control.download(); $P.control.download();

Loading…
Cancel
Save