폐기관리 <-> 폐기보고정보 매핑 처리 반영

dev
Jonguk. Lim 6 months ago
parent 14e9623dc1
commit 6a0c6fa51c

@ -3,7 +3,7 @@ package cokr.xit.adds.biz.iros.service;
import java.util.List;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtl;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlRequest;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlReq;
/**
* <pre>
@ -20,5 +20,5 @@ import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlRequest;
* </pre>
*/
public interface BizIrosService {
List<DrugPrdtMcpnDtl> getDrugPrdtMcpnDtls(DrugPrdtMcpnDtlRequest dto);
List<DrugPrdtMcpnDtl> getDrugPrdtMcpnDtls(DrugPrdtMcpnDtlReq dto);
}

@ -6,7 +6,7 @@ import org.springframework.stereotype.Service;
import cokr.xit.adds.biz.iros.service.BizIrosService;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtl;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlRequest;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlReq;
import cokr.xit.adds.inf.iros.model.IrosResponse;
import cokr.xit.adds.inf.iros.service.InfIrosService;
import cokr.xit.foundation.component.AbstractServiceBean;
@ -34,7 +34,7 @@ public class BizIrosServiceBean extends AbstractServiceBean implements BizIrosSe
private final InfIrosService infIrosService;
@Override
public List<DrugPrdtMcpnDtl> getDrugPrdtMcpnDtls(DrugPrdtMcpnDtlRequest dto) {
public List<DrugPrdtMcpnDtl> getDrugPrdtMcpnDtls(DrugPrdtMcpnDtlReq dto) {
IrosResponse<DrugPrdtMcpnDtl> rslt = infIrosService.getDrugPrdtMcpnDtls(dto);
return rslt.getResultOrThrow();

@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import cokr.xit.adds.biz.iros.service.BizIrosService;
import cokr.xit.adds.core.model.ApiBaseResponse;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtl;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlRequest;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlReq;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
@ -39,7 +39,7 @@ public class BizIrosController {
@Operation(summary = "의약 제품 주성분 상세 정보 조회", description = "의약 제품 주성분 상세 정보 조회")
@PostMapping("/getDrugPrdtMcpnDtls")
public ApiBaseResponse<List<DrugPrdtMcpnDtl>> getDrugPrdtMcpnDtls(
@RequestBody DrugPrdtMcpnDtlRequest dto
@RequestBody DrugPrdtMcpnDtlReq dto
) {
return ApiBaseResponse.of(bizIrosService.getDrugPrdtMcpnDtls(dto));
}

@ -32,9 +32,9 @@ public interface BizNimsMapper extends AbstractMapper {
// NIMS API CALL
//------------------------------------------------------------------------------------------------------
void mergeBsshInfoSt(NimsApiDto.BsshInfoSt dto);
List<NimsApiDto.BsshInfoSt> selectBsshInfos(NimsApiRequest.BsshInfoRequest dto);
List<NimsApiDto.BsshInfoSt> selectBsshInfos(NimsApiRequest.BsshInfoReq dto);
void mergeProductInfoKd(NimsApiDto.ProductInfoKd dto);
List<NimsApiDto.ProductInfoKd> selectProductInfos(NimsApiRequest.ProductInfoRequest dto);
List<NimsApiDto.ProductInfoKd> selectProductInfos(NimsApiRequest.ProductInfoReq dto);
// int mergeStorgeInfo(NimsApiDto.StorageInfo dto);
//------------------------------------------------------------------------------------------------------
@ -42,22 +42,27 @@ public interface BizNimsMapper extends AbstractMapper {
//------------------------------------------------------------------------------------------------------
int insertDsuseMgt(BizNimsRequest.DsuseMgt dto);
int insertDsuseMgtDtl(BizNimsRequest.DsuseMgtDtl dto);
List<BizNimsResponse.DsuseMgtResponse> selectDsuseMgts(BizNimsRequest.DsuseMgtInq dto);
List<BizNimsResponse.DsuseMgtDtlResponse> selectDsuseMgtDtls(Map<String, String> map);
List<BizNimsResponse.DsuseMgtRes> selectDsuseMgts(BizNimsRequest.DsuseMgtInq dto);
List<BizNimsResponse.DsuseMgtDtlRes> selectDsuseMgtDtls(Map<String, String> map);
int updateMappingDsuseMgt(BizNimsResponse.DsuseMgtRes mgtDto);
int insertDsuseRptInfo(NimsApiDto.DsuseRptInfo dto);
int insertDsuseRptInfoDtl(NimsApiDto.DsuseRptInfoDtl dto);
int updateCancelDsuseRptInfo(NimsApiDto.DsuseRptInfo dto);
int updateCancelDsuseRptInfoDtl(NimsApiDto.DsuseRptInfo dto);
int updateCancelDsuseMgt(NimsApiDto.DsuseRptInfo dto);
// int updateCancelDsuseMgt(NimsApiDto.DsuseRptInfo dto);
Map<String, String> recusiveRefUsrRptIdNo(String refUsrRptIdNo);
/**
*
*/
int updateUsrRptIdNoOfDsuseMgt(NimsApiDto.DsuseRptInfo dto);
NimsApiDto.DsuseRptInfo selectDsuseRptInfoByUsrRptIdNo(Map<String, String> map);
List<NimsApiDto.DsuseRptInfoDtl> selectDsuseRptInfoDtls(Map<String, String> map);
List<BizNimsResponse.DsuseRptInfoResponse> selectSavedDsuseMgts(List<String> dsuseMgtIds);
List<BizNimsResponse.DsuseRptInfoRes> selectSavedDsuseMgts(List<String> dsuseMgtIds);
// int insertDsuseMgtDtl(BizNimsRequest.DsuseMgtDtl dto);
// int updateCancelDsuseMgtDtl(BizNimsRequest.DsuseMgt dto);

@ -11,6 +11,7 @@ import javax.validation.constraints.Pattern;
import com.fasterxml.jackson.annotation.JsonProperty;
import cokr.xit.adds.core.Constants;
import cokr.xit.adds.core.model.AuditDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
@ -83,8 +84,8 @@ public class BizNimsRequest {
* <pre>
*
*
* 01-
* 02-
* 01-
* 02-
* 11-()
* 21-
* 22-
@ -93,9 +94,9 @@ public class BizNimsRequest {
* 99-
* </pre>
*/
@Schema(requiredMode = REQUIRED, title = "진행 상태 코드", example = " ", allowableValues = {"01", "02", "11", "22", "31", "41", "99"})
@Schema(requiredMode = REQUIRED, title = "진행 상태 코드", example = " ", allowableValues = {"01", "02", "11", "21", "22", "31", "41", "99"})
@Pattern(regexp = "01|02|11|22|31|41|99", message = "진행 상태 코드는 필수 입니다")
private String prgrsSttsCd = "01";
private String prgrsSttsCd = Constants.PRGRS_STTS_CD.RECEIPT.getCode();
}
/**
@ -125,8 +126,8 @@ public class BizNimsRequest {
* <pre>
*
*
* 01-
* 02-
* 01-
* 02-
* 11-()
* 21-
* 22-
@ -135,7 +136,7 @@ public class BizNimsRequest {
* 99-
* </pre>
*/
private String prgrsSttsCd = "01";
private String prgrsSttsCd = Constants.PRGRS_STTS_CD.RECEIPT.getCode();
/**
*
@ -270,6 +271,14 @@ public class BizNimsRequest {
private String usrRptIdNo;
// 사용자_보고_라인_식별_번호
private String usrRptLnIdNo;
/**
* <pre>
* ()
* -> "Y"
* </pre>
*/
private String validYn;
}
/**
@ -291,10 +300,10 @@ public class BizNimsRequest {
/**
* <pre>
*
*
*
* 01-
* 02-
* 01-
* 02-
* 11-()
* 21-
* 22-
@ -303,8 +312,8 @@ public class BizNimsRequest {
* 99-
* </pre>
*/
@Schema(requiredMode = REQUIRED, title = "진행 상태 코드", example = " ", allowableValues = {"01", "02", "11", "22", "31", "41", "99"})
private String prgrsSttsCd = "01";
@Schema(requiredMode = REQUIRED, title = "진행 상태 코드", example = " ", allowableValues = {"01", "02", "11", "21", "22", "31", "41", "99"})
private String prgrsSttsCd = Constants.PRGRS_STTS_CD.RECEIPT.getCode();
}
/**
* request

@ -1,5 +1,6 @@
package cokr.xit.adds.biz.nims.model;
import cokr.xit.adds.core.Constants;
import cokr.xit.adds.inf.nims.model.NimsApiDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
@ -26,13 +27,13 @@ public class BizNimsResponse {
/**
* response
*/
@Schema(name = "DsuseMgtResponse", description = "폐기관리정보 조회 response DTO")
@Schema(name = "DsuseMgtRes", description = "폐기관리정보 조회 response DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public static class DsuseMgtResponse extends BizNimsRequest.DsuseMgt {
public static class DsuseMgtRes extends BizNimsRequest.DsuseMgt {
private String dsuseSeCdNm;
private String dsusePrvCdNm;
@ -55,13 +56,13 @@ public class BizNimsResponse {
/**
* response
*/
@Schema(name = "DsuseMgtDtlResponse", description = "폐기관리상세정보 조회 response DTO")
@Schema(name = "DsuseMgtDtlRes", description = "폐기관리상세정보 조회 response DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public static class DsuseMgtDtlResponse extends BizNimsRequest.DsuseMgtDtl {
public static class DsuseMgtDtlRes extends BizNimsRequest.DsuseMgtDtl {
/**
*
@ -94,13 +95,13 @@ public class BizNimsResponse {
/**
* response
*/
@Schema(name = "DsuseRptInfoResponse", description = "폐기보고관리정보 조회 response DTO")
@Schema(name = "DsuseRptInfoRes", description = "폐기보고관리정보 조회 response DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public static class DsuseRptInfoResponse extends NimsApiDto.DsuseRptInfo {
public static class DsuseRptInfoRes extends NimsApiDto.DsuseRptInfo {
private String dscdmngId;
private String userId;
@ -109,8 +110,8 @@ public class BizNimsResponse {
* <pre>
*
*
* 01-
* 02-
* 01-
* 02-
* 11-()
* 21-
* 22-
@ -119,7 +120,7 @@ public class BizNimsResponse {
* 99-
* </pre>
*/
private String prgrsSttsCd = "01";
private String prgrsSttsCd = Constants.PRGRS_STTS_CD.RECEIPT.getCode();
/**
* <pre>

@ -26,9 +26,9 @@ public interface BizNimsService {
//------------------------------------------------------------------------------------------------------
// NIMS API CALL
//------------------------------------------------------------------------------------------------------
List<NimsApiDto.BsshInfoSt> saveBsshInfoSt(NimsApiRequest.BsshInfoRequest dto);
List<NimsApiDto.ProductInfoKd> saveProductInfoKd(NimsApiRequest.ProductInfoRequest dto, boolean isMnfSeqInfo);
List<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoRequest dto);
List<NimsApiDto.BsshInfoSt> saveBsshInfoSt(NimsApiRequest.BsshInfoReq dto);
List<NimsApiDto.ProductInfoKd> saveProductInfoKd(NimsApiRequest.ProductInfoReq dto, boolean isMnfSeqInfo);
List<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoReq dto);
// List<NimsApiDto.JurisdictionGovInfo> getJurisdictionGovInfo(NimsApiRequest.JurisdictionGovInfoRequest dto);
// List<NimsApiDto.StorageInfo> saveStorageInfo(NimsApiRequest.StorageInfoRequest dto);
@ -49,7 +49,7 @@ public interface BizNimsService {
* @return List<NimsApiDto.DsuseRptInfo>
* </pre>
*/
List<NimsApiDto.DsuseRptInfo> saveDsuseRptInfo(NimsApiRequest.DsuseRptInfoRequest dto);
List<NimsApiDto.DsuseRptInfo> saveDsuseRptInfo(NimsApiRequest.DsuseRptInfoReq dto);
//------------------------------------------------------------------------------------------------------
// NIMS BIZ
@ -59,11 +59,11 @@ public interface BizNimsService {
// NimsAarResult cancelReportDsuse();
BizNimsRequest.DsuseMgt saveDsuseMgt(BizNimsRequest.DsuseMgt dto);
List<BizNimsResponse.DsuseMgtResponse> getDsuseMgts(BizNimsRequest.DsuseMgtInq dto);
List<BizNimsResponse.DsuseMgtRes> getDsuseMgts(BizNimsRequest.DsuseMgtInq dto);
@Deprecated
List<BizNimsResponse.DsuseRptInfoResponse> saveDsuseMgts(List<BizNimsRequest.DsuseMgt> dtos);
// @Deprecated
// List<BizNimsResponse.DsuseRptInfoResponse> saveDsuseMgts(List<BizNimsRequest.DsuseMgt> dtos);
// BizNimsAarDto.AarHeader getTgtDsuseRptData(BizNimsRequest.DsuseMgt dto);

@ -22,7 +22,7 @@ import cokr.xit.adds.core.util.ApiUtil;
import cokr.xit.adds.inf.nims.model.NimsApiDto;
import cokr.xit.adds.inf.nims.model.NimsApiDto.BsshInfoSt;
import cokr.xit.adds.inf.nims.model.NimsApiRequest;
import cokr.xit.adds.inf.nims.model.NimsApiRequest.BsshInfoRequest;
import cokr.xit.adds.inf.nims.model.NimsApiRequest.BsshInfoReq;
import cokr.xit.adds.inf.nims.model.NimsApiResult;
import cokr.xit.adds.inf.nims.service.InfNimsService;
import cokr.xit.foundation.component.AbstractServiceBean;
@ -75,7 +75,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* </pre>
*/
@Override
public List<BsshInfoSt> saveBsshInfoSt(BsshInfoRequest dto) {
public List<BsshInfoSt> saveBsshInfoSt(BsshInfoReq dto) {
if(!isEmpty(dto.getBn()) && dto.getBn().length() < 3) {
throw ApiCustomException.create("업체[사업자]명은 3자 이상 으로 조회해 주세요");
}
@ -120,7 +120,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* </pre>
*/
@Override
public List<NimsApiDto.ProductInfoKd> saveProductInfoKd(NimsApiRequest.ProductInfoRequest dto, boolean isMnfSeqInfo) {
public List<NimsApiDto.ProductInfoKd> saveProductInfoKd(NimsApiRequest.ProductInfoReq dto, boolean isMnfSeqInfo) {
if(isEmpty(dto.getP()) && isEmpty(dto.getPn())){
throw ApiCustomException.create("상품번호 또는 상품명은 필수 입니다");
}
@ -161,7 +161,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
}
@Override
public List<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoRequest dto) {
public List<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoReq dto) {
NimsApiResult.Response<NimsApiDto.MnfSeqInfo> response = infNimsService.getMnfSeqInfo(dto);
List<NimsApiDto.MnfSeqInfo> results = response.getResultOrThrow();
@ -203,7 +203,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* </pre>
*/
@Override
public List<NimsApiDto.DsuseRptInfo> saveDsuseRptInfo(NimsApiRequest.DsuseRptInfoRequest reqDto) {
public List<NimsApiDto.DsuseRptInfo> saveDsuseRptInfo(NimsApiRequest.DsuseRptInfoReq reqDto) {
List<NimsApiDto.DsuseRptInfo> rsltList = new ArrayList<>();
while(true) {
@ -217,6 +217,29 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
if(rslt.isEndYn()) break;
reqDto.setPg(String.valueOf(Integer.parseInt(reqDto.getPg()) + 1));
}
// TODO: 보고관리-보고정보 매핑 처리
// 미완료(종료)된 폐기 관리 목록 조회
List<BizNimsResponse.DsuseMgtRes> dsuseMgts = getDsuseMgts(BizNimsRequest.DsuseMgtInq.builder()
.prgrsSttsCd(Constants.PRGRS_STTS_CD.END.getCode())
.build());
//////////////////////////////////////////////////////////////////////////////
// FIXME : 테스트를 위한 코드
//////////////////////////////////////////////////////////////////////////////
// for (NimsApiDto.DsuseRptInfo dto : rsltList) {
// // 폐기 관리 데이타 매핑
// for(BizNimsResponse.DsuseMgtResponse mgtDto: dsuseMgts){
// // 폐기 신청서 접수 상태 데이타만 처리
// if(Constants.PRGRS_STTS_CD.RECEIPT.getCode().equals(mgtDto.getPrgrsSttsCd())){
// dto.mappingDsuseRptInfo(mgtDto);
// };
// }
// }
// if(true) return null;
//////////////////////////////////////////////////////////////////////////////
// 0. 조회(저장)한 데이타 대상 에서 제외 (usrRptIdNo가 DB에 저장된 경우)
List<NimsApiDto.DsuseRptInfo> list = new ArrayList<>();
for (NimsApiDto.DsuseRptInfo dto : rsltList) {
@ -235,8 +258,20 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 신규가 아닌 경우 skip
if(!"0".equals(dto.getRptTyCd())) continue;
// 폐기 보고 정보 데이타 생성
createDsuseRpt(dto, true);
// FIXME : 폐기 관리 데이타 매핑
List<BizNimsResponse.DsuseMgtRes> newList = dto.mappingNewDsuseRptInfo(dsuseMgts);
if(newList.size() > 1){
throw ApiCustomException.create("폐기 관리 데이타 매핑 오류[폐기 관리 데이타 중복]");
}
if(bizNimsMapper.updateMappingDsuseMgt(newList.get(0)) == 1){
throw ApiCustomException.create("폐기 관리 데이타 매핑 오류[폐기 관리 데이타 매핑 실패]");
};
}
// 2. 신규 외의 경우(rptTyCd : 1 - 취소, 2 - 변경)
String errMsg = null;
@ -261,6 +296,15 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 2-3. tb_dsuse_rpt_info, tb_dsuse_rpt_info_dtl 생성 (취소인 경우는 tb_dsuse_rpt_info의 사용 여부 'N'으로 생성)
createDsuseRpt(dto, false);
// FIXME : 폐기 관리 데이타 매핑
List<BizNimsResponse.DsuseMgtRes> newList = dto.mappingDsuseRptInfo(dsuseMgts);
if(newList.size() > 1){
throw ApiCustomException.create("폐기 관리 데이타 매핑 오류[폐기 관리 데이타 중복]");
}
if(bizNimsMapper.updateMappingDsuseMgt(newList.get(0)) == 1){
throw ApiCustomException.create("폐기 관리 데이타 매핑 오류[폐기 관리 데이타 매핑 실패]");
};
}
@ -273,6 +317,14 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
//------------------------------------------------------------------------------------------------------
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
/**
* <pre>
*
* @param dto BizNimsRequest.DsuseMgt
* @return BizNimsRequest.DsuseMgt
* </pre>
*/
public BizNimsRequest.DsuseMgt saveDsuseMgt(BizNimsRequest.DsuseMgt dto) {
ApiUtil.validate(dto, null, validator);
if(dto.getRndDtlRptCnt() != dto.getDsuseMgtDtls().size()) throw ApiCustomException.create("폐기물 보고수 오류[폐기물 갯수 확인]");
@ -293,11 +345,18 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
return dto;
}
/**
* <pre>
*
* @param dto BizNimsRequest.DsuseMgtInq
* @return List<BizNimsResponse.DsuseMgtResponse>
* </pre>
*/
@Override
public List<BizNimsResponse.DsuseMgtResponse> getDsuseMgts(BizNimsRequest.DsuseMgtInq dto) {
List<BizNimsResponse.DsuseMgtResponse> resList = bizNimsMapper.selectDsuseMgts(dto);
public List<BizNimsResponse.DsuseMgtRes> getDsuseMgts(BizNimsRequest.DsuseMgtInq dto) {
List<BizNimsResponse.DsuseMgtRes> resList = bizNimsMapper.selectDsuseMgts(dto);
for (BizNimsResponse.DsuseMgtResponse r : resList) {
for (BizNimsResponse.DsuseMgtRes r : resList) {
r.setRptTyCdNm(Constants.RPT_TY_CD.getName(r.getRptTyCd()));
r.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(r.getDsuseSeCd()));
r.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(r.getDsusePrvCd()));
@ -305,7 +364,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
Map<String, String> map = new HashMap<>();
map.put("dscdmngId", r.getDscdmngId());
List<BizNimsResponse.DsuseMgtDtlResponse> dsuseRptInfoDtls = bizNimsMapper.selectDsuseMgtDtls(map);
List<BizNimsResponse.DsuseMgtDtlRes> dsuseRptInfoDtls = bizNimsMapper.selectDsuseMgtDtls(map);
setDsuseMgtDtlAddProductInfo(dsuseRptInfoDtls);
r.getDsuseMgtDtls().addAll(dsuseRptInfoDtls);
}
@ -318,32 +377,31 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
/**
* <pre>
*
*
* @param dtos List<BizNimsRequest.DsuseMgt>
* @return List<BizNimsResponse.DsuseMgtResponse>
* @return List<BizNimsResponse.DsuseRptInfoResponse>
* </pre>
*/
@Deprecated
@Override
public List<BizNimsResponse.DsuseRptInfoResponse> saveDsuseMgts(List<BizNimsRequest.DsuseMgt> dtos) {
for (BizNimsRequest.DsuseMgt dto : dtos) {
ApiUtil.validate(dto, null, validator);
}
final List<String> dscdmngIds = new ArrayList<>();
for (BizNimsRequest.DsuseMgt dto : dtos) {
dto.setRgtr(Constants.NIMS_API_USER_ID);
bizNimsMapper.insertDsuseMgt(dto);
dscdmngIds.add(dto.getDscdmngId());
}
List<BizNimsResponse.DsuseRptInfoResponse> resList = bizNimsMapper.selectSavedDsuseMgts(dscdmngIds);
// 마약류취급업체의 허가번호(prmisnNo), 대표자명(rprsntvNm) set
setAddBsshInfo(resList);
return resList;
}
// @Deprecated
// @Override
// public List<BizNimsResponse.DsuseRptInfoResponse> saveDsuseMgts(List<BizNimsRequest.DsuseMgt> dtos) {
// for (BizNimsRequest.DsuseMgt dto : dtos) {
// ApiUtil.validate(dto, null, validator);
// }
//
// final List<String> dscdmngIds = new ArrayList<>();
// for (BizNimsRequest.DsuseMgt dto : dtos) {
// dto.setRgtr(Constants.NIMS_API_USER_ID);
//
// bizNimsMapper.insertDsuseMgt(dto);
// dscdmngIds.add(dto.getDscdmngId());
// }
// List<BizNimsResponse.DsuseRptInfoResponse> resList = bizNimsMapper.selectSavedDsuseMgts(dscdmngIds);
//
// // 마약류취급업체의 허가번호(prmisnNo), 대표자명(rprsntvNm) set
// setAddBsshInfo(resList);
//
// return resList;
// }
//------------------------------------------------------------------------------------------------------
@ -357,15 +415,15 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* @param dtlList <NimsApiDto.DsuseRptInfoDtl>
* </pre>
*/
private void setDsuseMgtDtlAddProductInfo(List<BizNimsResponse.DsuseMgtDtlResponse> dtlList) {
private void setDsuseMgtDtlAddProductInfo(List<BizNimsResponse.DsuseMgtDtlRes> dtlList) {
for (BizNimsResponse.DsuseMgtDtlResponse r : dtlList) {//if()
for (BizNimsResponse.DsuseMgtDtlRes r : dtlList) {//if()
// 마약항정구분(nrcdSeNm), 중점일반구분(prtmSenm)
if (isEmpty(r.getNrcdSeNm()) || isEmpty(r.getPrtmSeNm())) {
//NimsApiResult.Response<NimsApiDto.ProductInfoKd> result = infNimsService.getProductInfoKd(
List<NimsApiDto.ProductInfoKd> list = saveProductInfoKd(
NimsApiRequest.ProductInfoRequest.builder()
NimsApiRequest.ProductInfoReq.builder()
.fg("1")
.pg("1")
.p(r.getPrductCd())
@ -386,7 +444,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 제조수입자명(bsshNm)
if (isEmpty(r.getBsshNm()) && !isEmpty(r.getBsshCd())) {
List<BsshInfoSt> list = saveBsshInfoSt(
BsshInfoRequest.builder()
BsshInfoReq.builder()
.fg("1")
.pg("1")
.bc(r.getBsshCd())
@ -419,13 +477,14 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
else errMsg = "변경";
if (bizNimsMapper.updateCancelDsuseRptInfo(dto) == 1) {
// TODO : 폐기 관리 테이블에 사용자보고식별번호 반영
// tb_dsuse_mgt
// 조건 : 사용자보고식별번호 = 참조사용자보고식별번호
// => usr_rpt_id_no -> refUsrRptIdNo update
// => 취소인 경우 use_yn = 'N' update
if(bizNimsMapper.updateCancelDsuseMgt(dto) == 0){
throw ApiCustomException.create("폐기보고정보 변경 적용 실패\n[폐기관리테이블에 사용자보고식별번호 = 참조사용자보고식별번호에 해당하는 데이타 미존재]");
}
// if(bizNimsMapper.updateCancelDsuseMgt(dto) == 0){
// throw ApiCustomException.create("폐기보고정보 변경 적용 실패\n[폐기관리테이블에 사용자보고식별번호 = 참조사용자보고식별번호에 해당하는 데이타 미존재]");
// }
int cnt = bizNimsMapper.updateCancelDsuseRptInfoDtl(dto);
if(cnt == 0) throw ApiCustomException.create(String.format("폐기 정보 상세 %s 실패", errMsg));
@ -461,6 +520,9 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
dto.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(dto.getDsusePrvCd()));
dto.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(dto.getDsuseMthCd()));
// TODO : 폐기 관리 테이블에 사용자보고식별번호 반영
// 원 사용자 식별 번호 set - 변경/취소 인 경우
// 신규인 경우는 사용자보고식별번호로 설정
if(!isNew){
String refUsrRptIdNo = dto.getRefUsrRptIdNo();
@ -485,10 +547,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
}
//취소인 경우 상세 데이타 등록 skip
//if("1".equals(dto.getRptTyCd())) return;
// TODO : 폐기 관리 테이블에 사용자보고식별번호 반영
if (bizNimsMapper.insertDsuseRptInfo(dto) == 1) {
//취소인 경우 상세 데이타 등록 skip
@ -513,8 +572,8 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* @param resList List<BizNimsResponse.DsuseMgtResponse>
* </pre>
*/
private void setAddBsshInfo(List<BizNimsResponse.DsuseRptInfoResponse> resList) {
for (BizNimsResponse.DsuseRptInfoResponse r : resList) {
private void setAddBsshInfo(List<BizNimsResponse.DsuseRptInfoRes> resList) {
for (BizNimsResponse.DsuseRptInfoRes r : resList) {
r.setRptTyCdNm(Constants.RPT_TY_CD.getName(r.getRptTyCd()));
r.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(r.getDsuseSeCd()));
r.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(r.getDsusePrvCd()));
@ -522,7 +581,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
if (isEmpty(r.getPrmisnNo())) {
List<BsshInfoSt> list = saveBsshInfoSt(
BsshInfoRequest.builder()
BsshInfoReq.builder()
.fg("1")
.pg("1")
.bc(r.getBsshCd())
@ -555,7 +614,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
//NimsApiResult.Response<NimsApiDto.ProductInfoKd> result = infNimsService.getProductInfoKd(
List<NimsApiDto.ProductInfoKd> list = saveProductInfoKd(
NimsApiRequest.ProductInfoRequest.builder()
NimsApiRequest.ProductInfoReq.builder()
.fg("1")
.pg("1")
.p(r.getPrductCd())
@ -576,7 +635,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 제조수입자명(bsshNm)
if (isEmpty(r.getBsshNm()) && !isEmpty(r.getBsshCd())) {
List<BsshInfoSt> list = saveBsshInfoSt(
BsshInfoRequest.builder()
BsshInfoReq.builder()
.fg("1")
.pg("1")
.bc(r.getBsshCd())
@ -607,7 +666,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
productCd = d.getPrductCd();
List<NimsApiDto.MnfSeqInfo> mnfList = getMnfSeqInfo(
NimsApiRequest.MnfSeqInfoRequest.builder()
NimsApiRequest.MnfSeqInfoReq.builder()
.fg("1")
.pg("1")
.p(d.getPrductCd())

@ -48,7 +48,7 @@ public class BizNimsController {
@Operation(summary = "마약류 취급자 정보 조회(NIMS API)", description = "마약류 취급자 정보 조회<br><br>NIMS API 호출 결과를 DB에 저장후 결과 Return<br><br><strong>bi-사업자등록번호, hp-요양기관번호, bn-업체명, bc-취급자식별번호 중 하나는 필수<strong>")
@PostMapping(value = "/getBsshInfoSt")
public ApiBaseResponse<List<NimsApiDto.BsshInfoSt>> getBsshInfoSt(
@RequestBody @Validated NimsApiRequest.BsshInfoRequest dto
@RequestBody @Validated NimsApiRequest.BsshInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.saveBsshInfoSt(dto));
}
@ -56,7 +56,7 @@ public class BizNimsController {
@Operation(summary = "마약류 상품 정보 조회(NIMS API)", description = "마약류 상품정보 조회<br><br>NIMS API 호출 결과를 DB에 저장후 결과 Return")
@PostMapping(value = "/getProductInfoKd")
public ApiBaseResponse<List<NimsApiDto.ProductInfoKd>> getMnfSeqInfo(
@RequestBody @Validated NimsApiRequest.ProductInfoRequest dto
@RequestBody @Validated NimsApiRequest.ProductInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.saveProductInfoKd(dto, false));
}
@ -64,7 +64,7 @@ public class BizNimsController {
@Operation(summary = "마약류 상품 정보 & 제조번호 조회(NIMS API)", description = "마약류 상품정보 & 제조번호 조회<br><br>NIMS API 호출 결과를 DB에 저장후 결과 Return")
@PostMapping(value = "/getProductInfoKdAndMnfSeqInfo")
public ApiBaseResponse<List<NimsApiDto.ProductInfoKd>> getProductInfoKdAndMnfSeqInfo(
@RequestBody @Validated NimsApiRequest.ProductInfoRequest dto
@RequestBody @Validated NimsApiRequest.ProductInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.saveProductInfoKd(dto, true));
}
@ -72,15 +72,15 @@ public class BizNimsController {
@Operation(summary = "제조 일련 번호 정보 조회(NIMS API)", description = "제보 일련 번호 정보 조회<br><br>NIMS API 호출 결과 Return")
@PostMapping(value = "/getMnfSeqInfo")
public ApiBaseResponse<List<NimsApiDto.MnfSeqInfo>> getMnfSeqInfo(
@RequestBody @Validated NimsApiRequest.MnfSeqInfoRequest dto
@RequestBody @Validated NimsApiRequest.MnfSeqInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.getMnfSeqInfo(dto));
}
@Operation(summary = "업체 폐기 보고 정보 조회(NIMS API)", description = "업체 폐기 보고 정보 조회<br><br>NIMS API 호출 결과를 DB에 저장후 Return")
@Operation(summary = "폐기 보고 정보 목록 조회(NIMS API)", description = "업체 폐기 보고 정보 목록 조회<br><br>NIMS API 호출 결과를 DB에 저장후 Return")
@PostMapping("/getDsuseRptInfo")
public ApiBaseResponse<List<NimsApiDto.DsuseRptInfo>> getDsuseRptInfo(
@RequestBody @Validated NimsApiRequest.DsuseRptInfoRequest dto
@RequestBody @Validated NimsApiRequest.DsuseRptInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.saveDsuseRptInfo(dto));
}
@ -139,7 +139,7 @@ public class BizNimsController {
@Operation(summary = "사고 마약류 폐기 관리 목록 조회", description = "사고 마약류 폐기 관리 목록 조회<br><br>사고마약류 관리대장, 결과통보서, 폐기현황등에 필요한 내용 조회")
@PostMapping(value = "/getDsuseMgts")
public ApiBaseResponse<List<BizNimsResponse.DsuseMgtResponse>> getDsuseMgts(
public ApiBaseResponse<List<BizNimsResponse.DsuseMgtRes>> getDsuseMgts(
@RequestBody BizNimsRequest.DsuseMgtInq dto
) {
return ApiBaseResponse.of(bizNimsService.getDsuseMgts(dto));
@ -153,47 +153,47 @@ public class BizNimsController {
@Operation(deprecated = true, summary = "사고 마약류 폐기 관리 생성", description = "사고 마약류 폐기 관리 생성<br><br>폐기관리 데이타 생성후 폐기보고 정보 return")
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(value = """
[
{
"userId":"userid1",
"usrRptIdNo":"22222",
"orgUsrRptIdNo":"22222"
},
{
"userId":"userid1",
"usrRptIdNo":"44444",
"orgUsrRptIdNo":"44444"
},
{
"userId":"userid1",
"usrRptIdNo":"77777",
"orgUsrRptIdNo":"33333"
}
]
""")
})
})
@PostMapping("/saveDsuseMgts")
public ApiBaseResponse<List<BizNimsResponse.DsuseRptInfoResponse>> saveDsuseMgts(
@RequestBody List<BizNimsRequest.DsuseMgt> dtos
) {
return ApiBaseResponse.of(bizNimsService.saveDsuseMgts(dtos));
}
@Operation(deprecated = true, summary = "사고 마약류 폐기 관리 목록 조회", description = "사고 마약류 폐기 관리 목록 조회<br><br>사고마약류 관리대장, 결과통보서, 폐기현황등에 필요한 내용 조회")
@PostMapping(value = "/getDsuseMgts2")
public ApiBaseResponse<List<BizNimsResponse.DsuseRptInfoResponse>> getDsuseMgts2(
public ApiBaseResponse<List<BizNimsResponse.DsuseRptInfoRes>> getDsuseMgts2(
@RequestBody BizNimsRequest.DsuseMgtInq dto
) {
return null; //ApiBaseResponse.of(bizNimsService.getDsuseMgts(dto));
}
// @Operation(deprecated = true, summary = "사고 마약류 폐기 관리 생성", description = "사고 마약류 폐기 관리 생성<br><br>폐기관리 데이타 생성후 폐기보고 정보 return")
// @io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
// @Content(mediaType = "application/json", examples = {
// @ExampleObject(value = """
// [
// {
// "userId":"userid1",
// "usrRptIdNo":"22222",
// "orgUsrRptIdNo":"22222"
// },
// {
// "userId":"userid1",
// "usrRptIdNo":"44444",
// "orgUsrRptIdNo":"44444"
// },
// {
// "userId":"userid1",
// "usrRptIdNo":"77777",
// "orgUsrRptIdNo":"33333"
// }
// ]
// """)
// })
// })
// @PostMapping("/saveDsuseMgts")
// public ApiBaseResponse<List<BizNimsResponse.DsuseRptInfoResponse>> saveDsuseMgts(
// @RequestBody List<BizNimsRequest.DsuseMgt> dtos
// ) {
// return ApiBaseResponse.of(bizNimsService.saveDsuseMgts(dtos));
// }
// @Operation(summary = "관할 허가 관청 정보 조회(NIMS API)", description = "관할 허가 관청 정보 조회<br><br>NIMS API 호출 결과 Return")

@ -179,6 +179,54 @@ public class Constants {
}
}
/**
* <pre>
* - ADDS11
* 01-
* 02-
* 11-()
* 21-
* 22-
* 31-
* 41-
* 99-
* </pre>
*/
@Getter
public enum PRGRS_STTS_CD {
// 폐기보고신청서의 데이타 입력 생성 - 폐기관리 데이타 생성
RECEIPT("01", "폐기신청서접수"),
// 폐기보고 데이타 매핑 완료
MAPPING("02", "폐기보고매핑"),
ACCEPT("11", "민원수령처리(전자결재)"),
NOTICE_WRITE("21", "폐기결과통보서작성"),
REPORT_WRITE("22", "폐기결과보고서작성"),
DRAFT("31", "기안 및 발송"),
REPORT("41", "폐기보고"),
END("99", "종료")
;
private final String code;
private final String nm;
PRGRS_STTS_CD(String code, String nm) {
this.code = code;
this.nm = nm;
}
public static String getName(final String code){
if(StringUtils.isEmpty(code)) return StringUtils.EMPTY;
return Arrays.stream(PRGRS_STTS_CD.values())
.filter(ssc -> ssc.getCode().equals(code))
.findFirst()
.map(PRGRS_STTS_CD::getNm)
.orElseThrow(() -> ApiCustomException.create(String.format("미 정의된 폐기 관리 진행 상태 코드[%s]", code)));
//return eNum.getNm();
}
}
/**
* <pre>
* - ADDS06

@ -28,13 +28,13 @@ import lombok.NoArgsConstructor;
*
* </pre>
*/
@Schema(name = "DrugPrdtMcpnDtlRequest", description = "의약 제품 주성분 상세 정보 조회 request")
@Schema(name = "DrugPrdtMcpnDtlReq", description = "의약 제품 주성분 상세 정보 조회 request")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class DrugPrdtMcpnDtlRequest {
public class DrugPrdtMcpnDtlReq {
@Schema(requiredMode = REQUIRED, title = "서비스 키", description = "서비스 키", example = "0fTkYnZU6XjaAPAp6GzKW9Q6fYq8iaoSH9wKUZwz2PBjRXGM04aUgtO3a61xYGjL8nFZn4fjLGS9XErhMSXq%2Bw%3D%3D")
@NotEmpty(message = "서비스 키는 필수 입니다")
private String serviceKey;

@ -1,7 +1,7 @@
package cokr.xit.adds.inf.iros.service;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtl;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlRequest;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlReq;
import cokr.xit.adds.inf.iros.model.IrosResponse;
/**
@ -20,5 +20,5 @@ import cokr.xit.adds.inf.iros.model.IrosResponse;
* </pre>
*/
public interface InfIrosService {
IrosResponse<DrugPrdtMcpnDtl> getDrugPrdtMcpnDtls(DrugPrdtMcpnDtlRequest dto);
IrosResponse<DrugPrdtMcpnDtl> getDrugPrdtMcpnDtls(DrugPrdtMcpnDtlReq dto);
}

@ -13,7 +13,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.adds.core.spring.exception.ApiCustomException;
import cokr.xit.adds.core.util.ApiUtil;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtl;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlRequest;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlReq;
import cokr.xit.adds.inf.iros.model.IrosResponse;
import cokr.xit.adds.inf.iros.service.InfIrosService;
import cokr.xit.foundation.component.AbstractServiceBean;
@ -53,7 +53,7 @@ public class InfIrosServiceBean extends AbstractServiceBean implements InfIrosSe
private String drugPrdtMcpnDtlInq;
@Override
public IrosResponse<DrugPrdtMcpnDtl> getDrugPrdtMcpnDtls(DrugPrdtMcpnDtlRequest dto) {
public IrosResponse<DrugPrdtMcpnDtl> getDrugPrdtMcpnDtls(DrugPrdtMcpnDtlReq dto) {
dto.setServiceKey(irosApiKey);
ApiUtil.validate(dto, null, validator);

@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.RestController;
import cokr.xit.adds.core.model.ApiBaseResponse;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtl;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlRequest;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlReq;
import cokr.xit.adds.inf.iros.model.IrosResponse;
import cokr.xit.adds.inf.iros.service.InfIrosService;
import io.swagger.v3.oas.annotations.Operation;
@ -39,7 +39,7 @@ public class InfIrosController {
@Operation(summary = "의약 제품 주성분 상세 정보 조회", description = "의약 제품 주성분 상세 정보 조회")
@PostMapping("/getDrugPrdtMcpnDtls")
public ApiBaseResponse<IrosResponse<DrugPrdtMcpnDtl>> getDrugPrdtMcpnDtls(
@RequestBody DrugPrdtMcpnDtlRequest dto
@RequestBody DrugPrdtMcpnDtlReq dto
) {
return ApiBaseResponse.of(infIrosService.getDrugPrdtMcpnDtls(dto));
}

@ -6,12 +6,18 @@ import java.util.List;
import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import cokr.xit.adds.biz.nims.model.BizNimsRequest;
import cokr.xit.adds.biz.nims.model.BizNimsResponse;
import cokr.xit.adds.core.Constants;
import cokr.xit.adds.core.model.AuditDto;
import cokr.xit.adds.core.spring.exception.ApiCustomException;
import lombok.AllArgsConstructor;
@ -404,6 +410,141 @@ public class NimsApiDto {
@Builder.Default
@Valid
private List<DsuseRptInfoDtl> dsuseRptInfoDtls = new ArrayList<>();
/**
* <pre>
*
* -> -
* ->
*
* 1.
* 2. set
* -> - (02) set
* -> , , , set
* @param dsuseMgts List<BizNimsResponse.DsuseMgtRes>
* @return List<BizNimsResponse.DsuseMgtRes>
* </pre>
*/
@JsonIgnore
public List<BizNimsResponse.DsuseMgtRes> mappingNewDsuseRptInfo(List<BizNimsResponse.DsuseMgtRes> dsuseMgts){
List<BizNimsResponse.DsuseMgtRes> newList = new ArrayList<>();
for(BizNimsResponse.DsuseMgtRes mgtDto: dsuseMgts) {
// 폐기 신청서 접수 상태 데이타만 처리
if (Constants.PRGRS_STTS_CD.RECEIPT.getCode().equals(mgtDto.getPrgrsSttsCd())) {
String rptInfo = String.join("",
this.bsshCd, // 마약류취급자식별번호
this.hdrDe, // 취급일자
this.rptDe, // 보고일자
this.dsuseSeCd, // 폐기구분코드
this.dsusePrvCd, // 폐기사유코드
this.dsuseMthCd, // 폐기방법코드
this.dsuseDe, // 폐기일자
String.valueOf(this.rndDtlRptCnt) // 수불상세보고수
);
String mgtInfo = String.join("",
mgtDto.getBsshCd(), // 마약류취급자식별번호
mgtDto.getHdrDe(), // 취급일자
mgtDto.getRptDe(), // 보고일자
mgtDto.getDsuseSeCd(), // 폐기구분코드
mgtDto.getDsusePrvCd(), // 폐기사유코드
mgtDto.getDsuseMthCd(), // 폐기방법코드
mgtDto.getDsuseDe(), // 폐기일자
String.valueOf(mgtDto.getRndDtlRptCnt()) // 수불상세보고수
);
// FIXME: 폐기관리와 폐기보고의 상품정보 일치 여부 set - 비교 필드 확정 필요
if (rptInfo.equals(mgtInfo)) {
if (this.dsuseRptInfoDtls.size() == mgtDto.getDsuseMgtDtls().size()) {
for (DsuseRptInfoDtl rptDtl : this.dsuseRptInfoDtls) {
for (BizNimsRequest.DsuseMgtDtl mgtDtl : mgtDto.getDsuseMgtDtls()) {
if (rptDtl.getPrductCd().equals(mgtDtl.getPrductCd())
// && rptDtl.getMnfNo().equals(mgtDtl.getMnfNo())
// && rptDtl.getPrdValidDe().equals(mgtDtl.getPrdValidDe())
// && rptDtl.getMnfSeq().equals(mgtDtl.getMnfSeq())
&& rptDtl.getDsuseQy().equals(mgtDtl.getDsuseQy())) {
mgtDtl.setValidYn("Y");
break;
}
}
}
}
mgtDto.setUsrRptIdNo(this.usrRptIdNo);
mgtDto.setOrgUsrRptIdNo(this.orgUsrRptIdNo);
mgtDto.setRptTyCd(this.rptTyCd);
mgtDto.setStts(this.status);
mgtDto.setPrgrsSttsCd(Constants.PRGRS_STTS_CD.MAPPING.getCode());
mgtDto.setRgtr(this.getRgtr());
newList.add(mgtDto);
}
}
}
return newList;
}
/**
* <pre>
*
* ->
*
* 1.
* 2. set
* 2-1. - ( )
* 2-2.
* -> - (02) set
* -> , , , set
* @param dsuseMgts List<BizNimsResponse.DsuseMgtRes>
* @return List<BizNimsResponse.DsuseMgtRes>
* </pre>
*/
@JsonIgnore
public List<BizNimsResponse.DsuseMgtRes> mappingDsuseRptInfo(List<BizNimsResponse.DsuseMgtRes> dsuseMgts){
List<BizNimsResponse.DsuseMgtRes> newList = new ArrayList<>();
for(BizNimsResponse.DsuseMgtRes mgtDto: dsuseMgts) {
if (this.orgUsrRptIdNo.equals(mgtDto.getOrgUsrRptIdNo())) {
// 취소인 경우
// 폐기관리에 매핑된 정보 초기화
if (Constants.RPT_TY_CD.CANCEL.getCode().equals(this.rptTyCd)) {
mgtDto.setUsrRptIdNo(StringUtils.EMPTY);
mgtDto.setOrgUsrRptIdNo(StringUtils.EMPTY);
mgtDto.setRptTyCd(StringUtils.EMPTY);
mgtDto.setStts(StringUtils.EMPTY);
mgtDto.setPrgrsSttsCd(Constants.PRGRS_STTS_CD.RECEIPT.getCode());
mgtDto.setRgtr(this.getRgtr());
newList.add(mgtDto);
continue;
}
// FIXME: 상품정보 미일치 여부 set - 비교 필드 확정 필요
if (this.dsuseRptInfoDtls.size() == mgtDto.getDsuseMgtDtls().size()) {
for (DsuseRptInfoDtl rptDtl : this.dsuseRptInfoDtls) {
for (BizNimsRequest.DsuseMgtDtl mgtDtl : mgtDto.getDsuseMgtDtls()) {
if (rptDtl.getPrductCd().equals(mgtDtl.getPrductCd())
// && rptDtl.getMnfNo().equals(mgtDtl.getMnfNo())
// && rptDtl.getPrdValidDe().equals(mgtDtl.getPrdValidDe())
// && rptDtl.getMnfSeq().equals(mgtDtl.getMnfSeq())
&& rptDtl.getDsuseQy().equals(mgtDtl.getDsuseQy())) {
mgtDtl.setValidYn("Y");
break;
}
}
}
}
mgtDto.setUsrRptIdNo(this.usrRptIdNo);
mgtDto.setOrgUsrRptIdNo(this.orgUsrRptIdNo);
mgtDto.setRptTyCd(this.rptTyCd);
mgtDto.setStts(this.status);
mgtDto.setPrgrsSttsCd(Constants.PRGRS_STTS_CD.MAPPING.getCode());
mgtDto.setRgtr(this.getRgtr());
newList.add(mgtDto);
}
}
return newList;
}
}
@Getter
@ -512,6 +653,7 @@ public class NimsApiDto {
// /**
// * 관할 허가 관청 정보 조회 response
// */

@ -34,12 +34,12 @@ public class NimsApiRequest {
/**
* request
*/
@Schema(name = "BsshInfoRequest", description = "마약류 취급자 정보 조회 request")
@Schema(name = "BsshInfoReq", description = "마약류 취급자 정보 조회 request")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class BsshInfoRequest {
public static class BsshInfoReq {
/**
*
@ -128,12 +128,12 @@ public class NimsApiRequest {
/**
* request
*/
@Schema(name = "ProductInfoRequest", description = "상품 정보 조회 request")
@Schema(name = "ProductInfoReq", description = "상품 정보 조회 request")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class ProductInfoRequest {
public static class ProductInfoReq {
/**
*
*/
@ -205,12 +205,12 @@ public class NimsApiRequest {
private String dbSkipYn = "N";
}
@Schema(name = "DsuseRptInfoRequest", description = "폐기 보고 정보 조회 request")
@Schema(name = "DsuseRptInfoReq", description = "폐기 보고 정보 조회 request")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class DsuseRptInfoRequest {
public static class DsuseRptInfoReq {
/**
*
*/
@ -318,12 +318,12 @@ public class NimsApiRequest {
/**
* request
*/
@Schema(name = "MnfSeqInfoRequest", description = "제품 일련 번호 정보 조회 request")
@Schema(name = "MnfSeqInfoReq", description = "제품 일련 번호 정보 조회 request")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class MnfSeqInfoRequest {
public static class MnfSeqInfoReq {
/**
*
*/
@ -382,7 +382,7 @@ public class NimsApiRequest {
// @NoArgsConstructor
// @AllArgsConstructor
// @Builder
// public static class JurisdictionGovInfoRequest {
// public static class JurisdictionGovInfoReq {
// /**
// * 인증키
// */
@ -435,7 +435,7 @@ public class NimsApiRequest {
// @NoArgsConstructor
// @AllArgsConstructor
// @Builder
// public static class StorageInfoRequest {
// public static class StorageInfoReq {
// /**
// * 인증키
// */

@ -20,15 +20,15 @@ import cokr.xit.adds.inf.nims.model.NimsApiResult;
* </pre>
*/
public interface InfNimsService {
NimsApiResult.Response<NimsApiDto.BsshInfoSt> getBsshInfoSt(NimsApiRequest.BsshInfoRequest dto);
NimsApiResult.Response<NimsApiDto.BsshInfoSt> getBsshInfoSt(NimsApiRequest.BsshInfoReq dto);
NimsApiResult.Response<NimsApiDto.ProductInfoKd> getProductInfoKd(NimsApiRequest.ProductInfoRequest dto);
NimsApiResult.Response<NimsApiDto.ProductInfoKd> getProductInfoKd(NimsApiRequest.ProductInfoReq dto);
NimsApiResult.Response<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoRequest dto);
NimsApiResult.Response<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoReq dto);
//
// NimsApiResult.Response<NimsApiDto.JurisdictionGovInfo> getJurisdictionGovInfo(NimsApiRequest.JurisdictionGovInfoRequest dto);
//
// NimsApiResult.Response<NimsApiDto.StorageInfo> getStorageInfo(NimsApiRequest.StorageInfoRequest dto);
NimsApiResult.Response<NimsApiDto.DsuseRptInfo> getDsuseRptInfo(NimsApiRequest.DsuseRptInfoRequest dto);
NimsApiResult.Response<NimsApiDto.DsuseRptInfo> getDsuseRptInfo(NimsApiRequest.DsuseRptInfoReq dto);
}

@ -77,7 +77,7 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
@Override
@TraceLogging
public NimsApiResult.Response<NimsApiDto.BsshInfoSt> getBsshInfoSt(NimsApiRequest.BsshInfoRequest dto) {
public NimsApiResult.Response<NimsApiDto.BsshInfoSt> getBsshInfoSt(NimsApiRequest.BsshInfoReq dto) {
dto.setK(nimsApiKey);
ApiUtil.validate(dto, null, validator);
if(isEmpty(dto.getBi()) && isEmpty(dto.getHp()) && isEmpty(dto.getBn()) && isEmpty(dto.getBc())) {
@ -92,7 +92,7 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
@Override
@TraceLogging
public NimsApiResult.Response<NimsApiDto.ProductInfoKd> getProductInfoKd(NimsApiRequest.ProductInfoRequest dto) {
public NimsApiResult.Response<NimsApiDto.ProductInfoKd> getProductInfoKd(NimsApiRequest.ProductInfoReq dto) {
dto.setK(nimsApiKey);
ApiUtil.validate(dto, null, validator);
if(!isEmpty(dto.getYmd())) ApiUtil.checkYmdError(dto.getYmd(), null);
@ -104,7 +104,7 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
@Override
@TraceLogging
public NimsApiResult.Response<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoRequest dto) {
public NimsApiResult.Response<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoReq dto) {
dto.setK(nimsApiKey);
ApiUtil.validate(dto, null, validator);
if(!isEmpty(dto.getYmd())) ApiUtil.checkYmdError(dto.getYmd(), null);
@ -147,7 +147,7 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
// }
@Override
public NimsApiResult.Response<NimsApiDto.DsuseRptInfo> getDsuseRptInfo(NimsApiRequest.DsuseRptInfoRequest dto) {
public NimsApiResult.Response<NimsApiDto.DsuseRptInfo> getDsuseRptInfo(NimsApiRequest.DsuseRptInfoReq dto) {
dto.setK(nimsApiKey);
dto.setFg4(ofCd);
ApiUtil.validate(dto, null, validator);
@ -201,16 +201,17 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
NimsApiDto.DsuseRptInfo dsuseRpt = NimsApiDto.DsuseRptInfo.builder()
.usrRptIdNo(usrRptIdNoList.get(i))
.refUsrRptIdNo("0".equals(rptTyCds.get(i))? null : refUsrRptIdNos.get(refIdx++))
.bsshCd("H00008333")
.bsshNm("수지미래산부인과의원")
.indutyNm("마약류취급의료업")
.rptTyCd(rptTyCds.get(i))
.rndDtlRptCnt("1".equals(rptTyCds.get(i))? 0 : 2)
.bsshCd("H00008333")
.bsshNm("수지미래산부인과의원")
.hdrDe("20240401")
.rptDe("20240401")
.dsuseSeCd("1")
.dsusePrvCd("01")
.dsuseMthCd("1")
.dsuseMthCd("3")
.dsuseDe("20240306")
.dsuseLoc("보건소")
.status("0")
.dsuseRptInfoDtls("1".equals(rptTyCds.get(i))? null : List.of(dtl1, dtl2))

@ -39,7 +39,7 @@ public class InfNimsController {
@Operation(summary = "마약류 취급자 정보 조회", description = "마약류 취급자 정보 조회")
@PostMapping("/getBsshInfoSt")
public ApiBaseResponse<NimsApiResult.Response<NimsApiDto.BsshInfoSt>> getBsshInfoSt(
@RequestBody NimsApiRequest.BsshInfoRequest dto
@RequestBody NimsApiRequest.BsshInfoReq dto
) {
return ApiBaseResponse.of(infNimsService.getBsshInfoSt(dto));
}
@ -47,7 +47,7 @@ public class InfNimsController {
@Operation(summary = "마약류 상품 정보 조회", description = "마약류 상품정보 조회")
@PostMapping("/getProductInfoKd")
public ApiBaseResponse<NimsApiResult.Response<NimsApiDto.ProductInfoKd>> getProductInfoKd(
@RequestBody NimsApiRequest.ProductInfoRequest dto
@RequestBody NimsApiRequest.ProductInfoReq dto
) {
return ApiBaseResponse.of(infNimsService.getProductInfoKd(dto));
}
@ -55,7 +55,7 @@ public class InfNimsController {
@Operation(summary = "제조 일련 번호 정보 조회", description = "제조 일련 번호 정보 조회")
@PostMapping("/getMnfSeqInfo")
public ApiBaseResponse<NimsApiResult.Response<NimsApiDto.MnfSeqInfo>> getMnfSeqInfo(
@RequestBody NimsApiRequest.MnfSeqInfoRequest dto
@RequestBody NimsApiRequest.MnfSeqInfoReq dto
) {
return ApiBaseResponse.of(infNimsService.getMnfSeqInfo(dto));
}
@ -79,7 +79,7 @@ public class InfNimsController {
@Operation(summary = "폐기 보고 정보 조회", description = "폐기 보고 정보 조회")
@PostMapping("/getDsuseRptInfo")
public ApiBaseResponse<NimsApiResult.Response<NimsApiDto.DsuseRptInfo>> getDsuseRptInfo(
@RequestBody NimsApiRequest.DsuseRptInfoRequest dto
@RequestBody NimsApiRequest.DsuseRptInfoReq dto
) {
return ApiBaseResponse.of(infNimsService.getDsuseRptInfo(dto));
}

@ -109,7 +109,7 @@
mdfr = #{rgtr}
</insert>
<select id="selectBsshInfos" parameterType="cokr.xit.adds.inf.nims.model.NimsApiRequest$BsshInfoRequest" resultType="cokr.xit.adds.inf.nims.model.NimsApiDto$BsshInfoSt">
<select id="selectBsshInfos" parameterType="cokr.xit.adds.inf.nims.model.NimsApiRequest$BsshInfoReq" resultType="cokr.xit.adds.inf.nims.model.NimsApiDto$BsshInfoSt">
/** nims-mysql-mapper|selectBsshInfos-마약류취급자정보 조회|julim */
SELECT bssh_cd, /* 마약류취급자식별번호 */
bssh_nm, /* 마약류취급자명 */
@ -140,7 +140,7 @@
</where>
</select>
<select id="selectProductInfos" parameterType="cokr.xit.adds.inf.nims.model.NimsApiRequest$ProductInfoRequest" resultType="cokr.xit.adds.inf.nims.model.NimsApiDto$ProductInfoKd">
<select id="selectProductInfos" parameterType="cokr.xit.adds.inf.nims.model.NimsApiRequest$ProductInfoReq" resultType="cokr.xit.adds.inf.nims.model.NimsApiDto$ProductInfoKd">
/** nims-mysql-mapper|selectProductInfo-상품 정보 조회|julim */
SELECT prduct_cd, /* 제품코드 */
prdlst_mst_cd, /* 제품대표코드 */
@ -254,13 +254,20 @@
)
</insert>
<select id="selectDsuseMgts" parameterType="java.util.List" resultType="cokr.xit.adds.biz.nims.model.BizNimsResponse$DsuseMgtResponse">
<select id="selectDsuseMgts" parameterType="java.util.List" resultType="cokr.xit.adds.biz.nims.model.BizNimsResponse$DsuseMgtRes">
/** nims-mysql-mapper|selectDsuseMgts-폐기관리 목록 조회|julim */
<include refid="sqlDsuseMgt"/>
WHERE tdm.dscdmng_id IN
<where>
<if test="dscdmngIds != null and dscdmngIds.size != 0">
AND dscdmng_id IN
<foreach collection="dscdmngIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="prgrsSttsCd != null and prgrsSttsCd != ''">
AND prgrs_stts_cd != #{prgrsSttsCd}
</if>
</where>
</select>
<sql id="sqlDsuseMgt">
@ -288,7 +295,7 @@
ON tdm.bssh_cd = tbi.bssh_cd
</sql>
<select id="selectDsuseMgtDtls" parameterType="map" resultType="cokr.xit.adds.biz.nims.model.BizNimsResponse$DsuseMgtDtlResponse">
<select id="selectDsuseMgtDtls" parameterType="map" resultType="cokr.xit.adds.biz.nims.model.BizNimsResponse$DsuseMgtDtlRes">
/** nims-mysql-mapper|selectDsuseMgtDtls-폐기관리 상세 목록 조회|julim */
SELECT tdmd.dscdmng_id, /* 폐기관리ID */
tdmd.dscdmng_sn, /* 폐기관리일련번호 */
@ -314,7 +321,7 @@
FROM tb_dsuse_mgt_dtl tdmd
LEFT JOIN tb_prduct_info tpi
ON (tdmd.prduct_cd = tpi.prduct_cd)
-- AND tdrid.use_yn = 'Y')
-- AND tdmd.use_yn = 'Y')
LEFT JOIN tb_bssh_info tbi
ON (tpi.bssh_cd = tbi.bssh_cd)
WHERE tdmd.dscdmng_id = #{dscdmngId}
@ -331,6 +338,35 @@
AND tdmd.usr_rpt_id_no = #{usrRptIdNo}
</if>
</select>
<update id="updateMappingDsuseMgt" parameterType="cokr.xit.adds.biz.nims.model.BizNimsResponse$DsuseMgtRes">
/** nims-mysql-mapper|updateMappingDsuseMgt-폐기관리 매핑정보 update|julim */
UPDATE tb_dsuse_mgt
SET prgrs_stts_cd = #{prgrsSttsCd}
, usr_rpt_id_no = #{usrRptIdNo}
, org_usr_rpt_id_no = #{orgUsrRptIdNo}
, rpt_ty_cd = #{rptTyCd}
, stts = #{status}
, mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s')
, mdfr = #{rgtr}
WHERE dscdmng_id = #{dscdmngId}
AND use_yn = 'Y'
</update>
<!-- FIXME:: 미사용 예정 :: 삭제 -->
<update id="updateCancelDsuseMgt" parameterType="cokr.xit.adds.inf.nims.model.NimsApiDto$DsuseRptInfo">
/** nims-mysql-mapper|updateCancelDsuseMgt-폐기관리 취소(참조사용자식별번호로)|julim */
UPDATE tb_dsuse_mgt
SET usr_rpt_id_no = #{usrRptIdNo}
, use_yn = IF(#{rptTyCd} = '1', 'N', use_yn)
, mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s')
, mdfr = #{rgtr}
WHERE usr_rpt_id_no = #{refUsrRptIdNo}
AND use_yn = 'Y'
</update>
<!-- ========================== -->
<!-- 폐기 관리 업무 테이블 end -->
<!-- ========================== -->
@ -501,17 +537,6 @@
AND use_yn = 'Y'
</update>
<update id="updateCancelDsuseMgt" parameterType="cokr.xit.adds.inf.nims.model.NimsApiDto$DsuseRptInfo">
/** nims-mysql-mapper|updateCancelDsuseMgt-폐기관리 취소(참조사용자식별번호로)|julim */
UPDATE tb_dsuse_mgt
SET usr_rpt_id_no = #{usrRptIdNo}
, use_yn = IF(#{rptTyCd} = '1', 'N', use_yn)
, mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s')
, mdfr = #{rgtr}
WHERE usr_rpt_id_no = #{refUsrRptIdNo}
AND use_yn = 'Y'
</update>
<update id="updateCancelDsuseRptInfoDtl" parameterType="cokr.xit.adds.inf.nims.model.NimsApiDto$DsuseRptInfo">
/** nims-mysql-mapper|updateCancelDsuseRptInfoDtl-폐기보고정보 상세 취소|julim */
UPDATE tb_dsuse_rpt_info_dtl
@ -530,6 +555,9 @@
FROM tb_dsuse_rpt_info
WHERE usr_rpt_id_no = #{refUsrRptIdNo}
</select>
<!-- ============================= -->
<!-- 폐기 보고 정보 업무 테이블 end -->
<!-- ============================= -->
@ -546,7 +574,7 @@
<select id="selectDsuseMgts2" parameterType="cokr.xit.adds.biz.nims.model.BizNimsRequest$DsuseMgtInq" resultType="cokr.xit.adds.biz.nims.model.BizNimsResponse$DsuseRptInfoResponse">
<select id="selectDsuseMgts2" parameterType="cokr.xit.adds.biz.nims.model.BizNimsRequest$DsuseMgtInq" resultType="cokr.xit.adds.biz.nims.model.BizNimsResponse$DsuseRptInfoRes">
/** nims-mysql-mapper|selectDsuseMgts-폐기관리목록 조회|julim */
<include refid="sqlDsuseRptInfoByDsuseMgt"/>
WHERE tdm.dscdmng_id IN

@ -11,7 +11,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtl;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlRequest;
import cokr.xit.adds.inf.iros.model.DrugPrdtMcpnDtlReq;
import cokr.xit.adds.inf.iros.model.IrosResponse;
import cokr.xit.foundation.data.JSON;
import cokr.xit.foundation.web.WebClient;
@ -41,7 +41,7 @@ public class IrosRestfulTest {
@Test
public void testDrugPrdtMcpnDtl() {
final DrugPrdtMcpnDtlRequest param = DrugPrdtMcpnDtlRequest.builder()
final DrugPrdtMcpnDtlReq param = DrugPrdtMcpnDtlReq.builder()
.serviceKey(serviceKey)
.pageNo("1")
.numOfRows("10")

Loading…
Cancel
Save