From 402e64ec6da87236ff757c3a32f474309a725c9c Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Sat, 19 Oct 2024 22:45:56 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20NIMS=20=EC=97=85=EC=B2=B4(=EC=B7=A8?= =?UTF-8?q?=EA=B8=89=EC=9E=90)=20=EC=A1=B0=ED=9A=8C=EC=8B=9C=20=EC=97=85?= =?UTF-8?q?=EC=B2=B4=EC=BD=94=EB=93=9C=EA=B0=80=20=EC=97=86=EB=8A=94=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20skip=20=EC=B2=98=EB=A6=AC=20=20=20=20=20?= =?UTF-8?q?=20NIMS=20=EC=97=85=EC=B2=B4(=EC=B7=A8=EA=B8=89=EC=9E=90)=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adds/biz/nims/service/BizNimsService.java | 3 +- .../nims/service/bean/BizNimsServiceBean.java | 56 ++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) 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);
 				// 대표자 검색조건이 있는 경우