Bläddra i källkod

fix 获取车票异常重试

zoujiajian 9 månader sedan
förälder
incheckning
24f54a4dcf

+ 8 - 5
netflix-service/src/main/java/com/cyksj/service/exchange/impl/ExchangeCodeServiceImpl.java

@@ -495,9 +495,10 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
 
 	public GroupsRelation getFinalRelation(GoodsDonSku sku, Long userId, Integer retryNum, Long yhsId, List<Long> errorsRelationIds) {
 		//获取车票车位
-		GroupsRelation relation = groupRelationFrontService.getRelation(null, userId, sku, null);
+		GroupsRelation relation = null;
 
 		try {
+			relation = groupRelationFrontService.getRelation(null, userId, sku, null);
 			//锁定座位
 			setRelation(relation);
 			relation.setUserId(userId);
@@ -535,11 +536,13 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
 
 			groupRelationFrontService.adjustGroupsParkingTime(relation.getId(), sku);
 		} catch (Exception e) {
-			//删除座位缓存
-			delRelationKey(relation.getId(), userId);
-			errorsRelationIds.add(relation.getId());
-			if (retryNum == 15) {
+			if (relation != null) {
+				//删除座位缓存
+				delRelationKey(relation.getId(), userId);
+				errorsRelationIds.add(relation.getId());
 				log.error("用户:{}获取车票:{}异常", userId, relation.getId());
+			}
+			if (retryNum == 15) {
 				throw BusinessRuntimeException.getInstance("获取车票异常,请联系客服");
 			}
 			//失败重新给他分配车位