Commit 393fc04c authored by liuzeheng's avatar liuzeheng

业绩判断

parent 00d1abe9
...@@ -588,18 +588,18 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -588,18 +588,18 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 海外仓归属发货人 // 海外仓归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
} else { } else {
if (order.getIsCargoControl()) { // if (order.getIsCargoControl()) {
// 控货订单归属发货人 // // 控货订单归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()); // order.setCustomerId(orderConsignorDO.getCustomerId());
} else { // } else {
// 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人 // // 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人
if (order.getDrawee() == 1) { // if (order.getDrawee() == 1) {
order.setCustomerId(orderConsignorDO.getCustomerId()); // order.setCustomerId(orderConsignorDO.getCustomerId());
} else { // } else {
customerType = 2; // customerType = 2;
order.setCustomerId(orderConsigneeDO.getCustomerId()); // order.setCustomerId(orderConsigneeDO.getCustomerId());
} // }
} // }
// 补充业绩规则判断 // 补充业绩规则判断
if(!consignorCustomerDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 if(!consignorCustomerDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
...@@ -873,18 +873,18 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -873,18 +873,18 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 海外仓归属发货人 // 海外仓归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
} else { } else {
if (order.getIsCargoControl()) { // if (order.getIsCargoControl()) {
// 控货订单归属发货人 // // 控货订单归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()); // order.setCustomerId(orderConsignorDO.getCustomerId());
} else { // } else {
// 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人 // // 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人
if (order.getDrawee() == 1) { // if (order.getDrawee() == 1) {
order.setCustomerId(orderConsignorDO.getCustomerId()); // order.setCustomerId(orderConsignorDO.getCustomerId());
} else { // } else {
customerType = 2; // customerType = 2;
order.setCustomerId(orderConsigneeDO.getCustomerId()); // order.setCustomerId(orderConsigneeDO.getCustomerId());
} // }
} // }
// 补充业绩规则判断 // 补充业绩规则判断
if(!consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 if(!consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
...@@ -926,7 +926,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -926,7 +926,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} else { } else {
//业绩归属公司 //业绩归属公司
order.setCustomerId(0L) ;
order.setSalesmanId(0L); order.setSalesmanId(0L);
} }
//end //end
...@@ -951,77 +950,84 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -951,77 +950,84 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1")); OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
CustomerDO consignorDO = customerService.getCustomer(orderConsignorDO.getCustomerId()); CustomerDO consignorDO = customerService.getCustomer(orderConsignorDO.getCustomerId());
CustomerDO consigneeDO = customerService.getCustomer(orderConsigneeDO.getCustomerId());//收货人 CustomerDO consigneeDO = customerService.getCustomer(orderConsigneeDO.getCustomerId());//收货人
if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {
if(consignorDO!=null){ // 海外仓归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0) ;
} } else{
if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if(consignorDO!=null){
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}
} }
List<TargetOfferBackVO> offerBackVOList =targetLogMapper.getTargetOfferBackByOrerId(order.getOrderId()) ; List<TargetOfferBackVO> offerBackVOList =targetLogMapper.getTargetOfferBackByOrerId(order.getOrderId()) ;
if (order.getDrawee() == 1) {//发货人付款 if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && CollectionUtil.isNotEmpty(offerBackVOList)) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个 if (order.getDrawee() == 1 && CollectionUtil.isNotEmpty(offerBackVOList)) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个 }else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getCustomerService());
} }
} else if (order.getDrawee() == 2 && CollectionUtil.isEmpty(offerBackVOList) && !consignorDO.getDefaultPay()) {//收货人付款 层级5 第一个 } else if (order.getDrawee() == 2 && CollectionUtil.isEmpty(offerBackVOList) && !consignorDO.getDefaultPay()) {//收货人付款 层级5 第一个
if(consigneeDO!=null){ if(consigneeDO!=null){
order.setCustomerId(orderConsigneeDO.getCustomerId()); order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService()); order.setSalesmanId(consigneeDO.getCustomerService());
}else{ }else{
order.setSalesmanId(0L); order.setSalesmanId(0L);
} }
} else if (order.getDrawee() == 3) { //自定义付款 } else if (order.getDrawee() == 3) { //自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class); List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
if(CollectionUtil.isNotEmpty(list)){ if(CollectionUtil.isNotEmpty(list)){
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList()); List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList()); List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ;//运费 int freight = freightList.get(0).getValue() ;//运费
int clearanceFee = clearanceFeeList.get(0).getValue();//清关费 int clearanceFee = clearanceFeeList.get(0).getValue();//清关费
if(CollectionUtil.isNotEmpty(offerBackVOList) && ( order.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费 if(CollectionUtil.isNotEmpty(offerBackVOList) && ( order.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getCustomerService());
}else if(CollectionUtil.isNotEmpty(offerBackVOList) && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费 }else if(CollectionUtil.isNotEmpty(offerBackVOList) && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getCustomerService());
}else if(consignorDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人 }else if(consignorDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getCustomerService());
}else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人 }else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getCustomerService());
}else if(!consignorDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人 }else if(!consignorDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
if(consigneeDO!=null){
order.setCustomerId(orderConsigneeDO.getCustomerId()); order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService()); if(consigneeDO!=null){
}else{ order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService());
}else{
order.setSalesmanId(0L); order.setSalesmanId(0L);
} }
} }
} }
} else { } else {
//业绩归属公司 //业绩归属公司
order.setSalesmanId(0L); order.setSalesmanId(0L);
}
} }
} }
private void addOrderCustomerService(OrderDO order, int customerType) { private void addOrderCustomerService(OrderDO order, int 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