From cd555937a96b0dc25bc7613034ec80b91f4b3dd5 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Thu, 27 Jun 2024 17:18:26 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EB=B3=80=EA=B2=BD=20=EC=B2=98=EB=A6=AC=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/adds/biz/nims/dao/BizNimsMapper.java | 2 +- .../nims/service/bean/BizNimsServiceBean.java | 43 +++++-------------- 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java b/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java index 1163285..26658b5 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java +++ b/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java @@ -84,7 +84,7 @@ public interface BizNimsMapper extends AbstractMapper { NimsApiDto.DsuseRptInfo selectDsuseRptInfoByUsrRptIdNo(final Map map); // 이미지 업로드시 이전 이미지 삭제를 위한 fileId 조회 - List selectFileId(Map map); + String[] selectFileId(Map map); void deleteDsuseMgtDtl(final String dscdmngId); 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 8a87ad0..a5ab643 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 @@ -290,10 +290,11 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe bizNimsMapper.updateDsuseMgtReceipt(reqDto); // 파일 삭제 - List fileIds = bizNimsMapper.selectFileId( + String[] fileIds = bizNimsMapper.selectFileId( Map.of("infType", Constants.FILE_INF_TYPE.DSUSE_PRD_IMG.getCode(), "infKey", reqDto.getDscdmngId())); - if (!fileIds.isEmpty()) { - fileService.delete(fileIds.toArray(new String[0])); + if (fileIds.length > 0) { + fileService.delete(fileIds); + } // 폐기관리 상세 삭제 @@ -325,10 +326,10 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe if(bizNimsMapper.updateDsuseMgtRslt(reqDto) == 1){ if("Y".equals(fileChangeYn)) { // 파일 삭제 - List fileIds = bizNimsMapper.selectFileId( + String[] 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 (fileIds.length > 0) { + fileService.delete(fileIds); } int idx = 1; @@ -948,9 +949,9 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe * */ private String uploadFileDeleteAndSave(String infType, String infKey, String subType, MultipartFile mf) { - List fileIds = bizNimsMapper.selectFileId(Map.of("infType", infType, "infKey", infKey, "subType", subType)); - if(!fileIds.isEmpty()){ - fileService.delete(fileIds.toArray(new String[0])); + String[] fileIds = bizNimsMapper.selectFileId(Map.of("infType", infType, "infKey", infKey, "subType", subType)); + if(fileIds.length > 0){ + fileService.delete(fileIds); } return uploadFileSave(infType, infKey, subType, mf); @@ -975,28 +976,4 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe return files.get(0).getId(); } - - - - - - - - - - - - - - // @Override - // public List saveStorageInfo(NimsApiRequest.StorageInfoRequest dto) { - // NimsApiResult.Response result = infNimsService.getStorageInfo(dto); - // List list = result.getResultOrThrow(); - // - // for (NimsApiDto.StorageInfo d : list) { - // d.setRgtr(Constants.NIMS_API_USER_ID); - // bizNimsMapper.mergeStorgeInfo(d); - // } - // return list; - // } }