Commit 5e96fd92f77c6f84ea476c5c57fbbdcfe560a3eb

Authored by 张志伟
1 parent 76d60437

:sparkles: 新增保有客分配人员查询接口

doc/v1.1.3/sql.sql
... ... @@ -34,4 +34,28 @@ create index secret_report_history_customer_id_index
34 34 on secret_report_history (customer_id);
35 35  
36 36 create index secret_report_history_staff_id_index
37   - on secret_report_history (staff_id);
38 37 \ No newline at end of file
  38 + on secret_report_history (staff_id);
  39 +
  40 +
  41 +
  42 +
  43 +-- 报表字段调整
  44 +alter table cas_015_d
  45 + add i10 int null comment '智能电话跟进有效数';
  46 +alter table cas_015_d
  47 + add i11 int null comment '智能电话跟进数';
  48 +alter table cas_015_d
  49 + add i12 int null comment '首次智能电话跟进有效数';
  50 +alter table cas_015_d
  51 + add i13 int null comment '首次智能电话跟进数';
  52 +
  53 +
  54 +
  55 +alter table cas_015_m
  56 + add i10 int null comment '智能电话跟进有效数';
  57 +alter table cas_015_m
  58 + add i11 int null comment '智能电话跟进数';
  59 +alter table cas_015_m
  60 + add i12 int null comment '首次智能电话跟进有效数';
  61 +alter table cas_015_m
  62 + add i13 int null comment '首次智能电话跟进数';
39 63 \ No newline at end of file
... ...
fw-valhalla-dao/src/main/resources/mapper/SecretReportHistoryMapper.xml
... ... @@ -38,9 +38,11 @@
38 38 and t1.staff_name like concat('%', #{condition.userName}, '%')
39 39 </if>
40 40 <if test="condition.plateNo != null and condition.plateNo !=''">
41   - and t2.plate_no like concat('%', #{condition.plateNo}, '%')
  41 + and (t2.plate_no like concat('%', #{condition.plateNo}, '%') or t4.plate_no like concat('%', #{condition.plateNo}, '%'))
  42 + </if>
  43 + <if test="condition.customerName != null and condition.customerName !=''">
  44 + and (t3.name like concat('%', #{condition.customerName}, '%') or t4.name like concat('%', #{condition.customerName}, '%'))
42 45 </if>
43   -
44 46 <if test="condition.shopIds !=null">
45 47 and t1.shop_id in
46 48 <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
... ... @@ -85,9 +87,11 @@
85 87 and t1.staff_name like concat('%', #{condition.userName}, '%')
86 88 </if>
87 89 <if test="condition.plateNo != null and condition.plateNo !=''">
88   - and t2.plate_no like concat('%', #{condition.plateNo}, '%')
  90 + and (t2.plate_no like concat('%', #{condition.plateNo}, '%') or t4.plate_no like concat('%', #{condition.plateNo}, '%'))
  91 + </if>
  92 + <if test="condition.customerName != null and condition.customerName !=''">
  93 + and (t3.name like concat('%', #{condition.customerName}, '%') or t4.name like concat('%', #{condition.customerName}, '%'))
89 94 </if>
90   -
91 95 <if test="condition.shopIds !=null">
92 96 and t1.shop_id in
93 97 <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/query/SecretReportHistoryQuery.java
... ... @@ -38,6 +38,10 @@ public class SecretReportHistoryQuery extends PoolQuery {
38 38 * 通话时间段(区间)
39 39 */
40 40 private String callTime;
  41 + /**
  42 + * 客户名称
  43 + */
  44 + private String customerName;
41 45  
42 46  
43 47 public Date getStartTime1() {
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/PostUserVO.java
... ... @@ -23,4 +23,8 @@ public class PostUserVO implements Serializable {
23 23 * 用户姓名
24 24 */
25 25 private String userName;
  26 + /**
  27 + * 当前保有客数
  28 + */
  29 + private Integer curQuantity;
26 30 }
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/SecretReportHistoryVO.java
... ... @@ -72,6 +72,10 @@ public class SecretReportHistoryVO {
72 72 */
73 73 private Long shopId;
74 74 /**
  75 + * 门店名称
  76 + */
  77 + private String shopName;
  78 + /**
75 79 * 集团id
76 80 */
77 81 private Long groupId;
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/app/CommonController.java
... ... @@ -56,15 +56,14 @@ public class CommonController {
56 56  
57 57 @GetMapping("/staff/list")
58 58 @IgnoreAuth
59   - public Message<List<PostUserVO>> list(@NotNull(message = "服务站ID不能为空") final Long shopId,
60   - @NotNull(message = "跟进类型不能为空") final Integer type) {
61   - final String msg = "查询跟进人员[app/common/staff/list]";
  59 + public Message<List<PostUserVO>> list(@NotNull(message = "服务站ID不能为空") final Long shopId) {
  60 + final String msg = "查询人员[app/common/staff/list]";
62 61 try {
63   - log.info("{}: param[shopId: {} type: {}]", msg, shopId, type);
64   - List<PostUserVO> list = commonService.getUsers(shopId, type);
  62 + log.info("{}: param[shopId: {}]", msg, shopId);
  63 + List<PostUserVO> list = commonService.getUsers(shopId);
65 64 return success(list, data -> log.info("{}", data));
66 65 } catch (Exception ex) {
67   - handleException(ex, e -> log.error("{}失败:param[shopId: {} type: {}]", msg, shopId, type, e));
  66 + handleException(ex, e -> log.error("{}失败:param[shopId: {}]", msg, shopId, e));
68 67 return failureWithMessage(SAVE_FAILURE);
69 68 }
70 69 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CommonService.java
... ... @@ -5,24 +5,28 @@ import cn.fw.valhalla.common.constant.RoleCode;
5 5 import cn.fw.valhalla.domain.db.customer.AccidentPool;
6 6 import cn.fw.valhalla.domain.db.customer.Customer;
7 7 import cn.fw.valhalla.domain.db.customer.CustomerBaseInfo;
  8 +import cn.fw.valhalla.domain.db.pool.StammkundePool;
8 9 import cn.fw.valhalla.domain.enums.FollowTypeEnum;
  10 +import cn.fw.valhalla.domain.enums.StammkundeStatusEnum;
9 11 import cn.fw.valhalla.domain.vo.PostUserVO;
10 12 import cn.fw.valhalla.rpc.ehr.EhrRpcService;
11 13 import cn.fw.valhalla.rpc.ehr.dto.StaffInfoDTO;
12 14 import cn.fw.valhalla.rpc.erp.UserService;
13 15 import cn.fw.valhalla.rpc.erp.dto.PostUserDTO;
14   -import cn.fw.valhalla.rpc.order.OrderRpcService;
15 16 import cn.fw.valhalla.rpc.pstn.PstnService;
16 17 import cn.fw.valhalla.service.bus.cust.CustomerChangeBizService;
17 18 import cn.fw.valhalla.service.data.AccidentPoolService;
18 19 import cn.fw.valhalla.service.data.CustomerBaseInfoService;
19 20 import cn.fw.valhalla.service.data.CustomerService;
  21 +import cn.fw.valhalla.service.data.StammkundePoolService;
  22 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
20 23 import lombok.RequiredArgsConstructor;
21 24 import lombok.extern.slf4j.Slf4j;
22 25 import org.springframework.stereotype.Service;
  26 +import org.springframework.util.CollectionUtils;
23 27  
  28 +import java.util.ArrayList;
24 29 import java.util.List;
25   -import java.util.stream.Collectors;
26 30  
27 31 import static cn.fw.common.businessvalidator.Validator.BV;
28 32  
... ... @@ -39,18 +43,33 @@ public class CommonService {
39 43 private final UserService userService;
40 44 private final CustomerService customerService;
41 45 private final CustomerBaseInfoService customerBaseInfoService;
42   - private final OrderRpcService orderRpcService;
  46 + private final StammkundePoolService stammkundePoolService;
43 47 private final PstnService pstnService;
44 48 private final EhrRpcService ehrRpcService;
45 49 private final AccidentPoolService accidentPoolService;
46 50 private final CustomerChangeBizService customerChangeBizService;
47 51  
48 52  
49   - public List<PostUserVO> getUsers(final Long shopId, final Integer type) {
50   - FollowTypeEnum typeEnum = FollowTypeEnum.ofValue(type);
51   - BV.notNull(typeEnum, () -> "跟进类型错误");
52   - List<PostUserDTO> userByRole = userService.getUserByRole(shopId, getRoleCode(typeEnum));
53   - return userByRole.stream().map(user -> new PostUserVO(user.getUserId(), user.getUserName())).collect(Collectors.toList());
  53 + public List<PostUserVO> getUsers(final Long shopId) {
  54 + List<PostUserVO> list = new ArrayList<>();
  55 + List<PostUserDTO> userByRole = userService.getUserByRole(shopId, RoleCode.FWGW);
  56 + if (CollectionUtils.isEmpty(userByRole)) {
  57 + return list;
  58 + }
  59 +
  60 + for (PostUserDTO userDTO : userByRole) {
  61 + PostUserVO vo = new PostUserVO(userDTO.getUserId(), userDTO.getUserName(), 0);
  62 + int count = stammkundePoolService.count(Wrappers.<StammkundePool>lambdaQuery()
  63 + .eq(StammkundePool::getAdviserId, userDTO.getUserId())
  64 + .eq(StammkundePool::getShopId, shopId)
  65 + .eq(StammkundePool::getPoolStatus, StammkundeStatusEnum.KUNDE)
  66 + .eq(StammkundePool::getAktiv, Boolean.TRUE)
  67 + .isNull(StammkundePool::getRejectTime)
  68 + );
  69 + vo.setCurQuantity(count);
  70 + list.add(vo);
  71 + }
  72 + return list;
54 73 }
55 74  
56 75 public void rollBack(String vin, Long groupId) {
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/PoolBizService.java
... ... @@ -213,6 +213,7 @@ public class PoolBizService {
213 213 for (SecretReportHistoryDTO dto : list) {
214 214 SecretReportHistoryVO vo = new SecretReportHistoryVO();
215 215 BeanUtils.copyProperties(dto, vo);
  216 + vo.setShopName(Optional.ofNullable(oopService.shop(dto.getShopId())).map(ShopDTO::getShortName).orElse(null));
216 217 vo.setCallType(CallTypeEnum.ofValue(dto.getDialType()));
217 218 appList.add(vo);
218 219 }
... ...