Commit 8c1f4b9a04b0d20275393b161b3cba676675660b

Authored by 张志伟
1 parent 679ff196

:alien: feature(*): 新增跟进应成交数据查询

- 新增跟进应成交数据查询
- 屏蔽服务健康检查日志打印
fw-valhalla-common/src/main/java/cn/fw/valhalla/common/utils/DateUtil.java
... ... @@ -585,6 +585,5 @@ public final class DateUtil {
585 585 System.out.println(getEndInTime(getMonthEndDay()));
586 586 System.out.println(expired);
587 587 System.out.println(startDate(DateUtil.getMonthFirstDay(date)));
588   - ;
589 588 }
590 589 }
... ...
fw-valhalla-dao/src/main/java/cn/fw/valhalla/dao/mapper/ClueTaskMapper.java
... ... @@ -2,6 +2,8 @@ package cn.fw.valhalla.dao.mapper;
2 2  
3 3 import cn.fw.valhalla.domain.db.follow.ClueTask;
4 4 import cn.fw.valhalla.domain.dto.FollowPoolDTO;
  5 +import cn.fw.valhalla.domain.dto.ShouldBeCompletedDTO;
  6 +import cn.fw.valhalla.domain.query.BeCompletedQuery;
5 7 import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
6 8 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
7 9 import org.apache.ibatis.annotations.Param;
... ... @@ -37,4 +39,12 @@ public interface ClueTaskMapper extends BaseMapper<ClueTask> {
37 39 * @return
38 40 */
39 41 Long followListCount(@Param("condition") FollowPoolQueryVO queryVO);
  42 +
  43 + /**
  44 + * 查询跟进应成交数
  45 + *
  46 + * @param query
  47 + * @return
  48 + */
  49 + List<ShouldBeCompletedDTO> queryBeCompleted(@Param("condition") BeCompletedQuery query);
40 50 }
... ...
fw-valhalla-dao/src/main/resources/mapper/ClueTaskMapper.xml
... ... @@ -176,4 +176,35 @@
176 176 </if>
177 177 </where>
178 178 </select>
  179 +
  180 +
  181 +
  182 + <select
  183 + id="queryBeCompleted"
  184 + resultType="cn.fw.valhalla.domain.dto.ShouldBeCompletedDTO"
  185 + parameterType="cn.fw.valhalla.domain.query.BeCompletedQuery"
  186 + >
  187 + SELECT
  188 + t2.vin,
  189 + t1.follow_user user_id,
  190 + t1.follow_user_name user_name,
  191 + t1.follow_shop shop_id
  192 + from clue_task t1
  193 + inner join follow_clue t2 on t1.clue_id = t2.id
  194 + <where>
  195 + t1.redistribution = 0
  196 + <if test="condition.type !=null">
  197 + and t1.type = #{condition.type}
  198 + </if>
  199 + <if test="condition.shopId !=null">
  200 + and t1.follow_shop = #{condition.shopId}
  201 + </if>
  202 + <if test="condition.userId !=null">
  203 + and t1.follow_user = #{condition.userId}
  204 + </if>
  205 + and DATE(t1.begin_time) &lt; DATE(from_unixtime(#{condition.startTime}))
  206 + and (t1.close_time is null or DATE(t1.close_time) BETWEEN DATE(from_unixtime(#{condition.startTime})) AND DATE(from_unixtime(#{condition.startTime})))
  207 + and DATE(t1.deadline) BETWEEN DATE(from_unixtime(#{condition.startTime})) AND DATE(from_unixtime(#{condition.startTime}))
  208 + </where>
  209 + </select>
179 210 </mapper>
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/ShouldBeCompletedDTO.java 0 → 100644
  1 +package cn.fw.valhalla.domain.dto;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * 应成交数据
  7 + *
  8 + * @author : kurisu
  9 + * @version : 1.0
  10 + * @className : ShouldBeCompletedDTo
  11 + * @description : 应成交数据
  12 + * @date : 2022-10-20 14:52
  13 + */
  14 +@Data
  15 +public class ShouldBeCompletedDTO {
  16 + /**
  17 + * 车架号
  18 + */
  19 + private String vin;
  20 + /**
  21 + * 跟进人员id
  22 + */
  23 + private Long userId;
  24 + /**
  25 + * 跟进人员名称
  26 + */
  27 + private String userName;
  28 + /**
  29 + * 门店id
  30 + */
  31 + private Long shopId;
  32 +}
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/query/BeCompletedQuery.java 0 → 100644
  1 +package cn.fw.valhalla.domain.query;
  2 +
  3 +import lombok.Data;
  4 +
  5 +
  6 +/**
  7 + * 应成交查询参数
  8 + *
  9 + * @author : kurisu
  10 + * @version : 1.0
  11 + * @className : BeCompletedQuery
  12 + * @description : 应成交查询参数
  13 + * @date : 2022-10-20 14:53
  14 + */
  15 +@Data
  16 +public class BeCompletedQuery {
  17 + /**
  18 + * 跟进人员id
  19 + */
  20 + private Long userId;
  21 + /**
  22 + * 门店id
  23 + */
  24 + private Long shopId;
  25 + /**
  26 + * 跟进开始时间
  27 + */
  28 + private String startTime;
  29 + /**
  30 + * 跟进截止时间
  31 + */
  32 + private String endTime;
  33 + /**
  34 + * 跟进类型
  35 + */
  36 + private Integer type;
  37 +}
... ...
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.0</version>
  13 + <version>1.2.1</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/FollowApiService.java
... ... @@ -2,13 +2,18 @@ package cn.fw.valhalla.sdk.api;
2 2  
3 3 import cn.fw.data.base.domain.common.Message;
4 4 import cn.fw.valhalla.sdk.param.FollowOriginalParam;
  5 +import cn.fw.valhalla.sdk.param.ShouldBeCompletedQuery;
  6 +import cn.fw.valhalla.sdk.result.ShouldBeCompletedResult;
5 7 import org.springframework.cloud.openfeign.FeignClient;
  8 +import org.springframework.cloud.openfeign.SpringQueryMap;
  9 +import org.springframework.validation.annotation.Validated;
6 10 import org.springframework.web.bind.annotation.GetMapping;
7 11 import org.springframework.web.bind.annotation.PostMapping;
8 12 import org.springframework.web.bind.annotation.RequestBody;
9 13 import org.springframework.web.bind.annotation.RequestParam;
10 14  
11 15 import javax.validation.Valid;
  16 +import java.util.List;
12 17  
13 18 /**
14 19 * @author : kurisu
... ... @@ -37,4 +42,14 @@ public interface FollowApiService {
37 42 */
38 43 @GetMapping("/origin/remove")
39 44 Message<Void> removeData(@RequestParam("type") Integer type, @RequestParam("detailId") String detailId);
  45 +
  46 +
  47 + /**
  48 + * 查询续保跟进应成交台数
  49 + *
  50 + * @param query 查询参数
  51 + * @return 分组人员
  52 + */
  53 + @GetMapping("/should/ins/completed")
  54 + Message<List<ShouldBeCompletedResult>> queryInsShouldBeCompleted(@Validated @SpringQueryMap ShouldBeCompletedQuery query);
40 55 }
41 56 \ No newline at end of file
... ...
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/param/ShouldBeCompletedQuery.java 0 → 100644
  1 +package cn.fw.valhalla.sdk.param;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import javax.validation.constraints.NotNull;
  6 +import java.time.YearMonth;
  7 +import java.time.ZoneId;
  8 +import java.util.Objects;
  9 +
  10 +/**
  11 + * 应成交台数查询
  12 + *
  13 + * @author : kurisu
  14 + * @version : 1.0
  15 + * @className : ShouldBeCompletedQuery
  16 + * @description : 应成交台数查询
  17 + * @date : 2022-10-20 11:33
  18 + */
  19 +@Data
  20 +public class ShouldBeCompletedQuery {
  21 + /**
  22 + * 跟进人员id
  23 + */
  24 + private Long userId;
  25 + /**
  26 + * 门店id
  27 + */
  28 + @NotNull(message = "门店不能为空")
  29 + private Long shopId;
  30 + /**
  31 + * 跟进开始时间 [时间戳 默认为本月月初]
  32 + */
  33 + private Long startTime;
  34 + /**
  35 + * 跟进截止时间 [时间戳 默认为本月月底]
  36 + */
  37 + private Long endTime;
  38 +
  39 + public String getStartTime() {
  40 + if (Objects.isNull(startTime)) {
  41 + long second = YearMonth.now().atEndOfMonth().atStartOfDay(ZoneId.systemDefault()).toEpochSecond();
  42 + return String.valueOf(second);
  43 + }
  44 + String timeStr = String.valueOf(startTime);
  45 + return timeStr.length() >= 9 ? timeStr.substring(0, 9) : timeStr;
  46 + }
  47 +
  48 + public String getEndTime() {
  49 + if (Objects.isNull(endTime)) {
  50 + long second = YearMonth.now().atDay(1).atStartOfDay(ZoneId.systemDefault()).toEpochSecond();
  51 + return String.valueOf(second);
  52 + }
  53 + String timeStr = String.valueOf(endTime);
  54 + return timeStr.length() >= 9 ? timeStr.substring(0, 9) : timeStr;
  55 + }
  56 +}
... ...
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/ShouldBeCompletedResult.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 : ShouldBeCompletedResult
  11 + * @description : 应成交数据
  12 + * @date : 2022-10-20 11:35
  13 + */
  14 +@Data
  15 +public class ShouldBeCompletedResult {
  16 + /**
  17 + * 车架号
  18 + */
  19 + private String vin;
  20 + /**
  21 + * 跟进人员id
  22 + */
  23 + private Long userId;
  24 + /**
  25 + * 跟进人员名称
  26 + */
  27 + private String userName;
  28 + /**
  29 + * 门店id
  30 + */
  31 + private Long shopId;
  32 +}
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/api/FollowApiServiceImpl.java
... ... @@ -4,16 +4,23 @@ import cn.fw.common.web.annotation.ControllerMethod;
4 4 import cn.fw.data.base.domain.common.Message;
5 5 import cn.fw.valhalla.common.utils.StringUtils;
6 6 import cn.fw.valhalla.domain.dto.OriginalDataDTO;
  7 +import cn.fw.valhalla.domain.enums.FollowTypeEnum;
7 8 import cn.fw.valhalla.sdk.api.FollowApiService;
8 9 import cn.fw.valhalla.sdk.enums.DataTypeEnum;
9 10 import cn.fw.valhalla.sdk.param.FollowOriginalParam;
  11 +import cn.fw.valhalla.sdk.param.ShouldBeCompletedQuery;
  12 +import cn.fw.valhalla.sdk.result.ShouldBeCompletedResult;
  13 +import cn.fw.valhalla.service.bus.follow.FollowApiBizService;
10 14 import cn.fw.valhalla.service.bus.follow.OriginalDataBizService;
11 15 import lombok.extern.slf4j.Slf4j;
12 16 import org.springframework.beans.BeanUtils;
13 17 import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.cloud.openfeign.SpringQueryMap;
  19 +import org.springframework.validation.annotation.Validated;
14 20 import org.springframework.web.bind.annotation.*;
15 21  
16 22 import javax.validation.Valid;
  23 +import java.util.List;
17 24 import java.util.Objects;
18 25  
19 26 import static cn.fw.common.businessvalidator.Validator.BV;
... ... @@ -31,10 +38,13 @@ import static cn.fw.common.web.util.ResultBuilder.success;
31 38 public class FollowApiServiceImpl implements FollowApiService {
32 39  
33 40 private final OriginalDataBizService originalDataBizService;
  41 + private final FollowApiBizService followApiBizService;
34 42  
35 43 @Autowired
36   - public FollowApiServiceImpl(final OriginalDataBizService originalDataBizService) {
  44 + public FollowApiServiceImpl(final OriginalDataBizService originalDataBizService,
  45 + final FollowApiBizService followApiBizService) {
37 46 this.originalDataBizService = originalDataBizService;
  47 + this.followApiBizService = followApiBizService;
38 48 }
39 49  
40 50 @Override
... ... @@ -62,4 +72,11 @@ public class FollowApiServiceImpl implements FollowApiService {
62 72 originalDataBizService.remove(typeEnum, detailId);
63 73 return success();
64 74 }
  75 +
  76 + @Override
  77 + @GetMapping("/should/ins/completed")
  78 + @ControllerMethod("查询续保跟进应成交台数")
  79 + public Message<List<ShouldBeCompletedResult>> queryInsShouldBeCompleted(@Validated @SpringQueryMap ShouldBeCompletedQuery query) {
  80 + return success(followApiBizService.queryShouldBeCompleted(query, FollowTypeEnum.IR));
  81 + }
65 82 }
... ...
fw-valhalla-server/src/main/resources/application.yml
... ... @@ -141,6 +141,8 @@ logbook:
141 141 style: http
142 142 write:
143 143 max-body-size: 300
  144 + exclude:
  145 + - /actuator/**
144 146 follow:
145 147 flowNo: '5W23NH02U6'
146 148 todo:
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowApiBizService.java 0 → 100644
  1 +package cn.fw.valhalla.service.bus.follow;
  2 +
  3 +import cn.fw.valhalla.domain.dto.ShouldBeCompletedDTO;
  4 +import cn.fw.valhalla.domain.enums.FollowTypeEnum;
  5 +import cn.fw.valhalla.domain.query.BeCompletedQuery;
  6 +import cn.fw.valhalla.sdk.param.ShouldBeCompletedQuery;
  7 +import cn.fw.valhalla.sdk.result.ShouldBeCompletedResult;
  8 +import cn.fw.valhalla.service.data.ClueTaskService;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +import java.util.ArrayList;
  13 +import java.util.List;
  14 +
  15 +/**
  16 + * 跟进api接口业务实现
  17 + *
  18 + * @author : kurisu
  19 + * @version : 1.0
  20 + * @className : FollowApiBizService
  21 + * @description : 跟进api接口业务实现
  22 + * @date : 2022-10-20 14:35
  23 + */
  24 +@Service
  25 +public class FollowApiBizService {
  26 + private final ClueTaskService clueTaskService;
  27 +
  28 + @Autowired
  29 + public FollowApiBizService(final ClueTaskService clueTaskService) {
  30 + this.clueTaskService = clueTaskService;
  31 + }
  32 +
  33 + /**
  34 + * 查询应成交台数
  35 + *
  36 + * @param query
  37 + * @param followTypeEnum
  38 + * @return
  39 + */
  40 + public List<ShouldBeCompletedResult> queryShouldBeCompleted(ShouldBeCompletedQuery query, FollowTypeEnum followTypeEnum) {
  41 + BeCompletedQuery search = new BeCompletedQuery();
  42 + search.setType(followTypeEnum.getValue());
  43 + search.setShopId(query.getShopId());
  44 + search.setUserId(query.getUserId());
  45 + search.setStartTime(query.getStartTime());
  46 + search.setEndTime(query.getEndTime());
  47 + List<ShouldBeCompletedDTO> dtoList = clueTaskService.queryShouldBeCompleted(search);
  48 + List<ShouldBeCompletedResult> results = new ArrayList<>();
  49 + for (ShouldBeCompletedDTO dto : dtoList) {
  50 + ShouldBeCompletedResult result = new ShouldBeCompletedResult();
  51 + result.setVin(dto.getVin());
  52 + result.setUserId(dto.getUserId());
  53 + result.setUserName(dto.getUserName());
  54 + result.setShopId(dto.getShopId());
  55 + results.add(result);
  56 + }
  57 + return results;
  58 + }
  59 +}
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/ClueTaskService.java
... ... @@ -2,6 +2,8 @@ package cn.fw.valhalla.service.data;
2 2  
3 3 import cn.fw.valhalla.domain.db.follow.ClueTask;
4 4 import cn.fw.valhalla.domain.dto.FollowPoolDTO;
  5 +import cn.fw.valhalla.domain.dto.ShouldBeCompletedDTO;
  6 +import cn.fw.valhalla.domain.query.BeCompletedQuery;
5 7 import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
6 8 import com.baomidou.mybatisplus.extension.service.IService;
7 9  
... ... @@ -20,6 +22,7 @@ public interface ClueTaskService extends IService&lt;ClueTask&gt; {
20 22  
21 23 /**
22 24 * 跟进线索id查询进行中的线索任务
  25 + *
23 26 * @param clueId
24 27 * @return
25 28 */
... ... @@ -40,4 +43,12 @@ public interface ClueTaskService extends IService&lt;ClueTask&gt; {
40 43 * @return
41 44 */
42 45 long followListCount(FollowPoolQueryVO queryVO);
  46 +
  47 + /**
  48 + * 查询应成交数据
  49 + *
  50 + * @param query
  51 + * @return
  52 + */
  53 + List<ShouldBeCompletedDTO> queryShouldBeCompleted(BeCompletedQuery query);
43 54 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/ClueTaskServiceImpl.java
... ... @@ -3,7 +3,9 @@ package cn.fw.valhalla.service.data.impl;
3 3 import cn.fw.valhalla.dao.mapper.ClueTaskMapper;
4 4 import cn.fw.valhalla.domain.db.follow.ClueTask;
5 5 import cn.fw.valhalla.domain.dto.FollowPoolDTO;
  6 +import cn.fw.valhalla.domain.dto.ShouldBeCompletedDTO;
6 7 import cn.fw.valhalla.domain.enums.TaskStateEnum;
  8 +import cn.fw.valhalla.domain.query.BeCompletedQuery;
7 9 import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
8 10 import cn.fw.valhalla.service.data.ClueTaskService;
9 11 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
... ... @@ -45,4 +47,9 @@ public class ClueTaskServiceImpl extends ServiceImpl&lt;ClueTaskMapper, ClueTask&gt; i
45 47 public long followListCount(FollowPoolQueryVO queryVO) {
46 48 return Optional.ofNullable(getBaseMapper().followListCount(queryVO)).orElse(0L);
47 49 }
  50 +
  51 + @Override
  52 + public List<ShouldBeCompletedDTO> queryShouldBeCompleted(BeCompletedQuery query) {
  53 + return Optional.ofNullable(getBaseMapper().queryBeCompleted(query)).orElse(new ArrayList<>());
  54 + }
48 55 }
... ...
... ... @@ -118,7 +118,7 @@
118 118 <dependency>
119 119 <groupId>cn.fw</groupId>
120 120 <artifactId>fw-valhalla-sdk</artifactId>
121   - <version>1.2.0</version>
  121 + <version>1.2.1</version>
122 122 </dependency>
123 123 <dependency>
124 124 <groupId>cn.fw</groupId>
... ...