|
|
@@ -3,6 +3,7 @@ package com.cyksj.service.exchange.impl;
|
|
|
import cn.hutool.core.date.DateField;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
@@ -445,10 +446,8 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
|
|
|
|
|
|
groupRelationFrontService.adjustGroupsParkingTime(relation.getId(), sku);
|
|
|
} catch (Exception e) {
|
|
|
- Object value = redisService.get(RedisKey.GROUPS_RELATION_NUM_KEY + relation.getId());
|
|
|
- if (value != null && userId.equals(Long.parseLong(value.toString()))) {
|
|
|
- redisService.del(RedisKey.GROUPS_RELATION_NUM_KEY + relation.getId());
|
|
|
- }
|
|
|
+ //删除座位缓存
|
|
|
+ delRelationKey(relation.getId(), userId);
|
|
|
errorsRelationIds.add(relation.getId());
|
|
|
if (retryNum == 15) {
|
|
|
log.error("用户:{}获取车票:{}异常", userId, relation.getId());
|
|
|
@@ -480,8 +479,28 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
|
|
|
if (count == 0) {
|
|
|
log.error("车位异常 groupId:{}", groupsId);
|
|
|
groupsMapper.updateAvailableNum(groupsId);
|
|
|
- redisService.del(RedisKey.GROUPS_RELATION_NUM_KEY + relationId);
|
|
|
+ //删除座位缓存
|
|
|
+ delRelationKey(relationId, userId);
|
|
|
throw new BusinessRuntimeException("车位异常");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 清除座位缓存key
|
|
|
+ */
|
|
|
+ public void delRelationKey(Long relationId, Long userId) {
|
|
|
+ String relation_num_key = RedisKey.GROUPS_RELATION_NUM_KEY + relationId;
|
|
|
+ Object object = redisService.get(relation_num_key);
|
|
|
+ if (object != null) {
|
|
|
+ try {
|
|
|
+ Long keyUserId = Long.parseLong(object.toString());
|
|
|
+ //清除车票key
|
|
|
+ if (ObjectUtil.equal(userId, keyUserId)) {
|
|
|
+ redisService.del(relation_num_key);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("删除缓存key错误:{}", StringUtil.getErrorText(e));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|