@ -149,20 +149,22 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
List < NimsApiDto . ProductInfoKd > list = new ArrayList < > ( ) ;
// DB 조회
if ( "N" . equals ( reqDto . getDbSkipYn ( ) ) ) {
list = bizNimsMapper . selectProductInfos ( reqDto ) ;
if ( ! isEmpty ( list ) ) {
if ( isMnfSeqInfo ) {
if ( isEmpty ( reqDto . getK ( ) ) ) {
productInfoaddMnfSeqs ( list , getApiInfInfo ( reqDto . getUserId ( ) ) . get ( "apiKey" ) ) ;
} else {
productInfoaddMnfSeqs ( list , reqDto . getK ( ) ) ;
}
}
return list ;
}
}
////////////////////////////////////////////////////////////////////////////////////////
// TODO: API 적용후 DB 조회 skip 처리
// if("N".equals(reqDto.getDbSkipYn())) {
// list = bizNimsMapper.selectProductInfos(reqDto);
// if (!isEmpty(list)){
// if(isMnfSeqInfo){
// if(isEmpty(reqDto.getK())){
// productInfoaddMnfSeqs(list, reqDto.getBc(), getApiInfInfo(reqDto.getUserId()).get("apiKey"));
// }else {
// productInfoaddMnfSeqs(list, reqDto.getBc(), reqDto.getK());
// }
// }
// return list;
// }
// }
///////////////////////////////////////////////////////////////
if ( isEmpty ( reqDto . getK ( ) ) ) {
reqDto . setK ( getApiInfInfo ( reqDto . getUserId ( ) ) . get ( "apiKey" ) ) ;
@ -184,7 +186,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
}
// 제조 번호, 일련번호, 유효기간 정보 목록 추가
if ( isMnfSeqInfo ) productInfoaddMnfSeqs ( curList , reqDto . get K( ) ) ;
if ( isMnfSeqInfo ) productInfoaddMnfSeqs ( curList , reqDto . get Bc( ) , reqDto . get K( ) ) ;
list . addAll ( curList ) ;
if ( rslt . isEndYn ( ) ) break ;
@ -201,24 +203,12 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
//reqDto.setFg("1"); // 제조번호 또는 일련번호 구분(1-제조번호, 2-일련번호, 3-바코드/RFID)
//reqDto.setPg("1"); // 조회페이지
// 시리얼번호 및 제조번호 기준 검색후, 결과내에서 유효기간으로 필터링 하도록 처리
boolean isPrdValidDe = ! isEmpty ( reqDto . getT ( ) ) & & ! isEmpty ( reqDto . getPrdValidDe ( ) ) ;
List < NimsApiDto . MnfSeqInfo > list = new ArrayList < > ( ) ;
//while (true) {
NimsApiResult . Response < NimsApiDto . MnfSeqInfo > rslt = infNimsService . getMnfSeqInfo ( reqDto ) ;
List < NimsApiDto . MnfSeqInfo > curList = rslt . getResult ( ) ;
if ( isPrdValidDe ) {
for ( NimsApiDto . MnfSeqInfo d : curList ) {
if ( ! isEmpty ( d . getPrdValidDe ( ) ) & & d . getPrdValidDe ( ) . contains ( reqDto . getPrdValidDe ( ) ) ) {
list . add ( d ) ;
}
}
} else {
list . addAll ( curList ) ;
}
NimsApiResult . Response < NimsApiDto . MnfSeqInfo > rslt = infNimsService . getMnfSeqInfo ( reqDto ) ;
List < NimsApiDto . MnfSeqInfo > list = rslt . getResult ( ) ;
// 시리얼번호 및 제조번호 기준 검색후, 결과내에서 유효기간으로 필터링 하도록 처리
if ( ! isEmpty ( list ) & & ( ! isEmpty ( reqDto . getT ( ) ) & & ! isEmpty ( reqDto . getVd ( ) ) ) ) {
list . sort ( ( a , b ) - > {
if ( isEmpty ( a . getPrdValidDe ( ) ) & & isEmpty ( b . getPrdValidDe ( ) ) )
return 0 ;
@ -228,57 +218,13 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
return 1 ;
return a . getPrdValidDe ( ) . compareTo ( b . getPrdValidDe ( ) ) ;
} ) ;
}
ApiBaseResponse < List < NimsApiDto . MnfSeqInfo > > res = ApiBaseResponse . of ( list ) ;
res . setTotalCount ( rslt . getBody ( ) . getTotalCount ( ) ) ;
return res ;
}
@Override
public List < NimsApiDto . MnfSeqInfo > getMnfSeqInfo2 ( NimsApiRequest . MnfSeqInfoReq reqDto ) {
if ( isEmpty ( reqDto . getK ( ) ) ) {
reqDto . setK ( getApiInfInfo ( reqDto . getUserId ( ) ) . get ( "apiKey" ) ) ;
}
//reqDto.setFg("1"); // 제조번호 또는 일련번호 구분(1-제조번호, 2-일련번호, 3-바코드/RFID)
reqDto . setPg ( "1" ) ; // 조회페이지
// 시리얼번호 및 제조번호 기준 검색후, 결과내에서 유효기간으로 필터링 하도록 처리
boolean isPrdValidDe = ! isEmpty ( reqDto . getT ( ) ) & & ! isEmpty ( reqDto . getPrdValidDe ( ) ) ;
List < NimsApiDto . MnfSeqInfo > list = new ArrayList < > ( ) ;
while ( true ) {
NimsApiResult . Response < NimsApiDto . MnfSeqInfo > rslt = infNimsService . getMnfSeqInfo ( reqDto ) ;
List < NimsApiDto . MnfSeqInfo > curList = rslt . getResult ( ) ;
if ( isEmpty ( curList ) ) break ;
if ( isPrdValidDe ) {
for ( NimsApiDto . MnfSeqInfo d : curList ) {
if ( ! isEmpty ( d . getPrdValidDe ( ) ) & & d . getPrdValidDe ( ) . contains ( reqDto . getPrdValidDe ( ) ) ) {
list . add ( d ) ;
}
}
} else {
list . addAll ( curList ) ;
// 올림 차순 정렬
list . sort ( ( a , b ) - > {
if ( isEmpty ( a . getPrdValidDe ( ) ) & & isEmpty ( b . getPrdValidDe ( ) ) )
return 0 ;
if ( isEmpty ( a . getPrdValidDe ( ) ) )
return - 1 ;
if ( isEmpty ( b . getPrdValidDe ( ) ) )
return 1 ;
return a . getPrdValidDe ( ) . compareTo ( b . getPrdValidDe ( ) ) ;
} ) ;
}
// 데이타 조회 결과 마지막 페이지 이거나 100건 이상인 경우 종료
if ( rslt . isEndYn ( ) | | list . size ( ) > 100 | | isPrdValidDe ) break ;
reqDto . setPg ( String . valueOf ( Integer . parseInt ( reqDto . getPg ( ) ) + 1 ) ) ;
}
return list ;
}
@Override
public List < NimsApiDto . JurisdictionGovInfo > getJurisdictionGovInfo ( final NimsApiRequest . JurisdictionGovInfoReq reqDto ) {
List < NimsApiDto . JurisdictionGovInfo > list = new ArrayList < > ( ) ;
@ -443,7 +389,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
Map < String , String > map = new HashMap < > ( ) ;
map . put ( "dscdmngId" , dto . getDscdmngId ( ) ) ;
List < BizNimsResponse . DsuseMgtDtlRes > dsuseRptInfoDtls = bizNimsMapper . selectDsuseMgtDtls ( map ) ;
if ( isForDoc ) setDsuseMgtDtlAddProductInfo ( dsuseRptInfoDtls , reqDto. getUserId ( ) , apiKey ) ;
if ( isForDoc ) setDsuseMgtDtlAddProductInfo ( dsuseRptInfoDtls , dto. getBsshCd ( ) , reqDto. getUserId ( ) , apiKey ) ;
dto . getDsuseMgtDtls ( ) . addAll ( dsuseRptInfoDtls ) ;
}
@ -565,7 +511,6 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
. fg ( "1" )
. pg ( "1" )
. p ( mnfSeqInfo . getPrductCd ( ) )
. dbSkipYn ( "N" )
. userId ( userId )
. build ( ) ;
List < NimsApiDto . ProductInfoKd > productInfoKds = saveProductInfoKd ( prdReq , false ) ;
@ -610,7 +555,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* @param dtlList < NimsApiDto . DsuseRptInfoDtl >
* < / pre >
* /
private void setDsuseMgtDtlAddProductInfo ( List < BizNimsResponse . DsuseMgtDtlRes > dtlList , String userId, String apiKey ) {
private void setDsuseMgtDtlAddProductInfo ( List < BizNimsResponse . DsuseMgtDtlRes > dtlList , String bsshCd, String userId, String apiKey ) {
for ( BizNimsResponse . DsuseMgtDtlRes r : dtlList ) {
// 마약항정구분(nrcdSeNm), 중점일반구분(prtmSenm)
if ( isEmpty ( r . getNrcdSeNm ( ) ) | | isEmpty ( r . getPrtmSeNm ( ) ) ) {
@ -899,7 +844,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* @param apiKey Api Key
* < / pre >
* /
private void productInfoaddMnfSeqs ( final List < NimsApiDto . ProductInfoKd > list , final String apiKey) {
private void productInfoaddMnfSeqs ( final List < NimsApiDto . ProductInfoKd > list , final String bsshCd, final String apiKey) {
String productCd = "" ;
try {
@ -913,6 +858,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
. fg ( "1" )
. pg ( "1" )
. p ( d . getPrductCd ( ) )
. bc ( bsshCd )
. userId ( "" )
. build ( )
) ;
@ -997,4 +943,48 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
return files . get ( 0 ) . getId ( ) ;
}
private List < NimsApiDto . MnfSeqInfo > getMnfSeqInfo2 ( NimsApiRequest . MnfSeqInfoReq reqDto ) {
if ( isEmpty ( reqDto . getK ( ) ) ) {
reqDto . setK ( getApiInfInfo ( reqDto . getUserId ( ) ) . get ( "apiKey" ) ) ;
}
//reqDto.setFg("1"); // 제조번호 또는 일련번호 구분(1-제조번호, 2-일련번호, 3-바코드/RFID)
reqDto . setPg ( "1" ) ; // 조회페이지
// 시리얼번호 및 제조번호 기준 검색후, 결과내에서 유효기간으로 필터링 하도록 처리
boolean isPrdValidDe = ! isEmpty ( reqDto . getT ( ) ) & & ! isEmpty ( reqDto . getVd ( ) ) ;
List < NimsApiDto . MnfSeqInfo > list = new ArrayList < > ( ) ;
while ( true ) {
NimsApiResult . Response < NimsApiDto . MnfSeqInfo > rslt = infNimsService . getMnfSeqInfo ( reqDto ) ;
List < NimsApiDto . MnfSeqInfo > curList = rslt . getResult ( ) ;
if ( isEmpty ( curList ) ) break ;
if ( isPrdValidDe ) {
for ( NimsApiDto . MnfSeqInfo d : curList ) {
if ( ! isEmpty ( d . getPrdValidDe ( ) ) & & d . getPrdValidDe ( ) . contains ( reqDto . getVd ( ) ) ) {
list . add ( d ) ;
}
}
} else {
list . addAll ( curList ) ;
// 올림 차순 정렬
list . sort ( ( a , b ) - > {
if ( isEmpty ( a . getPrdValidDe ( ) ) & & isEmpty ( b . getPrdValidDe ( ) ) )
return 0 ;
if ( isEmpty ( a . getPrdValidDe ( ) ) )
return - 1 ;
if ( isEmpty ( b . getPrdValidDe ( ) ) )
return 1 ;
return a . getPrdValidDe ( ) . compareTo ( b . getPrdValidDe ( ) ) ;
} ) ;
}
// 데이타 조회 결과 마지막 페이지 이거나 100건 이상인 경우 종료
if ( rslt . isEndYn ( ) | | list . size ( ) > 100 | | isPrdValidDe ) break ;
reqDto . setPg ( String . valueOf ( Integer . parseInt ( reqDto . getPg ( ) ) + 1 ) ) ;
}
return list ;
}
}