Kaynağa Gözat

fix 油管选择替换的规格

zoujiajian 8 ay önce
ebeveyn
işleme
43cdba4031

+ 19 - 16
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -2430,6 +2430,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		if (!redisService.setNx(key, relationId, RedisService.key.NETFLIX_CHANGE_TICKET_KEY.getTimeout())) {
 			throw BusinessRuntimeException.getInstance("正在更换其他车票中..");
 		}
+		Long chooseSkuId = req.getSkuId();
 		Date expiryTime = relationView.getExpiryTime();
 		SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
 				.eq(SysConfig::getSysKey, Constant.ERROR_YOUTUBE_CHANGE_OTHER_SKU_KEY)
@@ -2438,24 +2439,26 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		//替换车票
 		ErrorNetflixChangeOtherSkuTicketDto errorNetflixChangeOtherSkuTicketDto = errorNetflixChangeOtherSkuTicketDtos.get(0);
 		List<Long> skuIds = errorNetflixChangeOtherSkuTicketDto.getSkuIds();
+		if (!skuIds.contains(chooseSkuId)) {
+			throw BusinessRuntimeException.getInstance("选择要替换的规格错误");
+		}
 		try {
-			for (Long skuId : skuIds) {
-				TicketChangeDto changeDto = getTicketAndGenerateOrder(userId, skuId, null, null);
-				if (changeDto == null) {
-					throw BusinessRuntimeException.getInstance("系统繁忙,请重试");
-				}
-				//替换记录
-				NetflixUserChangeOtherTicketRecord changeOtherTicketRecord = new NetflixUserChangeOtherTicketRecord();
-				changeOtherTicketRecord.setUserId(userId);
-				changeOtherTicketRecord.setRelationId(relationId);
-				changeOtherTicketRecord.setOtherRelationId(changeDto.getOtherRelationId());
-				changeOtherTicketRecord.setRelateOrderId(changeDto.getOtherOrderId());
-				//该车票订单id
-				changeOtherTicketRecord.setOrderId(relationView.getNfOriOrderId());
-				changeOtherTicketRecord.setStartTime(relationView.getStartTime());
-				changeOtherTicketRecord.setExpiryTime(expiryTime);
-				netflixUserChangeOtherTicketRecordMapper.insert(changeOtherTicketRecord);
+			TicketChangeDto changeDto = getTicketAndGenerateOrder(userId, chooseSkuId, null, null);
+			if (changeDto == null) {
+				throw BusinessRuntimeException.getInstance("系统繁忙,请重试");
 			}
+			//替换记录
+			NetflixUserChangeOtherTicketRecord changeOtherTicketRecord = new NetflixUserChangeOtherTicketRecord();
+			changeOtherTicketRecord.setUserId(userId);
+			changeOtherTicketRecord.setRelationId(relationId);
+			changeOtherTicketRecord.setOtherRelationId(changeDto.getOtherRelationId());
+			changeOtherTicketRecord.setRelateOrderId(changeDto.getOtherOrderId());
+			//该车票订单id
+			changeOtherTicketRecord.setOrderId(relationView.getNfOriOrderId());
+			changeOtherTicketRecord.setStartTime(relationView.getStartTime());
+			changeOtherTicketRecord.setExpiryTime(expiryTime);
+			netflixUserChangeOtherTicketRecordMapper.insert(changeOtherTicketRecord);
+
 			//清除车票
 			GroupsRelation clearRelation = groupsRelationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
 					.eq(GroupsRelation::getId, relationId)