Pārlūkot izejas kodu

fix 当天过期mj镜像车票 直接加次数

zwhui 2 gadi atpakaļ
vecāks
revīzija
4e5a3922c7

+ 23 - 0
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -2429,6 +2429,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		if (orderDon.getIsNoLogin()) {
 			orderDon.setStatus(OrderDon.Status.hasPayment);
 		}
+		GroupsRelation groupsRelation = groupsRelationMapper.selectById(orderDon.getRelationId());
+		boolean mjRenew = DateUtil.isSameDay(new Date(), groupsRelation.getExpiryTime());
+
 		Long goodsId = goodsDon.getId();
 		if (!orderDon.getIsNoLogin() && sku != null) {
 			//更新座位信息
@@ -2442,6 +2445,11 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		}
 		this.updateById(orderDon);
 
+		//mj续费订单当天过期直接加次数
+		if (mjRenew) {
+			mjRenewOrder(orderDon);
+		}
+
 		//调整指定规格车队下次可 停用车位数的时间
 		groupRelationFrontService.adjustGroupsParkingTime(orderDon.getRelationId(), sku);
 
@@ -2556,6 +2564,21 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			}
 		}
 	}
+	private void mjRenewOrder(OrderDon orderDon){
+		if (orderDon.getOrderType() == 2 && orderDon.getGoodsId() == 26) {
+			GoodsDonSku goodsDonSku = goodsDonSkuMapper.selectById(orderDon.getSkuId());
+			if (goodsDonSku.getIsMirror()){
+					midjourneyUserMapper.update(null, Wrappers.lambdaUpdate(MidjourneyUser.class)
+							.set(MidjourneyUser::getMjFastNum, goodsDonSku.getMjFastNum())
+							.set(MidjourneyUser::getMjRelaxNum, goodsDonSku.getMjRelaxNum())
+							.eq(MidjourneyUser::getRelationId, orderDon.getRelationId()));
+					MidjourneyUser midjourneyUser = midjourneyUserMapper.selectOne(Wrappers.lambdaQuery(MidjourneyUser.class).eq(MidjourneyUser::getRelationId, orderDon.getRelationId()));
+					log.info("恢复midjourney镜像使用次数: {}", midjourneyUser.getId());
+					redisService.del(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + midjourneyUser.getId());
+					redisService.del(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + midjourneyUser.getId());
+			}
+		}
+	}
 
 	private void deductGiftCardCash(Long userId, Long gcId, BigDecimal deductCash, BigDecimal gcRemainCash, List<GiftCardOrderUseRecord> gcUseRecords, Boolean isUsed) {
 		Boolean is_update = giftCardUserRecordService.update(null, Wrappers.lambdaUpdate(GiftCardUserRecord.class)