diff --git a/src/main/java/cokr/xit/adds/cmm/model/NimsApiRequest.java b/src/main/java/cokr/xit/adds/cmm/model/NimsApiRequest.java index 7012315..5fcbabf 100644 --- a/src/main/java/cokr/xit/adds/cmm/model/NimsApiRequest.java +++ b/src/main/java/cokr/xit/adds/cmm/model/NimsApiRequest.java @@ -3,8 +3,11 @@ package cokr.xit.adds.cmm.model; import java.util.List; import org.apache.commons.lang3.StringUtils; +import org.springmodules.validation.bean.conf.loader.annotation.handler.NotEmpty; +import lombok.Builder; import lombok.Data; +import lombok.Setter; /** *
@@ -373,7 +376,54 @@ public class NimsApiRequest {
         private String adds12;
 
         private String userId;
+    }
+
+    @Data
+    public static class DsuseRptMappingInqReq {
+        private String dscdmngId;
+
+        private String userId;
+    }
+
+    @Data
+    public static class DsuseMgtMappingReq {
+        private String dscdmngId;
+
+        /**
+         * 
+         * 폐기관리진행상태 - ADDS11
+         * 01-폐기신청서 접수
+         * 06-폐기통보서작성
+         * 07-폐기내역서작성
+         * 11-폐기보고확인
+         * 21-폐기보고
+         * 99-폐기보고완료
+         * 
+ */ + private String prgrsSttsCd = "11"; + /** + * 사용자보고식별번호 + */ + private String usrRptIdNo; + + /** + * 원사용자보고식별번호 + */ + private String orgUsrRptIdNo; + + /** + * 보고 유형 코드(0-신규,1-취소,2-변경) + */ + private String rptTyCd; + + /** + * 상태 - NIMS의 폐기보고 상태 + */ + private String stts; + + private String userId; + private String rgtr; } } 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 1cf71c6..2ecc8e4 100644 --- a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java +++ b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java @@ -93,6 +93,12 @@ public class AddsNimsController extends ApplicationController { @Value("${app.inf.nims.api.saveDsuseMgtReceipt}") private String saveDsuseMgtReceiptEndpoint; + @Value("${app.inf.nims.api.nimsRptDsuseMgtMapping}") + private String dsuseRptAndDsuseMgtMappingEndpoint; + + @Value("${app.inf.nims.api.modifyMappingDsuseMgt}") + private String modifyMappingDsuseMgtEndpoint; + @Resource(name="sigunguDepartmentService") private SigunguDepartmentService sggDeptService; @@ -488,10 +494,9 @@ public class AddsNimsController extends ApplicationController { String rslt = apiRslt.body(); return json.parse(rslt, new TypeReference<>() {}); - }catch (Exception e){ - + } catch (IOException | InterruptedException e){ + throw new RuntimeException(e); } - return null; } @@ -517,12 +522,22 @@ public class AddsNimsController extends ApplicationController { String rslt = apiRslt.body(); return json.parse(rslt, new TypeReference<>() {}); - }catch (Exception e){ - + } catch (IOException | InterruptedException e){ + throw new RuntimeException(e); } - return null; } + @RequestMapping(value = "/getDsuseRptAndDsuseMgtMapping.do", name="폐기보고 매핑 조회", produces = "application/json;charset=UTF-8") + public @ResponseBody ApiBaseResponse> getDsuseRptAndDsuseMgtMapping(@ModelAttribute NimsApiRequest.DsuseRptMappingInqReq dto) { + String rslt = ApiUtil.callNimsApi(apiHost + dsuseRptAndDsuseMgtMappingEndpoint, dto); + return json.parse(rslt, new TypeReference<>() {}); + } + + @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); + return json.parse(rslt, new TypeReference<>() {}); + } //------------------------------------------------------------------------------------------------- // API server call //------------------------------------------------------------------------------------------------- @@ -717,29 +732,9 @@ public class AddsNimsController extends ApplicationController { var byteOut = new ByteArrayOutputStream(); String lineSeparator = "\r\n"; - // JSON part - byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Disposition: form-data; name=\"dsuseMgtRsltJsonStr\"" + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Type: application/json; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write((dsuseMgtRsltJsonStr + lineSeparator).getBytes(StandardCharsets.UTF_8)); - - // File parts - if (files != null) { - for (MultipartFile file : files) { - byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Disposition: form-data; name=\"dsuseDsuseImgFiles\"; filename=\"" + file.getOriginalFilename() + "\"" + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Type: " + file.getContentType() + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(file.getBytes()); - byteOut.write((lineSeparator).getBytes(StandardCharsets.UTF_8)); - } - } - - // fileChangeYn part - byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Disposition: form-data; name=\"fileChangeYn\"" + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Type: text/plain; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write((fileChangeYn + lineSeparator).getBytes(StandardCharsets.UTF_8)); - + writeJsonString("dsuseMgtRsltJsonStr", dsuseMgtRsltJsonStr, boundary, byteOut, lineSeparator); + writeMultipartFiles("dsuseDsuseImgFiles", files, boundary, byteOut, lineSeparator); + writeJsonString("fileChangeYn", fileChangeYn, boundary, byteOut, lineSeparator); byteOut.write(("--" + boundary + "--" + lineSeparator).getBytes(StandardCharsets.UTF_8)); return HttpRequest.BodyPublishers.ofByteArray(byteOut.toByteArray()); @@ -749,32 +744,33 @@ public class AddsNimsController extends ApplicationController { var byteOut = new ByteArrayOutputStream(); String lineSeparator = "\r\n"; - // JSON part - byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Disposition: form-data; name=\"dsuseMgtJsonStr\"" + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Type: application/json; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write((dsuseMgtJsonStr + lineSeparator).getBytes(StandardCharsets.UTF_8)); + writeJsonString("dsuseMgtJsonStr", dsuseMgtJsonStr, boundary, byteOut, lineSeparator); + writeMultipartFiles("dsusePrdImgFiles", files, boundary, byteOut, lineSeparator); + writeJsonString("dsuseMgtDtlsJsonStr", dsuseMgtDtlsJsonStr, boundary, byteOut, lineSeparator); + byteOut.write(("--" + boundary + "--" + lineSeparator).getBytes(StandardCharsets.UTF_8)); + + return HttpRequest.BodyPublishers.ofByteArray(byteOut.toByteArray()); + } - // File parts + private static void writeMultipartFiles(String attName, List files, String boundary, ByteArrayOutputStream byteOut, + String lineSeparator) throws IOException { if (files != null) { for (MultipartFile file : files) { byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Disposition: form-data; name=\"dsusePrdImgFiles\"; filename=\"" + file.getOriginalFilename() + "\"" + lineSeparator).getBytes(StandardCharsets.UTF_8)); + byteOut.write(("Content-Disposition: form-data; name=\"" + attName + "\"; filename=\"" + file.getOriginalFilename() + "\"" + lineSeparator).getBytes(StandardCharsets.UTF_8)); byteOut.write(("Content-Type: " + file.getContentType() + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8)); byteOut.write(file.getBytes()); - byteOut.write((lineSeparator).getBytes(StandardCharsets.UTF_8)); + byteOut.write(lineSeparator.getBytes(StandardCharsets.UTF_8)); } } + } - // fileChangeYn part + private static void writeJsonString(String attName, String dsuseMgtJsonStr, String boundary, ByteArrayOutputStream byteOut, + String lineSeparator) throws IOException { byteOut.write(("--" + boundary + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Disposition: form-data; name=\"dsuseMgtDtlsJsonStr\"" + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write(("Content-Type: text/plain; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8)); - byteOut.write((dsuseMgtDtlsJsonStr + lineSeparator).getBytes(StandardCharsets.UTF_8)); - - byteOut.write(("--" + boundary + "--" + lineSeparator).getBytes(StandardCharsets.UTF_8)); - - return HttpRequest.BodyPublishers.ofByteArray(byteOut.toByteArray()); + byteOut.write(("Content-Disposition: form-data; name=\"" + attName + "\"" + lineSeparator).getBytes(StandardCharsets.UTF_8)); + byteOut.write(("Content-Type: application/json; charset=UTF-8" + lineSeparator + lineSeparator).getBytes(StandardCharsets.UTF_8)); + byteOut.write((dsuseMgtJsonStr + lineSeparator).getBytes(StandardCharsets.UTF_8)); } //------------------------------------------------------------------------------------------------- // private method diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 0982691..7d82275 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -68,12 +68,16 @@ app: nimsDsuseRptInfo: /api/biz/nims/v1/getNimsDsuseRptInfo # 바코드 조회 prdMnfSeqInfoOfBarcode: /api/biz/nims/v1/getPrdMnfSeqInfoOfBarcode - # 보고문서 정보 목록 조회 - dsuseMgtListForRptDoc: /api/biz/nims/v1/getDsuseMgtListForRptDoc # 폐기신청서 접수 saveDsuseMgtReceipt: /api/biz/nims/v1/saveDsuseMgtReceipt # 폐기결과[통보] 처리 saveDsuseMgtRslt: /api/biz/nims/v1/saveDsuseMgtRslt + # Nims 폐기보고 폐기관리 매핑 조회 + nimsRptDsuseMgtMapping: /api/biz/nims/v1/getDsuseRptAndDsuseMgtMapping + # 폐기보고 정보 매핑 + modifyMappingDsuseMgt: /api/biz/nims/v1/modifyMappingDsuseMgt + # 보고문서 정보 목록 조회 + dsuseMgtListForRptDoc: /api/biz/nims/v1/getDsuseMgtListForRptDoc logging: file: 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 6dc098b..63a2a49 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 @@ -293,7 +293,8 @@ $P.mappingControl = new DatasetControl({ urls : { - load : '', + <%--load : '',--%> + load : wctx.url("/adds/nims/getDsuseRptAndDsuseMgtMapping.do") } , prefix: "dsuseMgtMapping" , prefixName: "마약류 제품 조회" @@ -315,7 +316,7 @@ $P.mappingDtlControl = new DatasetControl({ prefix: "dsuseMgtMapping" - , prefixName: "마약류 취급업체 조회" + , prefixName: "폐기보고 확인 조회" , keymapper: info => info ? info.mnfSeq : "" , dataGetter: obj => obj.${infoPrefix}MappingDtl , infoSize: "xl" @@ -401,7 +402,8 @@ ajax.post({ - url: '' + <%--url: ''--%> + url: wctx.url("/adds/nims/modifyMappingDsuseMgt.do") , data: JSON.stringify({ dscdmngId: $P.formFields.get().dscdmngId, prgrsSttsCd: "21",