Commit c115219a4b59dbd361f1d71fd1e0d4f949de619d

Authored by 张志伟
1 parent f424423f

:sparkles: 跟进时只校验第一次是否使用智能电话跟进

doc/v1.1.3/sql.sql 0 → 100644
  1 +alter table follow_record_log
  2 + add task_id bigint null comment '跟进任务id' after id;
  3 +
  4 +update follow_record_log t1
  5 +set task_id = (select w1.task_id from follow_record w1 where w1.id = t1.record_id)
  6 +where t1.task_id is null;
0 7 \ No newline at end of file
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/db/follow/FollowRecordLog.java
... ... @@ -21,6 +21,10 @@ public class FollowRecordLog extends BaseEntity<FollowRecordLog, Long> {
21 21 */
22 22 private Long recordId;
23 23 /**
  24 + * 任务id
  25 + */
  26 + private Long taskId;
  27 + /**
24 28 * 附件类型
25 29 */
26 30 private AttTypeEnum attType;
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/dto/CustomerDetailDto.java
... ... @@ -138,6 +138,10 @@ public class CustomerDetailDto {
138 138 */
139 139 private String idCode;
140 140 /**
  141 + * 进站次数
  142 + */
  143 + private Integer arrivalCount;
  144 + /**
141 145 * 上次进站时间
142 146 */
143 147 private Date arrivalTime;
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowDetailVO.java
... ... @@ -53,6 +53,14 @@ public class FollowDetailVO {
53 53 */
54 54 private String tags;
55 55 /**
  56 + * 客户星级
  57 + */
  58 + private Integer cusLevel;
  59 + /**
  60 + * 进站次数
  61 + */
  62 + private Integer arrivalCount;
  63 + /**
56 64 * 所属服务顾问
57 65 */
58 66 private Long adviserId;
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AbstractCustomerService.java
... ... @@ -131,6 +131,7 @@ public abstract class AbstractCustomerService {
131 131 dto.setInsuranceExpires(customer.getInsuranceExpires());
132 132 dto.setArrivalTime(customer.getArrivalTime());
133 133 dto.setAdviserId(customer.getAdviserId());
  134 + dto.setArrivalCount(customer.getArrivalCount());
134 135 UserInfoDTO user = userService.user(customer.getAdviserId());
135 136 if (Objects.nonNull(user)) {
136 137 dto.setAdviserName(user.getUserName());
... ...
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 {
136 136  
137 137 @Override
138 138 public List<FollowRecordVO> getRecordList(Long taskId) {
139   - List<FollowRecord> followRecordList = followRecordService.getRecordList(taskId);
  139 + List<FollowRecord> followRecordList = new ArrayList<>();
  140 + FollowTask task = followTaskService.getById(taskId);
  141 + if (Objects.nonNull(task)) {
  142 + Long clueId = task.getClueId();
  143 + List<FollowTask> taskList = followTaskService.list(Wrappers.<FollowTask>lambdaQuery()
  144 + .eq(FollowTask::getClueId, clueId)
  145 + .ne(FollowTask::getId, taskId)
  146 + );
  147 + if (!CollectionUtils.isEmpty(taskList)) {
  148 + for (FollowTask followTask : taskList) {
  149 + List<FollowRecord> recordList = followRecordService.getRecordList(followTask.getId());
  150 + if (!CollectionUtils.isEmpty(recordList)) {
  151 + followRecordList.addAll(recordList);
  152 + }
  153 + }
  154 + }
  155 + }
  156 + List<FollowRecord> recordList = followRecordService.getRecordList(taskId);
  157 + if (!CollectionUtils.isEmpty(recordList)) {
  158 + followRecordList.addAll(recordList);
  159 + }
140 160 if (CollectionUtils.isEmpty(followRecordList)) {
141 161 return new ArrayList<>();
142 162 }
  163 + List<FollowRecord> records = followRecordList.stream().sorted(Comparator.comparing(FollowRecord::getId)).collect(Collectors.toList());
143 164 List<Long> recordIds = followRecordList.stream().map(FollowRecord::getId).collect(Collectors.toList());
144 165 List<FollowRecordLog> attachments = followRecordLogService.getListByRecordIds(recordIds);
145 166 if (CollectionUtils.isEmpty(attachments)) {
... ... @@ -157,7 +178,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
157 178 vo.setFollowType(followRecordList.get(0).getType());
158 179 vo.setUploadTime(attachment.getUploadTime());
159 180 vo.setDescribes(attachment.getDescribes());
160   - int i = queryIndexFromRecords(followRecordList, attachment.getRecordId());
  181 + int i = queryIndexFromRecords(records, attachment.getRecordId());
161 182 vo.setTimes(i + 1);
162 183 list.add(vo);
163 184 }
... ...
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 {
316 316 vo.setCustomerId(customer.getId());
317 317 vo.setAdviserId(customerDetailDto.getAdviserId());
318 318 vo.setAdviserName(customerDetailDto.getAdviserName());
  319 + vo.setCusLevel(customerDetailDto.getCusLevel());
  320 + vo.setArrivalCount(customerDetailDto.getArrivalCount());
319 321 vo.setVin(customerDetailDto.getFrameNo());
320 322 Optional<InsuranceDTO> insuranceDTO = queryInsuInfo(customer.getId());
321 323 insuranceDTO.ifPresent(ins -> vo.setInsComName(ins.getTciInsurerName()));
... ...
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 {
81 81 vo.setTaskId(followRecord.getTaskId());
82 82 vo.setFMExpiration(followTask.getDeadline());
83 83 int count = followRecordLogService.count(Wrappers.<FollowRecordLog>lambdaQuery()
84   - .eq(FollowRecordLog::getRecordId, followRecord.getId())
  84 + .eq(FollowRecordLog::getTaskId, followRecord.getTaskId())
85 85 .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE)
86   - .isNotNull(FollowRecordLog::getFeedbackType)
87 86 );
88 87 vo.setHadCall(count > 0);
89 88 return vo;
... ... @@ -197,6 +196,8 @@ public class FMFollowStrategy extends AbstractFollowStrategy {
197 196 vo.setAdviserName(customerDetailDto.getAdviserName());
198 197 vo.setCarModel(customerDetailDto.getBrandName() + " " + customerDetailDto.getSeriesName());
199 198 vo.setBuyDate(customerDetailDto.getBuyDate());
  199 + vo.setCusLevel(customerDetailDto.getCusLevel());
  200 + vo.setArrivalCount(customerDetailDto.getArrivalCount());
200 201 return vo;
201 202 }
202 203 }
... ...
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 {
88 88 BV.notNull(followRecord, "跟进记录不存在");
89 89 IRDetailVO vo = assemble(followRecord.getCustomerId());
90 90 int count = followRecordLogService.count(Wrappers.<FollowRecordLog>lambdaQuery()
91   - .eq(FollowRecordLog::getRecordId, followRecord.getId())
  91 + .eq(FollowRecordLog::getTaskId, followRecord.getTaskId())
92 92 .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE)
93 93 );
94 94 vo.setHadCall(count > 0);
... ... @@ -424,6 +424,8 @@ public class IRFollowStrategy extends AbstractFollowStrategy {
424 424 vo.setExpires(detailDto.getExpires());
425 425 vo.setPeriods(detailDto.getPeriods());
426 426 vo.setLoanCustomer(detailDto.isLoanCustomer());
  427 + vo.setCusLevel(detailDto.getCusLevel());
  428 + vo.setArrivalCount(detailDto.getArrivalCount());
427 429 Optional<InsuranceDTO> insuranceDTO = queryInsuInfo(customerId);
428 430 insuranceDTO.ifPresent(ins -> {
429 431 vo.setTclInsComName(ins.getTciInsurerName());
... ...
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 {
105 105 BV.notNull(followRecord, "跟进记录不存在");
106 106 RMDetailVO vo = assemble(followRecord.getCustomerId());
107 107 int count = followRecordLogService.count(Wrappers.<FollowRecordLog>lambdaQuery()
108   - .eq(FollowRecordLog::getRecordId, followRecord.getId())
109 108 .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE)
  109 + .eq(FollowRecordLog::getTaskId, followRecord.getTaskId())
110 110 );
111 111 vo.setHadCall(count > 0);
112 112 vo.setId(followRecord.getId());
... ... @@ -260,6 +260,8 @@ public class RMFollowStrategy extends AbstractFollowStrategy {
260 260 vo.setAdviserName(customerDetailDto.getAdviserName());
261 261 vo.setCarModel(customerDetailDto.getBrandName() + " " + customerDetailDto.getSeriesName());
262 262 vo.setLastMileage(customerDetailDto.getCurrentMileage());
  263 + vo.setCusLevel(customerDetailDto.getCusLevel());
  264 + vo.setArrivalCount(customerDetailDto.getArrivalCount());
263 265 OriginalData originalData = originalDataService.getOne(Wrappers.<OriginalData>lambdaQuery()
264 266 .eq(OriginalData::getCustomerId, customerId)
265 267 .eq(OriginalData::getType, DataTypeEnum.FS)
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/FollowRecordServiceImpl.java
... ... @@ -44,6 +44,7 @@ public class FollowRecordServiceImpl extends ServiceImpl&lt;FollowRecordMapper, Fol
44 44 public List<FollowRecord> getRecordList(final Long taskId) {
45 45 return this.list(Wrappers.<FollowRecord>lambdaQuery()
46 46 .eq(FollowRecord::getTaskId, taskId)
  47 + .eq(FollowRecord::getAddTodo, Boolean.TRUE)
47 48 .orderByAsc(FollowRecord::getId)
48 49 );
49 50 }
... ...