From b734e898305dfef289c32d3a4302b0aa8a9dd014 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Wed, 19 Jun 2024 16:16:44 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=8F=90=EA=B8=B0=EA=B2=B0=EA=B3=BC[?= =?UTF-8?q?=ED=86=B5=EB=B3=B4]=20=EB=B3=80=EA=B2=BD=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC=20=EB=B3=80=EA=B2=BD=20=20=20=20=20=20->?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=20=EB=B3=80=EA=B2=BD=EC=97=AC=EB=B6=80=20?= =?UTF-8?q?=ED=8C=8C=EB=9D=BC=EB=A9=94=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adds/biz/nims/service/BizNimsService.java | 2 +- .../nims/service/bean/BizNimsServiceBean.java | 24 +++++++++++-------- .../adds/biz/nims/web/BizNimsController.java | 5 ++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java b/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java index 8d7a7bc..f5d5a3f 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java +++ b/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java @@ -42,7 +42,7 @@ public interface BizNimsService { // NIMS BIZ //------------------------------------------------------------------------------------------------------ BizNimsRequest.DsuseMgtReceiptReq saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceiptReq dto, final List dtls, List files); - BizNimsRequest.DsuseMgtRsltReq saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRsltReq dto, List files); + BizNimsRequest.DsuseMgtRsltReq saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRsltReq dto, final List files, final String fileChangeYn); List getDsuseMgts(final BizNimsRequest.DsuseMgtInqReq dto, final boolean isForDoc); void modifyPrgsSttsOfDsuseMgt(final BizNimsDto.DsuseMgt dto); NimsApiDto.ProductInfoKd getPrdMnfSeqInfoOfBarcode(final String barcodeStr); diff --git a/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java b/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java index a7532ea..4a0449f 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java +++ b/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java @@ -305,21 +305,25 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe * @return BizNimsRequest.DsuseMgtRslt 생성된 폐기관리 정보 * */ - public BizNimsRequest.DsuseMgtRsltReq saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRsltReq reqDto, final List files) { + public BizNimsRequest.DsuseMgtRsltReq saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRsltReq reqDto, final List files, final String fileChangeYn) { ApiUtil.validate(reqDto, null, validator); reqDto.setRgtr(reqDto.getUserId()); if(bizNimsMapper.updateDsuseMgtRslt(reqDto) == 1){ - // 파일 삭제 - List fileIds = bizNimsMapper.selectFileId(Map.of("infType", Constants.FILE_INF_TYPE.DSUSE_IMG.getCode(), "infKey", reqDto.getDscdmngId())); - if(!fileIds.isEmpty()){ - fileService.delete(fileIds.toArray(new String[0])); - } + if("Y".equals(fileChangeYn)) { + // 파일 삭제 + List fileIds = bizNimsMapper.selectFileId( + Map.of("infType", Constants.FILE_INF_TYPE.DSUSE_IMG.getCode(), "infKey", reqDto.getDscdmngId())); + if (!fileIds.isEmpty()) { + fileService.delete(fileIds.toArray(new String[0])); + } - int idx = 1; - for (MultipartFile mf : files) { - uploadFileSave(Constants.FILE_INF_TYPE.DSUSE_IMG.getCode(), reqDto.getDscdmngId(), String.valueOf(idx), mf); - idx++; + int idx = 1; + for (MultipartFile mf : files) { + uploadFileSave(Constants.FILE_INF_TYPE.DSUSE_IMG.getCode(), reqDto.getDscdmngId(), + String.valueOf(idx), mf); + idx++; + } } } else { diff --git a/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java b/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java index 86070b7..06f2641 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java +++ b/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java @@ -151,11 +151,12 @@ public class BizNimsController { @PostMapping(value = "/saveDsuseMgtRslt") public ApiBaseResponse saveDsuseMgtRslt( @RequestParam("dsuseMgtRsltJsonStr") String dsuseMgtRsltJsonStr, - @RequestParam(value = "dsuseDsuseImgFiles", required = false) List dsuseDsuseImgFiles + @RequestParam(value = "dsuseDsuseImgFiles", required = false) List dsuseDsuseImgFiles, + @RequestParam("fileChangeYn") String fileChangeYn ) { JSON json = new JSON(); BizNimsRequest.DsuseMgtRsltReq rsltDto = json.parse(dsuseMgtRsltJsonStr, new TypeReference<>() {}); - return ApiBaseResponse.of(bizNimsService.saveDsuseMgtRslt(rsltDto, dsuseDsuseImgFiles)); + return ApiBaseResponse.of(bizNimsService.saveDsuseMgtRslt(rsltDto, dsuseDsuseImgFiles, fileChangeYn)); } @Operation(summary = "폐기 보고 조회(NIMS API 폐기보고 조회)", description = "업체의 폐기 보고 정보 목록 조회

NIMS API 호출 결과를 DB에 저장후 Return", tags = { "BIZ NIMS API" })