Jelajahi Sumber

续费车票使用续费价格

zoujiajian 9 bulan lalu
induk
melakukan
50e833cc3e

+ 6 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDonSku.java

@@ -107,6 +107,12 @@ public class GoodsDonSku extends BaseEntity {
      */
     private BigDecimal price;
 
+    /**
+     * 续费价格
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal renewPrice;
+
     /**
      * 专属用户规格
      */

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuInsert.java

@@ -68,6 +68,8 @@ public class ReqGoodsSkuInsert {
 
         private BigDecimal price;
 
+        private BigDecimal renewPrice;
+
         /**
          * 专属用户规格
          */

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/request/OrderPayRequest.java

@@ -219,6 +219,11 @@ public class OrderPayRequest {
      */
     private RenewSource renewSource;
 
+    /**
+     * 是否使用续费价格
+     */
+    private Boolean isRenewPrice = false;
+
     @Getter
     public enum RenewSource{
         galaxyCoin("银河币"),

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSkuFrontView.java

@@ -91,6 +91,11 @@ public class GoodsDonSkuFrontView {
 	 */
 	private BigDecimal price = BigDecimal.ZERO;
 
+	/**
+	 * 续费价格
+	 */
+	private BigDecimal renewPrice;
+
 	/**
 	 * 渠道优惠折扣
 	 */

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSkuRenewView.java

@@ -31,6 +31,9 @@ public class GoodsDonSkuRenewView {
 	@DbField("sku.price")
 	private BigDecimal price;
 
+	@DbField("sku.renew_price")
+	private BigDecimal renewPrice;
+
 	@DbField("g.id")
 	private Long goodsId;
 

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSkuView.java

@@ -53,6 +53,9 @@ public class GoodsDonSkuView {
 	@DbField("gdk.price")
 	private BigDecimal money;
 
+	@DbField("gdk.renew_price")
+	private BigDecimal renewPrice;
+
 	@DbField("gd.status")
 	private Boolean goodsDonStatus;
 

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/views/RenewalView.java

@@ -59,6 +59,9 @@ public class RenewalView {
     @DbField("sku.price")
     private BigDecimal price;
 
+    @DbField("sku.renew_price")
+    private BigDecimal renewPrice;
+
     @DbField("sku.spec_val")
     private String specVal;
 

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/claude/impl/ClaudeCodeServiceImpl.java

@@ -1206,10 +1206,12 @@ public class ClaudeCodeServiceImpl implements ClaudeCodeService {
 	 * 获取车票可抵扣金额
 	 */
 	public BigDecimal getDeductMoneyFromTicket(Long relationId, List<Long> userIdList, Long skuId, DateTime now, Date relationStartTime, Date relationExpiryTime) {
+		OrderDon oriOrderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getRelationId, relationId).in(OrderDon::getUserId, userIdList).notIn(OrderDon::getStatus, Constant.noOrderAllStatus).eq(OrderDon::getOrderType, 1).orderByDesc(OrderDon::getId).last("limit 1"));
 		List<OrderDon> orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class)
 				.eq(OrderDon::getRelationId, relationId)
 				.in(OrderDon::getUserId, userIdList)
 				.eq(OrderDon::getSkuId, skuId)
+				.ge(oriOrderDon != null, OrderDon::getCreatedTime, oriOrderDon.getCreatedTime())
 				.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
 				.orderByDesc(OrderDon::getId));
 		//部分退款

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/codex/impl/CodexServiceImpl.java

@@ -861,10 +861,12 @@ public class CodexServiceImpl implements CodexService {
 	 * 获取车票可抵扣金额
 	 */
 	public BigDecimal getDeductMoneyFromTicket(Long relationId, List<Long> userIdList, Long skuId, DateTime now, Date relationStartTime, Date relationExpiryTime) {
+		OrderDon oriOrderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getRelationId, relationId).in(OrderDon::getUserId, userIdList).notIn(OrderDon::getStatus, Constant.noOrderAllStatus).eq(OrderDon::getOrderType, 1).orderByDesc(OrderDon::getId).last("limit 1"));
 		List<OrderDon> orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class)
 				.eq(OrderDon::getRelationId, relationId)
 				.in(OrderDon::getUserId, userIdList)
 				.eq(OrderDon::getSkuId, skuId)
+				.ge(oriOrderDon != null, OrderDon::getCreatedTime, oriOrderDon.getCreatedTime())
 				.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
 				.orderByDesc(OrderDon::getId));
 		//部分退款

+ 3 - 2
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderCommonServiceImpl.java

@@ -62,7 +62,7 @@ public class OrderCommonServiceImpl implements OrderCommonService {
 					.in(GroupsRelation::getUserId, userIdList)
 					.eq(GroupsRelation::getId, relationId)
 					.in(GroupsRelation::getStatus, List.of(GroupsRelation.Status.validity, GroupsRelation.Status.outside)));
-			Date oriExpiryTime = relation.getExpiryTime();
+			Date oriExpiryTime = null;
 			//车票变更之后
 			if (relation == null || orderDon.getIsChangeTicket()) {
 				UserRenewChangeTicketRecord record = userRenewChangeTicketRecordMapper.selectOne(Wrappers.lambdaQuery(UserRenewChangeTicketRecord.class)
@@ -75,6 +75,7 @@ public class OrderCommonServiceImpl implements OrderCommonService {
 				}
 			}
 			if (relation != null) {
+				oriExpiryTime = relation.getExpiryTime();
 				Boolean isFlag = true;
 				Date expiryTime = relation.getExpiryTime();
 				OrderDon otherOrder = null;
@@ -124,7 +125,7 @@ public class OrderCommonServiceImpl implements OrderCommonService {
 					}
 				}
 				//普通订单 退款直接清除订单
-				if (orderDon.getOrderType() == 1) {
+				if (orderDon.getOrderType() == 1 && relationIds.size() == 1) {
 					isFlag = true;
 				}
 				if (isFlag) {

+ 165 - 152
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -694,7 +694,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		}
 		if (sku != null) {
 			//扣除使用优惠券、余额的订单金额
-			deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon, payRequest.getGcCash(), payRequest.getGcpIds(), payRequest.getIsAcReduce(), subsidyId, sku, payRequest.getGalaxyCoin());
+			deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon, payRequest.getGcCash(), payRequest.getGcpIds(), payRequest.getIsAcReduce(), subsidyId, sku, payRequest.getGalaxyCoin(), null);
 		}
 
 		if (isSpecificPrice && (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0 || orderDon.getMoney().compareTo(specificPrice) != 0)) {
@@ -1323,7 +1323,17 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		orderDon.setOrderNo(donNo);
 		orderDon.setOpenId(payOpenId);
 		orderDon.setYhsId(yhsId);
-		orderDon.setMoney(sku.getPrice().multiply(BigDecimal.valueOf(payRequest.getNum())));
+		BigDecimal skuPrice = sku.getPrice();
+		BigDecimal renewPrice = null;
+		//使用续费价格
+		if (payRequest.getIsRenewPrice()) {
+			renewPrice = sku.getRenewPrice();
+			//续费价格存在 续费时直接使用
+			if (renewPrice != null && renewPrice.compareTo(BigDecimal.ZERO) > 0) {
+				skuPrice = renewPrice;
+			}
+		}
+		orderDon.setMoney(skuPrice.multiply(BigDecimal.valueOf(payRequest.getNum())));
 		orderDon.setSkuId(renewSkuId);
 		orderDon.setRelationId(relation.getId());
 		//续费订单
@@ -1360,7 +1370,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			orderDon.setMoney(sku.getPrice().multiply(discount));
 		}
 		//扣除使用优惠券、余额的订单金额
-		deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon, payRequest.getGcCash(), payRequest.getGcpIds(), false, null, sku, payRequest.getGalaxyCoin());
+		deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon, payRequest.getGcCash(), payRequest.getGcpIds(), false, null, sku, payRequest.getGalaxyCoin(), renewPrice);
 		this.saveOrUpdate(orderDon);
 
 		Long orderId = orderDon.getId();
@@ -2690,168 +2700,170 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 	/**
 	 * 使用优惠营销 订单金额抵扣
 	 */
-	public void deductOrderMoney(OrderDon orderDon, CouponUser couponUser, BigDecimal balance, User user, BigDecimal skuMoney, GoodsDon goodsDon, BigDecimal gcCash, List<Long> gcpIds, Boolean isAcReduce, Long subsidyId, GoodsDonSku sku, BigDecimal galaxyCoin) throws Exception {
-		Integer goodsType = goodsDon.getType();
-		if (gcCash != null && gcCash.compareTo(BigDecimal.ZERO) > 0 && couponUser != null && (balance != null && balance.compareTo(BigDecimal.ZERO) > 0)) {
-			throw BusinessRuntimeException.getInstance("现金卡不能与其他优惠叠加使用");
-		}
-		BigDecimal first_money = orderDon.getMoney();
-		//礼品卡现金支付 不参与其他优惠
-		if (subsidyId == null && gcCash != null && gcCash.compareTo(BigDecimal.ZERO) > 0) {
-			List<Long> userIdList = userBindRelationService.getRelationUserIdList(user.getId(), user);
-			if (CollUtil.isEmpty(gcpIds)) {
-				throw BusinessRuntimeException.getInstance("礼品卡现金支付参数异常");
-			}
-			BigDecimal money = orderDon.getMoney();
-			if (gcCash.compareTo(money) > 0) {
-				gcCash = money;
-			}
-			List<GiftCardUserRecord> availableGiftCards = giftCardUserRecordService.list(Wrappers.lambdaQuery(GiftCardUserRecord.class)
-					.in(GiftCardUserRecord::getToUserId, userIdList)
-					.in(GiftCardUserRecord::getId, gcpIds)
-					.eq(GiftCardUserRecord::getIsPay, true)
-					.eq(GiftCardUserRecord::getGcType, 1)
-					.gt(GiftCardUserRecord::getRemainCash, 0));
-			if (availableGiftCards.size() != gcpIds.size()) {
-				throw BusinessRuntimeException.getInstance("礼品卡使用异常,请刷新页面重试");
-			}
-			//需要扣除的礼品卡现金
-			BigDecimal deductCash = gcCash;
-			List<GiftCardOrderUseRecord> gcUseRecords = new ArrayList<>();
-			for (GiftCardUserRecord giftCard : availableGiftCards) {
-				if (deductCash.compareTo(BigDecimal.ZERO) <= 0) {
-					break;
-				}
-				BigDecimal remainCash = giftCard.getRemainCash();
-				//扣完
-				if (remainCash.compareTo(deductCash) == 0) {
-					deductGiftCardCash(user.getId(), giftCard.getId(), deductCash, remainCash, gcUseRecords, true);
-					deductCash = BigDecimal.ZERO;
-				} else if (remainCash.compareTo(deductCash) < 0) {
-					deductGiftCardCash(user.getId(), giftCard.getId(), remainCash, remainCash, gcUseRecords, true);
-					deductCash = deductCash.subtract(remainCash);
-				} else if (remainCash.compareTo(deductCash) > 0) {
-					deductGiftCardCash(user.getId(), giftCard.getId(), deductCash, remainCash, gcUseRecords, false);
-					deductCash = BigDecimal.ZERO;
-				}
-			}
-			orderDon.setMoney(orderDon.getMoney().subtract(gcCash));
-			orderDon.setGcCash(gcCash);
-			if (!gcUseRecords.isEmpty()) {
-				orderDon.setGcUseRecords(gcUseRecords);
-			}
-			return;
-		}
-		//针对设备 满减活动优惠 不支持使用优惠券等优惠
-		if (isAcReduce != null && isAcReduce && orderDon.getGoodsId() == 15) {
-			epOrderDonActivityReduce(orderDon);
-			//存在余额
-			deductBalancePayOrderMoney(orderDon, balance, user);
-			return;
-		}
-		//存在优惠券
-		if (couponUser != null && subsidyId == null) {
-			Long couponId = couponUser.getCouponId();
-			Coupon coupon = couponMapper.getCouponById(couponId);
-			BigDecimal couponMoney = null;
-			BigDecimal payMoney = orderDon.getMoney();
-			BigDecimal needDeductMoney = payMoney;
-			if (orderDon.getOriMoney() == null) {
-				orderDon.setOriMoney(payMoney);
-			}
-			if (orderDon.getIsDp() != null && orderDon.getIsDp()) {
-				needDeductMoney = needDeductMoney.subtract(orderDon.getDpMoney());
-			}
-			if (coupon.getType() == Coupon.Type.discount) {
-				couponMoney = needDeductMoney.multiply(BigDecimal.valueOf(1).subtract(coupon.getDiscount()));
-				//需支付金额
-				orderDon.setMoney(payMoney.subtract(couponMoney));
-
-				orderDon.setOriMoney(orderDon.getOriMoney().multiply(coupon.getDiscount()));
-				//记录折扣 用于分销
-				couponUser.setDiscount(coupon.getDiscount());
-				couponUserMapper.updateById(couponUser);
-			} else if (coupon.getType() == Coupon.Type.reduce) {
-				if (goodsType == 2) {
-					if (skuMoney.compareTo(coupon.getReduceCondition()) < 0) {
-						throw BusinessRuntimeException.getInstance(String.format("满%s可用", coupon.getReduceCondition().divide(BigDecimal.valueOf(100))));
+	public void deductOrderMoney(OrderDon orderDon, CouponUser couponUser, BigDecimal balance, User user, BigDecimal skuMoney, GoodsDon goodsDon, BigDecimal gcCash, List<Long> gcpIds, Boolean isAcReduce, Long subsidyId, GoodsDonSku sku, BigDecimal galaxyCoin, BigDecimal renewPrice) throws Exception {
+		//续费规格价格 不允许其他优惠
+		if (renewPrice == null || renewPrice.compareTo(BigDecimal.ZERO) <= 0) {
+			Integer goodsType = goodsDon.getType();
+			if (gcCash != null && gcCash.compareTo(BigDecimal.ZERO) > 0 && couponUser != null && (balance != null && balance.compareTo(BigDecimal.ZERO) > 0)) {
+				throw BusinessRuntimeException.getInstance("现金卡不能与其他优惠叠加使用");
+			}
+			BigDecimal first_money = orderDon.getMoney();
+			//礼品卡现金支付 不参与其他优惠
+			if (subsidyId == null && gcCash != null && gcCash.compareTo(BigDecimal.ZERO) > 0) {
+				List<Long> userIdList = userBindRelationService.getRelationUserIdList(user.getId(), user);
+				if (CollUtil.isEmpty(gcpIds)) {
+					throw BusinessRuntimeException.getInstance("礼品卡现金支付参数异常");
+				}
+				BigDecimal money = orderDon.getMoney();
+				if (gcCash.compareTo(money) > 0) {
+					gcCash = money;
+				}
+				List<GiftCardUserRecord> availableGiftCards = giftCardUserRecordService.list(Wrappers.lambdaQuery(GiftCardUserRecord.class)
+						.in(GiftCardUserRecord::getToUserId, userIdList)
+						.in(GiftCardUserRecord::getId, gcpIds)
+						.eq(GiftCardUserRecord::getIsPay, true)
+						.eq(GiftCardUserRecord::getGcType, 1)
+						.gt(GiftCardUserRecord::getRemainCash, 0));
+				if (availableGiftCards.size() != gcpIds.size()) {
+					throw BusinessRuntimeException.getInstance("礼品卡使用异常,请刷新页面重试");
+				}
+				//需要扣除的礼品卡现金
+				BigDecimal deductCash = gcCash;
+				List<GiftCardOrderUseRecord> gcUseRecords = new ArrayList<>();
+				for (GiftCardUserRecord giftCard : availableGiftCards) {
+					if (deductCash.compareTo(BigDecimal.ZERO) <= 0) {
+						break;
+					}
+					BigDecimal remainCash = giftCard.getRemainCash();
+					//扣完
+					if (remainCash.compareTo(deductCash) == 0) {
+						deductGiftCardCash(user.getId(), giftCard.getId(), deductCash, remainCash, gcUseRecords, true);
+						deductCash = BigDecimal.ZERO;
+					} else if (remainCash.compareTo(deductCash) < 0) {
+						deductGiftCardCash(user.getId(), giftCard.getId(), remainCash, remainCash, gcUseRecords, true);
+						deductCash = deductCash.subtract(remainCash);
+					} else if (remainCash.compareTo(deductCash) > 0) {
+						deductGiftCardCash(user.getId(), giftCard.getId(), deductCash, remainCash, gcUseRecords, false);
+						deductCash = BigDecimal.ZERO;
 					}
 				}
-				BigDecimal subtractMoney = payMoney.subtract(coupon.getReduceMoney());
-				orderDon.setMoney(subtractMoney);
-				couponMoney = coupon.getReduceMoney();
-
-				orderDon.setOriMoney(orderDon.getOriMoney().subtract(coupon.getReduceMoney()));
+				orderDon.setMoney(orderDon.getMoney().subtract(gcCash));
+				orderDon.setGcCash(gcCash);
+				if (!gcUseRecords.isEmpty()) {
+					orderDon.setGcUseRecords(gcUseRecords);
+				}
+				return;
 			}
-			if (couponMoney != null && couponMoney.compareTo(first_money) >= 0) {
-				throw BusinessRuntimeException.getInstance("支付金额不能小于优惠金额");
+			//针对设备 满减活动优惠 不支持使用优惠券等优惠
+			if (isAcReduce != null && isAcReduce && orderDon.getGoodsId() == 15) {
+				epOrderDonActivityReduce(orderDon);
+				//存在余额
+				deductBalancePayOrderMoney(orderDon, balance, user);
+				return;
 			}
-			orderDon.setCouponMoney(couponMoney);
-			orderDon.setCouponUserId(couponUser.getId());
-			orderDon.setCouponId(couponUser.getCouponId());
-		}
-		//特殊渠道推广优惠. 360
-		if (subsidyId == null && orderDon.getPopularizeId() != null && orderDon.getPopularizeId() != 0L) {
-			String name = channelPopularizeMapper.selectChannelByPid(orderDon.getPopularizeId());
-			if (StrUtil.isNotBlank(name)) {
-				//使用了优惠券 不再使用360渠道 折扣
-				if (couponUser == null && goodsType == 1) {
-					if (name.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(0)) || name.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(1))) {
-						String key;
-						if (name.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(0))) {
-							//百度渠道 专门优惠链接
-							key = Constant.CHANNEL_BAIDU_DISCOUNT_KEY;
-						} else {
-							//抖音
-							key = Constant.CHANNEL_DY_DISCOUNT_KEY;
+			//存在优惠券
+			if (couponUser != null && subsidyId == null) {
+				Long couponId = couponUser.getCouponId();
+				Coupon coupon = couponMapper.getCouponById(couponId);
+				BigDecimal couponMoney = null;
+				BigDecimal payMoney = orderDon.getMoney();
+				BigDecimal needDeductMoney = payMoney;
+				if (orderDon.getOriMoney() == null) {
+					orderDon.setOriMoney(payMoney);
+				}
+				if (orderDon.getIsDp() != null && orderDon.getIsDp()) {
+					needDeductMoney = needDeductMoney.subtract(orderDon.getDpMoney());
+				}
+				if (coupon.getType() == Coupon.Type.discount) {
+					couponMoney = needDeductMoney.multiply(BigDecimal.valueOf(1).subtract(coupon.getDiscount()));
+					//需支付金额
+					orderDon.setMoney(payMoney.subtract(couponMoney));
+
+					orderDon.setOriMoney(orderDon.getOriMoney().multiply(coupon.getDiscount()));
+					//记录折扣 用于分销
+					couponUser.setDiscount(coupon.getDiscount());
+					couponUserMapper.updateById(couponUser);
+				} else if (coupon.getType() == Coupon.Type.reduce) {
+					if (goodsType == 2) {
+						if (skuMoney.compareTo(coupon.getReduceCondition()) < 0) {
+							throw BusinessRuntimeException.getInstance(String.format("满%s可用", coupon.getReduceCondition().divide(BigDecimal.valueOf(100))));
 						}
-						SysConfig channelNoSignConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-								.eq(SysConfig::getSysKey, key).last("limit 1"));
-						if (channelNoSignConfig != null) {
-							String sysValue = channelNoSignConfig.getSysValue();
-							if (StrUtil.isNotBlank(sysValue)) {
-								try {
-									ChannelBaiDuDiscountDto baiDuDiscountDto = Jsons.parseObject(sysValue, ChannelBaiDuDiscountDto.class);
-									List<Long> baiduPopularizeIds = baiDuDiscountDto.getPopularizeIds();
-									BigDecimal discount = baiDuDiscountDto.getDiscount();
-									if (CollUtil.isNotEmpty(baiduPopularizeIds) && discount != null && discount.compareTo(BigDecimal.ZERO) > 0) {
-										if (baiduPopularizeIds.contains(orderDon.getPopularizeId())) {
-											BigDecimal discountMoney = orderDon.getMoney().multiply(discount);
-											orderDon.setMoney(discountMoney);
+					}
+					BigDecimal subtractMoney = payMoney.subtract(coupon.getReduceMoney());
+					orderDon.setMoney(subtractMoney);
+					couponMoney = coupon.getReduceMoney();
+
+					orderDon.setOriMoney(orderDon.getOriMoney().subtract(coupon.getReduceMoney()));
+				}
+				if (couponMoney != null && couponMoney.compareTo(first_money) >= 0) {
+					throw BusinessRuntimeException.getInstance("支付金额不能小于优惠金额");
+				}
+				orderDon.setCouponMoney(couponMoney);
+				orderDon.setCouponUserId(couponUser.getId());
+				orderDon.setCouponId(couponUser.getCouponId());
+			}
+			//特殊渠道推广优惠. 360
+			if (subsidyId == null && orderDon.getPopularizeId() != null && orderDon.getPopularizeId() != 0L) {
+				String name = channelPopularizeMapper.selectChannelByPid(orderDon.getPopularizeId());
+				if (StrUtil.isNotBlank(name)) {
+					//使用了优惠券 不再使用360渠道 折扣
+					if (couponUser == null && goodsType == 1) {
+						if (name.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(0)) || name.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(1))) {
+							String key;
+							if (name.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(0))) {
+								//百度渠道 专门优惠链接
+								key = Constant.CHANNEL_BAIDU_DISCOUNT_KEY;
+							} else {
+								//抖音
+								key = Constant.CHANNEL_DY_DISCOUNT_KEY;
+							}
+							SysConfig channelNoSignConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+									.eq(SysConfig::getSysKey, key).last("limit 1"));
+							if (channelNoSignConfig != null) {
+								String sysValue = channelNoSignConfig.getSysValue();
+								if (StrUtil.isNotBlank(sysValue)) {
+									try {
+										ChannelBaiDuDiscountDto baiDuDiscountDto = Jsons.parseObject(sysValue, ChannelBaiDuDiscountDto.class);
+										List<Long> baiduPopularizeIds = baiDuDiscountDto.getPopularizeIds();
+										BigDecimal discount = baiDuDiscountDto.getDiscount();
+										if (CollUtil.isNotEmpty(baiduPopularizeIds) && discount != null && discount.compareTo(BigDecimal.ZERO) > 0) {
+											if (baiduPopularizeIds.contains(orderDon.getPopularizeId())) {
+												BigDecimal discountMoney = orderDon.getMoney().multiply(discount);
+												orderDon.setMoney(discountMoney);
+											}
 										}
+									} catch (Exception e) {
 									}
-								} catch (Exception e) {
 								}
 							}
-						}
-					} else {
-						SysConfig discountPopularizeConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-								.eq(SysConfig::getSysKey, Constant.DISCOUNT_POPULARIZE_KEY).last("limit 1"));
-						if (discountPopularizeConfig != null) {
-							String sysValue = discountPopularizeConfig.getSysValue();
-							if (StrUtil.isNotBlank(sysValue)) {
-								if (user == null) {
-									throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
-								}
-								DiscountPopularizeDto discountPopularizeDto = Jsons.parseObject(sysValue, DiscountPopularizeDto.class);
-								List<Long> popularizeIds = discountPopularizeDto.getPopularizeIds();
-								if (CollUtil.isNotEmpty(popularizeIds) && popularizeIds.contains(orderDon.getPopularizeId())) {
-									List<Long> userIdList = userBindRelationService.getRelationUserIdList(user.getId(), user);
-									Integer count = orderDonUserDiscountPopularizeRecordMapper.selectUserPopularzieDiscountRecordByUidAndPid(userIdList, orderDon.getPopularizeId());
-									if (count == 0) {
-										log.info("用户:{}首次使用折扣特殊链接:{} 折扣:{},修改支付金额", user.getId(), orderDon.getPopularizeId(), discountPopularizeDto.getDiscount());
-										BigDecimal discountMoney = orderDon.getMoney().multiply(discountPopularizeDto.getDiscount());
-										orderDon.setMoney(discountMoney);
-
-										//记录用户使用折扣链接
-										orderDon.setDiscountPopularizeRecord(createPopularizeDiscountRecord(orderDon, discountPopularizeDto.getDiscount()));
+						} else {
+							SysConfig discountPopularizeConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+									.eq(SysConfig::getSysKey, Constant.DISCOUNT_POPULARIZE_KEY).last("limit 1"));
+							if (discountPopularizeConfig != null) {
+								String sysValue = discountPopularizeConfig.getSysValue();
+								if (StrUtil.isNotBlank(sysValue)) {
+									if (user == null) {
+										throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
+									}
+									DiscountPopularizeDto discountPopularizeDto = Jsons.parseObject(sysValue, DiscountPopularizeDto.class);
+									List<Long> popularizeIds = discountPopularizeDto.getPopularizeIds();
+									if (CollUtil.isNotEmpty(popularizeIds) && popularizeIds.contains(orderDon.getPopularizeId())) {
+										List<Long> userIdList = userBindRelationService.getRelationUserIdList(user.getId(), user);
+										Integer count = orderDonUserDiscountPopularizeRecordMapper.selectUserPopularzieDiscountRecordByUidAndPid(userIdList, orderDon.getPopularizeId());
+										if (count == 0) {
+											log.info("用户:{}首次使用折扣特殊链接:{} 折扣:{},修改支付金额", user.getId(), orderDon.getPopularizeId(), discountPopularizeDto.getDiscount());
+											BigDecimal discountMoney = orderDon.getMoney().multiply(discountPopularizeDto.getDiscount());
+											orderDon.setMoney(discountMoney);
+
+											//记录用户使用折扣链接
+											orderDon.setDiscountPopularizeRecord(createPopularizeDiscountRecord(orderDon, discountPopularizeDto.getDiscount()));
+										}
 									}
 								}
 							}
 						}
-					}
-				} else {
-					//360
+					} else {
+						//360
 //					if (Constant.CHANNEL_NAME_360.equals(name)) {
 //						SysConfig sysConfig = sysConfigService.getBaseMapper().selectOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, Constant.CHANNEL_360_DISCOUNT));
 //						if (sysConfig != null) {
@@ -2859,6 +2871,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 //							orderDon.setMoney(discountMoney);
 //						}
 //					}
+					}
 				}
 			}
 		}

+ 28 - 1
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -230,6 +230,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 
 	private final ClaudeUserMapper claudeUserMapper;
 
+	private final UserRenewChangeTicketRecordMapper userRenewChangeTicketRecordMapper;
+
 	@Override
 	public SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId, String account, String orderNo, Integer cmt) {
 		User u = userMapper.selectById(userId);
@@ -374,6 +376,31 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 						.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
 						.orderByDesc(OrderDon::getId)
 						.last("limit 1"));
+				Long zhSkuId = ticket.getSkuId();
+				if (orderDon == null) {
+					if (ticket.getGoodsId() == Constant.NETFLIX_GID) {
+						//续费更换过车票
+						UserRenewChangeTicketRecord record = userRenewChangeTicketRecordMapper.selectOne(Wrappers.lambdaQuery(UserRenewChangeTicketRecord.class)
+								.in(UserRenewChangeTicketRecord::getUserId, userIds)
+								.eq(UserRenewChangeTicketRecord::getAfterRelationId, ticket.getRelationId())
+								.orderByDesc(UserRenewChangeTicketRecord::getId).last("limit 1"));
+						if (record != null) {
+							Long preRelationId = record.getPreRelationId();
+							orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
+									.eq(OrderDon::getRelationId, preRelationId)
+									.in(OrderDon::getUserId, userIds)
+									.eq(OrderDon::getOrderType, 1)
+									.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
+									.orderByDesc(OrderDon::getId)
+									.last("limit 1"));
+							if (orderDon != null) {
+								zhSkuId = orderDon.getSkuId();
+								GoodsDonSku sku = goodsDonSkuMapper.selectById(zhSkuId);
+								ticket.setSpecVal(sku.getSpecVal());
+							}
+						}
+					}
+				}
 				if (orderDon != null) {
 					ticket.setOrderNo(orderDon.getOrderNo());
 					ticket.setOrderId(orderDon.getId());
@@ -385,7 +412,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 					}
 				}
 				if (lang != null && !StrUtil.equals(UserPageLanguage.Language.zh_CN.name(), lang)) {
-					String languageSpecVal = backInfoTranslationsFrontService.getLanguageSpecVal(ticket.getSkuId(), lang);
+					String languageSpecVal = backInfoTranslationsFrontService.getLanguageSpecVal(zhSkuId, lang);
 					if (StrUtil.isNotBlank(languageSpecVal)) {
 						ticket.setSpecVal(languageSpecVal);
 					}

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/vip/impl/VipFrontServiceImpl.java

@@ -358,10 +358,12 @@ public class VipFrontServiceImpl implements VipFrontService {
 	 * 获取车票可抵扣金额
 	 */
 	public BigDecimal getDeductMoneyFromTicket(Long relationId, List<Long> userIdList, Long skuId, DateTime now, Date relationStartTime, Date relationExpiryTime) {
+		OrderDon oriOrderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getRelationId, relationId).in(OrderDon::getUserId, userIdList).notIn(OrderDon::getStatus, Constant.noOrderAllStatus).eq(OrderDon::getOrderType, 1).orderByDesc(OrderDon::getId).last("limit 1"));
 		List<OrderDon> orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class)
 				.eq(OrderDon::getRelationId, relationId)
 				.in(OrderDon::getUserId, userIdList)
 				.eq(OrderDon::getSkuId, skuId)
+				.ge(oriOrderDon != null, OrderDon::getCreatedTime, oriOrderDon.getCreatedTime())
 				.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
 				.orderByDesc(OrderDon::getId));
 		//部分退款