Showing
2 changed files
with
7 additions
and
8 deletions
| ... | @@ -61,8 +61,8 @@ dependencies { | ... | @@ -61,8 +61,8 @@ dependencies { |
| 61 | 61 | ||
| 62 | // compileOnly 'org.projectlombok:lombok' | 62 | // compileOnly 'org.projectlombok:lombok' |
| 63 | // annotationProcessor 'org.projectlombok:lombok' | 63 | // annotationProcessor 'org.projectlombok:lombok' |
| 64 | - compileOnly 'org.projectlombok:lombok:1.18.20' | 64 | + compileOnly 'org.projectlombok:lombok:1.18.24' |
| 65 | - annotationProcessor 'org.projectlombok:lombok:1.18.20' | 65 | + annotationProcessor 'org.projectlombok:lombok:1.18.24' |
| 66 | 66 | ||
| 67 | testImplementation 'org.springframework.boot:spring-boot-starter-test' | 67 | testImplementation 'org.springframework.boot:spring-boot-starter-test' |
| 68 | } | 68 | } | ... | ... |
| ... | @@ -58,7 +58,6 @@ public class RepeatSubmitAspect { | ... | @@ -58,7 +58,6 @@ public class RepeatSubmitAspect { |
| 58 | * 获取LockKey | 58 | * 获取LockKey |
| 59 | * | 59 | * |
| 60 | * @param joinPoint 切入点 | 60 | * @param joinPoint 切入点 |
| 61 | - * @return | ||
| 62 | */ | 61 | */ |
| 63 | public static String getLockKey(ProceedingJoinPoint joinPoint) { | 62 | public static String getLockKey(ProceedingJoinPoint joinPoint) { |
| 64 | //获取连接点的方法签名对象 | 63 | //获取连接点的方法签名对象 |
| ... | @@ -79,13 +78,13 @@ public class RepeatSubmitAspect { | ... | @@ -79,13 +78,13 @@ public class RepeatSubmitAspect { |
| 79 | continue; | 78 | continue; |
| 80 | } | 79 | } |
| 81 | //如果属性是RequestKeyParam注解,则拼接 连接符 "& + RequestKeyParam" | 80 | //如果属性是RequestKeyParam注解,则拼接 连接符 "& + RequestKeyParam" |
| 82 | - if (sb.length() > 0) { | 81 | + if (!sb.isEmpty()) { |
| 83 | sb.append(requestLock.delimiter()); | 82 | sb.append(requestLock.delimiter()); |
| 84 | } | 83 | } |
| 85 | sb.append(args[i]); | 84 | sb.append(args[i]); |
| 86 | } | 85 | } |
| 87 | //如果方法上没有加RequestKeyParam注解 | 86 | //如果方法上没有加RequestKeyParam注解 |
| 88 | - if (StringUtils.isEmpty(sb.toString())) { | 87 | + if (!StringUtils.hasText((sb.toString()))) { |
| 89 | //获取方法上的多个注解(为什么是两层数组:因为第二层数组是只有一个元素的数组) | 88 | //获取方法上的多个注解(为什么是两层数组:因为第二层数组是只有一个元素的数组) |
| 90 | final var parameterAnnotations = method.getParameterAnnotations(); | 89 | final var parameterAnnotations = method.getParameterAnnotations(); |
| 91 | //循环注解 | 90 | //循环注解 |
| ... | @@ -103,7 +102,7 @@ public class RepeatSubmitAspect { | ... | @@ -103,7 +102,7 @@ public class RepeatSubmitAspect { |
| 103 | //如果有,设置Accessible为true(为true时可以使用反射访问私有变量,否则不能访问私有变量) | 102 | //如果有,设置Accessible为true(为true时可以使用反射访问私有变量,否则不能访问私有变量) |
| 104 | field.setAccessible(true); | 103 | field.setAccessible(true); |
| 105 | //如果属性是RequestKeyParam注解,则拼接 连接符" & + RequestKeyParam" | 104 | //如果属性是RequestKeyParam注解,则拼接 连接符" & + RequestKeyParam" |
| 106 | - if (sb.length() > 0) { | 105 | + if (!sb.isEmpty()) { |
| 107 | sb.append(requestLock.delimiter()); | 106 | sb.append(requestLock.delimiter()); |
| 108 | } | 107 | } |
| 109 | sb.append(ReflectionUtils.getField(field, object)); | 108 | sb.append(ReflectionUtils.getField(field, object)); |
| ... | @@ -112,9 +111,9 @@ public class RepeatSubmitAspect { | ... | @@ -112,9 +111,9 @@ public class RepeatSubmitAspect { |
| 112 | } | 111 | } |
| 113 | if (requestLock.isLockByLoginUser()) { | 112 | if (requestLock.isLockByLoginUser()) { |
| 114 | final var operatorId = LoginContextHolder.hasLogin() ? LoginContextHolder.getId() : null; | 113 | final var operatorId = LoginContextHolder.hasLogin() ? LoginContextHolder.getId() : null; |
| 115 | - return requestLock.prefix() + (operatorId != null ? CommonConstants.COLON + operatorId : "") + (sb.length() > 0 ? CommonConstants.UNDERLINE + sb : ""); | 114 | + return requestLock.prefix() + (operatorId != null ? CommonConstants.COLON + operatorId : "") + (!sb.isEmpty() ? CommonConstants.UNDERLINE + sb : ""); |
| 116 | } else { | 115 | } else { |
| 117 | - return requestLock.prefix() + (sb.length() > 0 ? CommonConstants.UNDERLINE + sb : ""); | 116 | + return requestLock.prefix() + (!sb.isEmpty() ? CommonConstants.UNDERLINE + sb : ""); |
| 118 | } | 117 | } |
| 119 | } | 118 | } |
| 120 | } | 119 | } | ... | ... |
-
Please register or login to post a comment