Commit 57305141 authored by lanbaoming's avatar lanbaoming

2024-07-02提交

parent 0d9f8ec0
......@@ -41,5 +41,20 @@
<version>${revision}</version>
</dependency>
<!--财务模块依赖-->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-wealth-core</artifactId>
<version>${revision}</version>
</dependency>
<!--产品模块依赖-->
<!--
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-product-core</artifactId>
<version>${revision}</version>
</dependency>-->
</dependencies>
</project>
......@@ -2570,7 +2570,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
// 当新客户(已有已装柜订单)分配给其他客户经理,客户经理接收后,业绩类型变成老客户
// 其他情况不需更新注:业绩类型只会从新客户更新到老客户,不反向更新
if (Boolean.TRUE.equals(customer.getIsNew())) {
//根据部门业绩日志表中的信息把新客户变为老客户 lanbm 2024-05-08 添加注释
//根据部门业绩日志表中的信息把新客户变为老客户
//ecw_target_log 部门业绩日志表
customerMapper.updateCustomerIsNewToOldByTargetLog(customerId);
}
......@@ -2593,7 +2593,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
//分配确认接收回调
applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId, customerService));
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
//添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO customer2 = customerMapper.selectById(customerId);
ReceiveCustomerCalTypeEvent event = new ReceiveCustomerCalTypeEvent();
......
......@@ -44,7 +44,9 @@ import static cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants.LEVEL_LO
@Slf4j
@Service
@Validated
public class CustomerLevelLogServiceImpl extends AbstractService<CustomerLevelLogMapper, CustomerLevelLogDO> implements CustomerLevelLogService {
public class CustomerLevelLogServiceImpl extends
AbstractService<CustomerLevelLogMapper, CustomerLevelLogDO>
implements CustomerLevelLogService {
@Resource
private CustomerLevelLogMapper levelLogMapper;
......
package cn.iocoder.yudao.module.customer.vo.customer.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ApiModel("管理后台 - 客户 Response VO")
@Data
@ToString(callSuper = true)
public class CustomerMerge {
@ApiModelProperty(value = "id1")
private Long id1;
@ApiModelProperty(value = "id2")
private Long id2;
}
......@@ -24,6 +24,11 @@
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-sale-core</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
</project>
......@@ -49,7 +49,8 @@ public class CustomerDetailController {
@GetMapping("/offerPage")
@ApiOperation("获取报价分页")
public CommonResult<PageResult<CustomerOfferBackVo>> getOfferPage(@RequestParam("customerId") Long customerId, PageParam page) {
PageResult<CustomerOfferBackVo> pageResult = customerDetailService.getCustomerOfferPage(customerId, page);
PageResult<CustomerOfferBackVo> pageResult =
customerDetailService.getCustomerOfferPage(customerId, page);
return success(pageResult);
}
......@@ -81,7 +82,8 @@ public class CustomerDetailController {
@GetMapping("/receiptPage")
@ApiOperation("获取账单分页")
public CommonResult<PageResult<CustomerReceivableBackVO>> getReceiptPage(@RequestParam("customerId") Long customerId, PageParam page) {
PageResult<CustomerReceivableBackVO> pageResult = customerDetailService.getReceiptPage(customerId, page);
PageResult<CustomerReceivableBackVO> pageResult =
customerDetailService.getReceiptPage(customerId, page);
return success(pageResult);
}
......@@ -90,7 +92,8 @@ public class CustomerDetailController {
@ApiOperation("获取跟进分页")
@ApiImplicitParam(name = "customerId", value = "客户ID", required = true, dataType = "Long")
public CommonResult<PageResult<CustomerFollowBackVo>> getFollwPage(@RequestParam("customerId") Long customerId, PageParam page) {
PageResult<CustomerFollowBackVo> pageResult = customerDetailService.getFollowPage(customerId, page);
PageResult<CustomerFollowBackVo> pageResult =
customerDetailService.getFollowPage(customerId, page);
return success(pageResult);
}
......@@ -103,7 +106,8 @@ public class CustomerDetailController {
@GetMapping("/levelLogPage")
@ApiOperation("获得客户等级日志分页")
public CommonResult<PageResult<CustomerLevelLogBackVO>> getLevelLogPage(@RequestParam("customerId") Long customerId, PageParam page) {
public CommonResult<PageResult<CustomerLevelLogBackVO>> getLevelLogPage(
@RequestParam("customerId") Long customerId, PageParam page) {
return success(customerLevelLogService.getLevelLogPage(customerId, page));
}
......
......@@ -69,4 +69,13 @@ public interface TargetLogMapper extends AbstractMapper<TargetLogDO> {
"</script>"
})
List<TargetOfferBackVO> getTargetOfferBackByOrerId(Long orderId);
@Select({
"<script>",
"select * from ecw_target_log where deleted=0 and DATE_FORMAT(create_time,'%Y-%m')='2024-06'",
"</script>"
})
List<TargetLogDO> selectList2();
}
......@@ -961,25 +961,41 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
private void addOrderSalesmanCustomerService(OrderDO order) {
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
CustomerDO consignorDO = customerService.getCustomer(orderConsignorDO.getCustomerId());
CustomerDO consigneeDO = customerService.getCustomer(orderConsigneeDO.getCustomerId());//收货人
OrderConsigneeDO orderConsigneeDO =
orderConsigneeService.getOne(
new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
OrderConsignorDO orderConsignorDO =
orderConsignorService.getOne(
new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
CustomerDO consignorDO =
customerService.getCustomer(orderConsignorDO.getCustomerId());
CustomerDO consigneeDO =
customerService.getCustomer(orderConsigneeDO.getCustomerId());
//收货人
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {
// 海外仓归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
if (consignorDO != null && !consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if (consignorDO != null && !consignorDO.getNoConsignee() &&
!order.getHasConsignee()) {
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if (consignorDO != null) {
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
}
} else {
List<TargetOfferBackVO> offerBackVOList = targetLogMapper.getTargetOfferBackByOrerId(order.getOrderId());
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && CollectionUtil.isNotEmpty(offerBackVOList)) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
List<TargetOfferBackVO> offerBackVOList =
targetLogMapper.getTargetOfferBackByOrerId(order.getOrderId());
if (order.getDrawee() == 1) {
//发货人付款
if (order.getDrawee() == 1 &&
CollectionUtil.isNotEmpty(offerBackVOList)) {
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
......@@ -992,14 +1008,16 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
} else if (order.getDrawee() == 2) {
//收货人付款 层级5 第一个
if (consigneeDO != null) {
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService());
} else {
order.setSalesmanId(0L);
}
} else if (order.getDrawee() == 3) { //自定义付款
} else if (order.getDrawee() == 3) {
//自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
if (CollectionUtil.isNotEmpty(list)) {
......@@ -1065,7 +1083,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
CustomerDO consignorDO = customerService.getCustomer(orderConsignorDO.getCustomerId());
CustomerDO consigneeDO = customerService.getCustomer(orderConsigneeDO.getCustomerId());//收货人
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {//层级1
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {
//层级1
// 海外仓归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
......@@ -1078,7 +1097,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} else {
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1) {
//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
......@@ -1103,9 +1123,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setSalesmanId(0L);
// order.setSalesmanId(0L);
}
} else if (order.getDrawee() == 3) { //自定义付款
} else if (order.getDrawee() == 3) {
//自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
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());
......@@ -1418,7 +1440,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
}
private void setAddOrderCustomerServiceCustomerId(OrderCreateReqVO createReqVO, OrderDO order, CustomerDO consignorDO, CustomerDO consigneeDO, OrderConsignorDO orderConsignorDO, OrderConsigneeDO orderConsigneeDO) {
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());
......
......@@ -16,6 +16,9 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
*/
public interface TargetLogService extends IService<TargetLogDO> {
//批量处理业绩归属问题
public void dealTargetLogTask(Long orderId, Date achievementTime, long targetId);
/**
* 创建部门业绩日志
* @param createReqVO 创建信息
......@@ -35,6 +38,8 @@ public interface TargetLogService extends IService<TargetLogDO> {
*/
void deleteTargetLog(Long id);
List<TargetLogDO> selectList2();
/**
* 获得部门业绩日志
* @param id 编号
......
package cn.iocoder.yudao.module.order.task;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.order.dal.dataobject.order.zTest;
import cn.iocoder.yudao.module.order.dal.dataobject.targetLog.TargetLogDO;
import cn.iocoder.yudao.module.order.dal.mysql.order.ZTestMapper2;
import cn.iocoder.yudao.module.order.service.targetLog.TargetLogServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Component
@TenantJob
@Slf4j
public class TargetLogJob implements JobHandler {
@Resource
ZTestMapper2 zTestMapper2;
@Resource
TargetLogServiceImpl targetLogService;
@Override
public String execute(String param) throws Exception {
int var1 = 30;
int var2 = 3;
int var3 = 6;
if (StringUtils.isNotBlank(param)) {
String[] vars = param.split(StrUtil.COMMA);
if (vars.length > 0) {
var1 = Integer.parseInt(vars[0]);
}
if (vars.length > 1) {
var2 = Integer.parseInt(vars[1]);
}
if (vars.length > 2) {
var3 = Integer.parseInt(vars[2]);
}
}
zTest m = new zTest();
m.setTestname("开始计算业绩归属");
m.setCreatedate(new Date());
zTestMapper2.insert(m);
//System.out.println("定时任务参数:" + param);
List<TargetLogDO> list = targetLogService.selectList2();
if (CollectionUtil.isNotEmpty(list)) {
for (TargetLogDO t : list
) {
targetLogService.dealTargetLogTask(t.getOrderId(),
null, t.getId());
}
}
zTest m2 = new zTest();
m2.setTestname("业绩归属计算完毕");
m2.setCreatedate(new Date());
zTestMapper2.insert(m2);
return "";
}
}
......@@ -303,7 +303,8 @@ public class ProductBrankServiceImpl extends AbstractService<ProductBrankMapper,
if (total == null) {
total = 0L;
}
List<ProductBrandMyEmpowerRespVO> list = productBrandEmpowerMapper.getBrankByCustomer(pageReqVO);
List<ProductBrandMyEmpowerRespVO> list =
productBrandEmpowerMapper.getBrankByCustomer(pageReqVO);
if (list == null) {
list = new ArrayList<>();
}
......
......@@ -171,8 +171,10 @@ public class ProductBrankController {
@PostMapping("/getBrankByCustomer")
@ApiOperation("查看某客户授权的品牌")
//@PreAuthorize("@ss.hasPermission('ecw:product-brank:query')")
public CommonResult<PageResult<ProductBrandMyEmpowerRespVO>> getBrankByCustomer(@Valid @RequestBody ProductBrankByCustomerPageReqVO createReqVO) {
PageResult<ProductBrandMyEmpowerRespVO> pageResult =productBrankService.getBrankByCustomer(createReqVO);
public CommonResult<PageResult<ProductBrandMyEmpowerRespVO>> getBrankByCustomer(
@Valid @RequestBody ProductBrankByCustomerPageReqVO createReqVO) {
PageResult<ProductBrandMyEmpowerRespVO> pageResult =
productBrankService.getBrankByCustomer(createReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
......
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