Commit aca8b720d7a7f63c1ae3ebc1d8dadc640fb4837f

Authored by 张志伟
2 parents df20ebc8 99e77aad

Merge remote-tracking branch 'origin/dev' into test

fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/customer/CarArchiveVO.java
@@ -40,6 +40,10 @@ public class CarArchiveVO { @@ -40,6 +40,10 @@ public class CarArchiveVO {
40 */ 40 */
41 private String carName; 41 private String carName;
42 /** 42 /**
  43 + * 车架号
  44 + */
  45 + private String frameNo;
  46 + /**
43 * 车辆图片 47 * 车辆图片
44 */ 48 */
45 private String image; 49 private String image;
@@ -60,6 +64,10 @@ public class CarArchiveVO { @@ -60,6 +64,10 @@ public class CarArchiveVO {
60 */ 64 */
61 private Long shopId; 65 private Long shopId;
62 /** 66 /**
  67 + * 集团id
  68 + */
  69 + private Long groupId;
  70 + /**
63 * 座位数 71 * 座位数
64 */ 72 */
65 private Integer seatCnt; 73 private Integer seatCnt;
@@ -84,6 +92,18 @@ public class CarArchiveVO { @@ -84,6 +92,18 @@ public class CarArchiveVO {
84 */ 92 */
85 private String adviserName; 93 private String adviserName;
86 /** 94 /**
  95 + * 是否是贷款客户
  96 + */
  97 + private boolean loanCustomer;
  98 + /**
  99 + * 分期期数
  100 + */
  101 + private Integer periods;
  102 + /**
  103 + * 贷款到期时间
  104 + */
  105 + private Date expires;
  106 + /**
87 * 商家信息 107 * 商家信息
88 */ 108 */
89 private DealerItem dealerInfoVO; 109 private DealerItem dealerInfoVO;
@@ -96,10 +116,12 @@ public class CarArchiveVO { @@ -96,10 +116,12 @@ public class CarArchiveVO {
96 vo.setCarId(customer.getId()); 116 vo.setCarId(customer.getId());
97 vo.setPlateNo(customer.getPlateNo()); 117 vo.setPlateNo(customer.getPlateNo());
98 vo.setSeriesId(customer.getSeriesId()); 118 vo.setSeriesId(customer.getSeriesId());
  119 + vo.setFrameNo(customer.getFrameNo());
99 vo.setSpecId(customer.getSpecId()); 120 vo.setSpecId(customer.getSpecId());
100 vo.setCarName(customer.getSeriesName().concat(" ").concat(Optional.ofNullable(customer.getSpecName()).orElse(""))); 121 vo.setCarName(customer.getSeriesName().concat(" ").concat(Optional.ofNullable(customer.getSpecName()).orElse("")));
101 vo.setCusId(customer.getId()); 122 vo.setCusId(customer.getId());
102 vo.setShopId(customer.getShopId()); 123 vo.setShopId(customer.getShopId());
  124 + vo.setGroupId(customer.getGroupId());
103 vo.setAdviserId(customer.getAdviserId()); 125 vo.setAdviserId(customer.getAdviserId());
104 //固定座位数为5 126 //固定座位数为5
105 vo.setSeatCnt(5); 127 vo.setSeatCnt(5);
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java
@@ -39,6 +39,7 @@ import org.springframework.context.ApplicationEventPublisher; @@ -39,6 +39,7 @@ import org.springframework.context.ApplicationEventPublisher;
39 import org.springframework.stereotype.Service; 39 import org.springframework.stereotype.Service;
40 import org.springframework.transaction.annotation.Transactional; 40 import org.springframework.transaction.annotation.Transactional;
41 41
  42 +import java.time.LocalDate;
42 import java.time.LocalDateTime; 43 import java.time.LocalDateTime;
43 import java.util.*; 44 import java.util.*;
44 import java.util.stream.Collectors; 45 import java.util.stream.Collectors;
@@ -551,6 +552,7 @@ public class CustomerBizService extends AbstractCustomerService { @@ -551,6 +552,7 @@ public class CustomerBizService extends AbstractCustomerService {
551 vo.setDealerInfoVO(createDeal(vo.getShopId())); 552 vo.setDealerInfoVO(createDeal(vo.getShopId()));
552 vo.setOwner(true); 553 vo.setOwner(true);
553 vo.setOwnerName(user.getRealName()); 554 vo.setOwnerName(user.getRealName());
  555 + loanCustomer(vo);
554 }).collect(Collectors.toList()); 556 }).collect(Collectors.toList());
555 } 557 }
556 return new ArrayList<>(); 558 return new ArrayList<>();
@@ -627,4 +629,17 @@ public class CustomerBizService extends AbstractCustomerService { @@ -627,4 +629,17 @@ public class CustomerBizService extends AbstractCustomerService {
627 log.error("新增客户贷款信息失败:", e); 629 log.error("新增客户贷款信息失败:", e);
628 } 630 }
629 } 631 }
  632 +
  633 + private void loanCustomer(CarArchiveVO vo) {
  634 + CustomerLoanInfo loanInfo = customerLoanInfoService.getOne(Wrappers.<CustomerLoanInfo>lambdaQuery()
  635 + .eq(CustomerLoanInfo::getGroupId, vo.getGroupId())
  636 + .eq(CustomerLoanInfo::getFrameNo, vo.getFrameNo())
  637 + .last(" limit 1 ")
  638 + );
  639 + if (Objects.nonNull(loanInfo)) {
  640 + vo.setLoanCustomer(LocalDate.now().isBefore(DateUtil.date2LocalDate(loanInfo.getExpires())));
  641 + vo.setExpires(loanInfo.getExpires());
  642 + vo.setPeriods(loanInfo.getPeriods());
  643 + }
  644 + }
630 } 645 }
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/AbstractFollowStrategy.java
@@ -204,6 +204,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -204,6 +204,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
204 * 生成跟进记录 204 * 生成跟进记录
205 * 205 *
206 * @param task 206 * @param task
  207 + * @param addDay 二次分配的情况+1天
207 */ 208 */
208 @Override 209 @Override
209 @Transactional(rollbackFor = Exception.class) 210 @Transactional(rollbackFor = Exception.class)
@@ -224,7 +225,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -224,7 +225,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
224 record.setPlanTime(planTime); 225 record.setPlanTime(planTime);
225 settingBizService.querySettingByType(task.getType(), SettingTypeEnum.EFFECTIVE_TIME, task.getGroupId()) 226 settingBizService.querySettingByType(task.getType(), SettingTypeEnum.EFFECTIVE_TIME, task.getGroupId())
226 .ifPresent(setting -> { 227 .ifPresent(setting -> {
227 - Timestamp timestamp = calDate(setting, record.getPlanTime(), false); 228 + Date timestamp = calDate(setting, record.getPlanTime(), false);
228 record.setDeadline(timestamp); 229 record.setDeadline(timestamp);
229 }); 230 });
230 record.setOutTime(Boolean.FALSE); 231 record.setOutTime(Boolean.FALSE);
@@ -237,7 +238,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -237,7 +238,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
237 @Override 238 @Override
238 @Transactional(rollbackFor = Exception.class) 239 @Transactional(rollbackFor = Exception.class)
239 public void overdueProcessing(FollowRecord record) { 240 public void overdueProcessing(FollowRecord record) {
240 - BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), record.getId().toString(), record.getPlanTime(),record.getShopId()); 241 + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), record.getId().toString(), record.getPlanTime(), record.getShopId());
241 todoRpcService.cancel(dto); 242 todoRpcService.cancel(dto);
242 boolean bool = this.addTaskRecord(record, true); 243 boolean bool = this.addTaskRecord(record, true);
243 if (bool) { 244 if (bool) {
@@ -321,7 +322,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -321,7 +322,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
321 List<Long> idList = new ArrayList<>(); 322 List<Long> idList = new ArrayList<>();
322 for (FollowRecord record : list) { 323 for (FollowRecord record : list) {
323 if (Boolean.TRUE.equals(record.getAddTodo())) { 324 if (Boolean.TRUE.equals(record.getAddTodo())) {
324 - BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(),record.getShopId()); 325 + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(), record.getShopId());
325 todoRpcService.cancel(dto); 326 todoRpcService.cancel(dto);
326 } 327 }
327 idList.add(record.getId()); 328 idList.add(record.getId());
@@ -337,6 +338,10 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -337,6 +338,10 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
337 if (ClueStatusEnum.COMPLETE.equals(cluePool.getClueStatus()) || ClueStatusEnum.FAILURE.equals(cluePool.getClueStatus())) { 338 if (ClueStatusEnum.COMPLETE.equals(cluePool.getClueStatus()) || ClueStatusEnum.FAILURE.equals(cluePool.getClueStatus())) {
338 return; 339 return;
339 } 340 }
  341 + if (ClueStatusEnum.WAITING.equals(cluePool.getClueStatus())) {
  342 + customerCluePoolService.removeById(cluePool.getId());
  343 + return;
  344 + }
340 LocalDateTime deadline = DateUtil.date2LocalDateTime(cluePool.getDeadline()); 345 LocalDateTime deadline = DateUtil.date2LocalDateTime(cluePool.getDeadline());
341 if (deadline.isAfter(DateUtil.date2LocalDateTime(originalData.getGenerateTime()))) { 346 if (deadline.isAfter(DateUtil.date2LocalDateTime(originalData.getGenerateTime()))) {
342 cluePool.setFinishShopId(originalData.getShopId()); 347 cluePool.setFinishShopId(originalData.getShopId());
@@ -410,7 +415,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -410,7 +415,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
410 return; 415 return;
411 } 416 }
412 for (FollowRecord record : list) { 417 for (FollowRecord record : list) {
413 - BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(),record.getShopId()); 418 + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(), record.getShopId());
414 todoRpcService.complete(dto); 419 todoRpcService.complete(dto);
415 record.setFollowTime(new Date()); 420 record.setFollowTime(new Date());
416 record.setOutTime(Boolean.FALSE); 421 record.setOutTime(Boolean.FALSE);
@@ -721,7 +726,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -721,7 +726,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
721 * @param origin 726 * @param origin
722 * @return 727 * @return
723 */ 728 */
724 - protected Timestamp calDate(SettingVO vo, Date origin, boolean reverse) { 729 + protected Date calDate(SettingVO vo, Date origin, boolean reverse) {
725 if (vo.getDetailValue() == null || vo.getDetailValue() <= 0) { 730 if (vo.getDetailValue() == null || vo.getDetailValue() <= 0) {
726 log.info("关键设置数据异常,请检查数据 : settingType[{}] settingId[{}]", vo.getType(), vo.getId()); 731 log.info("关键设置数据异常,请检查数据 : settingType[{}] settingId[{}]", vo.getType(), vo.getId());
727 return null; 732 return null;
@@ -735,9 +740,9 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -735,9 +740,9 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
735 if (reverse) { 740 if (reverse) {
736 value = -1 * value; 741 value = -1 * value;
737 } 742 }
738 - Timestamp expired = DateUtil.getExpired(origin, value, getCalendarType(unit));  
739 - if (SettingUnitEnum.DAY.equals(unit) && !DateUtil.isBeforeDawn(expired)) {  
740 - expired = DateUtil.getExpired(DateUtil.startDate(expired), 1, Calendar.DATE); 743 + Date expired = DateUtil.getExpired(origin, value, getCalendarType(unit));
  744 + if (SettingUnitEnum.DAY.equals(unit)) {
  745 + expired = DateUtil.startDate(expired);
741 } 746 }
742 return expired; 747 return expired;
743 } 748 }
@@ -783,9 +788,9 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -783,9 +788,9 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
783 log.info("关键设置数据异常,请检查数据 : settingType[{}] groupId[{}]", SettingTypeEnum.EFFECTIVE_TIME.getName(), record.getGroupId()); 788 log.info("关键设置数据异常,请检查数据 : settingType[{}] groupId[{}]", SettingTypeEnum.EFFECTIVE_TIME.getName(), record.getGroupId());
784 return false; 789 return false;
785 } 790 }
786 - Date originTime = record.getDeadline(); 791 + Date originTime = DateUtil.startDate(record.getDeadline());
787 if (!overdue) { 792 if (!overdue) {
788 - originTime = record.getFollowTime(); 793 + originTime = DateUtil.startDate(record.getFollowTime());
789 } 794 }
790 Date newTime = calDate(fcsetting.get(), originTime, false); 795 Date newTime = calDate(fcsetting.get(), originTime, false);
791 if (Objects.isNull(newTime)) { 796 if (Objects.isNull(newTime)) {
@@ -835,13 +840,4 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -835,13 +840,4 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
835 record.setCreateTime(DateUtil.localDateTime2Date(LocalDateTime.now())); 840 record.setCreateTime(DateUtil.localDateTime2Date(LocalDateTime.now()));
836 return record; 841 return record;
837 } 842 }
838 -  
839 - @Deprecated  
840 - private Timestamp getValidTime(SettingVO setting, Date origin) {  
841 - Timestamp timestamp = calDate(setting, origin, false);  
842 - while (!timestamp.after(DateUtil.localDateTime2Date(LocalDateTime.now()))) {  
843 - timestamp = calDate(setting, timestamp, false);  
844 - }  
845 - return timestamp;  
846 - }  
847 } 843 }
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/IRFollowStrategy.java
@@ -344,20 +344,28 @@ public class IRFollowStrategy extends AbstractFollowStrategy { @@ -344,20 +344,28 @@ public class IRFollowStrategy extends AbstractFollowStrategy {
344 if (ClueStatusEnum.COMPLETE.equals(cluePool.getClueStatus()) || ClueStatusEnum.FAILURE.equals(cluePool.getClueStatus())) { 344 if (ClueStatusEnum.COMPLETE.equals(cluePool.getClueStatus()) || ClueStatusEnum.FAILURE.equals(cluePool.getClueStatus())) {
345 return; 345 return;
346 } 346 }
  347 + if (ClueStatusEnum.WAITING.equals(cluePool.getClueStatus())) {
  348 + customerCluePoolService.removeById(cluePool.getId());
  349 + return;
  350 + }
347 LocalDateTime deadline = DateUtil.date2LocalDateTime(cluePool.getDeadline()); 351 LocalDateTime deadline = DateUtil.date2LocalDateTime(cluePool.getDeadline());
348 if (deadline.isAfter(DateUtil.date2LocalDateTime(DateUtil.getExpiredYear(originalData.getGenerateTime(), -1)))) { 352 if (deadline.isAfter(DateUtil.date2LocalDateTime(DateUtil.getExpiredYear(originalData.getGenerateTime(), -1)))) {
349 - cluePool.setFinishShopId(originalData.getShopId());  
350 - cluePool.setFinishUserId(originalData.getUserId());  
351 if (cluePool.getOriginalShopId().equals(originalData.getShopId())) { 353 if (cluePool.getOriginalShopId().equals(originalData.getShopId())) {
352 cluePool.setFinishUserId(cluePool.getOriginalUserId()); 354 cluePool.setFinishUserId(cluePool.getOriginalUserId());
353 - }  
354 - UserInfoDTO user = userService.user(originalData.getUserId());  
355 - if (Objects.nonNull(user)) {  
356 - cluePool.setFinishUserName(user.getUserName());  
357 - }  
358 - ShopDTO shop = oopService.shop(originalData.getShopId());  
359 - if (Objects.nonNull(shop)) {  
360 - cluePool.setFinishShopName(shop.getShortName()); 355 + cluePool.setFinishUserName(cluePool.getOriginalUserName());
  356 + cluePool.setFinishShopId(cluePool.getOriginalShopId());
  357 + cluePool.setFinishShopName(cluePool.getOriginalShopName());
  358 + } else {
  359 + UserInfoDTO user = userService.user(originalData.getUserId());
  360 + cluePool.setFinishUserId(originalData.getUserId());
  361 + if (Objects.nonNull(user)) {
  362 + cluePool.setFinishUserName(user.getUserName());
  363 + }
  364 + ShopDTO shop = oopService.shop(originalData.getShopId());
  365 + cluePool.setFinishShopId(originalData.getShopId());
  366 + if (Objects.nonNull(shop)) {
  367 + cluePool.setFinishShopName(shop.getShortName());
  368 + }
361 } 369 }
362 cluePool.setCloseTime(originalData.getGenerateTime()); 370 cluePool.setCloseTime(originalData.getGenerateTime());
363 cluePool.setClueStatus(ClueStatusEnum.COMPLETE); 371 cluePool.setClueStatus(ClueStatusEnum.COMPLETE);