| 
					
				 | 
			
			
				@@ -32,7 +32,6 @@ import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.LocalDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.LocalDateTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.time.LocalTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.ZoneId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.concurrent.CompletableFuture; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -402,11 +401,11 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<VipCardRecord> vipCardRecordList = this.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq(VipCardRecord::getClientType, addVipCardRecord.getClientType()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq(VipCardRecord::getUserId, addVipCardRecord.getUserId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                .ge(VipCardRecord::getEndTime, new Date()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .ge(VipCardRecord::getEndTime, new Date()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq(VipCardRecord::getEfficientFlag, true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .list() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .filter(n -> n.getEndTime() == null || n.getEndTime().after(new Date())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                .filter(n -> n.getEndTime() == null || n.getEndTime().after(new Date())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .sorted(Comparator.comparing(VipCardRecord::getStartTime)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -444,23 +443,36 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             startTime = vipCardRecordList.stream().map(VipCardRecord::getEndTime).max(Date::compareTo).get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (addVipType.equals(EVipType.SVIP)) { //放到VIP的前面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            index = (int) vipCardRecordList.stream().filter(n -> EVipType.SVIP.equals(n.getVipType())).count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (index > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                startTime = vipCardRecordList.stream().filter(n -> EVipType.SVIP.equals(n.getVipType())).map(VipCardRecord::getEndTime).max(Date::compareTo).get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PeriodEnum period = addVipCardRecord.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (period.equals(PeriodEnum.PERPETUAL)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                index = (int) vipCardRecordList.stream().filter(n -> EVipType.SVIP.equals(n.getVipType())).count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (index > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    startTime = vipCardRecordList.stream().filter(n -> EVipType.SVIP.equals(n.getVipType())).map(VipCardRecord::getEndTime).max(Date::compareTo).get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                index = (int) vipCardRecordList.stream().filter(n -> EVipType.SVIP.equals(n.getVipType()) && !PeriodEnum.PERPETUAL.equals(n.getType())).count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (index > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    startTime = vipCardRecordList.stream().filter(n -> EVipType.SVIP.equals(n.getVipType()) && !PeriodEnum.PERPETUAL.equals(n.getType())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            .map(VipCardRecord::getEndTime).max(Date::compareTo).get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date endDate = plusDate(startTime, addVipCardRecord.getType(), Long.valueOf(addVipCardRecord.getTimes())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         VipCardRecord newRecord = JSON.parseObject(JSON.toJSONString(addVipCardRecord), VipCardRecord.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         newRecord.setSourceType(SourceTypeEnum.BACKEND_GIVE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         newRecord.setStatus(EVipRecordStatus.ADD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        newRecord.setStartTime(startTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (index > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newRecord.setStartTime(new Date(startTime.getTime() + 1000)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newRecord.setStartTime(startTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         newRecord.setEndTime(endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         newRecord.setDisplayFlag(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         newRecord.setEfficientFlag(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         save(newRecord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 平移时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        long plusMills = endDate == null ? 0L : (endDate.getTime() - startTime.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        long plusMills = endDate.getTime() - startTime.getTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (int i = 0; i < vipCardRecordList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             VipCardRecord vipCardRecord = vipCardRecordList.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (i >= index) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -468,8 +480,17 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (plusMills > 0L) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     VipCardRecord addRecord = JSON.parseObject(JSON.toJSONString(vipCardRecord), VipCardRecord.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     addRecord.setStatus(EVipRecordStatus.UPDATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addRecord.setStartTime(new Date(Math.max(vipCardRecord.getStartTime().getTime(), now.getTime()) + plusMills)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addRecord.setEndTime(new Date(vipCardRecord.getEndTime().getTime() + plusMills)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    long startTimeMills = Math.max(vipCardRecord.getStartTime().getTime(), now.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Date startDate = new Date(startTimeMills + plusMills + 1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Calendar instance = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    instance.setTime(startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    instance.set(Calendar.SECOND, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    instance.set(Calendar.MILLISECOND, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    addRecord.setStartTime(instance.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    int days = (int) Math.ceil(plusMills * 1.0D / (24 * 60 * 60 * 1000)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    addRecord.setEndTime(plusDate(vipCardRecord.getEndTime(), PeriodEnum.DAY, days)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     addRecord.setDisplayFlag(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     addRecord.setEfficientFlag(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     save(addRecord); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -493,11 +514,19 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq(VipCardRecord::getClientType, addVipCardRecord.getClientType()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq(VipCardRecord::getUserId, addVipCardRecord.getUserId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .ge(VipCardRecord::getEndTime, new Date()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                .eq(VipCardRecord::getDisplayFlag, false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq(VipCardRecord::getEfficientFlag, true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .list() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .sorted(Comparator.comparing(VipCardRecord::getStartTime)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 当前类型的VIP 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PeriodEnum period = addVipCardRecord.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (PeriodEnum.PERPETUAL.equals(period)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            deductedSVipPerpetual(addVipCardRecord, vipCardRecordList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<VipCardRecord> collect = vipCardRecordList.stream().filter(n -> n.getVipType().equals(addVipCardRecord.getVipType())).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (collect.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("剩余扣减数量不足"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -511,7 +540,6 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LocalDate maxEndTime = collect.stream().map(VipCardRecord::getEndTime).max(Comparator.naturalOrder()).get().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        PeriodEnum period = addVipCardRecord.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 扣减后的开始时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LocalDate deductedStartTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         switch (period) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -532,7 +560,7 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case PERPETUAL: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 永久扣减 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                deductedPerpetual(addVipCardRecord, vipCardRecordList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                deductedSVipPerpetual(addVipCardRecord, vipCardRecordList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new BizException("不支持的扣减类型"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -542,7 +570,7 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date minStartTime = collect.stream().map(VipCardRecord::getStartTime).min(Comparator.naturalOrder()).get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 如果扣减的数量超过1天,则提示扣减数量不足 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (deductedStartDate.before(minStartTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            double day = (minStartTime.getTime() - deductedStartDate.getTime()) * 1.0D / (24 * 60 * 60); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            double day = (minStartTime.getTime() - deductedStartDate.getTime()) * 1.0D / (24 * 60 * 60 * 1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (day > 1.0D) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new BizException("剩余扣减数量不足"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -600,37 +628,48 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.save(vipCardRecord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 扣减永久会员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private void deductedPerpetual(VipCardRecordWrapper.AddVipCardRecord addVipCardRecord, List<VipCardRecord> vipCardRecordList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 扣减永久SVIP会员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void deductedSVipPerpetual(VipCardRecordWrapper.AddVipCardRecord addVipCardRecord, List<VipCardRecord> vipCardRecordList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<VipCardRecord> collect = vipCardRecordList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .filter(n -> n.getVipType().equals(addVipCardRecord.getVipType()) && n.getType().equals(PeriodEnum.PERPETUAL)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (collect.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("剩余扣减数量不足"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        EVipType vipType = addVipCardRecord.getVipType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 最后一个非永久SVIP的结束时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date lastUnPereutalDate = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long deductMills = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Date now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (VipCardRecord vipCardRecord : vipCardRecordList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Date startTime = vipCardRecord.getStartTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Date endTime = vipCardRecord.getEndTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (EVipType.SVIP.equals(vipCardRecord.getVipType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 获取后续VIP向前平移的开始时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!PeriodEnum.PERPETUAL.equals(vipCardRecord.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (vipCardRecord.getEndTime().after(lastUnPereutalDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        lastUnPereutalDate = vipCardRecord.getEndTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                vipCardRecord.setEfficientFlag(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                updateById(vipCardRecord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                deductMills += vipCardRecord.getStartTime().getTime() - lastUnPereutalDate.getTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                VipCardRecord newRecord = JSON.parseObject(JSON.toJSONString(vipCardRecord), VipCardRecord.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newRecord.setId(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newRecord.setDisplayFlag(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newRecord.setEfficientFlag(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newRecord.setStartTime(new Date(newRecord.getStartTime().getTime() - deductMills)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newRecord.setEndTime(new Date(newRecord.getEndTime().getTime() - deductMills)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                save(newRecord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Long refId = newRecord.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (vipCardRecord.getVipType().equals(vipType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                deductMills += endTime.getTime() - Math.max(startTime.getTime(), now.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 VipCardRecord updateRecord = JSON.parseObject(JSON.toJSONString(vipCardRecord), VipCardRecord.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 updateRecord.setEfficientFlag(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                updateRecord.setRefId(refId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 updateById(updateRecord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } else if (deductMills > 0L) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    VipCardRecord newRecord = JSON.parseObject(JSON.toJSONString(vipCardRecord), VipCardRecord.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    newRecord.setId(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    newRecord.setDisplayFlag(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    newRecord.setEfficientFlag(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    newRecord.setStartTime(new Date(newRecord.getStartTime().getTime() - deductMills)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    newRecord.setEndTime(new Date(newRecord.getEndTime().getTime() - deductMills)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    save(newRecord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Long refId = newRecord.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    VipCardRecord updateRecord = JSON.parseObject(JSON.toJSONString(vipCardRecord), VipCardRecord.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    updateRecord.setEfficientFlag(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    updateRecord.setRefId(refId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    updateById(updateRecord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         VipCardRecord vipCardRecord = JSON.parseObject(JSON.toJSONString(addVipCardRecord), VipCardRecord.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         vipCardRecord.setDisplayFlag(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         vipCardRecord.setEfficientFlag(false); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -665,7 +704,9 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 end = localDateTimeMaxTime.plusYears(times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case PERPETUAL: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 永久默认给100年 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                end = localDateTimeMaxTime.plusYears(100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new BizException("不支持的扣减类型"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 |