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 29f762e..cebcff5 100644 --- a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java +++ b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java @@ -1,40 +1,54 @@ package cokr.xit.adds.nims.web; +import javax.annotation.Resource; + import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; +import cokr.xit.adds.nims.service.DsuseMgtReceiptService; import cokr.xit.foundation.web.AbstractController; -import lombok.RequiredArgsConstructor; -//@RequiredArgsConstructor @Controller @RequestMapping( - name = "Nims 관리", + name = "마약류 폐기 보고", value = {"/adds/nims"} ) public class AddsNimsController extends AbstractController { -/* @Value("${app.api.host:}") + @Value("${app.api.host:}") private String apiHost; - @RequestMapping( - name = "신청서접수" - , value = {"/dsuseMgtReceipt.do"} - ) - public ModelAndView dsuseMgtReceiptForm() { - ModelAndView mav = new ModelAndView(); - mav.setViewName("adds/nims/dsuseMgtReceipt-main"); - return mav.addObject("apiHost", apiHost); + @Resource(name="dsuseMgtReceiptService") + private DsuseMgtReceiptService dsuseMgtReceiptService; + + @RequestMapping(value = "/bssh-popup.do", name="마약류 취급 업체 조회 팝업") + public ModelAndView bsshPopup(String openPage) { + ModelAndView mav = new ModelAndView("adds/nims/bssh-popup"); + + // 사용자 정보 + //ManagedUser managedUser = (ManagedUser)currentUser().getUser(); + + return mav + .addObject("pageName", "bsshPopup") // View(jsp)에서 사용할 id 뒤에 붙일 suffix + .addObject("infoPrefix", "bssh") // prefix + .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl + .addObject("openPage", openPage) + .addObject("apiHost", apiHost); } - @RequestMapping( - name = "결과[통보] 처리" - , value = {"/dsuseMgtRslt.do"} - ) - public ModelAndView dsuseMgtRsltForm() { - ModelAndView mav = new ModelAndView(); - mav.setViewName("adds/nims/dsuseMgtRslt-main"); - return mav.addObject("apiHost", apiHost); - }*/ + @RequestMapping(value = "/product-popup.do", name="마약류 제품 조회 팝업") + public ModelAndView productPopup(String openPage) { + ModelAndView mav = new ModelAndView("adds/nims/product-popup"); + + // 사용자 정보 + //ManagedUser managedUser = (ManagedUser)currentUser().getUser(); + + return mav + .addObject("pageName", "productMain") // View(jsp)에서 사용할 id 뒤에 붙일 suffix + .addObject("infoPrefix", "product") // prefix + .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl + .addObject("openPage", openPage) + .addObject("apiHost", apiHost); + } } diff --git a/src/main/java/cokr/xit/adds/nims/web/BsshController.java b/src/main/java/cokr/xit/adds/nims/web/BsshController.java deleted file mode 100644 index 4e67532..0000000 --- a/src/main/java/cokr/xit/adds/nims/web/BsshController.java +++ /dev/null @@ -1,133 +0,0 @@ -package cokr.xit.adds.nims.web; - -import java.util.Collection; -import java.util.function.Consumer; -import java.net.http.HttpResponse; -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Resource; -import javax.json.JsonObject; - -import org.springframework.boot.configurationprocessor.json.JSONException; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import net.minidev.json.JSONArray; -import net.minidev.json.JSONObject; -import net.minidev.json.parser.JSONParser; -import net.minidev.json.parser.ParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import cokr.xit.adds.nims.service.DsuseMgtReceiptService; -import cokr.xit.adds.nims.BsshQuery; - -import cokr.xit.foundation.web.AbstractController; -import cokr.xit.foundation.web.WebClient; -import cokr.xit.foundation.web.WebClient.Request.ContentType; -import cokr.xit.foundation.web.WebClient.Request; -import cokr.xit.foundation.data.DataObject; - - - -@Controller -@RequestMapping( - name = "마약류폐기 신청서 접수", - value = {"/adds/nims"} -) -public class BsshController extends AbstractController { - - public static final String CLASS_URL = "/adds/nims"; - - public class METHOD_URL { - public static final String - bsshhMain = "/bssh-main.do" // 부과 제외 관리 메인 화면 - , getbsshList = "/bssh-list.do" // 부과 제외 대장 목록 조회 -// , getLevyExclusionInfo = "/020/info.do" // 부과 제외 대장 조회 -// , createLevyExclusion = "/020/create.do" // 부과 제외 대장 등록 - ; - } - - @Resource(name="dsuseMgtReceiptService") - private DsuseMgtReceiptService dsuseMgtReceiptService; - - @RequestMapping(name="마약류폐기 신청서 접수 메인", value=METHOD_URL.bsshhMain) - public ModelAndView bsshMain(String openPage) { - ModelAndView mav = new ModelAndView("adds/nims/bssh-main"); - - // 사용자 정보 - //ManagedUser managedUser = (ManagedUser)currentUser().getUser(); - - return mav - .addObject("pageName", "bsshMain") // View(jsp)에서 사용할 id 뒤에 붙일 suffix - .addObject("infoPrefix", "bssh") // prefix - .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl - .addObject("openPage", openPage) - ; - } - - @RequestMapping(name="마약류폐기 신청서 접수 조회", value=METHOD_URL.getbsshList) - public ModelAndView getbsshList(BsshQuery query) throws JsonProcessingException, ParseException { - ModelAndView mav = new ModelAndView(); - - System.out.println("취급자 조회 : " + query.getSchBsshCd()); - - mav.setViewName("jsonView"); - - - String sMethod = "POST"; - - DataObject dataObject = new DataObject(); - dataObject.put("k",""); - dataObject.put("fg","1"); - dataObject.put("pg","1"); - dataObject.put("bi",""); - dataObject.put("hp",""); - dataObject.put("bn",query.getSchBsshNm()); - dataObject.put("bc",query.getSchBsshCd()); - dataObject.put("ymd",""); - dataObject.put("fg2","1"); - dataObject.put("dbSkipYn","N"); - dataObject.put("userId","suji"); - - - ObjectMapper mapper = new ObjectMapper(); - - String sJsonData = mapper.writeValueAsString(dataObject); - - Consumer configurer = (request) -> { - request.uri("http://localhost:9076/api/biz/nims/v1/getNimsBsshInfoSt") - .contentType(ContentType.JSON) - .bodyData(sJsonData); - }; - - HttpResponse hresp = null; - if(sMethod.equals("POST")) { - hresp = new WebClient() - .post(configurer); - } else if(sMethod.equals("GET")) { - hresp = new WebClient() - .get(configurer); - } - String resBody = hresp.body(); - - JSONParser parser = new JSONParser(); - - Object obj = parser.parse( resBody ); - JSONObject jsonObj = (JSONObject) obj; - JSONArray jsonData = (JSONArray) jsonObj.get("data"); - - System.out.println(jsonData.get(0).toString()); - - ModelAndView result = new ModelAndView("jsonView"); - - result.addObject("bsshMainList", jsonData) // 발송 정보 - ; - - return result; - - } - -} diff --git a/src/main/java/cokr/xit/adds/nims/web/ProductController.java b/src/main/java/cokr/xit/adds/nims/web/ProductController.java deleted file mode 100644 index c4bc1e2..0000000 --- a/src/main/java/cokr/xit/adds/nims/web/ProductController.java +++ /dev/null @@ -1,120 +0,0 @@ -package cokr.xit.adds.nims.web; - -import java.net.http.HttpResponse; -import java.util.List; -import java.util.function.Consumer; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -import net.minidev.json.JSONObject; -import net.minidev.json.parser.ParseException; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; - -import cokr.xit.adds.cmm.model.ApiBaseResponse; -import cokr.xit.adds.nims.ProductQuery; -import cokr.xit.foundation.data.DataObject; -import cokr.xit.foundation.data.JSON; -import cokr.xit.foundation.web.AbstractController; -import cokr.xit.foundation.web.WebClient; -import cokr.xit.foundation.web.WebClient.Request; -import cokr.xit.foundation.web.WebClient.Request.ContentType; - - - -@Controller -@RequestMapping( - name = "마약류폐기 신청서 접수", - value = {"/adds/nims"} -) -public class ProductController extends AbstractController { - @Value("${app.api.host:}") - private String apiHost; - - private static final String CLASS_URL = "/adds/nims"; - private final JSON json = new JSON(); - - public class METHOD_URL { - public static final String - producthMain = "/product-main.do" // 부과 제외 관리 메인 화면 - , getProductList = "/product-list.do" // 부과 제외 대장 목록 조회 -// , getLevyExclusionInfo = "/020/info.do" // 부과 제외 대장 조회 -// , createLevyExclusion = "/020/create.do" // 부과 제외 대장 등록 - ; - } - - @RequestMapping(name="마약류폐기 신청서 접수 메인", value=METHOD_URL.producthMain) - public ModelAndView bsshMain(String openPage) { - ModelAndView mav = new ModelAndView("adds/nims/product-main"); - - // 사용자 정보 - //ManagedUser managedUser = (ManagedUser)currentUser().getUser(); - - return mav - .addObject("pageName", "productMain") // View(jsp)에서 사용할 id 뒤에 붙일 suffix - .addObject("infoPrefix", "product") // prefix - .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl - .addObject("openPage", openPage) - .addObject("apiHost", apiHost); - } - - @RequestMapping(name="마약류폐기 신청서 접수 조회", value=METHOD_URL.getProductList) - public ModelAndView getbsshList(ProductQuery query) throws JsonProcessingException, ParseException { - ModelAndView mav = new ModelAndView(); - - System.out.println("취급자 조회 : " + query.getSchProductCd()); - - mav.setViewName("jsonView"); - - String sMethod = "POST"; - - DataObject dataObject = new DataObject(); - //dataObject.put("k",""); - dataObject.put("fg","1"); - dataObject.put("pg","1"); - dataObject.put("ymd",""); - dataObject.put("fg2",""); - //query.setSchProductNm("아네폴주사"); - if(!isEmpty(query.getSchProductCd())) dataObject.put("p",query.getSchProductCd()); - if(!isEmpty(query.getSchProductNm())) dataObject.put("pn",query.getSchProductNm()); - dataObject.put("dbSkipYn","N"); - dataObject.put("userId","suji"); - - Consumer configurer = (request) -> { - request.uri("http://localhost:9076/api/biz/nims/v1/getNimsProductInfoKd") - .contentType(ContentType.JSON) - .bodyData(json.stringify(dataObject)); - }; - - HttpResponse hresp = null; - if(sMethod.equals("POST")) { - hresp = new WebClient() - .post(configurer); - } else if(sMethod.equals("GET")) { - hresp = new WebClient() - .get(configurer); - } - String resBody = hresp.body(); - ApiBaseResponse> jsonData = json.parse(resBody, new TypeReference<>() {}); - - - // ApiBaseResponse(code=400, message=상품번호 또는 상품명은 필수 입니다, data=null, totalCount=0, success=false, responseTime=2024-06-12 15:35:24) - if(!jsonData.getSuccess()){ - // error 처리 - // throw new Exception(data.getMessage()); - } - List data = jsonData.getData(); - System.out.println(resBody); - - - ModelAndView result = new ModelAndView("jsonView"); - result.addObject("productMainList", data); - - return result; - } - -} diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/bssh-main.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/bssh-popup.jsp similarity index 95% rename from src/main/webapp/WEB-INF/jsp/adds/nims/bssh-main.jsp rename to src/main/webapp/WEB-INF/jsp/adds/nims/bssh-popup.jsp index 38041ac..a4e120d 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/bssh-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/bssh-popup.jsp @@ -95,10 +95,10 @@ //load : wctx.url("/adds/nims/bssh-list.do") load : '', } - , prefix: "bsshMain" + , prefix: "bsshPopup" , prefixName: "마약류 취급업체 조회" , keymapper: info => info ? info.bsshCd : "" - , dataGetter : obj => obj => { + , dataGetter : obj => { if (!obj.success){ dialog.alert(obj.message); return false; @@ -126,9 +126,9 @@ $("#paging--${pageName}").setPaging({ list: $P.control.dataset , prefix: "paging--${pageName}" - , start: obj.bsshMainStart - , totalSize: obj.bsshMainTotal - , fetchSize: obj.bsshMainFetch + , start: obj.bsshPopupStart + , totalSize: obj.bsshPopupTotal + , fetchSize: obj.bsshPopupFetch , func: "pageObject['${pageName}'].control.load({index})" }); @@ -199,7 +199,13 @@ $P.fnSearchList = () => { // 검색조건 // FIXME: 업체명 또는 식별번호중 하나는 필수 - $P.control.query = $P.formFields.get(); // 검색 조건 + $P.control.query = { + ... $P.formFields.get(), + bc: $P.formFields.get().schBsshCd, + bn: $P.formFields.get().schBsshNm, + dbSkipYn: "N", + userId: "${currentUser.account}" + }; $P.control.query.fetchSize = $P.control.defaultFetchSize; // 한번에 조회되는 자료 건수 $P.control.query.delYn = "N"; // 삭제 여부 @@ -212,9 +218,10 @@ dialog.alert({ content: "현재 " + $P.control.prefixName + " 정보를 선택 하시겠습니까?" , init: () => { setDialogZindex(); } - , onOK: () => { var openPage = new FimsFormFields("#${openPage}"); + , onOK: () => { + let openPage = new FimsFormFields("#${openPage}"); openPage.set (null,$P.control.getCurrent()); // formFields - dialog.close("bsshMainDialog"); + dialog.close("bsshPopupDialog"); } }); } diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseDoc-main.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseDoc-main.jsp index 52f593c..79b3674 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseDoc-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseDoc-main.jsp @@ -304,7 +304,7 @@ let params = {}; ajax.get({ - url : wctx.url("/adds/nims/bssh-main.do") + url : wctx.url("/adds/nims/bssh-popup.do") , data : params || {} , success : resp => { dialog.open({ diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgt-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgt-info.jsp index 00f01d2..7a21177 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgt-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgt-info.jsp @@ -258,11 +258,11 @@ let params = {}; ajax.get({ - url : wctx.url("/adds/nims/bssh-main.do") + url : wctx.url("/adds/nims/bssh-popup.do") , data : params || {} , success : resp => { dialog.open({ - id : "bsshMainDialog" + id : "bsshPopupDialog" , title : dialogTitle , content : resp , size : $P.control.infoSize diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtMapping-main.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtMapping-main.jsp index 54d678f..20397fb 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtMapping-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtMapping-main.jsp @@ -368,11 +368,11 @@ let params = {openPage : "frmSearch--${pageName}"}; ajax.get({ - url : wctx.url("/adds/nims/bssh-main.do") + url : wctx.url("/adds/nims/bssh-popup.do") , data : params , success : resp => { dialog.open({ - id : "bsshMainDialog" + id : "bsshPopupDialog" , title : dialogTitle , content : resp , size : $P.control.infoSize diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp index 7a57364..90595d4 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp @@ -48,7 +48,7 @@
- +
@@ -103,16 +103,16 @@ - 제품명 제품코드 + 제품명 + 폐기 수량 + 유효기간 제조 번호 제조 일련 번호 - 유효기간 최소 유통단위 수량 최소 유통단위 낱개 단위 수량 낱개 단위 - 폐기 수량 이미지 @@ -120,14 +120,14 @@