Commit 22b65ba4 authored by 332784038@qq.com's avatar 332784038@qq.com

客户经理未接收时下单不算业绩

parent 72f01e8d
......@@ -1186,30 +1186,30 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
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));
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null && consignorDO.getIsCustomerServiceConfirmed()? consignorDO.getCustomerService() : 0));
} else {
if (consignorDO != null && !consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
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));
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null && consignorDO.getIsCustomerServiceConfirmed()? consignorDO.getCustomerService() : 0));
} 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));
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null && consignorDO.getIsCustomerServiceConfirmed()? consignorDO.getCustomerService() : 0));
} 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());
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null && consignorDO.getIsCustomerServiceConfirmed()? consignorDO.getCustomerService() : 0));
} else {
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(Objects.nonNull(consigneeDO.getIsInOpenSea()) && consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
order.setSalesmanId(Objects.nonNull(consigneeDO.getIsInOpenSea()) && consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null && consigneeDO.getIsCustomerServiceConfirmed()? consigneeDO.getCustomerService() : 0));
customerType = 2;
}
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
......@@ -1217,7 +1217,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(Objects.nonNull(consigneeDO.getIsInOpenSea()) && consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
order.setSalesmanId(Objects.nonNull(consigneeDO.getIsInOpenSea()) && consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null && consigneeDO.getIsCustomerServiceConfirmed()? consigneeDO.getCustomerService() : 0));
} else {
//没有收货人
order.setCustomerId(0L);
......@@ -1236,29 +1236,29 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setIsInOpenSea(consignorDO.getIsInOpenSea());
order.setYejiType(consignorDO.getIsNew() ? 1 : 0);
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : consignorDO.getCustomerService());
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null && consignorDO.getIsCustomerServiceConfirmed()? consignorDO.getCustomerService() : 0));
} 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());
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null && consignorDO.getIsCustomerServiceConfirmed()? consignorDO.getCustomerService() : 0));
} 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());
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null && consignorDO.getIsCustomerServiceConfirmed()? consignorDO.getCustomerService() : 0));
} 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());
order.setSalesmanId(consignorDO.getIsInOpenSea() ? 0L : (consignorDO.getCustomerService() != null && consignorDO.getIsCustomerServiceConfirmed()? consignorDO.getCustomerService() : 0));
} else {
//去掉层级5、6 ,以上不符合的都归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(Objects.nonNull(consigneeDO.getIsInOpenSea()) && consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
order.setSalesmanId(Objects.nonNull(consigneeDO.getIsInOpenSea()) && consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null && consigneeDO.getIsCustomerServiceConfirmed()? consigneeDO.getCustomerService() : 0));
customerType = 2;
}
}
......@@ -1267,7 +1267,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setIsInOpenSea(consigneeDO.getIsInOpenSea());
order.setYejiType(consigneeDO.getIsNew() ? 1 : 0);
order.setSalesmanId(Objects.nonNull(consigneeDO.getIsInOpenSea()) && consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0));
order.setSalesmanId(Objects.nonNull(consigneeDO.getIsInOpenSea()) && consigneeDO.getIsInOpenSea() ? 0L : (consigneeDO.getCustomerService() != null && consigneeDO.getIsCustomerServiceConfirmed()? consigneeDO.getCustomerService() : 0));
customerType = 2;
}
}
......@@ -1478,142 +1478,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
}
private void setAddOrderCustomerServiceCustomerId(
OrderCreateReqVO createReqVO, OrderDO order,
CustomerDO consignorDO, CustomerDO consigneeDO,
OrderConsignorDO orderConsignorDO,
OrderConsigneeDO orderConsigneeDO) {
// 补充业绩规则判断
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) { //如果是海外仓
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
if (!consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
}
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
}
} else if (order.getDrawee() == 2 && createReqVO.getOfferId() == null && !consignorDO.getDefaultPay()) {//收货人付款 层级5 第一个
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
} 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(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (!consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 2) || (order.getDrawee() == 3 && clearanceFee == 2)) {//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
}
} else {
//业绩归属公司
order.setSalesmanId(0L);
}
}
}
private void setUpdateOrderCustomerServiceCustomerId(OrderUpdateReqVO createReqVO, OrderDO order, CustomerDO consignorDO, CustomerDO consigneeDO, OrderConsignorDO orderConsignorDO, OrderConsigneeDO orderConsigneeDO) {
// 补充业绩规则判断
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) { //如果是海外仓
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
if (!consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
}
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
//业绩归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
} 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(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
//去掉层级5、6 ,如果都不符合条件,归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
// if(!consignorDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
// order.setCustomerId(orderConsigneeDO.getCustomerId());
// order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
// }
}
} else {
//业绩归属收获人
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
}
}
private void compareOrderCustomerService(OrderBackVO vo, List<ApplyInfoVO> applyInfoList, int customerType) {
// TODO 判断该订单、该客户是否有未分配客户异常,如果有,则这个订单不计算业绩
List<OrderExceptionDO> orderExceptionDOList = orderExceptionService.getOrderExceptionByCustomerId(vo.getCustomerId());
......
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