Commit 1983befb52cfbbe2d864c8a4824bd873362c206a

Authored by 张志伟
1 parent 3c9f0339

feat(api): :sparkles: 新增关键字全匹配查询api接口

- 新增关键字查询档案
- 关键之只包含用户名称、车牌号、车架号后6位且全匹配查询

BREAKING CHANGE: nothing
fw-valhalla-dao/src/main/java/cn/fw/valhalla/dao/mapper/CustomerMapper.java
... ... @@ -7,6 +7,7 @@ import cn.fw.valhalla.domain.query.CustomCustomerQuery;
7 7 import cn.fw.valhalla.domain.query.CustomerQueryVO;
8 8 import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO;
9 9 import cn.fw.valhalla.domain.vo.customer.CustomerListVO;
  10 +import cn.fw.valhalla.sdk.result.BasicsCustomerDTO;
10 11 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
11 12 import org.apache.ibatis.annotations.Param;
12 13 import org.springframework.stereotype.Repository;
... ... @@ -46,6 +47,7 @@ public interface CustomerMapper extends BaseMapper<Customer> {
46 47 * @return
47 48 */
48 49 List<CustomerDetailDto> queryCustomList(@Param("condition") CustomCustomerQuery query);
  50 +
49 51 /**
50 52 * 查询自定义参数的档案数量
51 53 *
... ... @@ -53,4 +55,13 @@ public interface CustomerMapper extends BaseMapper&lt;Customer&gt; {
53 55 * @return
54 56 */
55 57 Long queryCustomCount(@Param("condition") CustomCustomerQuery query);
  58 +
  59 + /**
  60 + * 关键字全匹配查询
  61 + *
  62 + * @param keyword
  63 + * @param groupId
  64 + * @return
  65 + */
  66 + List<BasicsCustomerDTO> queryByKeyword(@Param("keyword") String keyword, @Param("groupId") Long groupId);
56 67 }
... ...
fw-valhalla-dao/src/main/resources/mapper/CustomerMapper.xml
... ... @@ -317,4 +317,28 @@
317 317 )
318 318 </if>
319 319 </select>
  320 +
  321 + <select
  322 + id="queryByKeyword"
  323 + resultType="cn.fw.valhalla.sdk.result.BasicsCustomerDTO"
  324 + >
  325 + select t1.id customer_id,
  326 + t2.name customer_name,
  327 + t2.member_id member_id,
  328 + t2.cus_type cus_type,
  329 + t1.plate_no plate_no,
  330 + t1.frame_no frame_no,
  331 + concat_ws(' ', t1.brand_name, t1.series_name, t1.spec_name) car_name,
  332 + t1.shop_id,
  333 + t1.adviser_id
  334 + from customer t1
  335 + inner join customer_base_info t2 on t1.base_id = t2.id
  336 + where t1.yn = 1
  337 + and (
  338 + t1.plate_no = #{keyword}
  339 + or right(t1.frame_no, 6) = #{keyword}
  340 + or t2.name = #{keyword}
  341 + )
  342 + and t1.group_id = #{groupId}
  343 + </select>
320 344 </mapper>
... ...
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.1.6</version>
  13 + <version>1.2.0</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/CustomerApiService.java
... ... @@ -5,10 +5,7 @@ import cn.fw.valhalla.sdk.param.ChangeAdviserReq;
5 5 import cn.fw.valhalla.sdk.param.ChangePlateNoReq;
6 6 import cn.fw.valhalla.sdk.param.ChangeSpecCodeReq;
7 7 import cn.fw.valhalla.sdk.param.CustomerParams;
8   -import cn.fw.valhalla.sdk.result.CarArchiveDTO;
9   -import cn.fw.valhalla.sdk.result.CustomerContactDto;
10   -import cn.fw.valhalla.sdk.result.CustomerInfoDto;
11   -import cn.fw.valhalla.sdk.result.ReceptionResultDto;
  8 +import cn.fw.valhalla.sdk.result.*;
12 9 import org.springframework.cloud.openfeign.FeignClient;
13 10 import org.springframework.web.bind.annotation.GetMapping;
14 11 import org.springframework.web.bind.annotation.PostMapping;
... ... @@ -184,4 +181,14 @@ public interface CustomerApiService {
184 181 */
185 182 @GetMapping("/query/by/engineNo")
186 183 Message<CustomerInfoDto> queryByEngineNo(@RequestParam("engineNo") String engineNo, @RequestParam("groupId") Long groupId);
  184 +
  185 + /**
  186 + * 通过关键字查询档案列表
  187 + *
  188 + * @param keyword 关键字 【车主名称、车牌号、车架号后6位】精确查找
  189 + * @param groupId 集团id
  190 + * @return
  191 + */
  192 + @GetMapping("/query/by/keyword")
  193 + Message<List<BasicsCustomerDTO>> queryByKeyword(@RequestParam("keyword") String keyword, @RequestParam("groupId") Long groupId);
187 194 }
... ...
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/BasicsCustomerDTO.java 0 → 100644
  1 +package cn.fw.valhalla.sdk.result;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * @author : kurisu
  7 + * @version : 1.0
  8 + * @className : BasicsCustomerDTO
  9 + * @description : 基础档案信息
  10 + * @date : 2022-04-12 14:04
  11 + */
  12 +@Data
  13 +public class BasicsCustomerDTO {
  14 + private Long customerId;
  15 + /**
  16 + * 姓名
  17 + */
  18 + private String customerName;
  19 + /**
  20 + * 客户类型
  21 + *
  22 + * @see cn.fw.valhalla.sdk.enums.CusTypeEnum
  23 + */
  24 + private Integer cusType;
  25 + /**
  26 + * 会员id
  27 + */
  28 + private Long memberId;
  29 + /**
  30 + * 车牌号
  31 + */
  32 + private String plateNo;
  33 + /**
  34 + * 车架号
  35 + */
  36 + private String frameNo;
  37 + /**
  38 + * 车辆品牌信息
  39 + */
  40 + private String carName;
  41 + /**
  42 + * 专属服务顾问id
  43 + */
  44 + private Long adviserId;
  45 + /**
  46 + * 专属服务顾问
  47 + */
  48 + private String adviserName;
  49 + /**
  50 + * 所属服务站id
  51 + */
  52 + private Long shopId;
  53 + /**
  54 + * 所属服务站
  55 + */
  56 + private String shopName;
  57 +}
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/api/CustomerApiServiceImpl.java
... ... @@ -9,10 +9,7 @@ import cn.fw.valhalla.sdk.param.ChangeAdviserReq;
9 9 import cn.fw.valhalla.sdk.param.ChangePlateNoReq;
10 10 import cn.fw.valhalla.sdk.param.ChangeSpecCodeReq;
11 11 import cn.fw.valhalla.sdk.param.CustomerParams;
12   -import cn.fw.valhalla.sdk.result.CarArchiveDTO;
13   -import cn.fw.valhalla.sdk.result.CustomerContactDto;
14   -import cn.fw.valhalla.sdk.result.CustomerInfoDto;
15   -import cn.fw.valhalla.sdk.result.ReceptionResultDto;
  12 +import cn.fw.valhalla.sdk.result.*;
16 13 import cn.fw.valhalla.service.bus.cust.ContactBizService;
17 14 import cn.fw.valhalla.service.bus.cust.CustomerBizService;
18 15 import cn.fw.valhalla.service.bus.cust.CustomerChangeBizService;
... ... @@ -225,4 +222,11 @@ public class CustomerApiServiceImpl implements CustomerApiService {
225 222 }
226 223 return success();
227 224 }
  225 +
  226 + @GetMapping("/query/by/keyword")
  227 + @Override
  228 + @ControllerMethod("通过关键字查询档案列表")
  229 + public Message<List<BasicsCustomerDTO>> queryByKeyword(@RequestParam("keyword") String keyword, @RequestParam("groupId") Long groupId) {
  230 + return success(customerBiz.queryByKeyword(keyword, groupId));
  231 + }
228 232 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java
... ... @@ -34,6 +34,7 @@ import cn.fw.valhalla.rpc.oop.dto.SpecDTO;
34 34 import cn.fw.valhalla.sdk.param.ChangeSpecCodeReq;
35 35 import cn.fw.valhalla.sdk.param.CustomerParams;
36 36 import cn.fw.valhalla.sdk.param.CustomerQueryReq;
  37 +import cn.fw.valhalla.sdk.result.BasicsCustomerDTO;
37 38 import cn.fw.valhalla.sdk.result.CustomerInfoDto;
38 39 import cn.fw.valhalla.sdk.result.ReceptionResultDto;
39 40 import cn.fw.valhalla.service.bus.StammkundeBizService;
... ... @@ -778,6 +779,22 @@ public class CustomerBizService extends AbstractCustomerService {
778 779 .in(Customer::getId, customerIdList));
779 780 }
780 781  
  782 + public List<BasicsCustomerDTO> queryByKeyword(String keyword, Long groupId) {
  783 + List<BasicsCustomerDTO> list = customerService.queryByKeyword(keyword, groupId);
  784 + for (BasicsCustomerDTO dto : list) {
  785 + UserInfoDTO user = userService.user(dto.getAdviserId());
  786 + if (Objects.nonNull(user)) {
  787 + dto.setAdviserName(user.getUserName());
  788 + }
  789 + ShopDTO shop = oopService.shop(dto.getShopId());
  790 + if (Objects.nonNull(shop)) {
  791 + dto.setShopName(shop.getShortName());
  792 + }
  793 + }
  794 + return list;
  795 + }
  796 +
  797 +
781 798 private AffiliationRecord createEntity(CustomerDetailDto customer) {
782 799 AffiliationRecord record = new AffiliationRecord();
783 800 record.setCustomerId(customer.getId());
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/CustomerService.java
... ... @@ -7,6 +7,7 @@ import cn.fw.valhalla.domain.query.CustomCustomerQuery;
7 7 import cn.fw.valhalla.domain.query.CustomerQueryVO;
8 8 import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO;
9 9 import cn.fw.valhalla.domain.vo.customer.CustomerListVO;
  10 +import cn.fw.valhalla.sdk.result.BasicsCustomerDTO;
10 11 import com.baomidou.mybatisplus.extension.service.IService;
11 12 import org.springframework.lang.NonNull;
12 13 import org.springframework.lang.Nullable;
... ... @@ -123,8 +124,18 @@ public interface CustomerService extends IService&lt;Customer&gt; {
123 124  
124 125 /**
125 126 * 查询自定义参数的档案数量
  127 + *
126 128 * @param query
127 129 * @return
128 130 */
129 131 Long queryCustomListCount(CustomCustomerQuery query);
  132 +
  133 + /**
  134 + * 关键字全匹配查询
  135 + *
  136 + * @param keyword
  137 + * @param groupId
  138 + * @return
  139 + */
  140 + List<BasicsCustomerDTO> queryByKeyword(String keyword, Long groupId);
130 141 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/CustomerServiceImpl.java
... ... @@ -8,6 +8,7 @@ import cn.fw.valhalla.domain.query.CustomCustomerQuery;
8 8 import cn.fw.valhalla.domain.query.CustomerQueryVO;
9 9 import cn.fw.valhalla.domain.query.StammkundeAnalyseQueryVO;
10 10 import cn.fw.valhalla.domain.vo.customer.CustomerListVO;
  11 +import cn.fw.valhalla.sdk.result.BasicsCustomerDTO;
11 12 import cn.fw.valhalla.service.data.CustomerService;
12 13 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
13 14 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
... ... @@ -130,4 +131,9 @@ public class CustomerServiceImpl extends ServiceImpl&lt;CustomerMapper, Customer&gt; i
130 131 public Long queryCustomListCount(CustomCustomerQuery query) {
131 132 return Optional.ofNullable(getBaseMapper().queryCustomCount(query)).orElse(0L);
132 133 }
  134 +
  135 + @Override
  136 + public List<BasicsCustomerDTO> queryByKeyword(String keyword, Long groupId) {
  137 + return Optional.ofNullable(this.getBaseMapper().queryByKeyword(keyword, groupId)).orElse(new ArrayList<>());
  138 + }
133 139 }
... ...
... ... @@ -12,7 +12,7 @@
12 12 <parent>
13 13 <groupId>cn.fw</groupId>
14 14 <artifactId>fw-common-dependencies</artifactId>
15   - <version>3.2.5</version>
  15 + <version>3.3.0</version>
16 16 </parent>
17 17  
18 18 <modules>
... ... @@ -117,7 +117,7 @@
117 117 <dependency>
118 118 <groupId>cn.fw</groupId>
119 119 <artifactId>fw-valhalla-sdk</artifactId>
120   - <version>1.1.6</version>
  120 + <version>1.2.0</version>
121 121 </dependency>
122 122 <dependency>
123 123 <groupId>cn.fw</groupId>
... ...