Commit 234b45b7 authored by Smile's avatar Smile

创建订单,订单的发货人或收货人,无归属客户经理/无在途的待接收流程(包括分配、移交),客户自动迁移到待分配客户列表

parent 4b3fe376
......@@ -27,6 +27,7 @@ import cn.iocoder.yudao.module.bpm.resp.TaskResp;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerOperateLog.CustomerOperateLogDO;
import cn.iocoder.yudao.module.customer.dal.mysql.customer.CustomerMapper;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService;
import cn.iocoder.yudao.module.customer.service.customerCreditLog.CustomerCreditLogService;
......@@ -197,7 +198,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
private final UnitApi unitApi;
private final OrderOperateLogService orderOperateLogService;
private TargetLogMapper targetLogMapper;
private final CustomerMapper customerMapper;
/*
后台创建订单 memberUserDO 信息为空
......@@ -721,7 +722,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
int customerType = this.checkOrderSalesman(order, createReqVO.getOfferId(), null, null, orderConsignorDO, orderConsigneeDO);
// 更新所属客户经理(业务员)
if (!DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getIsChargeCustomer()) && order.getIsChargeCustomer()) {
addOrderCustomerService(order, customerType);
addOrderCustomerService(order,orderConsignorDO,customerType);
}
}
......@@ -982,7 +983,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeDO);
// 更新所属客户经理(业务员)
if (!DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getIsChargeCustomer()) && order.getIsChargeCustomer()) {
addOrderCustomerService(order, customerType);
addOrderCustomerService(order,orderConsignorDO,customerType);
}
}
}
......@@ -1092,7 +1093,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
return customerType;
}
private void addOrderCustomerService(OrderDO order,
private void addOrderCustomerService(OrderDO order,OrderConsignorDO orderConsignorDO,
int customerType) {
if (Objects.nonNull(order.getParentOrderId()) &&
......@@ -1174,6 +1175,36 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setSalesmanId(0L);
order.setDeptId(0L);
log.info("订单下单,业绩为收货人,不产生未分配客户经理异常 orderNo={}", order.getOrderNo());
// 当后台创建订单,订单的发货人或收货人,无归属客户经理/无在途的待接收流程(包括分配、移交),客户自动迁移到待分配客户列表
if(order.getUserId()!=null){
if(customerDO.getIsInOpenSea()){
customerDO.setIsInOpenSea(false);
customerDO.setCustomerService(null);
customerDO.setIsCustomerServiceConfirmed(false);
customerMapper.updateById(customerDO);
}
Long customerId = orderConsignorDO.getCustomerId();
if (customerId!=null){
CustomerDO orderConsignorCustomerDO = customerMapper.selectById(customerId);
if(orderConsignorCustomerDO.getIsInOpenSea()){
orderConsignorCustomerDO.setIsInOpenSea(false);
orderConsignorCustomerDO.setCustomerService(null);
orderConsignorCustomerDO.setIsCustomerServiceConfirmed(false);
customerMapper.updateById(orderConsignorCustomerDO);
}
}
}else {
Long customerId = orderConsignorDO.getCustomerId();
if (customerId!=null) {
CustomerDO orderConsignorCustomerDO = customerMapper.selectById(customerId);
if (orderConsignorCustomerDO.getIsInOpenSea()) {
orderConsignorCustomerDO.setIsInOpenSea(false);
orderConsignorCustomerDO.setCustomerService(null);
orderConsignorCustomerDO.setIsCustomerServiceConfirmed(false);
customerMapper.updateById(orderConsignorCustomerDO);
}
}
}
} else {
// 该订单存在该客户未分配客户经理异常,或者该客户的客户经理待接收,
// 则不再生成未分配客户经理异常,且该订单不产生业绩归属
......@@ -3343,7 +3374,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (!DRAFT.getValue().equals(updateObj.getStatus())
&& ((Objects.nonNull(updateObj.getIsChargeCustomer()) && updateObj.getIsChargeCustomer())
|| (Objects.nonNull(updateObj.getIsChargeDraft()) && updateObj.getIsChargeDraft()))) {
addOrderCustomerService(updateObj, customerType);
addOrderCustomerService(updateObj, orderConsignorDO,customerType);
}
}
}
......@@ -3611,7 +3642,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (!DRAFT.getValue().equals(updateObj.getStatus())
&& ((Objects.nonNull(updateObj.getIsChargeCustomer()) && updateObj.getIsChargeCustomer())
|| (Objects.nonNull(updateObj.getIsChargeDraft()) && updateObj.getIsChargeDraft()))) {
addOrderCustomerService(updateObj, customerType);
addOrderCustomerService(updateObj,orderConsignorDO,customerType);
}
}
}
......
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