|
@@ -327,10 +327,11 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC
|
|
|
Optional<VipCardRecord> first = svipList.stream().filter(o ->o.getType()==PeriodEnum.PERPETUAL).findFirst();
|
|
|
if (first.isPresent()) {
|
|
|
userVip.setVipType(EVipType.PERMANENT_SVIP);
|
|
|
- } else {
|
|
|
- Optional<VipCardRecord> max = svipList.stream().max(Comparator.comparing(VipCardRecord::getEndTime));
|
|
|
- max.ifPresent(vipCardRecord -> userVip.setSvipEndDate(vipCardRecord.getEndTime()));
|
|
|
}
|
|
|
+// else {
|
|
|
+ Optional<VipCardRecord> max = svipList.stream().filter(o -> !PeriodEnum.PERPETUAL.equals(o.getType())).max(Comparator.comparing(VipCardRecord::getEndTime));
|
|
|
+ max.ifPresent(vipCardRecord -> userVip.setSvipEndDate(vipCardRecord.getEndTime()));
|
|
|
+// }
|
|
|
} else {
|
|
|
Integer svipCount = this.lambdaQuery()
|
|
|
.eq(VipCardRecord::getUserId, userId)
|
|
@@ -618,7 +619,8 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC
|
|
|
}
|
|
|
|
|
|
// 扣减非永久
|
|
|
- List<VipCardRecord> collect = vipCardRecordList.stream().filter(n -> n.getVipType().equals(addVipCardRecord.getVipType())).collect(Collectors.toList());
|
|
|
+ List<VipCardRecord> collect = vipCardRecordList.stream()
|
|
|
+ .filter(n -> n.getVipType().equals(addVipCardRecord.getVipType()) && !PeriodEnum.PERPETUAL.equals(n.getType())).collect(Collectors.toList());
|
|
|
if (collect.isEmpty()) {
|
|
|
throw new BizException("剩余扣减数量不足");
|
|
|
}
|
|
@@ -694,7 +696,7 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC
|
|
|
deductMills = endTime.getTime() - deductedStartDate.getTime();
|
|
|
endDeductMills = endTime.getTime() - formatEnd(deductedStartDate).getTime();
|
|
|
} else {
|
|
|
- if (vipCardRecord.getVipType().equals(vipType)) {
|
|
|
+ if (vipCardRecord.getVipType().equals(vipType) && !PeriodEnum.PERPETUAL.equals(vipCardRecord.getType())) {
|
|
|
deductMills = endTime.getTime() - deductedStartDate.getTime();
|
|
|
endDeductMills = endTime.getTime() - formatEnd(deductedStartDate).getTime();
|
|
|
} else {
|