Commit 29507dd87e1ddd29a362f57462e6ac045ddc73a1
Merge remote-tracking branch 'origin/master' into 2.0
# Conflicts: # fw-valhalla-server/src/main/resources/application.yml
Showing
7 changed files
with
113 additions
and
4 deletions
fw-valhalla-dao/src/main/resources/mapper/ClueTaskMapper.xml
... | ... | @@ -211,7 +211,8 @@ |
211 | 211 | </foreach> |
212 | 212 | </if> |
213 | 213 | <if test="condition.userId !=null"> |
214 | - and t1.follow_user = #{condition.userId} | |
214 | + and (t1.follow_user = #{condition.userId} | |
215 | + or t1.finish_user = #{condition.userId}) | |
215 | 216 | </if> |
216 | 217 | and DATE(t1.close_time) BETWEEN DATE(from_unixtime(#{condition.startTime})) AND |
217 | 218 | DATE(from_unixtime(#{condition.endTime})) | ... | ... |
fw-valhalla-sdk/pom.xml
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/CustomerDistributedMQ.java
0 → 100644
1 | +package cn.fw.valhalla.sdk.result; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Data; | |
5 | +import lombok.NoArgsConstructor; | |
6 | +import org.springframework.lang.Nullable; | |
7 | + | |
8 | +import java.util.ArrayDeque; | |
9 | +import java.util.Date; | |
10 | + | |
11 | +/** | |
12 | + * 档案分配后的mq通知 | |
13 | + * | |
14 | + * @author : kurisu | |
15 | + * @version : 1.0 | |
16 | + * @className : CustomerDistributedMQ | |
17 | + * @description : 档案分配后的mq通知 | |
18 | + * @date : 2023-03-15 15:39 | |
19 | + */ | |
20 | +@Data | |
21 | +@AllArgsConstructor | |
22 | +@NoArgsConstructor | |
23 | +public class CustomerDistributedMQ { | |
24 | + public final static String TOPIC = "valhalla_customer_distribute"; | |
25 | + /** | |
26 | + * 被分配的服务顾问id | |
27 | + */ | |
28 | + private ArrayDeque<Long> staffIds; | |
29 | + /** | |
30 | + * 分配时间 | |
31 | + */ | |
32 | + private Date distributeTime; | |
33 | + /** | |
34 | + * 离职分配 | |
35 | + * <p>为false的时候为管理者主动分配</p> | |
36 | + */ | |
37 | + private boolean resign; | |
38 | + | |
39 | + /** | |
40 | + * 获取第一个staff | |
41 | + * | |
42 | + * @return | |
43 | + */ | |
44 | + @Nullable | |
45 | + public Long getStaffId() { | |
46 | + return staffIds.pollFirst(); | |
47 | + } | |
48 | + | |
49 | + /** | |
50 | + * 获取最后一个staff | |
51 | + * | |
52 | + * @return | |
53 | + */ | |
54 | + @Nullable | |
55 | + public Long getLastStaffId() { | |
56 | + return staffIds.pollFirst(); | |
57 | + } | |
58 | + | |
59 | +} | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/component/CustAfterDistProducer.kt
0 → 100644
1 | +package cn.fw.valhalla.component | |
2 | + | |
3 | +import cn.fw.valhalla.sdk.result.CustomerDistributedMQ | |
4 | +import org.apache.rocketmq.spring.core.RocketMQTemplate | |
5 | +import org.slf4j.Logger | |
6 | +import org.slf4j.LoggerFactory | |
7 | +import org.springframework.stereotype.Component | |
8 | +import org.springframework.web.bind.annotation.RequestMapping | |
9 | +import java.util.* | |
10 | + | |
11 | +/** | |
12 | + * 保有客分配后的mq生产者 | |
13 | + * | |
14 | + * @author : kurisu | |
15 | + * @version : 1.0 | |
16 | + * @className : CustAfterDistProducer | |
17 | + * @description : 保有客分配后的mq生产者 | |
18 | + * @date : 2023-03-15 15:37 | |
19 | + */ | |
20 | +@Component | |
21 | +class CustAfterDistProducer(private val rocketMQTemplate: RocketMQTemplate) { | |
22 | + private val log: Logger = LoggerFactory.getLogger(CustAfterDistProducer::class.java) | |
23 | + | |
24 | + @RequestMapping(value = ["send"]) | |
25 | + fun send(resign: Boolean, staffIds: List<Long>?) { | |
26 | + log.info("发送保有客分配结束mq消息。staffIds:{}", staffIds) | |
27 | + try { | |
28 | + when { | |
29 | + staffIds.isNullOrEmpty() -> return | |
30 | + else -> { | |
31 | + val distributedMQ = CustomerDistributedMQ(ArrayDeque(staffIds), Date(), resign) | |
32 | + rocketMQTemplate.syncSend(CustomerDistributedMQ.TOPIC + ":*", distributedMQ) | |
33 | + } | |
34 | + } | |
35 | + } catch (e: Exception) { | |
36 | + log.info("发送保有客分配结束mq消息失败!", e) | |
37 | + } | |
38 | + } | |
39 | +} | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/LeaveNeedDoBizService.java
... | ... | @@ -9,6 +9,7 @@ import cn.fw.hermes.sdk.api.ImSendMessage; |
9 | 9 | import cn.fw.hermes.sdk.api.para.MsgParamCondition; |
10 | 10 | import cn.fw.valhalla.common.constant.RoleCode; |
11 | 11 | import cn.fw.valhalla.common.utils.DateUtil; |
12 | +import cn.fw.valhalla.component.CustAfterDistProducer; | |
12 | 13 | import cn.fw.valhalla.domain.db.LeaveNeedDo; |
13 | 14 | import cn.fw.valhalla.domain.db.customer.Customer; |
14 | 15 | import cn.fw.valhalla.domain.db.follow.ClueTask; |
... | ... | @@ -73,6 +74,7 @@ public class LeaveNeedDoBizService { |
73 | 74 | private final StammkundePoolService stammkundePoolService; |
74 | 75 | private final FollowClueService followClueService; |
75 | 76 | private final ClueTaskService clueTaskService; |
77 | + private final CustAfterDistProducer custAfterDistProducer; | |
76 | 78 | |
77 | 79 | /** |
78 | 80 | * Redis工具 |
... | ... | @@ -172,6 +174,7 @@ public class LeaveNeedDoBizService { |
172 | 174 | doAllocation(dto, key); |
173 | 175 | //完成分配发送消息提醒等 |
174 | 176 | finish(user, dto.getId(), key); |
177 | + custAfterDistProducer.send(Boolean.TRUE, Collections.singletonList(dto.getAdviserId())); | |
175 | 178 | } finally { |
176 | 179 | clearKey(key); |
177 | 180 | } |
... | ... | @@ -280,6 +283,9 @@ public class LeaveNeedDoBizService { |
280 | 283 | return; |
281 | 284 | } |
282 | 285 | try { |
286 | + List<Long> longList = dto.getBeAssignedList().stream().map(DistributableDTO.BeAssignedDTO::getUserId).collect(Collectors.toList()); | |
287 | + custAfterDistProducer.send(Boolean.FALSE, longList); | |
288 | + | |
283 | 289 | String text = String.format("%s通过资源分配给你%s台保有客", user.getUserName(), size); |
284 | 290 | final MsgParamCondition msgPara = MsgParamCondition.getOfflineTxetPara(text, null, "保有客分配", |
285 | 291 | "保有客分配", null, dto.getAdviserId()).build(); | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowApiBizService.kt
... | ... | @@ -83,7 +83,7 @@ class FollowApiBizService( |
83 | 83 | followTypeEnum.value |
84 | 84 | ) |
85 | 85 | val dtoList = clueTaskService.queryShouldBeCompleted(search) |
86 | - return dtoList.map { | |
86 | + val resultList = dtoList.map { | |
87 | 87 | ShouldBeCompletedResult( |
88 | 88 | it.vin, |
89 | 89 | it.userId, |
... | ... | @@ -92,6 +92,10 @@ class FollowApiBizService( |
92 | 92 | it.state |
93 | 93 | ) |
94 | 94 | } |
95 | + if (Objects.nonNull(query.userId)) { | |
96 | + return resultList.filter { it.userId == query.userId } | |
97 | + } | |
98 | + return resultList | |
95 | 99 | } |
96 | 100 | |
97 | 101 | fun queryAccidentFollowerByPlate(plateNo: String, groupId: Long): ClueTask? { | ... | ... |
pom.xml