Merge pull request #705 from xuxiaowei-com-cn/dev

⬆️ Upgrading dependencies hutool 5.8.4 & spring-javaformat-maven-plugin 0.0.34 & Enforce that all code matches the required style
This commit is contained in:
冷冷 2022-06-28 12:25:45 +08:00 committed by GitHub
commit c6253e53be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 110 additions and 98 deletions

View File

@ -38,9 +38,9 @@
| Spring Boot | 2.7.1 | | Spring Boot | 2.7.1 |
| Spring Cloud | 2021.0.3 | | Spring Cloud | 2021.0.3 |
| Spring Cloud Alibaba | 2021.0.1.0 | | Spring Cloud Alibaba | 2021.0.1.0 |
| Spring Authorization Server | 0.3.0 | | Spring Authorization Server | 0.3.1 |
| Mybatis Plus | 3.5.2 | | Mybatis Plus | 3.5.2 |
| hutool | 5.8.3 | | hutool | 5.8.4 |
| Avue | 2.6.18 | | Avue | 2.6.18 |
### 模块说明 ### 模块说明

View File

@ -70,25 +70,25 @@ public class ClusterConfigController {
if (body.containsKey(KEY_MODE)) { if (body.containsKey(KEY_MODE)) {
int mode = body.getInteger(KEY_MODE); int mode = body.getInteger(KEY_MODE);
switch (mode) { switch (mode) {
case ClusterStateManager.CLUSTER_CLIENT: case ClusterStateManager.CLUSTER_CLIENT:
ClusterClientModifyRequest data = JSON.parseObject(payload, ClusterClientModifyRequest.class); ClusterClientModifyRequest data = JSON.parseObject(payload, ClusterClientModifyRequest.class);
Result<Boolean> res = checkValidRequest(data); Result<Boolean> res = checkValidRequest(data);
if (res != null) { if (res != null) {
return res; return res;
} }
clusterConfigService.modifyClusterClientConfig(data).get(); clusterConfigService.modifyClusterClientConfig(data).get();
return Result.ofSuccess(true); return Result.ofSuccess(true);
case ClusterStateManager.CLUSTER_SERVER: case ClusterStateManager.CLUSTER_SERVER:
ClusterServerModifyRequest d = JSON.parseObject(payload, ClusterServerModifyRequest.class); ClusterServerModifyRequest d = JSON.parseObject(payload, ClusterServerModifyRequest.class);
Result<Boolean> r = checkValidRequest(d); Result<Boolean> r = checkValidRequest(d);
if (r != null) { if (r != null) {
return r; return r;
} }
// TODO: bad design here, should refactor! // TODO: bad design here, should refactor!
clusterConfigService.modifyClusterServerConfig(d).get(); clusterConfigService.modifyClusterServerConfig(d).get();
return Result.ofSuccess(true); return Result.ofSuccess(true);
default: default:
return Result.ofFail(-1, "invalid mode"); return Result.ofFail(-1, "invalid mode");
} }
} }
return Result.ofFail(-1, "invalid parameter"); return Result.ofFail(-1, "invalid parameter");

View File

@ -78,16 +78,16 @@ public class GatewayFlowRuleEntity implements RuleEntity {
public static Long calIntervalSec(Long interval, Integer intervalUnit) { public static Long calIntervalSec(Long interval, Integer intervalUnit) {
switch (intervalUnit) { switch (intervalUnit) {
case INTERVAL_UNIT_SECOND: case INTERVAL_UNIT_SECOND:
return interval; return interval;
case INTERVAL_UNIT_MINUTE: case INTERVAL_UNIT_MINUTE:
return interval * 60; return interval * 60;
case INTERVAL_UNIT_HOUR: case INTERVAL_UNIT_HOUR:
return interval * 60 * 60; return interval * 60 * 60;
case INTERVAL_UNIT_DAY: case INTERVAL_UNIT_DAY:
return interval * 60 * 60 * 24; return interval * 60 * 60 * 24;
default: default:
break; break;
} }
throw new IllegalArgumentException("Invalid intervalUnit: " + intervalUnit); throw new IllegalArgumentException("Invalid intervalUnit: " + intervalUnit);

View File

@ -1073,28 +1073,28 @@ public final class CronExpression implements Serializable, Cloneable {
int max = -1; int max = -1;
if (stopAt < startAt) { if (stopAt < startAt) {
switch (type) { switch (type) {
case SECOND: case SECOND:
max = 60; max = 60;
break; break;
case MINUTE: case MINUTE:
max = 60; max = 60;
break; break;
case HOUR: case HOUR:
max = 24; max = 24;
break; break;
case MONTH: case MONTH:
max = 12; max = 12;
break; break;
case DAY_OF_WEEK: case DAY_OF_WEEK:
max = 7; max = 7;
break; break;
case DAY_OF_MONTH: case DAY_OF_MONTH:
max = 31; max = 31;
break; break;
case YEAR: case YEAR:
throw new IllegalArgumentException("Start year must be less than stop year"); throw new IllegalArgumentException("Start year must be less than stop year");
default: default:
throw new IllegalArgumentException("Unexpected type encountered"); throw new IllegalArgumentException("Unexpected type encountered");
} }
stopAt += max; stopAt += max;
} }
@ -1120,22 +1120,22 @@ public final class CronExpression implements Serializable, Cloneable {
TreeSet<Integer> getSet(int type) { TreeSet<Integer> getSet(int type) {
switch (type) { switch (type) {
case SECOND: case SECOND:
return seconds; return seconds;
case MINUTE: case MINUTE:
return minutes; return minutes;
case HOUR: case HOUR:
return hours; return hours;
case DAY_OF_MONTH: case DAY_OF_MONTH:
return daysOfMonth; return daysOfMonth;
case MONTH: case MONTH:
return months; return months;
case DAY_OF_WEEK: case DAY_OF_WEEK:
return daysOfWeek; return daysOfWeek;
case YEAR: case YEAR:
return years; return years;
default: default:
return null; return null;
} }
} }
@ -1651,32 +1651,32 @@ public final class CronExpression implements Serializable, Cloneable {
protected int getLastDayOfMonth(int monthNum, int year) { protected int getLastDayOfMonth(int monthNum, int year) {
switch (monthNum) { switch (monthNum) {
case 1: case 1:
return 31; return 31;
case 2: case 2:
return (isLeapYear(year)) ? 29 : 28; return (isLeapYear(year)) ? 29 : 28;
case 3: case 3:
return 31; return 31;
case 4: case 4:
return 30; return 30;
case 5: case 5:
return 31; return 31;
case 6: case 6:
return 30; return 30;
case 7: case 7:
return 31; return 31;
case 8: case 8:
return 31; return 31;
case 9: case 9:
return 30; return 30;
case 10: case 10:
return 31; return 31;
case 11: case 11:
return 30; return 30;
case 12: case 12:
return 31; return 31;
default: default:
throw new IllegalArgumentException("Illegal month number: " + monthNum); throw new IllegalArgumentException("Illegal month number: " + monthNum);
} }
} }

18
pom.xml
View File

@ -35,7 +35,7 @@
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<spring-boot-admin.version>2.7.1</spring-boot-admin.version> <spring-boot-admin.version>2.7.1</spring-boot-admin.version>
<spring.authorization.version>0.3.1</spring.authorization.version> <spring.authorization.version>0.3.1</spring.authorization.version>
<hutool.version>5.8.3</hutool.version> <hutool.version>5.8.4</hutool.version>
<dynamic-ds.version>3.5.1</dynamic-ds.version> <dynamic-ds.version>3.5.1</dynamic-ds.version>
<captcha.version>2.2.2</captcha.version> <captcha.version>2.2.2</captcha.version>
<velocity.version>2.3</velocity.version> <velocity.version>2.3</velocity.version>
@ -51,7 +51,7 @@
<docker.username>username</docker.username> <docker.username>username</docker.username>
<docker.password>password</docker.password> <docker.password>password</docker.password>
<git.commit.plugin>4.9.9</git.commit.plugin> <git.commit.plugin>4.9.9</git.commit.plugin>
<spring.checkstyle.plugin>0.0.32</spring.checkstyle.plugin> <spring.checkstyle.plugin>0.0.34</spring.checkstyle.plugin>
</properties> </properties>
<!-- 以下依赖 全局所有的模块都会引入 --> <!-- 以下依赖 全局所有的模块都会引入 -->
@ -222,11 +222,23 @@
</includeOnlyProperties> </includeOnlyProperties>
</configuration> </configuration>
</plugin> </plugin>
<!--代码格式插件默认使用spring 规则--> <!--
代码格式插件默认使用spring 规则,可运行命令进行项目格式化:./mvnw spring-javaformat:apply 或 mvn spring-javaformat:apply可在IDEA中安装插件以下插件进行自动格式化
https://repo1.maven.org/maven2/io/spring/javaformat/spring-javaformat-intellij-idea-plugin
-->
<plugin> <plugin>
<groupId>io.spring.javaformat</groupId> <groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId> <artifactId>spring-javaformat-maven-plugin</artifactId>
<version>${spring.checkstyle.plugin}</version> <version>${spring.checkstyle.plugin}</version>
<executions>
<execution>
<phase>validate</phase>
<inherited>true</inherited>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>