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