zoujiajian vor 1 Jahr
Ursprung
Commit
1097c6bd68

+ 13 - 2
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -1239,7 +1239,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				.in(NetflixUserAccountStatusRecord::getUserId, userIdList)
 				.last("limit 1"));
 		if (netflixUseAccountStatusRecord == null) {
-			throw BusinessRuntimeException.getInstance("未有提交记录");
+			return null;
 		}
 		Integer state = netflixUseAccountStatusRecord.getState();
 		//2是登录失败 3是被封号
@@ -1460,6 +1460,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 			recoverRecord.setAccount(netflixRelationView.getAccount());
 			Long betweenDay = DateUtil.betweenDay(DateTime.now(), expiryTime, false) + 1;
 			recoverRecord.setRemainDays(betweenDay);
+			recoverRecord.setAccount(netflixRelationView.getTripsAccount());
 			try {
 				netflixUserAccountSubmitRecoverRecordMapper.insert(recoverRecord);
 			} catch (DuplicateKeyException e) {
@@ -1485,7 +1486,17 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		if (betweenDay <= 15) {
 			throw BusinessRuntimeException.getInstance("您的车票有效期未超过15天");
 		}
-		Long skuId = req.getSkuId();
+		List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
+		Integer count = netflixUserAccountSubmitRecoverRecordMapper.selectCount(Wrappers.lambdaQuery(NetflixUserAccountSubmitRecoverRecord.class)
+				.eq(NetflixUserAccountSubmitRecoverRecord::getRelationId, relationId)
+				.in(NetflixUserAccountSubmitRecoverRecord::getUserId, userIdList));
+		if (count > 0) {
+			throw BusinessRuntimeException.getInstance("您的车票申请恢复中...");
+		}
+		String key = RedisService.key.NETFLIX_CHANGE_TICKET_KEY.getName() + relationId;
+		if (!redisService.setNx(key, relationId, RedisService.key.NETFLIX_CHANGE_TICKET_KEY.getTimeout())) {
+			throw BusinessRuntimeException.getInstance("正在更换其他车票中..");
+		}		Long skuId = req.getSkuId();
 		SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
 				.eq(SysConfig::getSysKey, Constant.ERROR_NETFLIX_CHANGE_OTHER_SKU_KEY)
 				.last("limit 1"));