Commit 870c4269 authored by lanbaoming's avatar lanbaoming

2024-05-22-3 提交

parent 792c22e8
package cn.iocoder.yudao.module.delivery.controller.admin; package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.delivery.entity.EcwVz; import cn.iocoder.yudao.module.delivery.entity.EcwVz;
import cn.iocoder.yudao.module.delivery.entity.EcwVzPageReq; import cn.iocoder.yudao.module.delivery.entity.EcwVzPageReq;
...@@ -8,9 +9,13 @@ import cn.iocoder.yudao.module.delivery.listener.TestEvent; ...@@ -8,9 +9,13 @@ import cn.iocoder.yudao.module.delivery.listener.TestEvent;
import cn.iocoder.yudao.module.delivery.service.EcwVzService; import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.delivery.service.OrderServiceExt;
import cn.iocoder.yudao.module.delivery.service.ZTestService; import cn.iocoder.yudao.module.delivery.service.ZTestService;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -22,6 +27,7 @@ import javax.validation.*; ...@@ -22,6 +27,7 @@ import javax.validation.*;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -44,6 +50,12 @@ public class EcwVzController { ...@@ -44,6 +50,12 @@ public class EcwVzController {
@Resource @Resource
private ZTestService zTestService; private ZTestService zTestService;
@Autowired
private OrderService orderService;
@Resource
private OrderServiceExt orderServiceExt;
@Resource @Resource
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
...@@ -144,10 +156,25 @@ public class EcwVzController { ...@@ -144,10 +156,25 @@ public class EcwVzController {
applicationContext.publishEvent(even); applicationContext.publishEvent(even);
*/ */
zTest m=new zTest();
m.setTestname("111"); zTest m = new zTest();
m.setCreatedate(new Date());
zTestService.save(m); orderService.UpdateOrderYeJiType((long) 1, 1);
orderService.UpdateOrderVValue((long) 1, new BigDecimal(101), new Date());
ReceiveCustomerCalTypeEvent e = new ReceiveCustomerCalTypeEvent();
e.setCustomerId((long) 49345);
if (orderServiceExt.IsHavingOrder(e) == 0) {
m.setTestname("无业绩");
m.setCreatedate(new Date());
zTestService.save(m);
} else {
m.setTestname("有业绩");
m.setCreatedate(new Date());
zTestService.save(m);
}
return success(true); return success(true);
} }
......
...@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.delivery.listener; ...@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.delivery.listener;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent; import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService; import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.delivery.entity.deptex.zTest; import cn.iocoder.yudao.module.delivery.entity.deptex.zTest;
import cn.iocoder.yudao.module.delivery.service.OrderServiceExt;
import cn.iocoder.yudao.module.delivery.service.ZTestService; import cn.iocoder.yudao.module.delivery.service.ZTestService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -26,6 +27,10 @@ public class CalculateCustomerType { ...@@ -26,6 +27,10 @@ public class CalculateCustomerType {
@Resource @Resource
private ZTestService zTestService; private ZTestService zTestService;
@Resource
private OrderServiceExt orderServiceExt;
/** /**
* 客户捞取监听事件 lanbm 2024-05-07 add * 客户捞取监听事件 lanbm 2024-05-07 add
* @param event * @param event
...@@ -34,7 +39,7 @@ public class CalculateCustomerType { ...@@ -34,7 +39,7 @@ public class CalculateCustomerType {
public void CalculateCustomerTypePushEvent( public void CalculateCustomerTypePushEvent(
CalculateCustomerTypeEvent event) { CalculateCustomerTypeEvent event) {
zTest m=new zTest(); zTest m=new zTest();
String sMsg="计算开始"; String sMsg="计算开始"+event.getCustomerId();
if (event.getNewCustomerService() == event.getOldCustomerService()) { if (event.getNewCustomerService() == event.getOldCustomerService()) {
//新客户经理和老客户经理是同一客户经理 //新客户经理和老客户经理是同一客户经理
//继续判断有无成交记录 //继续判断有无成交记录
...@@ -72,9 +77,13 @@ public class CalculateCustomerType { ...@@ -72,9 +77,13 @@ public class CalculateCustomerType {
1.线索2.意向3.成交 1.线索2.意向3.成交
*/ */
private boolean isHaving_TransactionRecords(CalculateCustomerTypeEvent event) { private boolean isHaving_TransactionRecords(CalculateCustomerTypeEvent event) {
if (event.getStatus() == 3)
return true; int c=orderServiceExt.IsHavingOrder(event);
else if (c==0)
return false; return false;
else
return true;
} }
} }
...@@ -45,7 +45,7 @@ public class CalculateOrderYeJiTypeListener { ...@@ -45,7 +45,7 @@ public class CalculateOrderYeJiTypeListener {
CalculateOrderYeJiTypeEvent event) { CalculateOrderYeJiTypeEvent event) {
zTest m=new zTest(); zTest m=new zTest();
String sMsg="计算业绩类型"; String sMsg="计算业绩类型"+event.getCustomerId();
OrderDO orderDO = orderService.getById(event.getOrderId()); OrderDO orderDO = orderService.getById(event.getOrderId());
if (orderDO == null) { if (orderDO == null) {
......
...@@ -39,7 +39,7 @@ public class ReceiveCustomerCalTypeListener { ...@@ -39,7 +39,7 @@ public class ReceiveCustomerCalTypeListener {
//CustomerServiceImpl receiveCustomer 函数中触发,移交,系统分配,接收时判断 //CustomerServiceImpl receiveCustomer 函数中触发,移交,系统分配,接收时判断
//CustomerServiceImpl updateCustomer 函数中触发,完善客户信息 //CustomerServiceImpl updateCustomer 函数中触发,完善客户信息
zTest m=new zTest(); zTest m=new zTest();
String sMsg="接收客户"; String sMsg="接收客户"+event.getCustomerId();
if (event.getIsNew() == true) { if (event.getIsNew() == true) {
//移交接收前是新客户 //移交接收前是新客户
sMsg+=",新客户"; sMsg+=",新客户";
...@@ -67,11 +67,10 @@ public class ReceiveCustomerCalTypeListener { ...@@ -67,11 +67,10 @@ public class ReceiveCustomerCalTypeListener {
/* /*
判断客户是否有已入参订单 判断客户是否有已入参订单
select COUNT(id) from ecw_target_log where deleted = 0 and customer_id = 17442 select COUNT(id) from ecw_target_log where deleted = 0 and customer_id = 17442
需要在2个表中查询数据
*/ */
private boolean IsHavingRuCanOrder(ReceiveCustomerCalTypeEvent event) { private boolean IsHavingRuCanOrder(ReceiveCustomerCalTypeEvent event) {
//判断客户是否有已入参订单 //判断客户是否有已入参订单
//int a = orderServiceExt.IsHavingOrderConsignee(event);//收货方客户
//int b = orderServiceExt.IsHavingOrderConsignor(event);//发货方客户
int c=orderServiceExt.IsHavingOrder(event); int c=orderServiceExt.IsHavingOrder(event);
if (c==0) if (c==0)
return false; return false;
......
package cn.iocoder.yudao.module.delivery.mapper; package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent; import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent;
import cn.iocoder.yudao.module.delivery.entity.orderdata.OrderExt; import cn.iocoder.yudao.module.delivery.entity.orderdata.OrderExt;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -21,4 +22,6 @@ public interface OrderExtMapper { ...@@ -21,4 +22,6 @@ public interface OrderExtMapper {
*/ */
int IsHavingOrder(ReceiveCustomerCalTypeEvent event); int IsHavingOrder(ReceiveCustomerCalTypeEvent event);
int IsHavingOrder(CalculateCustomerTypeEvent event);
} }
package cn.iocoder.yudao.module.delivery.service.Impl; package cn.iocoder.yudao.module.delivery.service.Impl;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent; import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent;
import cn.iocoder.yudao.module.delivery.entity.orderdata.OrderExt; import cn.iocoder.yudao.module.delivery.entity.orderdata.OrderExt;
import cn.iocoder.yudao.module.delivery.mapper.OrderExtMapper; import cn.iocoder.yudao.module.delivery.mapper.OrderExtMapper;
...@@ -38,4 +39,8 @@ public class OrderServiceExtImpl implements OrderServiceExt { ...@@ -38,4 +39,8 @@ public class OrderServiceExtImpl implements OrderServiceExt {
return orderExtMapper.IsHavingOrder(event); return orderExtMapper.IsHavingOrder(event);
} }
public int IsHavingOrder(CalculateCustomerTypeEvent event) {
return orderExtMapper.IsHavingOrder(event);
}
} }
package cn.iocoder.yudao.module.delivery.service; package cn.iocoder.yudao.module.delivery.service;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent; import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent;
//import cn.iocoder.yudao.module.delivery.entity.orderdata.OrderExt; //import cn.iocoder.yudao.module.delivery.entity.orderdata.OrderExt;
...@@ -24,4 +25,6 @@ public interface OrderServiceExt { ...@@ -24,4 +25,6 @@ public interface OrderServiceExt {
*/ */
int IsHavingOrder(ReceiveCustomerCalTypeEvent event); int IsHavingOrder(ReceiveCustomerCalTypeEvent event);
int IsHavingOrder(CalculateCustomerTypeEvent event);
} }
...@@ -28,10 +28,17 @@ ...@@ -28,10 +28,17 @@
<select id="IsHavingOrder" resultType="java.lang.Integer"> <select id="IsHavingOrder" resultType="java.lang.Integer">
select COUNT(id) SELECT COUNT(*)
from ecw_target_log from (
where deleted = 0 select id as id
and customer_id = #{customerId} from ecw_target_log
where deleted = 0
and customer_id = #{customerId}
UNION
SELECT order_id as id
from ecw_order
where deleted = 0
and customer_id = #{customerId}) as a
</select> </select>
......
...@@ -6003,7 +6003,8 @@ public interface OrderMapper extends AbstractMapper<OrderDO> { ...@@ -6003,7 +6003,8 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
lanbm 2024-05-13 add lanbm 2024-05-13 add
*/ */
@Update("update ecw_order set yeji_type=#{yejiType} where order_id = #{orderId}") @Update("update ecw_order set yeji_type=#{yejiType} where order_id = #{orderId}")
void UpdateOrderYeJiType(@Param("orderId") Long orderId,int yejiType); void UpdateOrderYeJiType(@Param("orderId") Long orderId,
@Param("yejiType") int yejiType);
/* /*
...@@ -6011,8 +6012,9 @@ public interface OrderMapper extends AbstractMapper<OrderDO> { ...@@ -6011,8 +6012,9 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
yeji_create_date 业绩产生时间 yeji_create_date 业绩产生时间
简单的SQL语句用SQL注解来写比较方便 简单的SQL语句用SQL注解来写比较方便
*/ */
@Update("update ecw_order set cal_v_value=#{yejiType},yeji_create_date=#{yejiCreateDate} where order_id = #{orderId}") @Update("update ecw_order set cal_v_value=#{calVvalue},yeji_create_date=#{yejiCreateDate} where order_id = #{orderId}")
void UpdateOrderVValue(@Param("orderId") Long orderId,BigDecimal calVvalue,Date void UpdateOrderVValue(@Param("orderId") Long orderId,
yejiCreateDate); @Param("calVvalue") BigDecimal calVvalue,
@Param("yejiCreateDate") Date yejiCreateDate);
} }
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