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