Commit 42c7d102 authored by lanbaoming's avatar lanbaoming

2024-07-04-1提交

parent ba20d12a
...@@ -69,4 +69,6 @@ public class TargetLogDO extends BaseDO { ...@@ -69,4 +69,6 @@ public class TargetLogDO extends BaseDO {
* 部门id * 部门id
* */ * */
private Long deptId; private Long deptId;
private int loglev;
} }
...@@ -156,15 +156,22 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -156,15 +156,22 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
OrderDO orderDO = orderService.selectOne(OrderDO::getOrderNo, item); OrderDO orderDO = orderService.selectOne(OrderDO::getOrderNo, item);
TargetLogDO targetLogDO = targetLogMapper.selectOne(TargetLogDO::getOrderId, orderDO.getOrderId()); TargetLogDO targetLogDO = targetLogMapper.selectOne(TargetLogDO::getOrderId, orderDO.getOrderId());
if (targetLogDO == null) { if (targetLogDO == null) {
Date time = targetLogMapper.selectCabinetSealingTime(orderDO.getOrderId()); //获取装柜时间
Date time =
targetLogMapper.selectCabinetSealingTime(orderDO.getOrderId());
if (time != null) { if (time != null) {
dealTargetLog(orderDO.getOrderId(), time, TargetLogEnum.LOADING.getType()); dealTargetLog(orderDO.getOrderId(),
time,
TargetLogEnum.LOADING.getType());
} }
} }
}); });
} }
private void dealTargetLog(Long orderId, Date achievementTime, Integer type) { private void dealTargetLog(Long orderId,
Date achievementTime,
Integer type) {
long selectCount = targetLogMapper.selectCount(TargetLogDO::getOrderId, long selectCount = targetLogMapper.selectCount(TargetLogDO::getOrderId,
orderId); orderId);
if (selectCount > 0L) { if (selectCount > 0L) {
...@@ -173,9 +180,9 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -173,9 +180,9 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
OrderBackInfoDto info = orderQueryService.info(orderId); OrderBackInfoDto info = orderQueryService.info(orderId);
if (info != null && info.getSalesmanId() != null if (info != null && info.getSalesmanId() != null
&& info.getSalesmanId() > 0L) { && info.getSalesmanId() > 0L) {
//客户经理 //客户经理
Long customerId = 0L; Long customerId = 0L;
Long saleManid = info.getSalesmanId();
CustomerDO consignorDO = CustomerDO consignorDO =
customerService.getCustomer(info.getConsignorVO().getCustomerId()); customerService.getCustomer(info.getConsignorVO().getCustomerId());
//收货人 //收货人
...@@ -185,6 +192,14 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -185,6 +192,14 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//海外仓归属发货人 //海外仓归属发货人
//customerId = info.getConsignorVO().getCustomerId(); //二期需求修改 //customerId = info.getConsignorVO().getCustomerId(); //二期需求修改
customerId = consignorDO.getId(); customerId = consignorDO.getId();
//客户的客户经理为空,就把业绩归属设为0
if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0 ||
consignorDO.getIsInOpenSea() == true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} else { } else {
OrderConsigneeDO orderConsigneeDO = OrderConsigneeDO orderConsigneeDO =
orderConsigneeService.getOne( orderConsigneeService.getOne(
...@@ -193,9 +208,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -193,9 +208,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
orderConsignorService.getOne( orderConsignorService.getOne(
new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, info.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1")); new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, info.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
if (info.getIsCargoControl()) {
customerId = info.getConsignorVO().getCustomerId();
} else {
if (consignorDO != null && !consignorDO.getNoConsignee() if (consignorDO != null && !consignorDO.getNoConsignee()
&& !info.getHasConsignee()) { && !info.getHasConsignee()) {
//getHasConsignee 是否有收货人 //getHasConsignee 是否有收货人
...@@ -243,7 +256,8 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -243,7 +256,8 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
} 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());
...@@ -251,18 +265,25 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -251,18 +265,25 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
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)) { if (CollectionUtil.isNotEmpty(offerBackVOList) &&
(info.getDrawee() == 3 && freight == 1)) {
//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费 //层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
customerId = orderConsignorDO.getCustomerId(); customerId = orderConsignorDO.getCustomerId();
} else if (CollectionUtil.isNotEmpty(offerBackVOList) && (info.getDrawee() == 3 && clearanceFee == 1)) { } else if (CollectionUtil.isNotEmpty(offerBackVOList) &&
(info.getDrawee() == 3 && clearanceFee == 1)) {
//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费 //层级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 { } else {
...@@ -287,7 +308,6 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -287,7 +308,6 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
} }
} }
}
TargetLogDO targetLogDO = new TargetLogDO(); TargetLogDO targetLogDO = new TargetLogDO();
targetLogDO.setOrderId(orderId); targetLogDO.setOrderId(orderId);
targetLogDO.setCustomerId(customerId); targetLogDO.setCustomerId(customerId);
...@@ -332,6 +352,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -332,6 +352,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//客户经理 //客户经理
Long customerId = 0L; Long customerId = 0L;
Long saleManid = info.getSalesmanId(); Long saleManid = info.getSalesmanId();
int loglev=0;
CustomerDO consignorDO = CustomerDO consignorDO =
customerService.getCustomer(info.getConsignorVO().getCustomerId()); customerService.getCustomer(info.getConsignorVO().getCustomerId());
...@@ -348,12 +369,14 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -348,12 +369,14 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
customerId = consignorDO.getId(); customerId = consignorDO.getId();
//客户的客户经理为空,就把业绩归属设为0 //客户的客户经理为空,就把业绩归属设为0
if (consignorDO.getCustomerService() == null || if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0|| consignorDO.getCustomerService() == 0 ||
consignorDO.getIsInOpenSea()==true) { consignorDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=11;
} }
loglev=1;
} else { } else {
OrderConsigneeDO orderConsigneeDO = OrderConsigneeDO orderConsigneeDO =
...@@ -376,13 +399,16 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -376,13 +399,16 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 //发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if (consignorDO != null) { if (consignorDO != null) {
customerId = consignorDO.getId(); customerId = consignorDO.getId();
loglev=2;
//校验客户的客户经理 //校验客户的客户经理
if (consignorDO.getCustomerService() == null || if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0|| consignorDO.getCustomerService() == 0 ||
consignorDO.getIsInOpenSea()==true) { consignorDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=21;
} }
} }
...@@ -407,36 +433,42 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -407,36 +433,42 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
if (CollectionUtil.isNotEmpty(offerBackVOList)) { if (CollectionUtil.isNotEmpty(offerBackVOList)) {
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个 //如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
customerId = consignorDO.getId(); customerId = consignorDO.getId();
loglev=3;
//校验客户的客户经理 //校验客户的客户经理
if (consignorDO.getCustomerService() == null || if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0|| consignorDO.getCustomerService() == 0 ||
consignorDO.getIsInOpenSea()==true) { consignorDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=31;
} }
} else { } else {
if (consignorDO.getDefaultPay()) { if (consignorDO.getDefaultPay()) {
//如果是发货人付款且档案设置默认付运费 --层级4 第一个 //如果是发货人付款且档案设置默认付运费 --层级4 第一个
customerId = consignorDO.getId(); customerId = consignorDO.getId();
loglev=4;
//校验客户的客户经理 //校验客户的客户经理
if (consignorDO.getCustomerService() == null || if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0|| consignorDO.getCustomerService() == 0 ||
consignorDO.getIsInOpenSea()==true) { consignorDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=41;
} }
} else { } else {
//业绩归属方是收货人 //业绩归属方是收货人
loglev=5;
customerId = orderConsigneeDO.getCustomerId(); customerId = orderConsigneeDO.getCustomerId();
//校验客户的客户经理 //校验客户的客户经理
if (consigneeDO.getCustomerService() == null || if (consigneeDO.getCustomerService() == null ||
consigneeDO.getCustomerService() == 0|| consigneeDO.getCustomerService() == 0 ||
consigneeDO.getIsInOpenSea()==true) { consigneeDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=51;
} }
} }
} }
...@@ -445,7 +477,11 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -445,7 +477,11 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//收货人付款 层级5 第一个 //收货人付款 层级5 第一个
customerId = orderConsigneeDO.getCustomerId() != null ? customerId = orderConsigneeDO.getCustomerId() != null ?
orderConsigneeDO.getCustomerId() : consigneeDO.getId(); orderConsigneeDO.getCustomerId() : consigneeDO.getId();
if (consigneeDO != null) { loglev=5;
if (consigneeDO != null &&
(consigneeDO.getCustomerService() == null ||
consigneeDO.getCustomerService() == 0)) {
//收货人客户经理为空时不算业绩
//客户来源是发货人推荐,不保留业绩记录 customer_source //客户来源是发货人推荐,不保留业绩记录 customer_source
//2024-06-03 添加的逻辑 //2024-06-03 添加的逻辑
if (consigneeDO.getSource() == 12) { if (consigneeDO.getSource() == 12) {
...@@ -476,65 +512,74 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -476,65 +512,74 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
(info.getDrawee() == 3 && freight == 1)) { (info.getDrawee() == 3 && freight == 1)) {
//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费 //层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
customerId = orderConsignorDO.getCustomerId(); customerId = orderConsignorDO.getCustomerId();
loglev=3;
//校验客户的客户经理 //校验客户的客户经理
if (consignorDO.getCustomerService() == null || if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0|| consignorDO.getCustomerService() == 0 ||
consignorDO.getIsInOpenSea()==true) { consignorDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=31;
} }
} else if (CollectionUtil.isNotEmpty(offerBackVOList) } else if (CollectionUtil.isNotEmpty(offerBackVOList)
&& (info.getDrawee() == 3 && clearanceFee == 1)) { && (info.getDrawee() == 3 && clearanceFee == 1)) {
//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费 //层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
customerId = orderConsignorDO.getCustomerId(); customerId = orderConsignorDO.getCustomerId();
loglev=3;
//校验客户的客户经理 //校验客户的客户经理
if (consignorDO.getCustomerService() == null || if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0|| consignorDO.getCustomerService() == 0 ||
consignorDO.getIsInOpenSea()==true) { consignorDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=32;
} }
} else if (consignorDO.getDefaultPay() && } else if (consignorDO.getDefaultPay() &&
(info.getDrawee() == 3 && freight == 1)) { (info.getDrawee() == 3 && freight == 1)) {
//层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人 //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
customerId = orderConsignorDO.getCustomerId(); customerId = orderConsignorDO.getCustomerId();
loglev=3;
//校验客户的客户经理 //校验客户的客户经理
if (consignorDO.getCustomerService() == null || if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0|| consignorDO.getCustomerService() == 0 ||
consignorDO.getIsInOpenSea()==true) { consignorDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=33;
} }
} else if (consignorDO.getDefaultPay() && } else if (consignorDO.getDefaultPay() &&
(info.getDrawee() == 3 (info.getDrawee() == 3
&& clearanceFee == 1)) { && clearanceFee == 1)) {
// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人 // 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
loglev=4;
customerId = orderConsignorDO.getCustomerId(); customerId = orderConsignorDO.getCustomerId();
//校验客户的客户经理 //校验客户的客户经理
if (consignorDO.getCustomerService() == null || if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0|| consignorDO.getCustomerService() == 0 ||
consignorDO.getIsInOpenSea()==true) { consignorDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=1;
} }
} else { } else {
customerId = orderConsigneeDO.getCustomerId(); customerId = orderConsigneeDO.getCustomerId();
loglev=5;
//校验客户的客户经理 //校验客户的客户经理
if (consigneeDO.getCustomerService() == null || if (consigneeDO.getCustomerService() == null ||
consigneeDO.getCustomerService() == 0|| consigneeDO.getCustomerService() == 0 ||
consigneeDO.getIsInOpenSea()==true) { consigneeDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=51;
} }
} }
// if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人 // if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
...@@ -551,14 +596,16 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -551,14 +596,16 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() != null ?
orderConsigneeDO.getCustomerId() : 0; orderConsigneeDO.getCustomerId() : 0;
loglev=5;
//校验客户的客户经理 //校验客户的客户经理
if (consigneeDO != null) { if (consigneeDO != null) {
if (consigneeDO.getCustomerService() == null || if (consigneeDO.getCustomerService() == null ||
consigneeDO.getCustomerService() == 0|| consigneeDO.getCustomerService() == 0 ||
consigneeDO.getIsInOpenSea()==true) { consigneeDO.getIsInOpenSea() == true) {
saleManid = 0L; saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(), orderService.updateOrderSalesmanId(info.getOrderId(),
0L); 0L);
loglev=52;
} }
} }
} }
...@@ -573,7 +620,6 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -573,7 +620,6 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
targetLogDO.setUserId(saleManid); targetLogDO.setUserId(saleManid);
targetLogDO.setUpdateTime(new Date()); targetLogDO.setUpdateTime(new Date());
targetLogMapper.updateById(targetLogDO); targetLogMapper.updateById(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