Browse Source

增加删除错误的数据推送 -逻辑删除

master
pref_mail@163.com 11 months ago
parent
commit
99c14f5032
  1. 3
      blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java
  2. 8
      blade-service/logpm-basic/src/main/resources/application-dev.yml
  3. 14
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java
  4. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml
  5. 104
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java
  6. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java
  7. 280
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  8. 15
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java

3
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;

8
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}

14
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<Boolean> 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());
// }
}

4
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,

104
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<Long> orderPackageIds = new ArrayList<>();
List<DistributionBusinessPreOrderEntity> 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<DistributionReservationPackageEntity> 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<DistributionParcelListEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(DistributionParcelListEntity::getId, orderPackageIds);
// 查询包间列表
List<DistributionParcelListEntity> list1 = distributionParcelListService.list(lambdaQueryWrapper);
List<DistributionBusinessPreOrderEntity> 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<DistributionBusinessPreOrderEntity> dataResult, String maillName) {
// 查询保存的对象在商场端是否存在 && 没有入库的 都i需要删除 执行新的
List<Long> orderIdList = dataResult.stream()
.map(DistributionBusinessPreOrderEntity::getStockArticleId)
.collect(Collectors.toList());
R<Tenant> 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<DistributionBusinessPreOrderEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DistributionBusinessPreOrderEntity::getInWarehouse,0);
lambdaQueryWrapper.in(DistributionBusinessPreOrderEntity::getStockArticleId,orderIdList);
List<DistributionBusinessPreOrderEntity> list = distributionBusinessPreOrderService.list(lambdaQueryWrapper);
// 找到已经推送的包件信息 并将其标记为删除状态
List<Long> 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<DistributionBusinessPreOrderEntity> dataResult, String maillName) {
String method = "########################saveOtherDataBase";
R<Tenant> tenantByName = sysClient.getTenantByName(maillName);
@ -135,7 +187,7 @@ public class BusinessPreOrderDataQueueHandler {
Map<Integer, List<DistributionBusinessPreOrderEntity>> map = dataResult.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getInWarehouse));
if (Func.isNotEmpty(map.get(1))){
//存在需要进行删除的数据
List<DistributionBusinessPreOrderEntity> deleteList = 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)->{
@ -149,9 +201,9 @@ public class BusinessPreOrderDataQueueHandler {
});
}
}
if (Func.isNotEmpty(map.get(2))){
if (Func.isNotEmpty(map.get(0))){
//存在可能变更的数据
List<DistributionBusinessPreOrderEntity> mapList = map.get(2);
List<DistributionBusinessPreOrderEntity> mapList = map.get(0);
Map<String, List<DistributionBusinessPreOrderEntity>> saveData = mapList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode));
List<DistributionBusinessPreOrderEntity> existData= new ArrayList<>();
if (!saveData.isEmpty()) {

4
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<Distri
* @param ids
* @return
*/
Boolean inOrder(String ids);
Boolean inOrder(String ids) throws ServiceException;
/**

280
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -3666,283 +3666,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
deliveryListEntity.setTaskTime(deliveryListDTO.getTaskTime());
//对配送进行更改
this.updateById(deliveryListEntity);
return R.status(true);
//
// //根据门店进行分组
//// Map<String, List<DistributionStockArticleDTO>> storeClient = stockArticle.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getStoreName));
// List<DistributionStockArticleDTO> distributionStockArticleDTOS = storeClient.get("");
// Map<String, List<DistributionStockArticleDTO>> mallClient = null;
// if (!Func.isEmpty(distributionStockArticleDTOS)) {
// mallClient = distributionStockArticleDTOS.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getMallName));
// Map<String, List<DistributionStockArticleDTO>> finalMallClient = mallClient;
// storeClient.forEach((k, v) -> finalMallClient.merge(k, v, (v1, v2) -> v2));
// } else {
// mallClient = storeClient;
// }
//
// List<DistributionReservationEntity> reservationEntityList = distributionReservationMapper.getDeliveryReservation(deliveryListEntity.getId());
// //将原客户和新的进行比对,如果有那么则进行客户修改,最后剩下的订单信息都属于是新客户
// Map<String, List<DistributionReservationEntity>> 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<String> orderCode = new HashSet<>();
// HashSet<String> serviceNumber = new HashSet<>();
// HashSet<String> mallName = new HashSet<>();
// AtomicInteger packageTotal = new AtomicInteger();
//
// v.forEach(s -> {
// orderNum.getAndIncrement();
// mallName.add(s.getMallName());
// DistributionStockArticleDTO stockArticleDTO = Func.copy(s, DistributionStockArticleDTO.class);
// List<DistributionParcelListEntity> 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<String> list = Arrays.asList(split);
// HashSet<String> orderNumber = new HashSet<>();
// orderNumber.addAll(list);
// AtomicInteger packageTotal = new AtomicInteger();
// AtomicInteger reduceOrder = new AtomicInteger();
//// List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(reservationEntity.getId());
// List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionDeliveryListMapper.selectStockArticleById(deliveryListEntityId,k);
// Map<Long, List<DistributionReservationStockarticleEntity>> 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<DistributionParcelListEntity> 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<DistributionReservationPackageEntity> reservationPackageEntityList = distributionReservationMapper.selectPackageByReservationAndStockArticle(reservationEntity.getId(), s.getId());
// Map<Long, List<DistributionReservationPackageEntity>> oldPackage = reservationPackageEntityList.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getParceListId));
// List<DistributionParcelListEntity> packageListInfo = s.getPackageListInfo();
// Map<Long, List<DistributionParcelListEntity>> 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<DistributionReservationStockarticleEntity> 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<DistributionReservationPackageEntity> reservationPackageEntityList = distributionReservationPackageService.getBaseMapper().selectList(
// Wrappers.<DistributionReservationPackageEntity>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<DistributionReservationStockarticleEntity> entities = distributionReservationStockarticleMapper.selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
// .ne(DistributionReservationStockarticleEntity::getStockArticleStatus, "2")
// .eq(DistributionReservationStockarticleEntity::getReservationId, reservationEntity.getId()));
// entities.forEach(e->{
// e.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue());
// distributionReservationStockarticleService.updateById(e);
// //这个订单的包件预约进行取消
// List<DistributionReservationPackageEntity> packageEntityList = distributionReservationPackageMapper.selectList(Wrappers.<DistributionReservationPackageEntity>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<DistributionReservationEntity> reservationEntities = originalClient.get(f);
// reservationEntities.forEach(r->{
// distributionSignforMapper.deleteByReservationAndDeliveryId(r.getId(),deliveryListEntityId);
// });
// });
// 执行发送推送
distributionReservationService.createBusinessPreConversionQueue(deliveryListEntity.getId());
return R.status(true);
}

15
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<Di
private final IDistributionAsyncService distributionAsyncService;
@Override
public Boolean inOrder(String ids) {
public Boolean inOrder(String ids) throws ServiceException {
// 查询出来需要处理的包条码
List<String> idArray = Arrays.asList(ids.split(","));
@ -62,12 +63,12 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : list) {
if (distributionBusinessPreOrderEntity.getInWarehouse() == 1) {
throw new CustomerException("存在已入库的包件");
throw new ServiceException("存在已入库的包件");
}
//调用方法 执行批量入库
DistributionStockArticleEntity stockArticleEntity = buildDistributionStockArticleEntity(distributionBusinessPreOrderEntity);
if (stockArticleEntity == null) {
throw new CustomerException("订单信息错误,请联系管理员!");
throw new ServiceException("订单信息错误,请联系管理员!");
}
// 保存包件
distributionBusinessPreOrderEntity.setStockArticleId(stockArticleEntity.getId());
@ -174,7 +175,7 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
}
} catch (InterruptedException | ExecutionException e) {
log.error("inOrderWarehourse:", e);
throw new CustomerException("系统异常,请联系管理员");
throw new ServiceException("包件信息不存在!");
}
@ -202,6 +203,7 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
private void buildDistributionParcelListEntity(DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity) {
DistributionParcelListEntity distributionParcelListEntity = BeanUtil.copy(distributionBusinessPreOrderEntity, DistributionParcelListEntity.class);
distributionParcelListEntity.setId(null);
distributionParcelListService.save(distributionParcelListEntity);
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionParcelListEntity.getStockArticleId());
//增加
@ -219,10 +221,11 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
DistributionStockArticleEntity stockArticleEntity = null;
try {
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
stockArticleEntity = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(distributionBusinessPreOrderEntity.getOrderCode(), distributionBusinessPreOrderEntity.getWarehouseId());
stockArticleEntity = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(distributionBusinessPreOrderEntity.getOrderCode(),
myCurrentWarehouse.getId());
if (stockArticleEntity == null) {
// 需要保存这个对象
CompletableFuture<DistributionStockArticleEntity> distributionStockArticleEntityCompletableFuture = CompletableFuture.supplyAsync(() -> distributionAsyncService.findDistributionStockArticleEntityByIdForAsync(distributionBusinessPreOrderEntity.getFormTenantId(), distributionBusinessPreOrderEntity.getStockArticleId()));
CompletableFuture<DistributionStockArticleEntity> distributionStockArticleEntityCompletableFuture = CompletableFuture.supplyAsync(() -> distributionAsyncService.findDistributionStockArticleEntityByIdForAsync(distributionBusinessPreOrderEntity.getFromTenantId(), distributionBusinessPreOrderEntity.getStockArticleId()));
stockArticleEntity = distributionStockArticleEntityCompletableFuture.get();
if (stockArticleEntity == null) {
return null;

Loading…
Cancel
Save