fix 修复 幂等组件 逻辑问题导致线程变量未清除

2.X
疯狂的狮子Li 3 years ago
parent 4bad9c3eed
commit 9b66aecaf9

@ -77,12 +77,16 @@ public class RepeatSubmitAspect {
@AfterReturning(pointcut = "@annotation(repeatSubmit)", returning = "jsonResult") @AfterReturning(pointcut = "@annotation(repeatSubmit)", returning = "jsonResult")
public void doAfterReturning(JoinPoint joinPoint, RepeatSubmit repeatSubmit, Object jsonResult) { public void doAfterReturning(JoinPoint joinPoint, RepeatSubmit repeatSubmit, Object jsonResult) {
if (jsonResult instanceof R) { if (jsonResult instanceof R) {
R<?> r = (R<?>) jsonResult; try {
if (r.getCode() == R.SUCCESS) { R<?> r = (R<?>) jsonResult;
return; // 成功则不删除redis数据 保证在有效时间内无法重复提交
if (r.getCode() == R.SUCCESS) {
return;
}
RedisUtils.deleteObject(KEY_CACHE.get());
} finally {
KEY_CACHE.remove();
} }
RedisUtils.deleteObject(KEY_CACHE.get());
KEY_CACHE.remove();
} }
} }

Loading…
Cancel
Save