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 de38832..1b5b6e7 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 @@ -5,6 +5,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; import javax.validation.Validation; import javax.validation.Validator; @@ -618,6 +619,9 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe // 2. 참조사용자보고번호가 있는 경우 처리(rptTyCd : 1 - 취소, 2 - 변경) String errMsg = null; + // thread safe 하도록 CopyOnWriteArrayList 사용 + // List 사용시 java.util.ConcurrentModificationException 발생 - 동시성 문제 + CopyOnWriteArrayList concurrentList = new CopyOnWriteArrayList<>(rtnList); for (NimsApiDto.DsuseRptInfo dto : newList) { dto.setRgtr(reqDto.getUserId()); @@ -633,16 +637,15 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe // FIXME : API 적용 필요 // 결과 return 대상 데이타 List에서 조회한 변경 대상이 있는 경우 replace - for(NimsApiDto.DsuseRptInfo d : rtnList){ - if(d.getOrgUsrRptIdNo().equals(dto.getOrgUsrRptIdNo()) - && d.getUsrRptIdNo().equals(dto.getRefUsrRptIdNo())){ - rtnList.remove(d); - - rtnList.add(dto); - }; + for(NimsApiDto.DsuseRptInfo item : concurrentList){ + if(item.getOrgUsrRptIdNo().equals(dto.getOrgUsrRptIdNo()) + && item.getUsrRptIdNo().equals(dto.getRefUsrRptIdNo())){ + concurrentList.remove(item); + concurrentList.add(dto); + } } } - return rtnList; + return new ArrayList<>(concurrentList); } private List findNimsDsuseRptsOfApi(NimsApiRequest.DsuseRptInfoReq reqDto) { diff --git a/src/main/resources/sql/mapper/biz/nims-mysql-mapper.xml b/src/main/resources/sql/mapper/biz/nims-mysql-mapper.xml index 35cfed1..0e6cf19 100644 --- a/src/main/resources/sql/mapper/biz/nims-mysql-mapper.xml +++ b/src/main/resources/sql/mapper/biz/nims-mysql-mapper.xml @@ -631,7 +631,7 @@ #{dsuseProcessDe}, #{orgUsrRptIdNo}, (SELECT dept_cd FROM tb_user WHERE user_acnt = #{rgtr}), - IF(#{rptTyCd} = '1', 'N', 'Y'), + 'Y', DATE_FORMAT(now(), '%Y%m%d%H%i%s'), #{rgtr} ) @@ -691,7 +691,7 @@ , mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s') , mdfr = #{rgtr} WHERE usr_rpt_id_no = #{refUsrRptIdNo} - AND use_yn = 'Y' + -- AND use_yn = 'Y'