Commit bd5cb2d830b399e80da81f97cf34ffeb0bb6eaad

Authored by 张志伟
1 parent 755a1f60

feature(*): 修复成交池查询

- 修复成交池查询
fw-valhalla-dao/src/main/java/cn/fw/valhalla/dao/mapper/PubCluePoolMapper.java
1 1 package cn.fw.valhalla.dao.mapper;
2 2  
3 3 import cn.fw.valhalla.domain.db.pub.PubCluePool;
  4 +import cn.fw.valhalla.domain.dto.FollowPoolDTO;
  5 +import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
4 6 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  7 +import org.apache.ibatis.annotations.Param;
5 8 import org.springframework.stereotype.Repository;
6 9  
  10 +import java.util.List;
  11 +
7 12 /**
8 13 * 公共池线索
9 14 *
... ... @@ -15,4 +20,21 @@ import org.springframework.stereotype.Repository;
15 20 */
16 21 @Repository
17 22 public interface PubCluePoolMapper extends BaseMapper<PubCluePool> {
  23 + /**
  24 + * 跟进池
  25 + *
  26 + * @param startIndex
  27 + * @param pageSize
  28 + * @param queryVO
  29 + * @return
  30 + */
  31 + List<FollowPoolDTO> followList(@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize, @Param("condition") FollowPoolQueryVO queryVO);
  32 +
  33 + /**
  34 + * 查询跟进池总数
  35 + *
  36 + * @param queryVO
  37 + * @return
  38 + */
  39 + Long followListCount(@Param("condition") FollowPoolQueryVO queryVO);
18 40 }
... ...
fw-valhalla-dao/src/main/resources/mapper/ClueTaskMapper.xml
... ... @@ -24,7 +24,6 @@
24 24 t3.arrival_time arrival_time,
25 25 IFNULL(t1.times, 0) times,
26 26 TIMESTAMPDIFF(HOUR, now(), t1.deadline) remaining,
27   - t1.redistribution redistribution,
28 27 t1.state state,
29 28 t1.close_time close_time,
30 29 t1.reason initiative,
... ... @@ -37,6 +36,7 @@
37 36 left join customer_loan_info t2 on t6.vin = t2.frame_no and t6.group_id = t2.group_id
38 37 <where>
39 38 t1.group_id = #{condition.groupId}
  39 + and t1.tye != 10
40 40 <if test="condition.userId !=null">
41 41 and t1.follow_user = #{condition.userId}
42 42 </if>
... ... @@ -90,9 +90,6 @@
90 90 </trim>
91 91 ))
92 92 </if>
93   - <if test="condition.redistribution !=null">
94   - and t1.redistribution = #{condition.redistribution}
95   - </if>
96 93 <if test="condition.initiative !=null">
97 94 and t1.reason = #{condition.initiative}
98 95 </if>
... ... @@ -120,6 +117,7 @@
120 117 left join customer_loan_info t2 on t6.vin = t2.frame_no and t6.group_id = t2.group_id
121 118 <where>
122 119 t1.group_id = #{condition.groupId}
  120 + and t1.tye != 10
123 121 <if test="condition.userId !=null">
124 122 and t1.follow_user = #{condition.userId}
125 123 </if>
... ... @@ -173,9 +171,6 @@
173 171 </trim>
174 172 ))
175 173 </if>
176   - <if test="condition.redistribution !=null">
177   - and t1.redistribution = #{condition.redistribution}
178   - </if>
179 174 <if test="condition.initiative !=null">
180 175 and t1.reason = #{condition.initiative}
181 176 </if>
... ... @@ -201,6 +196,7 @@
201 196 inner join follow_clue t2 on t1.clue_id = t2.id
202 197 <where>
203 198 t1.redistribution = 0
  199 + and t1.type != 10
204 200 <if test="condition.type !=null">
205 201 and t1.type = #{condition.type}
206 202 </if>
... ...
fw-valhalla-dao/src/main/resources/mapper/PubCluePoolMapper.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3 <mapper namespace="cn.fw.valhalla.dao.mapper.PubCluePoolMapper">
  4 + <select
  5 + id="followList"
  6 + resultType="cn.fw.valhalla.domain.dto.FollowPoolDTO"
  7 + parameterType="cn.fw.valhalla.domain.query.FollowPoolQueryVO"
  8 + >
  9 + SELECT t1.id,
  10 + t3.plate_no plate_no,
  11 + t3.frame_no frame_no,
  12 + t5.mobile mobile,
  13 + t3.cus_level cus_level,
  14 + t2.expires loan_expires,
  15 + t1.type type,
  16 + t1.follow_user user_id,
  17 + t1.follow_user_name follow_user_name,
  18 + t1.follow_shop shop_id,
  19 + t1.finish_shop finish_shop,
  20 + t1.finish_user_name finish_user_name,
  21 + t1.create_time start_time,
  22 + t3.buy_date buy_date,
  23 + t3.insurance_expires insurance_expires,
  24 + t3.arrival_time arrival_time,
  25 + IFNULL(t1.times, 0) times,
  26 + TIMESTAMPDIFF(HOUR, now(), t1.deadline) remaining,
  27 + t1.state state,
  28 + t1.close_time close_time,
  29 + t1.reason initiative,
  30 + t1.group_id group_id
  31 + FROM clue_task t1
  32 + left join pub_clue_pool t6 on t1.clue_id=t6.id
  33 + left join customer t3 on t6.vin = t3.frame_no and t6.group_id = t3.group_id and t3.yn=1
  34 + left join customer_base_info t5 on t3.base_id = t5.id
  35 + left join customer_loan_info t2 on t6.vin = t2.frame_no and t6.group_id = t2.group_id
  36 + <where>
  37 + t1.group_id = #{condition.groupId}
  38 + and t1.type = 10
  39 + <if test="condition.userId !=null">
  40 + and t1.follow_user = #{condition.userId}
  41 + </if>
  42 + <if test="condition.userName !=null and condition.userName != ''">
  43 + and t1.follow_user_name like concat('%',#{condition.userName},'%')
  44 + </if>
  45 + <if test="condition.plateNo != null and condition.plateNo !='' ">
  46 + and (t3.plate_no like concat('%', #{condition.plateNo}, '%') or t4.plate_no like concat('%',
  47 + #{condition.plateNo}, '%'))
  48 + </if>
  49 + <if test="condition.frameNo != null and condition.frameNo !='' ">
  50 + and t6.vin like concat('%', #{condition.frameNo}, '%')
  51 + </if>
  52 +
  53 + <if test="condition.shopIds !=null">
  54 + and t1.follow_shop in
  55 + <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
  56 + #{id}
  57 + </foreach>
  58 + </if>
  59 + <if test="condition.state != null">
  60 + and t1.state in
  61 + <foreach collection="condition.state" item="id" index="index" open="(" close=")" separator=",">
  62 + #{id}
  63 + </foreach>
  64 + </if>
  65 + <if test="condition.loanCustomer !=null and condition.loanCustomer == 1">
  66 + and t2.expires > now()
  67 + </if>
  68 + <if test="condition.loanCustomer !=null and condition.loanCustomer == 0">
  69 + and (t2.expires is null or t2.expires &lt;= now())
  70 + </if>
  71 + <if test="condition.startTime1 !=null">
  72 + and t1.create_time >= #{condition.startTime1}
  73 + </if>
  74 + <if test="condition.startTime2 !=null">
  75 + and t1.create_time &lt;= #{condition.startTime2}
  76 + </if>
  77 + <if test="condition.closeTime1 !=null or condition.closeTime2 !=null">
  78 + and ( t1.close_time is null or (
  79 + <trim prefixOverrides="and">
  80 + <if test="condition.closeTime1 !=null">
  81 + and t1.close_time >= #{condition.closeTime1}
  82 + </if>
  83 + <if test="condition.closeTime2 !=null">
  84 + and t1.close_time &lt;= #{condition.closeTime2}
  85 + </if>
  86 + </trim>
  87 + ))
  88 + </if>
  89 + <if test="condition.initiative !=null">
  90 + and t1.reason = #{condition.initiative}
  91 + </if>
  92 + <if test="condition.ignoreChangeRole != null">
  93 + and (t1.reason is null or t1.reason not in (4))
  94 + </if>
  95 + </where>
  96 + <if test="condition.orderString != null and condition.orderString !='' ">
  97 + ${condition.orderString}
  98 + </if>
  99 + limit #{startIndex},#{pageSize};
  100 + </select>
  101 +
  102 + <select
  103 + id="followListCount"
  104 + resultType="java.lang.Long"
  105 + parameterType="cn.fw.valhalla.domain.query.FollowPoolQueryVO"
  106 + >
  107 + SELECT count(t1.id)
  108 + FROM clue_task t1
  109 + left join pub_clue_pool t6 on t1.clue_id=t6.id
  110 + left join customer t3 on t6.vin = t3.frame_no and t6.group_id = t3.group_id and t3.yn=1
  111 + left join customer_base_info t5 on t3.base_id = t5.id
  112 + left join customer_loan_info t2 on t6.vin = t2.frame_no and t6.group_id = t2.group_id
  113 + <where>
  114 + t1.group_id = #{condition.groupId}
  115 + and t1.type = 10
  116 + <if test="condition.userId !=null">
  117 + and t1.follow_user = #{condition.userId}
  118 + </if>
  119 + <if test="condition.userName !=null and condition.userName != ''">
  120 + and t1.follow_user_name like concat('%',#{condition.userName},'%')
  121 + </if>
  122 + <if test="condition.plateNo != null and condition.plateNo !='' ">
  123 + and (t3.plate_no like concat('%', #{condition.plateNo}, '%') or t4.plate_no like concat('%',
  124 + #{condition.plateNo}, '%'))
  125 + </if>
  126 + <if test="condition.frameNo != null and condition.frameNo !='' ">
  127 + and t6.vin like concat('%', #{condition.frameNo}, '%')
  128 + </if>
  129 +
  130 + <if test="condition.shopIds !=null">
  131 + and t1.follow_shop in
  132 + <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
  133 + #{id}
  134 + </foreach>
  135 + </if>
  136 + <if test="condition.state != null">
  137 + and t1.state in
  138 + <foreach collection="condition.state" item="id" index="index" open="(" close=")" separator=",">
  139 + #{id}
  140 + </foreach>
  141 + </if>
  142 + <if test="condition.loanCustomer !=null and condition.loanCustomer == 1">
  143 + and t2.expires > now()
  144 + </if>
  145 + <if test="condition.loanCustomer !=null and condition.loanCustomer == 0">
  146 + and (t2.expires is null or t2.expires &lt;= now())
  147 + </if>
  148 + <if test="condition.startTime1 !=null">
  149 + and t1.create_time >= #{condition.startTime1}
  150 + </if>
  151 + <if test="condition.startTime2 !=null">
  152 + and t1.create_time &lt;= #{condition.startTime2}
  153 + </if>
  154 + <if test="condition.closeTime1 !=null or condition.closeTime2 !=null">
  155 + and ( t1.close_time is null or (
  156 + <trim prefixOverrides="and">
  157 + <if test="condition.closeTime1 !=null">
  158 + and t1.close_time >= #{condition.closeTime1}
  159 + </if>
  160 + <if test="condition.closeTime2 !=null">
  161 + and t1.close_time &lt;= #{condition.closeTime2}
  162 + </if>
  163 + </trim>
  164 + ))
  165 + </if>
  166 + <if test="condition.initiative !=null">
  167 + and t1.reason = #{condition.initiative}
  168 + </if>
  169 + <if test="condition.ignoreChangeRole != null">
  170 + and (t1.reason is null or t1.reason not in (4))
  171 + </if>
  172 + </where>
  173 + </select>
4 174 </mapper>
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/FollowPoolDTO.java
... ... @@ -69,10 +69,7 @@ public class FollowPoolDTO {
69 69 * 剩余天数
70 70 */
71 71 private Integer remaining;
72   - /**
73   - * 二次跟进
74   - */
75   - private Boolean redistribution;
  72 +
76 73 /**
77 74 * 状态 1:进行中 2:已成交 3:战败
78 75 */
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/PoolBizService.java
... ... @@ -47,6 +47,7 @@ public class PoolBizService {
47 47 private final AffiliationRecordService affiliationRecordService;
48 48 private final OrderRpcService orderRpcService;
49 49 private final ClueTaskService clueTaskService;
  50 + private final PubCluePoolService pubCluePoolService;
50 51 private final FollowClueService followClueService;
51 52  
52 53  
... ... @@ -59,12 +60,23 @@ public class PoolBizService {
59 60 public AppPage<FollowPoolListVO> followList(LoginAuthBean user, FollowPoolQueryVO queryVO) {
60 61 prepareParams(user, queryVO);
61 62 AppPageVO<FollowPoolListVO> page = AppPageVO.init(queryVO);
62   - final long total = clueTaskService.followListCount(queryVO);
63   - if (total <= 0) {
64   - return page;
  63 + List<FollowPoolDTO> list;
  64 + if (FollowTypeEnum.PL.getValue().equals(queryVO.getType())) {
  65 + final long total = pubCluePoolService.followListCount(queryVO);
  66 + if (total <= 0) {
  67 + return page;
  68 + }
  69 + page.setTotal(total);
  70 + list = pubCluePoolService.followList(queryVO);
  71 + } else {
  72 + final long total = clueTaskService.followListCount(queryVO);
  73 + if (total <= 0) {
  74 + return page;
  75 + }
  76 + page.setTotal(total);
  77 + list = clueTaskService.followList(queryVO);
65 78 }
66   - page.setTotal(total);
67   - List<FollowPoolDTO> list = clueTaskService.followList(queryVO);
  79 +
68 80 List<FollowPoolListVO> followList = new ArrayList<>();
69 81 for (FollowPoolDTO followPoolDTO : list) {
70 82 FollowPoolListVO vo = trans2FollowPool(followPoolDTO);
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/PubCluePoolService.java
1 1 package cn.fw.valhalla.service.data;
2 2  
3 3 import cn.fw.valhalla.domain.db.pub.PubCluePool;
  4 +import cn.fw.valhalla.domain.dto.FollowPoolDTO;
  5 +import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
4 6 import com.baomidou.mybatisplus.extension.service.IService;
5 7  
  8 +import java.util.List;
  9 +
6 10 /**
7 11 * 公共池线索
8 12 *
... ... @@ -13,4 +17,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
13 17 * @date : 2023-03-20 10:36
14 18 */
15 19 public interface PubCluePoolService extends IService<PubCluePool> {
  20 + List<FollowPoolDTO> followList(FollowPoolQueryVO queryVO);
  21 +
  22 + long followListCount(FollowPoolQueryVO queryVO);
16 23 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/PubCluePoolServiceImpl.java
... ... @@ -2,11 +2,17 @@ package cn.fw.valhalla.service.data.impl;
2 2  
3 3 import cn.fw.valhalla.dao.mapper.PubCluePoolMapper;
4 4 import cn.fw.valhalla.domain.db.pub.PubCluePool;
  5 +import cn.fw.valhalla.domain.dto.FollowPoolDTO;
  6 +import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
5 7 import cn.fw.valhalla.service.data.PubCluePoolService;
6 8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 9 import lombok.extern.slf4j.Slf4j;
8 10 import org.springframework.stereotype.Service;
9 11  
  12 +import java.util.ArrayList;
  13 +import java.util.List;
  14 +import java.util.Optional;
  15 +
10 16 /**
11 17 * 公共池线索
12 18 *
... ... @@ -19,4 +25,16 @@ import org.springframework.stereotype.Service;
19 25 @Slf4j
20 26 @Service
21 27 public class PubCluePoolServiceImpl extends ServiceImpl<PubCluePoolMapper, PubCluePool> implements PubCluePoolService {
  28 + @Override
  29 + public List<FollowPoolDTO> followList(FollowPoolQueryVO queryVO) {
  30 + Integer current = queryVO.getCurrent();
  31 + Integer pageSize = queryVO.getPageSize();
  32 + Integer startIndex = (current - 1) * pageSize;
  33 + return Optional.ofNullable(getBaseMapper().followList(startIndex, pageSize, queryVO)).orElse(new ArrayList<>());
  34 + }
  35 +
  36 + @Override
  37 + public long followListCount(FollowPoolQueryVO queryVO) {
  38 + return Optional.ofNullable(getBaseMapper().followListCount(queryVO)).orElse(0L);
  39 + }
22 40 }
... ...