Commit 3bddceac789688645fc063324543a3c7f9888e4c

Authored by 夏天
1 parent 24867828

查询保有客档案sdk

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,COUNT(t1.id)
  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,COUNT(t1.id)
  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-server/src/main/java/cn/fw/valhalla/controller/api/CustomerApiServiceImpl.java
... ... @@ -281,6 +281,6 @@ public class CustomerApiServiceImpl implements CustomerApiService {
281 281 @PostMapping("/query/cus/cnt")
282 282 @ControllerMethod("查询保有客户数量")
283 283 public Message<List<CusCntResult>> queryCusCnt(@RequestBody final CusCntReq req) {
284   - return success();
  284 + return success(customerBiz.queryCusCnt(req));
285 285 }
286 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 }
... ...