Commit a5d8202847a31c7a8cfcca7373ca5cff79945b15

Authored by 张志伟
1 parent 57a32b62

解决循环依赖问题

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 11 import cn.fw.valhalla.service.bus.CustomerImportBizService;
12 12 import cn.fw.valhalla.service.bus.CustomerRetentionRatioBizService;
13 13 import cn.fw.valhalla.service.bus.LeaveNeedDoBizService;
  14 +import cn.fw.valhalla.service.bus.follow.FollowBizService;
14 15 import lombok.RequiredArgsConstructor;
15 16 import lombok.extern.slf4j.Slf4j;
16 17 import org.apache.commons.lang3.StringUtils;
... ... @@ -46,6 +47,7 @@ public class CommonController {
46 47 private final LeaveNeedDoBizService leaveNeedDoBizService;
47 48 private final CustomerImportBizService customerImportBizService;
48 49 private final CustomerRetentionRatioBizService customerRetentionRatioBizService;
  50 + private final FollowBizService followBizService;
49 51  
50 52  
51 53 @GetMapping("/staff/list")
... ... @@ -124,7 +126,7 @@ public class CommonController {
124 126 @Authorization(AuthType.NONE)
125 127 @ControllerMethod("手动开始任务")
126 128 public Message<Integer> manualStartClue() {
127   - commonService.startClue();
  129 + followBizService.manualStartClue();
128 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 22 import cn.fw.valhalla.rpc.erp.dto.PostUserDTO;
23 23 import cn.fw.valhalla.rpc.pstn.PstnService;
24 24 import cn.fw.valhalla.sdk.enums.DataTypeEnum;
25   -import cn.fw.valhalla.service.bus.follow.FollowBizService;
26 25 import cn.fw.valhalla.service.bus.setting.SettingBizService;
27 26 import cn.fw.valhalla.service.data.*;
28 27 import cn.hutool.core.collection.ListUtil;
... ... @@ -35,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional;
35 34 import org.springframework.util.CollectionUtils;
36 35  
37 36 import java.time.LocalDate;
38   -import java.time.LocalDateTime;
39 37 import java.util.*;
40 38  
41 39 import static cn.fw.common.businessvalidator.Validator.BV;
... ... @@ -61,7 +59,6 @@ public class CommonService {
61 59 private final ClueTaskService clueTaskService;
62 60 private final FollowRecordService followRecordService;
63 61 private final FollowNoticeRecordService followNoticeRecordService;
64   - private final FollowBizService followBizService;
65 62 private final OriginalDataService originalDataService;
66 63 private final SettingBizService settingBizService;
67 64 Map<Long, List<Integer>> map = MapUtil.builder(new HashMap<Long, List<Integer>>())
... ... @@ -175,22 +172,6 @@ public class CommonService {
175 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 176 public void createClue(Long groupId) {
196 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 33 import org.springframework.util.Assert;
34 34 import org.springframework.util.CollectionUtils;
35 35  
  36 +import java.time.LocalDateTime;
36 37 import java.util.*;
37 38 import java.util.stream.Collectors;
38 39  
... ... @@ -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 340 private FollowTypeEnum conv(DataTypeEnum type) {
322 341 switch (type) {
323 342 case AS:
... ...