Commit 1ca0a771aacb1b6db15d7990961836804e7f8a3a
1 parent
1f07ac69
新增查询档案数量接口
Showing
7 changed files
with
130 additions
and
7 deletions
fw-valhalla-dao/src/main/java/cn/fw/valhalla/dao/mapper/CustomerMapper.java
@@ -46,4 +46,11 @@ public interface CustomerMapper extends BaseMapper<Customer> { | @@ -46,4 +46,11 @@ public interface CustomerMapper extends BaseMapper<Customer> { | ||
46 | * @return | 46 | * @return |
47 | */ | 47 | */ |
48 | List<CustomerDetailDto> queryCustomList(@Param("condition") CustomCustomerQuery query); | 48 | List<CustomerDetailDto> queryCustomList(@Param("condition") CustomCustomerQuery query); |
49 | + /** | ||
50 | + * 查询自定义参数的档案数量 | ||
51 | + * | ||
52 | + * @param query | ||
53 | + * @return | ||
54 | + */ | ||
55 | + Long queryCustomCount(@Param("condition") CustomCustomerQuery query); | ||
49 | } | 56 | } |
fw-valhalla-dao/src/main/resources/mapper/CustomerMapper.xml
@@ -226,4 +226,95 @@ | @@ -226,4 +226,95 @@ | ||
226 | ) | 226 | ) |
227 | </if> | 227 | </if> |
228 | </select> | 228 | </select> |
229 | + | ||
230 | + <select | ||
231 | + id="queryCustomCount" | ||
232 | + resultType="java.lang.Long" | ||
233 | + parameterType="cn.fw.valhalla.domain.query.CustomCustomerQuery" | ||
234 | + > | ||
235 | + select count(1) | ||
236 | + from customer t1 inner join customer_base_info t2 on t1.base_id = t2.id | ||
237 | + left join follow_task t3 on t1.id=t3.customer_id and t3.state=1 and t3.type=2 | ||
238 | + left join follow_task t4 on t1.id=t4.customer_id and t4.state=1 and t4.type=4 | ||
239 | + where t1.yn = 1 and t1.group_id = #{condition.groupId} | ||
240 | + <if test="condition.shopList !=null and condition.shopList.size() != 0"> | ||
241 | + and t1.shop_id in | ||
242 | + <foreach collection="condition.shopList" item="id" index="index" open="(" close=")" separator=","> | ||
243 | + #{id} | ||
244 | + </foreach> | ||
245 | + </if> | ||
246 | + <if test="condition.excludeCustomerIds !=null and condition.excludeCustomerIds.size() != 0"> | ||
247 | + and t1.id not in | ||
248 | + <foreach collection="condition.excludeCustomerIds" item="id" index="index" open="(" close=")" separator=","> | ||
249 | + #{id} | ||
250 | + </foreach> | ||
251 | + </if> | ||
252 | + <if test="condition.followType !=null and condition.followType==2"> | ||
253 | + and t3.id is not null | ||
254 | + </if> | ||
255 | + <if test="condition.followType !=null and condition.followType==4"> | ||
256 | + and t4.id is not null | ||
257 | + </if> | ||
258 | + <if test="condition.frameNo !=null"> | ||
259 | + and t1.frame_no = #{condition.frameNo} | ||
260 | + </if> | ||
261 | + <if test="condition.andCondition==true"> | ||
262 | + and ( | ||
263 | + t1.adviser_id is not null | ||
264 | + <if test="condition.minMileage !=null and condition.maxMileage !=null"> | ||
265 | + <if test="condition.minMileage !=null"> | ||
266 | + and t1.current_mileage >= #{condition.minMileage} | ||
267 | + </if> | ||
268 | + <if test="condition.maxMileage !=null"> | ||
269 | + and t1.current_mileage <= #{condition.maxMileage} | ||
270 | + </if> | ||
271 | + </if> | ||
272 | + <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | ||
273 | + <if test="condition.minBuyDate !=null"> | ||
274 | + and t1.buy_date >= #{condition.minBuyDate} | ||
275 | + </if> | ||
276 | + <if test="condition.maxBuyDate !=null"> | ||
277 | + and t1.buy_date <= #{condition.maxBuyDate} | ||
278 | + </if> | ||
279 | + </if> | ||
280 | + | ||
281 | + <if test="condition.level !=null"> | ||
282 | + and t1.cus_level = #{condition.level} | ||
283 | + </if> | ||
284 | + ) | ||
285 | + </if> | ||
286 | + | ||
287 | + <if test="condition.andCondition==false"> | ||
288 | + and ( | ||
289 | + t1.adviser_id is not null | ||
290 | + <if test="condition.minMileage !=null and condition.maxMileage !=null"> | ||
291 | + or ( | ||
292 | + t1.current_mileage is not null | ||
293 | + <if test="condition.minMileage !=null"> | ||
294 | + and t1.current_mileage >= #{condition.minMileage} | ||
295 | + </if> | ||
296 | + <if test="condition.maxMileage !=null"> | ||
297 | + and t1.current_mileage <= #{condition.maxMileage} | ||
298 | + </if> | ||
299 | + ) | ||
300 | + </if> | ||
301 | + | ||
302 | + <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | ||
303 | + or ( | ||
304 | + t1.buy_date is not null | ||
305 | + <if test="condition.minBuyDate !=null"> | ||
306 | + and t1.buy_date >= #{condition.minBuyDate} | ||
307 | + </if> | ||
308 | + <if test="condition.maxBuyDate !=null"> | ||
309 | + and t1.buy_date <= #{condition.maxBuyDate} | ||
310 | + </if> | ||
311 | + ) | ||
312 | + </if> | ||
313 | + | ||
314 | + <if test="condition.level !=null"> | ||
315 | + or t1.cus_level = #{condition.level} | ||
316 | + </if> | ||
317 | + ) | ||
318 | + </if> | ||
319 | + </select> | ||
229 | </mapper> | 320 | </mapper> |
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/param/CustomerQueryReq.java
@@ -89,6 +89,10 @@ public class CustomerQueryReq implements Serializable { | @@ -89,6 +89,10 @@ public class CustomerQueryReq implements Serializable { | ||
89 | this.followType = followType; | 89 | this.followType = followType; |
90 | } | 90 | } |
91 | 91 | ||
92 | + public void setType(Integer type) { | ||
93 | + this.followType = CustomerFollowTypeEnum.ofValue(type); | ||
94 | + } | ||
95 | + | ||
92 | public Integer[] getArrivalMileage() { | 96 | public Integer[] getArrivalMileage() { |
93 | return arrivalMileage; | 97 | return arrivalMileage; |
94 | } | 98 | } |
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/erp/CustomerController.java renamed to fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/erp/ERPCommonController.java
@@ -3,6 +3,7 @@ package cn.fw.valhalla.controller.erp; | @@ -3,6 +3,7 @@ package cn.fw.valhalla.controller.erp; | ||
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.security.auth.client.annotation.Authorization; | 5 | import cn.fw.security.auth.client.annotation.Authorization; |
6 | +import cn.fw.security.auth.client.annotation.IgnoreAuth; | ||
6 | import cn.fw.security.auth.client.annotation.IgnoreUserToken; | 7 | import cn.fw.security.auth.client.annotation.IgnoreUserToken; |
7 | import cn.fw.security.auth.client.enums.AuthType; | 8 | import cn.fw.security.auth.client.enums.AuthType; |
8 | import cn.fw.valhalla.domain.dto.CustomerDetailDto; | 9 | import cn.fw.valhalla.domain.dto.CustomerDetailDto; |
@@ -33,15 +34,14 @@ import static cn.fw.common.web.util.ResultBuilder.success; | @@ -33,15 +34,14 @@ import static cn.fw.common.web.util.ResultBuilder.success; | ||
33 | @Authorization(AuthType.ERP) | 34 | @Authorization(AuthType.ERP) |
34 | @RequiredArgsConstructor | 35 | @RequiredArgsConstructor |
35 | @RequestMapping("/erp/customer") | 36 | @RequestMapping("/erp/customer") |
36 | -public class CustomerController { | 37 | +public class ERPCommonController { |
37 | private final CustomerBizService customerBizService; | 38 | private final CustomerBizService customerBizService; |
38 | 39 | ||
39 | 40 | ||
40 | @GetMapping("/condition/count") | 41 | @GetMapping("/condition/count") |
41 | - @IgnoreUserToken | 42 | + @IgnoreAuth |
42 | @ControllerMethod("查询满足条件的档案数量") | 43 | @ControllerMethod("查询满足条件的档案数量") |
43 | - public Message<Number> conditionCustomerCount(@Valid @RequestBody CustomerQueryReq customerQueryReq) { | ||
44 | - List<CustomerDetailDto> list = customerBizService.queryCustomList(customerQueryReq); | ||
45 | - return success(list.size()); | 44 | + public Message<Number> conditionCustomerCount(@Valid CustomerQueryReq customerQueryReq) { |
45 | + return success(customerBizService.queryCustomCount(customerQueryReq)); | ||
46 | } | 46 | } |
47 | } | 47 | } |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java
@@ -358,13 +358,22 @@ public class CustomerBizService extends AbstractCustomerService { | @@ -358,13 +358,22 @@ public class CustomerBizService extends AbstractCustomerService { | ||
358 | * @return | 358 | * @return |
359 | */ | 359 | */ |
360 | public List<CustomerDetailDto> queryCustomList(final CustomerQueryReq queryReq) { | 360 | public List<CustomerDetailDto> queryCustomList(final CustomerQueryReq queryReq) { |
361 | - | ||
362 | CustomCustomerQuery query = fillParams(queryReq); | 361 | CustomCustomerQuery query = fillParams(queryReq); |
363 | - | ||
364 | return customerService.queryCustomList(query); | 362 | return customerService.queryCustomList(query); |
365 | } | 363 | } |
366 | 364 | ||
367 | /** | 365 | /** |
366 | + * 根据自定义条件查询保有客档案数量 | ||
367 | + * | ||
368 | + * @param queryReq | ||
369 | + * @return | ||
370 | + */ | ||
371 | + public Long queryCustomCount(final CustomerQueryReq queryReq) { | ||
372 | + CustomCustomerQuery query = fillParams(queryReq); | ||
373 | + return customerService.queryCustomListCount(query); | ||
374 | + } | ||
375 | + | ||
376 | + /** | ||
368 | * 根据手机号查询所有档案 | 377 | * 根据手机号查询所有档案 |
369 | * | 378 | * |
370 | * @param mobile | 379 | * @param mobile |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/CustomerService.java
@@ -120,4 +120,11 @@ public interface CustomerService extends IService<Customer> { | @@ -120,4 +120,11 @@ public interface CustomerService extends IService<Customer> { | ||
120 | * @return | 120 | * @return |
121 | */ | 121 | */ |
122 | List<CustomerDetailDto> queryCustomList(CustomCustomerQuery query); | 122 | List<CustomerDetailDto> queryCustomList(CustomCustomerQuery query); |
123 | + | ||
124 | + /** | ||
125 | + * 查询自定义参数的档案数量 | ||
126 | + * @param query | ||
127 | + * @return | ||
128 | + */ | ||
129 | + Long queryCustomListCount(CustomCustomerQuery query); | ||
123 | } | 130 | } |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/CustomerServiceImpl.java
@@ -125,4 +125,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i | @@ -125,4 +125,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i | ||
125 | public List<CustomerDetailDto> queryCustomList(CustomCustomerQuery query) { | 125 | public List<CustomerDetailDto> queryCustomList(CustomCustomerQuery query) { |
126 | return Optional.ofNullable(getBaseMapper().queryCustomList(query)).orElse(new ArrayList<>()); | 126 | return Optional.ofNullable(getBaseMapper().queryCustomList(query)).orElse(new ArrayList<>()); |
127 | } | 127 | } |
128 | + | ||
129 | + @Override | ||
130 | + public Long queryCustomListCount(CustomCustomerQuery query) { | ||
131 | + return Optional.ofNullable(getBaseMapper().queryCustomCount(query)).orElse(0L); | ||
132 | + } | ||
128 | } | 133 | } |