Commit 06684a34 authored by zhengyi's avatar zhengyi

预装、分拣只排除特价与费用申请审批进行中的订单

parent ee61b999
This diff is collapsed.
...@@ -24,6 +24,11 @@ public class OrderApprovalTypeCheckEvent { ...@@ -24,6 +24,11 @@ public class OrderApprovalTypeCheckEvent {
*/ */
private Integer approvalType; private Integer approvalType;
/**
* 订单审批类型列表 {@link cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum}
*/
private List<Integer> approvalTypeList;
/** /**
* 是否包含互斥审批类型: true 包含互斥审批或相同的审批不能进行重复审批 false 是没有包含互斥审批类型和当前审批类型 * 是否包含互斥审批类型: true 包含互斥审批或相同的审批不能进行重复审批 false 是没有包含互斥审批类型和当前审批类型
*/ */
......
...@@ -2753,7 +2753,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> { ...@@ -2753,7 +2753,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"and eo.status in (5,8,9) ", "and eo.status in (5,8,9) ",
"and eo.transport_id in (1,2,4)", "and eo.transport_id in (1,2,4)",
"and eo.abnormal_state=0 ", "and eo.abnormal_state=0 ",
"and eo.audit_type=0 ", "and eo.audit_type not in(1,2,3,4,5,12,31,32) ",
"<when test = 'query.rucangTimeStart != null'>", "<when test = 'query.rucangTimeStart != null'>",
"AND eo.`rucang_time` &gt;= #{query.rucangTimeStart}", "AND eo.`rucang_time` &gt;= #{query.rucangTimeStart}",
"</when>", "</when>",
......
...@@ -29,25 +29,30 @@ public class OrderApprovalTypeCheckListener { ...@@ -29,25 +29,30 @@ public class OrderApprovalTypeCheckListener {
@EventListener(OrderApprovalTypeCheckEvent.class) @EventListener(OrderApprovalTypeCheckEvent.class)
public void orderApprovalTypeCheckEvent(OrderApprovalTypeCheckEvent event) { public void orderApprovalTypeCheckEvent(OrderApprovalTypeCheckEvent event) {
// 枚举配置中的互斥类型集合不能添加新值,这里需要重新定义新集合补充当前审批类型进行查询
List<Integer> typeList = null;
if (Objects.nonNull(event.getApprovalType())) {
OrderApprovalTypeEnum approvalTypeEnum = OrderApprovalTypeEnum.valueOf(event.getApprovalType()); OrderApprovalTypeEnum approvalTypeEnum = OrderApprovalTypeEnum.valueOf(event.getApprovalType());
if (Objects.isNull(approvalTypeEnum)){ if (Objects.isNull(approvalTypeEnum)) {
// 没有配置相关审批类型则不做校验 // 没有配置相关审批类型则不做校验
event.setResult(Boolean.FALSE); event.setResult(Boolean.FALSE);
return; return;
} }
List<Integer> types = approvalTypeEnum.getMutualExclusionValues(); List<Integer> types = approvalTypeEnum.getMutualExclusionValues();
if (Objects.isNull(types)){ if (Objects.isNull(types)) {
// 没有配置相关审批类型则不做校验 // 没有配置相关审批类型则不做校验
event.setResult(Boolean.FALSE); event.setResult(Boolean.FALSE);
return; return;
} }
// 枚举配置中的互斥类型集合不能添加新值,这里需要重新定义新集合补充当前审批类型进行查询
List<Integer> typeList = null;
// 包含-1则表示订单不能有任何审批状态存在,所以不用区分类型,查询所有的进行中审批 // 包含-1则表示订单不能有任何审批状态存在,所以不用区分类型,查询所有的进行中审批
if (!types.contains(-1)){ if (!types.contains(-1)) {
typeList = new ArrayList<>(types); typeList = new ArrayList<>(types);
typeList.add(event.getApprovalType()); typeList.add(event.getApprovalType());
} }
}else {
typeList = new ArrayList<>(event.getApprovalTypeList());
}
// 查询当前订单正在进行的审批 // 查询当前订单正在进行的审批
boolean result = orderApprovalService.countProcessingApproval(event.getOrderId(), event.getOrderItemIdList(), typeList); boolean result = orderApprovalService.countProcessingApproval(event.getOrderId(), event.getOrderItemIdList(), typeList);
// 入仓相关正在进行的审批业务查询 // 入仓相关正在进行的审批业务查询
......
...@@ -1808,7 +1808,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1808,7 +1808,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
return; return;
} }
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(vo.getOrderId(), null, ORDER_UPDATE.getValue(), false); OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(vo.getOrderId(), null, ORDER_UPDATE.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent); applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) { if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS); throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
...@@ -1868,7 +1868,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1868,7 +1868,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
this.updateOrderApply(updateReqVO, memberUserDO); this.updateOrderApply(updateReqVO, memberUserDO);
return; return;
} }
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(vo.getOrderId(), null, ORDER_UPDATE.getValue(), false); OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(vo.getOrderId(), null, ORDER_UPDATE.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent); applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) { if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS); throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
...@@ -5127,7 +5127,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -5127,7 +5127,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
throw exception(ORDER_APPROVAL_IS_NOT_EXISTS); throw exception(ORDER_APPROVAL_IS_NOT_EXISTS);
} }
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(specialApplyVO.getOrderId(), Objects.nonNull(specialApplyVO.getOrderItemId()) ? OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(specialApplyVO.getOrderId(), Objects.nonNull(specialApplyVO.getOrderItemId()) ?
Collections.singletonList(specialApplyVO.getOrderItemId()) : null, typeEnum.getValue(), false); Collections.singletonList(specialApplyVO.getOrderItemId()) : null, typeEnum.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent); applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) { if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS); throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
...@@ -5330,7 +5330,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -5330,7 +5330,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
throw exception(ORDER_APPROVAL_IS_NOT_EXISTS); throw exception(ORDER_APPROVAL_IS_NOT_EXISTS);
} }
List<Long> orderItemIdList = specialBatchApplyVO.getBatchApplyOrderItemDetailVOList().stream().map(OrderSpecialBatchApplyOrderItemDetailVO::getOrderItemId).filter(Objects::nonNull).collect(Collectors.toList()); List<Long> orderItemIdList = specialBatchApplyVO.getBatchApplyOrderItemDetailVOList().stream().map(OrderSpecialBatchApplyOrderItemDetailVO::getOrderItemId).filter(Objects::nonNull).collect(Collectors.toList());
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(specialBatchApplyVO.getOrderId(), orderItemIdList, typeEnum.getValue(), false); OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(specialBatchApplyVO.getOrderId(), orderItemIdList, typeEnum.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent); applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) { if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS); throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
......
...@@ -195,7 +195,7 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord ...@@ -195,7 +195,7 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
if (orderDO.getTransportId() == 4 && OrderStatusEnum.IN_WAREHOUSE.getValue().equals(orderDO.getStatus()) && orderDO.getAirShipment() > 2) { if (orderDO.getTransportId() == 4 && OrderStatusEnum.IN_WAREHOUSE.getValue().equals(orderDO.getStatus()) && orderDO.getAirShipment() > 2) {
throw exception(AIR_ORDER_IS_READY_STOCK_NOT_SPLIT); throw exception(AIR_ORDER_IS_READY_STOCK_NOT_SPLIT);
} }
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, ORDER_SPLIT.getValue(), false); OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, ORDER_SPLIT.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent); applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) { if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS); throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
......
...@@ -142,7 +142,7 @@ public class OrderWarehouseAdjustServiceImpl extends AbstractService<OrderWareho ...@@ -142,7 +142,7 @@ public class OrderWarehouseAdjustServiceImpl extends AbstractService<OrderWareho
} }
orderQueryService.throwPendingExceptionOrProcessingApproval(orderId); orderQueryService.throwPendingExceptionOrProcessingApproval(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, WAREHOUSE_ADJUST.getValue(), false); OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, WAREHOUSE_ADJUST.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent); applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) { if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS); throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
......
...@@ -4669,7 +4669,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements ...@@ -4669,7 +4669,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
.filter(t -> t.getAuditType() != 0) .filter(t -> t.getAuditType() != 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
for (OrderDO orderDO : orderDOList) { for (OrderDO orderDO : orderDOList) {
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, orderApprovalTypeEnum.getValue(), false); OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, orderApprovalTypeEnum.getValue(), null,false);
applicationContext.publishEvent(approvalTypeCheckEvent); applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) { if (approvalTypeCheckEvent.getResult()) {
orderNoList.add(orderDO.getOrderNo()); orderNoList.add(orderDO.getOrderNo());
......
package cn.iocoder.yudao.module.shipment.service.boxPreloadGoods; package cn.iocoder.yudao.module.shipment.service.boxPreloadGoods;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent;
import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collectors.CollectorsUtil; import cn.iocoder.yudao.framework.common.util.collectors.CollectorsUtil;
...@@ -72,6 +73,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -72,6 +73,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -87,6 +89,8 @@ import java.util.stream.Stream; ...@@ -87,6 +89,8 @@ import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_HAS_PROCESSING_APPROVAL; import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_HAS_PROCESSING_APPROVAL;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_IS_APPROVAL_IN_PROCESS;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.ORDER_UPDATE;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*;
/** /**
...@@ -122,7 +126,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM ...@@ -122,7 +126,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxLoadInfoService boxLoadInfoService; BoxLoadInfoService boxLoadInfoService;
@Resource @Resource
OrderService orderService; OrderService orderService;
@Resource
private ApplicationContext applicationContext;
@Resource @Resource
OrderQueryService orderQueryService; OrderQueryService orderQueryService;
@Resource @Resource
...@@ -190,7 +195,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM ...@@ -190,7 +195,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.eq(BoxPreloadGoodsDO::getIsRemove, 0) .eq(BoxPreloadGoodsDO::getIsRemove, 0)
); );
OrderDO orderDO = orderService.getById(orderId); OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(1,2,3,4,5,12,31,32) , false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
//如果都符合,下面展示互斥和关联订单的弹窗 //如果都符合,下面展示互斥和关联订单的弹窗
Integer relationStatus = createReqVO.getRelationStatus(); Integer relationStatus = createReqVO.getRelationStatus();
//校验是否是互斥订单 //校验是否是互斥订单
...@@ -424,7 +433,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM ...@@ -424,7 +433,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.eq(BoxPreloadGoodsDO::getIsRemove, 0) .eq(BoxPreloadGoodsDO::getIsRemove, 0)
); );
OrderDO orderDO = orderService.getById(orderId); OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(1,2,3,4,5,12,31,32) , false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
//校验是否符合预装。 //校验是否符合预装。
checkInstallAvailable(boxDO, secId, loadList, orderDO, orderItemIdList); checkInstallAvailable(boxDO, secId, loadList, orderDO, orderItemIdList);
...@@ -2254,6 +2267,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM ...@@ -2254,6 +2267,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
OrderConsigneeDO filterConsigneeDO = getFilterOrderConsigneeDO(boxDO, loadList); OrderConsigneeDO filterConsigneeDO = getFilterOrderConsigneeDO(boxDO, loadList);
OrderDO orderDO = orderService.getById(orderId); OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(1,2,3,4,5,12,31,32) , false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
if(filterConsigneeDO != null) { if(filterConsigneeDO != null) {
//校验收货人是否是同一个人 //校验收货人是否是同一个人
OrderConsigneeDO consigneeDO = boxService.getOrderConsignee(orderDO); OrderConsigneeDO consigneeDO = boxService.getOrderConsignee(orderDO);
......
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