feat: 업체조회 팝업 페이징 적용

업체조회 팝업 조건 유효성 체크 추가
      제품검색 팝업 페이징 적용
      제품조회 팝업 조건 유효성 체크 추가
main
Jonguk. Lim 4 weeks ago
parent b1995da72e
commit 2b7b836b1f

@ -1,79 +1,43 @@
package cokr.xit.adds.nims.web;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
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.apache.poi.ss.usermodel.VerticalAlignment;
import org.json.simple.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.adds.cmm.model.ApiBaseResponse;
import cokr.xit.adds.cmm.model.ApiUtil;
import cokr.xit.adds.cmm.model.DsuseMappingInfo;
import cokr.xit.adds.cmm.model.DsuseReceiptDtl;
import cokr.xit.adds.cmm.model.DsuseRsltInfo;
import cokr.xit.adds.cmm.model.NimsApiRequest;
import cokr.xit.adds.cmmn.hwp.format.DisposeProcessDetails;
import cokr.xit.adds.cmmn.hwp.format.DisposeResultReport;
import cokr.xit.adds.nims.ApiKeyQuery;
import cokr.xit.adds.nims.DsuseMgtDetailQuery;
import cokr.xit.adds.nims.DsuseMgtDocQuery;
import cokr.xit.adds.nims.DsuseMgtReceiptQuery;
import cokr.xit.adds.nims.DsuseMgtRsltQuery;
import cokr.xit.adds.nims.DsuseMgtStatisticsQuery;
import cokr.xit.adds.nims.DsuseProductAndSeqQuery;
import cokr.xit.adds.nims.service.AddsNimsService;
import cokr.xit.adds.nims.service.ApiKeyService;
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 java.io.*;
import java.net.*;
import java.net.http.*;
import java.nio.charset.*;
import java.text.*;
import java.util.*;
import java.util.stream.*;
import javax.annotation.*;
import org.apache.poi.hssf.util.*;
import org.apache.poi.ss.usermodel.*;
import org.json.simple.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.*;
import org.springframework.web.servlet.*;
import com.fasterxml.jackson.core.type.*;
import cokr.xit.adds.cmm.model.*;
import cokr.xit.adds.cmmn.hwp.format.*;
import cokr.xit.adds.nims.*;
import cokr.xit.adds.nims.service.*;
import cokr.xit.applib.*;
import cokr.xit.applib.xls.*;
import cokr.xit.base.code.*;
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;
import cokr.xit.base.file.service.FileService;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.base.user.service.SigunguDepartmentService;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.data.JSON;
import cokr.xit.foundation.web.WebClient;
import cokr.xit.base.docs.xls.*;
import cokr.xit.base.file.*;
import cokr.xit.base.file.FileInfo.*;
import cokr.xit.base.file.service.*;
import cokr.xit.base.user.*;
import cokr.xit.base.user.service.*;
import cokr.xit.base.web.*;
import cokr.xit.foundation.data.*;
import cokr.xit.foundation.web.*;
@Controller
@RequestMapping(
@ -616,6 +580,12 @@ public class AddsNimsController extends ApplicationController {
return json.parse(rslt, new TypeReference<>() {});
}
@RequestMapping(value = "/getNimsBsshInfoSt2.do", name="업체(마약류취급자) 검색", produces = "application/json;charset=UTF-8")
public @ResponseBody ApiBaseResponse<List<JSONObject>> getNimsBsshInfoSt2(@ModelAttribute NimsApiRequest.BsshInfoReq dto) {
String rslt = ApiUtil.callNimsApi(apiHost + bsshInfoEndpoint, dto);
return json.parse(rslt, new TypeReference<>() {});
}
@RequestMapping(value = "/getNimsProductInfoKd.do", name="제품 검색", produces = "application/json;charset=UTF-8")
public @ResponseBody ApiBaseResponse<List<JSONObject>> getNimsProductInfoKd(@ModelAttribute NimsApiRequest.ProductInfoReq dto) {
String rslt = ApiUtil.callNimsApi(apiHost + productInfoEndpoint, dto);

@ -8,21 +8,17 @@
<!-- hidden -->
<%-- <label for="bssh--${pageName}">마약류 취급업체 정보</label>--%>
<div class="row my-1 mx-4 g-1" style="align-items: baseline">
<div class="col-md-3">
<label for="schBsshNm--${pageName}" class="w-px-90 bg-lighter pe-2 col-form-label text-sm-end">취급업체명</label>
<input type="text" class="form-control w-50" id="schBsshNm--${pageName}" name="schBsshNm" data-map="schBsshNm" >
<div class="col-md-6">
<label for="schBsshNm--${pageName}" class="w-px-140 bg-lighter pe-2 col-form-label text-sm-end">취급업체명/식별번호</label>
<input type="text" class="form-control w-px-100" id="schBsshNm--${pageName}" name="schBsshNm" data-map="schBsshNm" >
<input type="text" class="form-control w-px-120" id="schBsshCd--${pageName}" name="schBsshCd" data-map="schBsshCd" >
</div>
<div class="col-md-3">
<label for="schRprsntvNm--${pageName}" class="w-px-80 bg-lighter pe-2 col-form-label text-sm-end">대표자명</label>
<input type="text" class="form-control w-50" id="schRprsntvNm--${pageName}" name="schRprsntvNm" data-map="schRprsntvNm" >
</div>
<div class="col-md-3">
<label for="schBsshCd--${pageName}" class="w-px-90 bg-lighter pe-2 col-form-label text-sm-end">취급자번호</label>
<input type="text" class="form-control w-50" id="schBsshCd--${pageName}" name="schBsshCd" data-map="schBsshCd" >
</div>
<div class="col-md-3">
<button type="button" class="btn btn-search w-px-120" id="btnSearch--${pageName}" title="검색">검색</button>&nbsp;
<button type="button" class="btn btn-primary w-px-120" id="btnSearch2--${pageName}" title="검색">NIMS 검색</button>
<button type="button" class="btn btn-primary w-px-120" id="btnSearch--${pageName}" title="검색">NIMS 검색</button>
</div>
</div>
</div>
@ -42,30 +38,24 @@
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-500" 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>
<thead class="sticky-thead">
<tr>
<!-- <th style="width: 15.828px;text-align:center;" tabindex="0">No</th> -->
<th class="sorting" style="width: 140.156px;">취급자번호</th>
<th class="sorting" style="width: 250.141px;">취급업체명</th>
<th class="sorting" style="width: 160.141px;">업종명</th>
<th class="sorting" style="width: 120.469px;">대표자</th>
<th class="sorting" style="width: 250.469px;">허가번호</th>
<%-- <th class="sorting" style="width: 120.469px;">담당자명</th>--%>
<%-- <th class="sorting" style="width: 120.469px;">구분</th>--%>
</tr>
</thead>
<tbody id="tbody--${pageName}">
</tbody>
<template id="${infoPrefix}Row--${pageName}">
<tr data-key="{bsshCd}">
<!-- <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{bsshCd}</td> -->
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{bsshCd}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{bsshNm}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{indutyNm}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{rprsntvNm}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prmisnNo}</td>
<%-- <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{chrgNm}</td>--%>
<%-- <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{hdntNm}</td>--%>
</tr>
</template>
<template id="${infoPrefix}NotFound--${pageName}">
@ -131,15 +121,16 @@
**************************************************************************/
// Dataset 변경 이벤트
$P.control.onDatasetChange = (obj) => {
$P.renderList(obj.${infoPrefix}Total);
$P.control.onDatasetChange = (obj, option) => {
$P.renderList(obj.totalCount, option);
$("#${infoPrefix}Paging--${pageName}").setPagingInfo({
list: $P.control.dataset
, prefix: "${infoPrefix}Paging--${pageName}"
, start: obj.${infoPrefix}Start
, totalSize: $P.control.dataset.length
, totalSize: obj.totalCount
, fetchSize: obj.${infoPrefix}Fetch
, func: "pageObject['${pageName}'].control.load({index})"
// , func: "pageObject['${pageName}'].control.load({index})"
});
};
@ -162,33 +153,22 @@
**************************************************************************/
// DataTables에 click, dbclick 이벤트
$P.renderList = (totalSize) => {
$P.renderList = (totalSize, option) => {
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
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("bsshCd") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()");
let trs = empty ? [document.getElementById("${infoPrefix}NotFound--${pageName}").content.outerHTML]
: ${infoPrefix}List.inStrings(foundTr.outerHTML, replacer);
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML]
: ${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML,
(str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("bsshCd") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()"));
let noMore = (${infoPrefix}List.length >= totalSize);
let initScroll = ($P.control.query.pageNum < 2);
$("#tbody--${pageName}").html(trs.join());
$("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore);
}
/**************************************************************************
* 사용자 함수(function)
@ -199,12 +179,25 @@
**************************************************************************/
$P.fnSearchList = () => {
if($P.formFields.get().schBsshCd.length + $P.formFields.get().schBsshNm.length === 0){
dialog.alert({
content: "취급업체명 또는 취급자식별번호중<br>하나는 필수입니다."
});
return false;
}
if($P.formFields.get().schBsshNm.length !== 0 && $P.formFields.get().schBsshNm.length < 2){
dialog.alert({
content: "취급업체명은 2자 이상으로 조회해 주세요."
});
return false;
}
$P.control.query = {
//... $P.formFields.get(),
pg: 1,
bc: $P.formFields.get().schBsshCd,
bn: $P.formFields.get().schBsshNm,
rprsntvNm: $P.formFields.get().schRprsntvNm,
//dbSkipYn: dbSkipYn? dbSkipYn : "N",
userId: "${currentUser.account}"
};
$P.control.query.fetchSize = FETCH_XXL; // 한번에 조회되는 자료 건수
@ -213,6 +206,12 @@
$P.control.load(1);
}
$P.scrollDataList = () => {
$P.control.query.pg = $P.control.query.pageNum + 1;
$P.control.load($P.control.query.pageNum + 1);
}
// 저장
$P.fnSave = () => {
let openPage = new AddsFormFields("#${openPage}");
@ -228,13 +227,12 @@
// 버튼 이벤트
$("#btnSave--${pageName}").on("click", () => $P.fnSave()); // 저장
$("#btnSearch--${pageName}").on("click", () => $P.fnSearchList());
$("#btnSearch2--${pageName}").on("click", () => $P.fnSearchList("Y"));
$("#frmSearch--${pageName} input").onEnterPress($P.fnSearchList);
}
// DataTables width 변경 조정 (업무별 그리드가 존재 한다면.. crdn06010-main.jsp 참고)
Componentization.fnMakeResizableTable($("#table-responsive--${pageName}")[0]);
Componentization.fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollDataList);
// 초기 화면 설정
$P.initForm = () => {}

@ -43,7 +43,7 @@
<input type="text" class="form-control w-70" id="bsshNm--${pageName}" name="bsshNm" data-map="bsshNm" readonly>
</div>
<div class="col-md-8">
<label for="bsshCd--${pageName}" class="w-px-100 bg-lighter pe-2 col-form-label text-sm-end">식별번호</label>
<label for="bsshCd--${pageName}" class="w-px-100 bg-lighter pe-2 col-form-label text-sm-end">업체식별번호</label>
<input type="text" class="form-control w-px-150" id="bsshNm--${pageName}" name="bsshCd" data-map="bsshCd" readonly>
<button type="button" class="btn btn-search w-px-100" id="btnBsshSearch--${pageName}" title="업체 검색">업체 검색</button>
</div>

@ -30,7 +30,7 @@
<input type="text" class="form-control w-70" id="bsshNm--${pageName}" name="bsshNm" data-map="bsshNm" readonly>
</div>
<div class="col-md-8">
<label for="bsshCd--${pageName}" class="w-px-100 bg-lighter pe-2 col-form-label text-sm-end">식별번호</label>
<label for="bsshCd--${pageName}" class="w-px-100 bg-lighter pe-2 col-form-label text-sm-end">업체식별번호</label>
<input type="text" class="form-control w-px-150" id="bsshNm--${pageName}" name="bsshCd" data-map="bsshCd" readonly>
<button type="button" class="btn btn-search w-px-100" id="btnBsshSearch--${pageName}" title="업체 검색">업체 검색</button>
</div>
@ -372,7 +372,7 @@
, data : params
, success : resp => {
dialog.open({
id : "productMainDialog"
id : "productPopupDialog"
, title : dialogTitle
, content : resp
, size : $P.productControl.infoSize

@ -24,9 +24,9 @@
<!-- / 업무 버튼 표시 -->
<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 h-px-500" id="table-responsiv-0--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-600" id="table-responsive-0--${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>
<thead class="sticky-thead">
<tr>
<th class="sorting" style="width: 146.156px;">제품코드</th>
<th class="sorting" style="width: 350.141px;">제품명</th>
@ -93,23 +93,21 @@
</div>
<div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_1_wrapper--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-500" id="table-responsive-1--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-600" id="table-responsive-1--${pageName}">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_1--${pageName}" aria-describedby="DataTables_Table_1_info">
<thead>
<thead class="sticky-thead">
<tr>
<%-- <th class="sorting" style="width: 146.156px;">제품코드</th>--%>
<%-- <th class="sorting" style="width: 330.141px;">제품명</th>--%>
<th class="sorting" style="width: 120.469px;">유효기간</th>
<th class="sorting" style="width: 160.469px;">제조번호</th>
<th class="sorting" style="width: 160.469px;">제조일련번호</th>
<th class="sorting" style="width: 146px;">제품코드</th>
<th class="sorting" style="width: 110px;">유효기간</th>
<th class="sorting" style="width: 155px;">제조번호</th>
<th class="sorting" style="width: 155px;">제조일련번호</th>
</tr>
</thead>
<tbody id="tbody--${pageName}Detail">
</tbody>
<template id="${infoPrefix}Row--${pageName}Detail">
<tr data-key="{keyCnt}">
<%-- <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prductCd}</td>--%>
<%-- <td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{prductNm}</td>--%>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prductCd}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prdValidDe}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{mnfNo}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{mnfSeq}</td>
@ -234,15 +232,15 @@
// Dataset 변경 이벤트
$P.control.onDatasetChange = (obj, option) => {
$P.renderList(obj.${infoPrefix}Total, option);
$P.renderList(obj.totalCount, option);
$("#${infoPrefix}Paging--${pageName}").setPagingInfo({
list: $P.control.dataset
, prefix: "${infoPrefix}Paging--${pageName}"
, start: obj.${infoPrefix}Start
, totalSize: $P.control.dataset.length
, totalSize: obj.totalCount
, fetchSize: obj.${infoPrefix}Fetch
, func: "pageObject['${pageName}'].control.load({index})"
//, func: "pageObject['${pageName}'].control.load({index})"
});
@ -283,9 +281,6 @@
};
// 저장 callback
// 저장
/**************************************************************************
* DataTables 이벤트
@ -296,26 +291,16 @@
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
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("keyCnt") + "');");
// .replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()");
let trs = empty ? [document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML]
: ${infoPrefix}List.inStrings(foundTr.outerHTML, replacer);
$("#tbody--${pageName}").html(trs.join());
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] :
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML,
(str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("keyCnt") + "');"));
let noMore = (${infoPrefix}List.length >= totalSize);
let initScroll = ($P.control.query.pageNum < 2);
$("#table-responsive-0--${pageName}")[0].changeContent(trs.join(), initScroll, noMore);
}
$P.renderDetailList = (totalSize, option) => {
@ -328,15 +313,12 @@
document.getElementById("${infoPrefix}Row--${pageName}Detail").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].seqInfoControl.setCurrent('" + dataItem.getValue("keyCnt") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()")
);
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()"));
let noMore = (${infoPrefix}DetailList.length >= totalSize);
let initScroll = ($P.seqInfoControl.query.pageNum < 2);
$("#table-responsive-1--${pageName}")[0].changeContent(trs.join(), initScroll, noMore);
}
/**************************************************************************
* 사용자 함수(function)
@ -347,8 +329,23 @@
**************************************************************************/
//그리드(좌)조회(새로 조회)
$P.fnSearchList = () => {
if($P.formFields.get().schProductNm.length + $P.formFields.get().schProductCd.length === 0){
dialog.alert({
content: "상품명 또는 상품번호중 하나는 필수입니다."
});
return false;
}
if($P.formFields.get().schProductNm.length !== 0 && $P.formFields.get().schProductNm.length < 2){
dialog.alert({
content: "상품명은 2자 이상으로 조회해 주세요."
});
return false;
}
$P.control.query = {
... $P.formFields.get(),
pg: 1,
p: $P.formFields.get().schProductCd,
pn: $P.formFields.get().schProductNm,
bc: '${bsshCd}', //업체코드
@ -359,6 +356,14 @@
$P.control.load(1);
}
$P.scrollList = () => {
$P.control.query.pg = $P.control.query.pageNum + 1;
$P.control.load($P.control.query.pageNum + 1);
}
//그리드(우)조회(새로 조회)
$P.fnDetailSearchList = () => {
$P.seqInfoControl.query = {
@ -420,6 +425,7 @@
$("#frmSearch--${pageName}Detail input").onEnterPress($P.fnDetailSearchList);
}
Componentization.fnMakeScrollableTable($("#table-responsive-0--${pageName}")[0], $P.scrollList);
Componentization.fnMakeScrollableTable($("#table-responsive-1--${pageName}")[0], $P.scrollDetailDataList);

Loading…
Cancel
Save