Commit 9cbc7658 authored by liuzeheng's avatar liuzeheng

判断调整

parent 4df487cf
...@@ -588,79 +588,87 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -588,79 +588,87 @@ 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 (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId()!=null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
// 补充业绩规则判断
if(!consignorCustomerDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}
if(createReqVO.getOfferId()!=null && order.getDrawee()==1){//订单关联报价单 && 发货人付款
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}
if(createReqVO.getOfferId()!=null && order.getDrawee()==3 ){//订单关联报价单 && 自定义付款 order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorCustomerDO.getCustomerService()!=null?consignorCustomerDO.getCustomerService():0);
}else if(order.getDrawee() == 1 && consignorCustomerDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class); order.setCustomerId(orderConsignorDO.getCustomerId());
if(CollectionUtil.isNotEmpty(list)){ order.setSalesmanId(consignorCustomerDO.getCustomerService());
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList()); }else{
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList()); order.setCustomerId(0L);
int freight = freightList.get(0).getValue() ; order.setSalesmanId(0L);
int clearanceFee = clearanceFeeList.get(0).getValue();
if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && freight==1 )){//订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}
if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
} }
} } else if (order.getDrawee() == 2 ) {//收货人付款 层级5 第一个
if(orderConsigneeDO!=null){
} order.setCustomerId(orderConsigneeDO.getCustomerId());
if(consignorCustomerDO.getDefaultPay() && (order.getDrawee()==2 || order.getDrawee()==3)){//发货人档案设置默认付运费 --层级4
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class); }else{
if(CollectionUtil.isNotEmpty(list)){ order.setSalesmanId(0L);
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(order.getDrawee()==1 || ( order.getDrawee()==3 && freight==1 ) || ( order.getDrawee()==3 && clearanceFee==1 )){//如果是发货人付款 或自定义付款且发货人付运费 或自定义付款且发货人付清关费,业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
} }
} } else if (order.getDrawee() == 3) { //自定义付款
}
if(order.getDrawee()==2 || order.getDrawee()==3){//如果是收货人付款或是自定义付款 --层级5
if(order.getDrawee()==2){//订单收货人付款,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
}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((order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorCustomerDO.getCustomerService());
}else if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorCustomerDO.getCustomerService());
}else if(consignorCustomerDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorCustomerDO.getCustomerService());
}else if (consignorCustomerDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorCustomerDO.getCustomerService());
}else if(!consignorCustomerDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId()); order.setCustomerId(orderConsigneeDO.getCustomerId());
if(orderConsignorDO!=null){
order.setCustomerId(orderConsigneeDO.getCustomerId());
}else{
order.setSalesmanId(0L);
}
} }
} }
} else {
//业绩归属公司
order.setSalesmanId(0L);
} }
//end
} }
} }
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (!OrderStatusEnum.DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) { if (!OrderStatusEnum.DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) {
...@@ -874,62 +882,65 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -874,62 +882,65 @@ 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
order.setCustomerId(orderConsignorDO.getCustomerId()) ; order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else{ }else{
if (order.getDrawee() == 1) {//发货人付款 if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个 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 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()) ; order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人 }else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()) ; order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(!consignorDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人 }else{
order.setCustomerId(orderConsigneeDO.getCustomerId()); order.setCustomerId(0L) ;
order.setSalesmanId(orderConsigneeDO.getCustomerId()); 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 if(!consignorDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
}
} }
} else {
//业绩归属公司
order.setSalesmanId(0L);
} }
//end
} else {
//业绩归属公司
order.setSalesmanId(0L);
} }
//end
} }
...@@ -937,6 +948,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -937,6 +948,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) { if (Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) {
...@@ -958,77 +971,85 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -958,77 +971,85 @@ 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) ;
} else{ } else{
if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 if(order.getIsCargoControl()){
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); }else{
} if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if(consignorDO!=null){
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}
} }else{
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()!=null?consignorDO.getCustomerService():0); 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 ) {//收货人付款 层级5 第一个 } else if (order.getDrawee() == 2 ) {//收货人付款 层级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()); order.setCustomerId(orderConsigneeDO.getCustomerId());
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 {
//业绩归属公司
order.setSalesmanId(0L);
} }
} }
}
} else {
//业绩归属公司
order.setSalesmanId(0L);
}
} }
} }
...@@ -1044,13 +1065,16 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1044,13 +1065,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) ;
} else{ } else{
if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 if(order.getIsCargoControl()){
if(consignorDO!=null){ order.setCustomerId(orderConsignorDO.getCustomerId());
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}
}else{ }else{
if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if(consignorDO!=null){
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}
}else{
// else{ // else{
// 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)){
...@@ -1081,70 +1105,75 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1081,70 +1105,75 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (order.getDrawee() == 1) {//发货人付款 if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId()!=null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个 if (order.getDrawee() == 1 && createReqVO.getOfferId()!=null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0); 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{
} else if (order.getDrawee() == 2 ) {//收货人付款 层级5 第一个 order.setCustomerId(0L);
if(consigneeDO!=null){ order.setSalesmanId(0L);
order.setCustomerId(orderConsigneeDO.getCustomerId()); }
order.setSalesmanId(consigneeDO.getCustomerService()); } else if (order.getDrawee() == 2 ) {//收货人付款 层级5 第一个
}else{ if(consigneeDO!=null){
order.setSalesmanId(0L); order.setCustomerId(orderConsigneeDO.getCustomerId());
} order.setSalesmanId(consigneeDO.getCustomerService());
} else if (order.getDrawee() == 3) { //自定义付款 }else{
order.setSalesmanId(0L);
}
} 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(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费 if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getCustomerService());
}else if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费 }else if(createReqVO.getOfferId()!=null && ( 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()); order.setCustomerId(orderConsigneeDO.getCustomerId());
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 { } else {
//业绩归属公司 //业绩归属公司
order.setSalesmanId(0L); order.setSalesmanId(0L);
}
}
} }
}
} }
} }
...@@ -3272,65 +3301,70 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3272,65 +3301,70 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
updateObj.setCustomerId(orderConsignorDO.getCustomerId()); updateObj.setCustomerId(orderConsignorDO.getCustomerId());
} else { } else {
// 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人 // 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人
if (updateObj.getDrawee() == 1) { // if (updateObj.getDrawee() == 1) {
updateObj.setCustomerId(orderConsignorDO.getCustomerId()); // updateObj.setCustomerId(orderConsignorDO.getCustomerId());
} else { // } else {
customerType = 2; // customerType = 2;
updateObj.setCustomerId(orderConsigneeDO.getCustomerId()); // updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
} // }
}
// 补充业绩规则判断 // 补充业绩规则判断
if(!consignorCustomerDO.getNoConsignee() && !updateObj.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 if(!consignorCustomerDO.getNoConsignee() && !updateObj.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ; updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
} }else{
if(updateReqVO.getOfferId()!=null && updateObj.getDrawee()==1){//订单关联报价单 && 发货人付款
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}
if(updateReqVO.getOfferId()!=null && updateObj.getDrawee()==1){//订单关联报价单 && 发货人付款 if(updateReqVO.getOfferId()!=null && updateObj.getDrawee()==3 ){//订单关联报价单 && 自定义付款
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}
if(updateReqVO.getOfferId()!=null && updateObj.getDrawee()==3 ){//订单关联报价单 && 自定义付款 List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class);
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 )){//订单关联报价单 && 自定义付款 且发货人付运费
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}
if(updateReqVO.getOfferId()!=null && ( updateObj.getDrawee()==3 && clearanceFee==1 )){//订单关联报价单 && 自定义付款 且发货人付清关费
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}
}
List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class); if(consignorCustomerDO.getDefaultPay() ){//发货人档案设置默认付运费 --层级4
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList()); List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class);
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList()); List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ; List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int clearanceFee = clearanceFeeList.get(0).getValue(); int freight = freightList.get(0).getValue() ;
if(updateReqVO.getOfferId()!=null && ( updateObj.getDrawee()==3 && freight==1 )){//订单关联报价单 && 自定义付款 且发货人付运费 int clearanceFee = clearanceFeeList.get(0).getValue();
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ; if(updateObj.getDrawee()==1 || ( updateObj.getDrawee()==3 && freight==1 ) || ( updateObj.getDrawee()==3 && clearanceFee==1 )){//如果是发货人付款 或自定义付款且发货人付运费 或自定义付款且发货人付清关费,业绩归属发货人
} updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
if(updateReqVO.getOfferId()!=null && ( updateObj.getDrawee()==3 && clearanceFee==1 )){//订单关联报价单 && 自定义付款 且发货人付清关费 }
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}
}
if(consignorCustomerDO.getDefaultPay() ){//发货人档案设置默认付运费 --层级4 }
List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class); if(updateObj.getDrawee()==2 || updateObj.getDrawee()==3){//如果是收货人付款或是自定义付款 --层级5
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList()); if(updateObj.getDrawee()==2){//订单收货人付款,业绩归属收货人
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList()); updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
int freight = freightList.get(0).getValue() ; }else if(updateObj.getDrawee()==3){
int clearanceFee = clearanceFeeList.get(0).getValue(); List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class);
if(updateObj.getDrawee()==1 || ( updateObj.getDrawee()==3 && freight==1 ) || ( updateObj.getDrawee()==3 && clearanceFee==1 )){//如果是发货人付款 或自定义付款且发货人付运费 或自定义付款且发货人付清关费,业绩归属发货人 List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ; 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((updateObj.getDrawee()==3 && freight==2 ) || (updateObj.getDrawee()==3 && clearanceFee==2)){//自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
}
}
}
if(updateObj.getDrawee()==2 || updateObj.getDrawee()==3){//如果是收货人付款或是自定义付款 --层级5
if(updateObj.getDrawee()==2){//订单收货人付款,业绩归属收货人
updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
}else if(updateObj.getDrawee()==3){
List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class);
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((updateObj.getDrawee()==3 && freight==2 ) || (updateObj.getDrawee()==3 && clearanceFee==2)){//自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
} }
} }
} }
} }
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
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) {
...@@ -3563,61 +3597,66 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3563,61 +3597,66 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (updateObj.getIsCargoControl()) { if (updateObj.getIsCargoControl()) {
// 控货订单归属发货人 // 控货订单归属发货人
updateObj.setCustomerId(orderConsignorDO.getCustomerId()); updateObj.setCustomerId(orderConsignorDO.getCustomerId());
} else {if(!consignorDO.getNoConsignee() && !updateObj.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 } else {
if(!consignorDO.getNoConsignee() && !updateObj.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ; updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
} }else{
if (updateObj.getDrawee() == 1) {//发货人付款 // 补充业绩规则判断
if (updateObj.getDrawee() == 1 && updateReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个 if (updateObj.getDrawee() == 1) {//发货人付款
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ; if (updateObj.getDrawee() == 1 && updateReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
}else if(updateObj.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else{
updateObj.setCustomerId(0L);
}
} 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()) ; updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(consignorDO.getDefaultPay() && ( updateObj.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人 }else if(updateObj.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ; updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if (consignorDO.getDefaultPay() && ( updateObj.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人 }else{
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ; updateObj.setSalesmanId(0L) ;
}else if(!consignorDO.getDefaultPay() && (updateObj.getDrawee()==3 && freight==2 ) || (updateObj.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人 updateObj.setCustomerId(0L);
updateObj.setCustomerId(orderConsigneeDO.getCustomerId()); }
updateObj.setSalesmanId(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 if(!consignorDO.getDefaultPay() && (updateObj.getDrawee()==3 && freight==2 ) || (updateObj.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
}
} }
} else {
//业绩归属公司
updateObj.setCustomerId(0L) ;
updateObj.setSalesmanId(0L);
} }
} else {
//业绩归属公司
updateObj.setCustomerId(0L) ;
updateObj.setSalesmanId(0L);
} }
// 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人 // 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人
if (updateObj.getDrawee() == 1) { // if (updateObj.getDrawee() == 1) {
updateObj.setCustomerId(orderConsignorDO.getCustomerId()); // updateObj.setCustomerId(orderConsignorDO.getCustomerId());
} else { // } else {
customerType = 2; // customerType = 2;
updateObj.setCustomerId(orderConsigneeDO.getCustomerId()); // updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
} // }
} }
} }
// 补充业绩规则判断
......
...@@ -183,59 +183,67 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -183,59 +183,67 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
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"));
if(consignorDO !=null && ! consignorDO.getNoConsignee() && !info.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 if(info.getIsCargoControl()){
if(consignorDO!=null){ customerId = info.getConsignorVO().getCustomerId();
customerId = consignorDO.getId(); }else {
} if(consignorDO !=null && ! consignorDO.getNoConsignee() && !info.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if(consignorDO!=null){
customerId = consignorDO.getId();
}
} }else{
List<TargetOfferBackVO> offerBackVOList =targetLogMapper.getTargetOfferBackByOrerId(orderId) ; List<TargetOfferBackVO> offerBackVOList =targetLogMapper.getTargetOfferBackByOrerId(orderId) ;
if (info.getDrawee() == 1) {//发货人付款 if (info.getDrawee() == 1) {//发货人付款
if (info.getDrawee() == 1 && CollectionUtil.isNotEmpty(offerBackVOList)) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个 if (info.getDrawee() == 1 && CollectionUtil.isNotEmpty(offerBackVOList)) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
customerId = consignorDO.getId(); customerId = consignorDO.getId();
}else if(info.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个 }else if(info.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
customerId = consignorDO.getId(); customerId = consignorDO.getId();
}else{ }else{
customerId = consignorDO.getId(); customerId = consignorDO.getId();
} }
} 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();
} else if (info.getDrawee() == 3) { //自定义付款 } else if (info.getDrawee() == 3) { //自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(info.getCustomDrawee(), CustomDraweeVO.class); List<CustomDraweeVO> list = JSONObject.parseArray(info.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) && ( info.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费 if(CollectionUtil.isNotEmpty(offerBackVOList) && ( info.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
customerId = orderConsignorDO.getCustomerId() ; customerId = orderConsignorDO.getCustomerId() ;
}else if(CollectionUtil.isNotEmpty(offerBackVOList) && ( info.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费 }else if(CollectionUtil.isNotEmpty(offerBackVOList) && ( info.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
customerId = orderConsignorDO.getCustomerId() ; customerId = orderConsignorDO.getCustomerId() ;
}else if(consignorDO.getDefaultPay() && ( info.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人 }else if(consignorDO.getDefaultPay() && ( info.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
customerId = orderConsignorDO.getCustomerId() ; customerId = orderConsignorDO.getCustomerId() ;
}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 if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
customerId = orderConsigneeDO.getCustomerId() ; customerId = orderConsigneeDO.getCustomerId() ;
} }
} }
} else { } else {
//业绩归属公司 //业绩归属公司
return; return;
}
}
} }
// } // }
} }
TargetLogDO targetLogDO = new TargetLogDO(); TargetLogDO targetLogDO = new TargetLogDO();
......
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