diff --git a/doc/v1.1.3/sql.sql b/doc/v1.1.3/sql.sql new file mode 100644 index 0000000..d0d2e75 --- /dev/null +++ b/doc/v1.1.3/sql.sql @@ -0,0 +1,6 @@ +alter table follow_record_log + add task_id bigint null comment '跟进任务id' after id; + +update follow_record_log t1 +set task_id = (select w1.task_id from follow_record w1 where w1.id = t1.record_id) +where t1.task_id is null; \ No newline at end of file diff --git a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/db/follow/FollowRecordLog.java b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/db/follow/FollowRecordLog.java index 5093273..6367a81 100644 --- a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/db/follow/FollowRecordLog.java +++ b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/db/follow/FollowRecordLog.java @@ -21,6 +21,10 @@ public class FollowRecordLog extends BaseEntity { */ private Long recordId; /** + * 任务id + */ + private Long taskId; + /** * 附件类型 */ private AttTypeEnum attType; diff --git a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/CustomerDetailDto.java b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/CustomerDetailDto.java index db7ad61..eaf53f1 100644 --- a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/CustomerDetailDto.java +++ b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/CustomerDetailDto.java @@ -138,6 +138,10 @@ public class CustomerDetailDto { */ private String idCode; /** + * 进站次数 + */ + private Integer arrivalCount; + /** * 上次进站时间 */ private Date arrivalTime; diff --git a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowDetailVO.java b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowDetailVO.java index 2b126e2..49a1297 100644 --- a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowDetailVO.java +++ b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowDetailVO.java @@ -53,6 +53,14 @@ public class FollowDetailVO { */ private String tags; /** + * 客户星级 + */ + private Integer cusLevel; + /** + * 进站次数 + */ + private Integer arrivalCount; + /** * 所属服务顾问 */ private Long adviserId; diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AbstractCustomerService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AbstractCustomerService.java index 32c8e96..6cf57dd 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AbstractCustomerService.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AbstractCustomerService.java @@ -131,6 +131,7 @@ public abstract class AbstractCustomerService { dto.setInsuranceExpires(customer.getInsuranceExpires()); dto.setArrivalTime(customer.getArrivalTime()); dto.setAdviserId(customer.getAdviserId()); + dto.setArrivalCount(customer.getArrivalCount()); UserInfoDTO user = userService.user(customer.getAdviserId()); if (Objects.nonNull(user)) { dto.setAdviserName(user.getUserName()); 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 e21e948..1661cbb 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 @@ -136,10 +136,31 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @Override public List getRecordList(Long taskId) { - List followRecordList = followRecordService.getRecordList(taskId); + List followRecordList = new ArrayList<>(); + FollowTask task = followTaskService.getById(taskId); + if (Objects.nonNull(task)) { + Long clueId = task.getClueId(); + List taskList = followTaskService.list(Wrappers.lambdaQuery() + .eq(FollowTask::getClueId, clueId) + .ne(FollowTask::getId, taskId) + ); + if (!CollectionUtils.isEmpty(taskList)) { + for (FollowTask followTask : taskList) { + List recordList = followRecordService.getRecordList(followTask.getId()); + if (!CollectionUtils.isEmpty(recordList)) { + followRecordList.addAll(recordList); + } + } + } + } + List recordList = followRecordService.getRecordList(taskId); + if (!CollectionUtils.isEmpty(recordList)) { + followRecordList.addAll(recordList); + } if (CollectionUtils.isEmpty(followRecordList)) { return new ArrayList<>(); } + List records = followRecordList.stream().sorted(Comparator.comparing(FollowRecord::getId)).collect(Collectors.toList()); List recordIds = followRecordList.stream().map(FollowRecord::getId).collect(Collectors.toList()); List attachments = followRecordLogService.getListByRecordIds(recordIds); if (CollectionUtils.isEmpty(attachments)) { @@ -157,7 +178,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { vo.setFollowType(followRecordList.get(0).getType()); vo.setUploadTime(attachment.getUploadTime()); vo.setDescribes(attachment.getDescribes()); - int i = queryIndexFromRecords(followRecordList, attachment.getRecordId()); + int i = queryIndexFromRecords(records, attachment.getRecordId()); vo.setTimes(i + 1); list.add(vo); } 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 a8e1880..f37e7bc 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 @@ -316,6 +316,8 @@ public class ACFollowStrategy extends AbstractFollowStrategy { vo.setCustomerId(customer.getId()); vo.setAdviserId(customerDetailDto.getAdviserId()); vo.setAdviserName(customerDetailDto.getAdviserName()); + vo.setCusLevel(customerDetailDto.getCusLevel()); + vo.setArrivalCount(customerDetailDto.getArrivalCount()); vo.setVin(customerDetailDto.getFrameNo()); Optional insuranceDTO = queryInsuInfo(customer.getId()); insuranceDTO.ifPresent(ins -> vo.setInsComName(ins.getTciInsurerName())); 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 31f4730..e2c8694 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 @@ -81,9 +81,8 @@ public class FMFollowStrategy extends AbstractFollowStrategy { vo.setTaskId(followRecord.getTaskId()); vo.setFMExpiration(followTask.getDeadline()); int count = followRecordLogService.count(Wrappers.lambdaQuery() - .eq(FollowRecordLog::getRecordId, followRecord.getId()) + .eq(FollowRecordLog::getTaskId, followRecord.getTaskId()) .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE) - .isNotNull(FollowRecordLog::getFeedbackType) ); vo.setHadCall(count > 0); return vo; @@ -197,6 +196,8 @@ public class FMFollowStrategy extends AbstractFollowStrategy { vo.setAdviserName(customerDetailDto.getAdviserName()); vo.setCarModel(customerDetailDto.getBrandName() + " " + customerDetailDto.getSeriesName()); vo.setBuyDate(customerDetailDto.getBuyDate()); + vo.setCusLevel(customerDetailDto.getCusLevel()); + vo.setArrivalCount(customerDetailDto.getArrivalCount()); return vo; } } 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 8afaf40..f0e8bcb 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 @@ -88,7 +88,7 @@ public class IRFollowStrategy extends AbstractFollowStrategy { BV.notNull(followRecord, "跟进记录不存在"); IRDetailVO vo = assemble(followRecord.getCustomerId()); int count = followRecordLogService.count(Wrappers.lambdaQuery() - .eq(FollowRecordLog::getRecordId, followRecord.getId()) + .eq(FollowRecordLog::getTaskId, followRecord.getTaskId()) .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE) ); vo.setHadCall(count > 0); @@ -424,6 +424,8 @@ public class IRFollowStrategy extends AbstractFollowStrategy { vo.setExpires(detailDto.getExpires()); vo.setPeriods(detailDto.getPeriods()); vo.setLoanCustomer(detailDto.isLoanCustomer()); + vo.setCusLevel(detailDto.getCusLevel()); + vo.setArrivalCount(detailDto.getArrivalCount()); Optional insuranceDTO = queryInsuInfo(customerId); insuranceDTO.ifPresent(ins -> { vo.setTclInsComName(ins.getTciInsurerName()); 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 2f90110..e8e026a 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 @@ -105,8 +105,8 @@ public class RMFollowStrategy extends AbstractFollowStrategy { BV.notNull(followRecord, "跟进记录不存在"); RMDetailVO vo = assemble(followRecord.getCustomerId()); int count = followRecordLogService.count(Wrappers.lambdaQuery() - .eq(FollowRecordLog::getRecordId, followRecord.getId()) .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE) + .eq(FollowRecordLog::getTaskId, followRecord.getTaskId()) ); vo.setHadCall(count > 0); vo.setId(followRecord.getId()); @@ -260,6 +260,8 @@ public class RMFollowStrategy extends AbstractFollowStrategy { vo.setAdviserName(customerDetailDto.getAdviserName()); vo.setCarModel(customerDetailDto.getBrandName() + " " + customerDetailDto.getSeriesName()); vo.setLastMileage(customerDetailDto.getCurrentMileage()); + vo.setCusLevel(customerDetailDto.getCusLevel()); + vo.setArrivalCount(customerDetailDto.getArrivalCount()); OriginalData originalData = originalDataService.getOne(Wrappers.lambdaQuery() .eq(OriginalData::getCustomerId, customerId) .eq(OriginalData::getType, DataTypeEnum.FS) diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/FollowRecordServiceImpl.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/FollowRecordServiceImpl.java index b69b703..48b0c57 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/FollowRecordServiceImpl.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/FollowRecordServiceImpl.java @@ -44,6 +44,7 @@ public class FollowRecordServiceImpl extends ServiceImpl getRecordList(final Long taskId) { return this.list(Wrappers.lambdaQuery() .eq(FollowRecord::getTaskId, taskId) + .eq(FollowRecord::getAddTodo, Boolean.TRUE) .orderByAsc(FollowRecord::getId) ); }