diff --git a/config/jdbc-dev.yml b/config/jdbc-dev.yml
index d26d748c..db1255ca 100644
--- a/config/jdbc-dev.yml
+++ b/config/jdbc-dev.yml
@@ -4,8 +4,20 @@ spring:
url: jdbc:mysql://localhost:3306/sonic?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC&autoReconnect=true&serverTimezone=GMT%2b8
username: root
password: Sonic!@#123
- jpa:
- open-in-view: true
- hibernate:
- ddl-auto: update
- show-sql: true
\ No newline at end of file
+ # 会用到广播的事件
+ initialization-mode: always
+ schema:
+ - classpath:data.sql
+# mybatis-plus配置
+mybatis-plus:
+ mapper-locations: classpath:mapping/*.xml, classpath*:com/gitee/sunchenbin/mybatis/actable/mapping/*/*.xml
+ global-config:
+ # 是否显示mybatis-plus图标
+ banner: false
+ configuration:
+ # 关闭二级缓存
+ cache-enabled: false
+ # 关闭一级缓存
+ localCacheScope: STATEMENT
+ # sql日志
+ # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
\ No newline at end of file
diff --git a/config/sonic-server-folder-dev.yml b/config/sonic-server-folder-dev.yml
index a4f4843a..f82a7097 100644
--- a/config/sonic-server-folder-dev.yml
+++ b/config/sonic-server-folder-dev.yml
@@ -2,6 +2,13 @@ server:
port: 0
spring:
+ tomcat:
+ max-http-post-size: 100M
+ http:
+ multipart:
+ maxFileSize: 3000M
+ maxRequestSize: 3000M
+ maxPostSize: 3000M
servlet:
multipart:
maxFileSize: -1
diff --git a/config/sonic-server-gateway-dev.yml b/config/sonic-server-gateway-dev.yml
index 473de558..0f55c872 100644
--- a/config/sonic-server-gateway-dev.yml
+++ b/config/sonic-server-gateway-dev.yml
@@ -2,7 +2,7 @@ server:
port: 8094
filter:
- white-list: /users/login,/users/register,/swagger-resources,/v2/api-docs,/folder/upload,/folder/recordFiles,/keepFiles/,/imageFiles/,/recordFiles/,/logFiles/,/packageFiles/
+ white-list: /users/login,/users/register,/swagger-resources,/v2/api-docs,/folder/upload,/folder/upload/recordFiles,/folder/upload/cv,/keepFiles/,/imageFiles/,/recordFiles/,/logFiles/,/packageFiles/
spring:
cloud:
diff --git a/config/sonic-server-task-dev.yml b/config/sonic-server-task-dev.yml
index 40714e9f..2c392bba 100644
--- a/config/sonic-server-task-dev.yml
+++ b/config/sonic-server-task-dev.yml
@@ -1,9 +1,5 @@
server:
port: 0
-
-spring:
- datasource:
- initialization-mode: always
quartz:
properties:
org:
diff --git a/docker-compose.yml b/docker-compose.yml
index 22512cc6..2b2d17a3 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,7 +1,7 @@
version: '3'
services:
sonic-server-eureka:
- image: "sonicorg/sonic-server-eureka:v1.2.0-release"
+ image: "sonicorg/sonic-server-eureka:v1.3.0-beta2"
hostname: sonic-server-eureka
environment:
- EUREKA_HOST=sonic-server-eureka
@@ -12,7 +12,7 @@ services:
ports:
- "9090:9090"
sonic-server-bus:
- image: "sonicorg/sonic-server-bus:v1.2.0-release"
+ image: "sonicorg/sonic-server-bus:v1.3.0-beta2"
environment:
- PROFILE=prod
- EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/
@@ -24,7 +24,7 @@ services:
depends_on:
- sonic-server-eureka
sonic-server-gateway:
- image: "sonicorg/sonic-server-gateway:v1.2.0-release"
+ image: "sonicorg/sonic-server-gateway:v1.3.0-beta2"
environment:
- PROFILE=prod
- EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/
@@ -38,7 +38,7 @@ services:
ports:
- "8094:8094"
sonic-server-controller:
- image: "sonicorg/sonic-server-controller:v1.3.0-beta1"
+ image: "sonicorg/sonic-server-controller:v1.3.0-beta2"
environment:
- PROFILE=prod
- EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/
@@ -51,7 +51,7 @@ services:
- sonic-server-eureka
- sonic-server-gateway
sonic-server-folder:
- image: "sonicorg/sonic-server-folder:v1.2.0-release"
+ image: "sonicorg/sonic-server-folder:v1.3.0-beta2"
environment:
- PROFILE=prod
- EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/
@@ -68,7 +68,7 @@ services:
- sonic-server-eureka
- sonic-server-gateway
sonic-server-task:
- image: "sonicorg/sonic-server-task:v1.2.0-release"
+ image: "sonicorg/sonic-server-task:v1.3.0-beta2"
environment:
- PROFILE=prod
- EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/
@@ -81,7 +81,7 @@ services:
- sonic-server-eureka
- sonic-server-gateway
sonic-server-transport:
- image: "sonicorg/sonic-server-transport:v1.3.0-beta1"
+ image: "sonicorg/sonic-server-transport:v1.3.0-beta2"
environment:
- PROFILE=prod
- EUREKA_URL=http://sonic:sonic@sonic-server-eureka:9090/eureka/
diff --git a/pom.xml b/pom.xml
index 5372a7d7..802781b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- com.sonic
+ org.cloud.sonic
sonic-server
1.0.0
pom
diff --git a/sonic-server-bus/pom.xml b/sonic-server-bus/pom.xml
index 47df1720..89a59eef 100644
--- a/sonic-server-bus/pom.xml
+++ b/sonic-server-bus/pom.xml
@@ -4,13 +4,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
sonic-server
- com.sonic
+ org.cloud.sonic
1.0.0
4.0.0
sonic-server-bus
- v1.2.0-release
+ v1.3.0-beta2
jar
@@ -42,23 +42,23 @@
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- true
-
-
-
- com.spotify
- docker-maven-plugin
-
- true
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sonic-server-bus/src/main/java/com/sonic/bus/BusApplication.java b/sonic-server-bus/src/main/java/org/cloud/sonic/bus/BusApplication.java
similarity index 92%
rename from sonic-server-bus/src/main/java/com/sonic/bus/BusApplication.java
rename to sonic-server-bus/src/main/java/org/cloud/sonic/bus/BusApplication.java
index dfcf9baa..31a94eda 100644
--- a/sonic-server-bus/src/main/java/com/sonic/bus/BusApplication.java
+++ b/sonic-server-bus/src/main/java/org/cloud/sonic/bus/BusApplication.java
@@ -1,15 +1,15 @@
-package com.sonic.bus;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.config.server.EnableConfigServer;
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
-
-@SpringBootApplication
-@EnableEurekaClient
-@EnableConfigServer
-public class BusApplication {
- public static void main(String[] args) {
- SpringApplication.run(BusApplication.class, args);
- }
+package org.cloud.sonic.bus;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.config.server.EnableConfigServer;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+
+@SpringBootApplication
+@EnableEurekaClient
+@EnableConfigServer
+public class BusApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(BusApplication.class, args);
+ }
}
\ No newline at end of file
diff --git a/sonic-server-common/pom.xml b/sonic-server-common/pom.xml
index 424e4223..12821aa8 100644
--- a/sonic-server-common/pom.xml
+++ b/sonic-server-common/pom.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
sonic-server
- com.sonic
+ org.cloud.sonic
1.0.0
4.0.0
@@ -47,6 +47,12 @@
java-jwt
3.10.3
+
+
+ org.projectlombok
+ lombok
+ 1.18.20
+
diff --git a/sonic-server-common/src/main/java/com/sonic/common/exception/SonicException.java b/sonic-server-common/src/main/java/com/sonic/common/exception/SonicException.java
deleted file mode 100644
index e180c700..00000000
--- a/sonic-server-common/src/main/java/com/sonic/common/exception/SonicException.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.sonic.common.exception;
-
-/**
- * @author ZhouYiXun
- * @des
- * @date 2021/10/10 11:57
- */
-public class SonicException extends Exception {
- public SonicException(String message) {
- super(message);
- }
-}
diff --git a/sonic-server-common/src/main/java/com/sonic/common/config/APIDocumentConfig.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/config/APIDocumentConfig.java
similarity index 96%
rename from sonic-server-common/src/main/java/com/sonic/common/config/APIDocumentConfig.java
rename to sonic-server-common/src/main/java/org/cloud/sonic/common/config/APIDocumentConfig.java
index 07d6aa34..b1093fc9 100644
--- a/sonic-server-common/src/main/java/com/sonic/common/config/APIDocumentConfig.java
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/config/APIDocumentConfig.java
@@ -1,120 +1,120 @@
-package com.sonic.common.config;
-
-import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.*;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spi.service.contexts.SecurityContext;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * @author ZhouYiXun
- * @des swagger配置
- * @date 2021/8/15 18:26
- */
-@Configuration
-@EnableSwagger2WebMvc
-public class APIDocumentConfig {
- //从配置文档获取接口文档信息
- @Value("${spring.application.name}")
- private String name;
- @Value("${spring.application.des}")
- private String title;
- @Value("${spring.version}")
- private String version;
- @Value("${knife4j.setting.enableHostText}")
- private String host;
-
- private final OpenApiExtensionResolver openApiExtensionResolver;
-
- /**
- * @param openApiExtensionResolver
- * @return 开启knife4j接口插件
- * @author ZhouYiXun
- * @des
- * @date 2021/8/15 23:22
- */
- @Autowired
- public APIDocumentConfig(OpenApiExtensionResolver openApiExtensionResolver) {
- this.openApiExtensionResolver = openApiExtensionResolver;
- }
-
- /**
- * @return springfox.documentation.spring.web.plugins.Docket
- * @author ZhouYiXun
- * @des 生成最终文档的配置,默认所有路径
- * @date 2021/8/15 22:55
- */
- @Bean
- public Docket createRestAPIDocket() {
- return new Docket(DocumentationType.SWAGGER_2)
- .host(host)
- .apiInfo(apiInfo())
- .select()
- .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
- .paths(PathSelectors.any())
- .build()
- .extensions(openApiExtensionResolver.buildSettingExtensions())
- .useDefaultResponseMessages(false)
- .securitySchemes(Arrays.asList(
- new ApiKey("SonicToken", "SonicToken", "header")))
- .securityContexts(securityContexts());
- }
-
- /**
- * @return java.util.List
- * @author ZhouYiXun
- * @des 放开Login的token校验
- * @date 2021/8/15 22:53
- */
- private List securityContexts() {
- return Arrays.asList(
- SecurityContext.builder()
- .securityReferences(auth())
- .forPaths(PathSelectors.regex("^((?!(register|login)).)*$"))
- .build()
- );
- }
-
- /**
- * @return java.util.List
- * @author ZhouYiXun
- * @des 设置SonicToken在接口文档页面
- * @date 2021/8/15 22:54
- */
- private List auth() {
- AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
- AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
- authorizationScopes[0] = authorizationScope;
- return Arrays.asList(
- new SecurityReference("SonicToken", authorizationScopes));
- }
-
- /**
- * @return springfox.documentation.service.ApiInfo
- * @author ZhouYiXun
- * @des 接口文档信息,从配置文件获取
- * @date 2021/8/15 22:54
- */
- private ApiInfo apiInfo() {
- return new ApiInfoBuilder()
- .title(title + " Open API")
- .termsOfServiceUrl("Please visit: https://github.com/SonicCloudOrg/sonic-server")
- .contact(new Contact("ZhouYiXun email: zyx291028775@qq.com", "", ""))
- .version(version)
- .description(name + " 服务开放API,注意不要频繁请求。")
- .build();
- }
+package org.cloud.sonic.common.config;
+
+import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.*;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spi.service.contexts.SecurityContext;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * @author ZhouYiXun
+ * @des swagger配置
+ * @date 2021/8/15 18:26
+ */
+@Configuration
+@EnableSwagger2WebMvc
+public class APIDocumentConfig {
+ //从配置文档获取接口文档信息
+ @Value("${spring.application.name}")
+ private String name;
+ @Value("${spring.application.des}")
+ private String title;
+ @Value("${spring.version}")
+ private String version;
+ @Value("${knife4j.setting.enableHostText}")
+ private String host;
+
+ private final OpenApiExtensionResolver openApiExtensionResolver;
+
+ /**
+ * @param openApiExtensionResolver
+ * @return 开启knife4j接口插件
+ * @author ZhouYiXun
+ * @des
+ * @date 2021/8/15 23:22
+ */
+ @Autowired
+ public APIDocumentConfig(OpenApiExtensionResolver openApiExtensionResolver) {
+ this.openApiExtensionResolver = openApiExtensionResolver;
+ }
+
+ /**
+ * @return springfox.documentation.spring.web.plugins.Docket
+ * @author ZhouYiXun
+ * @des 生成最终文档的配置,默认所有路径
+ * @date 2021/8/15 22:55
+ */
+ @Bean
+ public Docket createRestAPIDocket() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .host(host)
+ .apiInfo(apiInfo())
+ .select()
+ .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
+ .paths(PathSelectors.any())
+ .build()
+ .extensions(openApiExtensionResolver.buildSettingExtensions())
+ .useDefaultResponseMessages(false)
+ .securitySchemes(Arrays.asList(
+ new ApiKey("SonicToken", "SonicToken", "header")))
+ .securityContexts(securityContexts());
+ }
+
+ /**
+ * @return java.util.List
+ * @author ZhouYiXun
+ * @des 放开Login的token校验
+ * @date 2021/8/15 22:53
+ */
+ private List securityContexts() {
+ return Arrays.asList(
+ SecurityContext.builder()
+ .securityReferences(auth())
+ .forPaths(PathSelectors.regex("^((?!(register|login)).)*$"))
+ .build()
+ );
+ }
+
+ /**
+ * @return java.util.List
+ * @author ZhouYiXun
+ * @des 设置SonicToken在接口文档页面
+ * @date 2021/8/15 22:54
+ */
+ private List auth() {
+ AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
+ AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
+ authorizationScopes[0] = authorizationScope;
+ return Arrays.asList(
+ new SecurityReference("SonicToken", authorizationScopes));
+ }
+
+ /**
+ * @return springfox.documentation.service.ApiInfo
+ * @author ZhouYiXun
+ * @des 接口文档信息,从配置文件获取
+ * @date 2021/8/15 22:54
+ */
+ private ApiInfo apiInfo() {
+ return new ApiInfoBuilder()
+ .title(title + " Open API")
+ .termsOfServiceUrl("Please visit: https://github.com/SonicCloudOrg/sonic-server")
+ .contact(new Contact("ZhouYiXun email: zyx291028775@qq.com", "", ""))
+ .version(version)
+ .description(name + " 服务开放API,注意不要频繁请求。")
+ .build();
+ }
}
\ No newline at end of file
diff --git a/sonic-server-common/src/main/java/com/sonic/common/config/GlobalWebException.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/config/GlobalWebException.java
similarity index 88%
rename from sonic-server-common/src/main/java/com/sonic/common/config/GlobalWebException.java
rename to sonic-server-common/src/main/java/org/cloud/sonic/common/config/GlobalWebException.java
index 4e68bf5a..c23f5797 100644
--- a/sonic-server-common/src/main/java/com/sonic/common/config/GlobalWebException.java
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/config/GlobalWebException.java
@@ -1,43 +1,43 @@
-package com.sonic.common.config;
-
-import com.sonic.common.exception.SonicException;
-import com.sonic.common.http.RespEnum;
-import com.sonic.common.http.RespModel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.converter.HttpMessageNotReadableException;
-import org.springframework.web.bind.MethodArgumentNotValidException;
-import org.springframework.web.bind.MissingServletRequestParameterException;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-
-import javax.validation.ConstraintViolationException;
-
-/**
- * @author ZhouYiXun
- * @des 全局异常拦截
- * @date 2021/8/15 18:26
- */
-@RestControllerAdvice
-public class GlobalWebException {
- private final Logger logger = LoggerFactory.getLogger(GlobalWebException.class);
-
- @ExceptionHandler(Exception.class)
- public RespModel ErrHandler(Exception exception) {
- logger.error(exception.getMessage());
- if (exception instanceof MissingServletRequestParameterException) {
- return new RespModel(RespEnum.PARAMS_MISSING_ERROR);
- } else if (exception instanceof ConstraintViolationException) {
- return new RespModel(RespEnum.PARAMS_VIOLATE_ERROR);
- } else if (exception instanceof MethodArgumentNotValidException) {
- return new RespModel(RespEnum.PARAMS_NOT_VALID);
- } else if (exception instanceof HttpMessageNotReadableException) {
- return new RespModel(RespEnum.PARAMS_NOT_READABLE);
- } else if (exception instanceof SonicException) {
- return new RespModel(4006, exception.getMessage());
- } else {
- exception.printStackTrace();
- return new RespModel(RespEnum.UNKNOWN_ERROR);
- }
- }
+package org.cloud.sonic.common.config;
+
+import org.cloud.sonic.common.exception.SonicException;
+import org.cloud.sonic.common.http.RespEnum;
+import org.cloud.sonic.common.http.RespModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+import javax.validation.ConstraintViolationException;
+
+/**
+ * @author ZhouYiXun
+ * @des 全局异常拦截
+ * @date 2021/8/15 18:26
+ */
+@RestControllerAdvice
+public class GlobalWebException {
+ private final Logger logger = LoggerFactory.getLogger(GlobalWebException.class);
+
+ @ExceptionHandler(Exception.class)
+ public RespModel ErrHandler(Exception exception) {
+ logger.error(exception.getMessage());
+ if (exception instanceof MissingServletRequestParameterException) {
+ return new RespModel(RespEnum.PARAMS_MISSING_ERROR);
+ } else if (exception instanceof ConstraintViolationException) {
+ return new RespModel(RespEnum.PARAMS_VIOLATE_ERROR);
+ } else if (exception instanceof MethodArgumentNotValidException) {
+ return new RespModel(RespEnum.PARAMS_NOT_VALID);
+ } else if (exception instanceof HttpMessageNotReadableException) {
+ return new RespModel(RespEnum.PARAMS_NOT_READABLE);
+ } else if (exception instanceof SonicException) {
+ return new RespModel(4006, exception.getMessage());
+ } else {
+ exception.printStackTrace();
+ return new RespModel(RespEnum.UNKNOWN_ERROR);
+ }
+ }
}
\ No newline at end of file
diff --git a/sonic-server-common/src/main/java/com/sonic/common/config/WebAspect.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/config/WebAspect.java
similarity index 89%
rename from sonic-server-common/src/main/java/com/sonic/common/config/WebAspect.java
rename to sonic-server-common/src/main/java/org/cloud/sonic/common/config/WebAspect.java
index 325de44c..0c4ac35a 100644
--- a/sonic-server-common/src/main/java/com/sonic/common/config/WebAspect.java
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/config/WebAspect.java
@@ -1,16 +1,16 @@
-package com.sonic.common.config;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @author ZhouYiXun
- * @des 配合AOP指定对应的接口打印web请求日志
- * @date 2021/8/15 18:26
- */
-@Target({ElementType.METHOD, ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface WebAspect {
+package org.cloud.sonic.common.config;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author ZhouYiXun
+ * @des 配合AOP指定对应的接口打印web请求日志
+ * @date 2021/8/15 18:26
+ */
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface WebAspect {
}
\ No newline at end of file
diff --git a/sonic-server-common/src/main/java/com/sonic/common/config/WebAspectConfig.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/config/WebAspectConfig.java
similarity index 95%
rename from sonic-server-common/src/main/java/com/sonic/common/config/WebAspectConfig.java
rename to sonic-server-common/src/main/java/org/cloud/sonic/common/config/WebAspectConfig.java
index 6abce897..052813ae 100644
--- a/sonic-server-common/src/main/java/com/sonic/common/config/WebAspectConfig.java
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/config/WebAspectConfig.java
@@ -1,95 +1,95 @@
-package com.sonic.common.config;
-
-import com.alibaba.fastjson.JSONObject;
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.annotation.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Arrays;
-
-/**
- * @author ZhouYiXun
- * @des AOP框架搭配注解类,生成对应web请求日志
- * @date 2021/8/15 18:26
- */
-@Aspect
-@Component
-public class WebAspectConfig {
- private final Logger logger = LoggerFactory.getLogger(WebAspectConfig.class);
-
- /**
- * @return void
- * @author ZhouYiXun
- * @des 定义切点,注解类webAspect
- * @date 2021/8/15 23:08
- */
- @Pointcut("@annotation(WebAspect)")
- public void webAspect() {
- }
-
- /**
- * @param joinPoint
- * @return void
- * @author ZhouYiXun
- * @des 请求前获取所有信息
- * @date 2021/8/15 23:08
- */
- @Before("webAspect()")
- public void deBefore(JoinPoint joinPoint) throws Throwable {
- ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
- HttpServletRequest request = attributes.getRequest();
- //默认打印为json格式,接入elasticsearch等会方便查看
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("url", request.getRequestURL().toString());
- jsonObject.put("method", request.getMethod());
- jsonObject.put("auth", request.getHeader("SonicToken"));
- jsonObject.put("class", joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
- jsonObject.put("request", Arrays.toString(joinPoint.getArgs()));
- logger.info(jsonObject.toJSONString());
- }
-
- /**
- * @param ret
- * @return void
- * @author ZhouYiXun
- * @des 请求完毕后打印结果
- * @date 2021/8/15 23:10
- */
- @AfterReturning(returning = "ret", pointcut = "webAspect()")
- public void doAfterReturning(Object ret) throws Throwable {
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("response", ret);
- logger.info(jsonObject.toJSONString());
- }
-
- /**
- * @param joinPoint
- * @param ex
- * @return void
- * @author ZhouYiXun
- * @des 报错的话打印错误信息
- * @date 2021/8/15 23:11
- */
- @AfterThrowing(throwing = "ex", pointcut = "webAspect()")
- public void error(JoinPoint joinPoint, Exception ex) {
- logger.info("error : " + ex.getMessage());
- }
-
- /**
- * @param jp
- * @return void
- * @author ZhouYiXun
- * @des 方法结束后给出标识
- * @date 2021/8/15 23:11
- */
- @After("webAspect()")
- public void after(JoinPoint jp) {
- logger.info("handle end");
- }
-
+package org.cloud.sonic.common.config;
+
+import com.alibaba.fastjson.JSONObject;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+/**
+ * @author ZhouYiXun
+ * @des AOP框架搭配注解类,生成对应web请求日志
+ * @date 2021/8/15 18:26
+ */
+@Aspect
+@Component
+public class WebAspectConfig {
+ private final Logger logger = LoggerFactory.getLogger(WebAspectConfig.class);
+
+ /**
+ * @return void
+ * @author ZhouYiXun
+ * @des 定义切点,注解类webAspect
+ * @date 2021/8/15 23:08
+ */
+ @Pointcut("@annotation(WebAspect)")
+ public void webAspect() {
+ }
+
+ /**
+ * @param joinPoint
+ * @return void
+ * @author ZhouYiXun
+ * @des 请求前获取所有信息
+ * @date 2021/8/15 23:08
+ */
+ @Before("webAspect()")
+ public void deBefore(JoinPoint joinPoint) throws Throwable {
+ ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ HttpServletRequest request = attributes.getRequest();
+ //默认打印为json格式,接入elasticsearch等会方便查看
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("url", request.getRequestURL().toString());
+ jsonObject.put("method", request.getMethod());
+ jsonObject.put("auth", request.getHeader("SonicToken"));
+ jsonObject.put("class", joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
+ jsonObject.put("request", Arrays.toString(joinPoint.getArgs()));
+ logger.info(jsonObject.toJSONString());
+ }
+
+ /**
+ * @param ret
+ * @return void
+ * @author ZhouYiXun
+ * @des 请求完毕后打印结果
+ * @date 2021/8/15 23:10
+ */
+ @AfterReturning(returning = "ret", pointcut = "webAspect()")
+ public void doAfterReturning(Object ret) throws Throwable {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("response", ret);
+ logger.info(jsonObject.toJSONString());
+ }
+
+ /**
+ * @param joinPoint
+ * @param ex
+ * @return void
+ * @author ZhouYiXun
+ * @des 报错的话打印错误信息
+ * @date 2021/8/15 23:11
+ */
+ @AfterThrowing(throwing = "ex", pointcut = "webAspect()")
+ public void error(JoinPoint joinPoint, Exception ex) {
+ logger.info("error : " + ex.getMessage());
+ }
+
+ /**
+ * @param jp
+ * @return void
+ * @author ZhouYiXun
+ * @des 方法结束后给出标识
+ * @date 2021/8/15 23:11
+ */
+ @After("webAspect()")
+ public void after(JoinPoint jp) {
+ logger.info("handle end");
+ }
+
}
\ No newline at end of file
diff --git a/sonic-server-common/src/main/java/org/cloud/sonic/common/exception/BeanToolException.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/exception/BeanToolException.java
new file mode 100644
index 00000000..7793e1a9
--- /dev/null
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/exception/BeanToolException.java
@@ -0,0 +1,24 @@
+package org.cloud.sonic.common.exception;
+
+import org.springframework.http.HttpStatus;
+
+/**
+ * BeanUtils exception.
+ *
+ * @author JayWenStar
+ */
+public class BeanToolException extends SonicException {
+
+ public BeanToolException(String message) {
+ super(message);
+ }
+
+ public BeanToolException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ @Override
+ public HttpStatus getStatus() {
+ return HttpStatus.INTERNAL_SERVER_ERROR;
+ }
+}
diff --git a/sonic-server-common/src/main/java/org/cloud/sonic/common/exception/ServerErrorException.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/exception/ServerErrorException.java
new file mode 100644
index 00000000..ebb322b3
--- /dev/null
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/exception/ServerErrorException.java
@@ -0,0 +1,22 @@
+package org.cloud.sonic.common.exception;
+
+import org.springframework.http.HttpStatus;
+
+/**
+ * @author JayWenStar
+ */
+public class ServerErrorException extends SonicException {
+
+ public ServerErrorException(String message) {
+ super(message);
+ }
+
+ public ServerErrorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ @Override
+ public HttpStatus getStatus() {
+ return HttpStatus.INTERNAL_SERVER_ERROR;
+ }
+}
diff --git a/sonic-server-common/src/main/java/org/cloud/sonic/common/exception/SonicException.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/exception/SonicException.java
new file mode 100644
index 00000000..888b980b
--- /dev/null
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/exception/SonicException.java
@@ -0,0 +1,39 @@
+package org.cloud.sonic.common.exception;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.lang.NonNull;
+import org.springframework.lang.Nullable;
+
+/**
+ * @author ZhouYiXun
+ * @des
+ * @date 2021/10/10 11:57
+ */
+public class SonicException extends RuntimeException {
+
+ private Object errorData;
+
+ public SonicException(String message) {
+ super(message);
+ }
+
+ public SonicException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ @NonNull
+ public HttpStatus getStatus() {
+ return HttpStatus.OK;
+ }
+
+ @Nullable
+ public Object getErrorData() {
+ return errorData;
+ }
+
+ @NonNull
+ public SonicException setErrorData(@Nullable Object errorData) {
+ this.errorData = errorData;
+ return this;
+ }
+}
diff --git a/sonic-server-common/src/main/java/com/sonic/common/http/RespEnum.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/http/RespEnum.java
similarity index 94%
rename from sonic-server-common/src/main/java/com/sonic/common/http/RespEnum.java
rename to sonic-server-common/src/main/java/org/cloud/sonic/common/http/RespEnum.java
index 0f9fb2df..fc5e3a8f 100644
--- a/sonic-server-common/src/main/java/com/sonic/common/http/RespEnum.java
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/http/RespEnum.java
@@ -1,48 +1,48 @@
-package com.sonic.common.http;
-
-/**
- * @author ZhouYiXun
- * @des 接口响应枚举
- * @date 2021/8/15 18:26
- */
-public enum RespEnum {
- HANDLE_OK(2000, "操作成功!"),
- SEARCH_OK(2000, "查询成功!"),
- UPDATE_OK(2000, "编辑成功!"),
- DELETE_OK(2000, "删除成功!"),
- UPLOAD_OK(2000, "上传成功!"),
- UNAUTHORIZED(1001, "身份验证异常!"),
- SERVICE_NOT_FOUND(1002, "相关服务不可用!"),
- ID_NOT_FOUND(3001, "id不存在!"),
- DELETE_ERROR(3002, "删除失败!"),
- UPLOAD_ERROR(3003, "上传失败!"),
- PARAMS_MISSING_ERROR(4001, "部分参数缺失!"),
- PARAMS_VIOLATE_ERROR(4002, "字段校验异常!"),
- UNKNOWN_ERROR(4003, "发生未知异常!"),
- PARAMS_NOT_VALID(4004, "字段缺失或校验异常!"),
- PARAMS_NOT_READABLE(4005, "解析参数失败!");
-
- private int code;
- private String message;
-
- RespEnum(int code, String message) {
- this.code = code;
- this.message = message;
- }
-
- public int getCode() {
- return code;
- }
-
- public void setCode(int code) {
- this.code = code;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-}
+package org.cloud.sonic.common.http;
+
+/**
+ * @author ZhouYiXun
+ * @des 接口响应枚举
+ * @date 2021/8/15 18:26
+ */
+public enum RespEnum {
+ HANDLE_OK(2000, "操作成功!"),
+ SEARCH_OK(2000, "查询成功!"),
+ UPDATE_OK(2000, "编辑成功!"),
+ DELETE_OK(2000, "删除成功!"),
+ UPLOAD_OK(2000, "上传成功!"),
+ UNAUTHORIZED(1001, "身份验证异常!"),
+ SERVICE_NOT_FOUND(1002, "相关服务不可用!"),
+ ID_NOT_FOUND(3001, "id不存在!"),
+ DELETE_ERROR(3002, "删除失败!"),
+ UPLOAD_ERROR(3003, "上传失败!"),
+ PARAMS_MISSING_ERROR(4001, "部分参数缺失!"),
+ PARAMS_VIOLATE_ERROR(4002, "字段校验异常!"),
+ UNKNOWN_ERROR(4003, "发生未知异常!"),
+ PARAMS_NOT_VALID(4004, "字段缺失或校验异常!"),
+ PARAMS_NOT_READABLE(4005, "解析参数失败!");
+
+ private int code;
+ private String message;
+
+ RespEnum(int code, String message) {
+ this.code = code;
+ this.message = message;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/sonic-server-common/src/main/java/com/sonic/common/http/RespModel.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/http/RespModel.java
similarity index 94%
rename from sonic-server-common/src/main/java/com/sonic/common/http/RespModel.java
rename to sonic-server-common/src/main/java/org/cloud/sonic/common/http/RespModel.java
index dd95850a..cdf2b85a 100644
--- a/sonic-server-common/src/main/java/com/sonic/common/http/RespModel.java
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/http/RespModel.java
@@ -1,78 +1,78 @@
-package com.sonic.common.http;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * @author ZhouYiXun
- * @des 接口响应模型,后续开发相关模块会共用
- * @date 2021/8/15 18:26
- */
-@ApiModel("请求响应模型")
-public class RespModel {
- @ApiModelProperty(value = "状态码", example = "2000")
- private int code;
- @ApiModelProperty(value = "状态描述", example = "操作成功!")
- private String message;
- @ApiModelProperty(value = "响应详情")
- private T data;
-
- public RespModel() {
- }
-
- public RespModel(int code, String message) {
- this(code, message, null);
- }
-
- public RespModel(int code, String message, T data) {
- this.code = code;
- this.message = message;
- this.data = data;
- }
-
- public RespModel(RespEnum respEnum) {
- this.code = respEnum.getCode();
- this.message = respEnum.getMessage();
- }
-
- public RespModel(RespEnum respEnum, T data) {
- this.code = respEnum.getCode();
- this.message = respEnum.getMessage();
- this.data = data;
- }
-
- public int getCode() {
- return code;
- }
-
- public void setCode(int code) {
- this.code = code;
- }
-
- public String getMessage() {
- return message;
- }
-
- public RespModel setMessage(String msg) {
- this.message = msg;
- return this;
- }
-
- public T getData() {
- return data;
- }
-
- public RespModel setData(T data) {
- this.data = data;
- return this;
- }
-
- @Override
- public String toString() {
- return "RespModel{" +
- "error=" + code +
- ", errMsg='" + message + '\'' +
- ", data=" + data +
- '}';
- }
-}
+package org.cloud.sonic.common.http;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @author ZhouYiXun
+ * @des 接口响应模型,后续开发相关模块会共用
+ * @date 2021/8/15 18:26
+ */
+@ApiModel("请求响应模型")
+public class RespModel {
+ @ApiModelProperty(value = "状态码", example = "2000")
+ private int code;
+ @ApiModelProperty(value = "状态描述", example = "操作成功!")
+ private String message;
+ @ApiModelProperty(value = "响应详情")
+ private T data;
+
+ public RespModel() {
+ }
+
+ public RespModel(int code, String message) {
+ this(code, message, null);
+ }
+
+ public RespModel(int code, String message, T data) {
+ this.code = code;
+ this.message = message;
+ this.data = data;
+ }
+
+ public RespModel(RespEnum respEnum) {
+ this.code = respEnum.getCode();
+ this.message = respEnum.getMessage();
+ }
+
+ public RespModel(RespEnum respEnum, T data) {
+ this.code = respEnum.getCode();
+ this.message = respEnum.getMessage();
+ this.data = data;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public RespModel setMessage(String msg) {
+ this.message = msg;
+ return this;
+ }
+
+ public T getData() {
+ return data;
+ }
+
+ public RespModel setData(T data) {
+ this.data = data;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return "RespModel{" +
+ "error=" + code +
+ ", errMsg='" + message + '\'' +
+ ", data=" + data +
+ '}';
+ }
+}
diff --git a/sonic-server-common/src/main/java/org/cloud/sonic/common/tools/BeanTool.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/tools/BeanTool.java
new file mode 100644
index 00000000..b53b6517
--- /dev/null
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/tools/BeanTool.java
@@ -0,0 +1,141 @@
+package org.cloud.sonic.common.tools;
+
+import org.cloud.sonic.common.exception.BeanToolException;
+import org.springframework.beans.BeanWrapperImpl;
+import org.springframework.beans.BeansException;
+import org.springframework.lang.NonNull;
+import org.springframework.lang.Nullable;
+import org.springframework.util.Assert;
+import org.springframework.util.CollectionUtils;
+
+import java.beans.PropertyDescriptor;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * Bean utilities.
+ *
+ * @author JayWenStar
+ */
+public class BeanTool {
+
+ private BeanTool() {
+ }
+
+ /**
+ * Transforms from the source object. (copy same properties only)
+ *
+ * @param source source data
+ * @param targetClass target class must not be null
+ * @param target class type
+ * @return instance with specified type copying from source data; or null if source data is null
+ * @throws BeanToolException if newing target instance failed or copying failed
+ */
+ @Nullable
+ public static T transformFrom(@Nullable Object source, @NonNull Class targetClass) {
+ Assert.notNull(targetClass, "Target class must not be null");
+
+ if (source == null) {
+ return null;
+ }
+
+ // Init the instance
+ try {
+ // New instance for the target class
+ T targetInstance = targetClass.getDeclaredConstructor().newInstance();
+ // Copy properties
+ org.springframework.beans.BeanUtils.copyProperties(source, targetInstance, getNullPropertyNames(source));
+ // Return the target instance
+ return targetInstance;
+ } catch (Exception e) {
+ throw new BeanToolException("Failed to new " + targetClass.getName() + " instance or copy properties", e);
+ }
+ }
+
+ /**
+ * Transforms from source data collection in batch.
+ *
+ * @param sources source data collection
+ * @param targetClass target class must not be null
+ * @param target class type
+ * @return target collection transforming from source data collection.
+ * @throws BeanToolException if newing target instance failed or copying failed
+ */
+ @NonNull
+ public static List transformFromInBatch(Collection> sources, @NonNull Class targetClass) {
+ if (CollectionUtils.isEmpty(sources)) {
+ return Collections.emptyList();
+ }
+
+ // Transform in batch
+ return sources.stream()
+ .map(source -> transformFrom(source, targetClass))
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * Update properties (non null).
+ *
+ * @param source source data must not be null
+ * @param target target data must not be null
+ * @throws BeanToolException if copying failed
+ */
+ public static void updateProperties(@NonNull Object source, @NonNull Object target) {
+ Assert.notNull(source, "source object must not be null");
+ Assert.notNull(target, "target object must not be null");
+
+ // Set non null properties from source properties to target properties
+ try {
+ org.springframework.beans.BeanUtils.copyProperties(source, target, getNullPropertyNames(source));
+ } catch (BeansException e) {
+ throw new BeanToolException("Failed to copy properties", e);
+ }
+ }
+
+ /**
+ * Gets null names array of property.
+ *
+ * @param source object data must not be null
+ * @return null name array of property
+ */
+ @NonNull
+ private static String[] getNullPropertyNames(@NonNull Object source) {
+ return getNullPropertyNameSet(source).toArray(new String[0]);
+ }
+
+ /**
+ * Gets null names set of property.
+ *
+ * @param source object data must not be null
+ * @return null name set of property
+ */
+ @NonNull
+ private static Set getNullPropertyNameSet(@NonNull Object source) {
+
+ Assert.notNull(source, "source object must not be null");
+ BeanWrapperImpl beanWrapper = new BeanWrapperImpl(source);
+ PropertyDescriptor[] propertyDescriptors = beanWrapper.getPropertyDescriptors();
+
+ Set emptyNames = new HashSet<>();
+
+ for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+ String propertyName = propertyDescriptor.getName();
+ Object propertyValue = beanWrapper.getPropertyValue(propertyName);
+
+ // if property value is equal to null, add it to empty name set
+ if (propertyValue == null) {
+ emptyNames.add(propertyName);
+ }
+ }
+
+ return emptyNames;
+ }
+
+ @NonNull
+ public static T toBean(Object source, Class clazz) {
+ Assert.notNull(source, "object must not be null");
+ Assert.notNull(clazz, "clazz must not be null");
+
+ return BeanTool.toBean(source, clazz);
+ }
+}
diff --git a/sonic-server-common/src/main/java/com/sonic/common/tools/JWTTokenTool.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/tools/JWTTokenTool.java
similarity index 94%
rename from sonic-server-common/src/main/java/com/sonic/common/tools/JWTTokenTool.java
rename to sonic-server-common/src/main/java/org/cloud/sonic/common/tools/JWTTokenTool.java
index ff8c2261..b339f839 100644
--- a/sonic-server-common/src/main/java/com/sonic/common/tools/JWTTokenTool.java
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/tools/JWTTokenTool.java
@@ -1,73 +1,73 @@
-package com.sonic.common.tools;
-
-import com.auth0.jwt.JWT;
-import com.auth0.jwt.JWTVerifier;
-import com.auth0.jwt.algorithms.Algorithm;
-import com.auth0.jwt.exceptions.JWTDecodeException;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.UUID;
-
-/**
- * @author ZhouYiXun
- * @des Token加解密工具类
- * @date 2021/8/15 18:26
- */
-@Configuration
-public class JWTTokenTool {
- @Value("${gateway.secret}")
- private String TOKEN_SECRET;
- @Value("${gateway.expireDay}")
- private int EXPIRE_DAY;
-
- /**
- * @param username
- * @return java.lang.String
- * @author ZhouYiXun
- * @des 通过用户名生成token
- * @date 2021/8/15 23:05
- */
- public String getToken(String username) {
- Calendar now = Calendar.getInstance();
- now.add(Calendar.DATE, EXPIRE_DAY);
- Date nowTime = now.getTime();
- return JWT.create().withAudience(username, UUID.randomUUID().toString())
- .withExpiresAt(nowTime)
- .sign(Algorithm.HMAC256(TOKEN_SECRET));
- }
-
- /**
- * @param token
- * @return java.lang.String
- * @author ZhouYiXun
- * @des 由token获取生成时的用户信息
- * @date 2021/8/15 23:05
- */
- public String getUserName(String token) {
- try {
- return JWT.decode(token).getAudience().get(0);
- } catch (JWTDecodeException e) {
- return null;
- }
- }
-
- /**
- * @param token
- * @return boolean
- * @author ZhouYiXun
- * @des 校验token的签名是否合法
- * @date 2021/8/15 23:05
- */
- public boolean verify(String token) {
- JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(TOKEN_SECRET)).build();
- try {
- jwtVerifier.verify(token);
- return true;
- } catch (Exception e) {
- return false;
- }
- }
+package org.cloud.sonic.common.tools;
+
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.JWTVerifier;
+import com.auth0.jwt.algorithms.Algorithm;
+import com.auth0.jwt.exceptions.JWTDecodeException;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+/**
+ * @author ZhouYiXun
+ * @des Token加解密工具类
+ * @date 2021/8/15 18:26
+ */
+@Configuration
+public class JWTTokenTool {
+ @Value("${gateway.secret}")
+ private String TOKEN_SECRET;
+ @Value("${gateway.expireDay}")
+ private int EXPIRE_DAY;
+
+ /**
+ * @param username
+ * @return java.lang.String
+ * @author ZhouYiXun
+ * @des 通过用户名生成token
+ * @date 2021/8/15 23:05
+ */
+ public String getToken(String username) {
+ Calendar now = Calendar.getInstance();
+ now.add(Calendar.DATE, EXPIRE_DAY);
+ Date nowTime = now.getTime();
+ return JWT.create().withAudience(username, UUID.randomUUID().toString())
+ .withExpiresAt(nowTime)
+ .sign(Algorithm.HMAC256(TOKEN_SECRET));
+ }
+
+ /**
+ * @param token
+ * @return java.lang.String
+ * @author ZhouYiXun
+ * @des 由token获取生成时的用户信息
+ * @date 2021/8/15 23:05
+ */
+ public String getUserName(String token) {
+ try {
+ return JWT.decode(token).getAudience().get(0);
+ } catch (JWTDecodeException e) {
+ return null;
+ }
+ }
+
+ /**
+ * @param token
+ * @return boolean
+ * @author ZhouYiXun
+ * @des 校验token的签名是否合法
+ * @date 2021/8/15 23:05
+ */
+ public boolean verify(String token) {
+ JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(TOKEN_SECRET)).build();
+ try {
+ jwtVerifier.verify(token);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
}
\ No newline at end of file
diff --git a/sonic-server-common/src/main/java/org/cloud/sonic/common/tools/ReflectionTool.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/tools/ReflectionTool.java
new file mode 100644
index 00000000..1e620e63
--- /dev/null
+++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/tools/ReflectionTool.java
@@ -0,0 +1,92 @@
+package org.cloud.sonic.common.tools;
+
+import org.springframework.lang.NonNull;
+import org.springframework.lang.Nullable;
+import org.springframework.util.Assert;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+/**
+ * Reflection utilities.
+ *
+ * @author JayWenStar
+ */
+public class ReflectionTool {
+
+ private ReflectionTool() {
+ }
+
+ /**
+ * Gets parameterized type.
+ *
+ * @param superType super type must not be null (super class or super interface)
+ * @param genericTypes generic type array
+ * @return parameterized type of the interface or null if it is mismatch
+ */
+ @Nullable
+ public static ParameterizedType getParameterizedType(@NonNull Class> superType, Type... genericTypes) {
+ Assert.notNull(superType, "Interface or super type must not be null");
+
+ ParameterizedType currentType = null;
+
+ for (Type genericType : genericTypes) {
+ if (genericType instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType) genericType;
+ if (parameterizedType.getRawType().getTypeName().equals(superType.getTypeName())) {
+ currentType = parameterizedType;
+ break;
+ }
+ }
+ }
+
+ return currentType;
+ }
+
+ /**
+ * Gets parameterized type.
+ *
+ * @param interfaceType interface type must not be null
+ * @param implementationClass implementation class of the interface must not be null
+ * @return parameterized type of the interface or null if it is mismatch
+ */
+ @Nullable
+ public static ParameterizedType getParameterizedType(@NonNull Class> interfaceType, Class> implementationClass) {
+ Assert.notNull(interfaceType, "Interface type must not be null");
+ Assert.isTrue(interfaceType.isInterface(), "The give type must be an interface");
+
+ if (implementationClass == null) {
+ // If the super class is Object parent then return null
+ return null;
+ }
+
+ // Get parameterized type
+ ParameterizedType currentType = getParameterizedType(interfaceType, implementationClass.getGenericInterfaces());
+
+ if (currentType != null) {
+ // return the current type
+ return currentType;
+ }
+
+ Class> superclass = implementationClass.getSuperclass();
+
+ return getParameterizedType(interfaceType, superclass);
+ }
+
+ /**
+ * Gets parameterized type by super class.
+ *
+ * @param superClassType super class type must not be null
+ * @param extensionClass extension class
+ * @return parameterized type or null
+ */
+ @Nullable
+ public static ParameterizedType getParameterizedTypeBySuperClass(@NonNull Class> superClassType, Class> extensionClass) {
+
+ if (extensionClass == null) {
+ return null;
+ }
+
+ return getParameterizedType(superClassType, extensionClass.getGenericSuperclass());
+ }
+}
diff --git a/sonic-server-controller/pom.xml b/sonic-server-controller/pom.xml
index 0abe67b9..5042fc24 100644
--- a/sonic-server-controller/pom.xml
+++ b/sonic-server-controller/pom.xml
@@ -4,13 +4,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
sonic-server
- com.sonic
+ org.cloud.sonic
1.0.0
4.0.0
sonic-server-controller
- v1.3.0-beta1
+ v1.3.0-beta2
jar
@@ -35,20 +35,54 @@
org.springframework.boot
spring-boot-starter-undertow
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
mysql
mysql-connector-java
runtime
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.4.3.4
+
+
+
+ com.gitee.sunchenbin.mybatis.actable
+ mybatis-enhance-actable
+ 1.5.0.RELEASE
+
+
+ com.baomidou
+ mybatis-plus-annotation
+
+
+ org.springframework
+ spring-context
+
+
+ org.springframework
+ spring-tx
+
+
+ org.mybatis.scripting
+ mybatis-velocity
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+ commons-lang
+ commons-lang
+ 2.6
+
- com.sonic
+ org.cloud.sonic
sonic-server-common
1.1.0
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/controller/AgentsController.java b/sonic-server-controller/src/main/java/com/sonic/controller/controller/AgentsController.java
deleted file mode 100644
index 93e99566..00000000
--- a/sonic-server-controller/src/main/java/com/sonic/controller/controller/AgentsController.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.sonic.controller.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.sonic.common.config.WebAspect;
-import com.sonic.common.http.RespEnum;
-import com.sonic.common.http.RespModel;
-import com.sonic.controller.models.Agents;
-import com.sonic.controller.services.AgentsService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * @author ZhouYiXun
- * @des
- * @date 2021/8/28 21:49
- */
-@Api(tags = "Agent端相关")
-@RestController
-@RequestMapping("/agents")
-public class AgentsController {
- @Autowired
- private AgentsService agentsService;
-
- @WebAspect
- @ApiOperation(value = "查询所有Agent端", notes = "获取所有Agent端以及详细信息")
- @GetMapping("/list")
- public RespModel> findAgents() {
- return new RespModel(RespEnum.SEARCH_OK, agentsService.findAgents());
- }
-
- @WebAspect
- @PutMapping
- public RespModel save(@RequestBody JSONObject jsonObject) {
- agentsService.save(jsonObject);
- return new RespModel(RespEnum.HANDLE_OK);
- }
-
- @WebAspect
- @PutMapping("/updateName")
- public RespModel updateName(@RequestBody JSONObject jsonObject) {
- agentsService.updateName(jsonObject.getInteger("id"), jsonObject.getString("name"));
- return new RespModel(RespEnum.HANDLE_OK);
- }
-
- @WebAspect
- @GetMapping("/offLine")
- public RespModel offLine(@RequestParam(name = "id") int id) {
- agentsService.offLine(id);
- return new RespModel(RespEnum.HANDLE_OK);
- }
-
- @WebAspect
- @GetMapping("/auth")
- public RespModel auth(@RequestParam(name = "key") String key) {
- return new RespModel(RespEnum.SEARCH_OK, agentsService.auth(key));
- }
-
- @WebAspect
- @GetMapping("/findKeyById")
- public RespModel findKeyById(@RequestParam(name = "id") int id) {
- String key = agentsService.findKeyById(id);
- if (key != null) {
- return new RespModel(RespEnum.SEARCH_OK, key);
- } else {
- return new RespModel(RespEnum.ID_NOT_FOUND);
- }
- }
-
- @WebAspect
- @ApiOperation(value = "查询Agent端信息", notes = "获取对应id的Agent信息")
- @GetMapping
- public RespModel findOne(@RequestParam(name = "id") int id) {
- Agents agents = agentsService.findById(id);
- if (agents != null) {
- return new RespModel(RespEnum.SEARCH_OK, agents);
- } else {
- return new RespModel(RespEnum.ID_NOT_FOUND);
- }
- }
-
-}
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/controller/ElementsController.java b/sonic-server-controller/src/main/java/com/sonic/controller/controller/ElementsController.java
deleted file mode 100644
index d585d6a9..00000000
--- a/sonic-server-controller/src/main/java/com/sonic/controller/controller/ElementsController.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.sonic.controller.controller;
-
-import com.sonic.common.config.WebAspect;
-import com.sonic.common.http.RespEnum;
-import com.sonic.common.http.RespModel;
-import com.sonic.controller.models.Elements;
-import com.sonic.controller.services.ElementsService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@Api(tags = "控件元素管理相关")
-@RestController
-@RequestMapping("/elements")
-public class ElementsController {
- @Autowired
- private ElementsService elementsService;
-
- @WebAspect
- @ApiOperation(value = "查找控件元素列表1", notes = "查找对应项目id的控件元素列表")
- @ApiImplicitParams(value = {
- @ApiImplicitParam(name = "projectId", value = "项目id", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "eleTypes[]", value = "类型(多个)", dataTypeClass = String.class),
- @ApiImplicitParam(name = "name", value = "控件名称", dataTypeClass = String.class),
- @ApiImplicitParam(name = "type", value = "类型", dataTypeClass = String.class),
- @ApiImplicitParam(name = "page", value = "页码", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "pageSize", value = "页数据大小", dataTypeClass = Integer.class)
- })
- @GetMapping("/list")
- public RespModel> findAll(@RequestParam(name = "projectId") int projectId,
- @RequestParam(name = "type", required = false) String type,
- @RequestParam(name = "eleTypes[]", required = false) List eleTypes,
- @RequestParam(name = "name", required = false) String name,
- @RequestParam(name = "page") int page,
- @RequestParam(name = "pageSize") int pageSize) {
- Pageable pageable = PageRequest.of(page - 1, pageSize);
- return new RespModel(RespEnum.SEARCH_OK, elementsService.findAll(projectId, type, eleTypes, name, pageable));
- }
-
- @WebAspect
- @ApiOperation(value = "查找控件元素详情", notes = "查找对应id的对应控件元素详细信息")
- @ApiImplicitParam(name = "id", value = "控件元素id", dataTypeClass = Integer.class)
- @GetMapping
- public RespModel findById(@RequestParam(name = "id") int id) {
- Elements elements = elementsService.findById(id);
- if (elements != null) {
- return new RespModel(RespEnum.SEARCH_OK, elements);
- } else {
- return new RespModel(RespEnum.ID_NOT_FOUND);
- }
- }
-
- @WebAspect
- @ApiOperation(value = "删除控件元素", notes = "删除对应id的控件元素,当控件元素存在于用例或id不存在时,删除失败")
- @ApiImplicitParam(name = "id", value = "元素id", dataTypeClass = Integer.class)
- @DeleteMapping
- public RespModel delete(@RequestParam(name = "id") int id) {
- return elementsService.delete(id);
- }
-
- @WebAspect
- @ApiOperation(value = "更新控件元素", notes = "新增或更新控件元素信息,id为0时新增,否则为更新对应id的信息")
- @PutMapping
- public RespModel save(@Validated @RequestBody Elements elements) {
- if (elementsService.save(elements)) {
- return new RespModel(RespEnum.UPDATE_OK);
- } else {
- return new RespModel(-1, "操作失败!请检查控件元素值是否过长!");
- }
- }
-}
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/controller/StepsController.java b/sonic-server-controller/src/main/java/com/sonic/controller/controller/StepsController.java
deleted file mode 100644
index 4a25ae09..00000000
--- a/sonic-server-controller/src/main/java/com/sonic/controller/controller/StepsController.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package com.sonic.controller.controller;
-
-import com.sonic.common.config.WebAspect;
-import com.sonic.common.http.RespEnum;
-import com.sonic.common.http.RespModel;
-import com.sonic.controller.models.Steps;
-import com.sonic.controller.models.http.StepSort;
-import com.sonic.controller.services.StepsService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * @author ZhouYiXun
- * @des
- * @date 2021/9/19 11:45
- */
-@Api(tags = "操作步骤相关")
-@RestController
-@RequestMapping("/steps")
-public class StepsController {
- @Autowired
- private StepsService stepsService;
-
- @WebAspect
- @ApiOperation(value = "查找步骤列表", notes = "查找对应用例id下的步骤列表(分页)")
- @ApiImplicitParams(value = {
- @ApiImplicitParam(name = "projectId", value = "项目id", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "platform", value = "平台", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "page", value = "页码", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "pageSize", value = "页数据大小", dataTypeClass = Integer.class)
- })
- @GetMapping("/list")
- public RespModel> findAll(@RequestParam(name = "projectId") int projectId,
- @RequestParam(name = "platform") int platform,
- @RequestParam(name = "page") int page,
- @RequestParam(name = "pageSize") int pageSize) {
- Pageable pageable = PageRequest.of(page - 1, pageSize, Sort.by(Sort.Direction.DESC, "id"));
- return new RespModel(RespEnum.SEARCH_OK, stepsService.findByProjectIdAndPlatform(projectId, platform, pageable));
- }
-
- @WebAspect
- @ApiOperation(value = "查找步骤列表", notes = "查找对应用例id下的步骤列表")
- @ApiImplicitParam(name = "caseId", value = "测试用例id", dataTypeClass = Integer.class)
- @GetMapping("/listAll")
- public RespModel> findByCaseIdOrderBySort(@RequestParam(name = "caseId") int caseId) {
- return new RespModel(RespEnum.SEARCH_OK, stepsService.findByCaseIdOrderBySort(caseId));
- }
-
- @WebAspect
- @ApiOperation(value = "移出测试用例", notes = "将步骤从测试用例移出")
- @ApiImplicitParam(name = "id", value = "步骤id", dataTypeClass = Integer.class)
- @GetMapping("/resetCaseId")
- public RespModel resetCaseId(@RequestParam(name = "id") int id) {
- if (stepsService.resetCaseId(id)) {
- return new RespModel(2000, "移出测试用例成功!");
- } else {
- return new RespModel(RespEnum.ID_NOT_FOUND);
- }
- }
-
- @WebAspect
- @ApiOperation(value = "删除操作步骤", notes = "将步骤删除,并且从所有公共步骤里移除")
- @ApiImplicitParam(name = "id", value = "步骤id", dataTypeClass = Integer.class)
- @DeleteMapping
- public RespModel delete(@RequestParam(name = "id") int id) {
- if (stepsService.delete(id)) {
- return new RespModel(RespEnum.DELETE_OK);
- } else {
- return new RespModel(RespEnum.DELETE_ERROR);
- }
- }
-
- @WebAspect
- @ApiOperation(value = "更新操作步骤", notes = "新增或更新操作步骤")
- @PutMapping
- public RespModel save(@Validated @RequestBody Steps steps) {
- stepsService.save(steps);
- return new RespModel(RespEnum.UPDATE_OK);
- }
-
- @WebAspect
- @ApiOperation(value = "拖拽排序步骤", notes = "用于前端页面拖拽排序步骤")
- @PutMapping("/stepSort")
- public RespModel stepSort(@Validated @RequestBody StepSort stepSort) {
- stepsService.sortSteps(stepSort);
- return new RespModel(RespEnum.UPDATE_OK);
- }
-
- @WebAspect
- @ApiOperation(value = "查询步骤详情", notes = "查询对应步骤id的详情信息")
- @ApiImplicitParam(name = "id", value = "步骤id", dataTypeClass = Integer.class)
- @GetMapping
- public RespModel findById(@RequestParam(name = "id") int id) {
- Steps steps = stepsService.findById(id);
- if (steps != null) {
- return new RespModel(RespEnum.SEARCH_OK, steps);
- } else {
- return new RespModel(RespEnum.ID_NOT_FOUND);
- }
- }
-}
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/dao/AgentsRepository.java b/sonic-server-controller/src/main/java/com/sonic/controller/dao/AgentsRepository.java
deleted file mode 100644
index b63e085c..00000000
--- a/sonic-server-controller/src/main/java/com/sonic/controller/dao/AgentsRepository.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.sonic.controller.dao;
-
-import com.sonic.controller.models.Agents;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-
-import java.util.List;
-
-/**
- * @author ZhouYiXun
- * @des Agent数据库操作
- * @date 2021/8/16 20:29
- */
-public interface AgentsRepository extends JpaRepository {
- Agents findBySecretKey(String key);
-}
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/dao/DevicesRepository.java b/sonic-server-controller/src/main/java/com/sonic/controller/dao/DevicesRepository.java
deleted file mode 100644
index 92e7d560..00000000
--- a/sonic-server-controller/src/main/java/com/sonic/controller/dao/DevicesRepository.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.sonic.controller.dao;
-
-import com.sonic.controller.models.Devices;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.jpa.repository.Query;
-
-import java.util.List;
-
-/**
- * @author ZhouYiXun
- * @des Devices数据库操作
- * @date 2021/8/16 20:29
- */
-public interface DevicesRepository extends JpaRepository, JpaSpecificationExecutor {
- Devices findByAgentIdAndUdId(int agentId, String udId);
-
- List findByAgentId(int agentId);
-
- List findByIdIn(List ids);
-
- List findByPlatformOrderByIdDesc(int platform);
-
- @Query(value = "select avg(temperature) as avg from devices " +
- "where temperature <> 0 and status in (?1)", nativeQuery = true)
- Integer findTemper(List ids);
-
- @Query(value = "select cpu from devices group by cpu", nativeQuery = true)
- List findCpuList();
-
- @Query(value = "select size from devices group by size", nativeQuery = true)
- List findSizeList();
-}
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/dao/ElementsRepository.java b/sonic-server-controller/src/main/java/com/sonic/controller/dao/ElementsRepository.java
deleted file mode 100644
index c4efa4fe..00000000
--- a/sonic-server-controller/src/main/java/com/sonic/controller/dao/ElementsRepository.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.sonic.controller.dao;
-
-import com.sonic.controller.models.Elements;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-/**
- * @author ZhouYiXun
- * @des Elements数据库操作
- * @date 2021/8/16 20:29
- */
-public interface ElementsRepository extends JpaRepository, JpaSpecificationExecutor {
- @Transactional
- void deleteByProjectId(int projectId);
-}
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/dao/GlobalParamsRepository.java b/sonic-server-controller/src/main/java/com/sonic/controller/dao/GlobalParamsRepository.java
deleted file mode 100644
index 9d7b5313..00000000
--- a/sonic-server-controller/src/main/java/com/sonic/controller/dao/GlobalParamsRepository.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.sonic.controller.dao;
-
-import com.sonic.controller.models.GlobalParams;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-/**
- * @author ZhouYiXun
- * @des GlobalParams数据库操作
- * @date 2021/8/20 20:29
- */
-public interface GlobalParamsRepository extends JpaRepository {
- List findByProjectId(int projectId);
-
- @Transactional
- void deleteByProjectId(int projectId);
-}
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/dao/ModulesRepository.java b/sonic-server-controller/src/main/java/com/sonic/controller/dao/ModulesRepository.java
deleted file mode 100644
index 30d50934..00000000
--- a/sonic-server-controller/src/main/java/com/sonic/controller/dao/ModulesRepository.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.sonic.controller.dao;
-
-import com.sonic.controller.models.Modules;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-/**
- * @author ZhouYiXun
- * @des Modules数据库操作
- * @date 2021/8/16 20:29
- */
-public interface ModulesRepository extends JpaRepository {
- List findByProjectId(int projectId);
-
- @Transactional
- void deleteByProjectId(int projectId);
-}
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/dao/ProjectsRepository.java b/sonic-server-controller/src/main/java/com/sonic/controller/dao/ProjectsRepository.java
deleted file mode 100644
index ebbd039c..00000000
--- a/sonic-server-controller/src/main/java/com/sonic/controller/dao/ProjectsRepository.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.sonic.controller.dao;
-
-import com.sonic.controller.models.Projects;
-import org.springframework.data.jpa.repository.JpaRepository;
-
-public interface ProjectsRepository extends JpaRepository {
-}
diff --git a/sonic-server-controller/src/main/java/com/sonic/controller/dao/PublicStepsRepository.java b/sonic-server-controller/src/main/java/com/sonic/controller/dao/PublicStepsRepository.java
deleted file mode 100644
index b9755982..00000000
--- a/sonic-server-controller/src/main/java/com/sonic/controller/dao/PublicStepsRepository.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.sonic.controller.dao;
-
-import com.sonic.controller.models.PublicSteps;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author ZhouYiXun
- * @des PublicSteps数据库操作
- * @date 2021/8/16 20:29
- */
-public interface PublicStepsRepository extends JpaRepository {
- Page findByProjectId(int projectId, Pageable pageable);
-
- @Query(value = "select id,name from public_steps where project_id=?1 and platform=?2 order by id desc", nativeQuery = true)
- List