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 40 */
41 41 private String carName;
42 42 /**
  43 + * 车架号
  44 + */
  45 + private String frameNo;
  46 + /**
43 47 * 车辆图片
44 48 */
45 49 private String image;
... ... @@ -60,6 +64,10 @@ public class CarArchiveVO {
60 64 */
61 65 private Long shopId;
62 66 /**
  67 + * 集团id
  68 + */
  69 + private Long groupId;
  70 + /**
63 71 * 座位数
64 72 */
65 73 private Integer seatCnt;
... ... @@ -84,6 +92,18 @@ public class CarArchiveVO {
84 92 */
85 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 109 private DealerItem dealerInfoVO;
... ... @@ -96,10 +116,12 @@ public class CarArchiveVO {
96 116 vo.setCarId(customer.getId());
97 117 vo.setPlateNo(customer.getPlateNo());
98 118 vo.setSeriesId(customer.getSeriesId());
  119 + vo.setFrameNo(customer.getFrameNo());
99 120 vo.setSpecId(customer.getSpecId());
100 121 vo.setCarName(customer.getSeriesName().concat(" ").concat(Optional.ofNullable(customer.getSpecName()).orElse("")));
101 122 vo.setCusId(customer.getId());
102 123 vo.setShopId(customer.getShopId());
  124 + vo.setGroupId(customer.getGroupId());
103 125 vo.setAdviserId(customer.getAdviserId());
104 126 //固定座位数为5
105 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 39 import org.springframework.stereotype.Service;
40 40 import org.springframework.transaction.annotation.Transactional;
41 41  
  42 +import java.time.LocalDate;
42 43 import java.time.LocalDateTime;
43 44 import java.util.*;
44 45 import java.util.stream.Collectors;
... ... @@ -551,6 +552,7 @@ public class CustomerBizService extends AbstractCustomerService {
551 552 vo.setDealerInfoVO(createDeal(vo.getShopId()));
552 553 vo.setOwner(true);
553 554 vo.setOwnerName(user.getRealName());
  555 + loanCustomer(vo);
554 556 }).collect(Collectors.toList());
555 557 }
556 558 return new ArrayList<>();
... ... @@ -627,4 +629,17 @@ public class CustomerBizService extends AbstractCustomerService {
627 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 204 * 生成跟进记录
205 205 *
206 206 * @param task
  207 + * @param addDay 二次分配的情况+1天
207 208 */
208 209 @Override
209 210 @Transactional(rollbackFor = Exception.class)
... ... @@ -224,7 +225,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
224 225 record.setPlanTime(planTime);
225 226 settingBizService.querySettingByType(task.getType(), SettingTypeEnum.EFFECTIVE_TIME, task.getGroupId())
226 227 .ifPresent(setting -> {
227   - Timestamp timestamp = calDate(setting, record.getPlanTime(), false);
  228 + Date timestamp = calDate(setting, record.getPlanTime(), false);
228 229 record.setDeadline(timestamp);
229 230 });
230 231 record.setOutTime(Boolean.FALSE);
... ... @@ -237,7 +238,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
237 238 @Override
238 239 @Transactional(rollbackFor = Exception.class)
239 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 242 todoRpcService.cancel(dto);
242 243 boolean bool = this.addTaskRecord(record, true);
243 244 if (bool) {
... ... @@ -321,7 +322,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
321 322 List<Long> idList = new ArrayList<>();
322 323 for (FollowRecord record : list) {
323 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 326 todoRpcService.cancel(dto);
326 327 }
327 328 idList.add(record.getId());
... ... @@ -337,6 +338,10 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
337 338 if (ClueStatusEnum.COMPLETE.equals(cluePool.getClueStatus()) || ClueStatusEnum.FAILURE.equals(cluePool.getClueStatus())) {
338 339 return;
339 340 }
  341 + if (ClueStatusEnum.WAITING.equals(cluePool.getClueStatus())) {
  342 + customerCluePoolService.removeById(cluePool.getId());
  343 + return;
  344 + }
340 345 LocalDateTime deadline = DateUtil.date2LocalDateTime(cluePool.getDeadline());
341 346 if (deadline.isAfter(DateUtil.date2LocalDateTime(originalData.getGenerateTime()))) {
342 347 cluePool.setFinishShopId(originalData.getShopId());
... ... @@ -410,7 +415,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
410 415 return;
411 416 }
412 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 419 todoRpcService.complete(dto);
415 420 record.setFollowTime(new Date());
416 421 record.setOutTime(Boolean.FALSE);
... ... @@ -721,7 +726,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
721 726 * @param origin
722 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 730 if (vo.getDetailValue() == null || vo.getDetailValue() <= 0) {
726 731 log.info("关键设置数据异常,请检查数据 : settingType[{}] settingId[{}]", vo.getType(), vo.getId());
727 732 return null;
... ... @@ -735,9 +740,9 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
735 740 if (reverse) {
736 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 747 return expired;
743 748 }
... ... @@ -783,9 +788,9 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
783 788 log.info("关键设置数据异常,请检查数据 : settingType[{}] groupId[{}]", SettingTypeEnum.EFFECTIVE_TIME.getName(), record.getGroupId());
784 789 return false;
785 790 }
786   - Date originTime = record.getDeadline();
  791 + Date originTime = DateUtil.startDate(record.getDeadline());
787 792 if (!overdue) {
788   - originTime = record.getFollowTime();
  793 + originTime = DateUtil.startDate(record.getFollowTime());
789 794 }
790 795 Date newTime = calDate(fcsetting.get(), originTime, false);
791 796 if (Objects.isNull(newTime)) {
... ... @@ -835,13 +840,4 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
835 840 record.setCreateTime(DateUtil.localDateTime2Date(LocalDateTime.now()));
836 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 344 if (ClueStatusEnum.COMPLETE.equals(cluePool.getClueStatus()) || ClueStatusEnum.FAILURE.equals(cluePool.getClueStatus())) {
345 345 return;
346 346 }
  347 + if (ClueStatusEnum.WAITING.equals(cluePool.getClueStatus())) {
  348 + customerCluePoolService.removeById(cluePool.getId());
  349 + return;
  350 + }
347 351 LocalDateTime deadline = DateUtil.date2LocalDateTime(cluePool.getDeadline());
348 352 if (deadline.isAfter(DateUtil.date2LocalDateTime(DateUtil.getExpiredYear(originalData.getGenerateTime(), -1)))) {
349   - cluePool.setFinishShopId(originalData.getShopId());
350   - cluePool.setFinishUserId(originalData.getUserId());
351 353 if (cluePool.getOriginalShopId().equals(originalData.getShopId())) {
352 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 370 cluePool.setCloseTime(originalData.getGenerateTime());
363 371 cluePool.setClueStatus(ClueStatusEnum.COMPLETE);
... ...