Commit 5a147911 authored by 332784038@qq.com's avatar 332784038@qq.com

合单审批业务修改

parent 5ec19d6c
......@@ -300,18 +300,24 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
OrderApprovalQueryVO query = new OrderApprovalQueryVO();
query.setFormId(mergeDO.getBpmProcessId());
List<OrderApprovalDO> approvalDOList = orderApprovalService.getApprovalList(query);
List<Long> mergeOrderIdList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(approvalDOList)) {
orderApprovalService.updateBatchById(approvalDOList.stream().peek(it -> it.setStatus(result)).collect(Collectors.toList()));
for (OrderApprovalDO it : approvalDOList) {
it.setStatus(result);
mergeOrderIdList.add(it.getOrderId());
}
orderApprovalService.updateBatchById(approvalDOList);
}
//审批拒绝则修改所有流程编号一致的合单申请状态
if (result == 3) {
List<MergeDO> mergeDOS = mergeMapper.selectList(MergeDO::getBpmProcessId, mergeDO.getBpmProcessId());
Integer type = OrderApprovalTypeResultEnum.merge_order_reject.getType();
orderService.updateStatus(null, mergeDOS.get(0).getApplyOrderNo(), OrderStatusEnum.IN_WAREHOUSE.getValue(), null, OrderWarehouseInStatusEnum.warehouse_finished.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 3).getDesc());
for (MergeDO mergeDO1 : mergeDOS) {
mergeDO1.setStatus(result);
mergeMapper.updateById(mergeDO1);
orderService.updateStatus(null, mergeDO1.getOrderNos(), OrderStatusEnum.IN_WAREHOUSE.getValue(), null, OrderWarehouseInStatusEnum.warehouse_finished.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 3).getDesc());
}
for (Long orderId : mergeOrderIdList) {
orderService.updateStatus(orderId, null, OrderStatusEnum.IN_WAREHOUSE.getValue(), null, OrderWarehouseInStatusEnum.warehouse_finished.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 3).getDesc());
}
} else if (result == 2) {
//审批通过,需考虑分多次提交的合单申请
......@@ -404,7 +410,6 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
mergeDO1.setMergedOrderNo(mergedOrderNo);
orderGuanlianService.deleteRelationByOrderId(orderDO1.getOrderId());
mergeMapper.updateById(mergeDO1);
orderService.updateStatus(null, orderNo, OrderStatusEnum.MERGED_ORDER.getValue(), null, OrderWarehouseInStatusEnum.order_merge_apply_finish.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 2).getDesc());
receivableService.remove(new LambdaQueryWrapperX<ReceivableDO>().eq(ReceivableDO::getOrderId, orderDO1.getOrderId()).eq(ReceivableDO::getFeeSource, 1));
//修改入仓数据
orderWarehouseInList.addAll(orderWarehouseInService.selectList(OrderWarehouseInDO::getOrderId, orderDO1.getOrderId()));
......@@ -417,6 +422,9 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
);
warehousePictureDOList.addAll(orderWarehousePictureDOS);
}
for (Long orderId : mergeOrderIdList) {
orderService.updateStatus(orderId, null, OrderStatusEnum.MERGED_ORDER.getValue(), null, OrderWarehouseInStatusEnum.order_merge_apply_finish.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 2).getDesc());
}
orderDO.setOldNumbers(sb.toString());
orderDO.setSumNum(sumNum);
orderDO.setSumVolume(sumVolume);
......@@ -438,12 +446,8 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
receivableService.remove(new LambdaQueryWrapperX<ReceivableDO>().eq(ReceivableDO::getOrderId, orderDO.getOrderId()).eq(ReceivableDO::getFeeSource, 1));
//修改合并订单
orderService.mergeOrder(orderDO);
if (orderDO.getTransportId() == 3 || orderDO.getTransportId() == 4) {
orderService.updateStatus(null, orderDO.getOrderNo(), OrderStatusEnum.IN_WAREHOUSE.getValue(), null, OrderWarehouseInStatusEnum.warehouse_finished.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 2).getDesc());
} else {
orderService.updateStatus(null, orderDO.getOrderNo(), OrderStatusEnum.MERGED_ORDER.getValue(), null, OrderWarehouseInStatusEnum.order_merge_apply_pass.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 2).getDesc());
}
// TODO 删除原单的特需费用应收记录
// 删除原单的特需费用应收记录
specialNeedList.stream().forEach(item -> {
if (item.getReceivableId() != null && item.getReceivableId() > 0L) {
receivableService.removeById(item.getReceivableId());
......@@ -475,6 +479,7 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
});
orderFeeApplicationService.insertBatch(feeApplicationList);
feeApplicationCreateReceivable(feeApplicationList);
//处理新订单的储位
// orderLocationList.stream().forEach(item -> {
// item.setOrderId(orderDO.getOrderId());
......@@ -542,7 +547,6 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
StringBuilder sb = new StringBuilder();
sb.append(mergeDO.getApplyOrderNo()).append(",");
List<Long> orderIds = new ArrayList<>();
String applyOrderNo = "";
Integer type = OrderApprovalTypeResultEnum.merge_order_pass.getType();
List<OrderWarehouseInDO> orderWarehouseInList = orderWarehouseInService.selectList(OrderWarehouseInDO::getOrderId, orderDO2.getOrderId());
List<OrderSpecialNeedDO> specialNeedList = orderSpecialNeedService.getListByOrderId(orderDO2.getOrderId());
......@@ -593,9 +597,7 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
mergeDO1.setMergedOrderNo(newOrderNo);
orderGuanlianService.deleteRelationByOrderId(orderDO1.getOrderId());
mergeMapper.updateById(mergeDO1);
orderService.updateStatus(null, mergeDO1.getOrderNos(), OrderStatusEnum.MERGED_ORDER.getValue(), null, OrderWarehouseInStatusEnum.order_merge_apply_finish.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 2).getDesc());
orderIds.add(orderDO1.getOrderId());
applyOrderNo = mergeDO1.getApplyOrderNo();
receivableService.remove(new LambdaQueryWrapperX<ReceivableDO>().eq(ReceivableDO::getOrderId, orderDO1.getOrderId()).eq(ReceivableDO::getFeeSource, 1));
//合并除订单外的其他数据 TODO 入仓数据怎么处理? 复制原来的加上订单id来新增?
orderWarehouseInList.addAll(orderWarehouseInService.selectList(OrderWarehouseInDO::getOrderId, orderDO1.getOrderId()));
......@@ -608,9 +610,12 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
);
warehousePictureList.addAll(orderWarehousePictureDOS);
}
receivableService.remove(new LambdaQueryWrapperX<ReceivableDO>().eq(ReceivableDO::getOrderId, orderDO2.getOrderId()).eq(ReceivableDO::getFeeSource, 1));
orderGuanlianService.deleteRelationByOrderId(orderDO2.getOrderId());
orderService.updateStatus(null, applyOrderNo, OrderStatusEnum.MERGED_ORDER.getValue(), null, OrderWarehouseInStatusEnum.order_merge_apply_finish.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 2).getDesc());
for (Long orderId : mergeOrderIdList) {
orderService.updateStatus(orderId, null, OrderStatusEnum.MERGED_ORDER.getValue(), null, OrderWarehouseInStatusEnum.order_merge_apply_finish.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 2).getDesc());
}
orderDO.setOldNumbers(sb.deleteCharAt(sb.length() - 1).toString());
orderDO.setSumNum(sumNum);
orderDO.setSumVolume(sumVolume);
......@@ -631,11 +636,8 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
orderDO.setOrderItemDOList(orderItemDOS);
//新增合并订单
orderService.mergeOrder(orderDO);
if (orderDO.getTransportId() == 3 || orderDO.getTransportId() == 4) {
orderService.updateStatus(null, orderDO.getOrderNo(), OrderStatusEnum.IN_WAREHOUSE.getValue(), null, OrderWarehouseInStatusEnum.warehouse_finished.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 2).getDesc());
} else {
orderService.updateStatus(null, orderDO.getOrderNo(), OrderStatusEnum.MERGED_ORDER.getValue(), null, OrderWarehouseInStatusEnum.order_merge_apply_pass.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 2).getDesc());
}
//订单项入仓和货物信息和储位处理
Map<String, Long> itemIdMap = orderDO.getOrderItemDOList().stream().collect(Collectors.toMap(ii -> String.valueOf(ii.getOrgItemId()), OrderItemDO::getOrderItemId, (key1, key2) -> key1));
orderWarehouseInList.stream().forEach(item -> {
......@@ -667,20 +669,11 @@ public class MergeServiceImpl extends AbstractService<MergeMapper, MergeDO> impl
});
orderFeeApplicationService.insertBatch(feeApplicationList);
feeApplicationCreateReceivable(feeApplicationList);
//处理新订单的储位
// orderLocationList.stream().forEach(item -> {
// item.setOrderId(orderDO.getOrderId());
// item.setId(null);
//// orderLocationService.updateById(item);
// });
// orderLocationService.insertBatch(orderLocationList);
}
} else if (result == 4) {
Integer type = OrderApprovalTypeResultEnum.merge_order_cancel.getType();
List<MergeDO> cancelList = mergeMapper.selectList(new LambdaQueryWrapperX<MergeDO>().eq(MergeDO::getBpmProcessId, mergeDO.getBpmProcessId()).eq(MergeDO::getStatus, 1));
if (CollectionUtil.isNotEmpty(cancelList)) {
orderService.updateStatus(null, cancelList.get(0).getApplyOrderNo(), OrderStatusEnum.IN_WAREHOUSE.getValue(), null, OrderWarehouseInStatusEnum.warehouse_finished.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 4).getDesc());
cancelList.stream().forEach(item -> orderService.updateStatus(null, item.getOrderNos(), OrderStatusEnum.IN_WAREHOUSE.getValue(), null, OrderWarehouseInStatusEnum.warehouse_finished.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 4).getDesc()));
for (Long orderId : mergeOrderIdList) {
orderService.updateStatus(orderId, null, OrderStatusEnum.IN_WAREHOUSE.getValue(), null, OrderWarehouseInStatusEnum.warehouse_finished.getValue(), null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(type, 4).getDesc());
}
mergeMapper.delete(new LambdaQueryWrapperX<MergeDO>().eq(MergeDO::getBpmProcessId, mergeDO.getBpmProcessId()));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment