|
|
|
@ -71,8 +71,8 @@ public class BusinessPreOrderDataQueueHandler {
|
|
|
|
|
List<DistributionBusinessPreOrderEntity> dataResult = new ArrayList<>(); |
|
|
|
|
for (DistributionReservationEntity distributionReservationEntity : list) { |
|
|
|
|
// 判断需要进行推送商家名称
|
|
|
|
|
log.info(">>>>> mallName TAG {}",mallName); |
|
|
|
|
log.info(">>>>> distributionReservationEntity.getMallName() TAG {}",distributionReservationEntity.getMallName()); |
|
|
|
|
log.info(">>>>> mallName TAG {}", mallName); |
|
|
|
|
log.info(">>>>> distributionReservationEntity.getMallName() TAG {}", distributionReservationEntity.getMallName()); |
|
|
|
|
if (mallName.equals(distributionReservationEntity.getMallName())) { |
|
|
|
|
// 将当前的预约单加入到需要推送的列表
|
|
|
|
|
LambdaQueryWrapper<DistributionReservationPackageEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
@ -123,9 +123,9 @@ public class BusinessPreOrderDataQueueHandler {
|
|
|
|
|
.map(DistributionBusinessPreOrderEntity::getStockArticleId) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
R<Tenant> tenantByName = sysClient.getTenantByName(maillName); |
|
|
|
|
if(tenantByName.isSuccess()){ |
|
|
|
|
if (tenantByName.isSuccess()) { |
|
|
|
|
Tenant tenant = tenantByName.getData(); |
|
|
|
|
if(ObjectUtil.isEmpty(tenant)){ |
|
|
|
|
if (ObjectUtil.isEmpty(tenant)) { |
|
|
|
|
log.info(">>>>>>>>>>>>> saveOtherDataBaseNew 租户不存在"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -135,8 +135,8 @@ public class BusinessPreOrderDataQueueHandler {
|
|
|
|
|
DynamicDataSourceContextHolder.push(tenant.getTenantId()); |
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<DistributionBusinessPreOrderEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
lambdaQueryWrapper.eq(DistributionBusinessPreOrderEntity::getInWarehouse,0); |
|
|
|
|
lambdaQueryWrapper.in(DistributionBusinessPreOrderEntity::getStockArticleId,orderIdList); |
|
|
|
|
lambdaQueryWrapper.eq(DistributionBusinessPreOrderEntity::getInWarehouse, 0); |
|
|
|
|
lambdaQueryWrapper.in(DistributionBusinessPreOrderEntity::getStockArticleId, orderIdList); |
|
|
|
|
List<DistributionBusinessPreOrderEntity> list = distributionBusinessPreOrderService.list(lambdaQueryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -146,18 +146,20 @@ public class BusinessPreOrderDataQueueHandler {
|
|
|
|
|
|
|
|
|
|
for (DistributionBusinessPreOrderEntity businessPreOrderEntity : dataResult) { |
|
|
|
|
|
|
|
|
|
if(businessPreOrderEntity.getStockArticleId().equals(distributionBusinessPreOrderEntity.getStockArticleId())){ |
|
|
|
|
if (businessPreOrderEntity.getStockArticleId().equals(distributionBusinessPreOrderEntity.getStockArticleId())) { |
|
|
|
|
// 找到订单
|
|
|
|
|
|
|
|
|
|
if(businessPreOrderEntity.getOrderPackageCode().equals(distributionBusinessPreOrderEntity.getOrderPackageCode())){ |
|
|
|
|
if (businessPreOrderEntity.getOrderPackageCode().equals(distributionBusinessPreOrderEntity.getOrderPackageCode())) { |
|
|
|
|
//找到包件 并标记为删除状态
|
|
|
|
|
temsp.add(distributionBusinessPreOrderEntity.getId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 更新删除状态
|
|
|
|
|
distributionBusinessPreOrderService.deleteLogic(temsp); |
|
|
|
|
if (!temsp.isEmpty()) { |
|
|
|
|
// 更新删除状态
|
|
|
|
|
distributionBusinessPreOrderService.deleteLogic(temsp); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 执行保存操作
|
|
|
|
|
distributionBusinessPreOrderService.saveBatch(dataResult); |
|
|
|
@ -165,50 +167,47 @@ public class BusinessPreOrderDataQueueHandler {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void saveOtherDataBase(List<DistributionBusinessPreOrderEntity> dataResult, String maillName) { |
|
|
|
|
String method = "########################saveOtherDataBase"; |
|
|
|
|
R<Tenant> tenantByName = sysClient.getTenantByName(maillName); |
|
|
|
|
if(tenantByName.isSuccess()){ |
|
|
|
|
if (tenantByName.isSuccess()) { |
|
|
|
|
Tenant tenant = tenantByName.getData(); |
|
|
|
|
if(ObjectUtil.isEmpty(tenant)){ |
|
|
|
|
if (ObjectUtil.isEmpty(tenant)) { |
|
|
|
|
log.info(">>>>>>>>>>>>> BusinessPreOrderDataQueueHandler 租户不存在"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (dataResult.isEmpty()) { |
|
|
|
|
log.info(method+"dataResult 参数错误"); |
|
|
|
|
log.info(method + "dataResult 参数错误"); |
|
|
|
|
} |
|
|
|
|
DynamicDataSourceContextHolder.push(tenant.getTenantId()); |
|
|
|
|
Map<Integer, List<DistributionBusinessPreOrderEntity>> map = dataResult.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getInWarehouse)); |
|
|
|
|
if (Func.isNotEmpty(map.get(1))){ |
|
|
|
|
if (Func.isNotEmpty(map.get(1))) { |
|
|
|
|
//存在需要进行删除的数据
|
|
|
|
|
List<DistributionBusinessPreOrderEntity> deleteList = map.get(0); |
|
|
|
|
if (!deleteList.isEmpty()) { |
|
|
|
|
Map<String, List<DistributionBusinessPreOrderEntity>> deletedMap = deleteList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode)); |
|
|
|
|
deletedMap.forEach((k,v)->{ |
|
|
|
|
deletedMap.forEach((k, v) -> { |
|
|
|
|
List<String> deletedPackageList = v.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList()); |
|
|
|
|
log.info("删除商家端数据>>>>reservationCode:{}",deletedPackageList); |
|
|
|
|
if (!deletedPackageList.isEmpty()){ |
|
|
|
|
log.info("删除商家端数据>>>>reservationCode:{}", deletedPackageList); |
|
|
|
|
if (!deletedPackageList.isEmpty()) { |
|
|
|
|
//进行删除
|
|
|
|
|
Integer row = distributionBusinessPreOrderService.deleteBusinessPreOrder(k,deletedPackageList); |
|
|
|
|
log.info("删除商家端数据>>>>row:{}",row); |
|
|
|
|
Integer row = distributionBusinessPreOrderService.deleteBusinessPreOrder(k, deletedPackageList); |
|
|
|
|
log.info("删除商家端数据>>>>row:{}", row); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(map.get(0))){ |
|
|
|
|
if (Func.isNotEmpty(map.get(0))) { |
|
|
|
|
//存在可能变更的数据
|
|
|
|
|
List<DistributionBusinessPreOrderEntity> mapList = map.get(0); |
|
|
|
|
List<DistributionBusinessPreOrderEntity> mapList = map.get(0); |
|
|
|
|
Map<String, List<DistributionBusinessPreOrderEntity>> saveData = mapList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode)); |
|
|
|
|
List<DistributionBusinessPreOrderEntity> existData= new ArrayList<>(); |
|
|
|
|
List<DistributionBusinessPreOrderEntity> existData = new ArrayList<>(); |
|
|
|
|
if (!saveData.isEmpty()) { |
|
|
|
|
//查询是否存在重复
|
|
|
|
|
saveData.forEach((k,v)->{ |
|
|
|
|
saveData.forEach((k, v) -> { |
|
|
|
|
List<DistributionBusinessPreOrderEntity> list = distributionBusinessPreOrderService.list(Wrappers.<DistributionBusinessPreOrderEntity>query().lambda() |
|
|
|
|
.eq(DistributionBusinessPreOrderEntity::getReservationCode, k) |
|
|
|
|
.in(DistributionBusinessPreOrderEntity::getOrderPackageCode, v.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList())) |
|
|
|
@ -219,11 +218,11 @@ public class BusinessPreOrderDataQueueHandler {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
if (!existData.isEmpty()){ |
|
|
|
|
if (!existData.isEmpty()) { |
|
|
|
|
//二者比较取差集
|
|
|
|
|
mapList = mapList.stream().filter(m -> !existData.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList()).contains(m.getOrderPackageCode())).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
if (!mapList.isEmpty()){ |
|
|
|
|
if (!mapList.isEmpty()) { |
|
|
|
|
for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : mapList) { |
|
|
|
|
distributionBusinessPreOrderEntity.setTenantId(tenant.getTenantId()); |
|
|
|
|
} |
|
|
|
|