Commit a5d8202847a31c7a8cfcca7373ca5cff79945b15
1 parent
57a32b62
解决循环依赖问题
Showing
3 changed files
with
22 additions
and
20 deletions
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/app/CommonController.java
@@ -11,6 +11,7 @@ import cn.fw.valhalla.service.bus.CommonService; | @@ -11,6 +11,7 @@ import cn.fw.valhalla.service.bus.CommonService; | ||
11 | import cn.fw.valhalla.service.bus.CustomerImportBizService; | 11 | import cn.fw.valhalla.service.bus.CustomerImportBizService; |
12 | import cn.fw.valhalla.service.bus.CustomerRetentionRatioBizService; | 12 | import cn.fw.valhalla.service.bus.CustomerRetentionRatioBizService; |
13 | import cn.fw.valhalla.service.bus.LeaveNeedDoBizService; | 13 | import cn.fw.valhalla.service.bus.LeaveNeedDoBizService; |
14 | +import cn.fw.valhalla.service.bus.follow.FollowBizService; | ||
14 | import lombok.RequiredArgsConstructor; | 15 | import lombok.RequiredArgsConstructor; |
15 | import lombok.extern.slf4j.Slf4j; | 16 | import lombok.extern.slf4j.Slf4j; |
16 | import org.apache.commons.lang3.StringUtils; | 17 | import org.apache.commons.lang3.StringUtils; |
@@ -46,6 +47,7 @@ public class CommonController { | @@ -46,6 +47,7 @@ public class CommonController { | ||
46 | private final LeaveNeedDoBizService leaveNeedDoBizService; | 47 | private final LeaveNeedDoBizService leaveNeedDoBizService; |
47 | private final CustomerImportBizService customerImportBizService; | 48 | private final CustomerImportBizService customerImportBizService; |
48 | private final CustomerRetentionRatioBizService customerRetentionRatioBizService; | 49 | private final CustomerRetentionRatioBizService customerRetentionRatioBizService; |
50 | + private final FollowBizService followBizService; | ||
49 | 51 | ||
50 | 52 | ||
51 | @GetMapping("/staff/list") | 53 | @GetMapping("/staff/list") |
@@ -124,7 +126,7 @@ public class CommonController { | @@ -124,7 +126,7 @@ public class CommonController { | ||
124 | @Authorization(AuthType.NONE) | 126 | @Authorization(AuthType.NONE) |
125 | @ControllerMethod("手动开始任务") | 127 | @ControllerMethod("手动开始任务") |
126 | public Message<Integer> manualStartClue() { | 128 | public Message<Integer> manualStartClue() { |
127 | - commonService.startClue(); | 129 | + followBizService.manualStartClue(); |
128 | return success(); | 130 | return success(); |
129 | } | 131 | } |
130 | } | 132 | } |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CommonService.java
@@ -22,7 +22,6 @@ import cn.fw.valhalla.rpc.erp.UserService; | @@ -22,7 +22,6 @@ import cn.fw.valhalla.rpc.erp.UserService; | ||
22 | import cn.fw.valhalla.rpc.erp.dto.PostUserDTO; | 22 | import cn.fw.valhalla.rpc.erp.dto.PostUserDTO; |
23 | import cn.fw.valhalla.rpc.pstn.PstnService; | 23 | import cn.fw.valhalla.rpc.pstn.PstnService; |
24 | import cn.fw.valhalla.sdk.enums.DataTypeEnum; | 24 | import cn.fw.valhalla.sdk.enums.DataTypeEnum; |
25 | -import cn.fw.valhalla.service.bus.follow.FollowBizService; | ||
26 | import cn.fw.valhalla.service.bus.setting.SettingBizService; | 25 | import cn.fw.valhalla.service.bus.setting.SettingBizService; |
27 | import cn.fw.valhalla.service.data.*; | 26 | import cn.fw.valhalla.service.data.*; |
28 | import cn.hutool.core.collection.ListUtil; | 27 | import cn.hutool.core.collection.ListUtil; |
@@ -35,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional; | @@ -35,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional; | ||
35 | import org.springframework.util.CollectionUtils; | 34 | import org.springframework.util.CollectionUtils; |
36 | 35 | ||
37 | import java.time.LocalDate; | 36 | import java.time.LocalDate; |
38 | -import java.time.LocalDateTime; | ||
39 | import java.util.*; | 37 | import java.util.*; |
40 | 38 | ||
41 | import static cn.fw.common.businessvalidator.Validator.BV; | 39 | import static cn.fw.common.businessvalidator.Validator.BV; |
@@ -61,7 +59,6 @@ public class CommonService { | @@ -61,7 +59,6 @@ public class CommonService { | ||
61 | private final ClueTaskService clueTaskService; | 59 | private final ClueTaskService clueTaskService; |
62 | private final FollowRecordService followRecordService; | 60 | private final FollowRecordService followRecordService; |
63 | private final FollowNoticeRecordService followNoticeRecordService; | 61 | private final FollowNoticeRecordService followNoticeRecordService; |
64 | - private final FollowBizService followBizService; | ||
65 | private final OriginalDataService originalDataService; | 62 | private final OriginalDataService originalDataService; |
66 | private final SettingBizService settingBizService; | 63 | private final SettingBizService settingBizService; |
67 | Map<Long, List<Integer>> map = MapUtil.builder(new HashMap<Long, List<Integer>>()) | 64 | Map<Long, List<Integer>> map = MapUtil.builder(new HashMap<Long, List<Integer>>()) |
@@ -175,22 +172,6 @@ public class CommonService { | @@ -175,22 +172,6 @@ public class CommonService { | ||
175 | return virtualNumber; | 172 | return virtualNumber; |
176 | } | 173 | } |
177 | 174 | ||
178 | - /** | ||
179 | - * 手动开始任务 | ||
180 | - */ | ||
181 | - public void startClue() { | ||
182 | - List<FollowClue> list = followClueService.list(Wrappers.<FollowClue>lambdaQuery() | ||
183 | - .eq(FollowClue::getClueState, ClueStatusEnum.WAITING) | ||
184 | - .le(FollowClue::getStartTime, DateUtil.localDateTime2Date(LocalDateTime.now())) | ||
185 | - .last("limit 0, 2000") | ||
186 | - ); | ||
187 | - if (CollectionUtils.isEmpty(list)) { | ||
188 | - return; | ||
189 | - } | ||
190 | - for (FollowClue cluePool : list) { | ||
191 | - followBizService.startClue(cluePool); | ||
192 | - } | ||
193 | - } | ||
194 | 175 | ||
195 | public void createClue(Long groupId) { | 176 | public void createClue(Long groupId) { |
196 | int count = customerService.count(Wrappers.<Customer>lambdaQuery() | 177 | int count = customerService.count(Wrappers.<Customer>lambdaQuery() |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowBizService.java
@@ -33,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; | @@ -33,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; | ||
33 | import org.springframework.util.Assert; | 33 | import org.springframework.util.Assert; |
34 | import org.springframework.util.CollectionUtils; | 34 | import org.springframework.util.CollectionUtils; |
35 | 35 | ||
36 | +import java.time.LocalDateTime; | ||
36 | import java.util.*; | 37 | import java.util.*; |
37 | import java.util.stream.Collectors; | 38 | import java.util.stream.Collectors; |
38 | 39 | ||
@@ -318,6 +319,24 @@ public class FollowBizService { | @@ -318,6 +319,24 @@ public class FollowBizService { | ||
318 | } | 319 | } |
319 | 320 | ||
320 | 321 | ||
322 | + /** | ||
323 | + * 手动开始任务 | ||
324 | + */ | ||
325 | + public void manualStartClue() { | ||
326 | + List<FollowClue> list = followClueService.list(Wrappers.<FollowClue>lambdaQuery() | ||
327 | + .eq(FollowClue::getClueState, ClueStatusEnum.WAITING) | ||
328 | + .le(FollowClue::getStartTime, DateUtil.localDateTime2Date(LocalDateTime.now())) | ||
329 | + .last("limit 0, 2000") | ||
330 | + ); | ||
331 | + if (CollectionUtils.isEmpty(list)) { | ||
332 | + return; | ||
333 | + } | ||
334 | + for (FollowClue cluePool : list) { | ||
335 | + startClue(cluePool); | ||
336 | + } | ||
337 | + } | ||
338 | + | ||
339 | + | ||
321 | private FollowTypeEnum conv(DataTypeEnum type) { | 340 | private FollowTypeEnum conv(DataTypeEnum type) { |
322 | switch (type) { | 341 | switch (type) { |
323 | case AS: | 342 | case AS: |