From c2e1303b97418e937ca82322ec98c9f9d2c740cc Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Wed, 14 Aug 2024 15:38:15 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Nims=20=ED=8F=90=EA=B8=B0=EB=B3=B4?= =?UTF-8?q?=EA=B3=A0=20=ED=99=95=EC=9D=B8=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/cokr/xit/adds/cmm/model/ApiUtil.java | 10 ++++++++++ .../cokr/xit/adds/nims/web/AddsNimsController.java | 2 +- .../WEB-INF/jsp/adds/nims/dsuseMgtMapping-info.jsp | 5 ++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/cokr/xit/adds/cmm/model/ApiUtil.java b/src/main/java/cokr/xit/adds/cmm/model/ApiUtil.java index 2bf3181..d7c8cb9 100644 --- a/src/main/java/cokr/xit/adds/cmm/model/ApiUtil.java +++ b/src/main/java/cokr/xit/adds/cmm/model/ApiUtil.java @@ -44,6 +44,16 @@ public class ApiUtil { return rslt.body(); } + public static String callNimsApiFromJSON(String uri, T cls) { + HttpResponse rslt = new WebClient().post(request -> { + request.contentType(WebClient.Request.ContentType.JSON); + request.uri(uri); + toData(request, cls); + System.out.println("request : " + request); + }); + return rslt.body(); + } + /** * Object -> data로 변환 * @param request WebClient.Request 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 1cd0c51..9a27b15 100644 --- a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java +++ b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java @@ -704,7 +704,7 @@ public class AddsNimsController extends ApplicationController { @RequestMapping(value = "/modifyMappingDsuseMgt.do", name="폐기보고 확인 정보 저장", produces = "application/json;charset=UTF-8") public @ResponseBody ApiBaseResponse> modifyMappingDsuseMgt(@ModelAttribute NimsApiRequest.DsuseMgtMappingReq dto) { - String rslt = ApiUtil.callNimsApi(apiHost + modifyMappingDsuseMgtEndpoint, dto); + String rslt = ApiUtil.callNimsApiFromJSON(apiHost + modifyMappingDsuseMgtEndpoint, dto); return json.parse(rslt, new TypeReference<>() {}); } //------------------------------------------------------------------------------------------------- diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtMapping-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtMapping-info.jsp index f09451a..1ff12dd 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtMapping-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtMapping-info.jsp @@ -402,7 +402,7 @@ ajax.post({ url: wctx.url("/adds/nims/modifyMappingDsuseMgt.do") - , data: JSON.stringify({ + , data: { dscdmngId: $P.formFields.get().dscdmngId, prgrsSttsCd: "21", usrRptIdNo: $P.mappingControl.dataset.getCurrent().usrRptIdNo, @@ -410,8 +410,7 @@ rptTyCd: $P.mappingControl.dataset.getCurrent().rptTyCd, stts: $P.mappingControl.dataset.getCurrent().status, userId: "${currentUser.account}" - }) - , contentType : "application/json; charset=utf-8" + } , success: resp => { if(!resp.success){ dialog.alert({