|
@@ -321,6 +321,7 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC
|
|
|
} else {
|
|
|
// 存在没有结束时间的SVIP记录 永久SVIP
|
|
|
List<VipCardRecord> svipList = vipCardRecords.stream().filter(o -> o.getVipType() == EVipType.SVIP).collect(Collectors.toList());
|
|
|
+ Date svipEndDate = null;
|
|
|
if (CollectionUtils.isNotEmpty(svipList)) {
|
|
|
userVip.setVipType(EVipType.SVIP);
|
|
|
|
|
@@ -332,6 +333,10 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC
|
|
|
Optional<VipCardRecord> max = svipList.stream().filter(o -> !PeriodEnum.PERPETUAL.equals(o.getType())).max(Comparator.comparing(VipCardRecord::getEndTime));
|
|
|
max.ifPresent(vipCardRecord -> userVip.setSvipEndDate(vipCardRecord.getEndTime()));
|
|
|
// }
|
|
|
+ Optional<VipCardRecord> max1 = svipList.stream().max(Comparator.comparing(VipCardRecord::getEndTime));
|
|
|
+ if (max1.isPresent()) {
|
|
|
+ svipEndDate = max1.get().getEndTime();
|
|
|
+ }
|
|
|
} else {
|
|
|
Integer svipCount = this.lambdaQuery()
|
|
|
.eq(VipCardRecord::getUserId, userId)
|
|
@@ -360,8 +365,8 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC
|
|
|
// 设置VIP剩余天数
|
|
|
if (userVip.getVipEndDate() != null) {
|
|
|
int num;
|
|
|
- if (userVip.getSvipEndDate() != null && userVip.getSvipEndDate().after(new Date())) {
|
|
|
- num = DateUtil.daysBetween(userVip.getSvipEndDate(), userVip.getVipEndDate());
|
|
|
+ if (svipEndDate != null && svipEndDate.after(new Date())) {
|
|
|
+ num = DateUtil.daysBetween(svipEndDate, userVip.getVipEndDate());
|
|
|
} else if (minDate != null && minDate.after(new Date())){
|
|
|
num = DateUtil.daysBetween(minDate, userVip.getVipEndDate());
|
|
|
} else {
|