@ -95,17 +95,17 @@ public class AsyncServiceImpl implements IAsyncService {
if ( tenantFeign . isSuccess ( ) ) {
tenant = tenantFeign . getData ( ) ;
}
String mallName = tenant . getTenantName ( ) ;
// String mallName = tenant.getTenantName();
log . info ( ">>> 执行保存数据到商家数据的功能 商家名称{}" , tenant . getTenantName ( ) ) ;
for ( TrunklineAdvanceEntity trunklineAdvanceEntity : trunklineAdvanceEntities ) {
List < TrunklineAdvanceDetailEntity > t = trunklineAdvanceDetailEntities . stream ( ) . filter ( trunklineAdvanceDetailEntity - > trunklineAdvanceDetailEntity . getAdvanceId ( ) . equals ( trunklineAdvanceEntity . getId ( ) ) ) . collect ( Collectors . toList ( ) ) ;
saveTrunklineAdvanceEntity ( trunklineAdvanceEntity , mallName ) ;
saveTrunklineAdvanceEntity ( trunklineAdvanceEntity , tenant ) ;
// 保存暂存子表
saveTrunklineAdvanceDetailEntity ( t , trunklineAdvanceEntity , mallName ) ;
saveTrunklineAdvanceDetailEntity ( t , trunklineAdvanceEntity , tenant ) ;
}
List < Long > collect = trunklineAdvanceEntities . stream ( ) . map ( TrunklineAdvanceEntity : : getId ) . distinct ( ) . collect ( Collectors . toList ( ) ) ;
@ -113,7 +113,7 @@ public class AsyncServiceImpl implements IAsyncService {
List < TrunklineAdvanceDetailVO > listByAdvanceIds = advanceDetailService . findAdvanceDetailVoByAdvanceIds ( collect ) ;
// 保存运单
BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity ( mallName ) ;
BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity ( tenant . getTenantName ( ) ) ;
List < TrunklineWaybillOrderEntity > collect1 = trunklineWaybillOrderEntities . stream ( ) . filter ( trunklineWaybillOrderEntity - > trunklineWaybillOrderEntity . getWaybillId ( ) . equals ( waybillBilllByWaybillNo . getId ( ) ) ) . collect ( Collectors . toList ( ) ) ;
@ -254,7 +254,7 @@ public class AsyncServiceImpl implements IAsyncService {
trunklineWaybillTrackEntity . setWaybillId ( waybillBilllByWaybillNo . getId ( ) ) ;
trunklineWaybillTrackEntity . setTenantId ( tenant . getTenantId ( ) ) ;
BasicdataWarehouseEntity basicdataWarehouseEntity1 = getBasicdataWarehouseEntity ( mallName ) ;
BasicdataWarehouseEntity basicdataWarehouseEntity1 = getBasicdataWarehouseEntity ( tenant . getTenantName ( ) ) ;
trunklineWaybillTrackEntity . setWarehouseId ( basicdataWarehouseEntity1 . getId ( ) ) ;
trunklineWaybillTrackEntity . setWarehouseName ( basicdataWarehouseEntity1 . getName ( ) ) ;
trunklineWaybillTrackService . save ( trunklineWaybillTrackEntity ) ;
@ -293,7 +293,6 @@ public class AsyncServiceImpl implements IAsyncService {
}
}
private BasicdataWarehouseEntity getBasicdataWarehouseEntity ( String mallName ) {
@ -306,8 +305,7 @@ public class AsyncServiceImpl implements IAsyncService {
return basicdataWarehouseEntity ;
}
private void saveTrunklineAdvanceDetailEntity ( List < TrunklineAdvanceDetailEntity > t , TrunklineAdvanceEntity trunklineAdvanceEntity , String mallName ) {
Tenant tenant = changeDataBase ( mallName ) ;
private void saveTrunklineAdvanceDetailEntity ( List < TrunklineAdvanceDetailEntity > t , TrunklineAdvanceEntity trunklineAdvanceEntity , Tenant tenant ) {
List < Long > ids = Collections . singletonList ( trunklineAdvanceEntity . getId ( ) ) ;
@ -333,7 +331,7 @@ public class AsyncServiceImpl implements IAsyncService {
trunklineAdvanceDetailEntity . setTenantId ( tenant . getTenantId ( ) ) ;
trunklineAdvanceDetailEntity . setIncomingWarehouseId ( null ) ;
trunklineAdvanceDetailEntity . setIncomingWarehouseName ( null ) ;
BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity ( mallName ) ;
BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity ( tenant . getTenantName ( ) ) ;
if ( basicdataWarehouseEntity ! = null ) {
trunklineAdvanceDetailEntity . setWarehouseId ( basicdataWarehouseEntity . getId ( ) ) ;
trunklineAdvanceDetailEntity . setWarehouseName ( basicdataWarehouseEntity . getName ( ) ) ;
@ -346,8 +344,7 @@ public class AsyncServiceImpl implements IAsyncService {
}
private TrunklineAdvanceEntity saveTrunklineAdvanceEntity ( TrunklineAdvanceEntity trunklineAdvanceEntity , String mallName ) {
Tenant tenant = changeDataBase ( mallName ) ;
private TrunklineAdvanceEntity saveTrunklineAdvanceEntity ( TrunklineAdvanceEntity trunklineAdvanceEntity , Tenant tenant ) {
// 查找商户的暂存单是否存在改制
QueryWrapper < TrunklineAdvanceEntity > queryWrapper = new QueryWrapper < > ( ) ;
@ -355,7 +352,7 @@ public class AsyncServiceImpl implements IAsyncService {
queryWrapper . eq ( "waybill_no" , trunklineAdvanceEntity . getWaybillNo ( ) )
. last ( "limit 1" ) ;
TrunklineAdvanceEntity trunklineAdvanceEntity1 = advanceService . getOne ( queryWrapper ) ;
BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity ( mallName ) ;
BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity ( tenant . getTenantName ( ) ) ;
if ( ObjectUtil . isEmpty ( trunklineAdvanceEntity1 ) ) {
// 保存对象
if ( basicdataWarehouseEntity ! = null ) {