Commit ffcf4d52 authored by liuzeheng's avatar liuzeheng

报价结果赢单时,再次判断业绩归属

parent 54164d5c
...@@ -6017,4 +6017,12 @@ public interface OrderMapper extends AbstractMapper<OrderDO> { ...@@ -6017,4 +6017,12 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
@Param("calVvalue") BigDecimal calVvalue, @Param("calVvalue") BigDecimal calVvalue,
@Param("yejiCreateDate") Date yejiCreateDate); @Param("yejiCreateDate") Date yejiCreateDate);
/**
* 报价结果赢单时,同步业绩归属
* @param customerId
* @param salesmanId
* @param orderId
*/
@Update("update ecw_order set customer_id=#{customerId},salesman_id=#{salesmanId} where order_id = #{orderId}")
void updateOrderCustomerAndSalesmanId(@Param("customerId")Long customerId,@Param("salesmanId") Long salesmanId,@Param("orderId") Long orderId);
} }
...@@ -259,7 +259,12 @@ public interface OrderService extends IService<OrderDO> { ...@@ -259,7 +259,12 @@ public interface OrderService extends IService<OrderDO> {
*/ */
void addOrderOtherFee(Long orderId, List<FeeDto> feeDtoList); void addOrderOtherFee(Long orderId, List<FeeDto> feeDtoList);
/**
*设置订单业绩归属
* @param orderDO
* @param offerId
*/
void checkOrderSalesman(OrderDO orderDO, Long offerId) ;
/** /**
* 更新订单提单号 * 更新订单提单号
* *
...@@ -370,4 +375,5 @@ public interface OrderService extends IService<OrderDO> { ...@@ -370,4 +375,5 @@ public interface OrderService extends IService<OrderDO> {
yejiCreateDate); yejiCreateDate);
void updateOrderCustomerAndSalesmanId(Long customerId, Long salesmanId, Long orderId);
} }
...@@ -172,14 +172,6 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -172,14 +172,6 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//customerId = info.getConsignorVO().getCustomerId(); //二期需求修改 //customerId = info.getConsignorVO().getCustomerId(); //二期需求修改
customerId = consignorDO.getId(); customerId = consignorDO.getId();
} else { } else {
// if (info.getIsCargoControl()) {//非海外控货归属发货人
// customerId = info.getConsignorVO().getCustomerId();
// } else {
// if (info.getDrawee() == 1) {//非海外非控货 付款人为发货人 归属发货人
// customerId = info.getConsignorVO().getCustomerId();
// } else { //非海外非控货 付款人为其他 归属收货人
// customerId = info.getConsigneeVO().getCustomerId();
// }
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, info.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1")); OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, info.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, info.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1")); OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, info.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
...@@ -201,7 +193,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -201,7 +193,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
customerId = consignorDO.getId(); customerId = consignorDO.getId();
}else{ }else{
customerId = consignorDO.getId(); customerId = orderConsigneeDO.getCustomerId() ;
} }
} else if (info.getDrawee() == 2 ) {//收货人付款 层级5 第一个 } else if (info.getDrawee() == 2 ) {//收货人付款 层级5 第一个
customerId = orderConsigneeDO.getCustomerId()!=null? orderConsigneeDO.getCustomerId():consigneeDO.getId(); customerId = orderConsigneeDO.getCustomerId()!=null? orderConsigneeDO.getCustomerId():consigneeDO.getId();
...@@ -227,24 +219,27 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -227,24 +219,27 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
}else if (consignorDO.getDefaultPay() && ( info.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人 }else if (consignorDO.getDefaultPay() && ( info.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
customerId = orderConsignorDO.getCustomerId() ; customerId = orderConsignorDO.getCustomerId() ;
}else if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人 }else {
customerId = orderConsigneeDO.getCustomerId() ; customerId = orderConsigneeDO.getCustomerId() ;
} }
// if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
// customerId = orderConsigneeDO.getCustomerId() ;
//
// }
} }
} else { } else {
//业绩归属公司 //业绩归属收货人
return; if(orderConsigneeDO!=null){
customerId = orderConsigneeDO.getCustomerId() !=null?orderConsigneeDO.getCustomerId():0;
}
} }
} }
} }
// }
} }
TargetLogDO targetLogDO = new TargetLogDO(); TargetLogDO targetLogDO = new TargetLogDO();
targetLogDO.setOrderId(orderId); targetLogDO.setOrderId(orderId);
......
...@@ -893,6 +893,11 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl ...@@ -893,6 +893,11 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
if (Objects.nonNull(offer)){ if (Objects.nonNull(offer)){
throw exception(ORDER_BOUND_OFFER); throw exception(ORDER_BOUND_OFFER);
} }
//如果订单关联上报价单
if(orderDO!=null && offer.getOfferId()!=null){
this.checkOrderSalesman(orderDO,offer.getOfferId()) ;
}
} else { } else {
orderDO = this.generateOrder(offerDO, offerResultVO); orderDO = this.generateOrder(offerDO, offerResultVO);
if (Objects.isNull(orderDO)) { if (Objects.isNull(orderDO)) {
...@@ -916,6 +921,16 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl ...@@ -916,6 +921,16 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
return offerDO.getOrderId(); return offerDO.getOrderId();
} }
/**
* 赢单处理报价单时,再次判断业绩归属
* @param orderDO
* @param offerId
*/
private void checkOrderSalesman(OrderDO orderDO, Long offerId) {
orderService.checkOrderSalesman(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) {
OfferTransportDO offerTransportDO = offerTransportMapper.selectOne(new LambdaQueryWrapper<OfferTransportDO>().eq(OfferTransportDO::getOfferId, offerDO.getOfferId()).last("limit 1")); OfferTransportDO offerTransportDO = offerTransportMapper.selectOne(new LambdaQueryWrapper<OfferTransportDO>().eq(OfferTransportDO::getOfferId, offerDO.getOfferId()).last("limit 1"));
List<OfferProdDO> prodDOList = offerProdMapper.selectList(new LambdaQueryWrapper<OfferProdDO>().eq(OfferProdDO::getOfferId, offerDO.getOfferId())); List<OfferProdDO> prodDOList = offerProdMapper.selectList(new LambdaQueryWrapper<OfferProdDO>().eq(OfferProdDO::getOfferId, offerDO.getOfferId()));
......
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