Commit 33d47289 authored by liuzeheng's avatar liuzeheng

优化

parent 2e2a73ee
...@@ -267,7 +267,7 @@ public interface OrderService extends IService<OrderDO> { ...@@ -267,7 +267,7 @@ public interface OrderService extends IService<OrderDO> {
* @param order * @param order
* @param offerId * @param offerId
*/ */
void 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) ;
/** /**
* 更新订单提单号 * 更新订单提单号
* *
......
...@@ -583,8 +583,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -583,8 +583,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
orderConsigneeService.save(orderConsigneeDO); orderConsigneeService.save(orderConsigneeDO);
if (!Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
int customerType = 1; // 发货人 1 收货人 2 //customerType 发货人-1 收货人 2
this.checkOrderSalesman(order,createReqVO.getOfferId(),null,null,orderConsignorDO,orderConsigneeDO); int customerType= this.checkOrderSalesman(order,createReqVO.getOfferId(),null,null,orderConsignorDO,orderConsigneeDO);
// if (Objects.nonNull(order.getType()) && order.getType().contains("2")) { // if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {
// // 海外仓归属发货人 // // 海外仓归属发货人
// order.setCustomerId(orderConsignorDO.getCustomerId()); // order.setCustomerId(orderConsignorDO.getCustomerId());
...@@ -880,87 +880,9 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -880,87 +880,9 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeService.save(orderConsigneeDO); orderConsigneeService.save(orderConsigneeDO);
} }
if (!Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
int customerType = 1; // 发货人 1 收货人 2 // 发货人 1 收货人 2
this.checkOrderSalesman(order,createReqVO.getOfferId(),null,null,orderConsignorDO,orderConsigneeDO); int customerType = this.checkOrderSalesman(order,createReqVO.getOfferId(),null,null,orderConsignorDO,orderConsigneeDO);
// if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {
// // 海外仓归属发货人
// order.setCustomerId(orderConsignorDO.getCustomerId());
// } else {
//// if (order.getIsCargoControl()) {
//// // 控货订单归属发货人
//// order.setCustomerId(orderConsignorDO.getCustomerId());
//// } else {
// // 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人
//// if (order.getDrawee() == 1) {
//// order.setCustomerId(orderConsignorDO.getCustomerId());
//// } else {
//// customerType = 2;
//// order.setCustomerId(orderConsigneeDO.getCustomerId());
//// }
//
// // 补充业绩规则判断
// if(!consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else{
// if (order.getDrawee() == 1) {//发货人付款
// if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else{
// order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
// order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
//// order.setCustomerId(0L) ;
//// order.setSalesmanId(0L);
// }
// } else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
// order.setCustomerId(orderConsigneeDO.getCustomerId()) ;
// } else if (order.getDrawee() == 3) { //自定义付款
//
// List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
// if(CollectionUtil.isNotEmpty(list)){
//
// 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());
// int freight = freightList.get(0).getValue() ;//运费
// int clearanceFee = clearanceFeeList.get(0).getValue();//清关费
//
// if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else if(consignorDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else {
// order.setCustomerId(orderConsigneeDO.getCustomerId());
// }
//
//// if(!consignorDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
//// order.setCustomerId(orderConsigneeDO.getCustomerId());
////
////
//// }
//
// }
//
// } else {
// //业绩归属公司
// order.setCustomerId(orderConsigneeDO.getCustomerId());
// }
// //end
// }
// //}
//
//
//
//
//
//
//
//
// }
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) { if (Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) {
//addOrderCustomerService(order, customerType); //addOrderCustomerService(order, customerType);
...@@ -1088,35 +1010,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1088,35 +1010,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
}else{ }else{
// else{
// List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
// if(CollectionUtil.isNotEmpty(list)){
// 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());
// int freight = freightList.get(0).getValue() ;//运费
// int clearanceFee = clearanceFeeList.get(0).getValue();//清关费
// if((createReqVO.getOfferId()!=null && order.getDrawee() == 1) || (createReqVO.getOfferId()!=null && freight==1) || (createReqVO.getOfferId()!=null && clearanceFee==1)){//层级3
// order.setCustomerId(orderConsignorDO.getCustomerId());
// order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
// }else{
// if( (consignorDO.getDefaultPay() && order.getDrawee() == 2 ) || (consignorDO.getDefaultPay() && freight==1 ) || (consignorDO.getDefaultPay() && clearanceFee==1 )){//层级4
// order.setCustomerId(orderConsignorDO.getCustomerId());
// order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
// }else{
// if(order.getDrawee() == 2 || (order.getDrawee() == 3 && freight==2) || (order.getDrawee() == 3 && clearanceFee==2)){//层级5
// order.setCustomerId(orderConsigneeDO.getCustomerId());
// order.setSalesmanId(consigneeDO.getCustomerService());
// }else{
// order.setSalesmanId(0L); //层级6
// }
// }
// }
// }
//
// }
if (order.getDrawee() == 1) {//发货人付款 if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId()!=null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个 if (order.getDrawee() == 1 && createReqVO.getOfferId()!=null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
...@@ -1174,17 +1067,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1174,17 +1067,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0); order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0); order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
// 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.setSalesmanId(consigneeDO.getCustomerService());
// }else{
//
// order.setSalesmanId(0L);
// }
} }
} }
...@@ -1201,8 +1083,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1201,8 +1083,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
} }
public void checkOrderSalesman(OrderDO order, Long offerId,CustomerDO consignorDO,CustomerDO consigneeDO,OrderConsignorDO orderConsignorDO,OrderConsigneeDO orderConsigneeDO){ public int checkOrderSalesman(OrderDO order, Long offerId,CustomerDO consignorDO,CustomerDO consigneeDO,OrderConsignorDO orderConsignorDO,OrderConsigneeDO orderConsigneeDO){
int customerType = 1; //1-业绩归属发货人,2-业绩归属收货人
if(Objects.isNull(orderConsigneeDO)){//订单收货人 if(Objects.isNull(orderConsigneeDO)){//订单收货人
orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1")); orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
} }
...@@ -1220,11 +1102,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1220,11 +1102,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 海外仓归属发货人 // 海外仓归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0) ; order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0) ;
customerType = 1 ;
} else{ } else{
if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if(consignorDO!=null){ if(consignorDO!=null){
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0); order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
customerType = 1 ;
} }
}else{ }else{
...@@ -1238,13 +1122,16 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1238,13 +1122,16 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0); order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
customerType = 1 ;
}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());
customerType = 1 ;
}else{ }else{
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0); order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0); order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
customerType = 2 ;
// order.setCustomerId(0L); // order.setCustomerId(0L);
// order.setSalesmanId(0L); // order.setSalesmanId(0L);
} }
...@@ -1252,11 +1139,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1252,11 +1139,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if(consigneeDO!=null){ if(consigneeDO!=null){
order.setCustomerId(orderConsigneeDO.getCustomerId()); order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService()); order.setSalesmanId(consigneeDO.getCustomerService());
customerType = 1 ;
}else{ }else{
//没有收货人 //没有收货人
order.setCustomerId(0L); order.setCustomerId(0L);
order.setSalesmanId(0L); order.setSalesmanId(0L);
// order.setSalesmanId(0L); customerType = 0 ;
// order.setSalesmanId(0L);
} }
} else if (order.getDrawee() == 3) { //自定义付款 } else if (order.getDrawee() == 3) { //自定义付款
...@@ -1272,23 +1161,27 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1272,23 +1161,27 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getCustomerService());
customerType = 1 ;
}else if(offerId!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费 }else if(offerId!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getCustomerService());
customerType = 1 ;
}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());
customerType = 1 ;
}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());
customerType = 1 ;
}else { }else {
//去掉层级5、6 ,以上不符合的都归收货人 //去掉层级5、6 ,以上不符合的都归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0); order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0); order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
customerType = 2 ;
} }
...@@ -1299,12 +1192,14 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1299,12 +1192,14 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
//业绩归收货人 //业绩归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0); order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0); order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
customerType = 2 ;
} }
} }
} }
return customerType ;
} }
private void addOrderCustomerServiceAndCustomer(OrderCreateReqVO createReqVO,OrderDO order, int customerType) { private void addOrderCustomerServiceAndCustomer(OrderCreateReqVO createReqVO,OrderDO order, int customerType) {
...@@ -1348,7 +1243,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1348,7 +1243,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
&& (Objects.isNull(customerDO.getCustomerService()) || (!customerDO.getIsCustomerServiceConfirmed() && Objects.isNull(oldCustomerService)))) { && (Objects.isNull(customerDO.getCustomerService()) || (!customerDO.getIsCustomerServiceConfirmed() && Objects.isNull(oldCustomerService)))) {
// 如果客户正在移交新客户经理,但是未接收,并且老客户经理不为null,则不创建客户经理未分配异常 // 如果客户正在移交新客户经理,但是未接收,并且老客户经理不为null,则不创建客户经理未分配异常
//web下单,业绩为收货人,不产生未分配客户经理异常 //web下单,业绩为收货人,不产生未分配客户经理异常
if (order.getUserId() != null && order.getUserId() > 0 && customerType == 2) { //if (order.getUserId() != null && order.getUserId() > 0 && customerType == 2) {
if (order.getUserId() != null && order.getUserId() > 0 && order.getSalesmanId()>0) {
//order.setSalesmanId(0L); //order.setSalesmanId(0L);
addOrderSalesmanCustomerService(createReqVO,order); addOrderSalesmanCustomerService(createReqVO,order);
order.setDeptId(0L); order.setDeptId(0L);
...@@ -3427,8 +3323,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3427,8 +3323,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
orderConsigneeService.saveOrUpdate(orderConsigneeDO); orderConsigneeService.saveOrUpdate(orderConsigneeDO);
if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
int customerType = 1; // 发货人 1 收货人 2 //customerType 发货人 1 收货人 2
this.checkOrderSalesman(updateObj,updateReqVO.getOfferId(),consignorCustomerDO,null,orderConsignorDO,orderConsigneeDO); int customerType = this.checkOrderSalesman(updateObj,updateReqVO.getOfferId(),consignorCustomerDO,null,orderConsignorDO,orderConsigneeDO);
// if (Objects.nonNull(updateObj.getType()) && updateObj.getType().contains("2")) { // if (Objects.nonNull(updateObj.getType()) && updateObj.getType().contains("2")) {
// // 海外仓归属发货人 // // 海外仓归属发货人
// updateObj.setCustomerId(orderConsignorDO.getCustomerId()); // updateObj.setCustomerId(orderConsignorDO.getCustomerId());
...@@ -3727,69 +3623,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3727,69 +3623,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeService.saveOrUpdate(orderConsigneeDO); orderConsigneeService.saveOrUpdate(orderConsigneeDO);
} }
if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
int customerType = 1; // 发货人 1 收货人 2 //customerType 发货人 1 收货人 2
this.checkOrderSalesman(updateObj,updateReqVO.getOfferId(),consignorDO,consigneeDO,orderConsignorDO,orderConsigneeDO); int customerType = this.checkOrderSalesman(updateObj,updateReqVO.getOfferId(),consignorDO,consigneeDO,orderConsignorDO,orderConsigneeDO);
// if (Objects.nonNull(updateObj.getType()) && updateObj.getType().contains("2")) {
// // 海外仓归属发货人
// updateObj.setCustomerId(orderConsignorDO.getCustomerId());
// } else {
//
// if(!consignorDO.getNoConsignee() && !updateObj.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
// updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else{
// // 补充业绩规则判断
// if (updateObj.getDrawee() == 1) {//发货人付款
// if (updateObj.getDrawee() == 1 && updateReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
// updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else if(updateObj.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
// updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else{
// //不符合的,业绩归属收货人
// updateObj.setCustomerId(orderConsigneeDO.getCustomerId()) ;
// }
// } else if (updateObj.getDrawee() == 2) {//收货人付款 层级5 第一个
// updateObj.setCustomerId(orderConsigneeDO.getCustomerId()) ;
// } else if (updateObj.getDrawee() == 3) { //自定义付款
//
// List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class);
// if(CollectionUtil.isNotEmpty(list)){
//
// 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());
// int freight = freightList.get(0).getValue() ;//运费
// int clearanceFee = clearanceFeeList.get(0).getValue();//清关费
//
// if(updateReqVO.getOfferId()!=null && ( updateObj.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
// updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else if(updateReqVO.getOfferId()!=null && ( updateObj.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
// updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else if(consignorDO.getDefaultPay() && ( updateObj.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
// updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else if (consignorDO.getDefaultPay() && ( updateObj.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
// updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }else {
// updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
// }
// //去掉层级5、6 ,其他情况的都归收货人
//// if(!consignorDO.getDefaultPay() && (updateObj.getDrawee()==3 && freight==2 ) || (updateObj.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
//// updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
//// }
//
// }
//
// } else {
// //业绩归属收获人
// updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
//// updateObj.setCustomerId(0L) ;
//// updateObj.setSalesmanId(0L);
// }
// }
//
// }
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (!OrderStatusEnum.DRAFT.getValue().equals(updateObj.getStatus()) && Objects.nonNull(updateObj.getCustomerId()) && updateObj.getCustomerId() > 0) { if (!OrderStatusEnum.DRAFT.getValue().equals(updateObj.getStatus()) && Objects.nonNull(updateObj.getCustomerId()) && updateObj.getCustomerId() > 0) {
......
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