Commit 0f8d1df6 authored by 332784038@qq.com's avatar 332784038@qq.com

Merge branch 'master-fix' into dev

parents dcf977b6 7c227ec3
...@@ -200,7 +200,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -200,7 +200,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(order.getSalesmanId()); AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(order.getSalesmanId());
if (Objects.nonNull(adminUserRespDTO)) { if (Objects.nonNull(adminUserRespDTO)) {
order.setDeptId(adminUserRespDTO.getDeptId()); order.setDeptId(adminUserRespDTO.getDeptId());
}else { } else {
order.setDeptId(0L); order.setDeptId(0L);
} }
} else if (CollectionUtil.isEmpty(orderExceptionDOList) && } else if (CollectionUtil.isEmpty(orderExceptionDOList) &&
...@@ -1848,6 +1848,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -1848,6 +1848,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
private void updateConsignorAndConsignee(OrderConsignorDO orderConsignorDO, OrderConsigneeDO private void updateConsignorAndConsignee(OrderConsignorDO orderConsignorDO, OrderConsigneeDO
orderConsigneeDO, OrderDO orderDO, List<String> bugList) { orderConsigneeDO, OrderDO orderDO, List<String> bugList) {
boolean flag = false; boolean flag = false;
CustomerDO consignorDO = null;
CustomerDO consigneeDO = null;
CustomerContactsDO consignorContactsDO = customerContactsService.getCustomerContacts(orderConsignorDO.getCustomerContactsId()); CustomerContactsDO consignorContactsDO = customerContactsService.getCustomerContacts(orderConsignorDO.getCustomerContactsId());
if (Objects.isNull(consignorContactsDO)) { if (Objects.isNull(consignorContactsDO)) {
CustomerContactsDO newConsignorContactsDO = customerContactsService.getOne(new LambdaQueryWrapper<CustomerContactsDO>() CustomerContactsDO newConsignorContactsDO = customerContactsService.getOne(new LambdaQueryWrapper<CustomerContactsDO>()
...@@ -1857,7 +1859,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -1857,7 +1859,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
.orderByDesc(CustomerContactsDO::getId) .orderByDesc(CustomerContactsDO::getId)
.last("limit 1")); .last("limit 1"));
if (Objects.nonNull(newConsignorContactsDO)) { if (Objects.nonNull(newConsignorContactsDO)) {
CustomerDO consignorDO = customerService.getCustomer(newConsignorContactsDO.getCustomerId()); consignorDO = customerService.getCustomer(newConsignorContactsDO.getCustomerId());
log.info("订单【{}】,更新发货人联系人id-[{}]->[{}]和客户id-[{}]->[{}]", log.info("订单【{}】,更新发货人联系人id-[{}]->[{}]和客户id-[{}]->[{}]",
orderDO.getOrderNo(), orderConsignorDO.getCustomerContactsId(), newConsignorContactsDO.getId(), orderDO.getOrderNo(), orderConsignorDO.getCustomerContactsId(), newConsignorContactsDO.getId(),
orderConsignorDO.getCustomerId(), newConsignorContactsDO.getCustomerId()); orderConsignorDO.getCustomerId(), newConsignorContactsDO.getCustomerId());
...@@ -1888,7 +1890,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -1888,7 +1890,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
.orderByDesc(CustomerContactsDO::getId) .orderByDesc(CustomerContactsDO::getId)
.last("limit 1")); .last("limit 1"));
if (Objects.nonNull(newConsignorContactsDO)) { if (Objects.nonNull(newConsignorContactsDO)) {
CustomerDO consignorDO = customerService.getCustomer(newConsignorContactsDO.getCustomerId()); consignorDO = customerService.getCustomer(newConsignorContactsDO.getCustomerId());
log.info("订单【{}】,更新发货人联系人id-[{}]->[{}]和客户id-[{}]->[{}]", log.info("订单【{}】,更新发货人联系人id-[{}]->[{}]和客户id-[{}]->[{}]",
orderDO.getOrderNo(), orderConsignorDO.getCustomerContactsId(), newConsignorContactsDO.getId(), orderDO.getOrderNo(), orderConsignorDO.getCustomerContactsId(), newConsignorContactsDO.getId(),
orderConsignorDO.getCustomerId(), newConsignorContactsDO.getCustomerId()); orderConsignorDO.getCustomerId(), newConsignorContactsDO.getCustomerId());
...@@ -1912,7 +1914,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -1912,7 +1914,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
} else { } else {
if (!Objects.equals(consignorContactsDO.getCustomerId(), orderConsignorDO.getCustomerId())) { if (!Objects.equals(consignorContactsDO.getCustomerId(), orderConsignorDO.getCustomerId())) {
CustomerDO consignorDO = customerService.getCustomer(consignorContactsDO.getCustomerId()); consignorDO = customerService.getCustomer(consignorContactsDO.getCustomerId());
log.info("订单【{}】,更新发货人客户id-[{}]->[{}]", log.info("订单【{}】,更新发货人客户id-[{}]->[{}]",
orderDO.getOrderNo(), orderConsignorDO.getCustomerId(), consignorContactsDO.getCustomerId()); orderDO.getOrderNo(), orderConsignorDO.getCustomerId(), consignorContactsDO.getCustomerId());
if (Objects.nonNull(consignorDO)) { if (Objects.nonNull(consignorDO)) {
...@@ -1949,7 +1951,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -1949,7 +1951,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
if (Objects.isNull(consigneeContactsDO)) { if (Objects.isNull(consigneeContactsDO)) {
CustomerContactsDO newConsigneeContactsDO = customerContactsService.getUniqueOneAndValidate(orderConsigneeDO.getCountryCode(), orderConsigneeDO.getPhone(), null); CustomerContactsDO newConsigneeContactsDO = customerContactsService.getUniqueOneAndValidate(orderConsigneeDO.getCountryCode(), orderConsigneeDO.getPhone(), null);
if (Objects.nonNull(newConsigneeContactsDO)) { if (Objects.nonNull(newConsigneeContactsDO)) {
CustomerDO consigneeDO = customerService.getCustomer(newConsigneeContactsDO.getCustomerId()); consigneeDO = customerService.getCustomer(newConsigneeContactsDO.getCustomerId());
log.info("订单【{}】,更新收货人联系人id-[{}]->[{}]和客户id-[{}]->[{}]", log.info("订单【{}】,更新收货人联系人id-[{}]->[{}]和客户id-[{}]->[{}]",
orderDO.getOrderNo(), orderConsigneeDO.getCustomerContactsId(), newConsigneeContactsDO.getId(), orderDO.getOrderNo(), orderConsigneeDO.getCustomerContactsId(), newConsigneeContactsDO.getId(),
orderConsigneeDO.getCustomerId(), newConsigneeContactsDO.getCustomerId()); orderConsigneeDO.getCustomerId(), newConsigneeContactsDO.getCustomerId());
...@@ -1974,7 +1976,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -1974,7 +1976,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
if (!StringUtils.equals(consigneeContactsDO.getPhoneNew(), orderConsigneeDO.getPhone())) { if (!StringUtils.equals(consigneeContactsDO.getPhoneNew(), orderConsigneeDO.getPhone())) {
CustomerContactsDO newConsigneeContactsDO = customerContactsService.getUniqueOneAndValidate(orderConsigneeDO.getCountryCode(), orderConsigneeDO.getPhone(), null); CustomerContactsDO newConsigneeContactsDO = customerContactsService.getUniqueOneAndValidate(orderConsigneeDO.getCountryCode(), orderConsigneeDO.getPhone(), null);
if (Objects.nonNull(newConsigneeContactsDO)) { if (Objects.nonNull(newConsigneeContactsDO)) {
CustomerDO consigneeDO = customerService.getCustomer(newConsigneeContactsDO.getCustomerId()); consigneeDO = customerService.getCustomer(newConsigneeContactsDO.getCustomerId());
log.info("订单【{}】,更新收货人联系人id-[{}]->[{}]和客户id-[{}]->[{}]", log.info("订单【{}】,更新收货人联系人id-[{}]->[{}]和客户id-[{}]->[{}]",
orderDO.getOrderNo(), orderConsigneeDO.getCustomerContactsId(), newConsigneeContactsDO.getId(), orderDO.getOrderNo(), orderConsigneeDO.getCustomerContactsId(), newConsigneeContactsDO.getId(),
orderConsigneeDO.getCustomerId(), newConsigneeContactsDO.getCustomerId()); orderConsigneeDO.getCustomerId(), newConsigneeContactsDO.getCustomerId());
...@@ -1997,7 +1999,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -1997,7 +1999,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
} else { } else {
if (!Objects.equals(consigneeContactsDO.getCustomerId(), orderConsigneeDO.getCustomerId())) { if (!Objects.equals(consigneeContactsDO.getCustomerId(), orderConsigneeDO.getCustomerId())) {
CustomerDO consigneeDO = customerService.getCustomer(consigneeContactsDO.getCustomerId()); consigneeDO = customerService.getCustomer(consigneeContactsDO.getCustomerId());
log.info("订单【{}】,更新收货人客户id-[{}]->[{}]", log.info("订单【{}】,更新收货人客户id-[{}]->[{}]",
orderDO.getOrderNo(), orderConsigneeDO.getCustomerId(), consigneeContactsDO.getCustomerId()); orderDO.getOrderNo(), orderConsigneeDO.getCustomerId(), consigneeContactsDO.getCustomerId());
if (Objects.nonNull(consigneeDO)) { if (Objects.nonNull(consigneeDO)) {
...@@ -2019,9 +2021,10 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2019,9 +2021,10 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderDO.setCustomerId(orderConsignorDO.getCustomerId()); orderDO.setCustomerId(orderConsignorDO.getCustomerId());
} }
} else { } else {
if (orderDO.getIsCargoControl()) {
if (consignorDO != null && !consignorDO.getNoConsignee() && !orderDO.getHasConsignee()) {
if (!Objects.equals(orderDO.getCustomerId(), orderConsignorDO.getCustomerId())) { if (!Objects.equals(orderDO.getCustomerId(), orderConsignorDO.getCustomerId())) {
// 控货订单归属发货人 // 控货订单归属发货人->修改为发货人档案控货无收货人
orderDO.setCustomerId(orderConsignorDO.getCustomerId()); orderDO.setCustomerId(orderConsignorDO.getCustomerId());
} }
} else { } else {
...@@ -2031,6 +2034,56 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2031,6 +2034,56 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
// 订单归属发货人 // 订单归属发货人
orderDO.setCustomerId(orderConsignorDO.getCustomerId()); orderDO.setCustomerId(orderConsignorDO.getCustomerId());
} }
} else if (orderDO.getDrawee() == 3) {
//自定义付款
List<CustomDraweeVO> list =
JSONObject.parseArray(orderDO.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();//清关费
// 检查订单是否有关联报价单
OrderAssociationOfferCostEvent offerCostEvent =
new OrderAssociationOfferCostEvent(orderDO.getOrderId(),
BigDecimal.ZERO, 0, BigDecimal.ZERO,
0, false);
applicationContext.publishEvent(offerCostEvent);
if (offerCostEvent.isAssociationOffer() && (orderDO.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
orderDO.setCustomerId(orderConsignorDO.getCustomerId());
orderDO.setIsInOpenSea(consignorDO.getIsInOpenSea());
orderDO.setYejiType(consignorDO.getIsNew() ? 1 : 0);
orderDO.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
} else if (offerCostEvent.isAssociationOffer() && (orderDO.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
orderDO.setCustomerId(orderConsignorDO.getCustomerId());
orderDO.setIsInOpenSea(consignorDO.getIsInOpenSea());
orderDO.setYejiType(consignorDO.getIsNew() ? 1 : 0);
orderDO.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
} else if (consignorDO.getDefaultPay() && (orderDO.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
orderDO.setCustomerId(orderConsignorDO.getCustomerId());
orderDO.setIsInOpenSea(consignorDO.getIsInOpenSea());
orderDO.setYejiType(consignorDO.getIsNew() ? 1 : 0);
orderDO.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
} else if (consignorDO.getDefaultPay() && (orderDO.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
orderDO.setCustomerId(orderConsignorDO.getCustomerId());
orderDO.setIsInOpenSea(consignorDO.getIsInOpenSea());
orderDO.setYejiType(consignorDO.getIsNew() ? 1 : 0);
orderDO.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
} else {
//去掉层级5、6 ,以上不符合的都归收货人
orderDO.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
orderDO.setIsInOpenSea(consigneeDO.getIsInOpenSea());
orderDO.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
orderDO.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
}
}
} else { } else {
if (!Objects.equals(orderDO.getCustomerId(), orderConsigneeDO.getCustomerId())) { if (!Objects.equals(orderDO.getCustomerId(), orderConsigneeDO.getCustomerId())) {
// 控货订单归属收货人 // 控货订单归属收货人
...@@ -2040,17 +2093,24 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2040,17 +2093,24 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
} }
} }
if (Objects.nonNull(orderDO.getCustomerId()) && orderDO.getCustomerId() > 0) { // 判断该订单、该客户是否有未分配客户异常,如果有,则这个订单不计算业绩
List<OrderExceptionDO> orderExceptionDOList =
orderExceptionService.getOrderExceptionByCustomerId(
orderDO.getCustomerId());
// 获取当前订单的异常
OrderExceptionDO currentOrderException = orderExceptionDOList.stream()
.filter(orderExceptionDO -> Objects.equals(orderExceptionDO.getOrderId(), orderDO.getOrderId())).findFirst().orElse(null);
if (Objects.isNull(currentOrderException) && Objects.nonNull(orderDO.getCustomerId()) && orderDO.getCustomerId() > 0) {
CustomerDO customerDO = customerService.getById(orderDO.getCustomerId()); CustomerDO customerDO = customerService.getById(orderDO.getCustomerId());
// 订单所属客户变更,则需要变更业绩归属 // 订单所属客户变更,则需要变更业绩归属
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (Objects.nonNull(customerDO) && Objects.nonNull(customerDO.getCustomerService()) && customerDO.getIsCustomerServiceConfirmed()) { if (Objects.nonNull(customerDO) && Objects.nonNull(customerDO.getCustomerService()) && customerDO.getIsCustomerServiceConfirmed() && !customerDO.getIsInOpenSea()) {
log.info("订单【{}】,客户经理变动[{}]->[{}]", orderDO.getOrderNo(), orderDO.getSalesmanId(), customerDO.getCustomerService()); log.info("订单【{}】,客户经理变动[{}]->[{}]", orderDO.getOrderNo(), orderDO.getSalesmanId(), customerDO.getCustomerService());
orderDO.setSalesmanId(customerDO.getCustomerService()); orderDO.setSalesmanId(customerDO.getIsInOpenSea() ? 0L : customerDO.getCustomerService());
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(customerDO.getCustomerService()); AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(customerDO.getCustomerService());
if (Objects.nonNull(adminUserRespDTO)) { if (Objects.nonNull(adminUserRespDTO)) {
orderDO.setDeptId(adminUserRespDTO.getDeptId()); orderDO.setDeptId(adminUserRespDTO.getDeptId());
}else { } else {
orderDO.setDeptId(0L); orderDO.setDeptId(0L);
} }
} else { } else {
...@@ -2667,7 +2727,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2667,7 +2727,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
List<OrderItemDO> listItem = orderItemMapper.selectList(q1); List<OrderItemDO> listItem = orderItemMapper.selectList(q1);
if (CollectionUtil.isEmpty(listItem) == true) return; if (CollectionUtil.isEmpty(listItem) == true) return;
for (OrderItemDO o:listItem for (OrderItemDO o : listItem
) { ) {
} }
...@@ -3438,7 +3498,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3438,7 +3498,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
Objects.nonNull(orderItemDO.getWarehouseInInfoVO()) ? Objects.nonNull(orderItemDO.getWarehouseInInfoVO()) ?
orderItemDO.getChargeVolume() : orderItemDO.getChargeVolume() :
(Objects.equals(orderDO.getStatus(), OrderStatusEnum.DRAFT.getValue()) || (Objects.equals(orderDO.getStatus(), OrderStatusEnum.DRAFT.getValue()) ||
Objects.equals(orderDO.getStatus(),OrderStatusEnum.ORDER_PLACED.getValue()) ? orderItemDO.getVolume() : null) Objects.equals(orderDO.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) ? orderItemDO.getVolume() : null)
); );
param.setChargeQuantity(Objects.nonNull(orderItemDO.getWarehouseInInfoVO()) ? param.setChargeQuantity(Objects.nonNull(orderItemDO.getWarehouseInInfoVO()) ?
......
...@@ -668,93 +668,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -668,93 +668,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (!Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
//customerType 发货人-1 收货人 2 //customerType 发货人-1 收货人 2
int customerType = 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(!consignorCustomerDO.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());
// order.setSalesmanId(consignorCustomerDO.getCustomerService()!=null?consignorCustomerDO.getCustomerService():0);
// }else if(order.getDrawee() == 1 && consignorCustomerDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
//
// order.setCustomerId(orderConsignorDO.getCustomerId());
// order.setSalesmanId(consignorCustomerDO.getCustomerService());
// }else{
// order.setCustomerId(orderConsigneeDO.getCustomerId());
//
// }
// } else if (order.getDrawee() == 2 ) {//收货人付款 层级5 第一个
// if(orderConsigneeDO!=null){
// order.setCustomerId(orderConsigneeDO.getCustomerId());
//
// }else{
// order.setSalesmanId(0L);
// }
// } 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());
// 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 {
// order.setCustomerId(orderConsigneeDO.getCustomerId());
// }
//
//// if(!consignorCustomerDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
//// order.setCustomerId(orderConsigneeDO.getCustomerId());
//// if(orderConsignorDO!=null){
//// order.setCustomerId(orderConsigneeDO.getCustomerId());
////
//// }else{
////
//// order.setSalesmanId(0L);
//// }
////
////
//// }
//
// }
//
// } else {
// //业绩归属公司
// order.setCustomerId(orderConsigneeDO.getCustomerId());
//
// }
// }
//
//
//
//
//
// }//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) {
...@@ -1023,7 +936,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1023,7 +936,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
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());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0));
} else { } else {
if (consignorDO != null && !consignorDO.getNoConsignee() && if (consignorDO != null && !consignorDO.getNoConsignee() &&
...@@ -1033,7 +946,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1033,7 +946,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0));
} }
} else { } else {
...@@ -1049,19 +962,19 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1049,19 +962,19 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService()));
} else { } else {
//都不符合,归属收货人 //都不符合,归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0); order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
} }
} else if (order.getDrawee() == 2) { } else if (order.getDrawee() == 2) {
//收货人付款 层级5 第一个 //收货人付款 层级5 第一个
...@@ -1069,7 +982,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1069,7 +982,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsigneeDO.getCustomerId()); order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService()); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService()));
} else { } else {
order.setCustomerId(0L); order.setCustomerId(0L);
order.setSalesmanId(0L); order.setSalesmanId(0L);
...@@ -1090,45 +1003,31 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1090,45 +1003,31 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService()));
} else { } else {
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0); order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (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);
// }
//
//
// }
} }
} else { } else {
...@@ -1136,7 +1035,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1136,7 +1035,7 @@ 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.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
} }
} }
...@@ -1157,14 +1056,14 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1157,14 +1056,14 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
//层级1 //层级1
// 海外仓归属发货人 // 海外仓归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0));
} 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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0));
} }
} else { } else {
...@@ -1176,32 +1075,29 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1176,32 +1075,29 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
} else { } else {
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0); order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
// order.setCustomerId(0L);
// order.setSalesmanId(0L);
} }
} 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.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService()); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : consigneeDO.getCustomerService());
} else { } else {
//没有收货人 //没有收货人
order.setCustomerId(0L); order.setCustomerId(0L);
order.setSalesmanId(0L); order.setSalesmanId(0L);
// order.setSalesmanId(0L);
} }
} else if (order.getDrawee() == 3) { } else if (order.getDrawee() == 3) {
//自定义付款 //自定义付款
...@@ -1220,31 +1116,31 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1220,31 +1116,31 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : 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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : 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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : 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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
} else { } else {
//去掉层级5、6 ,以上不符合的都归收货人 //去掉层级5、6 ,以上不符合的都归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0); order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
} }
...@@ -1255,7 +1151,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1255,7 +1151,7 @@ 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.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
} }
} }
...@@ -1284,7 +1180,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1284,7 +1180,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0));
customerType = 1; customerType = 1;
} else { } else {
if (consignorDO != null && !consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 if (consignorDO != null && !consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
...@@ -1292,7 +1188,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1292,7 +1188,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0));
customerType = 1; customerType = 1;
} }
...@@ -1305,37 +1201,34 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1305,37 +1201,34 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0));
customerType = 1; 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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
customerType = 1; customerType = 1;
} else { } else {
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0); order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
customerType = 2; customerType = 2;
// order.setCustomerId(0L);
// order.setSalesmanId(0L);
} }
} 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.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService()); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : consigneeDO.getCustomerService());
customerType = 1; customerType = 1;
} else { } else {
//没有收货人 //没有收货人
order.setCustomerId(0L); order.setCustomerId(0L);
order.setSalesmanId(0L); order.setSalesmanId(0L);
customerType = 0; customerType = 0;
// order.setSalesmanId(0L);
} }
} else if (order.getDrawee() == 3) { //自定义付款 } else if (order.getDrawee() == 3) { //自定义付款
...@@ -1352,27 +1245,27 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1352,27 +1245,27 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId()); order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
customerType = 1; 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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
customerType = 1; 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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
customerType = 1; 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.setIsInOpenSea(consignorDO.getIsInOpenSea()); order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0); order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getCustomerService()); order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
customerType = 1; customerType = 1;
} else { } else {
...@@ -1380,7 +1273,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1380,7 +1273,7 @@ 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.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
customerType = 2; customerType = 2;
...@@ -1393,7 +1286,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1393,7 +1286,7 @@ 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.setIsInOpenSea(consigneeDO.getIsInOpenSea()); order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0); order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0); order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
customerType = 2; customerType = 2;
} }
...@@ -1444,6 +1337,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1444,6 +1337,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(order.getSalesmanId()); AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(order.getSalesmanId());
if (Objects.nonNull(adminUserRespDTO)) { if (Objects.nonNull(adminUserRespDTO)) {
order.setDeptId(adminUserRespDTO.getDeptId()); order.setDeptId(adminUserRespDTO.getDeptId());
} else {
order.setDeptId(0L);
} }
} else if (CollectionUtil.isEmpty(orderExceptionDOList) && Objects.nonNull(customerDO) } else if (CollectionUtil.isEmpty(orderExceptionDOList) && Objects.nonNull(customerDO)
&& (Objects.isNull(customerDO.getCustomerService()) || && (Objects.isNull(customerDO.getCustomerService()) ||
...@@ -1454,9 +1349,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1454,9 +1349,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
//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 if (order.getUserId() != null && order.getUserId() > 0
&& order.getSalesmanId() != null && order.getSalesmanId() > 0) { && order.getSalesmanId() != null && order.getSalesmanId() > 0) {
//order.setSalesmanId(0L);
addOrderSalesmanCustomerService(createReqVO, order); addOrderSalesmanCustomerService(createReqVO, order);
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(order.getSalesmanId());
if (Objects.nonNull(adminUserRespDTO)) {
order.setDeptId(adminUserRespDTO.getDeptId());
} else {
order.setDeptId(0L); order.setDeptId(0L);
}
log.info("web下单,业绩为收货人,不产生未分配客户经理异常 orderNo={}", order.getOrderNo()); log.info("web下单,业绩为收货人,不产生未分配客户经理异常 orderNo={}", order.getOrderNo());
} else { } else {
// 只有客户的客户经理为空时 // 只有客户的客户经理为空时
...@@ -3087,20 +2986,20 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3087,20 +2986,20 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
} else { } else {
if (vo.getIsCargoControl()) { if (vo.getIsCargoControl()) {
if (!Objects.equals(vo.getCustomerId(), // if (!Objects.equals(vo.getCustomerId(),
orderConsignorBackVO.getCustomerId())) { // orderConsignorBackVO.getCustomerId())) {
// 控货订单归属发货人 // // 控货订单归属发货人
customerType = 1; // customerType = 1;
CustomerDO orgCustomerDO = customerService.getCustomer(vo.getCustomerId()); // CustomerDO orgCustomerDO = customerService.getCustomer(vo.getCustomerId());
CustomerDO newCustomerDO = customerService.getCustomer(orderConsignorBackVO.getCustomerId()); // CustomerDO newCustomerDO = customerService.getCustomer(orderConsignorBackVO.getCustomerId());
infoVO = new ApplyInfoVO(); // infoVO = new ApplyInfoVO();
infoVO.setName("新规则,控货订单客户归属不变动/Change in customer ownership for orders"); // infoVO.setName("新规则,控货订单客户归属不变动/Change in customer ownership for orders");
// 出掉控货改变业绩归属的逻辑点 // // 出掉控货改变业绩归属的逻辑点
//infoVO.setOrgValue(Objects.nonNull(orgCustomerDO) ? ((StringUtils.isNotBlank(orgCustomerDO.getName()) ? orgCustomerDO.getName() : "无") + "/" + (StringUtils.isNotBlank(orgCustomerDO.getNameEn()) ? orgCustomerDO.getNameEn() : "empty")) : "无/not have"); // //infoVO.setOrgValue(Objects.nonNull(orgCustomerDO) ? ((StringUtils.isNotBlank(orgCustomerDO.getName()) ? orgCustomerDO.getName() : "无") + "/" + (StringUtils.isNotBlank(orgCustomerDO.getNameEn()) ? orgCustomerDO.getNameEn() : "empty")) : "无/not have");
//infoVO.setNewValue(Objects.nonNull(newCustomerDO) ? ((StringUtils.isNotBlank(newCustomerDO.getName()) ? newCustomerDO.getName() : "无") + "/" + (StringUtils.isNotBlank(newCustomerDO.getNameEn()) ? newCustomerDO.getNameEn() : "empty")) : "无/not have"); // //infoVO.setNewValue(Objects.nonNull(newCustomerDO) ? ((StringUtils.isNotBlank(newCustomerDO.getName()) ? newCustomerDO.getName() : "无") + "/" + (StringUtils.isNotBlank(newCustomerDO.getNameEn()) ? newCustomerDO.getNameEn() : "empty")) : "无/not have");
//vo.setCustomerId(orderConsignorBackVO.getCustomerId()); // //vo.setCustomerId(orderConsignorBackVO.getCustomerId());
return; // return;
} // }
} else { } else {
// 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人 // 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人
if (vo.getDrawee() == 1) { if (vo.getDrawee() == 1) {
......
...@@ -171,6 +171,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -171,6 +171,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
targetLogDO.setOrderId(orderId); targetLogDO.setOrderId(orderId);
targetLogDO.setCustomerId(info.getCustomerId()); targetLogDO.setCustomerId(info.getCustomerId());
targetLogDO.setUserId(Objects.isNull(info.getSalesmanId()) ? 0L : info.getSalesmanId()); targetLogDO.setUserId(Objects.isNull(info.getSalesmanId()) ? 0L : info.getSalesmanId());
targetLogDO.setDeptId(Objects.isNull(info.getDeptId()) ? 0L : info.getDeptId());
targetLogDO.setAchievementTime(achievementTime); targetLogDO.setAchievementTime(achievementTime);
if (info.getTransportId() == 3) { if (info.getTransportId() == 3) {
targetLogDO.setLdBoxTime(achievementTime); targetLogDO.setLdBoxTime(achievementTime);
......
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