diff --git a/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java b/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java index 471ff99..af4aaeb 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java +++ b/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java @@ -13,7 +13,7 @@ import cokr.xit.adds.inf.nims.model.NimsApiRequest; /** *
- * description : + * description : * * packageName : cokr.xit.adds.inf.nims.service * fileName : InfNimsService @@ -30,6 +30,7 @@ public interface BizNimsService { //------------------------------------------------------------------------------------------------------ // NIMS API CALL //------------------------------------------------------------------------------------------------------ + ApiBaseResponse> getBsshInfoSt(final NimsApiRequest.BsshInfoReq reqDto); List
saveBsshInfoSt(final NimsApiRequest.BsshInfoReq dto); List saveProductInfoKd(final NimsApiRequest.ProductInfoReq dto, boolean isMnfSeqInfo); ApiBaseResponse > getMnfSeqInfo(final NimsApiRequest.MnfSeqInfoReq 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 5c0b6ae..99bad34 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 @@ -39,7 +39,7 @@ import lombok.extern.slf4j.Slf4j; /** *
- * description : + * description : * * packageName : cokr.xit.adds.inf.nims.service.bean * fileName : InfNimsServiceBean @@ -65,6 +65,59 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe //------------------------------------------------------------------------------------------------------ // NIMS API CALL //------------------------------------------------------------------------------------------------------ + @Override + public ApiBaseResponse> getBsshInfoSt(BsshInfoReq reqDto) { + if(isEmpty(reqDto.getBc()) && isEmpty(reqDto.getBi()) && isEmpty(reqDto.getBn())){ + throw ApiCustomException.create("업체[사업자] 번호 또는 명, 사업자등록번호 중 하나는 필수 입니다"); + } + if(!isEmpty(reqDto.getBn()) && reqDto.getBn().length() < 3) { + throw ApiCustomException.create("업체[사업자]명은 3자 이상 으로 조회해 주세요"); + } + + // DB 조회 + List
list = new ArrayList<>(); + if("N".equals(reqDto.getDbSkipYn())) { + list = bizNimsMapper.selectBsshInfos(reqDto); + if (!isEmpty(list)){ + //return list; + ApiBaseResponse > res = ApiBaseResponse.of(list); + res.setTotalCount(list.size()); + return res; + } + } + + if(isEmpty(reqDto.getK())){ + reqDto.setK(getApiInfInfo(reqDto.getUserId()).get("apiKey")); + } + reqDto.setFg("1"); // 조회범위(1-전체,2-내거래처) + //reqDto.setPg("1"); // 조회페이지 + reqDto.setFg2("1"); // 조회범위2(1:NK(취급승인)포함 - default, 2:NK(취급승인)제외) + + boolean isRprsntvNm = !isEmpty(reqDto.getRprsntvNm());//while(true) { + + // 마약류취급자식별번호로 마약류취급자정보 조회 + NimsApiResult.Response
rslt = infNimsService.getBsshInfoSt(reqDto); + List curList = rslt.getResult(); + + for (BsshInfoSt d : curList) { + if(isEmpty(d.getBsshCd())) continue; + d.setRgtr(reqDto.getUserId()); + bizNimsMapper.mergeBsshInfoSt(d); + // 대표자 검색조건이 있는 경우 + if (isRprsntvNm && !isEmpty(d.getRprsntvNm()) && d.getRprsntvNm().contains(reqDto.getRprsntvNm())) { + list.add(d); + } + } + if (!isRprsntvNm){ + list.addAll(curList); + } + + ApiBaseResponse > res = ApiBaseResponse.of(list); + res.setTotalCount(list.size()); + return res; + } + + /** *
* DB에서 먼저 조회(dbSkipYn = 'Y' 인 경우는 DB 조회 skip) @@ -108,6 +161,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe break; for (BsshInfoSt d : curList) { + if(isEmpty(d.getBsshCd())) continue; d.setRgtr(reqDto.getUserId()); bizNimsMapper.mergeBsshInfoSt(d); // 대표자 검색조건이 있는 경우