Commit 6c05fe89 authored by zhengyi's avatar zhengyi

Merge branch 'master-fix' into dev

parents 5f7e9265 3cf08167
......@@ -627,4 +627,11 @@ public class OrderDO extends BaseDO {
@ApiModelProperty(value = "是否在公海")
private Boolean isInOpenSea;
@ApiModelProperty(value = "订单修改是否变动了归属客户,此字段用来判定订单是否需要重置归属客户经理,下单后归属客户的客户经理是固定的,除非订单归属客户变动,才需要重置客户经理")
@TableField(exist = false)
private Boolean isChargeCustomer;
}
......@@ -670,7 +670,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
int customerType = this.checkOrderSalesman(order, createReqVO.getOfferId(), null, null, orderConsignorDO, orderConsigneeDO);
// 更新所属客户经理(业务员)
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) {
if (!OrderStatusEnum.DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getIsChargeCustomer()) && order.getIsChargeCustomer()) {
//addOrderCustomerService(order, customerType);
addOrderCustomerServiceAndCustomer(createReqVO, order, customerType);
}
......@@ -911,7 +912,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO,
orderConsigneeDO);
// 更新所属客户经理(业务员)
if (Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) {
// if (Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) {
if (!OrderStatusEnum.DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getIsChargeCustomer()) && order.getIsChargeCustomer()) {
//addOrderCustomerService(order, customerType);
addOrderCustomerServiceAndCustomer(createReqVO, order, customerType);
}
......@@ -1174,6 +1176,10 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (Objects.isNull(consigneeDO)) {
consigneeDO = customerService.getCustomer(orderConsigneeDO.getCustomerId());//收货人客户
}
// 原客户经理
Long orgCustomerId = Objects.isNull(order.getCustomerId()) ? 0L : order.getCustomerId();
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {//层级1
// 海外仓归属发货人
......@@ -1181,35 +1187,24 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0));
customerType = 1;
} else {
if (consignorDO != null && !consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if (consignorDO != null) {
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0));
customerType = 1;
}
} else {
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && offerId != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0));
customerType = 1;
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
customerType = 1;
} else {
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
......@@ -1223,7 +1218,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : consigneeDO.getCustomerService());
customerType = 1;
} else {
//没有收货人
order.setCustomerId(0L);
......@@ -1231,7 +1225,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
customerType = 0;
}
} else if (order.getDrawee() == 3) { //自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
if (CollectionUtil.isNotEmpty(list)) {
......@@ -1239,35 +1232,27 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
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 (offerId != null && (order.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
customerType = 1;
} else if (offerId != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
customerType = 1;
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
customerType = 1;
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
customerType = 1;
} else {
//去掉层级5、6 ,以上不符合的都归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
......@@ -1275,12 +1260,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
customerType = 2;
}
}
} else {
//业绩归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
......@@ -1288,12 +1269,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
customerType = 2;
}
}
}
// 订单修改是否变动了归属客户,此字段用来判定订单是否需要重置归属客户经理,下单后归属客户的客户经理是固定的,除非订单归属客户变动,才需要重置客户经理
order.setIsChargeCustomer(!Objects.equals(order.getCustomerId(), orgCustomerId));
return customerType;
}
......@@ -1648,7 +1628,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 只有客户的客户经理被接收了才算有效
AdminUserRespDTO orgAdminUserRespDTO = adminUserApi.getUser(vo.getSalesmanId());
AdminUserRespDTO newAdminUserRespDTO = adminUserApi.getUser(customerDO.getCustomerService());
if (vo.getSalesmanId() != customerDO.getCustomerService()) {
if (!Objects.equals(vo.getSalesmanId(), customerDO.getCustomerService())) {
infoVO = new ApplyInfoVO();
infoVO.setName("订单业务经理变动/Change in Order Business Manager");
infoVO.setOrgValue(Objects.nonNull(orgAdminUserRespDTO) ? orgAdminUserRespDTO.getNickname() : "无");
......@@ -1660,8 +1640,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
} else if (Objects.isNull(currentOrderException) && Objects.nonNull(customerDO) && (Objects.isNull(customerDO.getCustomerService()) || !customerDO.getIsCustomerServiceConfirmed())) {
// 该订单不产生业绩归属
// vo.setSalesmanId(0L);
// vo.setDeptId(0L);
// 只有客户的客户经理被接收了才算有效
infoVO = new ApplyInfoVO();
AdminUserRespDTO orgAdminUserRespDTO = adminUserApi.getUser(vo.getSalesmanId());
......@@ -2968,6 +2946,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
List<ApplyInfoVO> applyInfoList,
OrderConsignorBackVO orderConsignorBackVO,
OrderConsigneeBackVO orderConsigneeBackVO) {
Long orgCustomerId = Objects.isNull(vo.getCustomerId()) ? 0L : vo.getCustomerId();
// TODO 客户归属变动时记录日志
if (!Objects.equals(vo.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
ApplyInfoVO infoVO = null;
......@@ -3035,8 +3014,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
// 订单所属客户变更,则需要变更业绩归属
// 更新所属客户经理(业务员)
if ((Objects.nonNull(vo.getCustomerId()) && vo.getCustomerId() > 0L) ||
((Objects.isNull(vo.getCustomerId()) || vo.getCustomerId() == 0L) && Objects.nonNull(vo.getSalesmanId()) && vo.getSalesmanId() > 0L)) {
// if ((Objects.nonNull(vo.getCustomerId()) && vo.getCustomerId() > 0L) ||
// ((Objects.isNull(vo.getCustomerId()) || vo.getCustomerId() == 0L) && Objects.nonNull(vo.getSalesmanId()) && vo.getSalesmanId() > 0L)) {
// 订单修改是否变动了归属客户,此字段用来判定订单是否需要重置归属客户经理,下单后归属客户的客户经理是固定的,除非订单归属客户变动,才需要重置客户经理
vo.setIsChargeCustomer(!Objects.equals(vo.getCustomerId(), orgCustomerId));
if (!Objects.equals(vo.getCustomerId(), orgCustomerId)) {
compareOrderCustomerService(vo, applyInfoList, customerType);
}
}
......
......@@ -587,6 +587,11 @@ public class OrderBackVO {
private Boolean isInOpenSea;
@ApiModelProperty(value = "订单修改是否变动了归属客户,此字段用来判定订单是否需要重置归属客户经理,下单后归属客户的客户经理是固定的,除非订单归属客户变动,才需要重置客户经理")
@TableField(exist = false)
private Boolean isChargeCustomer;
public void setExternalWarehouseJson(String externalWarehouseJson) {
this.externalWarehouseJson = externalWarehouseJson;
if (StringUtils.isNotBlank(externalWarehouseJson)) {
......
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