Commit 48fbaa1a authored by lanbaoming's avatar lanbaoming

2024-05-13新功能和运维BUG处理

parent ce9726ab
package cn.iocoder.yudao.framework.apollo.core.event.Customer;
import lombok.AllArgsConstructor;
import lombok.Data;
/*
lanbm 2024-05-07 添加公海捞取是计算客户类型
*/
@Data
public class CalculateCustomerTypeEvent {
/**
* 客户编码
*/
private String customerNumber;
/*
客户ID
*/
private Long customerId;
/*
新客户经理
*/
private Long oldCustomerService;
/*
老客户经理
*/
private Long newCustomerService;
/*
客户状态:1.线索2.意向3.成交
通过客户状态来判断客户是否是已成交客户
*/
private Integer status;
}
package cn.iocoder.yudao.framework.apollo.core.event.Order;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/*
lanbm 2024-05-13 add
计算订单V值
*/
@Data
public class CalculateOrderVValueEvent {
/*
订单id
*/
private Long orderId;
/*
根据体积或重量计算出的V值
*/
private BigDecimal calVvalue;
/*
业绩产生时间
*/
private Date yejiCreateDate;
}
package cn.iocoder.yudao.module.delivery.listener;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/*
lanbm 2024-05-07 add
*/
@Component("CalculateCustomerType")
@AllArgsConstructor
@Slf4j
public class CalculateCustomerType {
//监听公海捞取事件,计算客户是新客户类型还是老客户类型,此字段用户计算订单业绩类型
@Resource
private CustomerService customerService;
/**
* 客户捞取监听事件 lanbm 2024-05-07 add
* @param event
*/
@EventListener(CalculateCustomerTypeEvent.class)
public void CalculateCustomerTypePushEvent(
CalculateCustomerTypeEvent event) {
if (event.getNewCustomerService() == event.getOldCustomerService()) {
//新客户经理和老客户经理是同一客户经理
//继续判断有无成交记录
//有成交记录 客户业绩类型=老客户
//没成交记录 客户业绩类型=新客户
boolean bR = isHaving_TransactionRecords(event);
if (bR == true) {
//有成交记录
customerService.updateCustomerNewOrOld(event.getCustomerId(),
false);
} else {
//无成交记录
customerService.updateCustomerNewOrOld(event.getCustomerId(),
true);
}
} else {
//新客户经理和老客户经理不是同一客户经理
//客户业绩类型=新客户
customerService.updateCustomerNewOrOld(event.getCustomerId(), true);
}
}
/*
通过客户状态来判断有无成交记录
1.线索2.意向3.成交
*/
private boolean isHaving_TransactionRecords(CalculateCustomerTypeEvent event) {
if (event.getStatus() == 3)
return true;
else
return false;
}
}
......@@ -1527,10 +1527,12 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
List<Long> warehouseIdList;
if (countryId != null) {
List<WarehouseDO> warehouseList = warehouseService.findByCountryIdList(Collections.singletonList(countryId));
List<WarehouseDO> warehouseList =
warehouseService.findByCountryIdList(Collections.singletonList(countryId));
warehouseIdList = warehouseList.stream().map(WarehouseDO::getId).collect(Collectors.toList());
query.setWarehouseIdList(warehouseIdList);
}
//上面都是处理查询条件相关逻辑
return boxInfoQuery1(boxMapper.selectPage2(page, query), false);
}
......@@ -2292,7 +2294,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
.map(BoxBaseBackVO::getId)
.collect(Collectors.toList());
Map<Long, BoxGoodsStatistics> shipmentStatisticsMap = boxPreloadGoodsService.getBoxStatistics(idList);
//ecw_box_preload_goods 预装货物 lanbm 2024-05-13 添加注释
Map<Long, BoxGoodsStatistics> shipmentStatisticsMap =
boxPreloadGoodsService.getBoxStatistics(idList);
List<Long> cabinetIdList = boxBackList.stream()
.map(BoxBaseBackVO::getCabinetId)
......@@ -2301,6 +2305,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
Map<Long, CabinetDO> cabinetMap = new HashMap<>();
//ecw_cabinet 柜型配置 lanbm 2024-05-13 添加注释
if (CollectionUtils.isNotEmpty(cabinetIdList)) {
List<CabinetDO> cabinetDOList = cabinetService.getCabinetList(cabinetIdList);
cabinetMap = cabinetDOList.stream()
......@@ -2310,7 +2315,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
Set<Long> destWarehouseIdList = boxBackList.stream()
.map(BoxBaseBackVO::getDestWarehouseId)
.collect(Collectors.toSet());
List<WarehouseDO> warehouseDOList = warehouseService.getByIdList(new ArrayList<>(destWarehouseIdList));
//ecw_warehouse 仓库相关信息
List<WarehouseDO> warehouseDOList =
warehouseService.getByIdList(new ArrayList<>(destWarehouseIdList));
Map<Long, WarehouseDO> warehouseDOMap = warehouseDOList.stream()
.collect(Collectors.toMap(WarehouseDO::getId, v -> v));
......@@ -2340,22 +2347,28 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
//设置目的地
WarehouseDO destWarehouse = warehouseDOMap.get(boxBackVO.getDestWarehouseId());
WarehouseRespVO destWarehouseResp = WarehouseConvert.INSTANCE.convert(destWarehouse);
WarehouseDO destWarehouse =
warehouseDOMap.get(boxBackVO.getDestWarehouseId());
WarehouseRespVO destWarehouseResp =
WarehouseConvert.INSTANCE.convert(destWarehouse);
boxBackVO.setDestWarehouseResp(destWarehouseResp);
Long channelId = boxBackVO.getShippingChannelId();
if (channelId != null && channelId != 0) {
ChannelDO channelDO = channelMap.get(channelId);
boxBackVO.setChannelRespVO(ChannelConvert.INSTANCE.convert(channelDO));
boxBackVO.setChannelRespVO(ChannelConvert.INSTANCE.convert(
channelDO));
}
//统计信息
BoxGoodsStatistics boxStatistics = shipmentStatisticsMap.get(shipmentId);
//统计信息 lanbm2024-05-13 添加注释
BoxGoodsStatistics boxStatistics =
shipmentStatisticsMap.get(shipmentId);
boxBackVO.setBoxStatistics(boxStatistics);
if (searchDcDate) {
BoxCabinetUnloadDO boxCabinetUnloadDO = boxCabinetUnloadService.getOne(new LambdaQueryWrapperX<BoxCabinetUnloadDO>()
BoxCabinetUnloadDO boxCabinetUnloadDO =
boxCabinetUnloadService.getOne(
new LambdaQueryWrapperX<BoxCabinetUnloadDO>()
.eq(BoxCabinetUnloadDO::getShipmentId, shipmentId)
.last("limit 1")
);
......
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