diff --git a/fw-valhalla-sdk/pom.xml b/fw-valhalla-sdk/pom.xml
index b273e4d..2d26a71 100644
--- a/fw-valhalla-sdk/pom.xml
+++ b/fw-valhalla-sdk/pom.xml
@@ -10,7 +10,7 @@
../pom.xml
fw-valhalla-sdk
- 1.2.7
+ 1.2.8
jar
fw-valhalla-sdk
diff --git a/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/enums/CustomerFollowTypeEnum.java b/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/enums/CustomerFollowTypeEnum.java
index e5d0088..12d7791 100644
--- a/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/enums/CustomerFollowTypeEnum.java
+++ b/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/enums/CustomerFollowTypeEnum.java
@@ -12,6 +12,10 @@ import lombok.Getter;
*/
public enum CustomerFollowTypeEnum {
/**
+ * 首保
+ */
+ FM(1, "首保"),
+ /**
* 例保
*/
RM(2, "流失客户"),
@@ -19,6 +23,10 @@ public enum CustomerFollowTypeEnum {
* 续保
*/
IR(4, "续保"),
+ /**
+ * 公共池专属线索
+ */
+ PL(10, "公共池专属线索"),
;
/**
diff --git a/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/ClueChangeResult.java b/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/ClueChangeResult.java
index 9c5c4a6..1814775 100644
--- a/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/ClueChangeResult.java
+++ b/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/ClueChangeResult.java
@@ -61,6 +61,22 @@ public class ClueChangeResult {
public enum ChangeType {
ADD,
- STOP
+ STOP,
+ /**
+ * 主动放弃
+ */
+ ABANDON,
+ /**
+ * 成交
+ */
+ COMPLETE,
+ /**
+ * 他人成交
+ */
+ OTHER_COMPLETE,
+ /**
+ * 角色变动
+ */
+ ROLE_CHANGE
}
}
diff --git a/fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/task/ClueChangeNoticeTask.java b/fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/task/ClueChangeNoticeTask.java
index 0d4ea05..f44190e 100644
--- a/fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/task/ClueChangeNoticeTask.java
+++ b/fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/task/ClueChangeNoticeTask.java
@@ -2,11 +2,17 @@ package cn.fw.valhalla.controller.task;
import cn.fw.valhalla.component.producer.ClueChangeProducer;
import cn.fw.valhalla.component.producer.RenewalSwitchProducer;
+import cn.fw.valhalla.domain.db.follow.ClueTask;
import cn.fw.valhalla.domain.db.follow.FollowClue;
+import cn.fw.valhalla.domain.db.pub.PubCluePool;
import cn.fw.valhalla.domain.enums.FollowTypeEnum;
+import cn.fw.valhalla.domain.enums.TaskDefeatTypeEnum;
+import cn.fw.valhalla.domain.enums.TaskStateEnum;
import cn.fw.valhalla.sdk.enums.CustomerFollowTypeEnum;
import cn.fw.valhalla.sdk.result.ClueChangeResult;
+import cn.fw.valhalla.service.data.ClueTaskService;
import cn.fw.valhalla.service.data.FollowClueService;
+import cn.fw.valhalla.service.data.PubCluePoolService;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,7 +43,9 @@ import java.util.Objects;
public class ClueChangeNoticeTask {
private final ClueChangeProducer clueChangeProducer;
private final RenewalSwitchProducer renewalSwitchProducer;
+ private final ClueTaskService clueTaskService;
private final FollowClueService followClueService;
+ private final PubCluePoolService pubCluePoolService;
private final StringRedisTemplate redisTemplate;
@Value("${spring.cache.custom.global-prefix}:follow:clue:change")
@Getter
@@ -46,11 +54,15 @@ public class ClueChangeNoticeTask {
@Autowired
public ClueChangeNoticeTask(final ClueChangeProducer clueChangeProducer,
final RenewalSwitchProducer renewalSwitchProducer,
+ final ClueTaskService clueTaskService,
final FollowClueService followClueService,
+ final PubCluePoolService pubCluePoolService,
final StringRedisTemplate redisTemplate) {
this.clueChangeProducer = clueChangeProducer;
this.renewalSwitchProducer = renewalSwitchProducer;
+ this.clueTaskService = clueTaskService;
this.followClueService = followClueService;
+ this.pubCluePoolService = pubCluePoolService;
this.redisTemplate = redisTemplate;
}
@@ -61,21 +73,16 @@ public class ClueChangeNoticeTask {
String pop;
while ((pop = operations.pop()) != null) {
try {
- final Long clueId = Long.valueOf(pop);
- FollowClue clue = followClueService.getById(clueId);
- if (Objects.nonNull(clue)) {
- ClueChangeResult result = new ClueChangeResult();
- result.setFrameNo(clue.getVin());
- result.setGroupId(clue.getGroupId());
- result.setChangeType(ClueChangeResult.ChangeType.STOP);
- if (FollowTypeEnum.RM.equals(clue.getClueType())) {
- result.setClueType(CustomerFollowTypeEnum.RM.getValue());
- } else if (FollowTypeEnum.IR.equals(clue.getClueType())) {
- result.setClueType(CustomerFollowTypeEnum.IR.getValue());
- renewalSwitchProducer.send(clue.getVin(), clue.getEndTime().toLocalDate(), clue.getGroupId());
- }
- clueChangeProducer.send(result);
+ final Long taskId = Long.valueOf(pop);
+ ClueTask task = clueTaskService.getById(taskId);
+ if (Objects.isNull(task)) {
+ continue;
}
+ if (FollowTypeEnum.PL.equals(task.getType())) {
+ sendPubMQ(task);
+ return;
+ }
+ sendNormalMQ(task);
} catch (Exception ex) {
failList.add(pop);
log.error(ex.getMessage(), ex);
@@ -86,6 +93,64 @@ public class ClueChangeNoticeTask {
}
}
+ private void sendNormalMQ(ClueTask task) {
+ FollowClue clue = followClueService.getById(task.getClueId());
+ if (Objects.isNull(clue)) {
+ return;
+ }
+ ClueChangeResult result = new ClueChangeResult();
+ result.setFrameNo(clue.getVin());
+ result.setGroupId(clue.getGroupId());
+ TaskDefeatTypeEnum reason = task.getReason();
+
+ if (FollowTypeEnum.RM.equals(clue.getClueType())) {
+ result.setClueType(CustomerFollowTypeEnum.RM.getValue());
+ } else if (FollowTypeEnum.IR.equals(clue.getClueType())) {
+ result.setClueType(CustomerFollowTypeEnum.IR.getValue());
+ renewalSwitchProducer.send(clue.getVin(), clue.getEndTime().toLocalDate(), clue.getGroupId());
+ } else if (FollowTypeEnum.FM.equals(clue.getClueType())) {
+ result.setClueType(CustomerFollowTypeEnum.FM.getValue());
+ }
+
+ if (TaskStateEnum.COMPLETE.equals(task.getState())) {
+ result.setChangeType(ClueChangeResult.ChangeType.COMPLETE);
+ } else {
+ processChangeType(reason, result);
+ }
+
+ clueChangeProducer.send(result);
+ }
+
+ private void sendPubMQ(ClueTask task) {
+ PubCluePool clue = pubCluePoolService.getById(task.getClueId());
+ ClueChangeResult result = new ClueChangeResult();
+ result.setFrameNo(clue.getVin());
+ result.setGroupId(clue.getGroupId());
+ TaskDefeatTypeEnum reason = task.getReason();
+ result.setClueType(CustomerFollowTypeEnum.PL.getValue());
+ if (TaskStateEnum.COMPLETE.equals(task.getState())) {
+ result.setChangeType(ClueChangeResult.ChangeType.COMPLETE);
+ } else {
+ processChangeType(reason, result);
+ }
+ clueChangeProducer.send(result);
+ }
+
+ private void processChangeType(TaskDefeatTypeEnum reason, ClueChangeResult result) {
+ if (TaskDefeatTypeEnum.A.equals(reason)) {
+ result.setChangeType(ClueChangeResult.ChangeType.ABANDON);
+ }
+ if (TaskDefeatTypeEnum.F.equals(reason)) {
+ result.setChangeType(ClueChangeResult.ChangeType.OTHER_COMPLETE);
+ }
+ if (TaskDefeatTypeEnum.D.equals(reason)) {
+ result.setChangeType(ClueChangeResult.ChangeType.ROLE_CHANGE);
+ }
+ if (TaskDefeatTypeEnum.C.equals(reason)) {
+ result.setChangeType(ClueChangeResult.ChangeType.STOP);
+ }
+ }
+
private String generateStopKey() {
return String.format("%s:%s", getClueChangeKeyPrefix(), "STOP");
}
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/component/producer/RenewalSwitchProducer.kt b/fw-valhalla-service/src/main/java/cn/fw/valhalla/component/producer/RenewalSwitchProducer.kt
index 02a3580..bfafab3 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/component/producer/RenewalSwitchProducer.kt
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/component/producer/RenewalSwitchProducer.kt
@@ -45,7 +45,7 @@ class RenewalSwitchProducer(
if (mode == 1) {
return
}
- if (!LocalDate.now().plusDays(1L).isBefore(deadline)) {
+ if (!LocalDate.now().plusDays(2L).isBefore(deadline)) {
return
}
log.info("发送续保跟进切换mq消息。vin:{}", vin)
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/AbstractFollowStrategy.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/AbstractFollowStrategy.java
index 4ae3d89..3a137ff 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/AbstractFollowStrategy.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/AbstractFollowStrategy.java
@@ -203,7 +203,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
clue.setCloseTime(task.getCloseTime());
clue.setClueState(ClueStatusEnum.FAILURE);
followClueService.updateById(clue);
- redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(clueId));
+ redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(task.getId()));
customerBizService.taskEndAbandon(task, clue);
}
}
@@ -249,7 +249,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
clue.setClueState(ClueStatusEnum.FAILURE);
followClueService.updateById(clue);
- redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(clueId));
+ redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(task.getId()));
} else {
task.setRpcSuccess(true);
clueTaskService.updateById(task);
@@ -295,7 +295,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
clue.setClueState(ClueStatusEnum.FAILURE);
clue.setCloseTime(LocalDateTime.now());
followClueService.updateById(clue);
- redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(clueId));
+ redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(task.getId()));
}
}
@@ -439,6 +439,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
clueTask.setFinishShop(originalData.getShopId());
followClue.setCloseTime(clueTask.getCloseTime());
followClueService.updateById(followClue);
+ redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(clueTask.getId()));
boolean rpcSucess = rpcStopTask(clueTask);
clueTask.setRpcSuccess(rpcSucess);
clueTaskService.updateById(clueTask);
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/IRFollowStrategy.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/IRFollowStrategy.java
index b030266..f75cc75 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/IRFollowStrategy.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/IRFollowStrategy.java
@@ -149,7 +149,7 @@ public class IRFollowStrategy extends AbstractFollowStrategy {
clue.setClueState(ClueStatusEnum.FAILURE);
clue.setCloseTime(task.getCloseTime());
followClueService.updateById(clue);
- redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(clueId));
+ redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(task.getId()));
afterStopClue(clue);
}
clueTaskService.updateById(task);
@@ -221,7 +221,7 @@ public class IRFollowStrategy extends AbstractFollowStrategy {
clue.setCloseTime(LocalDateTime.now());
followClueService.updateById(clue);
afterStopClue(clue);
- redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(clueId));
+ redisTemplate.opsForSet().add(generateStopKey(), String.valueOf(task.getId()));
}
Optional settingVO = settingBizService.querySettingByType(getFollowType(), SettingTypeEnum.MODE, clue.getGroupId(), COMMON_BRAND_ID);
// 模式 1、续保角色 2、续保角色+服务接待/新车销售
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/PubFollowStrategy.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/PubFollowStrategy.java
index c3c2939..f430351 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/PubFollowStrategy.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/PubFollowStrategy.java
@@ -24,8 +24,11 @@ import cn.fw.valhalla.service.bus.setting.SettingBizService;
import cn.fw.valhalla.service.data.ClueTaskService;
import cn.fw.valhalla.service.data.PubCluePoolService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -55,6 +58,11 @@ public class PubFollowStrategy implements FollowStrategy {
private final OopService oopService;
private final SettingBizService settingBizService;
private final EhrRpcService ehrRpcService;
+ private final StringRedisTemplate redisTemplate;
+
+ @Value("${spring.cache.custom.global-prefix}:follow:clue:change:STOP")
+ @Getter
+ private String clueChangeKey;
@Autowired
public PubFollowStrategy(final PubCluePoolService pubCluePoolService,
@@ -63,7 +71,8 @@ public class PubFollowStrategy implements FollowStrategy {
final ShirasawaRpcService shirasawaRpcService,
final OopService oopService,
final SettingBizService settingBizService,
- final EhrRpcService ehrRpcService) {
+ final EhrRpcService ehrRpcService,
+ final StringRedisTemplate redisTemplate) {
this.pubCluePoolService = pubCluePoolService;
this.clueTaskService = clueTaskService;
this.customerBizService = customerBizService;
@@ -71,6 +80,7 @@ public class PubFollowStrategy implements FollowStrategy {
this.oopService = oopService;
this.settingBizService = settingBizService;
this.ehrRpcService = ehrRpcService;
+ this.redisTemplate = redisTemplate;
}
@Override
@@ -148,6 +158,8 @@ public class PubFollowStrategy implements FollowStrategy {
boolean rpcSucess = rpcStopTask(clueTask);
clueTask.setRpcSuccess(rpcSucess);
clueTaskService.updateById(clueTask);
+
+ redisTemplate.opsForSet().add(getClueChangeKey(), String.valueOf(clueTask.getId()));
}
pubCluePoolService.updateById(pubClue);
}
@@ -172,6 +184,8 @@ public class PubFollowStrategy implements FollowStrategy {
boolean rpcSucess = rpcStopTask(clueTask);
clueTask.setRpcSuccess(rpcSucess);
clueTaskService.updateById(clueTask);
+
+ redisTemplate.opsForSet().add(getClueChangeKey(), String.valueOf(clueTask.getId()));
}
pubCluePoolService.updateById(pubClue);
}
@@ -201,6 +215,8 @@ public class PubFollowStrategy implements FollowStrategy {
boolean rpcSucess = rpcStopTask(clueTask);
clueTask.setRpcSuccess(rpcSucess);
clueTaskService.updateById(clueTask);
+
+ redisTemplate.opsForSet().add(getClueChangeKey(), String.valueOf(clueTask.getId()));
}
if (PublicClueStateEnum.ONGOING.equals(cluePool.getState())) {
cluePool.setState(PublicClueStateEnum.DEFEAT);
@@ -223,6 +239,7 @@ public class PubFollowStrategy implements FollowStrategy {
}
task.setRpcSuccess(rpcSucess);
clueTaskService.updateById(task);
+ redisTemplate.opsForSet().add(getClueChangeKey(), String.valueOf(task.getId()));
}
@Override
@@ -276,6 +293,7 @@ public class PubFollowStrategy implements FollowStrategy {
pubCluePool.setDefeatReason(task.getReason());
pubCluePoolService.updateById(pubCluePool);
customerBizService.pubTaskEndAbandon(pubCluePool);
+ redisTemplate.opsForSet().add(getClueChangeKey(), String.valueOf(task.getId()));
}
private boolean rpcStopTask(ClueTask clueTask) {
diff --git a/pom.xml b/pom.xml
index 4e5bd07..be29c3b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -124,7 +124,7 @@
cn.fw
fw-valhalla-sdk
- 1.2.7
+ 1.2.8
cn.fw