Commit e3b97634 authored by Smile's avatar Smile

bug338 报价单-结果-关联订单没有更新业绩

parent 4cb58194
...@@ -287,6 +287,13 @@ public interface OrderService extends IService<OrderDO> { ...@@ -287,6 +287,13 @@ public interface OrderService extends IService<OrderDO> {
* @param offerId * @param offerId
*/ */
int checkOrderSalesman(OrderDO order, Long offerId, CustomerDO consignorDO, CustomerDO consigneeDO, OrderConsignorDO orderConsignorDO, OrderConsigneeDO orderConsigneeDO) ; int checkOrderSalesman(OrderDO order, Long offerId, CustomerDO consignorDO, CustomerDO consigneeDO, OrderConsignorDO orderConsignorDO, OrderConsigneeDO orderConsigneeDO) ;
/**
*关联报价单设置订单业绩归属
* @param order
* @param offerId
*/
void offerUpdateOrderSalesman(OrderDO order, Long offerId);
/** /**
* 更新订单提单号 * 更新订单提单号
* *
......
...@@ -1108,6 +1108,31 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1108,6 +1108,31 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
return customerType; return customerType;
} }
@Override
public void offerUpdateOrderSalesman(OrderDO orderDO, Long offerId) {
int customerType = checkOrderSalesman(orderDO, offerId, null, null, null, null);
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
if (Objects.equals(orderDO.getStatus(), DRAFT.getValue())
|| Objects.equals(orderDO.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) || Objects.equals(orderDO.getStatus(), OrderStatusEnum.WAREHOUSING.getValue())) {
//重算所属客户经理
addOrderCustomerService(orderDO,orderConsignorDO,customerType);
updateOrderCustomerAndSalesmanId(orderDO.getCustomerId() != null ? orderDO.getCustomerId() : 0, orderDO.getSalesmanId() != null ? orderDO.getSalesmanId() : 0, orderDO.getOrderId());
}else{
OrderWarehouseInDO warehouseInDO = orderWarehouseInMapper.selectOne(new LambdaQueryWrapper<OrderWarehouseInDO>()
.eq(OrderWarehouseInDO::getOrderId, orderDO.getOrderId())
.orderByAsc(OrderWarehouseInDO::getInTime).last("limit 1"));
if (Objects.isNull(warehouseInDO)) {
throw exception(ORDER_NOT_WAREHOUSE_IN);
}
Date expireTime = DateUtil.offsetDay(warehouseInDO.getInTime(), 3);
if (expireTime.compareTo(new Date()) >= 0) {
//重算所属客户经理
addOrderCustomerService(orderDO,orderConsignorDO,customerType);
updateOrderCustomerAndSalesmanId(orderDO.getCustomerId() != null ? orderDO.getCustomerId() : 0, orderDO.getSalesmanId() != null ? orderDO.getSalesmanId() : 0, orderDO.getOrderId());
}
}
}
private void addOrderCustomerService(OrderDO order,OrderConsignorDO orderConsignorDO, private void addOrderCustomerService(OrderDO order,OrderConsignorDO orderConsignorDO,
int customerType) { int customerType) {
......
...@@ -985,8 +985,7 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl ...@@ -985,8 +985,7 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
* @param offerId * @param offerId
*/ */
private void checkOrderSalesman(OrderDO orderDO, Long offerId) { private void checkOrderSalesman(OrderDO orderDO, Long offerId) {
orderService.checkOrderSalesman(orderDO, offerId, null, null, null, null); orderService.offerUpdateOrderSalesman(orderDO, offerId);
orderService.updateOrderCustomerAndSalesmanId(orderDO.getCustomerId() != null ? orderDO.getCustomerId() : 0, orderDO.getSalesmanId() != null ? orderDO.getSalesmanId() : 0, orderDO.getOrderId());
} }
private OrderDO generateOrder(OfferDO offerDO, OfferResultVO offerResultVO) { private OrderDO generateOrder(OfferDO offerDO, OfferResultVO offerResultVO) {
......
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