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,6 +23,7 @@ public interface FollowApiService { | ||
23 | /** | 23 | /** |
24 | * 保存会产生跟进的业务数据 | 24 | * 保存会产生跟进的业务数据 |
25 | * 事故车的场景联系方式不能为空 | 25 | * 事故车的场景联系方式不能为空 |
26 | + * | ||
26 | * @param generateDTO | 27 | * @param generateDTO |
27 | * @return | 28 | * @return |
28 | */ | 29 | */ |
@@ -33,6 +34,7 @@ public interface FollowApiService { | @@ -33,6 +34,7 @@ public interface FollowApiService { | ||
33 | * 批量保存 | 34 | * 批量保存 |
34 | * 最多支持1000条 | 35 | * 最多支持1000条 |
35 | * 事故车的场景联系方式不能为空 | 36 | * 事故车的场景联系方式不能为空 |
37 | + * | ||
36 | * @param paramList | 38 | * @param paramList |
37 | * @return | 39 | * @return |
38 | */ | 40 | */ |
@@ -87,12 +89,23 @@ public interface FollowApiService { | @@ -87,12 +89,23 @@ public interface FollowApiService { | ||
87 | Message<Void> terminationBatch(@Valid @RequestBody CustomList<TerminationDTO> paramList); | 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 | * @param customerId 档案id | 95 | * @param customerId 档案id |
93 | * @return | 96 | * @return |
94 | */ | 97 | */ |
95 | @GetMapping("/getCompletedFollowRecord") | 98 | @GetMapping("/getCompletedFollowRecord") |
96 | Message<List<SucessFollowRecordVo>> getCompletedFollowRecord(@RequestParam("bizType") @NotNull(message = "业务类型不能为空!") Integer bizType, | 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 | \ No newline at end of file | 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,4 +171,14 @@ public class FollowApiServiceImpl implements FollowApiService { | ||
171 | @RequestParam("customerId") @NotEmpty(message = "档案id不能为空!") List<Long> customerId) { | 171 | @RequestParam("customerId") @NotEmpty(message = "档案id不能为空!") List<Long> customerId) { |
172 | return success(followBizService.getCompletedFollowRecord(bizType, customerId)); | 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
@@ -56,7 +56,7 @@ follow: | @@ -56,7 +56,7 @@ follow: | ||
56 | PFCode: 'O6zZjZ17st' | 56 | PFCode: 'O6zZjZ17st' |
57 | FACode: '' | 57 | FACode: '' |
58 | RVCode: '' | 58 | RVCode: '' |
59 | - SFCode: '' | 59 | + SFCode: 't8nlNVPNGp' |
60 | FmTemplateCode: 'SMS_215116996' | 60 | FmTemplateCode: 'SMS_215116996' |
61 | RmTemplateCode: 'SMS_215072079' | 61 | RmTemplateCode: 'SMS_215072079' |
62 | IrTemplateCode: '' | 62 | IrTemplateCode: '' |
fw-shirasawa-server/src/main/resources/application-prd.yml
@@ -55,7 +55,7 @@ follow: | @@ -55,7 +55,7 @@ follow: | ||
55 | PFCode: 'O6zZjZ17st' | 55 | PFCode: 'O6zZjZ17st' |
56 | FACode: '' | 56 | FACode: '' |
57 | RVCode: '' | 57 | RVCode: '' |
58 | - SFCode: '' | 58 | + SFCode: 't8nlNVPNGp' |
59 | FmTemplateCode: 'SMS_215116996' | 59 | FmTemplateCode: 'SMS_215116996' |
60 | RmTemplateCode: 'SMS_215072079' | 60 | RmTemplateCode: 'SMS_215072079' |
61 | IrTemplateCode: '' | 61 | IrTemplateCode: '' |
fw-shirasawa-server/src/main/resources/application-test.yml
@@ -66,7 +66,6 @@ follow: | @@ -66,7 +66,6 @@ follow: | ||
66 | PFCode: 'O6zZjZ17st' | 66 | PFCode: 'O6zZjZ17st' |
67 | FACode: '' | 67 | FACode: '' |
68 | RVCode: '' | 68 | RVCode: '' |
69 | - SFCode: '' | ||
70 | FmTemplateCode: '' | 69 | FmTemplateCode: '' |
71 | RmTemplateCode: '' | 70 | RmTemplateCode: '' |
72 | IrTemplateCode: '' | 71 | IrTemplateCode: '' |
73 | \ No newline at end of file | 72 | \ No newline at end of file |
fw-shirasawa-server/src/main/resources/application.yml
@@ -145,7 +145,7 @@ follow: | @@ -145,7 +145,7 @@ follow: | ||
145 | FACode: '' | 145 | FACode: '' |
146 | RVCode: '' | 146 | RVCode: '' |
147 | PLCode: '' | 147 | PLCode: '' |
148 | - SFCode: '' | 148 | + SFCode: 't8nlNVPNGp' |
149 | FmTemplateCode: '' | 149 | FmTemplateCode: '' |
150 | RmTemplateCode: '' | 150 | RmTemplateCode: '' |
151 | IrTemplateCode: '' | 151 | IrTemplateCode: '' |
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,6 +13,7 @@ import cn.fw.shirasawa.rpc.flow.FlowApproveRpc; | ||
13 | import cn.fw.shirasawa.sdk.mq.FollowResultDTO; | 13 | import cn.fw.shirasawa.sdk.mq.FollowResultDTO; |
14 | import cn.fw.shirasawa.service.data.ApproveRecordService; | 14 | import cn.fw.shirasawa.service.data.ApproveRecordService; |
15 | import cn.fw.shirasawa.service.data.CluePoolService; | 15 | import cn.fw.shirasawa.service.data.CluePoolService; |
16 | +import cn.fw.shirasawa.service.data.FollowRecordService; | ||
16 | import cn.fw.shirasawa.service.data.FollowTaskService; | 17 | import cn.fw.shirasawa.service.data.FollowTaskService; |
17 | import cn.fw.shirasawa.service.event.CancelApproveEvent; | 18 | import cn.fw.shirasawa.service.event.CancelApproveEvent; |
18 | import cn.fw.shirasawa.service.event.RecordCompleteEvent; | 19 | import cn.fw.shirasawa.service.event.RecordCompleteEvent; |
@@ -38,6 +39,7 @@ public class CustomEventListener { | @@ -38,6 +39,7 @@ public class CustomEventListener { | ||
38 | private final ApproveRecordService approveRecordService; | 39 | private final ApproveRecordService approveRecordService; |
39 | private final FlowApproveRpc flowApproveRpc; | 40 | private final FlowApproveRpc flowApproveRpc; |
40 | private final CluePoolService cluePoolService; | 41 | private final CluePoolService cluePoolService; |
42 | + private final FollowRecordService followRecordService; | ||
41 | private final RecordResultProducer recordResultProducer; | 43 | private final RecordResultProducer recordResultProducer; |
42 | 44 | ||
43 | /** | 45 | /** |
@@ -86,6 +88,7 @@ public class CustomEventListener { | @@ -86,6 +88,7 @@ public class CustomEventListener { | ||
86 | if (Objects.isNull(cluePool)) { | 88 | if (Objects.isNull(cluePool)) { |
87 | return; | 89 | return; |
88 | } | 90 | } |
91 | + long remaining = followRecordService.recordRemaining(record.getUserId(), record.getBizType(), record.getId()); | ||
89 | FollowResultDTO dto = new FollowResultDTO(); | 92 | FollowResultDTO dto = new FollowResultDTO(); |
90 | dto.setCustomerId(record.getCustomerId()); | 93 | dto.setCustomerId(record.getCustomerId()); |
91 | dto.setRecordId(record.getId()); | 94 | dto.setRecordId(record.getId()); |
@@ -95,6 +98,7 @@ public class CustomEventListener { | @@ -95,6 +98,7 @@ public class CustomEventListener { | ||
95 | dto.setUserName(record.getUserName()); | 98 | dto.setUserName(record.getUserName()); |
96 | dto.setShopId(record.getShopId()); | 99 | dto.setShopId(record.getShopId()); |
97 | dto.setGroupId(record.getGroupId()); | 100 | dto.setGroupId(record.getGroupId()); |
101 | + dto.setRemaining(remaining); | ||
98 | boolean ov = OutTimeEnum.BE_OVERDUE.equals(record.getOutTime()); | 102 | boolean ov = OutTimeEnum.BE_OVERDUE.equals(record.getOutTime()); |
99 | dto.setOverdue(ov); | 103 | dto.setOverdue(ov); |
100 | dto.setResultTime(DateUtil.toDate(ov ? record.getDeadline().minusSeconds(1L) : record.getFollowTime())); | 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,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 | * @param newRecordDTO | 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,7 +132,6 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { | ||
132 | BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), record.getTodoCode(), String.valueOf(record.getId()), | 132 | BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), record.getTodoCode(), String.valueOf(record.getId()), |
133 | DateUtil.toDate(record.getFollowTime()), record.getShopId()); | 133 | DateUtil.toDate(record.getFollowTime()), record.getShopId()); |
134 | todoRpcService.complete(dto); | 134 | todoRpcService.complete(dto); |
135 | - | ||
136 | eventPublisher.publishEvent(new RecordCompleteEvent(record, task.getClueId())); | 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,7 +12,6 @@ import cn.fw.shirasawa.domain.enums.ClueStatusEnum; | ||
12 | import cn.fw.shirasawa.domain.enums.FollowTypeEnum; | 12 | import cn.fw.shirasawa.domain.enums.FollowTypeEnum; |
13 | import cn.fw.shirasawa.domain.enums.OutTimeEnum; | 13 | import cn.fw.shirasawa.domain.enums.OutTimeEnum; |
14 | import cn.fw.shirasawa.domain.vo.follow.ACDetailVO; | 14 | import cn.fw.shirasawa.domain.vo.follow.ACDetailVO; |
15 | -import cn.fw.shirasawa.domain.vo.follow.FollowDetailVO; | ||
16 | import cn.fw.shirasawa.rpc.backlog.dto.BackLogItemDTO; | 15 | import cn.fw.shirasawa.rpc.backlog.dto.BackLogItemDTO; |
17 | import cn.fw.shirasawa.rpc.valhalla.ValhallaRpcService; | 16 | import cn.fw.shirasawa.rpc.valhalla.ValhallaRpcService; |
18 | import cn.fw.shirasawa.rpc.valhalla.dto.ValhallaCustomerDTO; | 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,7 +4,9 @@ import cn.fw.shirasawa.domain.db.follow.FollowRecord; | ||
4 | import cn.fw.shirasawa.domain.db.follow.SucessFollowRecord; | 4 | import cn.fw.shirasawa.domain.db.follow.SucessFollowRecord; |
5 | import cn.fw.shirasawa.domain.dto.FollowRecordPoolDTO; | 5 | import cn.fw.shirasawa.domain.dto.FollowRecordPoolDTO; |
6 | import cn.fw.shirasawa.domain.query.FollowRecordPoolQuery; | 6 | import cn.fw.shirasawa.domain.query.FollowRecordPoolQuery; |
7 | +import cn.fw.shirasawa.sdk.enums.BusinessTypeEnum; | ||
7 | import com.baomidou.mybatisplus.extension.service.IService; | 8 | import com.baomidou.mybatisplus.extension.service.IService; |
9 | +import org.springframework.lang.Nullable; | ||
8 | 10 | ||
9 | import java.util.List; | 11 | import java.util.List; |
10 | 12 | ||
@@ -83,4 +85,13 @@ public interface FollowRecordService extends IService<FollowRecord> { | @@ -83,4 +85,13 @@ public interface FollowRecordService extends IService<FollowRecord> { | ||
83 | */ | 85 | */ |
84 | List<FollowRecordPoolDTO> recordPoolList(FollowRecordPoolQuery query); | 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,16 +6,19 @@ import cn.fw.shirasawa.domain.db.follow.SucessFollowRecord; | ||
6 | import cn.fw.shirasawa.domain.dto.FollowRecordPoolDTO; | 6 | import cn.fw.shirasawa.domain.dto.FollowRecordPoolDTO; |
7 | import cn.fw.shirasawa.domain.enums.OutTimeEnum; | 7 | import cn.fw.shirasawa.domain.enums.OutTimeEnum; |
8 | import cn.fw.shirasawa.domain.query.FollowRecordPoolQuery; | 8 | import cn.fw.shirasawa.domain.query.FollowRecordPoolQuery; |
9 | +import cn.fw.shirasawa.sdk.enums.BusinessTypeEnum; | ||
9 | import cn.fw.shirasawa.service.data.FollowRecordService; | 10 | import cn.fw.shirasawa.service.data.FollowRecordService; |
10 | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | 11 | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
11 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 12 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
12 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 13 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
13 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
15 | +import org.springframework.lang.Nullable; | ||
14 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
15 | import org.springframework.transaction.annotation.Transactional; | 17 | import org.springframework.transaction.annotation.Transactional; |
16 | 18 | ||
17 | import java.util.ArrayList; | 19 | import java.util.ArrayList; |
18 | import java.util.List; | 20 | import java.util.List; |
21 | +import java.util.Objects; | ||
19 | import java.util.Optional; | 22 | import java.util.Optional; |
20 | 23 | ||
21 | /** | 24 | /** |
@@ -109,4 +112,16 @@ public class FollowRecordServiceImpl extends ServiceImpl<FollowRecordMapper, Fol | @@ -109,4 +112,16 @@ public class FollowRecordServiceImpl extends ServiceImpl<FollowRecordMapper, Fol | ||
109 | List<FollowRecordPoolDTO> list = this.getBaseMapper().recordPoolList(startIndex, pageSize, query); | 112 | List<FollowRecordPoolDTO> list = this.getBaseMapper().recordPoolList(startIndex, pageSize, query); |
110 | return Optional.ofNullable(list).orElse(new ArrayList<>()); | 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