Browse Source

Merge remote-tracking branch 'remotes/origin/dev_bugfix_ljj' into yantai_master

dev
jianjun 3 years ago
parent
commit
9a8ba9ce99
  1. 8
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java

8
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java

@ -47,6 +47,7 @@ public class NoRepeatSubmitAop {
// 如果缓存中有这个url视为重复提交
Object result = null;
RLock lock = null;
try {
try {
//key 为空则直接跳过 不加锁
if (key != null) {
@ -55,17 +56,18 @@ public class NoRepeatSubmitAop {
lock = distributedLock.getLock(RedisKeys.getNoRepeatSubmitKey(key), leaseTime, NumConstant.ZERO_L, TimeUnit.MILLISECONDS);
//因为getLock如果获取失败抛异常 所以不做锁状态的判断
}
result = pjp.proceed();
} catch (Exception e) {
log.warn("noRepeatSubmit key:{},msg:{}", key, e.getMessage());
//"未获取到锁,重复提交了
throw new RenException(EpmetErrorCode.REPEAT_SUBMIT.getCode());
}
//执行业务代码
result = pjp.proceed();
} finally {
distributedLock.unLock(lock);
}
return result;
}
private String getKey(String keyExpress, String token) {

Loading…
Cancel
Save