diff --git a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/customer/CarArchiveVO.java b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/customer/CarArchiveVO.java index 3258215..caeb1b4 100644 --- a/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/customer/CarArchiveVO.java +++ b/fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/customer/CarArchiveVO.java @@ -40,6 +40,10 @@ public class CarArchiveVO { */ private String carName; /** + * 车架号 + */ + private String frameNo; + /** * 车辆图片 */ private String image; @@ -60,6 +64,10 @@ public class CarArchiveVO { */ private Long shopId; /** + * 集团id + */ + private Long groupId; + /** * 座位数 */ private Integer seatCnt; @@ -84,6 +92,18 @@ public class CarArchiveVO { */ private String adviserName; /** + * 是否是贷款客户 + */ + private boolean loanCustomer; + /** + * 分期期数 + */ + private Integer periods; + /** + * 贷款到期时间 + */ + private Date expires; + /** * 商家信息 */ private DealerItem dealerInfoVO; @@ -96,10 +116,12 @@ public class CarArchiveVO { vo.setCarId(customer.getId()); vo.setPlateNo(customer.getPlateNo()); vo.setSeriesId(customer.getSeriesId()); + vo.setFrameNo(customer.getFrameNo()); vo.setSpecId(customer.getSpecId()); vo.setCarName(customer.getSeriesName().concat(" ").concat(Optional.ofNullable(customer.getSpecName()).orElse(""))); vo.setCusId(customer.getId()); vo.setShopId(customer.getShopId()); + vo.setGroupId(customer.getGroupId()); vo.setAdviserId(customer.getAdviserId()); //固定座位数为5 vo.setSeatCnt(5); diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java index 0811b00..fc6a6be 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java @@ -39,6 +39,7 @@ import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -551,6 +552,7 @@ public class CustomerBizService extends AbstractCustomerService { vo.setDealerInfoVO(createDeal(vo.getShopId())); vo.setOwner(true); vo.setOwnerName(user.getRealName()); + loanCustomer(vo); }).collect(Collectors.toList()); } return new ArrayList<>(); @@ -627,4 +629,17 @@ public class CustomerBizService extends AbstractCustomerService { log.error("新增客户贷款信息失败:", e); } } + + private void loanCustomer(CarArchiveVO vo) { + CustomerLoanInfo loanInfo = customerLoanInfoService.getOne(Wrappers.lambdaQuery() + .eq(CustomerLoanInfo::getGroupId, vo.getGroupId()) + .eq(CustomerLoanInfo::getFrameNo, vo.getFrameNo()) + .last(" limit 1 ") + ); + if (Objects.nonNull(loanInfo)) { + vo.setLoanCustomer(LocalDate.now().isBefore(DateUtil.date2LocalDate(loanInfo.getExpires()))); + vo.setExpires(loanInfo.getExpires()); + vo.setPeriods(loanInfo.getPeriods()); + } + } } 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 9a35ff3..b99bdb8 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 @@ -204,6 +204,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { * 生成跟进记录 * * @param task + * @param addDay 二次分配的情况+1天 */ @Override @Transactional(rollbackFor = Exception.class) @@ -224,7 +225,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { record.setPlanTime(planTime); settingBizService.querySettingByType(task.getType(), SettingTypeEnum.EFFECTIVE_TIME, task.getGroupId()) .ifPresent(setting -> { - Timestamp timestamp = calDate(setting, record.getPlanTime(), false); + Date timestamp = calDate(setting, record.getPlanTime(), false); record.setDeadline(timestamp); }); record.setOutTime(Boolean.FALSE); @@ -237,7 +238,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @Override @Transactional(rollbackFor = Exception.class) public void overdueProcessing(FollowRecord record) { - BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), record.getId().toString(), record.getPlanTime(),record.getShopId()); + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), record.getId().toString(), record.getPlanTime(), record.getShopId()); todoRpcService.cancel(dto); boolean bool = this.addTaskRecord(record, true); if (bool) { @@ -321,7 +322,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { List idList = new ArrayList<>(); for (FollowRecord record : list) { if (Boolean.TRUE.equals(record.getAddTodo())) { - BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(),record.getShopId()); + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(), record.getShopId()); todoRpcService.cancel(dto); } idList.add(record.getId()); @@ -337,6 +338,10 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { if (ClueStatusEnum.COMPLETE.equals(cluePool.getClueStatus()) || ClueStatusEnum.FAILURE.equals(cluePool.getClueStatus())) { return; } + if (ClueStatusEnum.WAITING.equals(cluePool.getClueStatus())) { + customerCluePoolService.removeById(cluePool.getId()); + return; + } LocalDateTime deadline = DateUtil.date2LocalDateTime(cluePool.getDeadline()); if (deadline.isAfter(DateUtil.date2LocalDateTime(originalData.getGenerateTime()))) { cluePool.setFinishShopId(originalData.getShopId()); @@ -410,7 +415,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { return; } for (FollowRecord record : list) { - BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(),record.getShopId()); + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(), record.getShopId()); todoRpcService.complete(dto); record.setFollowTime(new Date()); record.setOutTime(Boolean.FALSE); @@ -721,7 +726,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { * @param origin * @return */ - protected Timestamp calDate(SettingVO vo, Date origin, boolean reverse) { + protected Date calDate(SettingVO vo, Date origin, boolean reverse) { if (vo.getDetailValue() == null || vo.getDetailValue() <= 0) { log.info("关键设置数据异常,请检查数据 : settingType[{}] settingId[{}]", vo.getType(), vo.getId()); return null; @@ -735,9 +740,9 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { if (reverse) { value = -1 * value; } - Timestamp expired = DateUtil.getExpired(origin, value, getCalendarType(unit)); - if (SettingUnitEnum.DAY.equals(unit) && !DateUtil.isBeforeDawn(expired)) { - expired = DateUtil.getExpired(DateUtil.startDate(expired), 1, Calendar.DATE); + Date expired = DateUtil.getExpired(origin, value, getCalendarType(unit)); + if (SettingUnitEnum.DAY.equals(unit)) { + expired = DateUtil.startDate(expired); } return expired; } @@ -783,9 +788,9 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { log.info("关键设置数据异常,请检查数据 : settingType[{}] groupId[{}]", SettingTypeEnum.EFFECTIVE_TIME.getName(), record.getGroupId()); return false; } - Date originTime = record.getDeadline(); + Date originTime = DateUtil.startDate(record.getDeadline()); if (!overdue) { - originTime = record.getFollowTime(); + originTime = DateUtil.startDate(record.getFollowTime()); } Date newTime = calDate(fcsetting.get(), originTime, false); if (Objects.isNull(newTime)) { @@ -835,13 +840,4 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { record.setCreateTime(DateUtil.localDateTime2Date(LocalDateTime.now())); return record; } - - @Deprecated - private Timestamp getValidTime(SettingVO setting, Date origin) { - Timestamp timestamp = calDate(setting, origin, false); - while (!timestamp.after(DateUtil.localDateTime2Date(LocalDateTime.now()))) { - timestamp = calDate(setting, timestamp, false); - } - return timestamp; - } } 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 802df63..e86dde2 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 @@ -344,20 +344,28 @@ public class IRFollowStrategy extends AbstractFollowStrategy { if (ClueStatusEnum.COMPLETE.equals(cluePool.getClueStatus()) || ClueStatusEnum.FAILURE.equals(cluePool.getClueStatus())) { return; } + if (ClueStatusEnum.WAITING.equals(cluePool.getClueStatus())) { + customerCluePoolService.removeById(cluePool.getId()); + return; + } LocalDateTime deadline = DateUtil.date2LocalDateTime(cluePool.getDeadline()); if (deadline.isAfter(DateUtil.date2LocalDateTime(DateUtil.getExpiredYear(originalData.getGenerateTime(), -1)))) { - cluePool.setFinishShopId(originalData.getShopId()); - cluePool.setFinishUserId(originalData.getUserId()); if (cluePool.getOriginalShopId().equals(originalData.getShopId())) { cluePool.setFinishUserId(cluePool.getOriginalUserId()); - } - UserInfoDTO user = userService.user(originalData.getUserId()); - if (Objects.nonNull(user)) { - cluePool.setFinishUserName(user.getUserName()); - } - ShopDTO shop = oopService.shop(originalData.getShopId()); - if (Objects.nonNull(shop)) { - cluePool.setFinishShopName(shop.getShortName()); + cluePool.setFinishUserName(cluePool.getOriginalUserName()); + cluePool.setFinishShopId(cluePool.getOriginalShopId()); + cluePool.setFinishShopName(cluePool.getOriginalShopName()); + } else { + UserInfoDTO user = userService.user(originalData.getUserId()); + cluePool.setFinishUserId(originalData.getUserId()); + if (Objects.nonNull(user)) { + cluePool.setFinishUserName(user.getUserName()); + } + ShopDTO shop = oopService.shop(originalData.getShopId()); + cluePool.setFinishShopId(originalData.getShopId()); + if (Objects.nonNull(shop)) { + cluePool.setFinishShopName(shop.getShortName()); + } } cluePool.setCloseTime(originalData.getGenerateTime()); cluePool.setClueStatus(ClueStatusEnum.COMPLETE);