feat: 폐기보고 - 보고정보 API 반영

dev
Jonguk. Lim 5 months ago
parent 60417f08bb
commit 9c0dcd5064

@ -19,6 +19,7 @@ import cokr.xit.adds.biz.nims.model.BizNimsRequest;
import cokr.xit.adds.biz.nims.model.BizNimsResponse; import cokr.xit.adds.biz.nims.model.BizNimsResponse;
import cokr.xit.adds.biz.nims.service.BizNimsService; import cokr.xit.adds.biz.nims.service.BizNimsService;
import cokr.xit.adds.core.Constants; import cokr.xit.adds.core.Constants;
import cokr.xit.adds.core.Constants.RPT_TY_CD;
import cokr.xit.adds.core.spring.exception.ApiCustomException; import cokr.xit.adds.core.spring.exception.ApiCustomException;
import cokr.xit.adds.core.util.ApiUtil; import cokr.xit.adds.core.util.ApiUtil;
import cokr.xit.adds.inf.nims.model.NimsApiDto; import cokr.xit.adds.inf.nims.model.NimsApiDto;
@ -301,6 +302,17 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
List<NimsApiDto.DsuseRptInfo> rtnlist = new ArrayList<>(); List<NimsApiDto.DsuseRptInfo> rtnlist = new ArrayList<>();
for (NimsApiDto.DsuseRptInfo nimsDto : nimsList) { for (NimsApiDto.DsuseRptInfo nimsDto : nimsList) {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
// FIXME: API 적용후 적용 내용 삭제 ///////////////////////
if("신규".equals(nimsDto.getRptTyCd())) {
nimsDto.setRptTyCd(RPT_TY_CD.NEW.getCode());
}else if("취소".equals(nimsDto.getRptTyCd())) {
nimsDto.setRptTyCd(RPT_TY_CD.CANCEL.getCode());
}else if("변경".equals(nimsDto.getRptTyCd())){
nimsDto.setRptTyCd(RPT_TY_CD.MODIFY.getCode());
}
/////////////////////////////////////////////////////////
map.put("usrRptIdNo", nimsDto.getUsrRptIdNo()); map.put("usrRptIdNo", nimsDto.getUsrRptIdNo());
NimsApiDto.DsuseRptInfo infoDto = bizNimsMapper.selectDsuseRptInfoByUsrRptIdNo(map); NimsApiDto.DsuseRptInfo infoDto = bizNimsMapper.selectDsuseRptInfoByUsrRptIdNo(map);
if(isEmpty(infoDto)){ if(isEmpty(infoDto)){
@ -319,7 +331,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 1. 신규(rptTyCd : 0) 저장 - tb_dsuse_rpt_info, tb_dsuse_rpt_info_dtl 생성 // 1. 신규(rptTyCd : 0) 저장 - tb_dsuse_rpt_info, tb_dsuse_rpt_info_dtl 생성
for (NimsApiDto.DsuseRptInfo dto : workList) { for (NimsApiDto.DsuseRptInfo dto : workList) {
// 신규가 아닌 경우 skip // 신규가 아닌 경우 skip
if(!"0".equals(dto.getRptTyCd())) continue; if(!RPT_TY_CD.NEW.getCode().equals(dto.getRptTyCd())) continue;
// 폐기 보고 정보 데이타 생성 // 폐기 보고 정보 데이타 생성
@ -333,7 +345,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
if(newList.size() > 1){ if(newList.size() > 1){
throw ApiCustomException.create("폐기 관리 데이타 매핑 오류[폐기 관리 데이타 중복]"); throw ApiCustomException.create("폐기 관리 데이타 매핑 오류[폐기 관리 데이타 중복]");
} }
if(bizNimsMapper.updateMappingDsuseMgt(newList.get(0)) == 1){ if(!newList.isEmpty() && bizNimsMapper.updateMappingDsuseMgt(newList.get(0)) == 1){
throw ApiCustomException.create("폐기 관리 데이타 매핑 오류[폐기 관리 데이타 매핑 실패]"); throw ApiCustomException.create("폐기 관리 데이타 매핑 오류[폐기 관리 데이타 매핑 실패]");
}; };
} }
@ -344,7 +356,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
dto.setRgtr(reqDto.getUserId()); dto.setRgtr(reqDto.getUserId());
// 신규인 경우 skip // 신규인 경우 skip
if("0".equals(dto.getRptTyCd())) continue; if(RPT_TY_CD.NEW.getCode().equals(dto.getRptTyCd())) continue;
// 2-1. refUsrRptIdNo 필수 체크 // 2-1. refUsrRptIdNo 필수 체크
if(isEmpty(dto.getRefUsrRptIdNo())){ if(isEmpty(dto.getRefUsrRptIdNo())){
@ -370,7 +382,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
&& d.getUsrRptIdNo().equals(dto.getRefUsrRptIdNo())){ && d.getUsrRptIdNo().equals(dto.getRefUsrRptIdNo())){
rtnlist.remove(d); rtnlist.remove(d);
if(dto.getRptTyCd().equals("2")){ if(dto.getRptTyCd().equals(RPT_TY_CD.MODIFY.getCode())){
rtnlist.add(dto); rtnlist.add(dto);
} }
}; };
@ -495,10 +507,11 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
if(isForDoc) apiKey = getApiInfInfo(reqDto.getUserId()).get("apiKey"); if(isForDoc) apiKey = getApiInfInfo(reqDto.getUserId()).get("apiKey");
for (BizNimsResponse.DsuseMgtRes dto : resList) { for (BizNimsResponse.DsuseMgtRes dto : resList) {
dto.setRptTyCdNm(Constants.RPT_TY_CD.getName(dto.getRptTyCd())); // FIXME: API 적용 완류후 command 제거
dto.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(dto.getDsuseSeCd())); //dto.setRptTyCdNm(RPT_TY_CD.getName(dto.getRptTyCd()));
dto.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(dto.getDsusePrvCd())); // dto.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(dto.getDsuseSeCd()));
dto.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(dto.getDsuseMthCd())); // dto.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(dto.getDsusePrvCd()));
// dto.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(dto.getDsuseMthCd()));
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("dscdmngId", dto.getDscdmngId()); map.put("dscdmngId", dto.getDscdmngId());
@ -610,7 +623,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 신규(rptTyCd : 0) 저장 - tb_dsuse_rpt_info, tb_dsuse_rpt_info_dtl 생성 // 신규(rptTyCd : 0) 저장 - tb_dsuse_rpt_info, tb_dsuse_rpt_info_dtl 생성
for (NimsApiDto.DsuseRptInfo dto : newList) { for (NimsApiDto.DsuseRptInfo dto : newList) {
// 신규가 아닌 경우 skip // 신규가 아닌 경우 skip
if(!"0".equals(dto.getRptTyCd())) continue; if(!RPT_TY_CD.NEW.getCode().equals(dto.getRptTyCd())) continue;
// 폐기 보고 정보 데이타 생성 // 폐기 보고 정보 데이타 생성
createDsuseRpt(dto, reqDto.getUserId()); createDsuseRpt(dto, reqDto.getUserId());
@ -631,7 +644,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
String errMsg = null; String errMsg = null;
for (NimsApiDto.DsuseRptInfo dto : newList) { for (NimsApiDto.DsuseRptInfo dto : newList) {
// 신규인 경우 skip // 신규인 경우 skip
if("0".equals(dto.getRptTyCd())) continue; if(RPT_TY_CD.NEW.getCode().equals(dto.getRptTyCd())) continue;
// 4-0) 참조사용자보고식별번호 필수 체크 // 4-0) 참조사용자보고식별번호 필수 체크
if(isEmpty(dto.getRefUsrRptIdNo())){ if(isEmpty(dto.getRefUsrRptIdNo())){
@ -830,13 +843,14 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
*/ */
private void createDsuseRpt(final NimsApiDto.DsuseRptInfo dto, String userId) { private void createDsuseRpt(final NimsApiDto.DsuseRptInfo dto, String userId) {
dto.setRgtr(userId); dto.setRgtr(userId);
dto.setRptTyCdNm(Constants.RPT_TY_CD.getName(dto.getRptTyCd())); // FIXME: API 적용 완류후 command 제거
dto.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(dto.getDsuseSeCd())); // dto.setRptTyCdNm(RPT_TY_CD.getName(dto.getRptTyCd()));
dto.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(dto.getDsusePrvCd())); // dto.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(dto.getDsuseSeCd()));
dto.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(dto.getDsuseMthCd())); // dto.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(dto.getDsusePrvCd()));
// dto.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(dto.getDsuseMthCd()));
// 신규가 아닌 경우 : 원사용자보고식별번호 조회 & set // 신규가 아닌 경우 : 원사용자보고식별번호 조회 & set
if("0".equals(dto.getRptTyCd())){ if(RPT_TY_CD.NEW.getCode().equals(dto.getRptTyCd())){
dto.setOrgUsrRptIdNo(dto.getUsrRptIdNo()); dto.setOrgUsrRptIdNo(dto.getUsrRptIdNo());
}else{ }else{
setOrgUsrRptIdNo(dto); setOrgUsrRptIdNo(dto);
@ -845,11 +859,14 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
if (bizNimsMapper.insertDsuseRptInfo(dto) == 1) { if (bizNimsMapper.insertDsuseRptInfo(dto) == 1) {
//취소인 경우 상세 데이타 등록 skip //취소인 경우 상세 데이타 등록 skip
if("1".equals(dto.getRptTyCd())) return; if(RPT_TY_CD.CANCEL.getCode().equals(dto.getRptTyCd())) return;
int dtlCnt = 0; int dtlCnt = 0;
for (NimsApiDto.DsuseRptInfoDtl d : dto.getListDtl()) { for (NimsApiDto.DsuseRptInfoDtl d : dto.getListDtl()) {
d.setRgtr(Constants.NIMS_API_USER_ID); d.setRgtr(userId);
// FIXME: API 적용 완류후 아래 라인 제거
d.setUsrRptLnIdNo(d.getUsrRptIdNo()+"_"+(dtlCnt+1));
///////////////////////////////////////////////////
dtlCnt = dtlCnt + bizNimsMapper.insertDsuseRptInfoDtl(d); dtlCnt = dtlCnt + bizNimsMapper.insertDsuseRptInfoDtl(d);
} }
if (dto.getRndDtlRptCnt() != dtlCnt) if (dto.getRndDtlRptCnt() != dtlCnt)
@ -885,7 +902,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
continue; continue;
} }
if("0".equals(map.get("rptTyCd"))){ if(RPT_TY_CD.NEW.getCode().equals(map.get("rptTyCd"))){
dto.setOrgUsrRptIdNo(map.get("usrRptIdNo")); dto.setOrgUsrRptIdNo(map.get("usrRptIdNo"));
break; break;
} else { } else {
@ -909,8 +926,8 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
private void updateDsuseRptAndDsuseMgt(NimsApiDto.DsuseRptInfo dto, String userId) { private void updateDsuseRptAndDsuseMgt(NimsApiDto.DsuseRptInfo dto, String userId) {
dto.setRgtr(userId); dto.setRgtr(userId);
String errMsg; String errMsg;
if ("1".equals(dto.getRptTyCd())) errMsg = "취소"; if (RPT_TY_CD.CANCEL.getCode().equals(dto.getRptTyCd())) errMsg = RPT_TY_CD.CANCEL.getNm();
else errMsg = "변경"; else errMsg = RPT_TY_CD.MODIFY.getNm();
if (bizNimsMapper.updateCancelDsuseRptInfo(dto) == 1) { if (bizNimsMapper.updateCancelDsuseRptInfo(dto) == 1) {
// FIXME : 폐기 관리 테이블에 사용자보고식별번호 반영 // FIXME : 폐기 관리 테이블에 사용자보고식별번호 반영
@ -1041,7 +1058,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// */ // */
// private void setAddBsshInfo(List<BizNimsResponse.DsuseRptInfoRes> resList) { // private void setAddBsshInfo(List<BizNimsResponse.DsuseRptInfoRes> resList) {
// for (BizNimsResponse.DsuseRptInfoRes r : resList) { // for (BizNimsResponse.DsuseRptInfoRes r : resList) {
// r.setRptTyCdNm(Constants.RPT_TY_CD.getName(r.getRptTyCd())); // r.setRptTyCdNm(RPT_TY_CD.getName(r.getRptTyCd()));
// r.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(r.getDsuseSeCd())); // r.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(r.getDsuseSeCd()));
// r.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(r.getDsusePrvCd())); // r.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(r.getDsusePrvCd()));
// r.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(r.getDsuseMthCd())); // r.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(r.getDsuseMthCd()));

@ -611,7 +611,7 @@ public class NimsApiDto {
/** /**
* *
*/ */
@JsonAlias("PRDCT_NM") @JsonAlias("PRDUCT_NM")
private String prductNm; private String prductNm;
/** /**

@ -74,7 +74,7 @@ public class NimsApiResult2 {
} }
return body.list; return body.list;
} }
throw Objects.requireNonNull(ApiCustomException.of("header")); throw Objects.requireNonNull(ApiCustomException.create(header.resultMsg));
} }
/** /**
@ -89,7 +89,7 @@ public class NimsApiResult2 {
if(header.resultCd == 0 || header.resultCd == 8) { if(header.resultCd == 0 || header.resultCd == 8) {
return body.list; return body.list;
} }
throw Objects.requireNonNull(ApiCustomException.of("header")); throw Objects.requireNonNull(ApiCustomException.create(header.resultMsg));
} }
@JsonIgnore @JsonIgnore

@ -164,7 +164,13 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
// "listDtl": "[{PCE_UNIT=정 PRDUCT_CD=8806519017940 DSUSE_QY=28 MNF_NO=20005 MNF_SEQ=2010136201005327 MIN_DISTB_UNIT=병 PRD_VALID_DE=20230722 PCE_QY=0 PRDUCT_NM=졸피신정10mg (10mg) USR_RPT_ID_NO=AAR_R240108122001673_H0000 MIN_DISTB_QY=1}]", // "listDtl": "[{PCE_UNIT=정 PRDUCT_CD=8806519017940 DSUSE_QY=28 MNF_NO=20005 MNF_SEQ=2010136201005327 MIN_DISTB_UNIT=병 PRD_VALID_DE=20230722 PCE_QY=0 PRDUCT_NM=졸피신정10mg (10mg) USR_RPT_ID_NO=AAR_R240108122001673_H0000 MIN_DISTB_QY=1}]",
NimsApiResult2 tempResult = json.parse(rslt, new TypeReference<>() {}); NimsApiResult2 tempResult = json.parse(rslt, new TypeReference<>() {});
List<Object> list = tempResult.getResponse().getResult(); List<Object> list = null;
try{
list = tempResult.getResponse().getResult();
} catch (ApiCustomException e) {
throw e;
}
list = tempResult.getResponse().getResult();
for (Object o : list) { for (Object o : list) {
Map<String,Object> map = (Map)o; Map<String,Object> map = (Map)o;

@ -318,7 +318,7 @@
rgtr rgtr
) VALUES ( ) VALUES (
#{dscdmngId}, #{dscdmngId},
(SELECT dept_cd FROM tb_user WHERE user_id = #{userId}), (SELECT dept_cd FROM tb_user WHERE user_acnt = #{userId}),
#{userId}, #{userId},
#{prgrsSttsCd}, #{prgrsSttsCd},
#{bsshCd}, #{bsshCd},
@ -630,7 +630,7 @@
#{status}, #{status},
#{dsuseProcessDe}, #{dsuseProcessDe},
#{orgUsrRptIdNo}, #{orgUsrRptIdNo},
(SELECT dept_cd FROM tb_user WHERE user_acnt = #{userId}), (SELECT dept_cd FROM tb_user WHERE user_acnt = #{rgtr}),
IF(#{rptTyCd} = '1', 'N', 'Y'), IF(#{rptTyCd} = '1', 'N', 'Y'),
DATE_FORMAT(now(), '%Y%m%d%H%i%s'), DATE_FORMAT(now(), '%Y%m%d%H%i%s'),
#{rgtr} #{rgtr}

Loading…
Cancel
Save