Commit 17bf353d4b80ee6b0faeb3b9573ddb01c0b62d9d
1 parent
6b1e138d
feature(*): 新增查询进行中待办数量的接口
- 新增查询进行中待办数量的接口
Showing
15 changed files
with
76 additions
and
10 deletions
fw-shirasawa-sdk/src/main/java/cn/fw/shirasawa/sdk/api/FollowApiService.java
... | ... | @@ -23,6 +23,7 @@ public interface FollowApiService { |
23 | 23 | /** |
24 | 24 | * 保存会产生跟进的业务数据 |
25 | 25 | * 事故车的场景联系方式不能为空 |
26 | + * | |
26 | 27 | * @param generateDTO |
27 | 28 | * @return |
28 | 29 | */ |
... | ... | @@ -33,6 +34,7 @@ public interface FollowApiService { |
33 | 34 | * 批量保存 |
34 | 35 | * 最多支持1000条 |
35 | 36 | * 事故车的场景联系方式不能为空 |
37 | + * | |
36 | 38 | * @param paramList |
37 | 39 | * @return |
38 | 40 | */ |
... | ... | @@ -87,12 +89,23 @@ public interface FollowApiService { |
87 | 89 | Message<Void> terminationBatch(@Valid @RequestBody CustomList<TerminationDTO> paramList); |
88 | 90 | |
89 | 91 | /** |
90 | - * 根据类型和档案id查询已完成的跟进记录 | |
91 | - * @param bizType 跟进业务类型 1-售前 2-售后 | |
92 | + * 根据类型和档案id查询已完成的跟进记录 | |
93 | + * | |
94 | + * @param bizType 跟进业务类型 1-售前 2-售后 | |
92 | 95 | * @param customerId 档案id |
93 | 96 | * @return |
94 | 97 | */ |
95 | 98 | @GetMapping("/getCompletedFollowRecord") |
96 | 99 | Message<List<SucessFollowRecordVo>> getCompletedFollowRecord(@RequestParam("bizType") @NotNull(message = "业务类型不能为空!") Integer bizType, |
97 | - @RequestParam("customerId") @NotEmpty(message = "档案id不能为空!") List<Long> customerId); | |
100 | + @RequestParam("customerId") @NotEmpty(message = "档案id不能为空!") List<Long> customerId); | |
101 | + | |
102 | + /** | |
103 | + * 查询用户剩余待办数 | |
104 | + * @param userId 用户id | |
105 | + * @param bizType 业态类型 {@link cn.fw.shirasawa.sdk.enums.BusinessTypeEnum} | |
106 | + * @return | |
107 | + */ | |
108 | + @GetMapping("/query_record_remaining") | |
109 | + Message<Long> queryRecordRemaining(@RequestParam("userId") @NotNull(message = "userId不能为空!") Long userId, | |
110 | + @RequestParam("bizType") @NotNull(message = "业务类型不能为空!") Integer bizType); | |
98 | 111 | } |
99 | 112 | \ No newline at end of file | ... | ... |
fw-shirasawa-sdk/src/main/java/cn/fw/shirasawa/sdk/mq/FollowResultDTO.java
fw-shirasawa-server/src/main/java/cn/fw/shirasawa/server/controller/api/FollowApiServiceImpl.java
... | ... | @@ -171,4 +171,14 @@ public class FollowApiServiceImpl implements FollowApiService { |
171 | 171 | @RequestParam("customerId") @NotEmpty(message = "档案id不能为空!") List<Long> customerId) { |
172 | 172 | return success(followBizService.getCompletedFollowRecord(bizType, customerId)); |
173 | 173 | } |
174 | + | |
175 | + @Override | |
176 | + @GetMapping("/query_record_remaining") | |
177 | + @ControllerMethod("查询用户剩余待办数") | |
178 | + public Message<Long> queryRecordRemaining(@RequestParam("userId") @NotNull(message = "userId不能为空!") Long userId, | |
179 | + @RequestParam("bizType") @NotNull(message = "业务类型不能为空!") Integer bizType) { | |
180 | + BusinessTypeEnum businessType = BusinessTypeEnum.ofValue(bizType); | |
181 | + BV.notNull(businessType, () -> "业务类型不正确"); | |
182 | + return success(followBizService.queryOngoingRecord(userId, businessType)); | |
183 | + } | |
174 | 184 | } | ... | ... |
fw-shirasawa-server/src/main/java/cn/fw/shirasawa/server/controller/app/FollowController.java
fw-shirasawa-server/src/main/resources/application-gray.yml
fw-shirasawa-server/src/main/resources/application-prd.yml
fw-shirasawa-server/src/main/resources/application-test.yml
fw-shirasawa-server/src/main/resources/application.yml
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/service/bus/CustomEventListener.java
... | ... | @@ -13,6 +13,7 @@ import cn.fw.shirasawa.rpc.flow.FlowApproveRpc; |
13 | 13 | import cn.fw.shirasawa.sdk.mq.FollowResultDTO; |
14 | 14 | import cn.fw.shirasawa.service.data.ApproveRecordService; |
15 | 15 | import cn.fw.shirasawa.service.data.CluePoolService; |
16 | +import cn.fw.shirasawa.service.data.FollowRecordService; | |
16 | 17 | import cn.fw.shirasawa.service.data.FollowTaskService; |
17 | 18 | import cn.fw.shirasawa.service.event.CancelApproveEvent; |
18 | 19 | import cn.fw.shirasawa.service.event.RecordCompleteEvent; |
... | ... | @@ -38,6 +39,7 @@ public class CustomEventListener { |
38 | 39 | private final ApproveRecordService approveRecordService; |
39 | 40 | private final FlowApproveRpc flowApproveRpc; |
40 | 41 | private final CluePoolService cluePoolService; |
42 | + private final FollowRecordService followRecordService; | |
41 | 43 | private final RecordResultProducer recordResultProducer; |
42 | 44 | |
43 | 45 | /** |
... | ... | @@ -86,6 +88,7 @@ public class CustomEventListener { |
86 | 88 | if (Objects.isNull(cluePool)) { |
87 | 89 | return; |
88 | 90 | } |
91 | + long remaining = followRecordService.recordRemaining(record.getUserId(), record.getBizType(), record.getId()); | |
89 | 92 | FollowResultDTO dto = new FollowResultDTO(); |
90 | 93 | dto.setCustomerId(record.getCustomerId()); |
91 | 94 | dto.setRecordId(record.getId()); |
... | ... | @@ -95,6 +98,7 @@ public class CustomEventListener { |
95 | 98 | dto.setUserName(record.getUserName()); |
96 | 99 | dto.setShopId(record.getShopId()); |
97 | 100 | dto.setGroupId(record.getGroupId()); |
101 | + dto.setRemaining(remaining); | |
98 | 102 | boolean ov = OutTimeEnum.BE_OVERDUE.equals(record.getOutTime()); |
99 | 103 | dto.setOverdue(ov); |
100 | 104 | dto.setResultTime(DateUtil.toDate(ov ? record.getDeadline().minusSeconds(1L) : record.getFollowTime())); | ... | ... |
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/service/bus/follow/FollowBizService.java
... | ... | @@ -992,6 +992,17 @@ public class FollowBizService { |
992 | 992 | } |
993 | 993 | |
994 | 994 | /** |
995 | + * 查询未完成的待办数量 | |
996 | + * | |
997 | + * @param userId | |
998 | + * @param bizType | |
999 | + * @return | |
1000 | + */ | |
1001 | + public long queryOngoingRecord(Long userId, BusinessTypeEnum bizType) { | |
1002 | + return followRecordService.recordRemaining(userId, bizType, null); | |
1003 | + } | |
1004 | + | |
1005 | + /** | |
995 | 1006 | * 创建新跟进 |
996 | 1007 | * |
997 | 1008 | * @param newRecordDTO | ... | ... |
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/service/bus/follow/strategy/AbstractFollowStrategy.java
... | ... | @@ -132,7 +132,6 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
132 | 132 | BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), record.getTodoCode(), String.valueOf(record.getId()), |
133 | 133 | DateUtil.toDate(record.getFollowTime()), record.getShopId()); |
134 | 134 | todoRpcService.complete(dto); |
135 | - | |
136 | 135 | eventPublisher.publishEvent(new RecordCompleteEvent(record, task.getClueId())); |
137 | 136 | } |
138 | 137 | ... | ... |
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/service/bus/follow/strategy/impl/ACFollowStrategy.java
... | ... | @@ -12,7 +12,6 @@ import cn.fw.shirasawa.domain.enums.ClueStatusEnum; |
12 | 12 | import cn.fw.shirasawa.domain.enums.FollowTypeEnum; |
13 | 13 | import cn.fw.shirasawa.domain.enums.OutTimeEnum; |
14 | 14 | import cn.fw.shirasawa.domain.vo.follow.ACDetailVO; |
15 | -import cn.fw.shirasawa.domain.vo.follow.FollowDetailVO; | |
16 | 15 | import cn.fw.shirasawa.rpc.backlog.dto.BackLogItemDTO; |
17 | 16 | import cn.fw.shirasawa.rpc.valhalla.ValhallaRpcService; |
18 | 17 | import cn.fw.shirasawa.rpc.valhalla.dto.ValhallaCustomerDTO; | ... | ... |
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/service/data/FollowRecordService.java
... | ... | @@ -4,7 +4,9 @@ import cn.fw.shirasawa.domain.db.follow.FollowRecord; |
4 | 4 | import cn.fw.shirasawa.domain.db.follow.SucessFollowRecord; |
5 | 5 | import cn.fw.shirasawa.domain.dto.FollowRecordPoolDTO; |
6 | 6 | import cn.fw.shirasawa.domain.query.FollowRecordPoolQuery; |
7 | +import cn.fw.shirasawa.sdk.enums.BusinessTypeEnum; | |
7 | 8 | import com.baomidou.mybatisplus.extension.service.IService; |
9 | +import org.springframework.lang.Nullable; | |
8 | 10 | |
9 | 11 | import java.util.List; |
10 | 12 | |
... | ... | @@ -83,4 +85,13 @@ public interface FollowRecordService extends IService<FollowRecord> { |
83 | 85 | */ |
84 | 86 | List<FollowRecordPoolDTO> recordPoolList(FollowRecordPoolQuery query); |
85 | 87 | |
88 | + /** | |
89 | + * 查询用未完成的剩余跟进数量 | |
90 | + * | |
91 | + * @param userId | |
92 | + * @param bizType | |
93 | + * @param recordId 排除记录的id [nullable] | |
94 | + * @return | |
95 | + */ | |
96 | + long recordRemaining(Long userId, BusinessTypeEnum bizType, @Nullable Long recordId); | |
86 | 97 | } | ... | ... |
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/service/data/impl/FollowRecordServiceImpl.java
... | ... | @@ -6,16 +6,19 @@ import cn.fw.shirasawa.domain.db.follow.SucessFollowRecord; |
6 | 6 | import cn.fw.shirasawa.domain.dto.FollowRecordPoolDTO; |
7 | 7 | import cn.fw.shirasawa.domain.enums.OutTimeEnum; |
8 | 8 | import cn.fw.shirasawa.domain.query.FollowRecordPoolQuery; |
9 | +import cn.fw.shirasawa.sdk.enums.BusinessTypeEnum; | |
9 | 10 | import cn.fw.shirasawa.service.data.FollowRecordService; |
10 | 11 | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
11 | 12 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
12 | 13 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
13 | 14 | import lombok.extern.slf4j.Slf4j; |
15 | +import org.springframework.lang.Nullable; | |
14 | 16 | import org.springframework.stereotype.Service; |
15 | 17 | import org.springframework.transaction.annotation.Transactional; |
16 | 18 | |
17 | 19 | import java.util.ArrayList; |
18 | 20 | import java.util.List; |
21 | +import java.util.Objects; | |
19 | 22 | import java.util.Optional; |
20 | 23 | |
21 | 24 | /** |
... | ... | @@ -109,4 +112,16 @@ public class FollowRecordServiceImpl extends ServiceImpl<FollowRecordMapper, Fol |
109 | 112 | List<FollowRecordPoolDTO> list = this.getBaseMapper().recordPoolList(startIndex, pageSize, query); |
110 | 113 | return Optional.ofNullable(list).orElse(new ArrayList<>()); |
111 | 114 | } |
115 | + | |
116 | + @Override | |
117 | + public long recordRemaining(Long userId, BusinessTypeEnum bizType, @Nullable Long recordId) { | |
118 | + return count(Wrappers.<FollowRecord>lambdaQuery() | |
119 | + .eq(FollowRecord::getUserId, userId) | |
120 | + .eq(FollowRecord::getBizType, bizType) | |
121 | + .eq(FollowRecord::getOutTime, OutTimeEnum.ONGOING) | |
122 | + .eq(FollowRecord::getYn, Boolean.TRUE) | |
123 | + .eq(FollowRecord::getAddTodo, Boolean.TRUE) | |
124 | + .ne(Objects.nonNull(recordId), FollowRecord::getId, recordId) | |
125 | + ); | |
126 | + } | |
112 | 127 | } | ... | ... |
lombok.config
0 → 100644