마약류취급자, 상품정보 조회시

1. DB 조회후 결과가 없는 경우 API 호출
2. dbSkipYn 파라메터 추가 하여 "Y"인 경우
-> DB 조회 없이 API 호출
-> DB에 데이타가 있지만, 갱신 또는 추가 등이 필요한 경우 강제하기 위해 필요
dev
Jonguk. Lim 7 months ago
parent e92442fca1
commit 14e9623dc1

@ -8,6 +8,7 @@ import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.adds.biz.nims.model.BizNimsRequest; 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.inf.nims.model.NimsApiDto; import cokr.xit.adds.inf.nims.model.NimsApiDto;
import cokr.xit.adds.inf.nims.model.NimsApiRequest;
import cokr.xit.foundation.component.AbstractMapper; import cokr.xit.foundation.component.AbstractMapper;
/** /**
@ -30,8 +31,10 @@ public interface BizNimsMapper extends AbstractMapper {
//------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------
// NIMS API CALL // NIMS API CALL
//------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------
int mergeBsshInfoSt(NimsApiDto.BsshInfoSt dto); void mergeBsshInfoSt(NimsApiDto.BsshInfoSt dto);
int mergeProductInfoKd(NimsApiDto.ProductInfoKd dto); List<NimsApiDto.BsshInfoSt> selectBsshInfos(NimsApiRequest.BsshInfoRequest dto);
void mergeProductInfoKd(NimsApiDto.ProductInfoKd dto);
List<NimsApiDto.ProductInfoKd> selectProductInfos(NimsApiRequest.ProductInfoRequest dto);
// int mergeStorgeInfo(NimsApiDto.StorageInfo dto); // int mergeStorgeInfo(NimsApiDto.StorageInfo dto);
//------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------

@ -66,6 +66,8 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
//------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------
/** /**
* <pre> * <pre>
* DB (dbSkipYn = 'Y' DB skip)
* -> API
* DB * DB
* - (3 ) * - (3 )
* @param dto NimsApiRequest.BsshInfoRequest * @param dto NimsApiRequest.BsshInfoRequest
@ -77,7 +79,14 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
if(!isEmpty(dto.getBn()) && dto.getBn().length() < 3) { if(!isEmpty(dto.getBn()) && dto.getBn().length() < 3) {
throw ApiCustomException.create("업체[사업자]명은 3자 이상 으로 조회해 주세요"); throw ApiCustomException.create("업체[사업자]명은 3자 이상 으로 조회해 주세요");
} }
// DB 조회
List<BsshInfoSt> list = new ArrayList<>(); List<BsshInfoSt> list = new ArrayList<>();
if("N".equals(dto.getDbSkipYn())) {
list = bizNimsMapper.selectBsshInfos(dto);
if (!isEmpty(list)) return list;
}
while(true) { while(true) {
// 마약류취급자식별번호로 마약류취급자정보 조회 // 마약류취급자식별번호로 마약류취급자정보 조회
NimsApiResult.Response<BsshInfoSt> rslt = infNimsService.getBsshInfoSt(dto); NimsApiResult.Response<BsshInfoSt> rslt = infNimsService.getBsshInfoSt(dto);
@ -100,6 +109,8 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
/** /**
* <pre> * <pre>
* DB (dbSkipYn = 'Y' DB skip)
* -> API
* DB * DB
* , , * , ,
* - (2 ) * - (2 )
@ -119,6 +130,14 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
} }
List<NimsApiDto.ProductInfoKd> list = new ArrayList<>(); List<NimsApiDto.ProductInfoKd> list = new ArrayList<>();
// DB 조회
if("N".equals(dto.getDbSkipYn())) {
list = bizNimsMapper.selectProductInfos(dto);
if (!isEmpty(list)){
if(isMnfSeqInfo) productInfoaddMnfSeqs(list);
return list;
}
}
while(true) { while(true) {
// 제품코드로 제품정보 조회 // 제품코드로 제품정보 조회
NimsApiResult.Response<NimsApiDto.ProductInfoKd> rslt = infNimsService.getProductInfoKd(dto); NimsApiResult.Response<NimsApiDto.ProductInfoKd> rslt = infNimsService.getProductInfoKd(dto);
@ -130,10 +149,10 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
d.setRgtr(Constants.NIMS_API_USER_ID); d.setRgtr(Constants.NIMS_API_USER_ID);
bizNimsMapper.mergeProductInfoKd(d); bizNimsMapper.mergeProductInfoKd(d);
} }
list.addAll(curList);
// 제조 번호, 일련번호, 유효기간 정보 목록 추가 // 제조 번호, 일련번호, 유효기간 정보 목록 추가
if(isMnfSeqInfo) productInfoaddMnfSeqs(curList); if(isMnfSeqInfo) productInfoaddMnfSeqs(curList);
list.addAll(curList);
if(rslt.isEndYn()) break; if(rslt.isEndYn()) break;
dto.setPg(String.valueOf(Integer.parseInt(dto.getPg()) + 1)); dto.setPg(String.valueOf(Integer.parseInt(dto.getPg()) + 1));

@ -102,13 +102,27 @@ public class NimsApiRequest {
String ymd = StringUtils.EMPTY; String ymd = StringUtils.EMPTY;
/** /**
* <pre>
* 2 * 2
* 1:NK() - default * 1:NK() - default
* 2:NK() * 2:NK()
* </pre>
*/ */
@Schema(requiredMode = REQUIRED, title = "조회범위2(1:NK(취급승인)포함 - default, 2:NK(취급승인)제외)", description = "조회범위2(1:NK(취급승인)포함 - default, 2:NK(취급승인)제외)", example = "1", allowableValues = {"1", "2"}) @Schema(requiredMode = REQUIRED, title = "조회범위2(1:NK(취급승인)포함 - default, 2:NK(취급승인)제외)", description = "조회범위2(1:NK(취급승인)포함 - default, 2:NK(취급승인)제외)", example = "1", allowableValues = {"1", "2"})
@Builder.Default @Builder.Default
String fg2 = "1"; String fg2 = "1";
/**
* <pre>
* DB skip
* DB NIMS API
* true DB skip
* </pre>
*/
@Schema(title = "DB 조회 skip 여부", description = "DB 조회 skip 여부(DB 조회 없이 NIMS API호출 하려면 Y)", example = "N")
@Builder.Default
//@JsonIgnore
private String dbSkipYn = "N";
} }
/** /**
@ -177,6 +191,18 @@ public class NimsApiRequest {
@Schema(title = "제품명", description = "제품명", example = " ") @Schema(title = "제품명", description = "제품명", example = " ")
@Builder.Default @Builder.Default
String pn = StringUtils.EMPTY; String pn = StringUtils.EMPTY;
/**
* <pre>
* DB skip
* DB NIMS API
* true DB skip
* </pre>
*/
@Schema(title = "DB 조회 skip 여부", description = "DB 조회 skip 여부(DB 조회 없이 NIMS API호출 하려면 Y)", example = "N")
@Builder.Default
//@JsonIgnore
private String dbSkipYn = "N";
} }
@Schema(name = "DsuseRptInfoRequest", description = "폐기 보고 정보 조회 request") @Schema(name = "DsuseRptInfoRequest", description = "폐기 보고 정보 조회 request")

@ -109,6 +109,64 @@
mdfr = #{rgtr} mdfr = #{rgtr}
</insert> </insert>
<select id="selectBsshInfos" parameterType="cokr.xit.adds.inf.nims.model.NimsApiRequest$BsshInfoRequest" resultType="cokr.xit.adds.inf.nims.model.NimsApiDto$BsshInfoSt">
/** nims-mysql-mapper|selectBsshInfos-마약류취급자정보 조회|julim */
SELECT bssh_cd, /* 마약류취급자식별번호 */
bssh_nm, /* 마약류취급자명 */
induty_nm, /* 업종명 */
hdnt_cd, /* 의료업자구분 */
hdnt_nm, /* 의료업자구분명 */
bizrno, /* 사업자등록번호 */
rprsntv_nm, /* 대표자명 */
chrg_nm, /* 담당자명 */
hptl_no, /* 요양기관번호 */
join_yn, /* 회원가입여부 */
bssh_stts_nm, /* 마약류취급자상태명 */
prmisn_no /* 허가번호 */
FROM tb_bssh_info
<where>
<if test="bc != null and bc != ''">
AND bssh_cd = #{bc}
</if>
<if test="bn != null and bn != ''">
AND INSTR(bssh_nm, #{bn}) > 0
</if>
<if test="bi != null and bi != ''">
AND bizrno = #{bi}
</if>
<if test="hp != null and hp != ''">
AND hptl_no = #{hp}
</if>
</where>
</select>
<select id="selectProductInfos" parameterType="cokr.xit.adds.inf.nims.model.NimsApiRequest$ProductInfoRequest" resultType="cokr.xit.adds.inf.nims.model.NimsApiDto$ProductInfoKd">
/** nims-mysql-mapper|selectProductInfo-상품 정보 조회|julim */
SELECT prduct_cd, /* 제품코드 */
prdlst_mst_cd, /* 제품대표코드 */
prduct_nm, /* 제품명 */
nrcd_se_nm, /* 마약항정구분 */
prtm_se_nm, /* 중점일반구분 */
prd_min_distb_qy, /* 최소유통단위수량 - 제품규격정보(고정값=1) */
std_packng_stle_nm, /* 제품최소유통단위 */
prd_tot_pce_qy, /* 제품총낱개단위수량 */
pce_co_unit_nm, /* 제품낱개단위 */
bssh_cd, /* 마약류취급자식별번호 */
rgs_dt, /* 등록일 */
upd_dt /* 변경일 */
FROM tb_prduct_info
<where>
<if test="p != null and p != ''">
AND prduct_cd = #{p}
</if>
<if test="pn != null and pn != ''">
AND INSTR(prduct_nm, #{pn}) > 0
</if>
<if test="fg2 != null and fg2 != ''">
AND prtm_se_nm = IF(#{fg2} = '1', '중점관리대상', '일반관리대상')
</if>
</where>
</select>
<!-- **************************************************************************** --> <!-- **************************************************************************** -->
<!-- NIMS API end --> <!-- NIMS API end -->
<!-- **************************************************************************** --> <!-- **************************************************************************** -->
@ -260,16 +318,16 @@
LEFT JOIN tb_bssh_info tbi LEFT JOIN tb_bssh_info tbi
ON (tpi.bssh_cd = tbi.bssh_cd) ON (tpi.bssh_cd = tbi.bssh_cd)
WHERE tdmd.dscdmng_id = #{dscdmngId} WHERE tdmd.dscdmng_id = #{dscdmngId}
<if test="dscdmngSn != null"> <if test="dscdmngSn != null and dscdmngSn != ''">
AND tdmd.dscdmng_sn = #{dscdmngSn} AND tdmd.dscdmng_sn = #{dscdmngSn}
</if> </if>
<if test="useYn != null"> <if test="useYn != null and useYn != ''">
AND tdmd.use_yn = #{useYn} AND tdmd.use_yn = #{useYn}
</if> </if>
<if test="userId != null"> <if test="userId != null and userId != ''">
AND tdmd.userId = #{userId} AND tdmd.userId = #{userId}
</if> </if>
<if test="usrRptIdNo != null"> <if test="usrRptIdNo != null and usrRptIdNo != ''">
AND tdmd.usr_rpt_id_no = #{usrRptIdNo} AND tdmd.usr_rpt_id_no = #{usrRptIdNo}
</if> </if>
</select> </select>
@ -310,10 +368,10 @@
rgtr rgtr
FROM tb_dsuse_rpt_info FROM tb_dsuse_rpt_info
WHERE usr_rpt_id_no = #{usrRptIdNo} WHERE usr_rpt_id_no = #{usrRptIdNo}
<if test="useYn != null"> <if test="useYn != null and useYn != ''">
AND use_yn = #{useYn} AND use_yn = #{useYn}
</if> </if>
<if test="userId != null"> <if test="userId != null and userId != ''">
AND userId = #{userId} AND userId = #{userId}
</if> </if>
</select> </select>
@ -344,13 +402,13 @@
LEFT JOIN tb_bssh_info tbi LEFT JOIN tb_bssh_info tbi
ON (tpi.bssh_cd = tbi.bssh_cd) ON (tpi.bssh_cd = tbi.bssh_cd)
WHERE tdrid.usr_rpt_id_no = #{usrRptIdNo} WHERE tdrid.usr_rpt_id_no = #{usrRptIdNo}
<if test="usrRptLnIdNo != null"> <if test="usrRptLnIdNo != null and usrRptLnIdNo != ''">
AND tdrid.usr_rpt_ln_id_no = #{usrRptLnIdNo} AND tdrid.usr_rpt_ln_id_no = #{usrRptLnIdNo}
</if> </if>
<if test="useYn != null"> <if test="useYn != null and useYn != ''">
AND tdrid.use_yn = #{useYn} AND tdrid.use_yn = #{useYn}
</if> </if>
<if test="userId != null"> <if test="userId != null and userId != ''">
AND tdrid.userId = #{userId} AND tdrid.userId = #{userId}
</if> </if>
</select> </select>

Loading…
Cancel
Save