diff --git a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/ACTodoListVO.java b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/ACTodoListVO.java index c4ef7c7..e43c2ee 100644 --- a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/ACTodoListVO.java +++ b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/ACTodoListVO.java @@ -19,10 +19,6 @@ public class ACTodoListVO extends FollowTodoListVO { * 保险公司名称 */ private String insComName; - /** - * 车牌号 - */ - private String plateNo; public Integer getType() { return FollowTypeEnum.AC.getValue(); diff --git a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowTodoListVO.java b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowTodoListVO.java index ae08a47..21b7156 100644 --- a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowTodoListVO.java +++ b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowTodoListVO.java @@ -22,6 +22,10 @@ public class FollowTodoListVO { */ private Long taskId; /** + * 车牌号 + */ + private String plateNo; + /** * 档案id */ private Long customerId; diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/component/FlowConsumer.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/component/FlowConsumer.java index 3d585c3..051ea08 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/component/FlowConsumer.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/component/FlowConsumer.java @@ -3,22 +3,28 @@ package cn.fw.valhalla.component; import cn.fw.flow.enums.ApproveResultEnum; import cn.fw.flow.result.ApproveCheckMessageDto; import cn.fw.valhalla.domain.db.ApproveRecord; +import cn.fw.valhalla.domain.db.follow.FollowRecord; import cn.fw.valhalla.domain.db.follow.FollowTask; import cn.fw.valhalla.domain.enums.ApproveStateEnum; import cn.fw.valhalla.domain.enums.FollowTypeEnum; import cn.fw.valhalla.domain.enums.TaskStateEnum; import cn.fw.valhalla.service.bus.cust.CustomerBizService; import cn.fw.valhalla.service.bus.cust.CustomerChangeBizService; +import cn.fw.valhalla.service.bus.follow.FollowBizService; import cn.fw.valhalla.service.data.ApproveRecordService; +import cn.fw.valhalla.service.data.FollowRecordService; import cn.fw.valhalla.service.data.FollowTaskService; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.extern.slf4j.Slf4j; import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; import org.apache.rocketmq.spring.core.RocketMQListener; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import java.util.List; import java.util.Objects; /** @@ -36,17 +42,23 @@ public class FlowConsumer implements RocketMQListener { private final CustomerBizService customerBizService; private final ApproveRecordService approveRecordService; private final FollowTaskService followTaskService; + private final FollowRecordService followRecordService; + private final FollowBizService followBizService; @Autowired public FlowConsumer(final CustomerChangeBizService customerChangeBizService, final CustomerBizService customerBizService, final ApproveRecordService approveRecordService, - final FollowTaskService followTaskService) { + final FollowTaskService followTaskService, + final FollowRecordService followRecordService, + final FollowBizService followBizService) { this.customerChangeBizService = customerChangeBizService; this.customerBizService = customerBizService; this.approveRecordService = approveRecordService; this.followTaskService = followTaskService; + this.followRecordService = followRecordService; + this.followBizService = followBizService; } @Override @@ -94,5 +106,16 @@ public class FlowConsumer implements RocketMQListener { return; } customerChangeBizService.changeFollowUser(task); + List list = followRecordService.list(Wrappers.lambdaQuery() + .eq(FollowRecord::getTaskId, taskId) + .eq(FollowRecord::getOutTime, Boolean.FALSE) + .isNotNull(FollowRecord::getFollowTime) + .eq(FollowRecord::getAddTodo, Boolean.TRUE) + ); + if (!CollectionUtils.isEmpty(list)) { + for (FollowRecord record : list) { + followBizService.completeRecord2(record); + } + } } } diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowBizService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowBizService.java index 1143ed3..0fef4da 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowBizService.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowBizService.java @@ -165,6 +165,18 @@ public class FollowBizService { } /** + * 完成跟进 + * + * @param record + */ + @Transactional(rollbackFor = Exception.class) + public void completeRecord2(FollowRecord record) { + FollowStrategy strategy = followMap.get(record.getType()); + Assert.notNull(strategy, "strategy cannot be null"); + strategy.completeRecord2(record); + } + + /** * 查询待办详情 * * @param id 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 88662bf..53ce2d7 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 @@ -173,6 +173,18 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { todoRpcService.complete(dto); } + @Override + @Transactional(rollbackFor = Exception.class) + public void completeRecord2(FollowRecord record) { + BV.isTrue(Boolean.FALSE.equals(record.getOutTime()), () -> "无法完成已逾期的待办任务"); + final Date followTime = DateUtil.localDateTime2Date(LocalDateTime.now()); + record.setFollowTime(followTime); + followRecordService.updateById(record); + this.addTaskRecord(record, false); + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), followTime); + todoRpcService.complete(dto); + } + /** * 生成跟进记录 * diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/FollowStrategy.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/FollowStrategy.java index dbd733e..0db1f16 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/FollowStrategy.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/FollowStrategy.java @@ -63,6 +63,12 @@ public interface FollowStrategy { void completeRecord(Long id, LoginAuthBean currentUser); /** + * 完成跟进 + * @param record + */ + void completeRecord2(FollowRecord record); + + /** * 上传跟进附件 * * @param dto diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java index 58a217c..a504b41 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java @@ -117,6 +117,17 @@ public class ACFollowStrategy extends AbstractFollowStrategy { } @Override + public void completeRecord2(FollowRecord record) { + final Date followTime = DateUtil.localDateTime2Date(LocalDateTime.now()); + record.setFollowTime(followTime); + if (Boolean.FALSE.equals(record.getOutTime())) { + followRecordService.updateById(record); + } + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), followTime); + todoRpcService.complete(dto); + } + + @Override public void uploadAtt(FollowAttachmentDTO dto, Long userId) { super.uploadAtt(dto, userId); } diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/FMFollowStrategy.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/FMFollowStrategy.java index da1546a..01e908e 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/FMFollowStrategy.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/FMFollowStrategy.java @@ -58,6 +58,7 @@ public class FMFollowStrategy extends AbstractFollowStrategy { vo.setDeadline(followRecord.getDeadline()); CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId()); vo.setName(customerDetailDto.getName()); + vo.setPlateNo(customerDetailDto.getPlateNo()); vo.setCarImage(customerDetailDto.getCarImage()); vo.setBuyDate(customerDetailDto.getBuyDate()); Optional followTask = Optional.ofNullable(followTaskService.getById(followRecord.getTaskId())); 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 0c0f302..d3131b0 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 @@ -63,6 +63,7 @@ public class IRFollowStrategy extends AbstractFollowStrategy { CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId()); vo.setName(customerDetailDto.getName()); vo.setCarImage(customerDetailDto.getCarImage()); + vo.setPlateNo(customerDetailDto.getPlateNo()); Optional insuranceDTO = queryInsuInfo(followRecord.getCustomerId()); insuranceDTO.ifPresent(ins -> { vo.setInsComName(ins.getInsurerName()); diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/RMFollowStrategy.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/RMFollowStrategy.java index ef055d0..28edb1d 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/RMFollowStrategy.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/RMFollowStrategy.java @@ -71,6 +71,7 @@ public class RMFollowStrategy extends AbstractFollowStrategy { CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId()); vo.setName(customerDetailDto.getName()); vo.setCarImage(customerDetailDto.getCarImage()); + vo.setPlateNo(customerDetailDto.getPlateNo()); vo.setLastMileage(customerDetailDto.getCurrentMileage()); OriginalData originalData = originalDataService.getOne(Wrappers.lambdaQuery()