Blame view

fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/listener/CustomEventListener.java 3.13 KB
03d7ac84   张志伟   feature(*): 添加续保、...
1
  package cn.fw.valhalla.service.bus.listener;
08704989   张志伟   :art:
2
  
55003764   张志伟   feature(*): 售后crm...
3
  import cn.fw.valhalla.domain.db.follow.ClueTask;
08704989   张志伟   :art:
4
  import cn.fw.valhalla.domain.enums.FollowTypeEnum;
08704989   张志伟   :art:
5
  import cn.fw.valhalla.domain.vo.setting.SettingVO;
08704989   张志伟   :art:
6
  import cn.fw.valhalla.service.bus.follow.FollowBizService;
8bf465d6   张志伟   feature(*): 修改人员站岗信息
7
  import cn.fw.valhalla.service.bus.follow.strategy.impl.PubFollowStrategy;
08704989   张志伟   :art:
8
  import cn.fw.valhalla.service.bus.setting.SettingBizService;
55003764   张志伟   feature(*): 售后crm...
9
10
11
12
  import cn.fw.valhalla.service.event.PublicPoolEvent;
  import cn.fw.valhalla.service.event.SettingChangeEvent;
  import cn.fw.valhalla.service.event.StopTaskEvent;
  import cn.fw.valhalla.service.event.TaskCancelEvent;
08704989   张志伟   :art:
13
  import lombok.extern.slf4j.Slf4j;
ef3c0145   张志伟   ✨ 主动放弃跟进 70%
14
  import org.springframework.beans.factory.annotation.Autowired;
08704989   张志伟   :art:
15
16
  import org.springframework.context.event.EventListener;
  import org.springframework.stereotype.Component;
08704989   张志伟   :art:
17
  
ad395b9c   张志伟   :art:
18
  import java.util.List;
08704989   张志伟   :art:
19
20
21
  import java.util.Objects;
  import java.util.Optional;
  
08704989   张志伟   :art:
22
23
24
25
26
27
28
29
30
31
32
  /**
   * @author : kurisu
   * @className : CustomEventListener
   * @description : 事件监听器
   * @date: 2020-08-18 16:28
   */
  @Component
  @Slf4j
  public class CustomEventListener {
      private final SettingBizService settingBizService;
      private final FollowBizService followBizService;
8bf465d6   张志伟   feature(*): 修改人员站岗信息
33
      private final PubFollowStrategy pubFollowStrategy;
08704989   张志伟   :art:
34
  
ef3c0145   张志伟   ✨ 主动放弃跟进 70%
35
      @Autowired
08704989   张志伟   :art:
36
      public CustomEventListener(final SettingBizService settingBizService,
8bf465d6   张志伟   feature(*): 修改人员站岗信息
37
38
                                 final FollowBizService followBizService,
                                 final PubFollowStrategy pubFollowStrategy) {
08704989   张志伟   :art:
39
40
          this.settingBizService = settingBizService;
          this.followBizService = followBizService;
8bf465d6   张志伟   feature(*): 修改人员站岗信息
41
          this.pubFollowStrategy = pubFollowStrategy;
08704989   张志伟   :art:
42
43
44
45
46
47
48
49
      }
  
      /**
       * 监听跟进任务取消事件
       *
       * @param event
       */
      @EventListener(TaskCancelEvent.class)
612d25d9   张志伟   :art:
50
      public void onDataCancel(final TaskCancelEvent event) {
08704989   张志伟   :art:
51
52
53
54
55
56
57
58
59
          followBizService.onDataCancel(event);
      }
  
      /**
       * 当设置发生改变时
       *
       * @param event
       */
      @EventListener(SettingChangeEvent.class)
612d25d9   张志伟   :art:
60
      public void onSettingChange(final SettingChangeEvent event) {
08704989   张志伟   :art:
61
          final FollowTypeEnum type = event.getType();
4d48353c   张志伟   :sparkles:
62
          if (Objects.isNull(type) || FollowTypeEnum.OT.equals(type)) {
08704989   张志伟   :art:
63
64
              return;
          }
8b00f03a   张志伟   :sparkles:
65
          Optional<List<SettingVO>> listOptional = Optional.ofNullable(settingBizService.querySettingByCat(type.getValue(), event.getGroupId(), event.getBrandId()));
ad395b9c   张志伟   :art:
66
          listOptional.ifPresent(settingList -> followBizService.synFollowTask(settingList, type, event.getGroupId()));
08704989   张志伟   :art:
67
68
      }
  
03b7b995   张志伟   ✨ 公共池后端逻辑 100%
69
70
71
72
73
74
      /**
       * 档案进入公共池
       *
       * @param event
       */
      @EventListener(PublicPoolEvent.class)
27223d59   张志伟   :bug:
75
      public void stopTaskAndAddPublic(final PublicPoolEvent event) {
9dad9666   张志伟   feature(*): 售后crm...
76
77
          String vin = event.getVin();
          Long groupId = event.getGroupId();
2a51fef7   张志伟   feature(*): 清理代码监...
78
79
          boolean fromTask = event.isFromTask();
  
8bf465d6   张志伟   feature(*): 修改人员站岗信息
80
81
          followBizService.stopClue(vin, groupId, fromTask);
          pubFollowStrategy.clueConvertFailedFromFlow(vin, groupId);
03b7b995   张志伟   ✨ 公共池后端逻辑 100%
82
      }
27223d59   张志伟   :bug:
83
84
  
      /**
55003764   张志伟   feature(*): 售后crm...
85
       * 审批终止 续保/事故车 任务
27223d59   张志伟   :bug:
86
87
88
89
90
       *
       * @param event
       */
      @EventListener(StopTaskEvent.class)
      public void stopTask(final StopTaskEvent event) {
55003764   张志伟   feature(*): 售后crm...
91
          ClueTask task = event.getTask();
27223d59   张志伟   :bug:
92
93
          followBizService.stopTask(task);
      }
08704989   张志伟   :art:
94
  }