Commit 34b20e3aec589e23702b274765ce840aadc4a08b

Authored by 张志伟
1 parent b593b576

:sparkles: feature(*): 清理过时的方法和类

- 清理过时的方法和类
- 修复售后接车新增档案时没有生成续保线索的bug
Showing 21 changed files with 130 additions and 1387 deletions
doc/v2.0/update.sql 0 → 100644
  1 +drop table if exists customer_clue_pool;
  2 +
  3 +drop table if exists follow_task;
... ...
fw-valhalla-dao/src/main/java/cn/fw/valhalla/dao/mapper/CustomerCluePoolMapper.java deleted
1   -package cn.fw.valhalla.dao.mapper;
2   -
3   -import cn.fw.valhalla.domain.db.pool.CustomerCluePool;
4   -import cn.fw.valhalla.domain.dto.CustomerCluePoolDTO;
5   -import cn.fw.valhalla.domain.query.CustomerCluePoolQueryVO;
6   -import com.baomidou.mybatisplus.core.mapper.BaseMapper;
7   -import org.apache.ibatis.annotations.Param;
8   -import org.springframework.stereotype.Repository;
9   -
10   -import java.util.List;
11   -
12   -/**
13   - * @author : kurisu
14   - * @className : CustomerCluePoolMapper
15   - * @description : 客户线索池
16   - * @date: 2020-11-12 09:34
17   - */
18   -@Repository
19   -public interface CustomerCluePoolMapper extends BaseMapper<CustomerCluePool> {
20   - /**
21   - * 客户线索池
22   - * fixme 数据量大的时候性能有问题
23   - * @param startIndex
24   - * @param pageSize
25   - * @param queryVO
26   - * @return
27   - */
28   - List<CustomerCluePoolDTO> clueList(@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize, @Param("condition") CustomerCluePoolQueryVO queryVO);
29   -
30   - /**
31   - * 总数
32   - * @param queryVO
33   - * @return
34   - */
35   - Long clueListCount(@Param("condition") CustomerCluePoolQueryVO queryVO);
36   -
37   - /**
38   - * 成交数
39   - * @param queryVO
40   - * @return
41   - */
42   - Long completeNum(@Param("condition") CustomerCluePoolQueryVO queryVO);
43   -
44   - /**
45   - * 战败数
46   - * @param queryVO
47   - * @return
48   - */
49   - Long defeatNum(@Param("condition") CustomerCluePoolQueryVO queryVO);
50   -
51   - /**
52   - * 进行中的数量
53   - * @param queryVO
54   - * @return
55   - */
56   - Long onGoingNum(@Param("condition") CustomerCluePoolQueryVO queryVO);
57   -}
fw-valhalla-dao/src/main/java/cn/fw/valhalla/dao/mapper/FollowClueMapper.java
1 1 package cn.fw.valhalla.dao.mapper;
2 2  
3 3 import cn.fw.valhalla.domain.db.follow.FollowClue;
4   -import cn.fw.valhalla.domain.dto.CustomerCluePoolDTO;
  4 +import cn.fw.valhalla.domain.dto.FollowClueDTO;
5 5 import cn.fw.valhalla.domain.query.CustomerCluePoolQueryVO;
6 6 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
7 7 import org.apache.ibatis.annotations.Param;
... ... @@ -27,7 +27,7 @@ public interface FollowClueMapper extends BaseMapper&lt;FollowClue&gt; {
27 27 * @param queryVO
28 28 * @return
29 29 */
30   - List<CustomerCluePoolDTO> clueList(@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize, @Param("condition") CustomerCluePoolQueryVO queryVO);
  30 + List<FollowClueDTO> clueList(@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize, @Param("condition") CustomerCluePoolQueryVO queryVO);
31 31  
32 32 /**
33 33 * 总数
... ...
fw-valhalla-dao/src/main/java/cn/fw/valhalla/dao/mapper/FollowTaskMapper.java deleted
1   -package cn.fw.valhalla.dao.mapper;
2   -
3   -import cn.fw.valhalla.domain.db.follow.FollowTask;
4   -import cn.fw.valhalla.domain.dto.FollowPoolDTO;
5   -import cn.fw.valhalla.domain.dto.StammkundeAnalyseDTO;
6   -import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
7   -import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO;
8   -import com.baomidou.mybatisplus.core.mapper.BaseMapper;
9   -import org.apache.ibatis.annotations.Param;
10   -import org.springframework.stereotype.Repository;
11   -
12   -import java.util.List;
13   -
14   -/**
15   - * @author : kurisu
16   - * @className : FollowTaskMapper
17   - * @description : 跟进任务
18   - * @date: 2020-08-12 10:58
19   - */
20   -@Repository
21   -public interface FollowTaskMapper extends BaseMapper<FollowTask> {
22   - /**
23   - * 跟进池
24   - * fixme 性能有问题
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);
40   -}
fw-valhalla-dao/src/main/resources/mapper/CustomerCluePoolMapper.xml deleted
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3   -<mapper namespace="cn.fw.valhalla.dao.mapper.CustomerCluePoolMapper">
4   - <select
5   - id="clueList"
6   - resultType="cn.fw.valhalla.domain.dto.CustomerCluePoolDTO"
7   - parameterType="cn.fw.valhalla.domain.query.CustomerCluePoolQueryVO"
8   - >
9   - SELECT t2.id customer_id,
10   - if(t1.clue_type=3 , t3.plate_no, t2.plate_no) plate_no,
11   - t1.clue_type type,
12   - t1.frame_no frame_no,
13   - t2.buy_date buy_date,
14   - t2.arrival_time arrival_time,
15   - t2.insurance_expires insurance_expires,
16   - t1.add_time add_time,
17   - t1.start_time create_date,
18   - t1.deadline deadline,
19   - t1.clue_status clue_status,
20   - t1.close_time close_time,
21   - t1.original_user_id original_user_id,
22   - t1.original_user_name original_user,
23   - t1.original_shop_id original_shop_id,
24   - t1.original_shop_name original_shop,
25   - t1.finish_user_id finish_user_id,
26   - t1.finish_user_name finish_user,
27   - t1.finish_shop_id finish_shop_id,
28   - t1.finish_shop_name finish_shop,
29   - t4.expires loan_expires
30   - FROM customer_clue_pool t1
31   - left join customer t2 on t1.referer_id = t2.id
32   - left join accident_pool t3 on t1.referer_id = t3.id
33   - left join customer_loan_info t4 on t2.frame_no = t4.frame_no and t2.group_id = t4.group_id
34   - <where>
35   - t1.clue_status != 1
36   - <if test="condition.type !=null">
37   - and t1.clue_type = #{condition.type}
38   - </if>
39   - <if test="condition.groupId !=null">
40   - and t1.group_id = #{condition.groupId}
41   - </if>
42   - <if test="condition.frameNo !=null and condition.frameNo != ''">
43   - and t1.frame_no like concat('%', #{condition.frameNo}, '%')
44   - </if>
45   - <if test="condition.userId !=null">
46   - and t1.original_user_id = #{condition.userId}
47   - </if>
48   - <if test="condition.userName !=null and condition.userName != ''">
49   - and t1.original_user_name like concat('%', #{condition.userName}, '%')
50   - </if>
51   - <if test="condition.comUserId !=null">
52   - and t1.finish_user_id = #{condition.comUserId}
53   - </if>
54   - <if test="condition.comUserName !=null and condition.comUserName != ''">
55   - and t1.finish_user_name like concat('%', #{condition.comUserName}, '%')
56   - </if>
57   - <if test="condition.plateNo != null and condition.plateNo !=''">
58   - and (t2.plate_no like concat('%', #{condition.plateNo}, '%') or t3.plate_no like concat('%', #{condition.plateNo}, '%'))
59   - </if>
60   - <if test="condition.startTime !=null">
61   - and DATE_FORMAT(t1.start_time, '%Y-%m') = DATE_FORMAT(#{condition.startTime}, '%Y-%m')
62   - </if>
63   - <if test="condition.closeTime1 !=null">
64   - and DATE_FORMAT(t1.close_time, '%Y-%m-%d') >= DATE_FORMAT(#{condition.closeTime1}, '%Y-%m-%d')
65   - </if>
66   - <if test="condition.closeTime2 !=null">
67   - and DATE_FORMAT(t1.close_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{condition.closeTime2}, '%Y-%m-%d')
68   - </if>
69   - <if test="condition.deadline1 !=null">
70   - and DATE_FORMAT(t1.start_time, '%Y-%m-%d') &lt; DATE_FORMAT(#{condition.deadline1}, '%Y-%m-%d')
71   - and DATE_FORMAT(t1.deadline, '%Y-%m-%d') >= DATE_FORMAT(#{condition.deadline1}, '%Y-%m-%d')
72   - </if>
73   - <if test="condition.deadline2 !=null">
74   - and DATE_FORMAT(t1.deadline, '%Y-%m-%d') &lt;= DATE_FORMAT(#{condition.deadline2}, '%Y-%m-%d')
75   - </if>
76   - <if test="condition.loanCustomer !=null and condition.loanCustomer == 1">
77   - and t4.expires > now()
78   - </if>
79   - <if test="condition.loanCustomer !=null and condition.loanCustomer == 0">
80   - and t4.expires &lt;= now()
81   - </if>
82   - <if test="condition.shopIds !=null">
83   - and t1.original_shop_id in
84   - <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
85   - #{id}
86   - </foreach>
87   - </if>
88   - <if test="condition.comShops !=null">
89   - and t1.finish_shop_id in
90   - <foreach collection="condition.comShops" item="id" index="index" open="(" close=")" separator=",">
91   - #{id}
92   - </foreach>
93   - </if>
94   - <if test="condition.status !=null and condition.status ==2">
95   - and t1.clue_status = 2
96   - </if>
97   - <if test="condition.status !=null and condition.status ==3">
98   - and (
99   - t1.clue_status = 3 and t1.finish_shop_id in
100   - <foreach collection="condition.scope" item="id" index="index" open="(" close=")" separator=",">
101   - #{id}
102   - </foreach>
103   - )
104   - </if>
105   - <if test="condition.status !=null and condition.status ==4">
106   - and ((
107   - t1.clue_status = 3 and t1.finish_shop_id not in
108   - <foreach collection="condition.scope" item="id" index="index" open="(" close=")" separator=",">
109   - #{id}
110   - </foreach>
111   - ) or t1.clue_status = 4
112   - )
113   - </if>
114   - </where>
115   - <if test="condition.orderString != null and condition.orderString !='' ">
116   - ${condition.orderString}
117   - </if>
118   - limit #{startIndex},#{pageSize};
119   - </select>
120   -
121   - <select
122   - id="clueListCount"
123   - resultType="java.lang.Long"
124   - parameterType="cn.fw.valhalla.domain.query.CustomerCluePoolQueryVO"
125   - >
126   - SELECT
127   - count(t1.id)
128   - FROM customer_clue_pool t1
129   - left join customer t2 on t1.referer_id = t2.id
130   - left join accident_pool t3 on t1.referer_id = t3.id
131   - left join customer_loan_info t4 on t2.frame_no = t4.frame_no and t2.group_id = t4.group_id
132   - <where>
133   - t1.clue_status != 1
134   - <if test="condition.type !=null">
135   - and t1.clue_type = #{condition.type}
136   - </if>
137   - <if test="condition.groupId !=null">
138   - and t1.group_id = #{condition.groupId}
139   - </if>
140   - <if test="condition.frameNo !=null and condition.frameNo != ''">
141   - and t1.frame_no like concat('%', #{condition.frameNo}, '%')
142   - </if>
143   - <if test="condition.userId !=null">
144   - and t1.original_user_id = #{condition.userId}
145   - </if>
146   - <if test="condition.userName !=null and condition.userName != ''">
147   - and t1.original_user_name like concat('%', #{condition.userName}, '%')
148   - </if>
149   - <if test="condition.comUserId !=null">
150   - and t1.finish_user_id = #{condition.comUserId}
151   - </if>
152   - <if test="condition.comUserName !=null and condition.comUserName != ''">
153   - and t1.finish_user_name like concat('%', #{condition.comUserName}, '%')
154   - </if>
155   - <if test="condition.plateNo != null and condition.plateNo !=''">
156   - and (t2.plate_no like concat('%', #{condition.plateNo}, '%') or t3.plate_no like concat('%', #{condition.plateNo}, '%'))
157   - </if>
158   - <if test="condition.startTime !=null">
159   - and DATE_FORMAT(t1.start_time, '%Y-%m') = DATE_FORMAT(#{condition.startTime}, '%Y-%m')
160   - </if>
161   - <if test="condition.closeTime1 !=null">
162   - and DATE_FORMAT(t1.close_time, '%Y-%m-%d') >= DATE_FORMAT(#{condition.closeTime1}, '%Y-%m-%d')
163   - </if>
164   - <if test="condition.closeTime2 !=null">
165   - and DATE_FORMAT(t1.close_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{condition.closeTime2}, '%Y-%m-%d')
166   - </if>
167   - <if test="condition.deadline1 !=null">
168   - and DATE_FORMAT(t1.start_time, '%Y-%m-%d') &lt; DATE_FORMAT(#{condition.deadline1}, '%Y-%m-%d')
169   - and DATE_FORMAT(t1.deadline, '%Y-%m-%d') >= DATE_FORMAT(#{condition.deadline1}, '%Y-%m-%d')
170   - </if>
171   - <if test="condition.deadline2 !=null">
172   - and DATE_FORMAT(t1.deadline, '%Y-%m-%d') &lt;= DATE_FORMAT(#{condition.deadline2}, '%Y-%m-%d')
173   - </if>
174   - <if test="condition.loanCustomer !=null and condition.loanCustomer == 1">
175   - and t4.expires > now()
176   - </if>
177   - <if test="condition.loanCustomer !=null and condition.loanCustomer == 0">
178   - and t4.expires &lt;= now()
179   - </if>
180   - <if test="condition.comShops !=null">
181   - and t1.finish_shop_id in
182   - <foreach collection="condition.comShops" item="id" index="index" open="(" close=")" separator=",">
183   - #{id}
184   - </foreach>
185   - </if>
186   - <if test="condition.shopIds !=null">
187   - and t1.original_shop_id in
188   - <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
189   - #{id}
190   - </foreach>
191   - </if>
192   - <if test="condition.status !=null and condition.status ==2">
193   - and t1.clue_status = 2
194   - </if>
195   - <if test="condition.status !=null and condition.status ==3">
196   - and (
197   - t1.clue_status = 3 and t1.finish_shop_id in
198   - <foreach collection="condition.scope" item="id" index="index" open="(" close=")" separator=",">
199   - #{id}
200   - </foreach>
201   - )
202   - </if>
203   - <if test="condition.status !=null and condition.status ==4">
204   - and ((
205   - t1.clue_status = 3 and t1.finish_shop_id not in
206   - <foreach collection="condition.scope" item="id" index="index" open="(" close=")" separator=",">
207   - #{id}
208   - </foreach>
209   - ) or t1.clue_status = 4
210   - )
211   - </if>
212   - </where>
213   - </select>
214   -
215   - <select
216   - id="completeNum"
217   - resultType="java.lang.Long"
218   - >
219   - SELECT
220   - count(t1.id)
221   - FROM customer_clue_pool t1
222   - left join customer t2 on t1.referer_id = t2.id
223   - left join accident_pool t3 on t1.referer_id = t3.id
224   - <where>
225   - DATE_FORMAT(t1.close_time, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
226   - and t1.original_shop_id in
227   - <foreach collection="condition.scope" item="id" index="index" open="(" close=")" separator=",">
228   - #{id}
229   - </foreach>
230   - and (
231   - t1.clue_status = 3 and t1.finish_shop_id in
232   - <foreach collection="condition.scope" item="id" index="index" open="(" close=")" separator=",">
233   - #{id}
234   - </foreach>
235   - )
236   - <if test="condition.type !=null">
237   - and t1.clue_type = #{condition.type}
238   - </if>
239   - <if test="condition.groupId !=null">
240   - and t1.group_id = #{condition.groupId}
241   - </if>
242   - </where>
243   - </select>
244   -
245   -
246   - <select
247   - id="defeatNum"
248   - resultType="java.lang.Long"
249   - >
250   - SELECT
251   - count(t1.id)
252   - FROM customer_clue_pool t1
253   - left join customer t2 on t1.referer_id = t2.id
254   - left join accident_pool t3 on t1.referer_id = t3.id
255   - <where>
256   - DATE_FORMAT(t1.close_time, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
257   - and t1.original_shop_id in
258   - <foreach collection="condition.scope" item="id" index="index" open="(" close=")" separator=",">
259   - #{id}
260   - </foreach>
261   - and ((
262   - t1.clue_status = 3 and t1.finish_shop_id not in
263   - <foreach collection="condition.scope" item="id" index="index" open="(" close=")" separator=",">
264   - #{id}
265   - </foreach>
266   - ) or t1.clue_status = 4
267   - )
268   - <if test="condition.type !=null">
269   - and t1.clue_type = #{condition.type}
270   - </if>
271   - <if test="condition.groupId !=null">
272   - and t1.group_id = #{condition.groupId}
273   - </if>
274   - </where>
275   - </select>
276   -
277   - <select
278   - id="onGoingNum"
279   - resultType="java.lang.Long"
280   - >
281   - SELECT
282   - count(t1.id)
283   - FROM customer_clue_pool t1
284   - left join customer t2 on t1.referer_id = t2.id
285   - left join accident_pool t3 on t1.referer_id = t3.id
286   - <where>
287   - t1.clue_status = 2
288   - and t1.original_shop_id in
289   - <foreach collection="condition.scope" item="id" index="index" open="(" close=")" separator=",">
290   - #{id}
291   - </foreach>
292   - <if test="condition.type !=null">
293   - and t1.clue_type = #{condition.type}
294   - </if>
295   - <if test="condition.groupId !=null">
296   - and t1.group_id = #{condition.groupId}
297   - </if>
298   - </where>
299   - </select>
300   -</mapper>
fw-valhalla-dao/src/main/resources/mapper/FollowTaskMapper.xml deleted
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3   -<mapper namespace="cn.fw.valhalla.dao.mapper.FollowTaskMapper">
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   - if(t1.type=3 , t4.plate_no, t3.plate_no)plate_no,
11   - if(t1.type=3 , t4.frame_no, t3.frame_no)frame_no,
12   - if(t1.type=3 , t4.mobile, 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.reception_user_name reception_user_name,
22   - t1.reception_shop_name reception_shop_name,
23   - t1.create_time start_time,
24   - t3.buy_date buy_date,
25   - t3.insurance_expires insurance_expires,
26   - t3.arrival_time arrival_time,
27   - t1.times times,
28   - t1.feedback feedback,
29   - TIMESTAMPDIFF(HOUR, now(), t1.deadline) remaining,
30   - t1.redistribution redistribution,
31   - t1.state state,
32   - t1.close_time close_time,
33   - t1.reason initiative,
34   - t1.group_id group_id
35   - FROM follow_task t1
36   - left join customer t3 on t1.customer_id = t3.id
37   - left join customer_base_info t5 on t3.base_id = t5.id
38   - left join accident_pool t4 on t1.customer_id = t4.id
39   - left join customer_loan_info t2 on t3.frame_no = t2.frame_no and t3.group_id = t2.group_id
40   - <where>
41   - <if test="condition.groupId !=null">
42   - and t1.group_id = #{condition.groupId}
43   - </if>
44   - <if test="condition.userId !=null">
45   - and t1.follow_user = #{condition.userId}
46   - </if>
47   - <if test="condition.userName !=null and condition.userName != ''">
48   - and t1.follow_user_name like concat('%',#{condition.userName},'%')
49   - </if>
50   - <if test="condition.plateNo != null and condition.plateNo !='' ">
51   - and (t3.plate_no like concat('%', #{condition.plateNo}, '%') or t4.plate_no like concat('%', #{condition.plateNo}, '%'))
52   - </if>
53   - <if test="condition.frameNo != null and condition.frameNo !='' ">
54   - and t3.frame_no like concat('%', #{condition.frameNo}, '%')
55   - </if>
56   - <if test="condition.type !=null">
57   - and t1.type = #{condition.type}
58   - </if>
59   - <if test="condition.feedback != null">
60   - and FIND_IN_SET(#{condition.feedback}, t1.feedback)
61   - </if>
62   - <if test="condition.lastFeedback != null">
63   - and t1.last_feedback = #{condition.lastFeedback}
64   - </if>
65   - <if test="condition.shopIds !=null">
66   - and t1.follow_shop in
67   - <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
68   - #{id}
69   - </foreach>
70   - </if>
71   - <if test="condition.state != null">
72   - and t1.state in
73   - <foreach collection="condition.state" item="id" index="index" open="(" close=")" separator=",">
74   - #{id}
75   - </foreach>
76   - </if>
77   - <if test="condition.loanCustomer !=null and condition.loanCustomer == 1">
78   - and t2.expires > now()
79   - </if>
80   - <if test="condition.loanCustomer !=null and condition.loanCustomer == 0">
81   - and t2.expires &lt;= now()
82   - </if>
83   - <if test="condition.startTime1 !=null">
84   - and t1.create_time >= #{condition.startTime1}
85   - </if>
86   - <if test="condition.startTime2 !=null">
87   - and t1.create_time &lt;= #{condition.startTime2}
88   - </if>
89   - <if test="condition.closeTime1 !=null">
90   - and t1.close_time >= #{condition.closeTime1}
91   - </if>
92   - <if test="condition.closeTime2 !=null">
93   - and t1.close_time &lt;= #{condition.closeTime2}
94   - </if>
95   - <if test="condition.redistribution !=null">
96   - and t1.redistribution = #{condition.redistribution}
97   - </if>
98   - <if test="condition.initiative !=null">
99   - and t1.reason = #{condition.initiative}
100   - </if>
101   - </where>
102   - <if test="condition.orderString != null and condition.orderString !='' ">
103   - ${condition.orderString}
104   - </if>
105   - limit #{startIndex},#{pageSize};
106   - </select>
107   -
108   - <select
109   - id="followListCount"
110   - resultType="java.lang.Long"
111   - parameterType="cn.fw.valhalla.domain.query.FollowPoolQueryVO"
112   - >
113   - SELECT count(t1.id)
114   - FROM follow_task t1
115   - left join customer t3 on t1.customer_id = t3.id
116   - left join accident_pool t4 on t1.customer_id = t4.id
117   - left join customer_loan_info t2 on t3.frame_no = t2.frame_no and t3.group_id = t2.group_id
118   - <where>
119   - <if test="condition.groupId !=null">
120   - and t1.group_id = #{condition.groupId}
121   - </if>
122   - <if test="condition.userId !=null">
123   - and t1.follow_user = #{condition.userId}
124   - </if>
125   - <if test="condition.userName !=null and condition.userName != ''">
126   - and t1.follow_user_name like concat('%',#{condition.userName},'%')
127   - </if>
128   - <if test="condition.plateNo != null and condition.plateNo !='' ">
129   - and (t3.plate_no like concat('%', #{condition.plateNo}, '%') or t4.plate_no like concat('%', #{condition.plateNo}, '%'))
130   - </if>
131   - <if test="condition.frameNo != null and condition.frameNo !='' ">
132   - and t3.frame_no like concat('%', #{condition.frameNo}, '%')
133   - </if>
134   - <if test="condition.type !=null">
135   - and t1.type = #{condition.type}
136   - </if>
137   - <if test="condition.feedback != null">
138   - and FIND_IN_SET(#{condition.feedback}, t1.feedback)
139   - </if>
140   - <if test="condition.lastFeedback != null">
141   - and t1.last_feedback = #{condition.lastFeedback}
142   - </if>
143   - <if test="condition.shopIds !=null">
144   - and t1.follow_shop in
145   - <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
146   - #{id}
147   - </foreach>
148   - </if>
149   - <if test="condition.state != null">
150   - and t1.state in
151   - <foreach collection="condition.state" item="id" index="index" open="(" close=")" separator=",">
152   - #{id}
153   - </foreach>
154   - </if>
155   - <if test="condition.loanCustomer !=null and condition.loanCustomer == 1">
156   - and t2.expires > now()
157   - </if>
158   - <if test="condition.loanCustomer !=null and condition.loanCustomer == 0">
159   - and t2.expires &lt;= now()
160   - </if>
161   - <if test="condition.startTime1 !=null">
162   - and t1.create_time >= #{condition.startTime1}
163   - </if>
164   - <if test="condition.startTime2 !=null">
165   - and t1.create_time &lt;= #{condition.startTime2}
166   - </if>
167   - <if test="condition.closeTime1 !=null">
168   - and t1.close_time >= #{condition.closeTime1}
169   - </if>
170   - <if test="condition.closeTime2 !=null">
171   - and t1.close_time &lt;= #{condition.closeTime2}
172   - </if>
173   - <if test="condition.redistribution !=null">
174   - and t1.redistribution = #{condition.redistribution}
175   - </if>
176   - <if test="condition.initiative !=null">
177   - and t1.reason = #{condition.initiative}
178   - </if>
179   - </where>
180   - </select>
181   -</mapper>
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/db/follow/FollowTask.java deleted
1   -package cn.fw.valhalla.domain.db.follow;
2   -
3   -import cn.fw.common.data.entity.BaseAuditableTimeEntity;
4   -import cn.fw.valhalla.domain.enums.FeedbackTypeEnum;
5   -import cn.fw.valhalla.domain.enums.FollowTypeEnum;
6   -import cn.fw.valhalla.domain.enums.TaskDefeatTypeEnum;
7   -import cn.fw.valhalla.domain.enums.TaskStateEnum;
8   -import lombok.Data;
9   -import lombok.EqualsAndHashCode;
10   -
11   -import java.util.Date;
12   -
13   -/**
14   - * 跟进任务
15   - *
16   - * @author kurisu
17   - */
18   -@Data
19   -@EqualsAndHashCode(callSuper = true)
20   -public class FollowTask extends BaseAuditableTimeEntity<FollowTask, Long> {
21   - /**
22   - * 线索id
23   - */
24   - private Long clueId;
25   - /**
26   - * 档案id
27   - */
28   - private Long customerId;
29   - /**
30   - * 跟进类型
31   - */
32   - private FollowTypeEnum type;
33   - /**
34   - * 任务开始时间
35   - */
36   - private Date beginTime;
37   - /**
38   - * 是否是二次分配
39   - */
40   - private Boolean redistribution;
41   - /**
42   - * 截止日期
43   - */
44   - private Date deadline;
45   - /**
46   - * 是否完成
47   - */
48   - private TaskStateEnum state;
49   - /**
50   - * 终止时间
51   - */
52   - private Date closeTime;
53   - /**
54   - * 当前跟进人
55   - */
56   - private Long followUser;
57   - private String followUserName;
58   - /**
59   - * 当前跟进人门店
60   - */
61   - private Long followShop;
62   - /**
63   - * 完成人
64   - */
65   - private Long finishUser;
66   - private String finishUserName;
67   - /**
68   - * 接待人
69   - */
70   - private Long receptionUserId;
71   - private String receptionUserName;
72   - /**
73   - * 接待门店
74   - */
75   - private Long receptionShopId;
76   - private String receptionShopName;
77   - /**
78   - * 完成门店
79   - */
80   - private Long finishShop;
81   - /**
82   - * 任务战败原因
83   - */
84   - private TaskDefeatTypeEnum reason;
85   - /**
86   - * 跟进次数
87   - */
88   - private Integer times;
89   - /**
90   - * 反馈类型
91   - */
92   - private String feedback;
93   - /**
94   - * 最新反馈
95   - */
96   - private FeedbackTypeEnum lastFeedback;
97   - /**
98   - * 集团id
99   - */
100   - private Long groupId;
101   -}
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/db/pool/CustomerCluePool.java deleted
1   -package cn.fw.valhalla.domain.db.pool;
2   -
3   -import cn.fw.common.data.entity.BaseAuditableTimeEntity;
4   -import cn.fw.valhalla.domain.enums.ClueStatusEnum;
5   -import cn.fw.valhalla.domain.enums.FollowTypeEnum;
6   -import lombok.Data;
7   -import lombok.EqualsAndHashCode;
8   -import lombok.ToString;
9   -
10   -import java.util.Date;
11   -
12   -/**
13   - * @author : kurisu
14   - * @className : CustomerCluePool
15   - * @description : 客户线索池
16   - * @date: 2020-11-11 18:02
17   - */
18   -@Data
19   -@EqualsAndHashCode(callSuper = true)
20   -@ToString(callSuper = true)
21   -public class CustomerCluePool extends BaseAuditableTimeEntity<CustomerCluePool, Long> {
22   - /**
23   - * 档案id或者事故车线索id
24   - */
25   - private Long refererId;
26   - /**
27   - * 车架号
28   - */
29   - private String frameNo;
30   - /**
31   - * 车牌号
32   - */
33   - private String plateNo;
34   - /**
35   - * 线索类型 同跟进类型
36   - */
37   - private FollowTypeEnum clueType;
38   - /**
39   - * 添加时间
40   - */
41   - private Date addTime;
42   - /**
43   - * 生效时间
44   - */
45   - private Date startTime;
46   - /**
47   - * 过期时间
48   - */
49   - private Date deadline;
50   - /**
51   - * 完成时间
52   - */
53   - private Date closeTime;
54   - /**
55   - * 是否过期
56   - */
57   - private ClueStatusEnum clueStatus;
58   - /**
59   - * 是否已经二次分配
60   - */
61   - private Boolean redistribution;
62   - /**
63   - * 初始跟进人id
64   - */
65   - private Long originalUserId;
66   - /**
67   - * 初始跟进人名称
68   - */
69   - private String originalUserName;
70   - /**
71   - * 初始跟进门店id
72   - */
73   - private Long originalShopId;
74   - /**
75   - * 初始跟进门店名称
76   - */
77   - private String originalShopName;
78   - /**
79   - * 成交人员id
80   - */
81   - private Long finishUserId;
82   - /**
83   - * 成交人员名称
84   - */
85   - private String finishUserName;
86   - /**
87   - * 成交门店id
88   - */
89   - private Long finishShopId;
90   - /**
91   - * 成交门店名称
92   - */
93   - private String finishShopName;
94   - /**
95   - * 集团id
96   - */
97   - private Long groupId;
98   -}
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/CustomerCluePoolDTO.java renamed to fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/FollowClueDTO.java
... ... @@ -7,13 +7,13 @@ import java.util.Date;
7 7  
8 8 /**
9 9 * @author : kurisu
10   - * @className : CustomerCluePoolDTO
  10 + * @className : FollowClueDTO
11 11 * @description : 客户线索池
12 12 * @date: 2020-11-20 15:27
13 13 */
14 14 @Data
15 15 @ToString
16   -public class CustomerCluePoolDTO {
  16 +public class FollowClueDTO {
17 17 /**
18 18 * 档案id
19 19 */
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/wx/CustomerWxController.java
... ... @@ -7,7 +7,6 @@ import cn.fw.data.base.domain.common.Message;
7 7 import cn.fw.security.auth.client.annotation.Authorization;
8 8 import cn.fw.security.auth.client.enums.AuthType;
9 9 import cn.fw.valhalla.domain.dto.CorrelationDto;
10   -import cn.fw.valhalla.domain.dto.CustomerChangeDto;
11 10 import cn.fw.valhalla.domain.dto.NewCustomerDTO;
12 11 import cn.fw.valhalla.domain.vo.customer.CarArchiveVO;
13 12 import cn.fw.valhalla.domain.vo.customer.CustomerChangeInfoVO;
... ... @@ -19,7 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
19 18 import org.springframework.validation.annotation.Validated;
20 19 import org.springframework.web.bind.annotation.*;
21 20  
22   -import javax.validation.constraints.NotBlank;
23 21 import javax.validation.constraints.NotNull;
24 22 import java.util.List;
25 23  
... ... @@ -90,33 +88,6 @@ public class CustomerWxController {
90 88 return success(changeBizService.mpGetById(cusId));
91 89 }
92 90  
93   - /**
94   - * 回显用户修改的基本信息
95   - *
96   - * @param user
97   - * @param key
98   - * @return
99   - * @Deprecated 将在下版本移除此接口 2022-03-15
100   - */
101   - @Deprecated
102   - @GetMapping("/change/info")
103   - @ControllerMethod("保有客档案变更基本信息回显")
104   - public Message<CustomerChangeInfoVO> changeInfo(@CurrentUser PassportAuthBean user,
105   - @NotBlank(message = "口令不能为空") String key) {
106   - return success(changeBizService.getInfo(user, key));
107   - }
108   -
109   - /**
110   - * 档案详情修改
111   - *
112   - * @param dto 档案信息
113   - */
114   - @Deprecated
115   - @PostMapping("/save")
116   - @ControllerMethod("修改档案信息")
117   - public Message<Long> updateOrCreate(@CurrentUser PassportAuthBean user, @Validated @RequestBody final CustomerChangeDto dto) {
118   - return success(changeBizService.updateOrSave(user, dto));
119   - }
120 91  
121 92 /**
122 93 * 查询所有档案
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CustomerRetentionRatioBizService.java
... ... @@ -4,7 +4,7 @@ import cn.fw.valhalla.common.constant.RoleCode;
4 4 import cn.fw.valhalla.common.utils.DateUtil;
5 5 import cn.fw.valhalla.common.utils.StringUtils;
6 6 import cn.fw.valhalla.domain.db.customer.CustomerReachLog;
7   -import cn.fw.valhalla.domain.db.follow.FollowTask;
  7 +import cn.fw.valhalla.domain.db.follow.ClueTask;
8 8 import cn.fw.valhalla.domain.db.pool.StammkundePool;
9 9 import cn.fw.valhalla.domain.db.report.CustomerRetentionRatio;
10 10 import cn.fw.valhalla.domain.enums.*;
... ... @@ -12,12 +12,11 @@ import cn.fw.valhalla.rpc.ehr.EhrRpcService;
12 12 import cn.fw.valhalla.rpc.ehr.dto.StaffInfoDTO;
13 13 import cn.fw.valhalla.rpc.erp.UserService;
14 14 import cn.fw.valhalla.rpc.erp.dto.PostUserDTO;
15   -import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
16 15 import cn.fw.valhalla.rpc.oop.OopService;
17 16 import cn.fw.valhalla.rpc.oop.dto.ShopDTO;
  17 +import cn.fw.valhalla.service.data.ClueTaskService;
18 18 import cn.fw.valhalla.service.data.CustomerReachLogService;
19 19 import cn.fw.valhalla.service.data.CustomerRetentionRatioService;
20   -import cn.fw.valhalla.service.data.FollowTaskService;
21 20 import cn.fw.valhalla.service.data.StammkundePoolService;
22 21 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
23 22 import lombok.RequiredArgsConstructor;
... ... @@ -48,7 +47,7 @@ public class CustomerRetentionRatioBizService {
48 47 private final EhrRpcService ehrRpcService;
49 48 private final CustomerRetentionRatioService customerRetentionRatioService;
50 49 private final StammkundePoolService stammkundePoolService;
51   - private final FollowTaskService followTaskService;
  50 + private final ClueTaskService clueTaskService;
52 51 private final CustomerReachLogService customerReachLogService;
53 52  
54 53 @Transactional(rollbackFor = Exception.class)
... ... @@ -203,14 +202,14 @@ public class CustomerRetentionRatioBizService {
203 202  
204 203 private int twiceNum(Long userId, Long shopId, Date preMonthEndDay, Date nowDate, FollowTypeEnum typeEnum) {
205 204 Date endDay = DateUtil.getEndInTime(nowDate);
206   - return followTaskService.count(Wrappers.<FollowTask>lambdaQuery()
207   - .eq(FollowTask::getState, TaskStateEnum.COMPLETE)
208   - .eq(FollowTask::getRedistribution, Boolean.TRUE)
209   - .eq(FollowTask::getType, typeEnum)
210   - .eq(FollowTask::getFollowShop, shopId)
211   - .eq(FollowTask::getFollowUser, userId)
212   - .gt(FollowTask::getCloseTime, preMonthEndDay)
213   - .le(FollowTask::getCloseTime, endDay)
  205 + return clueTaskService.count(Wrappers.<ClueTask>lambdaQuery()
  206 + .eq(ClueTask::getState, TaskStateEnum.COMPLETE)
  207 + .eq(ClueTask::getRedistribution, Boolean.TRUE)
  208 + .eq(ClueTask::getType, typeEnum)
  209 + .eq(ClueTask::getFollowShop, shopId)
  210 + .eq(ClueTask::getFollowUser, userId)
  211 + .gt(ClueTask::getCloseTime, preMonthEndDay)
  212 + .le(ClueTask::getCloseTime, endDay)
214 213 );
215 214 }
216 215  
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/StammkundeBizService.java
... ... @@ -2,15 +2,18 @@ package cn.fw.valhalla.service.bus;
2 2  
3 3 import cn.fw.valhalla.common.utils.DateUtil;
4 4 import cn.fw.valhalla.common.utils.GeoDistanceUtils;
5   -import cn.fw.valhalla.domain.db.follow.FollowTask;
  5 +import cn.fw.valhalla.domain.db.customer.Customer;
  6 +import cn.fw.valhalla.domain.db.follow.ClueTask;
  7 +import cn.fw.valhalla.domain.db.follow.FollowClue;
6 8 import cn.fw.valhalla.domain.dto.StammkundeAnalyseDTO;
7 9 import cn.fw.valhalla.domain.enums.FollowTypeEnum;
8 10 import cn.fw.valhalla.domain.enums.TaskStateEnum;
9 11 import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO;
10 12 import cn.fw.valhalla.domain.vo.customer.StammkundeAddressAnalyseVO;
11 13 import cn.fw.valhalla.domain.vo.customer.StammkundeAnalyseVO;
  14 +import cn.fw.valhalla.service.data.ClueTaskService;
12 15 import cn.fw.valhalla.service.data.CustomerService;
13   -import cn.fw.valhalla.service.data.FollowTaskService;
  16 +import cn.fw.valhalla.service.data.FollowClueService;
14 17 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
15 18 import lombok.RequiredArgsConstructor;
16 19 import lombok.extern.slf4j.Slf4j;
... ... @@ -39,8 +42,9 @@ import static cn.fw.common.businessvalidator.Validator.BV;
39 42 @RequiredArgsConstructor
40 43 public class StammkundeBizService {
41 44  
42   - private final FollowTaskService followTaskService;
  45 + private final ClueTaskService clueTaskService;
43 46 private final CustomerService customerService;
  47 + private final FollowClueService followClueService;
44 48  
45 49 public List<StammkundeAnalyseVO> stammkundeList(final StammkundeAnalyseQueryVO queryVO) {
46 50 boolean verifyPoi = Objects.nonNull(queryVO.getLat()) && Objects.nonNull(queryVO.getLng());
... ... @@ -58,18 +62,16 @@ public class StammkundeBizService {
58 62 BV.notNull(typeEnum, () -> "跟进类型不正确");
59 63 boolean underway = Boolean.TRUE.equals(queryVO.getUnderway());
60 64 TaskStateEnum stateEnum = underway ? TaskStateEnum.ONGOING : TaskStateEnum.DEFEAT;
61   - List<FollowTask> tasks = followTaskService.list(Wrappers.<FollowTask>lambdaQuery()
62   - .eq(FollowTask::getType, typeEnum)
63   - .eq(FollowTask::getState, stateEnum)
64   - .in(!CollectionUtils.isEmpty(queryVO.getShopIds()), FollowTask::getFollowShop, queryVO.getShopIds())
65   - .between(!underway, FollowTask::getCloseTime, queryVO.getStartTime(), queryVO.getEndTime())
  65 + List<ClueTask> tasks = clueTaskService.list(Wrappers.<ClueTask>lambdaQuery()
  66 + .eq(ClueTask::getType, typeEnum)
  67 + .eq(ClueTask::getState, stateEnum)
  68 + .in(!CollectionUtils.isEmpty(queryVO.getShopIds()), ClueTask::getFollowShop, queryVO.getShopIds())
  69 + .between(!underway, ClueTask::getCloseTime, queryVO.getStartTime(), queryVO.getEndTime())
66 70 );
67 71 if (CollectionUtils.isEmpty(tasks)) {
68 72 return new ArrayList<>();
69 73 }
70   - queryVO.setShopIds(null);
71   - Set<Long> customerIds = tasks.stream().map(FollowTask::getCustomerId).collect(Collectors.toSet());
72   - queryVO.setCustomerIds(customerIds);
  74 + fillCustomer(tasks, queryVO);
73 75 }
74 76  
75 77 List<StammkundeAnalyseDTO> list = customerService.analyseList(queryVO);
... ... @@ -101,18 +103,17 @@ public class StammkundeBizService {
101 103 boolean underway = Boolean.TRUE.equals(queryVO.getUnderway());
102 104 FollowTypeEnum typeEnum = FollowTypeEnum.ofValue(queryVO.getFollowType());
103 105 TaskStateEnum stateEnum = underway ? TaskStateEnum.ONGOING : TaskStateEnum.DEFEAT;
104   - List<FollowTask> tasks = followTaskService.list(Wrappers.<FollowTask>lambdaQuery()
105   - .eq(FollowTask::getType, typeEnum)
106   - .eq(FollowTask::getState, stateEnum)
107   - .in(!CollectionUtils.isEmpty(queryVO.getShopIds()), FollowTask::getFollowShop, queryVO.getShopIds())
108   - .between(!underway, FollowTask::getCloseTime, queryVO.getStartTime(), queryVO.getEndTime())
  106 + List<ClueTask> tasks = clueTaskService.list(Wrappers.<ClueTask>lambdaQuery()
  107 + .eq(ClueTask::getType, typeEnum)
  108 + .eq(ClueTask::getState, stateEnum)
  109 + .in(!CollectionUtils.isEmpty(queryVO.getShopIds()), ClueTask::getFollowShop, queryVO.getShopIds())
  110 + .between(!underway, ClueTask::getCloseTime, queryVO.getStartTime(), queryVO.getEndTime())
109 111 );
110 112 if (CollectionUtils.isEmpty(tasks)) {
111 113 return new ArrayList<>();
112 114 }
113 115 queryVO.setShopIds(null);
114   - Set<Long> customerIds = tasks.stream().map(FollowTask::getCustomerId).collect(Collectors.toSet());
115   - queryVO.setCustomerIds(customerIds);
  116 + fillCustomer(tasks, queryVO);
116 117 return customerService.analyseList(queryVO);
117 118 }
118 119  
... ... @@ -183,4 +184,31 @@ public class StammkundeBizService {
183 184 queryVO.setMinLng(BigDecimal.valueOf(minLng));
184 185 queryVO.setMaxLng(BigDecimal.valueOf(maxLng));
185 186 }
  187 +
  188 + private void fillCustomer(List<ClueTask> taskList, StammkundeAnalyseQueryVO queryVO) {
  189 + Set<Long> clueIdArr = taskList.stream().map(ClueTask::getClueId).collect(Collectors.toSet());
  190 + if (CollectionUtils.isEmpty(clueIdArr)) {
  191 + return;
  192 + }
  193 + List<FollowClue> list = followClueService.list(Wrappers.<FollowClue>lambdaQuery()
  194 + .eq(FollowClue::getGroupId, queryVO.getGroupId())
  195 + .in(FollowClue::getId, clueIdArr)
  196 + );
  197 + if (CollectionUtils.isEmpty(list)) {
  198 + return;
  199 + }
  200 + Set<String> vinArr = list.stream().map(FollowClue::getVin).collect(Collectors.toSet());
  201 + if (CollectionUtils.isEmpty(vinArr)) {
  202 + return;
  203 + }
  204 + List<Customer> custList = customerService.list(Wrappers.<Customer>lambdaQuery()
  205 + .eq(Customer::getGroupId, queryVO.getGroupId())
  206 + .in(Customer::getFrameNo, vinArr)
  207 + );
  208 + if (CollectionUtils.isEmpty(custList)) {
  209 + return;
  210 + }
  211 + Set<Long> customerIds = custList.stream().map(Customer::getId).collect(Collectors.toSet());
  212 + queryVO.setCustomerIds(customerIds);
  213 + }
186 214 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerChangeBizService.java
1 1 package cn.fw.valhalla.service.bus.cust;
2 2  
3   -import cn.fw.common.exception.BusinessException;
  3 +import cn.fw.common.cache.locker.DistributedLocker;
4 4 import cn.fw.common.web.annotation.DisLock;
5 5 import cn.fw.common.web.auth.LoginAuthBean;
6   -import cn.fw.common.web.auth.PassportAuthBean;
7 6 import cn.fw.data.base.domain.common.Message;
8 7 import cn.fw.hermes.sdk.api.para.BusinessType;
9 8 import cn.fw.hermes.sdk.api.para.MsgParamCondition;
10 9 import cn.fw.passport.sdk.api.param.WxBCodeParam;
11   -import cn.fw.starter.redis.redis.RedisUtil;
12 10 import cn.fw.valhalla.common.constant.RoleCode;
13 11 import cn.fw.valhalla.common.utils.DateUtil;
14 12 import cn.fw.valhalla.common.utils.MessageFormatUtil;
... ... @@ -17,11 +15,10 @@ import cn.fw.valhalla.common.utils.StringUtils;
17 15 import cn.fw.valhalla.domain.db.customer.AffiliationRecord;
18 16 import cn.fw.valhalla.domain.db.customer.Customer;
19 17 import cn.fw.valhalla.domain.db.customer.CustomerBaseInfo;
  18 +import cn.fw.valhalla.domain.db.follow.ClueTask;
20 19 import cn.fw.valhalla.domain.db.follow.FollowClue;
21 20 import cn.fw.valhalla.domain.db.follow.FollowRecord;
22 21 import cn.fw.valhalla.domain.db.follow.FollowRecordLog;
23   -import cn.fw.valhalla.domain.db.follow.FollowTask;
24   -import cn.fw.valhalla.domain.db.pool.CustomerCluePool;
25 22 import cn.fw.valhalla.domain.db.pool.PublicCluePool;
26 23 import cn.fw.valhalla.domain.db.pool.StammkundePool;
27 24 import cn.fw.valhalla.domain.dto.*;
... ... @@ -39,19 +36,23 @@ import cn.fw.valhalla.rpc.passport.PassportService;
39 36 import cn.fw.valhalla.sdk.enums.*;
40 37 import cn.fw.valhalla.sdk.param.ChangeAdviserReq;
41 38 import cn.fw.valhalla.sdk.result.CustomerInfoDto;
  39 +import cn.fw.valhalla.service.bus.CommonService;
42 40 import cn.fw.valhalla.service.data.*;
43 41 import com.alibaba.fastjson.JSON;
44 42 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
45 43 import lombok.RequiredArgsConstructor;
46 44 import lombok.extern.slf4j.Slf4j;
  45 +import org.apache.commons.lang3.tuple.Pair;
  46 +import org.redisson.api.RLock;
47 47 import org.springframework.beans.BeanUtils;
48   -import org.springframework.context.ApplicationEventPublisher;
  48 +import org.springframework.data.redis.core.StringRedisTemplate;
49 49 import org.springframework.stereotype.Service;
50 50 import org.springframework.transaction.annotation.Transactional;
51 51 import org.springframework.util.CollectionUtils;
52 52  
53 53 import java.time.LocalDateTime;
54 54 import java.util.*;
  55 +import java.util.concurrent.TimeUnit;
55 56  
56 57 import static cn.fw.common.businessvalidator.Validator.BV;
57 58  
... ... @@ -67,20 +68,21 @@ import static cn.fw.common.businessvalidator.Validator.BV;
67 68 public class CustomerChangeBizService extends AbstractCustomerService {
68 69 public final String CUSTOMER_CHANGE_CODE = "valhalla:customer:change:key:{0}:{1}";
69 70  
70   - private final RedisUtil redisUtil;
  71 + private final DistributedLocker distributedLocker;
  72 + private final StringRedisTemplate stringRedisTemplate;
71 73 /**
72 74 * 会员服务
73 75 */
74 76 private final PassportService passportService;
75 77 private final MemberRpcService memberRpcService;
76   - private final FollowTaskService followTaskService;
77   - private final CustomerCluePoolService customerCluePoolService;
78 78 private final AffiliationRecordService affiliationRecordService;
79 79 private final PublicPoolService publicPoolService;
80   - private final ApplicationEventPublisher eventPublisher;
81 80 private final FollowRecordService followRecordService;
82 81 private final FollowNoticeRecordService followNoticeRecordService;
83 82 private final FollowRecordLogService followRecordLogService;
  83 + private final FollowClueService followClueService;
  84 + private final ClueTaskService clueTaskService;
  85 + private final CommonService commonService;
84 86  
85 87 /**
86 88 * 生成档案变更二维码
... ... @@ -114,18 +116,16 @@ public class CustomerChangeBizService extends AbstractCustomerService {
114 116 customerChangeDto.setAdviserId(user.getUserId());
115 117 }
116 118 String key = MessageFormatUtil.MessageFormatTransfer(CUSTOMER_CHANGE_CODE, customerChangeDto.getShopId(), str);
117   - try {
118   - String customerString = JSON.toJSONString(customerChangeDto);
119   - boolean flag = redisUtil.lock(key, 1000 * 15);
120   - BV.isTrue(flag, "重复操作,请稍后重试");
121   - int expires = 60 * 30;
122   - String s = redisUtil.STRINGS.setEx(key, expires, customerString);
123   - BV.isTrue(StringUtils.isValid(s), "操作失败,请稍后重试");
124   - String code = createCode(key, expires, customerChangeDto.getDealerId());
125   - return new CustomerChangeQrCodeVO(code, key);
126   - } finally {
127   - redisUtil.unlock(key);
128   - }
  119 + String customerString = JSON.toJSONString(customerChangeDto);
  120 + Pair<Boolean, RLock> lockPair = distributedLocker.tryLock(key, TimeUnit.SECONDS, 0, 1000 * 15);
  121 + RLock rLock = lockPair.getRight();
  122 + boolean flag = rLock.isLocked();
  123 + BV.isTrue(flag, "重复操作,请稍后重试");
  124 + int expires = 60 * 30;
  125 + stringRedisTemplate.opsForValue().set(key, customerString, expires, TimeUnit.SECONDS);
  126 + String code = createCode(key, expires, customerChangeDto.getDealerId());
  127 + distributedLocker.unlock(key);
  128 + return new CustomerChangeQrCodeVO(code, key);
129 129 }
130 130  
131 131 /**
... ... @@ -154,33 +154,12 @@ public class CustomerChangeBizService extends AbstractCustomerService {
154 154  
155 155  
156 156 /**
157   - * 用户维护的基础信息查询
158   - *
159   - * @param user
160   - * @param key
161   - * @return
162   - */
163   - public CustomerChangeInfoVO getInfo(PassportAuthBean user, String key) {
164   - String s = redisUtil.STRINGS.get(key);
165   - BV.isTrue(StringUtils.isValid(s), "二维码已失效");
166   - CustomerChangeDto dto = JSON.parseObject(s, CustomerChangeDto.class);
167   - final CustomerChangeInfoVO vo = new CustomerChangeInfoVO();
168   - BeanUtils.copyProperties(dto, vo);
169   - MemberUserDTO userDto = memberRpcService.user(user.getUserId());
170   - if (userDto != null) {
171   - vo.setMobile(userDto.getPhone());
172   - }
173   - this.sendMsg(vo.getAdviserId(), false, key);
174   - return vo;
175   - }
176   -
177   - /**
178 157 * C端 档案新增或者变更
179 158 *
180 159 * @param dto
181 160 */
182 161 @Transactional(rollbackFor = Exception.class)
183   - @DisLock(prefix = "save-customer:", key = "#dto.memberId + ':' + #dto.frameNo", message = "系统繁忙,请5秒后再试")
  162 + @DisLock(prefix = "'save-customer:'", key = "#dto.memberId + ':' + #dto.frameNo", message = "系统繁忙,请5秒后再试")
184 163 public Long saveCustomer(NewCustomerDTO dto) {
185 164 Long memberId = dto.getMemberId();
186 165 // 客户类型
... ... @@ -256,7 +235,7 @@ public class CustomerChangeBizService extends AbstractCustomerService {
256 235 * @param dto
257 236 */
258 237 @Transactional(rollbackFor = Exception.class)
259   - @DisLock(prefix = "change-address-customer:", key = "#dto.id", message = "系统繁忙,请5秒后再试")
  238 + @DisLock(prefix = "'change-address-customer:'", key = "#dto.id", message = "系统繁忙,请5秒后再试")
260 239 public void updateCustomerAddress(CustomerAddressChangeDTO dto) {
261 240 Long id = dto.getId();
262 241 Customer customer = customerService.getById(id);
... ... @@ -275,93 +254,6 @@ public class CustomerChangeBizService extends AbstractCustomerService {
275 254 customerBaseInfoService.updateById(baseInfo);
276 255 }
277 256  
278   - /**
279   - * 档案修改
280   - *
281   - * @param saveDto
282   - * @return
283   - * @Deprecated 将在下版本移除此接口 2022-03-15
284   - */
285   - @Deprecated
286   - @Transactional(rollbackFor = Exception.class)
287   - public Long updateOrSave(PassportAuthBean user, CustomerChangeDto saveDto) {
288   - final String key = saveDto.getKey();
289   - final Long adviserId = saveDto.getAdviserId();
290   - saveDto.setMemberId(user.getUserId());
291   - Long nid;
292   -
293   - CustomerBaseInfo baseInfo = new CustomerBaseInfo();
294   - BeanUtils.copyProperties(saveDto, baseInfo);
295   - baseInfo.setId(null);
296   - baseInfo.setGender(GenderEnum.ofValue(saveDto.getGender()));
297   - baseInfo.setUpdateTime(new Date());
298   -
299   - //客户主动修改信息
300   - if (StringUtils.isEmpty(key)) {
301   - Customer customer = customerService.queryById(saveDto.getId());
302   - baseInfo.setId(customer.getBaseId());
303   - customerBaseInfoService.updateById(baseInfo);
304   - return customer.getId();
305   - }
306   -
307   - //车牌号有档案
308   - if (Objects.nonNull(saveDto.getMotoId())) {
309   - //vin有档案
310   - if (Objects.nonNull(saveDto.getId())) {
311   - //档案和行驶证不一致 作废旧档案 更新档案
312   - boolean bool = saveDto.getId().equals(saveDto.getMotoId());
313   - if (!bool) {
314   - stammkundePoolService.reject(saveDto.getId(), saveDto.getGroupId(), DefeatReasonEnum.CI);
315   - publicCluePoolService.removeClue(saveDto.getId(), adviserId);
316   - customerService.forbidden(saveDto.getMotoId());
317   - }
318   - Customer customer = customerService.queryById(saveDto.getId());
319   - BV.notNull(customer, "档案信息异常");
320   - baseInfo.setId(customer.getBaseId());
321   - customerBaseInfoService.updateById(baseInfo);
322   - if (Objects.isNull(customer.getAdviserId())) {
323   - saveDto.setShopId(null);
324   - saveDto.setAdviserId(null);
325   - }
326   - BeanUtils.copyProperties(saveDto, customer);
327   - customer.setUseType(CarUseTypeEnum.ofValue(saveDto.getUseType()));
328   - customer.setUpdateTime(new Date());
329   - customer.setYn(Boolean.TRUE);
330   - nid = this.edit(customer);
331   - } else {
332   - stammkundePoolService.reject(saveDto.getId(), saveDto.getGroupId(), DefeatReasonEnum.CI);
333   - publicCluePoolService.removeClue(saveDto.getId(), adviserId);
334   - customerService.forbidden(saveDto.getMotoId());
335   - Customer customer = new Customer();
336   - BeanUtils.copyProperties(saveDto, customer);
337   - customer.setUseType(CarUseTypeEnum.ofValue(saveDto.getUseType()));
338   - customer.setSpecCode(saveDto.getModelCode());
339   - nid = create(customer, baseInfo);
340   - }
341   - } else {
342   - //vin有档案 行驶证车主和vin档案车主一致的情况app直接替换车牌不会到这个流程
343   - if (Objects.nonNull(saveDto.getId())) {
344   - stammkundePoolService.reject(saveDto.getId(), saveDto.getGroupId(), DefeatReasonEnum.CI);
345   - publicCluePoolService.removeClue(saveDto.getId(), adviserId);
346   - customerService.forbidden(saveDto.getId());
347   - saveDto.setId(null);
348   - }
349   - Customer customer = new Customer();
350   - BeanUtils.copyProperties(saveDto, customer);
351   - customer.setUseType(CarUseTypeEnum.ofValue(saveDto.getUseType()));
352   - customer.setSpecCode(saveDto.getModelCode());
353   - nid = create(customer, baseInfo);
354   - if (Objects.nonNull(saveDto.getId())) {
355   - changeTaskFollower(saveDto.getMotoId(), customer.getId(), customer.getGroupId());
356   - }
357   - }
358   -
359   - if (StringUtils.isValid(key)) {
360   - redisUtil.KEYS.del(key);
361   - this.sendMsg(adviserId, true, key);
362   - }
363   - return nid;
364   - }
365 257  
366 258 /**
367 259 * 变更档案标签
... ... @@ -555,26 +447,6 @@ public class CustomerChangeBizService extends AbstractCustomerService {
555 447 }
556 448  
557 449  
558   - /**
559   - * 更换跟进人
560   - *
561   - * @param task
562   - * @return
563   - */
564   - @Transactional(rollbackFor = Exception.class)
565   - public PostUserDTO changeInsFollowUser(FollowTask task) throws BusinessException {
566   - Customer customer = customerService.getById(task.getCustomerId());
567   - if (Objects.isNull(customer)) {
568   - log.info("档案信息异常,custId: [{}]", task.getCustomerId());
569   - }
570   - BV.notNull(customer, () -> "档案信息不存在");
571   -
572   - List<PostUserDTO> userList = userService.getUserByRole(task.getFollowShop(), RoleCode.XBGJ);
573   - BV.isNotEmpty(userList, () -> String.format("更换跟进人员失败:更换跟进人员失败:门店[%s]没有续保跟进员", customer.getShopId()));
574   - Collections.shuffle(userList);
575   - return userList.stream().filter(u -> !u.getUserId().equals(task.getFollowUser())).findAny().orElse(null);
576   - }
577   -
578 450 @Transactional(rollbackFor = Exception.class)
579 451 public void rollBack(String vin, Long groupId) {
580 452 Customer customer = customerService.queryByFrameNo(vin, groupId);
... ... @@ -582,24 +454,25 @@ public class CustomerChangeBizService extends AbstractCustomerService {
582 454 boolean isTemporaryPlateNo = customer.getPlateNo().contains("临") || customer.getPlateNo().contains("商");
583 455 BV.isTrue(isTemporaryPlateNo, () -> "非临时牌照车辆,无法回滚");
584 456 Long customerId = customer.getId();
585   - List<CustomerCluePool> list = customerCluePoolService.list(Wrappers.<CustomerCluePool>lambdaQuery()
586   - .eq(CustomerCluePool::getRefererId, customerId)
587   - .eq(CustomerCluePool::getGroupId, groupId)
  457 +
  458 + List<FollowClue> list = followClueService.list(Wrappers.<FollowClue>lambdaQuery()
  459 + .eq(FollowClue::getVin, vin)
  460 + .eq(FollowClue::getGroupId, groupId)
588 461 );
589 462 if (!CollectionUtils.isEmpty(list)) {
590 463 List<Long> clueIds = new ArrayList<>();
591   - for (CustomerCluePool cluePool : list) {
592   - boolean isWaiting = ClueStatusEnum.WAITING.equals(cluePool.getClueStatus());
  464 + for (FollowClue cluePool : list) {
  465 + boolean isWaiting = ClueStatusEnum.WAITING.equals(cluePool.getClueState());
593 466 BV.isTrue(isWaiting, () -> "存在已开始的跟进任务,无法回滚档案");
594 467 clueIds.add(cluePool.getId());
595 468 }
596   - followTaskService.remove(Wrappers.<FollowTask>lambdaQuery()
597   - .eq(FollowTask::getCustomerId, customerId)
598   - .in(FollowTask::getClueId, clueIds)
  469 + clueTaskService.remove(Wrappers.<ClueTask>lambdaQuery()
  470 + .eq(ClueTask::getGroupId, groupId)
  471 + .in(ClueTask::getClueId, clueIds)
599 472 );
600 473 followRecordService.removeRecordByCustId(customerId, null);
601 474 followNoticeRecordService.removeByClueIds(clueIds);
602   - customerCluePoolService.removeByIds(clueIds);
  475 + followClueService.removeByIds(clueIds);
603 476 }
604 477 List<StammkundePool> stammkundePoolList = stammkundePoolService.list(Wrappers.<StammkundePool>lambdaQuery()
605 478 .eq(StammkundePool::getCustomerId, customerId)
... ... @@ -665,39 +538,6 @@ public class CustomerChangeBizService extends AbstractCustomerService {
665 538 }
666 539 }
667 540  
668   - private void changeTaskFollower(Long motoId, Long curId, Long groupId) {
669   - CustomerCluePool cluePool = customerCluePoolService.queryByRefererId(motoId, groupId, FollowTypeEnum.FM);
670   - if (Objects.nonNull(cluePool)) {
671   - boolean equals = ClueStatusEnum.ONGOING.equals(cluePool.getClueStatus()) || ClueStatusEnum.WAITING.equals(cluePool.getClueStatus());
672   - if (equals) {
673   - cluePool.setRefererId(curId);
674   - customerCluePoolService.updateById(cluePool);
675   - }
676   - }
677   - cluePool = customerCluePoolService.queryByRefererId(motoId, groupId, FollowTypeEnum.RM);
678   - if (Objects.nonNull(cluePool)) {
679   - boolean equals = ClueStatusEnum.ONGOING.equals(cluePool.getClueStatus()) || ClueStatusEnum.WAITING.equals(cluePool.getClueStatus());
680   - if (equals) {
681   - cluePool.setRefererId(curId);
682   - customerCluePoolService.updateById(cluePool);
683   - }
684   - }
685   - cluePool = customerCluePoolService.queryByRefererId(motoId, groupId, FollowTypeEnum.IR);
686   - if (Objects.nonNull(cluePool)) {
687   - boolean equals = ClueStatusEnum.ONGOING.equals(cluePool.getClueStatus()) || ClueStatusEnum.WAITING.equals(cluePool.getClueStatus());
688   - if (equals) {
689   - cluePool.setRefererId(curId);
690   - customerCluePoolService.updateById(cluePool);
691   - }
692   - }
693   -
694   - List<FollowTask> list = followTaskService.getListByCustomerId(motoId, null);
695   - if (CollectionUtils.isEmpty(list)) {
696   - return;
697   - }
698   - list.forEach(r -> r.setCustomerId(curId));
699   - followTaskService.updateBatchById(list);
700   - }
701 541  
702 542 private void create(Customer customer, Long adviserId, Long shopId) {
703 543 StammkundePool stammkundePool = createSimpleInfo(customer, adviserId);
... ... @@ -777,6 +617,7 @@ public class CustomerChangeBizService extends AbstractCustomerService {
777 617 simpleInfo.setAktiv(Boolean.TRUE);
778 618 simpleInfo.setActivationTime(new Date());
779 619 stammkundePoolService.save(simpleInfo);
  620 + commonService.createClue(customer);
780 621 }
781 622  
782 623 final CustomerInfoDto customerInfoDto = new CustomerInfoDto();
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/NoticeBizService.java
... ... @@ -3,9 +3,9 @@ package cn.fw.valhalla.service.bus.follow;
3 3 import cn.fw.valhalla.common.utils.DateUtil;
4 4 import cn.fw.valhalla.domain.db.customer.Customer;
5 5 import cn.fw.valhalla.domain.db.customer.CustomerBaseInfo;
  6 +import cn.fw.valhalla.domain.db.follow.ClueTask;
  7 +import cn.fw.valhalla.domain.db.follow.FollowClue;
6 8 import cn.fw.valhalla.domain.db.follow.FollowNoticeRecord;
7   -import cn.fw.valhalla.domain.db.follow.FollowTask;
8   -import cn.fw.valhalla.domain.db.pool.CustomerCluePool;
9 9 import cn.fw.valhalla.domain.enums.*;
10 10 import cn.fw.valhalla.domain.vo.setting.SettingVO;
11 11 import cn.fw.valhalla.rpc.ehr.EhrRpcService;
... ... @@ -49,10 +49,10 @@ public class NoticeBizService {
49 49 private final CustomerService customerService;
50 50 private final CustomerBaseInfoService customerBaseInfoService;
51 51 private final OopService oopService;
52   - private final CustomerCluePoolService customerCluePoolService;
53 52 private final SmsRpcService smsRpcService;
54   - private final FollowTaskService followTaskService;
  53 + private final ClueTaskService clueTaskService;
55 54 private final EhrRpcService ehrRpcService;
  55 + private final FollowClueService followClueService;
56 56  
57 57 private final String type = "d";
58 58 private final int day = 2;
... ... @@ -93,16 +93,16 @@ public class NoticeBizService {
93 93 * @param record
94 94 */
95 95 private void sendNoticeAndCreate(FollowNoticeRecord record) {
96   - CustomerCluePool cluePool = customerCluePoolService.getById(record.getClueId());
  96 + FollowClue cluePool = followClueService.getById(record.getClueId());
97 97 if (Objects.isNull(cluePool)) {
98 98 followNoticeRecordService.removeById(record.getId());
99 99 return;
100 100 }
101   - if (ClueStatusEnum.FAILURE.equals(cluePool.getClueStatus()) || ClueStatusEnum.COMPLETE.equals(cluePool.getClueStatus()) || cluePool.getDeadline().before(new Date())) {
  101 + if (ClueStatusEnum.FAILURE.equals(cluePool.getClueState()) || ClueStatusEnum.COMPLETE.equals(cluePool.getClueState()) || cluePool.getEndTime().isBefore(LocalDateTime.now())) {
102 102 followNoticeRecordService.removeById(record.getId());
103 103 return;
104 104 }
105   - Customer customer = customerService.queryById(cluePool.getRefererId());
  105 + Customer customer = customerService.queryByFrameNo(cluePool.getVin(), cluePool.getGroupId());
106 106 if (Objects.isNull(customer)) {
107 107 createNextNotice(record, cluePool.getGroupId());
108 108 return;
... ... @@ -114,7 +114,7 @@ public class NoticeBizService {
114 114 }
115 115 ShopDTO shop = oopService.shop(customer.getShopId());
116 116 if (Objects.isNull(shop)) {
117   - shop = oopService.shop(cluePool.getOriginalShopId());
  117 + shop = oopService.shop(cluePool.getSuggestShopId());
118 118 }
119 119 String shopName = Objects.isNull(shop) ? "" : shop.getShortName();
120 120 boolean flag = false;
... ... @@ -132,12 +132,12 @@ public class NoticeBizService {
132 132 }
133 133 }
134 134  
135   - private boolean sendIR(final FollowNoticeRecord record, final CustomerCluePool cluePool, CustomerBaseInfo baseInfo, String shopName) {
  135 + private boolean sendIR(final FollowNoticeRecord record, final FollowClue cluePool, CustomerBaseInfo baseInfo, String shopName) {
136 136 if (DateUtil.sub(new Date(), record.getSendTime(), type) > day) {
137 137 record.setStatus(SendStatusEnum.SUCCESS);
138 138 return followNoticeRecordService.updateById(record);
139 139 }
140   - Customer customer = Optional.ofNullable(customerService.getById(cluePool.getRefererId())).orElse(new Customer());
  140 + Customer customer = Optional.ofNullable(customerService.queryByFrameNo(cluePool.getVin(), cluePool.getGroupId())).orElse(new Customer());
141 141 //页面附带参数
142 142 HashMap<String, String> paramMap = new HashMap<>(1);
143 143 paramMap.put("bizType", "2");
... ... @@ -159,8 +159,8 @@ public class NoticeBizService {
159 159 record.setStatus(Objects.nonNull(templateResult) ? SendStatusEnum.SUCCESS : SendStatusEnum.FAILED);
160 160 record.setStatusDesc(templateResult.getSceneToken().toString());
161 161 if (SendStatusEnum.FAILED.equals(record.getStatus())) {
162   - Long staffId = cluePool.getOriginalUserId();
163   - FollowTask task = followTaskService.queryOngoingTaskByClueId(cluePool.getId());
  162 + Long staffId = customer.getAdviserId();
  163 + ClueTask task = clueTaskService.queryOngoingTaskByClueId(cluePool.getId());
164 164 if (Objects.nonNull(task)) {
165 165 staffId = task.getFollowUser();
166 166 }
... ... @@ -171,13 +171,13 @@ public class NoticeBizService {
171 171 map.put("shopName", shopName);
172 172 map.put("userName", infoDTO.getName());
173 173 map.put("phone", infoDTO.getMobile());
174   - smsRpcService.sendSms(getIrTemplateCode(), baseInfo.getMobile(), map, cluePool.getOriginalShopId());
  174 + smsRpcService.sendSms(getIrTemplateCode(), baseInfo.getMobile(), map, cluePool.getSuggestShopId());
175 175 }
176 176 }
177 177 return followNoticeRecordService.updateById(record);
178 178 }
179 179  
180   - private boolean sendFM(final FollowNoticeRecord record, final CustomerCluePool cluePool, CustomerBaseInfo baseInfo, String shopName) {
  180 + private boolean sendFM(final FollowNoticeRecord record, final FollowClue cluePool, CustomerBaseInfo baseInfo, String shopName) {
181 181 if (DateUtil.sub(new Date(), record.getSendTime(), type) > day) {
182 182 record.setStatus(SendStatusEnum.SUCCESS);
183 183 return followNoticeRecordService.updateById(record);
... ... @@ -185,7 +185,7 @@ public class NoticeBizService {
185 185 //额外展示数据
186 186 HashMap<String, String> extraMap = new HashMap<>(2);
187 187 extraMap.put("车牌号", cluePool.getPlateNo());
188   - extraMap.put("到期时间", DateUtil.getStringDateShort(cluePool.getDeadline()));
  188 + extraMap.put("到期时间", DateUtil.getStringDateShort(DateUtil.localDateTime2Date(cluePool.getEndTime())));
189 189 //生成发送实体
190 190 TemplateDTO templateDTO = TemplateDTO.builder()
191 191 .content("您好!您的爱车的首次保养即将到期,请尽快进店进行保养!")
... ... @@ -199,8 +199,8 @@ public class NoticeBizService {
199 199 record.setStatus(Objects.nonNull(templateResult) ? SendStatusEnum.SUCCESS : SendStatusEnum.FAILED);
200 200 record.setStatusDesc(templateResult.getSceneToken().toString());
201 201 if (SendStatusEnum.FAILED.equals(record.getStatus())) {
202   - Long staffId = cluePool.getOriginalUserId();
203   - FollowTask task = followTaskService.queryOngoingTaskByClueId(cluePool.getId());
  202 + Long staffId = null;
  203 + ClueTask task = clueTaskService.queryOngoingTaskByClueId(cluePool.getId());
204 204 if (Objects.nonNull(task)) {
205 205 staffId = task.getFollowUser();
206 206 }
... ... @@ -210,13 +210,13 @@ public class NoticeBizService {
210 210 map.put("shopName", shopName);
211 211 map.put("userName", infoDTO.getName());
212 212 map.put("phone", infoDTO.getMobile());
213   - smsRpcService.sendSms(getFmTemplateCode(), baseInfo.getMobile(), map, cluePool.getOriginalShopId());
  213 + smsRpcService.sendSms(getFmTemplateCode(), baseInfo.getMobile(), map, cluePool.getSuggestShopId());
214 214 }
215 215 }
216 216 return followNoticeRecordService.updateById(record);
217 217 }
218 218  
219   - private boolean sendRM(final FollowNoticeRecord record, final CustomerCluePool cluePool, CustomerBaseInfo baseInfo, String shopName) {
  219 + private boolean sendRM(final FollowNoticeRecord record, final FollowClue cluePool, CustomerBaseInfo baseInfo, String shopName) {
220 220 if (DateUtil.sub(new Date(), record.getSendTime(), type) > day) {
221 221 record.setStatus(SendStatusEnum.SUCCESS);
222 222 return followNoticeRecordService.updateById(record);
... ... @@ -224,7 +224,7 @@ public class NoticeBizService {
224 224 //额外展示数据
225 225 HashMap<String, String> extraMap = new HashMap<>(2);
226 226 extraMap.put("车牌号", cluePool.getPlateNo());
227   - extraMap.put("推荐保养时间", DateUtil.getStringDateShort(cluePool.getDeadline()) + " 前");
  227 + extraMap.put("推荐保养时间", DateUtil.getStringDateShort(DateUtil.localDateTime2Date(cluePool.getEndTime())) + " 前");
228 228 //生成发送实体
229 229 TemplateDTO templateDTO = TemplateDTO.builder()
230 230 .content("您好!即将到达您的爱车下次保养日期,请尽快进店进行保养!")
... ... @@ -238,20 +238,20 @@ public class NoticeBizService {
238 238 record.setStatus(Objects.nonNull(templateResult) ? SendStatusEnum.SUCCESS : SendStatusEnum.FAILED);
239 239 record.setStatusDesc(templateResult.getSceneToken().toString());
240 240 if (SendStatusEnum.FAILED.equals(record.getStatus())) {
241   - Long staffId = cluePool.getOriginalUserId();
242   - FollowTask task = followTaskService.queryOngoingTaskByClueId(cluePool.getId());
  241 + Long staffId = null;
  242 + ClueTask task = clueTaskService.queryOngoingTaskByClueId(cluePool.getId());
243 243 if (Objects.nonNull(task)) {
244 244 staffId = task.getFollowUser();
245 245 }
246 246 StaffInfoDTO infoDTO = ehrRpcService.queryStaffInfo(staffId);
247 247 if (Objects.nonNull(infoDTO)) {
248   - Integer m = DateUtil.sub(cluePool.getAddTime(), new Date(), "m");
  248 + Integer m = DateUtil.sub(DateUtil.localDateTime2Date(cluePool.getOriginTime()), new Date(), "m");
249 249 Map<String, Object> map = new HashMap<>(4);
250 250 map.put("num", Math.abs(m));
251 251 map.put("shopName", shopName);
252 252 map.put("userName", infoDTO.getName());
253 253 map.put("phone", infoDTO.getMobile());
254   - smsRpcService.sendSms(getRmTemplateCode(), baseInfo.getMobile(), map, cluePool.getOriginalShopId());
  254 + smsRpcService.sendSms(getRmTemplateCode(), baseInfo.getMobile(), map, cluePool.getSuggestShopId());
255 255 }
256 256 }
257 257 return followNoticeRecordService.updateById(record);
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/PoolBizService.java
... ... @@ -162,9 +162,9 @@ public class PoolBizService {
162 162 }
163 163 page.setTotal(total);
164 164 final HashSet<Long> scope = new HashSet<>(queryVO.getScope());
165   - List<CustomerCluePoolDTO> list = followClueService.clueList(queryVO);
  165 + List<FollowClueDTO> list = followClueService.clueList(queryVO);
166 166 List<CustomerCluePoolVO> appList = new ArrayList<>();
167   - for (CustomerCluePoolDTO dto : list) {
  167 + for (FollowClueDTO dto : list) {
168 168 CustomerCluePoolVO vo = trans2CluePool(dto, scope);
169 169 appList.add(vo);
170 170 }
... ... @@ -299,7 +299,7 @@ public class PoolBizService {
299 299 return vo;
300 300 }
301 301  
302   - private CustomerCluePoolVO trans2CluePool(CustomerCluePoolDTO poolDTO, Set<Long> scope) {
  302 + private CustomerCluePoolVO trans2CluePool(FollowClueDTO poolDTO, Set<Long> scope) {
303 303 CustomerCluePoolVO vo = new CustomerCluePoolVO();
304 304 BeanUtils.copyProperties(poolDTO, vo);
305 305 vo.setStatus(poolDTO.getClueStatus());
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/CustomerCluePoolService.java deleted
1   -package cn.fw.valhalla.service.data;
2   -
3   -import cn.fw.valhalla.domain.db.pool.CustomerCluePool;
4   -import cn.fw.valhalla.domain.dto.CustomerCluePoolDTO;
5   -import cn.fw.valhalla.domain.enums.FollowTypeEnum;
6   -import cn.fw.valhalla.domain.query.CustomerCluePoolQueryVO;
7   -import com.baomidou.mybatisplus.extension.service.IService;
8   -import org.apache.ibatis.annotations.Param;
9   -import org.springframework.lang.Nullable;
10   -
11   -import java.util.List;
12   -
13   -/**
14   - * @author : kurisu
15   - * @className : CustomerCluePoolService
16   - * @description : 客户线索池
17   - * @date: 2020-11-12 09:35
18   - */
19   -public interface CustomerCluePoolService extends IService<CustomerCluePool> {
20   - /**
21   - * 通过refererId查询线索
22   - *
23   - * @param refererId
24   - * @param groupId
25   - * @param type
26   - * @return
27   - */
28   - @Nullable
29   - CustomerCluePool queryByRefererId(Long refererId, Long groupId, FollowTypeEnum type);
30   -
31   - /**
32   - * 通过vin查询线索
33   - *
34   - * @param vin
35   - * @param groupId
36   - * @param type
37   - * @return
38   - */
39   - @Nullable
40   - CustomerCluePool queryByVin(String vin, Long groupId, FollowTypeEnum type);
41   -
42   - /**
43   - * 通过车牌号查询线索
44   - *
45   - * @param plateNo
46   - * @param groupId
47   - * @param type
48   - * @return
49   - */
50   - @Nullable
51   - CustomerCluePool queryByPlateNo(String plateNo, Long groupId, FollowTypeEnum type);
52   -
53   - /**
54   - * 查询客户线索池
55   - *
56   - * @param queryVO
57   - * @return
58   - */
59   - List<CustomerCluePoolDTO> clueList(CustomerCluePoolQueryVO queryVO);
60   -
61   - /**
62   - * 总数
63   - * @param queryVO
64   - * @return
65   - */
66   - Long clueListCount(CustomerCluePoolQueryVO queryVO);
67   -
68   - /**
69   - * 成交数
70   - * @param queryVO
71   - * @return
72   - */
73   - Long completeNum(CustomerCluePoolQueryVO queryVO);
74   -
75   - /**
76   - * 战败数
77   - * @param queryVO
78   - * @return
79   - */
80   - Long defeatNum(CustomerCluePoolQueryVO queryVO);
81   -
82   - /**
83   - * 进行中的数量
84   - * @param queryVO
85   - * @return
86   - */
87   - Long onGoingNum(CustomerCluePoolQueryVO queryVO);
88   -}
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/FollowClueService.java
1 1 package cn.fw.valhalla.service.data;
2 2  
3 3 import cn.fw.valhalla.domain.db.follow.FollowClue;
4   -import cn.fw.valhalla.domain.dto.CustomerCluePoolDTO;
  4 +import cn.fw.valhalla.domain.dto.FollowClueDTO;
5 5 import cn.fw.valhalla.domain.query.CustomerCluePoolQueryVO;
6 6 import com.baomidou.mybatisplus.extension.service.IService;
7 7  
... ... @@ -23,7 +23,7 @@ public interface FollowClueService extends IService&lt;FollowClue&gt; {
23 23 * @param queryVO
24 24 * @return
25 25 */
26   - List<CustomerCluePoolDTO> clueList(CustomerCluePoolQueryVO queryVO);
  26 + List<FollowClueDTO> clueList(CustomerCluePoolQueryVO queryVO);
27 27  
28 28 /**
29 29 * 总数
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/FollowTaskService.java deleted
1   -package cn.fw.valhalla.service.data;
2   -
3   -import cn.fw.valhalla.domain.db.follow.FollowTask;
4   -import cn.fw.valhalla.domain.dto.FollowPoolDTO;
5   -import cn.fw.valhalla.domain.enums.FollowTypeEnum;
6   -import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
7   -import com.baomidou.mybatisplus.extension.service.IService;
8   -
9   -import java.util.List;
10   -
11   -/**
12   - * @author : kurisu
13   - * @className : FollowTaskService
14   - * @description : 跟进任务
15   - * @date: 2020-08-12 11:04
16   - */
17   -public interface FollowTaskService extends IService<FollowTask> {
18   - /**
19   - * 根据档案id查询
20   - *
21   - * @param customerId
22   - * @param list
23   - * @return
24   - */
25   - List<FollowTask> getWaitListByCustomerId(Long customerId, List<FollowTypeEnum> list);
26   -
27   - /**
28   - * 跟进池查询
29   - *
30   - * @param queryVO
31   - * @return
32   - */
33   - List<FollowPoolDTO> followList(FollowPoolQueryVO queryVO);
34   -
35   - /**
36   - * 跟进池查询总数
37   - *
38   - * @param queryVO
39   - * @return
40   - */
41   - long followListCount(FollowPoolQueryVO queryVO);
42   -
43   - /**
44   - * 查询客户所有的跟进信息
45   - *
46   - * @param customerId
47   - * @param list
48   - * @return
49   - */
50   - List<FollowTask> getListByCustomerId(Long customerId, List<FollowTypeEnum> list);
51   -
52   - /**
53   - * 根据线索id查询正在进行中的任务
54   - *
55   - * @param clueId
56   - * @return
57   - */
58   - FollowTask queryOngoingTaskByClueId(Long clueId);
59   -
60   - /**
61   - * 查询是否有正在进行中的跟进任务
62   - *
63   - * @param customerId
64   - * @param followType
65   - * @return
66   - */
67   - boolean hasOngoingTask(Long customerId, Integer followType);
68   -}
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/CustomerCluePoolServiceImpl.java deleted
1   -package cn.fw.valhalla.service.data.impl;
2   -
3   -import cn.fw.valhalla.dao.mapper.CustomerCluePoolMapper;
4   -import cn.fw.valhalla.domain.db.pool.CustomerCluePool;
5   -import cn.fw.valhalla.domain.dto.CustomerCluePoolDTO;
6   -import cn.fw.valhalla.domain.enums.FollowTypeEnum;
7   -import cn.fw.valhalla.domain.query.CustomerCluePoolQueryVO;
8   -import cn.fw.valhalla.service.data.CustomerCluePoolService;
9   -import com.baomidou.mybatisplus.core.toolkit.Wrappers;
10   -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
11   -import org.springframework.lang.Nullable;
12   -import org.springframework.stereotype.Service;
13   -
14   -import java.util.ArrayList;
15   -import java.util.List;
16   -import java.util.Optional;
17   -
18   -/**
19   - * @author : kurisu
20   - * @className : CustomerCluePoolServiceImpl
21   - * @description : 线索池
22   - * @date: 2020-11-12 09:36
23   - */
24   -@Service
25   -public class CustomerCluePoolServiceImpl extends ServiceImpl<CustomerCluePoolMapper, CustomerCluePool> implements CustomerCluePoolService {
26   - @Override
27   - @Nullable
28   - public CustomerCluePool queryByRefererId(Long refererId, Long groupId, FollowTypeEnum type) {
29   - return getOne(Wrappers.<CustomerCluePool>lambdaQuery()
30   - .eq(CustomerCluePool::getRefererId, refererId)
31   - .eq(CustomerCluePool::getGroupId, groupId)
32   - .eq(CustomerCluePool::getClueType, type)
33   - .orderByDesc(CustomerCluePool::getId)
34   - .last(" limit 1")
35   - );
36   - }
37   -
38   - @Override
39   - @Nullable
40   - public CustomerCluePool queryByVin(String vin, Long groupId, FollowTypeEnum type) {
41   - return getOne(Wrappers.<CustomerCluePool>lambdaQuery()
42   - .eq(CustomerCluePool::getFrameNo, vin)
43   - .eq(CustomerCluePool::getGroupId, groupId)
44   - .eq(CustomerCluePool::getClueType, type)
45   - .orderByDesc(CustomerCluePool::getId)
46   - .last(" limit 1")
47   - );
48   - }
49   -
50   - @Override
51   - @Nullable
52   - public CustomerCluePool queryByPlateNo(String plateNo, Long groupId, FollowTypeEnum type) {
53   - return getOne(Wrappers.<CustomerCluePool>lambdaQuery()
54   - .eq(CustomerCluePool::getPlateNo, plateNo)
55   - .eq(CustomerCluePool::getGroupId, groupId)
56   - .eq(CustomerCluePool::getClueType, type)
57   - .orderByDesc(CustomerCluePool::getId)
58   - .last(" limit 1")
59   - );
60   - }
61   -
62   - @Override
63   - public List<CustomerCluePoolDTO> clueList(CustomerCluePoolQueryVO queryVO) {
64   - Integer current = queryVO.getCurrent();
65   - Integer pageSize = queryVO.getPageSize();
66   - Integer startIndex = (current - 1) * pageSize;
67   - return Optional.ofNullable(getBaseMapper().clueList(startIndex, pageSize, queryVO)).orElse(new ArrayList<>());
68   - }
69   -
70   - @Override
71   - public Long clueListCount(CustomerCluePoolQueryVO queryVO) {
72   - return Optional.ofNullable(getBaseMapper().clueListCount(queryVO)).orElse(0L);
73   - }
74   -
75   - @Override
76   - public Long completeNum(CustomerCluePoolQueryVO queryVO) {
77   - return Optional.ofNullable(getBaseMapper().completeNum(queryVO)).orElse(0L);
78   - }
79   -
80   - @Override
81   - public Long defeatNum(CustomerCluePoolQueryVO queryVO) {
82   - return Optional.ofNullable(getBaseMapper().defeatNum(queryVO)).orElse(0L);
83   - }
84   -
85   - @Override
86   - public Long onGoingNum(CustomerCluePoolQueryVO queryVO) {
87   - return Optional.ofNullable(getBaseMapper().onGoingNum(queryVO)).orElse(0L);
88   - }
89   -}
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/FollowClueServiceImpl.java
... ... @@ -2,7 +2,7 @@ package cn.fw.valhalla.service.data.impl;
2 2  
3 3 import cn.fw.valhalla.dao.mapper.FollowClueMapper;
4 4 import cn.fw.valhalla.domain.db.follow.FollowClue;
5   -import cn.fw.valhalla.domain.dto.CustomerCluePoolDTO;
  5 +import cn.fw.valhalla.domain.dto.FollowClueDTO;
6 6 import cn.fw.valhalla.domain.query.CustomerCluePoolQueryVO;
7 7 import cn.fw.valhalla.service.data.FollowClueService;
8 8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
... ... @@ -24,7 +24,7 @@ import java.util.Optional;
24 24 @Service
25 25 public class FollowClueServiceImpl extends ServiceImpl<FollowClueMapper, FollowClue> implements FollowClueService {
26 26 @Override
27   - public List<CustomerCluePoolDTO> clueList(CustomerCluePoolQueryVO queryVO) {
  27 + public List<FollowClueDTO> clueList(CustomerCluePoolQueryVO queryVO) {
28 28 Integer current = queryVO.getCurrent();
29 29 Integer pageSize = queryVO.getPageSize();
30 30 Integer startIndex = (current - 1) * pageSize;
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/FollowTaskServiceImpl.java deleted
1   -package cn.fw.valhalla.service.data.impl;
2   -
3   -import cn.fw.valhalla.dao.mapper.FollowTaskMapper;
4   -import cn.fw.valhalla.domain.db.follow.FollowTask;
5   -import cn.fw.valhalla.domain.dto.FollowPoolDTO;
6   -import cn.fw.valhalla.domain.enums.FollowTypeEnum;
7   -import cn.fw.valhalla.domain.enums.TaskStateEnum;
8   -import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
9   -import cn.fw.valhalla.service.data.FollowTaskService;
10   -import com.baomidou.mybatisplus.core.toolkit.Wrappers;
11   -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
12   -import lombok.extern.slf4j.Slf4j;
13   -import org.springframework.stereotype.Service;
14   -import org.springframework.util.CollectionUtils;
15   -
16   -import java.util.ArrayList;
17   -import java.util.List;
18   -import java.util.Optional;
19   -
20   -/**
21   - * @author : kurisu
22   - * @className : FollowTaskServiceImpl
23   - * @description : 跟进任务
24   - * @date: 2020-08-12 11:05
25   - */
26   -@Service
27   -@Slf4j
28   -public class FollowTaskServiceImpl extends ServiceImpl<FollowTaskMapper, FollowTask> implements FollowTaskService {
29   - @Override
30   - public List<FollowTask> getWaitListByCustomerId(Long customerId, List<FollowTypeEnum> list) {
31   - return Optional.ofNullable(list(Wrappers.<FollowTask>lambdaQuery()
32   - .eq(FollowTask::getCustomerId, customerId)
33   - .eq(FollowTask::getState, TaskStateEnum.ONGOING)
34   - .in(!CollectionUtils.isEmpty(list), FollowTask::getType, list)
35   - )).orElse(new ArrayList<>());
36   - }
37   -
38   - @Override
39   - public List<FollowPoolDTO> followList(FollowPoolQueryVO queryVO) {
40   - Integer current = queryVO.getCurrent();
41   - Integer pageSize = queryVO.getPageSize();
42   - Integer startIndex = (current - 1) * pageSize;
43   - return Optional.ofNullable(getBaseMapper().followList(startIndex, pageSize, queryVO)).orElse(new ArrayList<>());
44   - }
45   -
46   - @Override
47   - public long followListCount(FollowPoolQueryVO queryVO) {
48   - return Optional.ofNullable(getBaseMapper().followListCount(queryVO)).orElse(0L);
49   - }
50   -
51   - @Override
52   - public List<FollowTask> getListByCustomerId(Long customerId, List<FollowTypeEnum> list) {
53   - return Optional.ofNullable(list(Wrappers.<FollowTask>lambdaQuery()
54   - .eq(FollowTask::getCustomerId, customerId)
55   - .eq(FollowTask::getState, TaskStateEnum.ONGOING)
56   - .in(!CollectionUtils.isEmpty(list), FollowTask::getType, list)
57   - )).orElse(new ArrayList<>());
58   - }
59   -
60   - @Override
61   - public FollowTask queryOngoingTaskByClueId(Long clueId) {
62   - return getOne(Wrappers.<FollowTask>lambdaQuery()
63   - .eq(FollowTask::getClueId, clueId)
64   - .eq(FollowTask::getState, TaskStateEnum.ONGOING)
65   - .last(" limit 1")
66   - );
67   - }
68   -
69   - @Override
70   - public boolean hasOngoingTask(Long customerId, Integer followType) {
71   - return count(Wrappers.<FollowTask>lambdaQuery()
72   - .eq(FollowTask::getCustomerId, customerId)
73   - .eq(FollowTask::getState, TaskStateEnum.ONGOING)
74   - .eq(FollowTask::getType, followType)
75   - ) > 0;
76   - }
77   -}