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 Cloud | 2021.0.3 |
| Spring Cloud Alibaba | 2021.0.1.0 |
| Spring Authorization Server | 0.3.0 |
| Spring Authorization Server | 0.3.1 |
| Mybatis Plus | 3.5.2 |
| hutool | 5.8.3 |
| hutool | 5.8.4 |
| Avue | 2.6.18 |
### 模块说明

View File

@ -70,25 +70,25 @@ public class ClusterConfigController {
if (body.containsKey(KEY_MODE)) {
int mode = body.getInteger(KEY_MODE);
switch (mode) {
case ClusterStateManager.CLUSTER_CLIENT:
ClusterClientModifyRequest data = JSON.parseObject(payload, ClusterClientModifyRequest.class);
Result<Boolean> res = checkValidRequest(data);
if (res != null) {
return res;
}
clusterConfigService.modifyClusterClientConfig(data).get();
return Result.ofSuccess(true);
case ClusterStateManager.CLUSTER_SERVER:
ClusterServerModifyRequest d = JSON.parseObject(payload, ClusterServerModifyRequest.class);
Result<Boolean> r = checkValidRequest(d);
if (r != null) {
return r;
}
// TODO: bad design here, should refactor!
clusterConfigService.modifyClusterServerConfig(d).get();
return Result.ofSuccess(true);
default:
return Result.ofFail(-1, "invalid mode");
case ClusterStateManager.CLUSTER_CLIENT:
ClusterClientModifyRequest data = JSON.parseObject(payload, ClusterClientModifyRequest.class);
Result<Boolean> res = checkValidRequest(data);
if (res != null) {
return res;
}
clusterConfigService.modifyClusterClientConfig(data).get();
return Result.ofSuccess(true);
case ClusterStateManager.CLUSTER_SERVER:
ClusterServerModifyRequest d = JSON.parseObject(payload, ClusterServerModifyRequest.class);
Result<Boolean> r = checkValidRequest(d);
if (r != null) {
return r;
}
// TODO: bad design here, should refactor!
clusterConfigService.modifyClusterServerConfig(d).get();
return Result.ofSuccess(true);
default:
return Result.ofFail(-1, "invalid mode");
}
}
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) {
switch (intervalUnit) {
case INTERVAL_UNIT_SECOND:
return interval;
case INTERVAL_UNIT_MINUTE:
return interval * 60;
case INTERVAL_UNIT_HOUR:
return interval * 60 * 60;
case INTERVAL_UNIT_DAY:
return interval * 60 * 60 * 24;
default:
break;
case INTERVAL_UNIT_SECOND:
return interval;
case INTERVAL_UNIT_MINUTE:
return interval * 60;
case INTERVAL_UNIT_HOUR:
return interval * 60 * 60;
case INTERVAL_UNIT_DAY:
return interval * 60 * 60 * 24;
default:
break;
}
throw new IllegalArgumentException("Invalid intervalUnit: " + intervalUnit);

View File

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

18
pom.xml
View File

@ -35,7 +35,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<spring-boot-admin.version>2.7.1</spring-boot-admin.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>
<captcha.version>2.2.2</captcha.version>
<velocity.version>2.3</velocity.version>
@ -51,7 +51,7 @@
<docker.username>username</docker.username>
<docker.password>password</docker.password>
<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>
<!-- 以下依赖 全局所有的模块都会引入 -->
@ -222,11 +222,23 @@
</includeOnlyProperties>
</configuration>
</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>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId>
<version>${spring.checkstyle.plugin}</version>
<executions>
<execution>
<phase>validate</phase>
<inherited>true</inherited>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>