From c96cfd8defcc794c63e055eb2a3cc95a3a54be5d Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Tue, 22 Oct 2024 12:14:57 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=8F=90=EA=B8=B0=EA=B2=B0=EA=B3=BC?= =?UTF-8?q?=EC=9D=98=20=ED=8F=90=EA=B8=B0=EC=9E=A5=EC=86=8C=20=EC=9D=BC?= =?UTF-8?q?=EA=B4=84=20=EB=B3=80=EA=B2=BD=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/adds/biz/nims/dao/BizNimsMapper.java | 3 +++ .../nims/service/bean/BizNimsServiceBean.java | 25 ++++++++++++++----- .../sql/mapper/biz/nims-mysql-mapper.xml | 22 ++++++++++++++++ 3 files changed, 44 insertions(+), 6 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 c145b33..c135721 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 @@ -44,6 +44,9 @@ public interface BizNimsMapper extends AbstractMapper { int insertDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceiptReq dto); int updateDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceiptReq dto); + + Optional selectCheckDsuseLocBydscdmngId(final String dscdmngId); + void updateDsuseLocOfDsuseMgt(final BizNimsRequest.DsuseMgtRsltReq dto); int updateDsuseMgtRslt(final BizNimsRequest.DsuseMgtRsltReq dto); int insertDsuseMgtDtl(final BizNimsDto.DsuseMgtDtl dto); 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 5bad15e..c3c783f 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 @@ -190,8 +190,6 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe if(isEmpty(reqDto.getK())){ reqDto.setK(getApiInfInfo(reqDto.getUserId()).get("apiKey")); } - reqDto.setFg("1"); // 조회범위(1-전체,2-내거래처품목,3-청구코드매핑) - reqDto.setPg("1"); // 조회페이지 reqDto.setFg2(""); // 중점일반구분(all, 1:중점, 2:일반) // 제품코드로 제품정보 조회 @@ -201,10 +199,10 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe if(isEmpty(curList)) return curList; //FIXME: 신규 API 적용 - 조회 결과 저장 skip - for (NimsApiDto.ProductInfoKd d : curList) { - d.setRgtr(reqDto.getUserId()); - bizNimsMapper.mergeProductInfoKd(d); - } + // for (NimsApiDto.ProductInfoKd d : curList) { + // d.setRgtr(reqDto.getUserId()); + // bizNimsMapper.mergeProductInfoKd(d); + // } // 제조 번호, 일련번호, 유효기간 정보 목록 추가 if(isMnfSeqInfo) productInfoaddMnfSeqs(curList, reqDto.getBc(), reqDto.getK()); @@ -362,6 +360,21 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe ApiUtil.validate(reqDto, null, validator); reqDto.setRgtr(reqDto.getUserId()); + // ------------------------------------------------------------------------------------------------ + // 폐기장소 변경 여부 체크 - 폐기 결과를 공유하는 데이타 + // 폐기구분, 폐기일자, 폐기방법이 동일한 건에 대하여 폐기장소 일괄 변경 + // ------------------------------------------------------------------------------------------------ + // 폐기장소가 null인 경우 - request 데이타로 set + final String dsuseLoc = bizNimsMapper.selectCheckDsuseLocBydscdmngId(reqDto.getDscdmngId()) + .orElse(reqDto.getDsuseLoc()); + + // 1. 폐기장소가 null(또는 "")인 경우 - 신규 저장 -> 폐기장소 저장으로 이동 + // 2. 1이 아니고, 저장된 폐기장소와 request 폐기장소가 다르면 해당 데이타를 공유하는 모든건 변경 + if(!isEmpty(dsuseLoc) && !reqDto.getDsuseLoc().equals(dsuseLoc)){ + bizNimsMapper.updateDsuseLocOfDsuseMgt(reqDto); + } + // ------------------------------------------------------------------------------------------------ + if(bizNimsMapper.updateDsuseMgtRslt(reqDto) == 1){ if("Y".equals(fileChangeYn)) { Map map = Map.of("infType", Constants.FILE_INF_TYPE.DSUSE_IMG.getCode(), "infKey", reqDto.getDscdmngId()); 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 09f5199..4405ef6 100644 --- a/src/main/resources/sql/mapper/biz/nims-mysql-mapper.xml +++ b/src/main/resources/sql/mapper/biz/nims-mysql-mapper.xml @@ -295,6 +295,28 @@ WHERE dscdmng_id = #{dscdmngId} + + + + /** nims-mysql-mapper|updateDsuseLocOfDsuseMgt-폐기관리 결과의 폐기장소 변경|julim */ + UPDATE tb_dsuse_mgt + SET dsuse_loc = #{dsuseLoc} + , mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s') + , mdfr = #{rgtr} + WHERE use_yn = 'Y' + AND dept_cd = (SELECT dept_cd FROM tb_user WHERE user_acnt = #{userId}) + AND dsuse_mth_cd = #{dsuseMthCd} + AND dsuse_se_cd = #{dsuseSeCd} + AND dsuse_de = #{dsuseDe} + AND tb_dsuse_mgt.dscdmng_id != #{dscdmngId} + + + /** nims-mysql-mapper|updateDsuseMgtRslt-폐기관리 정보 변경|julim */ UPDATE tb_dsuse_mgt