Commit feed4723 authored by fangxinjiang's avatar fangxinjiang

分布式锁

parent 73c4bfc5
...@@ -272,7 +272,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -272,7 +272,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override @Override
public R<Boolean> removeInFoById(String id) { public R<Boolean> removeInFoById(String id) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH; String key = CacheConstants.PAYMENT_SOCIAL_PUSH + CommonConstants.DOWN_LINE_STRING + user.getId();
if (Common.isNotNull(redisUtil.get(key))) { if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中禁止删除!"); return R.failed("用户正在推送实缴数据中禁止删除!");
} }
...@@ -300,7 +300,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -300,7 +300,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
return R.failed(CommonConstants.NO_DATA_TO_HANDLE); return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
} }
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH; String key = CacheConstants.PAYMENT_SOCIAL_PUSH + CommonConstants.DOWN_LINE_STRING + user.getId();
if (Common.isNotNull(redisUtil.get(key))) { if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中禁止删除!"); return R.failed("用户正在推送实缴数据中禁止删除!");
} }
...@@ -342,7 +342,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -342,7 +342,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
String socialCreateMonth, String socialPayMonth) { String socialCreateMonth, String socialPayMonth) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH; String key = CacheConstants.PAYMENT_SOCIAL_PUSH + CommonConstants.DOWN_LINE_STRING + user.getId();
if (Common.isNotNull(redisUtil.get(key))) { if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中禁止删除!"); return R.failed("用户正在推送实缴数据中禁止删除!");
} }
...@@ -2824,6 +2824,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2824,6 +2824,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA); throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA);
} }
redisUtil.set(key, user.getId(), 36000L);
Map<String, TSettleDomainSelectVo> mapSelectVo = this.getSelectVoMap(); Map<String, TSettleDomainSelectVo> mapSelectVo = this.getSelectVoMap();
//手动推送未推送的社保公积金明细数据 //手动推送未推送的社保公积金明细数据
createPaymentSocialInfoReal(user, searchVo, mapSelectVo); createPaymentSocialInfoReal(user, searchVo, mapSelectVo);
...@@ -2839,6 +2840,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2839,6 +2840,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
doJointSocialTask.asynchronousEkpIncomePaymentT(income); doJointSocialTask.asynchronousEkpIncomePaymentT(income);
} }
redisUtil.remove(redisKey); redisUtil.remove(redisKey);
redisUtil.remove(key);
} }
//主动释放锁 //主动释放锁
RedisDistributedLock.unlock(key, requestId); RedisDistributedLock.unlock(key, requestId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment