Commit d8ddee3735e539f70ed8e94ace391f466520dbd1

Authored by 夏天
2 parents bfac3874 f0695a76

Merge branch 'fixbug' into dev

fw-valhalla-dao/src/main/java/cn/fw/valhalla/dao/mapper/CustomerMapper.java
... ... @@ -7,7 +7,9 @@ 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.param.CusCntReq;
10 11 import cn.fw.valhalla.sdk.result.BasicsCustomerDTO;
  12 +import cn.fw.valhalla.sdk.result.CusCntResult;
11 13 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
12 14 import org.apache.ibatis.annotations.Param;
13 15 import org.springframework.stereotype.Repository;
... ... @@ -64,4 +66,21 @@ public interface CustomerMapper extends BaseMapper<Customer> {
64 66 * @return
65 67 */
66 68 List<BasicsCustomerDTO> queryByKeyword(@Param("keyword") String keyword, @Param("groupId") Long groupId);
  69 +
  70 + /**
  71 + * 查询门店保有客数量
  72 + *
  73 + * @param cusCntReq 门店保有客数量
  74 + * @return 门店保有客数据
  75 + */
  76 + List<CusCntResult> queryShopCusCnt(@Param("req") CusCntReq cusCntReq);
  77 +
  78 + /**
  79 + * 查询服务顾问保有客数量
  80 + *
  81 + * @param cusCntReq 服务顾问保有客数量
  82 + * @return 服务顾问保有客数据
  83 + */
  84 + List<CusCntResult> queryAdviserCusCnt(@Param("req") CusCntReq cusCntReq);
  85 +
67 86 }
... ...
fw-valhalla-dao/src/main/resources/mapper/CustomerMapper.xml
... ... @@ -355,4 +355,34 @@
355 355 )
356 356 and t1.group_id = #{groupId}
357 357 </select>
  358 +
  359 + <select id="queryShopCusCnt"
  360 + parameterType="cn.fw.valhalla.sdk.param.CusCntReq"
  361 + resultType="cn.fw.valhalla.sdk.result.CusCntResult">
  362 + select t1.shop_id as id,COUNT(t1.id) as cnt
  363 + from customer t1
  364 + where t1.yn = 1
  365 + <if test="req.shopIds !=null and req.shopIds.size() != 0">
  366 + and t1.shop_id in
  367 + <foreach collection="req.shopIds" item="shopId" index="index" open="(" close=")" separator=",">
  368 + #{shopId}
  369 + </foreach>
  370 + group by t1.shop_id
  371 + </if>
  372 + </select>
  373 +
  374 + <select id="queryAdviserCusCnt"
  375 + parameterType="cn.fw.valhalla.sdk.param.CusCntReq"
  376 + resultType="cn.fw.valhalla.sdk.result.CusCntResult">
  377 + select t1.adviser_id as id,COUNT(t1.id) as cnt
  378 + from customer t1
  379 + where t1.yn = 1
  380 + <if test="req.adviserIds !=null and req.adviserIds.size() != 0">
  381 + and t1.adviser_id in
  382 + <foreach collection="req.adviserIds" item="adviserId" index="index" open="(" close=")" separator=",">
  383 + #{adviserId}
  384 + </foreach>
  385 + group by t1.adviser_id
  386 + </if>
  387 + </select>
358 388 </mapper>
... ...
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/api/CustomerApiService.java
... ... @@ -243,5 +243,16 @@ public interface CustomerApiService {
243 243 @GetMapping("/query/vehicle/by/vin")
244 244 Message<MemberVehicleDTO> queryVehicle(@RequestParam("vin") String vin);
245 245  
  246 + /**
  247 + * 查询保有客数量
  248 + *
  249 + * @param req 查询参数
  250 + * @return 保有客数量
  251 + */
  252 + @PostMapping("/query/cus/cnt")
  253 + Message<List<CusCntResult>> queryCusCnt(@RequestBody CusCntReq req);
  254 +
  255 +
  256 +
246 257  
247 258 }
... ...
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/param/CusCntReq.java 0 → 100644
  1 +package cn.fw.valhalla.sdk.param;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import javax.validation.constraints.NotNull;
  6 +
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * 查询保有客数量
  11 + *
  12 + * @author xiatian
  13 + */
  14 +@Data
  15 +public class CusCntReq {
  16 +
  17 + /**
  18 + * 门店id集合
  19 + */
  20 + private List<Long> shopIds;
  21 +
  22 + /**
  23 + * 顾问id集合
  24 + */
  25 + private List<Long> adviserIds;
  26 +}
... ...
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/CusCntResult.java 0 → 100644
  1 +package cn.fw.valhalla.sdk.result;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * @author xiatian
  7 + * @date 2023-05-12
  8 + */
  9 +@Data
  10 +public class CusCntResult {
  11 + /**
  12 + * 门店id或人员id
  13 + */
  14 + private Long id;
  15 + /**
  16 + * 数量
  17 + */
  18 + private Integer cnt;
  19 +}
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/api/CustomerApiServiceImpl.java
... ... @@ -19,9 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
19 19 import org.springframework.web.bind.annotation.*;
20 20  
21 21 import javax.validation.Valid;
22   -import java.util.ArrayList;
23   -import java.util.List;
24   -import java.util.Objects;
  22 +
  23 +import java.util.*;
25 24  
26 25 import static cn.fw.common.businessvalidator.Validator.BV;
27 26 import static cn.fw.common.web.util.ResultBuilder.success;
... ... @@ -277,4 +276,11 @@ public class CustomerApiServiceImpl implements CustomerApiService {
277 276 public Message<MemberVehicleDTO> queryVehicle(@RequestParam("vin") final String vin) {
278 277 return success(customerBiz.queryVehicleByVin(vin));
279 278 }
  279 +
  280 + @Override
  281 + @PostMapping("/query/cus/cnt")
  282 + @ControllerMethod("查询保有客户数量")
  283 + public Message<List<CusCntResult>> queryCusCnt(@RequestBody final CusCntReq req) {
  284 + return success(customerBiz.queryCusCnt(req));
  285 + }
280 286 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java
... ... @@ -35,13 +35,8 @@ import cn.fw.valhalla.rpc.oop.OopService;
35 35 import cn.fw.valhalla.rpc.oop.dto.ShopDTO;
36 36 import cn.fw.valhalla.rpc.oop.dto.SpecDTO;
37 37 import cn.fw.valhalla.sdk.enums.CusTypeEnum;
38   -import cn.fw.valhalla.sdk.param.ChangeSpecCodeReq;
39   -import cn.fw.valhalla.sdk.param.CustomerParams;
40   -import cn.fw.valhalla.sdk.param.CustomerQueryReq;
41   -import cn.fw.valhalla.sdk.result.BasicsCustomerDTO;
42   -import cn.fw.valhalla.sdk.result.CustomerInfoDto;
43   -import cn.fw.valhalla.sdk.result.MemberVehicleDTO;
44   -import cn.fw.valhalla.sdk.result.ReceptionResultDto;
  38 +import cn.fw.valhalla.sdk.param.*;
  39 +import cn.fw.valhalla.sdk.result.*;
45 40 import cn.fw.valhalla.service.bus.StammkundeBizService;
46 41 import cn.fw.valhalla.service.bus.setting.SettingBizService;
47 42 import cn.fw.valhalla.service.data.*;
... ... @@ -1119,6 +1114,11 @@ public class CustomerBizService extends AbstractCustomerService {
1119 1114 return dto;
1120 1115 }
1121 1116  
  1117 + public List<CusCntResult> queryCusCnt(CusCntReq req){
  1118 + return customerService.queryCusCnt(req);
  1119 + }
  1120 +
  1121 +
1122 1122  
1123 1123 private AffiliationRecord createEntity(CustomerDetailDto customer) {
1124 1124 AffiliationRecord record = new AffiliationRecord();
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/CustomerService.java
... ... @@ -7,7 +7,9 @@ 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.param.CusCntReq;
10 11 import cn.fw.valhalla.sdk.result.BasicsCustomerDTO;
  12 +import cn.fw.valhalla.sdk.result.CusCntResult;
11 13 import com.baomidou.mybatisplus.extension.service.IService;
12 14 import org.springframework.lang.NonNull;
13 15 import org.springframework.lang.Nullable;
... ... @@ -150,4 +152,12 @@ public interface CustomerService extends IService&lt;Customer&gt; {
150 152 */
151 153 @Transactional(rollbackFor = Exception.class)
152 154 void afterDistributePubClue(List<String> vinList, Long userId, Long shopId, Long groupId);
  155 +
  156 + /**
  157 + * 查询保有客数量
  158 + * @param req 查询参数
  159 + * @return 保有客数量
  160 + */
  161 + List<CusCntResult> queryCusCnt(CusCntReq req);
  162 +
153 163 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/CustomerServiceImpl.java
... ... @@ -8,7 +8,9 @@ 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.param.CusCntReq;
11 12 import cn.fw.valhalla.sdk.result.BasicsCustomerDTO;
  13 +import cn.fw.valhalla.sdk.result.CusCntResult;
12 14 import cn.fw.valhalla.service.data.CustomerService;
13 15 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
14 16 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
... ... @@ -151,4 +153,12 @@ public class CustomerServiceImpl extends ServiceImpl&lt;CustomerMapper, Customer&gt; i
151 153 .isNull(Customer::getAdviserId)
152 154 );
153 155 }
  156 +
  157 + @Override
  158 + public List<CusCntResult> queryCusCnt(final CusCntReq req) {
  159 + if(!CollectionUtils.isEmpty(req.getShopIds())){
  160 + return getBaseMapper().queryShopCusCnt(req);
  161 + }
  162 + return getBaseMapper().queryAdviserCusCnt(req);
  163 + }
154 164 }
... ...