Ver Fonte

fix codex抵扣金额

zoujiajian há 1 mês atrás
pai
commit
a4d2e79bbc

+ 3 - 4
netflix-service/src/main/java/com/cyksj/service/codex/impl/CodexServiceImpl.java

@@ -418,11 +418,10 @@ public class CodexServiceImpl implements CodexService {
 					relationExpiryTime = DateUtil.offsetMonth(relationExpiryTime, -presentSku.getMonths());
 				}
 			} else {
-				// 续费天数追加在车票尾部,不能按“下单时间 + 规格天数”从购买当天开始折旧。
-				// 总到期时间覆盖完整续费周期时,该笔续费应按完整价值抵扣;只有进入该周期后才按剩余天数折算。
 				long skuDays = presentSku.getDays() != null ? presentSku.getDays() : presentSku.getMonths() * 30L;
-				long relationRemainDays = DateUtil.betweenDay(now, relationExpiryTime, false) + 1;
-				long renewRemainDays = Math.min(skuDays, relationRemainDays);
+				// renewSkuId 存在即为续费升级:升级套餐立即优先使用,原套餐剩余时间暂停。
+				// 只按续费升级自身的 renewExpiryTime 计算剩余价值。
+				long renewRemainDays = Math.max(0L, Math.min(skuDays, DateUtil.betweenDay(now, renewExpiryTime, false)));
 				//此次续费规格单价
 				BigDecimal single = getPayOrderSingle(orderMoney, presentSku);
 				//该车票抵扣金额