Commit ce5a6042 authored by liuzeheng's avatar liuzeheng

Merge branch 'master' into dev

# Conflicts:
#	yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/order/impl/OrderServiceImpl.java
parents c4dd5f4c 33d47289
......@@ -2921,7 +2921,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"SELECT",
"s.order_no as value",
"FROM",
" ( SELECT t.order_no FROM ecw_order t GROUP BY t.order_no ) s",
" ( SELECT t.order_no FROM ecw_order t where deleted =0 GROUP BY t.order_no ) s",
"WHERE",
"s.order_no LIKE concat('%',#{keyValue},'%')",
"</script>"
......@@ -2934,7 +2934,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"SELECT",
"s.tidan_no as value",
"FROM",
" ( SELECT t.tidan_no FROM ecw_order t GROUP BY t.`tidan_no` ) s",
" ( SELECT t.tidan_no FROM ecw_order t WHERE deleted =0 GROUP BY t.`tidan_no` ) s",
"WHERE",
"s.tidan_no LIKE concat('%',#{keyValue},'%')",
"</script>"
......@@ -6017,4 +6017,12 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
@Param("calVvalue") BigDecimal calVvalue,
@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);
}
package cn.iocoder.yudao.module.order.service.order;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigneeDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignor.OrderConsignorDO;
import cn.iocoder.yudao.module.order.dto.OrderBackInfoDto;
import cn.iocoder.yudao.module.order.vo.approval.OrderSpecialApplyVO;
import cn.iocoder.yudao.module.order.vo.approval.OrderSpecialBatchApplyVO;
......@@ -259,7 +262,12 @@ public interface OrderService extends IService<OrderDO> {
*/
void addOrderOtherFee(Long orderId, List<FeeDto> feeDtoList);
/**
*设置订单业绩归属
* @param order
* @param offerId
*/
int checkOrderSalesman(OrderDO order, Long offerId, CustomerDO consignorDO, CustomerDO consigneeDO, OrderConsignorDO orderConsignorDO, OrderConsigneeDO orderConsigneeDO) ;
/**
* 更新订单提单号
*
......@@ -370,4 +378,5 @@ public interface OrderService extends IService<OrderDO> {
yejiCreateDate);
void updateOrderCustomerAndSalesmanId(Long customerId, Long salesmanId, Long orderId);
}
......@@ -172,14 +172,6 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//customerId = info.getConsignorVO().getCustomerId(); //二期需求修改
customerId = consignorDO.getId();
} 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"));
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
customerId = consignorDO.getId();
}else{
customerId = consignorDO.getId();
customerId = orderConsigneeDO.getCustomerId() ;
}
} else if (info.getDrawee() == 2 ) {//收货人付款 层级5 第一个
customerId = orderConsigneeDO.getCustomerId()!=null? orderConsigneeDO.getCustomerId():consigneeDO.getId();
......@@ -227,24 +219,27 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
}else if (consignorDO.getDefaultPay() && ( info.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
customerId = orderConsignorDO.getCustomerId() ;
}else if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
}else {
customerId = orderConsigneeDO.getCustomerId() ;
}
// if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
// customerId = orderConsigneeDO.getCustomerId() ;
//
// }
}
} else {
//业绩归属公司
return;
//业绩归属收货人
if(orderConsigneeDO!=null){
customerId = orderConsigneeDO.getCustomerId() !=null?orderConsigneeDO.getCustomerId():0;
}
}
}
}
// }
}
TargetLogDO targetLogDO = new TargetLogDO();
targetLogDO.setOrderId(orderId);
......
......@@ -893,6 +893,11 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
if (Objects.nonNull(offer)){
throw exception(ORDER_BOUND_OFFER);
}
//如果订单关联上报价单
if(orderDO!=null && offerDO.getOfferId()!=null){
this.checkOrderSalesman(orderDO,offerDO.getOfferId()) ;
}
} else {
orderDO = this.generateOrder(offerDO, offerResultVO);
if (Objects.isNull(orderDO)) {
......@@ -916,6 +921,16 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
return offerDO.getOrderId();
}
/**
* 赢单处理报价单时,再次判断业绩归属
* @param orderDO
* @param offerId
*/
private void checkOrderSalesman(OrderDO orderDO, Long offerId) {
orderService.checkOrderSalesman(orderDO,offerId,null,null,null,null);
orderService.updateOrderCustomerAndSalesmanId(orderDO.getCustomerId()!=null?orderDO.getCustomerId():0,orderDO.getSalesmanId()!=null?orderDO.getSalesmanId():0,orderDO.getOrderId()) ;
}
private OrderDO generateOrder(OfferDO offerDO, OfferResultVO offerResultVO) {
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()));
......
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