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" })