Commit 975ae813 authored by 332784038@qq.com's avatar 332784038@qq.com

订单无收货人时的业务逻辑兼容性调整

parent 228c72ad
......@@ -470,9 +470,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
// 插入订单商品项
this.costCalculation(updater, orderDO,
orderConsignorDO.getCustomerId(),
orderConsigneeDO.getCustomerId(),
Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(),
orderConsigneeDO.getCustomerContactsId(),
Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerContactsId(),
orderItemDOList, type);
}
......@@ -513,9 +513,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
// 插入订单商品项
this.costCalculation(updater, orderDO,
orderConsignorDO.getCustomerId(),
orderConsigneeDO.getCustomerId(),
Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(),
orderConsigneeDO.getCustomerContactsId(),
Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerContactsId(),
orderItemDOList, type);
}
......@@ -568,8 +568,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
String updater = String.valueOf(loginUser != null ? loginUser.getId() : null);
// 插入订单商品项
this.costCalculation(updater, orderDO, orderConsignorDO.getCustomerId(), orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(), orderConsigneeDO.getCustomerContactsId(), orderItemDOList, type);
this.costCalculation(updater, orderDO, orderConsignorDO.getCustomerId(), Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(), Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerContactsId(), orderItemDOList, type);
// orderMapper.updateById(orderDO);
}
......@@ -827,9 +827,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
// 批量加价计价调整
this.costCalculation(updater,
orderDO, orderConsignorDO.getCustomerId(),
orderConsigneeDO.getCustomerId(),
Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(),
orderConsigneeDO.getCustomerContactsId(),
Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerContactsId(),
orderItemDOList, 14);
// 添加出货批量加价日志
......@@ -862,9 +862,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
this.costCalculation("0", orderDO,
orderConsignorDO.getCustomerId(),
orderConsigneeDO.getCustomerId(),
Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(),
orderConsigneeDO.getCustomerContactsId(),
Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerContactsId(),
orderItemDOList, 30);
this.addOrderOperateLog(orderDO.getOrderId(),
......@@ -1865,8 +1865,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
List<OrderItemDO> orderItemDOList = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, orderDO.getOrderId()));
this.costCalculation(userId.toString(), orderDO, orderConsignorDO.getCustomerId(), orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(), orderConsigneeDO.getCustomerContactsId(), orderItemDOList, isResetPrice ? 20 : 8);
this.costCalculation(userId.toString(), orderDO, orderConsignorDO.getCustomerId(), Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(), Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerContactsId(), orderItemDOList, isResetPrice ? 20 : 8);
// TODO 此处是否需要更新操作日志
}
// }
......@@ -1974,8 +1974,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
}
CustomerContactsDO consigneeContactsDO = customerContactsService.getCustomerContacts(orderConsigneeDO.getCustomerContactsId());
if (Objects.isNull(consigneeContactsDO)) {
CustomerContactsDO consigneeContactsDO = customerContactsService.getCustomerContacts(Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerContactsId());
if (Objects.isNull(consigneeContactsDO) && Objects.nonNull(orderConsigneeDO)) {
CustomerContactsDO newConsigneeContactsDO = customerContactsService.getUniqueOneAndValidate(orderConsigneeDO.getCountryCode(), orderConsigneeDO.getPhone(), null);
if (Objects.nonNull(newConsigneeContactsDO)) {
consigneeDO = customerService.getCustomer(newConsigneeContactsDO.getCustomerId());
......@@ -2000,7 +2000,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
log.error(msg);
}
} else {
if (!StringUtils.equals(consigneeContactsDO.getPhoneNew(), orderConsigneeDO.getPhone())) {
if (Objects.nonNull(orderConsigneeDO) && !StringUtils.equals(consigneeContactsDO.getPhoneNew(), orderConsigneeDO.getPhone())) {
CustomerContactsDO newConsigneeContactsDO = customerContactsService.getUniqueOneAndValidate(orderConsigneeDO.getCountryCode(), orderConsigneeDO.getPhone(), null);
if (Objects.nonNull(newConsigneeContactsDO)) {
consigneeDO = customerService.getCustomer(newConsigneeContactsDO.getCustomerId());
......@@ -2025,10 +2025,10 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
log.error(msg);
}
} else {
if (!Objects.equals(consigneeContactsDO.getCustomerId(), orderConsigneeDO.getCustomerId())) {
if (Objects.isNull(orderConsigneeDO) || !Objects.equals(consigneeContactsDO.getCustomerId(), orderConsigneeDO.getCustomerId())) {
consigneeDO = customerService.getCustomer(consigneeContactsDO.getCustomerId());
log.info("订单【{}】,更新收货人客户id-[{}]->[{}]",
orderDO.getOrderNo(), orderConsigneeDO.getCustomerId(), consigneeContactsDO.getCustomerId());
orderDO.getOrderNo(), Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerId(), consigneeContactsDO.getCustomerId());
if (Objects.nonNull(consigneeDO)) {
orderConsigneeDO.setCompany(consigneeDO.getCompany());
CountryDO consigneeCountryDO = countryService.getById(consigneeDO.getCountry());
......@@ -2084,7 +2084,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
if (Objects.isNull(consignorDO)) {//发货人客户
consignorDO = customerService.getCustomer(orderConsignorDO.getCustomerId());
}
if (Objects.isNull(consigneeDO)) {
if (Objects.isNull(consigneeDO) && Objects.nonNull(orderConsigneeDO)) {
consigneeDO = customerService.getCustomer(orderConsigneeDO.getCustomerId());//收货人客户
}
// 原客户经理
......@@ -2104,7 +2104,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
} else {
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setCustomerId(Objects.nonNull(orderConsigneeDO) && orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
customerType = 2;
}
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
......@@ -2136,13 +2136,13 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
order.setCustomerId(orderConsignorDO.getCustomerId());
} else {
//去掉层级5、6 ,以上不符合的都归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setCustomerId(Objects.nonNull(orderConsigneeDO) && orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
customerType = 2;
}
}
} else {
//业绩归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setCustomerId(Objects.nonNull(orderConsigneeDO) && orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
customerType = 2;
}
}
......@@ -2167,7 +2167,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
CustomerZhongPaoQueryVO customerZhongPaoQueryVO = new CustomerZhongPaoQueryVO();
customerZhongPaoQueryVO.setConsignorId(orderConsignorDO.getCustomerId());
customerZhongPaoQueryVO.setConsigneeId(orderConsigneeDO.getCustomerId());
customerZhongPaoQueryVO.setConsigneeId(Objects.nonNull(orderConsigneeDO) ? orderConsigneeDO.getCustomerId() : 0L);
customerZhongPaoQueryVO.setDepartureId(logisticsInfoDto.getStartCityId());
customerZhongPaoQueryVO.setObjectiveId(logisticsInfoDto.getDestCityId());
customerZhongPaoQueryVO.setStartWarehouseId(logisticsInfoDto.getStartWarehouseId());
......@@ -2291,9 +2291,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
this.costCalculation(userId, orderDO,
orderConsignorDO.getCustomerId(),
orderConsigneeDO.getCustomerId(),
Objects.isNull(orderConsigneeDO)? 0L : orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(),
orderConsigneeDO.getCustomerContactsId(),
Objects.isNull(orderConsigneeDO)? 0L : orderConsigneeDO.getCustomerContactsId(),
orderItemDOList, 50);
this.addOrderOperateLog(orderDO.getOrderId(),
"有活动更新订单计价", null);
......
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