Commit 1d7bf23c authored by zhengyi's avatar zhengyi

预装校验逻辑修改补充

parent 9173c71f
......@@ -430,4 +430,5 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_NOT_IS_OVERSEAS_WAREHOUSE_ORDER = new ErrorCode(1004001170, "order.not.is.overseas.warehouse.order");
ErrorCode ORDER_APPROVAL_IS_NOT_EXISTS = new ErrorCode(1004001171, "order.approval.is.not.exists");
ErrorCode FEE_APPLICATION_NOT_IS_ZERO = new ErrorCode(1004001172, "fee.application.not.is.zero");
ErrorCode GUAN_LIAN_ORDER_IS_APPROVAL_IN_PROCESS = new ErrorCode(1004001173, "guan.lian.order.is.approval.in.process");
}
package cn.iocoder.yudao.module.shipment.service.boxPreloadGoods;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -30,6 +31,7 @@ import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.enums.OrderStatusEnum;
import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.service.orderException.OrderExceptionService;
import cn.iocoder.yudao.module.order.vo.order.GuanLianOrderStatusVO;
import cn.iocoder.yudao.module.order.vo.order.OrderPreloadReq;
import cn.iocoder.yudao.module.order.vo.order.OrderPreloadVO;
import cn.iocoder.yudao.module.order.vo.orderGuanlian.OrderTree;
......@@ -68,6 +70,7 @@ import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataExpo
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.base.Joiner;
......@@ -88,8 +91,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
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_IS_APPROVAL_IN_PROCESS;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.ORDER_UPDATE;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*;
......@@ -200,6 +202,24 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
// 2024-11-5 注意:此处要关注关联订单,关联订单也是一并修改成不受费用申请和特价影响
if (StringUtils.isNotBlank(orderDO.getGuanLianOrderStatus())){
List<GuanLianOrderStatusVO> guanLianOrderStatusVOList = JSONObject.parseArray(orderDO.getGuanLianOrderStatus(), GuanLianOrderStatusVO.class);
if (CollectionUtil.isNotEmpty(guanLianOrderStatusVOList) && guanLianOrderStatusVOList.size() > 0){
List<GuanLianOrderStatusVO> approvalGuanLianOrderList = guanLianOrderStatusVOList.stream().filter(vo -> vo.getType() == 2).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(approvalGuanLianOrderList)){
String orderNoStr = approvalGuanLianOrderList.stream().filter(o -> {
OrderApprovalTypeCheckEvent guanLianApprovalTypeCheckEvent = new OrderApprovalTypeCheckEvent(o.getOrderId(), null, null, Arrays.asList(1,2,3,4,5,12,31,32) , false);
applicationContext.publishEvent(guanLianApprovalTypeCheckEvent);
return guanLianApprovalTypeCheckEvent.getResult();
}).map(GuanLianOrderStatusVO::getOrderNo).collect(Collectors.joining(StrUtil.COMMA));
if (StringUtils.isNotBlank(orderNoStr)){
throw exception(GUAN_LIAN_ORDER_IS_APPROVAL_IN_PROCESS, orderNoStr);
}
}
}
}
//如果都符合,下面展示互斥和关联订单的弹窗
Integer relationStatus = createReqVO.getRelationStatus();
//校验是否是互斥订单
......@@ -257,9 +277,9 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.filter(t -> t.getAbnormalState() != 0)
.collect(Collectors.toList());
List<OrderDO> auditList = orderList.stream()
.filter(t -> t.getAuditType() != 0)
.collect(Collectors.toList());
// List<OrderDO> auditList = orderList.stream()
// .filter(t -> t.getAuditType() != 0)
// .collect(Collectors.toList());
boolean isSuit = true;
if (CollectionUtil.isNotEmpty(notMatchStatusList)) {
......@@ -286,17 +306,17 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
sb.append("订单:").append(orderNos).append("存在异常");
}
if (CollectionUtil.isNotEmpty(auditList)) {
isSuit = false;
if (hasRelationOrder) {
sb.append("<br>");
}
List<String> orderNoList = auditList.stream()
.map(OrderDO::getOrderNo)
.collect(Collectors.toList());
String orderNos = Joiner.on(",").join(orderNoList);
sb.append("订单:").append(orderNos).append("审核中");
}
// if (CollectionUtil.isNotEmpty(auditList)) {
// isSuit = false;
// if (hasRelationOrder) {
// sb.append("<br>");
// }
// List<String> orderNoList = auditList.stream()
// .map(OrderDO::getOrderNo)
// .collect(Collectors.toList());
// String orderNos = Joiner.on(",").join(orderNoList);
// sb.append("订单:").append(orderNos).append("审核中");
// }
if (!isSuit) {
throw new ServiceException(500, sb.toString());
......@@ -433,11 +453,6 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.eq(BoxPreloadGoodsDO::getIsRemove, 0)
);
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);
......@@ -767,10 +782,28 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
OrderDO orderDO,
List<Long> orderItemIdList) {
//订单校验是否在审核中
Integer auditType = orderDO.getAuditType();
if (auditType != 0) {
throw exception(ORDER_HAS_PROCESSING_APPROVAL, orderDO.getOrderNo());
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);
}
// 2024-11-5 注意:此处要关注关联订单,关联订单也是一并修改成不受费用申请和特价影响
// if (StringUtils.isNotBlank(orderDO.getGuanLianOrderStatus())){
// List<GuanLianOrderStatusVO> guanLianOrderStatusVOList = JSONObject.parseArray(orderDO.getGuanLianOrderStatus(), GuanLianOrderStatusVO.class);
// if (CollectionUtil.isNotEmpty(guanLianOrderStatusVOList) && guanLianOrderStatusVOList.size() > 0){
// List<GuanLianOrderStatusVO> approvalGuanLianOrderList = guanLianOrderStatusVOList.stream().filter(vo -> vo.getType() == 2).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(approvalGuanLianOrderList)){
// String orderNoStr = approvalGuanLianOrderList.stream().filter(o -> {
// OrderApprovalTypeCheckEvent guanLianApprovalTypeCheckEvent = new OrderApprovalTypeCheckEvent(o.getOrderId(), null, null, Arrays.asList(1,2,3,4,5,12,31,32) , false);
// applicationContext.publishEvent(guanLianApprovalTypeCheckEvent);
// return guanLianApprovalTypeCheckEvent.getResult();
// }).map(GuanLianOrderStatusVO::getOrderNo).collect(Collectors.joining(StrUtil.COMMA));
// if (StringUtils.isNotBlank(orderNoStr)){
// throw exception(GUAN_LIAN_ORDER_IS_APPROVAL_IN_PROCESS, orderNoStr);
// }
// }
// }
// }
checkInstallItem(loadList, orderItemIdList, Collections.singletonList(orderDO));
......
......@@ -308,3 +308,4 @@ currency.id.not.null=
order.approval.is.not.exists=
fee.application.not.is.zero=
guan.lian.order.is.approval.in.process=
\ No newline at end of file
......@@ -1122,3 +1122,4 @@ currency.id.not.null=The country ID cannot be empty
order.approval.is.not.exists=Order approval type does not exist
fee.application.not.is.zero=The expense application amount is not 0, and cannot be directly deleted
guan.lian.order.is.approval.in.process=Related order [{}] has approval in progress
\ No newline at end of file
......@@ -1122,3 +1122,4 @@ currency.id.not.null=\u56fd\u5bb6id\u4e0d\u80fd\u4e3a\u7a7a
order.approval.is.not.exists=\u8ba2\u5355\u5ba1\u6279\u7c7b\u578b\u4e0d\u5b58\u5728
fee.application.not.is.zero=\u8d39\u7528\u7533\u8bf7\u91d1\u989d\u4e0d\u4e3a0\uff0c\u4e0d\u80fd\u8fdb\u884c\u76f4\u63a5\u5220\u9664
guan.lian.order.is.approval.in.process=\u5173\u8054\u8ba2\u5355\u3010{}\u3011\u6709\u5ba1\u6279\u6b63\u5728\u8fdb\u884c\u4e2d
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