Commit e2581610271197db0f567926491fa5aa1d894515
1 parent
3233b45c
feat(*): bug修复
- bug修复
Showing
5 changed files
with
9 additions
and
9 deletions
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/task/PubStandTask.java
1 | 1 | package cn.fw.valhalla.controller.task; |
2 | 2 | |
3 | 3 | import cn.fw.common.cache.locker.DistributedLocker; |
4 | +import cn.fw.common.cache.locker.FLock; | |
4 | 5 | import cn.fw.valhalla.common.utils.StringUtils; |
5 | 6 | import cn.fw.valhalla.common.utils.ThreadPoolUtil; |
6 | 7 | import cn.fw.valhalla.domain.db.pub.PubCluePool; |
... | ... | @@ -14,7 +15,6 @@ import lombok.Getter; |
14 | 15 | import lombok.RequiredArgsConstructor; |
15 | 16 | import lombok.extern.slf4j.Slf4j; |
16 | 17 | import org.apache.commons.lang3.tuple.Pair; |
17 | -import org.redisson.api.RLock; | |
18 | 18 | import org.springframework.beans.factory.annotation.Value; |
19 | 19 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
20 | 20 | import org.springframework.data.redis.core.BoundListOperations; |
... | ... | @@ -113,7 +113,7 @@ public class PubStandTask { |
113 | 113 | public void doDistribute(GroupDTO group) { |
114 | 114 | final String key = generateKey(group.getId()); |
115 | 115 | final String lockKey = String.format("pub:distribute:%s", group.getId()); |
116 | - Pair<Boolean, RLock> lockPair = distributedLocker.tryLock(lockKey, TimeUnit.MINUTES, 0, -1); | |
116 | + Pair<Boolean, FLock> lockPair = distributedLocker.tryLock(lockKey, TimeUnit.MINUTES, 0, -1); | |
117 | 117 | try { |
118 | 118 | if (Boolean.TRUE.equals(lockPair.getLeft())) { |
119 | 119 | List<String> failList = new ArrayList<>(); | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerChangeBizService.java
1 | 1 | package cn.fw.valhalla.service.bus.cust; |
2 | 2 | |
3 | 3 | import cn.fw.common.cache.locker.DistributedLocker; |
4 | +import cn.fw.common.cache.locker.FLock; | |
4 | 5 | import cn.fw.common.constant.CommonConstant; |
5 | 6 | import cn.fw.common.web.annotation.DisLock; |
6 | 7 | import cn.fw.common.web.auth.LoginAuthBean; |
... | ... | @@ -39,7 +40,6 @@ import lombok.Getter; |
39 | 40 | import lombok.RequiredArgsConstructor; |
40 | 41 | import lombok.extern.slf4j.Slf4j; |
41 | 42 | import org.apache.commons.lang3.tuple.Pair; |
42 | -import org.redisson.api.RLock; | |
43 | 43 | import org.springframework.beans.BeanUtils; |
44 | 44 | import org.springframework.beans.factory.annotation.Value; |
45 | 45 | import org.springframework.data.redis.core.StringRedisTemplate; |
... | ... | @@ -118,7 +118,7 @@ public class CustomerChangeBizService extends AbstractCustomerService { |
118 | 118 | } |
119 | 119 | String key = MessageFormatUtil.MessageFormatTransfer(CUSTOMER_CHANGE_CODE, customerChangeDto.getShopId(), str); |
120 | 120 | String customerString = JSON.toJSONString(customerChangeDto); |
121 | - Pair<Boolean, RLock> lockPair = distributedLocker.tryLock(key, TimeUnit.SECONDS, 0, 1000 * 15); | |
121 | + Pair<Boolean, FLock> lockPair = distributedLocker.tryLock(key, TimeUnit.SECONDS, 0, 1000 * 15); | |
122 | 122 | boolean flag = lockPair.getKey(); |
123 | 123 | BV.isTrue(flag, "重复操作,请稍后重试"); |
124 | 124 | int expires = 60 * 30; | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/setting/strategy/AbstractSettingStrategy.java
1 | 1 | package cn.fw.valhalla.service.bus.setting.strategy; |
2 | 2 | |
3 | 3 | import cn.fw.common.cache.locker.DistributedLocker; |
4 | +import cn.fw.common.cache.locker.FLock; | |
4 | 5 | import cn.fw.valhalla.domain.db.setting.FollowSetting; |
5 | 6 | import cn.fw.valhalla.domain.db.setting.FollowSettingDetail; |
6 | 7 | import cn.fw.valhalla.domain.dto.SettingDTO; |
... | ... | @@ -17,7 +18,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
17 | 18 | import lombok.Getter; |
18 | 19 | import lombok.extern.slf4j.Slf4j; |
19 | 20 | import org.apache.commons.lang3.tuple.Pair; |
20 | -import org.redisson.api.RLock; | |
21 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
22 | 22 | import org.springframework.beans.factory.annotation.Value; |
23 | 23 | import org.springframework.context.ApplicationEventPublisher; |
... | ... | @@ -134,7 +134,7 @@ public abstract class AbstractSettingStrategy implements SettingStrategy { |
134 | 134 | */ |
135 | 135 | protected boolean saveOrUpdate(final FollowTypeEnum type, final Long groupId, final List<SettingDTO> list) { |
136 | 136 | String lockKey = getLockKey(groupId, type); |
137 | - Pair<Boolean, RLock> pair = distributedLocker.tryLock(lockKey, TimeUnit.SECONDS, 0, 15); | |
137 | + Pair<Boolean, FLock> pair = distributedLocker.tryLock(lockKey, TimeUnit.SECONDS, 0, 15); | |
138 | 138 | BV.isTrue(Boolean.TRUE.equals(pair.getKey()), "修改过于频繁,请5秒后重试"); |
139 | 139 | try { |
140 | 140 | FollowSetting setting = settingService.getOne(Wrappers.<FollowSetting>lambdaQuery() | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/report/PublicReportBizService.java
... | ... | @@ -62,8 +62,8 @@ public class PublicReportBizService { |
62 | 62 | public void extracting(final LocalDate nowDate, final Long groupId) { |
63 | 63 | log.info("开始抽取公共池报表数据,日期:{} 集团:{}", nowDate, groupId); |
64 | 64 | final String lockKey = generateKey(groupId); |
65 | - RLock lock = (RLock) distributedLocker.lock(lockKey); | |
66 | - if (lock == null || !lock.isLocked() || !lock.isHeldByCurrentThread()) { | |
65 | + RLock lock = distributedLocker.lock(lockKey); | |
66 | + if (lock == null || !lock.isLocked()) { | |
67 | 67 | return; |
68 | 68 | } |
69 | 69 | try { | ... | ... |