Commit 9e4f63f34cb51e603355daf4d9cc6bf730f6eda7

Authored by 张志伟
1 parent 67c4c5d6

feature(*): 新增进行中的事故车跟进人员查询

- 新增事故车跟进人员查询
- 升级sdk
fw-valhalla-sdk/pom.xml
... ... @@ -10,7 +10,7 @@
10 10 <relativePath>../pom.xml</relativePath>
11 11 </parent>
12 12 <artifactId>fw-valhalla-sdk</artifactId>
13   - <version>1.2.2</version>
  13 + <version>1.2.3</version>
14 14 <packaging>jar</packaging>
15 15 <name>fw-valhalla-sdk</name>
16 16  
... ...
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/api/ValhallaGeneralApiService.java
... ... @@ -3,10 +3,13 @@ package cn.fw.valhalla.sdk.api;
3 3 import cn.fw.data.base.domain.common.Message;
4 4 import cn.fw.valhalla.sdk.param.CustomerQueryReq;
5 5 import cn.fw.valhalla.sdk.param.ReachLogReq;
  6 +import cn.fw.valhalla.sdk.result.AccidentFollowerResult;
6 7 import cn.fw.valhalla.sdk.result.CustomerSimpleInfoDto;
7 8 import org.springframework.cloud.openfeign.FeignClient;
  9 +import org.springframework.web.bind.annotation.GetMapping;
8 10 import org.springframework.web.bind.annotation.PostMapping;
9 11 import org.springframework.web.bind.annotation.RequestBody;
  12 +import org.springframework.web.bind.annotation.RequestParam;
10 13  
11 14 import javax.validation.Valid;
12 15 import java.util.List;
... ... @@ -36,4 +39,13 @@ public interface ValhallaGeneralApiService {
36 39 */
37 40 @PostMapping("/query/customer/list")
38 41 Message<List<CustomerSimpleInfoDto>> queryCustomList(@RequestBody CustomerQueryReq customerQueryReq);
  42 +
  43 + /**
  44 + * 根据车牌号查询事故车跟进人员
  45 + * @param plateNo 车牌号
  46 + * @param groupId 集团id
  47 + * @return
  48 + */
  49 + @GetMapping("/query/accident/follower")
  50 + Message<AccidentFollowerResult> queryByPlate(@RequestParam("plateNo") String plateNo, @RequestParam("groupId") Long groupId);
39 51 }
... ...
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/AccidentFollowerResult.java 0 → 100644
  1 +package cn.fw.valhalla.sdk.result;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * 事故车跟进人员
  7 + *
  8 + * @author : kurisu
  9 + * @version : 1.0
  10 + * @className : AccidentFollowerResult
  11 + * @description : 事故车跟进人员
  12 + * @date : 2022-12-03 10:21
  13 + */
  14 +@Data
  15 +public class AccidentFollowerResult {
  16 + /**
  17 + * 跟进人员id
  18 + */
  19 + private Long userId;
  20 + /**
  21 + * 跟进人员名称
  22 + */
  23 + private String userName;
  24 + /**
  25 + * 门店id
  26 + */
  27 + private Long shopId;
  28 +}
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/api/ValhallaGeneralApiServiceImpl.java
... ... @@ -2,24 +2,25 @@ package cn.fw.valhalla.controller.api;
2 2  
3 3 import cn.fw.common.web.annotation.ControllerMethod;
4 4 import cn.fw.data.base.domain.common.Message;
  5 +import cn.fw.valhalla.domain.db.follow.ClueTask;
5 6 import cn.fw.valhalla.domain.dto.CustomerDetailDto;
6 7 import cn.fw.valhalla.sdk.api.ValhallaGeneralApiService;
7 8 import cn.fw.valhalla.sdk.param.CustomerQueryReq;
8 9 import cn.fw.valhalla.sdk.param.ReachLogReq;
  10 +import cn.fw.valhalla.sdk.result.AccidentFollowerResult;
9 11 import cn.fw.valhalla.sdk.result.CustomerSimpleInfoDto;
10 12 import cn.fw.valhalla.service.bus.ReachLogBizService;
11 13 import cn.fw.valhalla.service.bus.cust.CustomerBizService;
  14 +import cn.fw.valhalla.service.bus.follow.FollowApiBizService;
12 15 import lombok.extern.slf4j.Slf4j;
13 16 import org.springframework.beans.BeanUtils;
14 17 import org.springframework.beans.factory.annotation.Autowired;
15   -import org.springframework.web.bind.annotation.PostMapping;
16   -import org.springframework.web.bind.annotation.RequestBody;
17   -import org.springframework.web.bind.annotation.RequestMapping;
18   -import org.springframework.web.bind.annotation.RestController;
  18 +import org.springframework.web.bind.annotation.*;
19 19  
20 20 import javax.validation.Valid;
21 21 import java.util.ArrayList;
22 22 import java.util.List;
  23 +import java.util.Objects;
23 24  
24 25 import static cn.fw.common.web.util.ResultBuilder.success;
25 26  
... ... @@ -39,12 +40,15 @@ public class ValhallaGeneralApiServiceImpl implements ValhallaGeneralApiService
39 40 * 保有客数据服务
40 41 */
41 42 private final CustomerBizService customerBiz;
  43 + private final FollowApiBizService followApiBizService;
42 44  
43 45 @Autowired
44 46 public ValhallaGeneralApiServiceImpl(final ReachLogBizService reachLogBizService,
45   - final CustomerBizService customerBiz) {
  47 + final CustomerBizService customerBiz,
  48 + final FollowApiBizService followApiBizService) {
46 49 this.reachLogBizService = reachLogBizService;
47 50 this.customerBiz = customerBiz;
  51 + this.followApiBizService = followApiBizService;
48 52 }
49 53  
50 54 @PostMapping("/reach/save")
... ... @@ -68,4 +72,19 @@ public class ValhallaGeneralApiServiceImpl implements ValhallaGeneralApiService
68 72 }
69 73 return success(dtoList);
70 74 }
  75 +
  76 + @Override
  77 + @GetMapping("/query/accident/follower")
  78 + @ControllerMethod("查询进行中的事故车跟进人员")
  79 + public Message<AccidentFollowerResult> queryByPlate(@RequestParam("plateNo") String plateNo, @RequestParam("groupId") Long groupId) {
  80 + ClueTask clueTask = followApiBizService.queryAccidentFollowerByPlate(plateNo, groupId);
  81 + if (Objects.isNull(clueTask)) {
  82 + return success();
  83 + }
  84 + AccidentFollowerResult result = new AccidentFollowerResult();
  85 + result.setUserId(clueTask.getFollowUser());
  86 + result.setUserName(clueTask.getFollowUserName());
  87 + result.setShopId(clueTask.getFollowShop());
  88 + return success(result);
  89 + }
71 90 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AccidentPoolBizService.java
... ... @@ -172,6 +172,7 @@ public class AccidentPoolBizService {
172 172 .eq(FollowClue::getPlateNo, plateNo)
173 173 .eq(FollowClue::getClueType, FollowTypeEnum.AC)
174 174 .eq(FollowClue::getClueState, ClueStatusEnum.ONGOING)
  175 + .eq(FollowClue::getGroupId, groupId)
175 176 .last(" limit 1 ")
176 177 );
177 178  
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowApiBizService.java
1 1 package cn.fw.valhalla.service.bus.follow;
2 2  
  3 +import cn.fw.valhalla.domain.db.customer.AccidentPool;
  4 +import cn.fw.valhalla.domain.db.follow.ClueTask;
  5 +import cn.fw.valhalla.domain.db.follow.FollowClue;
3 6 import cn.fw.valhalla.domain.dto.ShouldBeCompletedDTO;
  7 +import cn.fw.valhalla.domain.enums.ClueStatusEnum;
4 8 import cn.fw.valhalla.domain.enums.FollowTypeEnum;
5 9 import cn.fw.valhalla.domain.query.BeCompletedQuery;
6 10 import cn.fw.valhalla.sdk.param.ShouldBeCompletedQuery;
7 11 import cn.fw.valhalla.sdk.result.ShouldBeCompletedResult;
  12 +import cn.fw.valhalla.service.data.AccidentPoolService;
8 13 import cn.fw.valhalla.service.data.ClueTaskService;
  14 +import cn.fw.valhalla.service.data.FollowClueService;
  15 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
9 16 import org.springframework.beans.factory.annotation.Autowired;
10 17 import org.springframework.stereotype.Service;
11 18  
12 19 import java.util.ArrayList;
13 20 import java.util.List;
  21 +import java.util.Objects;
14 22  
15 23 /**
16 24 * 跟进api接口业务实现
... ... @@ -24,10 +32,16 @@ import java.util.List;
24 32 @Service
25 33 public class FollowApiBizService {
26 34 private final ClueTaskService clueTaskService;
  35 + private final AccidentPoolService accidentPoolService;
  36 + private final FollowClueService followClueService;
27 37  
28 38 @Autowired
29   - public FollowApiBizService(final ClueTaskService clueTaskService) {
  39 + public FollowApiBizService(final ClueTaskService clueTaskService,
  40 + final AccidentPoolService accidentPoolService,
  41 + final FollowClueService followClueService) {
30 42 this.clueTaskService = clueTaskService;
  43 + this.accidentPoolService = accidentPoolService;
  44 + this.followClueService = followClueService;
31 45 }
32 46  
33 47 /**
... ... @@ -56,4 +70,29 @@ public class FollowApiBizService {
56 70 }
57 71 return results;
58 72 }
  73 +
  74 + public ClueTask queryAccidentFollowerByPlate(String plateNo, Long groupId) {
  75 + AccidentPool lastOne = accidentPoolService.getOne(Wrappers.<AccidentPool>lambdaQuery()
  76 + .eq(AccidentPool::getPlateNo, plateNo)
  77 + .eq(AccidentPool::getGroupId, groupId)
  78 + .orderByDesc(AccidentPool::getCreateTime)
  79 + .last(" limit 1 ")
  80 + );
  81 +
  82 + if (Objects.isNull(lastOne)) {
  83 + return null;
  84 + }
  85 + FollowClue lastOngoingClue = followClueService.getOne(Wrappers.<FollowClue>lambdaQuery()
  86 + .eq(FollowClue::getPlateNo, plateNo)
  87 + .eq(FollowClue::getClueType, FollowTypeEnum.AC)
  88 + .eq(FollowClue::getClueState, ClueStatusEnum.ONGOING)
  89 + .eq(FollowClue::getGroupId, groupId)
  90 + .last(" limit 1 ")
  91 + );
  92 +
  93 + if (Objects.isNull(lastOngoingClue)) {
  94 + return null;
  95 + }
  96 + return clueTaskService.queryOngoingTaskByClueId(lastOngoingClue.getId());
  97 + }
59 98 }
... ...
... ... @@ -118,7 +118,7 @@
118 118 <dependency>
119 119 <groupId>cn.fw</groupId>
120 120 <artifactId>fw-valhalla-sdk</artifactId>
121   - <version>1.2.2</version>
  121 + <version>1.2.3</version>
122 122 </dependency>
123 123 <dependency>
124 124 <groupId>cn.fw</groupId>
... ...