From 99c14f5032166b632265e50eab5f08be82c2d2f7 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Mon, 20 May 2024 22:04:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E6=95=B0=E6=8D=AE=E6=8E=A8=E9=80=81=20-?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributionBusinessPreOrderEntity.java | 3 +- .../src/main/resources/application-dev.yml | 8 +- ...istributionBusinessPreOrderController.java | 14 +- .../DistributionBusinessPreOrderMapper.xml | 4 + .../BusinessPreOrderDataQueueHandler.java | 104 +++++-- .../IDistributionBusinessPreOrderService.java | 4 +- .../DistributionDeliveryListServiceImpl.java | 280 +----------------- ...stributionBusinessPreOrderServiceImpl.java | 15 +- 8 files changed, 116 insertions(+), 316 deletions(-) diff --git a/blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java b/blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java index 4e55f8d4b..7197a7e8b 100644 --- a/blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java +++ b/blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java @@ -266,7 +266,8 @@ public class DistributionBusinessPreOrderEntity extends TenantEntity { private Integer inWarehouse;// @ApiModelProperty(value = "来源租户") - private String formTenantId; + private String fromTenantId; + @ApiModelProperty(value = "操作状态 0 正常操作 1.补录操作") private Integer operationStatus; diff --git a/blade-service/logpm-basic/src/main/resources/application-dev.yml b/blade-service/logpm-basic/src/main/resources/application-dev.yml index 14fe5cb4d..2a19240b9 100644 --- a/blade-service/logpm-basic/src/main/resources/application-dev.yml +++ b/blade-service/logpm-basic/src/main/resources/application-dev.yml @@ -42,12 +42,12 @@ spring: url: ${blade.datasource.basic.627683.url} username: ${blade.datasource.basic.627683.username} password: ${blade.datasource.basic.627683.password} - 703923: + 703623: druid: #独立校验配置 validation-query: select 1 #oracle校验 #validation-query: select 1 from dual - url: ${blade.datasource.basic.703923.url} - username: ${blade.datasource.basic.703923.username} - password: ${blade.datasource.basic.703923.password} + url: ${blade.datasource.basic.703623.url} + username: ${blade.datasource.basic.703623.username} + password: ${blade.datasource.basic.703623.password} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java index 7020d175c..3930d641a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java @@ -12,6 +12,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; @@ -26,6 +27,7 @@ import java.util.Map; @RestController @AllArgsConstructor +@Slf4j @RequestMapping("/businessPreOrder") @Api(value = "配送增值服务明细", tags = "预入库信息控制器") public class DistributionBusinessPreOrderController extends BladeController { @@ -47,10 +49,16 @@ public class DistributionBusinessPreOrderController extends BladeController { @GetMapping("/inOrder") @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入distributionDeliveryList") + @ApiOperation(value = "页面ID", notes = "传入distributionDeliveryList") public R inOrder(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - Boolean isSuccess =distributionBusinessPreOrderService.inOrder(ids); - return R.data(isSuccess); +// try { + Boolean isSuccess =distributionBusinessPreOrderService.inOrder(ids); + return R.data(isSuccess); +// }catch (Exception e){ +// log.error("预入库信息入库失败",e); +// return R.fail(500,e.getMessage()); +// } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml index 22eca92ac..bd4bd558b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml @@ -27,6 +27,10 @@ waybill_number, dealer_name, dealer_code, + order_package_code, + reservation_code, + operation_status, + distr_car_number, send_warehouse_name, accept_warehouse_name, weight, diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java index 31e6f765b..0415a9c86 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java @@ -47,7 +47,7 @@ public class BusinessPreOrderDataQueueHandler { public void businessPreOrderDataHandler(Map map, Message message, Channel channel) { - String mallName = "仁寿欧派大家具"; + String mallName = "仁寿欧派大家居"; Long t = (Long) map.get("messageData"); if (ObjectUtil.isEmpty(t)) { @@ -68,10 +68,11 @@ public class BusinessPreOrderDataQueueHandler { return; } - List orderPackageIds = new ArrayList<>(); - + List dataResult = new ArrayList<>(); for (DistributionReservationEntity distributionReservationEntity : list) { // 判断需要进行推送商家名称 + log.info(">>>>> mallName TAG {}",mallName); + log.info(">>>>> distributionReservationEntity.getMallName() TAG {}",distributionReservationEntity.getMallName()); if (mallName.equals(distributionReservationEntity.getMallName())) { // 将当前的预约单加入到需要推送的列表 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -81,33 +82,29 @@ public class BusinessPreOrderDataQueueHandler { for (DistributionReservationPackageEntity distributionReservationPackageEntity : distributionReservationPackageEntityList) { - orderPackageIds.add(distributionReservationPackageEntity.getParceListId()); + + DistributionParcelListEntity byId = distributionParcelListService.getById(distributionReservationPackageEntity.getParceListId()); + DistributionBusinessPreOrderEntity data = BeanUtil.copy(byId, DistributionBusinessPreOrderEntity.class); + + data.setDriverName(distributionDeliveryListEntity.getDriverName()); + data.setVehicleName(distributionDeliveryListEntity.getVehicleName()); + data.setDistrCarNumber(distributionDeliveryListEntity.getTrainNumber()); + data.setFromTenantId(byId.getTenantId()); + data.setOperationStatus(0); + data.setInWarehouse(0); + data.setId(null); + data.setTenantId(null); + data.setReservationCode(distributionReservationEntity.getReservationCode()); + dataResult.add(data); } } } - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.in(DistributionParcelListEntity::getId, orderPackageIds); - // 查询包间列表 - List list1 = distributionParcelListService.list(lambdaQueryWrapper); - - List dataResult = new ArrayList<>(); - for (DistributionParcelListEntity distributionParcelListEntity : list1) { - - - DistributionBusinessPreOrderEntity data = BeanUtil.copy(distributionParcelListEntity, DistributionBusinessPreOrderEntity.class); - - data.setDriverName(distributionDeliveryListEntity.getDriverName()); - data.setVehicleName(distributionDeliveryListEntity.getVehicleName()); - data.setDistrCarNumber(distributionDeliveryListEntity.getTrainNumber()); - data.setFormTenantId(distributionParcelListEntity.getTenantId()); - data.setOperationStatus(0); - dataResult.add(data); + // 查询包间列表 - } - saveOtherDataBase(dataResult, mallName); + saveOtherDataBaseNew(dataResult, mallName); // 查询配送单对应的司机 // 需要将查询出来的数据与 当前保存的数据进行比对 避免重复插入 @@ -119,6 +116,61 @@ public class BusinessPreOrderDataQueueHandler { log.info("businessPreOrderDataHandler:{}", map); } + public void saveOtherDataBaseNew(List dataResult, String maillName) { + + // 查询保存的对象在商场端是否存在 && 没有入库的 都i需要删除 执行新的 + List orderIdList = dataResult.stream() + .map(DistributionBusinessPreOrderEntity::getStockArticleId) + .collect(Collectors.toList()); + R tenantByName = sysClient.getTenantByName(maillName); + if(tenantByName.isSuccess()){ + Tenant tenant = tenantByName.getData(); + if(ObjectUtil.isEmpty(tenant)){ + log.info(">>>>>>>>>>>>> saveOtherDataBaseNew 租户不存在"); + return; + } + if (dataResult.isEmpty()) { + log.info(" saveOtherDataBaseNew dataResult 参数错误"); + } + DynamicDataSourceContextHolder.push(tenant.getTenantId()); + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(DistributionBusinessPreOrderEntity::getInWarehouse,0); + lambdaQueryWrapper.in(DistributionBusinessPreOrderEntity::getStockArticleId,orderIdList); + List list = distributionBusinessPreOrderService.list(lambdaQueryWrapper); + + + // 找到已经推送的包件信息 并将其标记为删除状态 + List temsp = new ArrayList<>(); + for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : list) { + + for (DistributionBusinessPreOrderEntity businessPreOrderEntity : dataResult) { + + if(businessPreOrderEntity.getStockArticleId().equals(distributionBusinessPreOrderEntity.getStockArticleId())){ + // 找到订单 + + if(businessPreOrderEntity.getOrderPackageCode().equals(distributionBusinessPreOrderEntity.getOrderPackageCode())){ + //找到包件 并标记为删除状态 + temsp.add(distributionBusinessPreOrderEntity.getId()); + } + } + } + } + // 更新删除状态 + distributionBusinessPreOrderService.deleteLogic(temsp); + + // 执行保存操作 + distributionBusinessPreOrderService.saveBatch(dataResult); + DynamicDataSourceContextHolder.poll(); + } + + + + } + + + + public void saveOtherDataBase(List dataResult, String maillName) { String method = "########################saveOtherDataBase"; R tenantByName = sysClient.getTenantByName(maillName); @@ -135,7 +187,7 @@ public class BusinessPreOrderDataQueueHandler { Map> map = dataResult.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getInWarehouse)); if (Func.isNotEmpty(map.get(1))){ //存在需要进行删除的数据 - List deleteList = map.get(1); + List deleteList = map.get(0); if (!deleteList.isEmpty()) { Map> deletedMap = deleteList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode)); deletedMap.forEach((k,v)->{ @@ -149,9 +201,9 @@ public class BusinessPreOrderDataQueueHandler { }); } } - if (Func.isNotEmpty(map.get(2))){ + if (Func.isNotEmpty(map.get(0))){ //存在可能变更的数据 - List mapList = map.get(2); + List mapList = map.get(0); Map> saveData = mapList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode)); List existData= new ArrayList<>(); if (!saveData.isEmpty()) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java index 00e3b3ca1..4a895ff91 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java @@ -7,6 +7,8 @@ import com.logpm.business.vo.DistributionBusinessPreOrderListVO; import com.logpm.business.vo.DistributionBusinessPreOrderVO; import com.logpm.distribution.bean.Resp; import com.logpm.distribution.entity.DistributionBillLadingScanEntity; +import org.springblade.common.exception.CustomerException; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; @@ -20,7 +22,7 @@ public interface IDistributionBusinessPreOrderService extends BaseService> storeClient = stockArticle.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getStoreName)); -// List distributionStockArticleDTOS = storeClient.get(""); -// Map> mallClient = null; -// if (!Func.isEmpty(distributionStockArticleDTOS)) { -// mallClient = distributionStockArticleDTOS.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getMallName)); -// Map> finalMallClient = mallClient; -// storeClient.forEach((k, v) -> finalMallClient.merge(k, v, (v1, v2) -> v2)); -// } else { -// mallClient = storeClient; -// } -// -// List reservationEntityList = distributionReservationMapper.getDeliveryReservation(deliveryListEntity.getId()); -// //将原客户和新的进行比对,如果有那么则进行客户修改,最后剩下的订单信息都属于是新客户 -// Map> originalClient = reservationEntityList.stream().collect(Collectors.groupingBy(DistributionReservationEntity::getConsignee)); -// //查询原来的备货任务 -//// DistributionStockupVO stockupInfo = distributionStockupMapper.getDeliveryStockupInfo(deliveryListEntity.getId()); -// Date date = new Date(); -// BladeUser user = AuthUtil.getUser(); -// AtomicInteger clientNum = new AtomicInteger(); -// AtomicInteger orderNum = new AtomicInteger(); -// mallClient.forEach((k, v) -> { -// clientNum.getAndIncrement(); -// //判断原始客户中是否存在 -// if (Func.isEmpty(originalClient.get(k))) { -// //不存在,意味这里应该进行客户的新增 -// DistributionReservationDTO reservation = deliveryListDTO.getReservation(); -// DistributionReservationEntity distributionReservationEntity = Func.copy(reservation, DistributionReservationEntity.class); -// distributionReservationEntity.setReservationDate(date); -// distributionReservationEntity.setServeType(deliveryListDTO.getReservation().getServeType()); -// distributionReservationEntity.setConsignee(k); -// distributionReservationEntity.setDeliveryAddress(v.get(0).getCustomerAddress()); -// distributionReservationEntity.setDeliveryPhone(v.get(0).getCustomerTelephone()); -// distributionReservationEntity.setDeliveryWay(deliveryListDTO.getReservation().getDeliveryWay()); -// distributionReservationEntity.setReservationStatus(ReservationStatusConstant.daipeisong.getValue()); -// distributionReservationEntity.setStockupStatus(ReservationStockupStatusConstant.daibeihuo.getValue()); -// distributionReservationEntity.setReservationCode(Func.random(13, RandomType.INT)); -// distributionReservationEntity.setDeliveryType(DistributionTypeConstant.shangpei.getValue()); -// //默认配送时间为全天 -// distributionReservationEntity.setPeriodOfTime(ServiceConstant.RESERVATION_PERIOED_TIME_DAY); -// distributionReservationEntity.setCreateUser(user.getUserId()); -// distributionReservationEntity.setCreateDept(Long.parseLong(user.getDeptId())); -// distributionReservationEntity.setIsDeleted(0); -// distributionReservationEntity.setStatus(1); -// distributionReservationEntity.setTenantId(user.getTenantId()); -// distributionReservationEntity.setCreateTime(new Date()); -// distributionReservationEntity.setUpdateUser(user.getUserId()); -// distributionReservationEntity.setUpdateTime(new Date()); -// distributionReservationMapper.insert(distributionReservationEntity); -// HashSet orderCode = new HashSet<>(); -// HashSet serviceNumber = new HashSet<>(); -// HashSet mallName = new HashSet<>(); -// AtomicInteger packageTotal = new AtomicInteger(); -// -// v.forEach(s -> { -// orderNum.getAndIncrement(); -// mallName.add(s.getMallName()); -// DistributionStockArticleDTO stockArticleDTO = Func.copy(s, DistributionStockArticleDTO.class); -// List packageListInfo = stockArticleDTO.getPackageListInfo(); -// AtomicInteger packageNum = new AtomicInteger(); -// //维护包件信息 -// packageListInfo.forEach(p -> { -// DistributionReservationPackageEntity packageEntity = new DistributionReservationPackageEntity(); -// packageEntity.setStockArticleId(s.getId()); -// packageEntity.setReservationId(distributionReservationEntity.getId()); -// packageEntity.setPacketBarCode(p.getOrderPackageCode()); -// packageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue()); -// packageEntity.setParceListId(p.getId()); -// p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); -// distributionParcelListService.updateById(p); -// distributionReservationPackageService.save(packageEntity); -// //包件统计 -// packageNum.getAndAdd(p.getQuantity()); -// }); -// //修改订单信息 -// s.setReservationStatus(distributionReservationPackageService.judgmentStatus(s)); -// DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity(); -// reservationStockarticleEntity.setReservationNum(packageNum.get()); -// reservationStockarticleEntity.setReservationId(distributionReservationEntity.getId()); -// reservationStockarticleEntity.setStockArticleId(s.getId()); -// reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.zengjia.getValue()); -// distributionReservationStockarticleService.save(reservationStockarticleEntity); -// distributionStockArticleService.updateById(s); -// orderCode.add(s.getOrderCode()); -// packageTotal.getAndAdd(reservationStockarticleEntity.getReservationNum()); -// serviceNumber.add(s.getServiceNumber()); -// }); -// distributionReservationEntity.setStockArticleId(String.join(",", orderCode)); -// distributionReservationEntity.setReservationNum(packageTotal.get()); -// distributionReservationEntity.setStockupStatus(ReservationStockupStatusConstant.daibeihuo.getValue()); -// distributionReservationEntity.setReservationStatus(ReservationStatusConstant.daipeisong.getValue()); -// distributionReservationEntity.setServiceNumber(String.join(",", serviceNumber)); -// distributionReservationEntity.setMallName(String.join(",",mallName)); -// distributionReservationMapper.updateById(distributionReservationEntity); -// //建立这个预约和配送任务之间的关系 -// DistributionSignforEntity distributionSignforEntity = new DistributionSignforEntity(); -// distributionSignforEntity.setDeliveryId(deliveryListEntityId); -// distributionSignforEntity.setTrainNumber(deliveryListEntity.getTrainNumber()); -// distributionSignforEntity.setReservationId(distributionReservationEntity.getId()); -// distributionSignforService.save(distributionSignforEntity); -// //这里查看这个配送任务的备货任务是否已完成,如果已完成则需要开新的备货任务,否则将这个新的预约和原来的备货任务建立绑定关系 -// DistributionStockupInfoEntity stockupInfoEntity = new DistributionStockupInfoEntity(); -// stockupInfoEntity.setReservationId(distributionReservationEntity.getId()); -// stockupInfoEntity.setStockupId(deliveryStockupInfo.getId()); -// distributionStockupInfoService.save(stockupInfoEntity); -// } else { -// DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomer(deliveryListEntityId, k); -// String stockArticleId = reservationEntity.getStockArticleId(); -// String[] split = stockArticleId.split(","); -// List list = Arrays.asList(split); -// HashSet orderNumber = new HashSet<>(); -// orderNumber.addAll(list); -// AtomicInteger packageTotal = new AtomicInteger(); -// AtomicInteger reduceOrder = new AtomicInteger(); -//// List reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(reservationEntity.getId()); -// List reservationStockarticleEntityList = distributionDeliveryListMapper.selectStockArticleById(deliveryListEntityId,k); -// Map> oldStockArticle = reservationStockarticleEntityList.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId)); -// v.forEach(s -> { -// orderNum.getAndIncrement(); -// //根据配送和客户名称查询预约 -// AtomicInteger packageNum = new AtomicInteger(); -// AtomicInteger reduceNum = new AtomicInteger(); -// if (Func.isEmpty(oldStockArticle.get(s.getId()))) { -// //订单新增 -// //维护包件 -// List packageListInfo = s.getPackageListInfo(); -// packageListInfo.forEach(p -> { -// DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); -// reservationPackageEntity.setReservationId(reservationEntity.getId()); -// reservationPackageEntity.setStockArticleId(s.getId()); -// reservationPackageEntity.setPacketBarCode(p.getOrderPackageCode()); -// reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue()); -// reservationPackageEntity.setParceListId(p.getId()); -// distributionReservationPackageService.save(reservationPackageEntity); -// //统计包件数量 -// packageNum.getAndAdd(p.getQuantity()); -// p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); -// distributionParcelListService.updateById(p); -// }); -// //查询该订单有效的预约包件数量是否和订单总件数一样,一样订单状态为已预约,否则为部分预约 -//// int number = distributionReservationPackageMapper.selectPackageNum(s.getId()); -//// if (Func.equals(number, s.getTotalNumber())) { -//// s.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue()); -//// } else { -//// s.setReservationStatus(OrderReservationStatusConstant.bufenyuyue.getValue()); -//// } -// DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity(); -// reservationStockarticleEntity.setReservationId(reservationEntity.getId()); -//// reservationStockarticleEntity.setStockArticleStatus(distributionReservationPackageService.judgmentStatus()); -// reservationStockarticleEntity.setStockArticleId(s.getId()); -// reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.zengjia.getValue()); -// reservationStockarticleEntity.setReservationNum(packageNum.get()); -// distributionReservationStockarticleService.save(reservationStockarticleEntity); -// packageTotal.getAndAdd(reservationStockarticleEntity.getReservationNum()); -// //拼接订单自编号 -// orderNumber.add(s.getOrderCode()); -// } else { -// //这里就表示这个订单和这个预约已经存在绑定关系,查看订单是否有修改包件的动作 -// List reservationPackageEntityList = distributionReservationMapper.selectPackageByReservationAndStockArticle(reservationEntity.getId(), s.getId()); -// Map> oldPackage = reservationPackageEntityList.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getParceListId)); -// List packageListInfo = s.getPackageListInfo(); -// Map> newPackage = packageListInfo.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getId)); -// newPackage.forEach((m, n) -> { -// if (Func.isEmpty(oldPackage.get(m))) { -// //新增包件 -// DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); -// reservationPackageEntity.setParceListId(n.get(0).getId()); -// reservationPackageEntity.setPacketBarCode(n.get(0).getOrderPackageCode()); -// reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue()); -// reservationPackageEntity.setReservationId(reservationEntity.getId()); -// reservationPackageEntity.setStockArticleId(s.getId()); -// distributionReservationPackageService.save(reservationPackageEntity); -// DistributionParcelListEntity parcelListEntity = n.get(0); -// parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); -// distributionParcelListService.updateById(parcelListEntity); -// packageNum.getAndAdd(parcelListEntity.getQuantity()); -// } else { -// //列表存在这个订单,将它进行移除 -// oldPackage.remove(m); -// } -// }); -// oldPackage.forEach((i, j) -> { -// DistributionReservationPackageEntity distributionReservationPackageEntity = j.get(0); -// distributionReservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue()); -// distributionReservationPackageService.updateById(distributionReservationPackageEntity); -// DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionReservationPackageEntity.getParceListId()); -// parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); -// distributionParcelListService.updateById(parcelListEntity); -// //统计减少包件数量 -// reduceNum.getAndAdd(parcelListEntity.getQuantity()); -// //移除订单信息前端不会将取消的包件信息传递至后端,这里需要找出该订单下被选择的包件信息进行全部取消的操作 -// -// //这些数据就是取消的包件 -// }); -// //这里修改结束需要对包件信息进行维护 -// //订单的预约状态判断改变 -// s.setReservationStatus(distributionReservationPackageService.judgmentStatus(s)); -// distributionStockArticleService.updateById(s); -// List reservationStockarticleEntities = oldStockArticle.get(s.getId()); -// DistributionReservationStockarticleEntity reservationStockarticleEntity = reservationStockarticleEntities.get(0); -// reservationStockarticleEntity.setReservationNum(reservationStockarticleEntity.getReservationNum() + packageNum.get() - reduceNum.get()); -// distributionReservationStockarticleService.updateById(reservationStockarticleEntity); -// packageTotal.getAndAdd(reservationStockarticleEntity.getReservationNum()); -// oldStockArticle.remove(s.getId()); -// } -// }); -// //需要进行移除的订单 -// oldStockArticle.forEach((a, b) -> { -// DistributionReservationStockarticleEntity reservationStockarticleEntity = b.get(0); -// DistributionStockArticleEntity articleEntity = distributionStockArticleService.getById(reservationStockarticleEntity.getStockArticleId()); -// DistributionStockArticleDTO articleDTO = Func.copy(articleEntity, DistributionStockArticleDTO.class); -// reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue()); -// distributionReservationStockarticleService.updateById(reservationStockarticleEntity); -// //这里需要对订单的预约状态进行判断后修改 -// articleEntity.setReservationStatus(distributionReservationPackageService.judgmentStatus(articleDTO)); -// distributionStockArticleService.updateById(articleEntity); -// //订单自编号取消 -// orderNumber.remove(articleEntity.getOrderCode()); -// reduceOrder.getAndAdd(reservationStockarticleEntity.getReservationNum()); -// // 这里移除订单还需要对这个订单下存在的包件进行批量取消 -// List reservationPackageEntityList = distributionReservationPackageService.getBaseMapper().selectList( -// Wrappers.query().lambda() -// .eq(DistributionReservationPackageEntity::getReservationId, b.get(0).getReservationId()) -// .eq(DistributionReservationPackageEntity::getStockArticleId, b.get(0).getStockArticleId())); -// reservationPackageEntityList.forEach(rs -> { -// rs.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue()); -// distributionReservationPackageService.updateById(rs); -// }); -// }); -// // 对预约任务进行修改信息完善 -// //对预约进行修改 -// DistributionReservationDTO reservation = deliveryListDTO.getReservation(); -// reservationEntity.setReservationNum(packageTotal.get()); -// reservationEntity.setStockArticleId(String.join(",", orderNumber)); -// reservationEntity.setServeType(reservation.getServeType()); -// reservationEntity.setDeliveryWay(reservation.getDeliveryWay()); -// reservationEntity.setDeliveryType(DistributionTypeConstant.shangpei.getValue()); -// reservationEntity.setOtherFee(reservation.getOtherFee()); -// originalClient.remove(k); -// distributionReservationMapper.updateById(reservationEntity); -// } -// }); -// //TODO 对取消的预约进行标识 -// originalClient.forEach((f, g) -> { -// DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomer(deliveryListEntity.getId(), f); -// reservationEntity.setReservationStatus(ReservationStatusConstant.yiquexiao.getValue()); -// distributionReservationMapper.updateById(reservationEntity); -// //这里还需要将减少的预约单下的所有订单、包件进行取消状态 -// List entities = distributionReservationStockarticleMapper.selectList(Wrappers.query().lambda() -// .ne(DistributionReservationStockarticleEntity::getStockArticleStatus, "2") -// .eq(DistributionReservationStockarticleEntity::getReservationId, reservationEntity.getId())); -// entities.forEach(e->{ -// e.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue()); -// distributionReservationStockarticleService.updateById(e); -// //这个订单的包件预约进行取消 -// List packageEntityList = distributionReservationPackageMapper.selectList(Wrappers.query().lambda().eq(DistributionReservationPackageEntity::getStockArticleId, e.getStockArticleId()).ne(DistributionReservationPackageEntity::getPacketBarStatus, "2")); -// packageEntityList.forEach(p->{ -// p.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue()); -// distributionReservationPackageService.updateById(p); -// DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p.getParceListId()); -// parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); -// distributionParcelListService.updateById(parcelListEntity); -// }); -// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(e.getStockArticleId()); -// stockArticleEntity.setReservationStatus(distributionReservationPackageService.judgmentStatus(Func.copy(stockArticleEntity,DistributionStockArticleDTO.class))); -// distributionStockArticleService.updateById(stockArticleEntity); -// //修改预约状态和包件状态 -// }); -// List reservationEntities = originalClient.get(f); -// reservationEntities.forEach(r->{ -// distributionSignforMapper.deleteByReservationAndDeliveryId(r.getId(),deliveryListEntityId); -// }); -// }); + // 执行发送推送 + distributionReservationService.createBusinessPreConversionQueue(deliveryListEntity.getId()); + + return R.status(true); + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java index cb14cddfc..697ef78f7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java @@ -27,6 +27,7 @@ import lombok.AllArgsConstructor; import org.springblade.common.annotations.ChangeAsync; import org.springblade.common.annotations.LogpmAsync; import org.springblade.common.exception.CustomerException; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.utils.BeanUtil; @@ -52,7 +53,7 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl idArray = Arrays.asList(ids.split(",")); @@ -62,12 +63,12 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl distributionStockArticleEntityCompletableFuture = CompletableFuture.supplyAsync(() -> distributionAsyncService.findDistributionStockArticleEntityByIdForAsync(distributionBusinessPreOrderEntity.getFormTenantId(), distributionBusinessPreOrderEntity.getStockArticleId())); + CompletableFuture distributionStockArticleEntityCompletableFuture = CompletableFuture.supplyAsync(() -> distributionAsyncService.findDistributionStockArticleEntityByIdForAsync(distributionBusinessPreOrderEntity.getFromTenantId(), distributionBusinessPreOrderEntity.getStockArticleId())); stockArticleEntity = distributionStockArticleEntityCompletableFuture.get(); if (stockArticleEntity == null) { return null;