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 \ No newline at end of file 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,6 +21,10 @@ public class FollowRecordLog extends BaseEntity<FollowRecordLog, Long> {
21 */ 21 */
22 private Long recordId; 22 private Long recordId;
23 /** 23 /**
  24 + * 任务id
  25 + */
  26 + private Long taskId;
  27 + /**
24 * 附件类型 28 * 附件类型
25 */ 29 */
26 private AttTypeEnum attType; 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,6 +138,10 @@ public class CustomerDetailDto {
138 */ 138 */
139 private String idCode; 139 private String idCode;
140 /** 140 /**
  141 + * 进站次数
  142 + */
  143 + private Integer arrivalCount;
  144 + /**
141 * 上次进站时间 145 * 上次进站时间
142 */ 146 */
143 private Date arrivalTime; 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,6 +53,14 @@ public class FollowDetailVO {
53 */ 53 */
54 private String tags; 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 private Long adviserId; 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,6 +131,7 @@ public abstract class AbstractCustomerService {
131 dto.setInsuranceExpires(customer.getInsuranceExpires()); 131 dto.setInsuranceExpires(customer.getInsuranceExpires());
132 dto.setArrivalTime(customer.getArrivalTime()); 132 dto.setArrivalTime(customer.getArrivalTime());
133 dto.setAdviserId(customer.getAdviserId()); 133 dto.setAdviserId(customer.getAdviserId());
  134 + dto.setArrivalCount(customer.getArrivalCount());
134 UserInfoDTO user = userService.user(customer.getAdviserId()); 135 UserInfoDTO user = userService.user(customer.getAdviserId());
135 if (Objects.nonNull(user)) { 136 if (Objects.nonNull(user)) {
136 dto.setAdviserName(user.getUserName()); 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,10 +136,31 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
136 136
137 @Override 137 @Override
138 public List<FollowRecordVO> getRecordList(Long taskId) { 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 if (CollectionUtils.isEmpty(followRecordList)) { 160 if (CollectionUtils.isEmpty(followRecordList)) {
141 return new ArrayList<>(); 161 return new ArrayList<>();
142 } 162 }
  163 + List<FollowRecord> records = followRecordList.stream().sorted(Comparator.comparing(FollowRecord::getId)).collect(Collectors.toList());
143 List<Long> recordIds = followRecordList.stream().map(FollowRecord::getId).collect(Collectors.toList()); 164 List<Long> recordIds = followRecordList.stream().map(FollowRecord::getId).collect(Collectors.toList());
144 List<FollowRecordLog> attachments = followRecordLogService.getListByRecordIds(recordIds); 165 List<FollowRecordLog> attachments = followRecordLogService.getListByRecordIds(recordIds);
145 if (CollectionUtils.isEmpty(attachments)) { 166 if (CollectionUtils.isEmpty(attachments)) {
@@ -157,7 +178,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -157,7 +178,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
157 vo.setFollowType(followRecordList.get(0).getType()); 178 vo.setFollowType(followRecordList.get(0).getType());
158 vo.setUploadTime(attachment.getUploadTime()); 179 vo.setUploadTime(attachment.getUploadTime());
159 vo.setDescribes(attachment.getDescribes()); 180 vo.setDescribes(attachment.getDescribes());
160 - int i = queryIndexFromRecords(followRecordList, attachment.getRecordId()); 181 + int i = queryIndexFromRecords(records, attachment.getRecordId());
161 vo.setTimes(i + 1); 182 vo.setTimes(i + 1);
162 list.add(vo); 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,6 +316,8 @@ public class ACFollowStrategy extends AbstractFollowStrategy {
316 vo.setCustomerId(customer.getId()); 316 vo.setCustomerId(customer.getId());
317 vo.setAdviserId(customerDetailDto.getAdviserId()); 317 vo.setAdviserId(customerDetailDto.getAdviserId());
318 vo.setAdviserName(customerDetailDto.getAdviserName()); 318 vo.setAdviserName(customerDetailDto.getAdviserName());
  319 + vo.setCusLevel(customerDetailDto.getCusLevel());
  320 + vo.setArrivalCount(customerDetailDto.getArrivalCount());
319 vo.setVin(customerDetailDto.getFrameNo()); 321 vo.setVin(customerDetailDto.getFrameNo());
320 Optional<InsuranceDTO> insuranceDTO = queryInsuInfo(customer.getId()); 322 Optional<InsuranceDTO> insuranceDTO = queryInsuInfo(customer.getId());
321 insuranceDTO.ifPresent(ins -> vo.setInsComName(ins.getTciInsurerName())); 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,9 +81,8 @@ public class FMFollowStrategy extends AbstractFollowStrategy {
81 vo.setTaskId(followRecord.getTaskId()); 81 vo.setTaskId(followRecord.getTaskId());
82 vo.setFMExpiration(followTask.getDeadline()); 82 vo.setFMExpiration(followTask.getDeadline());
83 int count = followRecordLogService.count(Wrappers.<FollowRecordLog>lambdaQuery() 83 int count = followRecordLogService.count(Wrappers.<FollowRecordLog>lambdaQuery()
84 - .eq(FollowRecordLog::getRecordId, followRecord.getId()) 84 + .eq(FollowRecordLog::getTaskId, followRecord.getTaskId())
85 .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE) 85 .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE)
86 - .isNotNull(FollowRecordLog::getFeedbackType)  
87 ); 86 );
88 vo.setHadCall(count > 0); 87 vo.setHadCall(count > 0);
89 return vo; 88 return vo;
@@ -197,6 +196,8 @@ public class FMFollowStrategy extends AbstractFollowStrategy { @@ -197,6 +196,8 @@ public class FMFollowStrategy extends AbstractFollowStrategy {
197 vo.setAdviserName(customerDetailDto.getAdviserName()); 196 vo.setAdviserName(customerDetailDto.getAdviserName());
198 vo.setCarModel(customerDetailDto.getBrandName() + " " + customerDetailDto.getSeriesName()); 197 vo.setCarModel(customerDetailDto.getBrandName() + " " + customerDetailDto.getSeriesName());
199 vo.setBuyDate(customerDetailDto.getBuyDate()); 198 vo.setBuyDate(customerDetailDto.getBuyDate());
  199 + vo.setCusLevel(customerDetailDto.getCusLevel());
  200 + vo.setArrivalCount(customerDetailDto.getArrivalCount());
200 return vo; 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,7 +88,7 @@ public class IRFollowStrategy extends AbstractFollowStrategy {
88 BV.notNull(followRecord, "跟进记录不存在"); 88 BV.notNull(followRecord, "跟进记录不存在");
89 IRDetailVO vo = assemble(followRecord.getCustomerId()); 89 IRDetailVO vo = assemble(followRecord.getCustomerId());
90 int count = followRecordLogService.count(Wrappers.<FollowRecordLog>lambdaQuery() 90 int count = followRecordLogService.count(Wrappers.<FollowRecordLog>lambdaQuery()
91 - .eq(FollowRecordLog::getRecordId, followRecord.getId()) 91 + .eq(FollowRecordLog::getTaskId, followRecord.getTaskId())
92 .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE) 92 .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE)
93 ); 93 );
94 vo.setHadCall(count > 0); 94 vo.setHadCall(count > 0);
@@ -424,6 +424,8 @@ public class IRFollowStrategy extends AbstractFollowStrategy { @@ -424,6 +424,8 @@ public class IRFollowStrategy extends AbstractFollowStrategy {
424 vo.setExpires(detailDto.getExpires()); 424 vo.setExpires(detailDto.getExpires());
425 vo.setPeriods(detailDto.getPeriods()); 425 vo.setPeriods(detailDto.getPeriods());
426 vo.setLoanCustomer(detailDto.isLoanCustomer()); 426 vo.setLoanCustomer(detailDto.isLoanCustomer());
  427 + vo.setCusLevel(detailDto.getCusLevel());
  428 + vo.setArrivalCount(detailDto.getArrivalCount());
427 Optional<InsuranceDTO> insuranceDTO = queryInsuInfo(customerId); 429 Optional<InsuranceDTO> insuranceDTO = queryInsuInfo(customerId);
428 insuranceDTO.ifPresent(ins -> { 430 insuranceDTO.ifPresent(ins -> {
429 vo.setTclInsComName(ins.getTciInsurerName()); 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,8 +105,8 @@ public class RMFollowStrategy extends AbstractFollowStrategy {
105 BV.notNull(followRecord, "跟进记录不存在"); 105 BV.notNull(followRecord, "跟进记录不存在");
106 RMDetailVO vo = assemble(followRecord.getCustomerId()); 106 RMDetailVO vo = assemble(followRecord.getCustomerId());
107 int count = followRecordLogService.count(Wrappers.<FollowRecordLog>lambdaQuery() 107 int count = followRecordLogService.count(Wrappers.<FollowRecordLog>lambdaQuery()
108 - .eq(FollowRecordLog::getRecordId, followRecord.getId())  
109 .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE) 108 .eq(FollowRecordLog::getAttType, AttTypeEnum.SMART_PHONE)
  109 + .eq(FollowRecordLog::getTaskId, followRecord.getTaskId())
110 ); 110 );
111 vo.setHadCall(count > 0); 111 vo.setHadCall(count > 0);
112 vo.setId(followRecord.getId()); 112 vo.setId(followRecord.getId());
@@ -260,6 +260,8 @@ public class RMFollowStrategy extends AbstractFollowStrategy { @@ -260,6 +260,8 @@ public class RMFollowStrategy extends AbstractFollowStrategy {
260 vo.setAdviserName(customerDetailDto.getAdviserName()); 260 vo.setAdviserName(customerDetailDto.getAdviserName());
261 vo.setCarModel(customerDetailDto.getBrandName() + " " + customerDetailDto.getSeriesName()); 261 vo.setCarModel(customerDetailDto.getBrandName() + " " + customerDetailDto.getSeriesName());
262 vo.setLastMileage(customerDetailDto.getCurrentMileage()); 262 vo.setLastMileage(customerDetailDto.getCurrentMileage());
  263 + vo.setCusLevel(customerDetailDto.getCusLevel());
  264 + vo.setArrivalCount(customerDetailDto.getArrivalCount());
263 OriginalData originalData = originalDataService.getOne(Wrappers.<OriginalData>lambdaQuery() 265 OriginalData originalData = originalDataService.getOne(Wrappers.<OriginalData>lambdaQuery()
264 .eq(OriginalData::getCustomerId, customerId) 266 .eq(OriginalData::getCustomerId, customerId)
265 .eq(OriginalData::getType, DataTypeEnum.FS) 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,6 +44,7 @@ public class FollowRecordServiceImpl extends ServiceImpl&lt;FollowRecordMapper, Fol
44 public List<FollowRecord> getRecordList(final Long taskId) { 44 public List<FollowRecord> getRecordList(final Long taskId) {
45 return this.list(Wrappers.<FollowRecord>lambdaQuery() 45 return this.list(Wrappers.<FollowRecord>lambdaQuery()
46 .eq(FollowRecord::getTaskId, taskId) 46 .eq(FollowRecord::getTaskId, taskId)
  47 + .eq(FollowRecord::getAddTodo, Boolean.TRUE)
47 .orderByAsc(FollowRecord::getId) 48 .orderByAsc(FollowRecord::getId)
48 ); 49 );
49 } 50 }