Commit 03c1a9b3dd8ff0db4cd562a19f7d1b0fda12a19f
1 parent
138b8c07
新增自定义查询档案列表的接口
Showing
18 changed files
with
607 additions
and
12 deletions
fw-valhalla-common/src/main/java/cn/fw/valhalla/common/utils/MessageFormatUtil.java
1 | package cn.fw.valhalla.common.utils; | 1 | package cn.fw.valhalla.common.utils; |
2 | 2 | ||
3 | import java.text.MessageFormat; | 3 | import java.text.MessageFormat; |
4 | +import java.time.LocalDate; | ||
4 | import java.util.ArrayList; | 5 | import java.util.ArrayList; |
5 | -import java.util.Date; | ||
6 | import java.util.List; | 6 | import java.util.List; |
7 | 7 | ||
8 | /** | 8 | /** |
@@ -25,7 +25,9 @@ public class MessageFormatUtil { | @@ -25,7 +25,9 @@ public class MessageFormatUtil { | ||
25 | } | 25 | } |
26 | 26 | ||
27 | public static void main(String[] args) { | 27 | public static void main(String[] args) { |
28 | - System.out.println("示例:" + MessageFormatTransfer("crm:valhalla:save:lock:key:{0}:{1}", 11111L, new Date())); | 28 | + // System.out.println("示例:" + MessageFormatTransfer("crm:valhalla:save:lock:key:{0}:{1}", 11111L, new Date())); |
29 | + | ||
30 | + System.out.println(LocalDate.now().plusYears(0)); | ||
29 | } | 31 | } |
30 | 32 | ||
31 | } | 33 | } |
fw-valhalla-dao/src/main/java/cn/fw/valhalla/dao/mapper/CustomerMapper.java
1 | package cn.fw.valhalla.dao.mapper; | 1 | package cn.fw.valhalla.dao.mapper; |
2 | 2 | ||
3 | import cn.fw.valhalla.domain.db.customer.Customer; | 3 | import cn.fw.valhalla.domain.db.customer.Customer; |
4 | +import cn.fw.valhalla.domain.dto.CustomerDetailDto; | ||
4 | import cn.fw.valhalla.domain.dto.StammkundeAnalyseDTO; | 5 | import cn.fw.valhalla.domain.dto.StammkundeAnalyseDTO; |
6 | +import cn.fw.valhalla.domain.query.CustomCustomerQuery; | ||
7 | +import cn.fw.valhalla.domain.query.CustomerQueryVO; | ||
5 | import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO; | 8 | import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO; |
9 | +import cn.fw.valhalla.domain.vo.customer.CustomerListVO; | ||
6 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 10 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
7 | import org.apache.ibatis.annotations.Param; | 11 | import org.apache.ibatis.annotations.Param; |
8 | import org.springframework.stereotype.Repository; | 12 | import org.springframework.stereotype.Repository; |
9 | -import cn.fw.valhalla.domain.vo.customer.CustomerListVO; | ||
10 | -import cn.fw.valhalla.domain.query.CustomerQueryVO; | ||
11 | 13 | ||
12 | import java.util.List; | 14 | import java.util.List; |
13 | 15 | ||
@@ -31,8 +33,17 @@ public interface CustomerMapper extends BaseMapper<Customer> { | @@ -31,8 +33,17 @@ public interface CustomerMapper extends BaseMapper<Customer> { | ||
31 | 33 | ||
32 | /** | 34 | /** |
33 | * 查询指定条件的客户 | 35 | * 查询指定条件的客户 |
36 | + * | ||
34 | * @param queryVO | 37 | * @param queryVO |
35 | * @return | 38 | * @return |
36 | */ | 39 | */ |
37 | List<StammkundeAnalyseDTO> analyseList(@Param("condition") StammkundeAnalyseQueryVO queryVO); | 40 | List<StammkundeAnalyseDTO> analyseList(@Param("condition") StammkundeAnalyseQueryVO queryVO); |
41 | + | ||
42 | + /** | ||
43 | + * 查询自定义参数的档案信息 | ||
44 | + * | ||
45 | + * @param query | ||
46 | + * @return | ||
47 | + */ | ||
48 | + List<CustomerDetailDto> queryCustomList(@Param("condition") CustomCustomerQuery query); | ||
38 | } | 49 | } |
fw-valhalla-dao/src/main/resources/mapper/CustomerMapper.xml
@@ -130,4 +130,93 @@ | @@ -130,4 +130,93 @@ | ||
130 | and t2.lng <= #{condition.maxLng} | 130 | and t2.lng <= #{condition.maxLng} |
131 | </if> | 131 | </if> |
132 | </select> | 132 | </select> |
133 | + | ||
134 | + <select | ||
135 | + id="queryCustomList" | ||
136 | + resultType="cn.fw.valhalla.domain.dto.CustomerDetailDto" | ||
137 | + parameterType="cn.fw.valhalla.domain.query.CustomCustomerQuery" | ||
138 | + > | ||
139 | + select distinct | ||
140 | + t1.*, | ||
141 | + t2.contact name, | ||
142 | + t2.member_id member_id | ||
143 | + from customer t1 inner join customer_base_info t2 on t1.base_id = t2.id | ||
144 | + left join follow_task t3 on t1.id=t3.customer_id and t3.state=1 and t3.type=2 | ||
145 | + left join follow_task t4 on t1.id=t4.customer_id and t4.state=1 and t4.type=4 | ||
146 | + where t1.yn = 1 and t1.group_id = #{condition.groupId} | ||
147 | + <if test="condition.shopList !=null"> | ||
148 | + and t1.shop_id in | ||
149 | + <foreach collection="condition.shopList" item="id" index="index" open="(" close=")" separator=","> | ||
150 | + #{id} | ||
151 | + </foreach> | ||
152 | + </if> | ||
153 | + <if test="condition.followType !=null and condition.followType==2"> | ||
154 | + and t3.id is not null | ||
155 | + </if> | ||
156 | + <if test="condition.followType !=null and condition.followType==4"> | ||
157 | + and t4.id is not null | ||
158 | + </if> | ||
159 | + <if test="condition.frameNo !=null"> | ||
160 | + and t1.frame_no = #{condition.frameNo} | ||
161 | + </if> | ||
162 | + <if test="condition.andCondition==true"> | ||
163 | + and ( | ||
164 | + t1.adviser_id is not null | ||
165 | + <if test="condition.minMileage !=null and condition.maxMileage !=null"> | ||
166 | + <if test="condition.minMileage !=null"> | ||
167 | + and t1.current_mileage >= #{condition.minMileage} | ||
168 | + </if> | ||
169 | + <if test="condition.maxMileage !=null"> | ||
170 | + and t1.current_mileage <= #{condition.maxMileage} | ||
171 | + </if> | ||
172 | + </if> | ||
173 | + | ||
174 | + <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | ||
175 | + <if test="condition.minBuyDate !=null"> | ||
176 | + and t1.buy_date >= #{condition.minBuyDate} | ||
177 | + </if> | ||
178 | + <if test="condition.maxBuyDate !=null"> | ||
179 | + and t1.buy_date <= #{condition.maxBuyDate} | ||
180 | + </if> | ||
181 | + </if> | ||
182 | + | ||
183 | + <if test="condition.level !=null"> | ||
184 | + and t1.cus_level = #{condition.level} | ||
185 | + </if> | ||
186 | + ) | ||
187 | + </if> | ||
188 | + | ||
189 | + <if test="condition.andCondition==false"> | ||
190 | + and ( | ||
191 | + t1.adviser_id is not null | ||
192 | + <if test="condition.minMileage !=null and condition.maxMileage !=null"> | ||
193 | + or ( | ||
194 | + t1.current_mileage is not null | ||
195 | + <if test="condition.minMileage !=null"> | ||
196 | + and t1.current_mileage >= #{condition.minMileage} | ||
197 | + </if> | ||
198 | + <if test="condition.maxMileage !=null"> | ||
199 | + and t1.current_mileage <= #{condition.maxMileage} | ||
200 | + </if> | ||
201 | + ) | ||
202 | + </if> | ||
203 | + | ||
204 | + <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | ||
205 | + or ( | ||
206 | + t1.buy_date is not null | ||
207 | + <if test="condition.minBuyDate !=null"> | ||
208 | + and t1.buy_date >= #{condition.minBuyDate} | ||
209 | + </if> | ||
210 | + <if test="condition.maxBuyDate !=null"> | ||
211 | + and t1.buy_date <= #{condition.maxBuyDate} | ||
212 | + </if> | ||
213 | + ) | ||
214 | + </if> | ||
215 | + | ||
216 | + <if test="condition.level !=null"> | ||
217 | + or t1.cus_level = #{condition.level} | ||
218 | + </if> | ||
219 | + ) | ||
220 | + </if> | ||
221 | + </select> | ||
133 | </mapper> | 222 | </mapper> |
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/query/CustomCustomerQuery.java
0 → 100644
1 | +package cn.fw.valhalla.domain.query; | ||
2 | + | ||
3 | + | ||
4 | +import lombok.Data; | ||
5 | + | ||
6 | +import java.time.LocalDate; | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author : kurisu | ||
11 | + * @className : CustomCustomerQuery | ||
12 | + * @description : | ||
13 | + * @date: 2022-01-10 17:46 | ||
14 | + */ | ||
15 | +@Data | ||
16 | +public class CustomCustomerQuery { | ||
17 | + | ||
18 | + private Integer minMileage; | ||
19 | + private Integer maxMileage; | ||
20 | + private LocalDate minBuyDate; | ||
21 | + private LocalDate maxBuyDate; | ||
22 | + private Integer level; | ||
23 | + | ||
24 | + | ||
25 | + private boolean andCondition; | ||
26 | + | ||
27 | + | ||
28 | + private Integer customerType; | ||
29 | + | ||
30 | + private Long groupId; | ||
31 | + | ||
32 | + private Integer followType; | ||
33 | + private String frameNo; | ||
34 | + private List<Long> shopList; | ||
35 | +} |
fw-valhalla-sdk/pom.xml
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | <relativePath>../pom.xml</relativePath> | 10 | <relativePath>../pom.xml</relativePath> |
11 | </parent> | 11 | </parent> |
12 | <artifactId>fw-valhalla-sdk</artifactId> | 12 | <artifactId>fw-valhalla-sdk</artifactId> |
13 | - <version>1.1.4</version> | 13 | + <version>1.1.5</version> |
14 | <packaging>jar</packaging> | 14 | <packaging>jar</packaging> |
15 | <name>fw-valhalla-sdk</name> | 15 | <name>fw-valhalla-sdk</name> |
16 | 16 |
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/api/ValhallaGeneralApiService.java
1 | package cn.fw.valhalla.sdk.api; | 1 | package cn.fw.valhalla.sdk.api; |
2 | 2 | ||
3 | import cn.fw.data.base.domain.common.Message; | 3 | import cn.fw.data.base.domain.common.Message; |
4 | +import cn.fw.valhalla.sdk.param.CustomerQueryReq; | ||
4 | import cn.fw.valhalla.sdk.param.ReachLogReq; | 5 | import cn.fw.valhalla.sdk.param.ReachLogReq; |
6 | +import cn.fw.valhalla.sdk.result.CustomerSimpleInfoDto; | ||
5 | import org.springframework.cloud.openfeign.FeignClient; | 7 | import org.springframework.cloud.openfeign.FeignClient; |
6 | import org.springframework.web.bind.annotation.PostMapping; | 8 | import org.springframework.web.bind.annotation.PostMapping; |
7 | import org.springframework.web.bind.annotation.RequestBody; | 9 | import org.springframework.web.bind.annotation.RequestBody; |
8 | 10 | ||
9 | import javax.validation.Valid; | 11 | import javax.validation.Valid; |
12 | +import java.util.List; | ||
10 | 13 | ||
11 | /** | 14 | /** |
12 | * @author : kurisu | 15 | * @author : kurisu |
@@ -18,9 +21,19 @@ import javax.validation.Valid; | @@ -18,9 +21,19 @@ import javax.validation.Valid; | ||
18 | public interface ValhallaGeneralApiService { | 21 | public interface ValhallaGeneralApiService { |
19 | /** | 22 | /** |
20 | * 保存进站记录 | 23 | * 保存进站记录 |
24 | + * | ||
21 | * @param reachLogReq | 25 | * @param reachLogReq |
22 | * @return | 26 | * @return |
23 | */ | 27 | */ |
24 | @PostMapping("/reach/save") | 28 | @PostMapping("/reach/save") |
25 | Message<Void> saveReachLog(@Valid @RequestBody ReachLogReq reachLogReq); | 29 | Message<Void> saveReachLog(@Valid @RequestBody ReachLogReq reachLogReq); |
30 | + | ||
31 | + /** | ||
32 | + * 查询保有客档案信息 | ||
33 | + * | ||
34 | + * @param customerQueryReq | ||
35 | + * @return | ||
36 | + */ | ||
37 | + @PostMapping("/query/customer/list") | ||
38 | + Message<List<CustomerSimpleInfoDto>> queryCustomList(@RequestBody CustomerQueryReq customerQueryReq); | ||
26 | } | 39 | } |
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/enums/CustomerFollowTypeEnum.java
0 → 100644
1 | +package cn.fw.valhalla.sdk.enums; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.annotation.JsonCreator; | ||
4 | +import com.fasterxml.jackson.annotation.JsonValue; | ||
5 | +import lombok.Getter; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author : kurisu | ||
9 | + * @className : CustomerFollowTypeEnum | ||
10 | + * @description : 跟进类型 | ||
11 | + * @date: 2022-01-10 17:37 | ||
12 | + */ | ||
13 | +public enum CustomerFollowTypeEnum { | ||
14 | + /** | ||
15 | + * 例保 | ||
16 | + */ | ||
17 | + RM(2, "流失客户"), | ||
18 | + /** | ||
19 | + * 续保 | ||
20 | + */ | ||
21 | + IR(4, "续保"), | ||
22 | + ; | ||
23 | + | ||
24 | + /** | ||
25 | + * 值 | ||
26 | + */ | ||
27 | + private final Integer value; | ||
28 | + /** | ||
29 | + * 名称 | ||
30 | + */ | ||
31 | + @Getter | ||
32 | + private final String name; | ||
33 | + | ||
34 | + CustomerFollowTypeEnum(final Integer value, final String name) { | ||
35 | + this.value = value; | ||
36 | + this.name = name; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * 根据枚举值获取枚举对象 | ||
41 | + */ | ||
42 | + @JsonCreator | ||
43 | + public static CustomerFollowTypeEnum ofValue(final Integer value) { | ||
44 | + for (final CustomerFollowTypeEnum typeEnum : CustomerFollowTypeEnum.values()) { | ||
45 | + if (typeEnum.value.equals(value)) { | ||
46 | + return typeEnum; | ||
47 | + } | ||
48 | + } | ||
49 | + return null; | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * 获取描述 | ||
54 | + * | ||
55 | + * @return 值 | ||
56 | + */ | ||
57 | + @JsonCreator | ||
58 | + public static String getNameByVale(final Integer value) { | ||
59 | + for (final CustomerFollowTypeEnum typeEnum : CustomerFollowTypeEnum.values()) { | ||
60 | + if (typeEnum.value.equals(value)) { | ||
61 | + return typeEnum.getName(); | ||
62 | + } | ||
63 | + } | ||
64 | + return ""; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * 获取值 | ||
69 | + * | ||
70 | + * @return 值 | ||
71 | + */ | ||
72 | + @JsonValue | ||
73 | + public Integer getValue() { | ||
74 | + return value; | ||
75 | + } | ||
76 | +} |
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/param/CustomerQueryReq.java
0 → 100644
1 | +package cn.fw.valhalla.sdk.param; | ||
2 | + | ||
3 | +import cn.fw.valhalla.sdk.enums.CustomerFollowTypeEnum; | ||
4 | +import lombok.EqualsAndHashCode; | ||
5 | +import lombok.ToString; | ||
6 | + | ||
7 | +import javax.validation.constraints.NotNull; | ||
8 | +import java.io.Serializable; | ||
9 | +import java.util.Arrays; | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | + | ||
13 | +/** | ||
14 | + * @author : kurisu | ||
15 | + * @className : CustomerQueryReq | ||
16 | + * @description : 保有客查询参数 | ||
17 | + * @date: 2022-01-10 14:59 | ||
18 | + */ | ||
19 | +@ToString | ||
20 | +@EqualsAndHashCode | ||
21 | +public class CustomerQueryReq implements Serializable { | ||
22 | + private static final long serialVersionUID = 2363764577856885L; | ||
23 | + | ||
24 | + /** | ||
25 | + * 进站里程 | ||
26 | + * 单位km 最多指会取前两个元素 | ||
27 | + */ | ||
28 | + private Integer[] arrivalMileage; | ||
29 | + | ||
30 | + /** | ||
31 | + * 车辆年限 | ||
32 | + * 向上取整 | ||
33 | + */ | ||
34 | + private Integer[] ageLimit; | ||
35 | + | ||
36 | + /** | ||
37 | + * 客户星级 | ||
38 | + */ | ||
39 | + private Integer level; | ||
40 | + /** | ||
41 | + * 是否是 并且条件 | ||
42 | + * 反之就是或者 | ||
43 | + */ | ||
44 | + private boolean andCondition; | ||
45 | + | ||
46 | + | ||
47 | + /** | ||
48 | + * (以下独立于 andCondition 都是取并且) | ||
49 | + * 保有客类型 (暂无) | ||
50 | + */ | ||
51 | + @Deprecated | ||
52 | + private Integer customerType; | ||
53 | + | ||
54 | + @NotNull(message = "集团id不能为空") | ||
55 | + private Long groupId; | ||
56 | + | ||
57 | + /** | ||
58 | + * 保有客跟进类型 | ||
59 | + */ | ||
60 | + private CustomerFollowTypeEnum followType; | ||
61 | + /** | ||
62 | + * 车架号 | ||
63 | + */ | ||
64 | + private String frameNo; | ||
65 | + | ||
66 | + /** | ||
67 | + * 门店id列表 | ||
68 | + */ | ||
69 | + private List<Long> shopList; | ||
70 | + | ||
71 | + public Integer getCustomerType() { | ||
72 | + return customerType; | ||
73 | + } | ||
74 | + | ||
75 | + public void setCustomerType(Integer customerType) { | ||
76 | + this.customerType = customerType; | ||
77 | + } | ||
78 | + | ||
79 | + public CustomerFollowTypeEnum getFollowType() { | ||
80 | + return followType; | ||
81 | + } | ||
82 | + | ||
83 | + public void setFollowType(CustomerFollowTypeEnum followType) { | ||
84 | + this.followType = followType; | ||
85 | + } | ||
86 | + | ||
87 | + public Integer[] getArrivalMileage() { | ||
88 | + return arrivalMileage; | ||
89 | + } | ||
90 | + | ||
91 | + public void setArrivalMileage(Integer... arrivalMileage) { | ||
92 | + if (arrivalMileage != null && arrivalMileage.length > 2) { | ||
93 | + this.arrivalMileage = Arrays.copyOfRange(arrivalMileage, 0, 2); | ||
94 | + return; | ||
95 | + } | ||
96 | + this.arrivalMileage = arrivalMileage; | ||
97 | + } | ||
98 | + | ||
99 | + public Integer[] getAgeLimit() { | ||
100 | + return ageLimit; | ||
101 | + } | ||
102 | + | ||
103 | + public void setAgeLimit(Integer... ageLimit) { | ||
104 | + if (ageLimit != null && ageLimit.length > 2) { | ||
105 | + this.ageLimit = Arrays.copyOfRange(ageLimit, 0, 2); | ||
106 | + return; | ||
107 | + } | ||
108 | + this.ageLimit = ageLimit; | ||
109 | + } | ||
110 | + | ||
111 | + public Integer getLevel() { | ||
112 | + return level; | ||
113 | + } | ||
114 | + | ||
115 | + public void setLevel(Integer level) { | ||
116 | + this.level = level; | ||
117 | + } | ||
118 | + | ||
119 | + public boolean isAndCondition() { | ||
120 | + return andCondition; | ||
121 | + } | ||
122 | + | ||
123 | + public void setAndCondition(boolean andCondition) { | ||
124 | + this.andCondition = andCondition; | ||
125 | + } | ||
126 | + | ||
127 | + public String getFrameNo() { | ||
128 | + return frameNo; | ||
129 | + } | ||
130 | + | ||
131 | + public void setFrameNo(String frameNo) { | ||
132 | + this.frameNo = frameNo; | ||
133 | + } | ||
134 | + | ||
135 | + public List<Long> getShopList() { | ||
136 | + return shopList; | ||
137 | + } | ||
138 | + | ||
139 | + public void setShopList(List<Long> shopList) { | ||
140 | + this.shopList = shopList; | ||
141 | + } | ||
142 | + | ||
143 | + public Long getGroupId() { | ||
144 | + return groupId; | ||
145 | + } | ||
146 | + | ||
147 | + public void setGroupId(Long groupId) { | ||
148 | + this.groupId = groupId; | ||
149 | + } | ||
150 | +} |
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/CustomerSimpleInfoDto.java
0 → 100644
1 | +package cn.fw.valhalla.sdk.result; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +import java.util.Date; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author kurisu | ||
9 | + * @date 2020-08-27 | ||
10 | + */ | ||
11 | +@Data | ||
12 | +public class CustomerSimpleInfoDto { | ||
13 | + private Long id; | ||
14 | + /** | ||
15 | + * 会员id | ||
16 | + */ | ||
17 | + private Long memberId; | ||
18 | + /** | ||
19 | + * 车牌号 | ||
20 | + */ | ||
21 | + private String plateNo; | ||
22 | + /** | ||
23 | + * 车架号 | ||
24 | + */ | ||
25 | + private String frameNo; | ||
26 | + /** | ||
27 | + * 发动机编号 | ||
28 | + */ | ||
29 | + private String engineNo; | ||
30 | + /** | ||
31 | + * 行驶证注册日期 | ||
32 | + */ | ||
33 | + private Date regDate; | ||
34 | + /** | ||
35 | + * 车型代码 | ||
36 | + */ | ||
37 | + private String specCode; | ||
38 | + /** | ||
39 | + * 品牌id | ||
40 | + */ | ||
41 | + private Long brandId; | ||
42 | + /** | ||
43 | + * 品牌名称 | ||
44 | + */ | ||
45 | + private String brandName; | ||
46 | + /** | ||
47 | + * 车系id | ||
48 | + */ | ||
49 | + private Long seriesId; | ||
50 | + /** | ||
51 | + * 车系名称 | ||
52 | + */ | ||
53 | + private String seriesName; | ||
54 | + /** | ||
55 | + * 车系id | ||
56 | + */ | ||
57 | + private Long specId; | ||
58 | + /** | ||
59 | + * 车系名称 | ||
60 | + */ | ||
61 | + private String specName; | ||
62 | + /** | ||
63 | + * 车辆图片 | ||
64 | + */ | ||
65 | + private String carImage; | ||
66 | + /** | ||
67 | + * 标签 | ||
68 | + */ | ||
69 | + private String tags; | ||
70 | + /** | ||
71 | + * 客户星级 | ||
72 | + */ | ||
73 | + private Integer cusLevel; | ||
74 | + /** | ||
75 | + * 姓名 | ||
76 | + */ | ||
77 | + private String name; | ||
78 | + /** | ||
79 | + * 联系电话 | ||
80 | + */ | ||
81 | + private String mobile; | ||
82 | + /** | ||
83 | + * 保险到期日期 | ||
84 | + */ | ||
85 | + private Date insuranceExpireDate; | ||
86 | + /** | ||
87 | + * 当前行驶里程 单位KM | ||
88 | + */ | ||
89 | + private Integer currentMileage; | ||
90 | + /** | ||
91 | + * 购车时间 | ||
92 | + */ | ||
93 | + private Date buyDate; | ||
94 | + /** | ||
95 | + * 所属服务站id | ||
96 | + */ | ||
97 | + private Long shopId; | ||
98 | + /** | ||
99 | + * 所属商家id | ||
100 | + */ | ||
101 | + private Long dealerId; | ||
102 | + /** | ||
103 | + * 所属集团 | ||
104 | + */ | ||
105 | + private Long groupId; | ||
106 | + /** | ||
107 | + * 专属服务顾问id | ||
108 | + */ | ||
109 | + private Long adviserId; | ||
110 | +} | ||
0 | \ No newline at end of file | 111 | \ No newline at end of file |
fw-valhalla-server/src/main/java/cn/fw/valhalla/ValhallaApplication.java
@@ -26,7 +26,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; | @@ -26,7 +26,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; | ||
26 | @EnableAutoConfiguration | 26 | @EnableAutoConfiguration |
27 | @Configuration | 27 | @Configuration |
28 | @EnableRedisRepositories | 28 | @EnableRedisRepositories |
29 | -@MapperScan("cn.fw.**.mapper") | 29 | +@MapperScan("cn.fw.valhalla.dao.mapper") |
30 | @ComponentScan({"cn.fw.valhalla.*"}) | 30 | @ComponentScan({"cn.fw.valhalla.*"}) |
31 | @EnableFeignClients({"cn.fw.**.sdk", "cn.fw.flow.api"}) | 31 | @EnableFeignClients({"cn.fw.**.sdk", "cn.fw.flow.api"}) |
32 | @EnableConfigurationProperties({UrlProperty.class}) | 32 | @EnableConfigurationProperties({UrlProperty.class}) |
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/api/ValhallaGeneralApiServiceImpl.java
@@ -2,10 +2,15 @@ package cn.fw.valhalla.controller.api; | @@ -2,10 +2,15 @@ package cn.fw.valhalla.controller.api; | ||
2 | 2 | ||
3 | import cn.fw.common.web.annotation.ControllerMethod; | 3 | import cn.fw.common.web.annotation.ControllerMethod; |
4 | import cn.fw.data.base.domain.common.Message; | 4 | import cn.fw.data.base.domain.common.Message; |
5 | +import cn.fw.valhalla.domain.dto.CustomerDetailDto; | ||
5 | import cn.fw.valhalla.sdk.api.ValhallaGeneralApiService; | 6 | import cn.fw.valhalla.sdk.api.ValhallaGeneralApiService; |
7 | +import cn.fw.valhalla.sdk.param.CustomerQueryReq; | ||
6 | import cn.fw.valhalla.sdk.param.ReachLogReq; | 8 | import cn.fw.valhalla.sdk.param.ReachLogReq; |
9 | +import cn.fw.valhalla.sdk.result.CustomerSimpleInfoDto; | ||
7 | import cn.fw.valhalla.service.bus.ReachLogBizService; | 10 | import cn.fw.valhalla.service.bus.ReachLogBizService; |
11 | +import cn.fw.valhalla.service.bus.cust.CustomerBizService; | ||
8 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
13 | +import org.springframework.beans.BeanUtils; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
10 | import org.springframework.web.bind.annotation.PostMapping; | 15 | import org.springframework.web.bind.annotation.PostMapping; |
11 | import org.springframework.web.bind.annotation.RequestBody; | 16 | import org.springframework.web.bind.annotation.RequestBody; |
@@ -13,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -13,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
13 | import org.springframework.web.bind.annotation.RestController; | 18 | import org.springframework.web.bind.annotation.RestController; |
14 | 19 | ||
15 | import javax.validation.Valid; | 20 | import javax.validation.Valid; |
21 | +import java.util.ArrayList; | ||
22 | +import java.util.List; | ||
16 | 23 | ||
17 | import static cn.fw.common.web.util.ResultBuilder.success; | 24 | import static cn.fw.common.web.util.ResultBuilder.success; |
18 | 25 | ||
@@ -28,10 +35,16 @@ import static cn.fw.common.web.util.ResultBuilder.success; | @@ -28,10 +35,16 @@ import static cn.fw.common.web.util.ResultBuilder.success; | ||
28 | public class ValhallaGeneralApiServiceImpl implements ValhallaGeneralApiService { | 35 | public class ValhallaGeneralApiServiceImpl implements ValhallaGeneralApiService { |
29 | 36 | ||
30 | private final ReachLogBizService reachLogBizService; | 37 | private final ReachLogBizService reachLogBizService; |
38 | + /** | ||
39 | + * 保有客数据服务 | ||
40 | + */ | ||
41 | + private final CustomerBizService customerBiz; | ||
31 | 42 | ||
32 | @Autowired | 43 | @Autowired |
33 | - public ValhallaGeneralApiServiceImpl(final ReachLogBizService reachLogBizService) { | 44 | + public ValhallaGeneralApiServiceImpl(final ReachLogBizService reachLogBizService, |
45 | + final CustomerBizService customerBiz) { | ||
34 | this.reachLogBizService = reachLogBizService; | 46 | this.reachLogBizService = reachLogBizService; |
47 | + this.customerBiz = customerBiz; | ||
35 | } | 48 | } |
36 | 49 | ||
37 | @PostMapping("/reach/save") | 50 | @PostMapping("/reach/save") |
@@ -41,4 +54,18 @@ public class ValhallaGeneralApiServiceImpl implements ValhallaGeneralApiService | @@ -41,4 +54,18 @@ public class ValhallaGeneralApiServiceImpl implements ValhallaGeneralApiService | ||
41 | reachLogBizService.saveReachLog(reachLogReq); | 54 | reachLogBizService.saveReachLog(reachLogReq); |
42 | return success(); | 55 | return success(); |
43 | } | 56 | } |
57 | + | ||
58 | + @Override | ||
59 | + @PostMapping("/query/customer/list") | ||
60 | + @ControllerMethod("查询保有客档案列表") | ||
61 | + public Message<List<CustomerSimpleInfoDto>> queryCustomList(@Valid @RequestBody CustomerQueryReq customerQueryReq) { | ||
62 | + List<CustomerDetailDto> list = customerBiz.queryCustomList(customerQueryReq); | ||
63 | + List<CustomerSimpleInfoDto> dtoList = new ArrayList<>(); | ||
64 | + for (CustomerDetailDto customer : list) { | ||
65 | + CustomerSimpleInfoDto dto = new CustomerSimpleInfoDto(); | ||
66 | + BeanUtils.copyProperties(customer, dto); | ||
67 | + dtoList.add(dto); | ||
68 | + } | ||
69 | + return success(dtoList); | ||
70 | + } | ||
44 | } | 71 | } |
fw-valhalla-server/src/main/resources/application-local.yml
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java
@@ -16,6 +16,7 @@ import cn.fw.valhalla.domain.db.pool.PublicPool; | @@ -16,6 +16,7 @@ import cn.fw.valhalla.domain.db.pool.PublicPool; | ||
16 | import cn.fw.valhalla.domain.db.pool.StammkundePool; | 16 | import cn.fw.valhalla.domain.db.pool.StammkundePool; |
17 | import cn.fw.valhalla.domain.dto.CustomerDetailDto; | 17 | import cn.fw.valhalla.domain.dto.CustomerDetailDto; |
18 | import cn.fw.valhalla.domain.enums.*; | 18 | import cn.fw.valhalla.domain.enums.*; |
19 | +import cn.fw.valhalla.domain.query.CustomCustomerQuery; | ||
19 | import cn.fw.valhalla.domain.query.CustomerQueryVO; | 20 | import cn.fw.valhalla.domain.query.CustomerQueryVO; |
20 | import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO; | 21 | import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO; |
21 | import cn.fw.valhalla.domain.vo.customer.*; | 22 | import cn.fw.valhalla.domain.vo.customer.*; |
@@ -31,6 +32,7 @@ import cn.fw.valhalla.rpc.member.dto.MemberUserDTO; | @@ -31,6 +32,7 @@ import cn.fw.valhalla.rpc.member.dto.MemberUserDTO; | ||
31 | import cn.fw.valhalla.rpc.oop.dto.ShopDTO; | 32 | import cn.fw.valhalla.rpc.oop.dto.ShopDTO; |
32 | import cn.fw.valhalla.rpc.oop.dto.SpecDTO; | 33 | import cn.fw.valhalla.rpc.oop.dto.SpecDTO; |
33 | import cn.fw.valhalla.sdk.param.CustomerParams; | 34 | import cn.fw.valhalla.sdk.param.CustomerParams; |
35 | +import cn.fw.valhalla.sdk.param.CustomerQueryReq; | ||
34 | import cn.fw.valhalla.sdk.result.CustomerInfoDto; | 36 | import cn.fw.valhalla.sdk.result.CustomerInfoDto; |
35 | import cn.fw.valhalla.sdk.result.ReceptionResultDto; | 37 | import cn.fw.valhalla.sdk.result.ReceptionResultDto; |
36 | import cn.fw.valhalla.service.bus.StammkundeBizService; | 38 | import cn.fw.valhalla.service.bus.StammkundeBizService; |
@@ -84,6 +86,7 @@ public class CustomerBizService extends AbstractCustomerService { | @@ -84,6 +86,7 @@ public class CustomerBizService extends AbstractCustomerService { | ||
84 | private final SettingBizService settingBizService; | 86 | private final SettingBizService settingBizService; |
85 | private final FollowRecordService followRecordService; | 87 | private final FollowRecordService followRecordService; |
86 | private final StammkundeBizService stammkundeBizService; | 88 | private final StammkundeBizService stammkundeBizService; |
89 | + private final FollowTaskService followTaskService; | ||
87 | 90 | ||
88 | @Value("${spring.cache.custom.global-prefix}:customer") | 91 | @Value("${spring.cache.custom.global-prefix}:customer") |
89 | @Getter | 92 | @Getter |
@@ -349,6 +352,19 @@ public class CustomerBizService extends AbstractCustomerService { | @@ -349,6 +352,19 @@ public class CustomerBizService extends AbstractCustomerService { | ||
349 | } | 352 | } |
350 | 353 | ||
351 | /** | 354 | /** |
355 | + * 根据自定义条件查询保有客档案 | ||
356 | + * | ||
357 | + * @param queryReq | ||
358 | + * @return | ||
359 | + */ | ||
360 | + public List<CustomerDetailDto> queryCustomList(final CustomerQueryReq queryReq) { | ||
361 | + | ||
362 | + CustomCustomerQuery query = fillParams(queryReq); | ||
363 | + | ||
364 | + return customerService.queryCustomList(query); | ||
365 | + } | ||
366 | + | ||
367 | + /** | ||
352 | * 根据手机号查询所有档案 | 368 | * 根据手机号查询所有档案 |
353 | * | 369 | * |
354 | * @param mobile | 370 | * @param mobile |
@@ -780,4 +796,38 @@ public class CustomerBizService extends AbstractCustomerService { | @@ -780,4 +796,38 @@ public class CustomerBizService extends AbstractCustomerService { | ||
780 | vo.setPeriods(loanInfo.getPeriods()); | 796 | vo.setPeriods(loanInfo.getPeriods()); |
781 | } | 797 | } |
782 | } | 798 | } |
799 | + | ||
800 | + private CustomCustomerQuery fillParams(final CustomerQueryReq queryReq) { | ||
801 | + CustomCustomerQuery query = new CustomCustomerQuery(); | ||
802 | + BeanUtils.copyProperties(queryReq, query); | ||
803 | + | ||
804 | + | ||
805 | + if (queryReq.getArrivalMileage() != null && queryReq.getArrivalMileage().length > 0) { | ||
806 | + for (int i = 0; i < queryReq.getArrivalMileage().length; i++) { | ||
807 | + if (i == 0) { | ||
808 | + query.setMinMileage(queryReq.getArrivalMileage()[i]); | ||
809 | + } | ||
810 | + if (i == 1) { | ||
811 | + query.setMaxMileage(queryReq.getArrivalMileage()[i]); | ||
812 | + } | ||
813 | + } | ||
814 | + } | ||
815 | + | ||
816 | + if (queryReq.getAgeLimit() != null && queryReq.getAgeLimit().length > 0) { | ||
817 | + for (int i = 0; i < queryReq.getAgeLimit().length; i++) { | ||
818 | + if (i == 0) { | ||
819 | + query.setMaxBuyDate(LocalDate.now().plusYears(-1L * queryReq.getAgeLimit()[i])); | ||
820 | + } | ||
821 | + if (i == 1) { | ||
822 | + query.setMinBuyDate(LocalDate.now().plusYears(-1L * queryReq.getAgeLimit()[i])); | ||
823 | + } | ||
824 | + } | ||
825 | + } | ||
826 | + | ||
827 | + if (Objects.nonNull(queryReq.getFollowType())) { | ||
828 | + query.setFollowType(queryReq.getFollowType().getValue()); | ||
829 | + } | ||
830 | + | ||
831 | + return query; | ||
832 | + } | ||
783 | } | 833 | } |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/CustomerService.java
1 | package cn.fw.valhalla.service.data; | 1 | package cn.fw.valhalla.service.data; |
2 | 2 | ||
3 | import cn.fw.valhalla.domain.db.customer.Customer; | 3 | import cn.fw.valhalla.domain.db.customer.Customer; |
4 | +import cn.fw.valhalla.domain.dto.CustomerDetailDto; | ||
4 | import cn.fw.valhalla.domain.dto.StammkundeAnalyseDTO; | 5 | import cn.fw.valhalla.domain.dto.StammkundeAnalyseDTO; |
6 | +import cn.fw.valhalla.domain.query.CustomCustomerQuery; | ||
5 | import cn.fw.valhalla.domain.query.CustomerQueryVO; | 7 | import cn.fw.valhalla.domain.query.CustomerQueryVO; |
6 | import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO; | 8 | import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO; |
7 | import cn.fw.valhalla.domain.vo.customer.CustomerListVO; | 9 | import cn.fw.valhalla.domain.vo.customer.CustomerListVO; |
@@ -110,4 +112,12 @@ public interface CustomerService extends IService<Customer> { | @@ -110,4 +112,12 @@ public interface CustomerService extends IService<Customer> { | ||
110 | * @return | 112 | * @return |
111 | */ | 113 | */ |
112 | List<StammkundeAnalyseDTO> analyseList(StammkundeAnalyseQueryVO queryVO); | 114 | List<StammkundeAnalyseDTO> analyseList(StammkundeAnalyseQueryVO queryVO); |
115 | + | ||
116 | + /** | ||
117 | + * 查询自定义参数的档案信息 | ||
118 | + * | ||
119 | + * @param query | ||
120 | + * @return | ||
121 | + */ | ||
122 | + List<CustomerDetailDto> queryCustomList(CustomCustomerQuery query); | ||
113 | } | 123 | } |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/FollowTaskService.java
@@ -56,4 +56,13 @@ public interface FollowTaskService extends IService<FollowTask> { | @@ -56,4 +56,13 @@ public interface FollowTaskService extends IService<FollowTask> { | ||
56 | * @return | 56 | * @return |
57 | */ | 57 | */ |
58 | FollowTask queryOngoingTaskByClueId(Long clueId); | 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); | ||
59 | } | 68 | } |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/CustomerServiceImpl.java
@@ -2,7 +2,9 @@ package cn.fw.valhalla.service.data.impl; | @@ -2,7 +2,9 @@ package cn.fw.valhalla.service.data.impl; | ||
2 | 2 | ||
3 | import cn.fw.valhalla.dao.mapper.CustomerMapper; | 3 | import cn.fw.valhalla.dao.mapper.CustomerMapper; |
4 | import cn.fw.valhalla.domain.db.customer.Customer; | 4 | import cn.fw.valhalla.domain.db.customer.Customer; |
5 | +import cn.fw.valhalla.domain.dto.CustomerDetailDto; | ||
5 | import cn.fw.valhalla.domain.dto.StammkundeAnalyseDTO; | 6 | import cn.fw.valhalla.domain.dto.StammkundeAnalyseDTO; |
7 | +import cn.fw.valhalla.domain.query.CustomCustomerQuery; | ||
6 | import cn.fw.valhalla.domain.query.CustomerQueryVO; | 8 | import cn.fw.valhalla.domain.query.CustomerQueryVO; |
7 | import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO; | 9 | import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO; |
8 | import cn.fw.valhalla.domain.vo.customer.CustomerListVO; | 10 | import cn.fw.valhalla.domain.vo.customer.CustomerListVO; |
@@ -17,7 +19,6 @@ import org.springframework.util.CollectionUtils; | @@ -17,7 +19,6 @@ import org.springframework.util.CollectionUtils; | ||
17 | 19 | ||
18 | import java.util.ArrayList; | 20 | import java.util.ArrayList; |
19 | import java.util.List; | 21 | import java.util.List; |
20 | -import java.util.Objects; | ||
21 | import java.util.Optional; | 22 | import java.util.Optional; |
22 | 23 | ||
23 | /** | 24 | /** |
@@ -119,4 +120,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i | @@ -119,4 +120,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i | ||
119 | List<StammkundeAnalyseDTO> list = this.getBaseMapper().analyseList(queryVO); | 120 | List<StammkundeAnalyseDTO> list = this.getBaseMapper().analyseList(queryVO); |
120 | return Optional.ofNullable(list).orElse(new ArrayList<>()); | 121 | return Optional.ofNullable(list).orElse(new ArrayList<>()); |
121 | } | 122 | } |
123 | + | ||
124 | + @Override | ||
125 | + public List<CustomerDetailDto> queryCustomList(CustomCustomerQuery query) { | ||
126 | + return Optional.ofNullable(getBaseMapper().queryCustomList(query)).orElse(new ArrayList<>()); | ||
127 | + } | ||
122 | } | 128 | } |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/FollowTaskServiceImpl.java
@@ -3,11 +3,9 @@ package cn.fw.valhalla.service.data.impl; | @@ -3,11 +3,9 @@ package cn.fw.valhalla.service.data.impl; | ||
3 | import cn.fw.valhalla.dao.mapper.FollowTaskMapper; | 3 | import cn.fw.valhalla.dao.mapper.FollowTaskMapper; |
4 | import cn.fw.valhalla.domain.db.follow.FollowTask; | 4 | import cn.fw.valhalla.domain.db.follow.FollowTask; |
5 | import cn.fw.valhalla.domain.dto.FollowPoolDTO; | 5 | import cn.fw.valhalla.domain.dto.FollowPoolDTO; |
6 | -import cn.fw.valhalla.domain.dto.StammkundeAnalyseDTO; | ||
7 | import cn.fw.valhalla.domain.enums.FollowTypeEnum; | 6 | import cn.fw.valhalla.domain.enums.FollowTypeEnum; |
8 | import cn.fw.valhalla.domain.enums.TaskStateEnum; | 7 | import cn.fw.valhalla.domain.enums.TaskStateEnum; |
9 | import cn.fw.valhalla.domain.query.FollowPoolQueryVO; | 8 | import cn.fw.valhalla.domain.query.FollowPoolQueryVO; |
10 | -import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO; | ||
11 | import cn.fw.valhalla.service.data.FollowTaskService; | 9 | import cn.fw.valhalla.service.data.FollowTaskService; |
12 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 10 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
13 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 11 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
@@ -67,4 +65,13 @@ public class FollowTaskServiceImpl extends ServiceImpl<FollowTaskMapper, FollowT | @@ -67,4 +65,13 @@ public class FollowTaskServiceImpl extends ServiceImpl<FollowTaskMapper, FollowT | ||
67 | .last(" limit 1") | 65 | .last(" limit 1") |
68 | ); | 66 | ); |
69 | } | 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 | + } | ||
70 | } | 77 | } |
pom.xml
@@ -117,7 +117,7 @@ | @@ -117,7 +117,7 @@ | ||
117 | <dependency> | 117 | <dependency> |
118 | <groupId>cn.fw</groupId> | 118 | <groupId>cn.fw</groupId> |
119 | <artifactId>fw-valhalla-sdk</artifactId> | 119 | <artifactId>fw-valhalla-sdk</artifactId> |
120 | - <version>1.1.4</version> | 120 | + <version>1.1.5</version> |
121 | </dependency> | 121 | </dependency> |
122 | <dependency> | 122 | <dependency> |
123 | <groupId>cn.fw</groupId> | 123 | <groupId>cn.fw</groupId> |