From 609c674dc843492b8fb9fbfa067002570e8dd3f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jun 2020 20:04:17 +0000 Subject: [PATCH 01/46] Bump spring-core from 5.0.8.RELEASE to 5.0.11.RELEASE in /common Bumps [spring-core](https://github.com/spring-projects/spring-framework) from 5.0.8.RELEASE to 5.0.11.RELEASE. - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v5.0.8.RELEASE...v5.0.11.RELEASE) Signed-off-by: dependabot[bot] --- common/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/pom.xml b/common/pom.xml index 638cf4c2..050d679b 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -26,7 +26,7 @@ org.springframework spring-core - 5.0.8.RELEASE + 5.0.11.RELEASE From 002ecc53025c19e11f71201b8103b36f12f9da24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 18 Jun 2020 15:52:25 +0000 Subject: [PATCH 02/46] Bump jackson-databind from 2.9.10.4 to 2.10.0.pr1 in /common/web Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.9.10.4 to 2.10.0.pr1. - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Signed-off-by: dependabot[bot] --- common/web/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/web/pom.xml b/common/web/pom.xml index 0fa5bacd..612e5a2b 100644 --- a/common/web/pom.xml +++ b/common/web/pom.xml @@ -44,7 +44,7 @@ com.fasterxml.jackson.core jackson-databind - 2.9.10.4 + 2.10.0.pr1 From fa6a0dce1ce9286a0dee4d343d59e408203e43f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 18 Jun 2020 16:00:46 +0000 Subject: [PATCH 03/46] Bump jackson-databind in /auth/authorization-server Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.9.10.4 to 2.10.0.pr1. - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Signed-off-by: dependabot[bot] --- auth/authorization-server/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/authorization-server/pom.xml b/auth/authorization-server/pom.xml index 203ee9ab..0441ff61 100644 --- a/auth/authorization-server/pom.xml +++ b/auth/authorization-server/pom.xml @@ -31,7 +31,7 @@ com.fasterxml.jackson.core jackson-databind - 2.9.10.4 + 2.10.0.pr1 compile From 461773844de8f575681e44cabf7da86e5462e614 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2020 00:25:17 +0000 Subject: [PATCH 04/46] Bump mysql-connector-java from 5.1.39 to 8.0.16 in /demos/producer Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 5.1.39 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/5.1.39...8.0.16) Signed-off-by: dependabot[bot] --- demos/producer/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/producer/pom.xml b/demos/producer/pom.xml index 21dd6e78..11ee87f0 100644 --- a/demos/producer/pom.xml +++ b/demos/producer/pom.xml @@ -50,7 +50,7 @@ mysql mysql-connector-java - 5.1.39 + 8.0.16 org.flywaydb From caae259984eb392cced74621a1905867910b430b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2020 00:26:56 +0000 Subject: [PATCH 05/46] Bump mysql-connector-java from 5.1.39 to 8.0.16 in /webapps Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 5.1.39 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/5.1.39...8.0.16) Signed-off-by: dependabot[bot] --- webapps/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapps/pom.xml b/webapps/pom.xml index ee5cc23a..c1412c41 100644 --- a/webapps/pom.xml +++ b/webapps/pom.xml @@ -42,7 +42,7 @@ mysql mysql-connector-java - 5.1.39 + 8.0.16 org.flywaydb From a1b6a0005336d8a5d02c76a58d77784282b5887d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2020 00:27:44 +0000 Subject: [PATCH 06/46] Bump mysql-connector-java from 5.1.39 to 8.0.16 in /demos/producer-jpa Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 5.1.39 to 8.0.16. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/5.1.39...8.0.16) Signed-off-by: dependabot[bot] --- demos/producer-jpa/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/producer-jpa/pom.xml b/demos/producer-jpa/pom.xml index 325cf5b5..98d98a64 100644 --- a/demos/producer-jpa/pom.xml +++ b/demos/producer-jpa/pom.xml @@ -61,7 +61,7 @@ mysql mysql-connector-java - 5.1.39 + 8.0.16 From 13483a23ccd1c139a471821cd3dd80354564921b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2020 00:23:43 +0000 Subject: [PATCH 07/46] Bump junit from 4.12 to 4.13.1 in /auth/authentication-client Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1. - [Release notes](https://github.com/junit-team/junit4/releases) - [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md) - [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1) Signed-off-by: dependabot[bot] --- auth/authentication-client/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/authentication-client/pom.xml b/auth/authentication-client/pom.xml index af6e9be0..03da59c8 100644 --- a/auth/authentication-client/pom.xml +++ b/auth/authentication-client/pom.xml @@ -71,7 +71,7 @@ junit junit - 4.12 + 4.13.1 test From baf3e0a5d02246f489df4fff750b50c1727de5cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2020 08:09:15 +0000 Subject: [PATCH 08/46] Bump junit from 4.12 to 4.13.1 in /common Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1. - [Release notes](https://github.com/junit-team/junit4/releases) - [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md) - [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1) Signed-off-by: dependabot[bot] --- common/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/pom.xml b/common/pom.xml index 050d679b..e3aa63da 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -39,7 +39,7 @@ junit junit - 4.12 + 4.13.1 test From 09518af1a9a4c5f86812034033e5787d7baa019d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Apr 2021 18:14:30 +0000 Subject: [PATCH 09/46] Bump mybatis from 3.5.1 to 3.5.6 in /common/web Bumps [mybatis](https://github.com/mybatis/mybatis-3) from 3.5.1 to 3.5.6. - [Release notes](https://github.com/mybatis/mybatis-3/releases) - [Commits](https://github.com/mybatis/mybatis-3/compare/mybatis-3.5.1...mybatis-3.5.6) Signed-off-by: dependabot[bot] --- common/web/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/web/pom.xml b/common/web/pom.xml index 612e5a2b..655c5546 100644 --- a/common/web/pom.xml +++ b/common/web/pom.xml @@ -90,7 +90,7 @@ org.mybatis mybatis - 3.5.1 + 3.5.6 compile From 8b2c5bb4b87d9cbb788d4e964de8a2fb1d965ce3 Mon Sep 17 00:00:00 2001 From: fengdan <975728601@qq.com> Date: Thu, 1 Jul 2021 17:44:18 +0800 Subject: [PATCH 10/46] =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E5=AD=98=E5=82=A8=09Mi?= =?UTF-8?q?nio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docs/minio\351\203\250\347\275\262.md" | 53 ++++++++ object-storage/file-service/pom.xml | 99 ++++++++++++++ .../file-service/src/main/docker/Dockerfile | 4 + .../cloud/file/FileServiceApplication.java | 16 +++ .../cloud/file/configure/MinioConfigure.java | 36 +++++ .../cloud/file/configure/MinioProperties.java | 26 ++++ .../cloud/file/entity/FileObject.java | 22 ++++ .../GlobalExceptionHandlerAdvice.java | 21 +++ .../file/exception/MinioFileException.java | 22 ++++ .../cloud/file/exception/MinioFileType.java | 31 +++++ .../cloud/file/rest/FileController.java | 124 ++++++++++++++++++ .../cloud/file/service/FileService.java | 37 ++++++ .../file/service/MinIoFileServiceImpl.java | 62 +++++++++ .../cloud/file/util/MinioFileUtil.java | 110 ++++++++++++++++ .../src/main/resources/application.yml | 37 ++++++ .../src/main/resources/bootstrap.yml | 12 ++ .../file/FileServiceApplicationTests.java | 16 +++ object-storage/pom.xml | 22 ++++ 18 files changed, 750 insertions(+) create mode 100644 "object-storage/docs/minio\351\203\250\347\275\262.md" create mode 100644 object-storage/file-service/pom.xml create mode 100644 object-storage/file-service/src/main/docker/Dockerfile create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/FileServiceApplication.java create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioConfigure.java create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioProperties.java create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/entity/FileObject.java create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/GlobalExceptionHandlerAdvice.java create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileException.java create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileType.java create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/rest/FileController.java create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/service/FileService.java create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/service/MinIoFileServiceImpl.java create mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/util/MinioFileUtil.java create mode 100644 object-storage/file-service/src/main/resources/application.yml create mode 100644 object-storage/file-service/src/main/resources/bootstrap.yml create mode 100644 object-storage/file-service/src/test/java/com/springboot/cloud/file/FileServiceApplicationTests.java create mode 100644 object-storage/pom.xml diff --git "a/object-storage/docs/minio\351\203\250\347\275\262.md" "b/object-storage/docs/minio\351\203\250\347\275\262.md" new file mode 100644 index 00000000..e5613723 --- /dev/null +++ "b/object-storage/docs/minio\351\203\250\347\275\262.md" @@ -0,0 +1,53 @@ +### Minio 服务器 + + + +- docker 部署 + +```docker +docker pull minio/minio + +docker run -p 9000:9000 minio/minio server /data + +默认: +Access Key: minioadmin +Secret Key: minioadmin +``` +- docker 部署 MinIO自定义Access和Secret密钥 + + 要覆盖MinIO的自动生成的密钥,您可以将Access和Secret密钥设为环境变量。 MinIO允许常规字符串作为Access和Secret密钥。 +```docker +docker run -p 9000:9000 --name minio1 \ + -e "MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE" \ + -e "MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \ + -v /mnt/data:/data \ + -v /mnt/config:/root/.minio \ + minio/minio server /data +``` + + + +- macOS 部署 +```linux +brew install minio/stable/minio +minio server /data +``` + + + +- Windows系统 + + **下载二进制文件** + +| 操作系统 | CPU架构 | 地址 | +| --------------- | ------- | ------------------------------------------------------------ | +| 微软Windows系统 | 64位 | http://dl.minio.org.cn/server/minio/release/windows-amd64/minio.exe | + +```text +minio.exe server D:\Photos +``` + + + +Minio 文档 : http://docs.minio.org.cn/docs + diff --git a/object-storage/file-service/pom.xml b/object-storage/file-service/pom.xml new file mode 100644 index 00000000..16e6ae93 --- /dev/null +++ b/object-storage/file-service/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + + + com.springboot.cloud + object-storage + 0.0.1-SNAPSHOT + + + file-service + 0.0.1-SNAPSHOT + + file-service + + File Service project for Spring Boot + + + + io.minio + minio + 8.0.3 + + + org.apache.commons + commons-lang3 + + + commons-io + commons-io + 2.6 + + + commons-fileupload + commons-fileupload + 1.4 + + + commons-io + commons-io + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.springframework.boot + spring-boot-starter-web + + + com.springboot.cloud + web + 0.0.1-SNAPSHOT + + + + org.jetbrains.kotlin + kotlin-stdlib + 1.3.72 + + + + + + + + com.spotify + docker-maven-plugin + 1.2.0 + + + cike/${project.artifactId} + ${project.basedir}/src/main/docker + true + + + / + ${project.build.directory} + ${project.build.finalName}.jar + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 7 + 7 + + + + + + diff --git a/object-storage/file-service/src/main/docker/Dockerfile b/object-storage/file-service/src/main/docker/Dockerfile new file mode 100644 index 00000000..3c658eb7 --- /dev/null +++ b/object-storage/file-service/src/main/docker/Dockerfile @@ -0,0 +1,4 @@ +FROM java:alpine +VOLUME /tmp +ADD fileService-0.0.1-SNAPSHOT.jar app.jar +ENTRYPOINT ["java","-jar","/app.jar"] diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/FileServiceApplication.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/FileServiceApplication.java new file mode 100644 index 00000000..e7a230a8 --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/FileServiceApplication.java @@ -0,0 +1,16 @@ +package com.springboot.cloud.file; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; + +/** + * @author fengdan + */ +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) +public class FileServiceApplication { + public static void main(String[] args) { + SpringApplication.run(FileServiceApplication.class, args); + } +} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioConfigure.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioConfigure.java new file mode 100644 index 00000000..7624e4f8 --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioConfigure.java @@ -0,0 +1,36 @@ +package com.springboot.cloud.file.configure; + +import io.minio.MinioClient; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author fengdan + */ +@Configuration +@EnableConfigurationProperties(MinioProperties.class) +public class MinioConfigure { + + private final MinioProperties properties; + + public MinioConfigure(@Qualifier("minioProperties") MinioProperties properties) { + this.properties = properties; + } + + /** + * 构建客户端 + * + * @return MinioClient + */ + @Bean + public MinioClient minioClient() { + return MinioClient.builder() + .endpoint(properties.getEndpoint()) + .credentials(properties.getAccessKey(), properties.getSecretKey()) + .build(); + } +} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioProperties.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioProperties.java new file mode 100644 index 00000000..bc2576dc --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioProperties.java @@ -0,0 +1,26 @@ +package com.springboot.cloud.file.configure; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * @author fengdan + */ +@Data +@Component("minioProperties") +@ConfigurationProperties(prefix = "spring.minio") +public class MinioProperties { + /** + * 连接端点 + */ + private String endpoint; + /** + * 用户名 + */ + private String accessKey; + /** + * 密码 + */ + private String secretKey; +} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/entity/FileObject.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/entity/FileObject.java new file mode 100644 index 00000000..ce0b8123 --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/entity/FileObject.java @@ -0,0 +1,22 @@ +package com.springboot.cloud.file.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author fengdan + * @date 2021年07月01日 15:04 + */ +@ApiModel +@Data +public class FileObject { + @NotBlank(message = "不能为空") + @ApiModelProperty("文件名") + private String fileName; + @NotBlank(message = "不能为空") + @ApiModelProperty("存储空间(桶)") + private String bucketName; +} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/GlobalExceptionHandlerAdvice.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/GlobalExceptionHandlerAdvice.java new file mode 100644 index 00000000..11438153 --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/GlobalExceptionHandlerAdvice.java @@ -0,0 +1,21 @@ +package com.springboot.cloud.file.exception; + +import com.springboot.cloud.common.core.entity.vo.Result; +import com.springboot.cloud.common.web.exception.DefaultGlobalExceptionHandlerAdvice; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +/** + * @author fengdan + */ +@Slf4j +@RestControllerAdvice +public class GlobalExceptionHandlerAdvice extends DefaultGlobalExceptionHandlerAdvice { + + @ExceptionHandler(value = {MinioFileException.class}) + public Result uploadFileFailure(MinioFileException ex) { + log.error(ex.getMessage()); + return Result.fail(ex.getErrorType()); + } +} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileException.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileException.java new file mode 100644 index 00000000..40653359 --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileException.java @@ -0,0 +1,22 @@ +package com.springboot.cloud.file.exception; + +import com.springboot.cloud.common.core.exception.BaseException; +import com.springboot.cloud.common.core.exception.ErrorType; + +/** + * @author fengdan + * @date 2021年07月01日 14:38 + */ +public class MinioFileException extends BaseException { + public MinioFileException() { + super(MinioFileType.FILE_UPLOAD_FAILED); + } + + public MinioFileException(String message) { + super(MinioFileType.FILE_UPLOAD_FAILED, message); + } + + public MinioFileException(ErrorType errorType, String message) { + super(errorType, message); + } +} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileType.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileType.java new file mode 100644 index 00000000..42a4d65c --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileType.java @@ -0,0 +1,31 @@ +package com.springboot.cloud.file.exception; + +import com.springboot.cloud.common.core.exception.ErrorType; +import lombok.Getter; + +/** + * @author fengdan + * @date 2021年07月01日 14:39 + */ +@Getter +public enum MinioFileType implements ErrorType { + FILE_UPLOAD_FAILED("040100", "文件上传失败!"), + FILE_REMOVE_FAILED("040200", "文件删除失败!"), + FILE_GET_FAILED("040300", "获取文件失败!"), + FAILED_DOWNLOAD_FILE("040400", "下载文件失败!") + + ; + /** + * 错误类型码 + */ + private String code; + /** + * 错误类型描述信息 + */ + private String mesg; + + MinioFileType(String code, String mesg) { + this.code = code; + this.mesg = mesg; + } +} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/rest/FileController.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/rest/FileController.java new file mode 100644 index 00000000..719f3cf5 --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/rest/FileController.java @@ -0,0 +1,124 @@ +package com.springboot.cloud.file.rest; + +import com.springboot.cloud.common.core.entity.vo.Result; +import com.springboot.cloud.file.entity.FileObject; +import com.springboot.cloud.file.exception.MinioFileException; +import com.springboot.cloud.file.exception.MinioFileType; +import com.springboot.cloud.file.service.FileService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +/** + * @author fengdan + */ +@Api(tags = "文件管理") +@RestController +@RequestMapping(value = "/file") +public class FileController { + + private final FileService fileService; + + public FileController(@Qualifier("minioServiceImpl") FileService fileService) { + this.fileService = fileService; + } + + + @ApiOperation(value = "上传文件", notes = "上传文件", response = Result.class) + @PostMapping("/upload") + public Result upload(@RequestParam(value = "file") MultipartFile file, + @RequestParam(value = "bucketName") String bucketName) { + return Result.success(fileService.uploadFile(file, bucketName)); + } + + + @ApiOperation(value = "删除文件", notes = "删除文件", response = Result.class) + @DeleteMapping("/remove") + public Result remove(@Valid @RequestBody FileObject fileObject) { + fileService.removeFile(fileObject.getBucketName(), fileObject.getFileName()); + return Result.success(); + } + + + @ApiOperation(value = "预览图片", notes = "预览图片") + @GetMapping("/previewPicture/{fileName}") + public void previewPicture(@PathVariable("fileName") String objectName, + @RequestParam(value = "bucketName") String bucketName, + HttpServletResponse response) throws IOException { + response.setContentType("image/jpeg"); + try (ServletOutputStream out = response.getOutputStream()) { + InputStream stream = fileService.getObject(bucketName, objectName); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int n = 0; + while (-1 != (n = stream.read(buffer))) { + output.write(buffer, 0, n); + } + byte[] bytes = output.toByteArray(); + out.write(bytes); + out.flush(); + } + } + + + @ApiOperation(value = "下载文件到本地", notes = "下载文件到本地") + @GetMapping("/download/{fileName}") + public ResponseEntity download(@PathVariable("fileName") String objectName, + @RequestParam(value = "bucketName") String bucketName) throws Exception { + ResponseEntity responseEntity = null; + InputStream stream = null; + ByteArrayOutputStream output = null; + try { + stream = fileService.getObject(bucketName, objectName); + if (stream == null) { + throw new MinioFileException(MinioFileType.FAILED_DOWNLOAD_FILE, ""); + } + //用于转换byte + output = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int n = 0; + while (-1 != (n = stream.read(buffer))) { + output.write(buffer, 0, n); + } + byte[] bytes = output.toByteArray(); + + //设置header + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add("Accept-Ranges", "bytes"); + httpHeaders.add("Content-Length", bytes.length + ""); + objectName = new String(objectName.getBytes(StandardCharsets.UTF_8), "ISO8859-1"); + //把文件名按UTF-8取出并按ISO8859-1编码,保证弹出窗口中的文件名中文不乱码,中文不要太多,最多支持17个中文,因为header有150个字节限制。 + httpHeaders.add("Content-disposition", "attachment; filename=" + objectName); + httpHeaders.add("Content-Type", "text/plain;charset=utf-8"); + responseEntity = new ResponseEntity(bytes, httpHeaders, HttpStatus.CREATED); + } finally { + if (stream != null) { + stream.close(); + } + if (output != null) { + output.close(); + } + } + return responseEntity; + } +} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/FileService.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/FileService.java new file mode 100644 index 00000000..05b1ef7d --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/FileService.java @@ -0,0 +1,37 @@ +package com.springboot.cloud.file.service; + +import org.springframework.web.multipart.MultipartFile; + +import java.io.InputStream; + +/** + * @author fengdan + */ +public interface FileService { + + /** + * 上传文件 + * + * @param file 文件 + * @param bucketName 存储空间(桶) + * @return file url + */ + String uploadFile(MultipartFile file, String bucketName); + + /** + * 删除文件 + * + * @param bucketName 存储空间(桶) + * @param objectName 文件名 + */ + void removeFile(String bucketName, String objectName); + + /** + * 获取文件 + * + * @param bucketName 存储空间(桶) + * @param objectName 文件名 + * @return 进制流 + */ + InputStream getObject(String bucketName, String objectName); +} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/MinIoFileServiceImpl.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/MinIoFileServiceImpl.java new file mode 100644 index 00000000..22af14c2 --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/MinIoFileServiceImpl.java @@ -0,0 +1,62 @@ +package com.springboot.cloud.file.service; + +import com.springboot.cloud.file.exception.MinioFileException; +import com.springboot.cloud.file.exception.MinioFileType; +import com.springboot.cloud.file.util.MinioFileUtil; +import io.minio.errors.ErrorResponseException; +import io.minio.errors.InsufficientDataException; +import io.minio.errors.InternalException; +import io.minio.errors.InvalidResponseException; +import io.minio.errors.ServerException; +import io.minio.errors.XmlParserException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.InputStream; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +/** + * @author fengdan + */ +@Slf4j +@Service("minioServiceImpl") +@RequiredArgsConstructor +public class MinIoFileServiceImpl implements FileService { + + private final MinioFileUtil minioFileUtil; + + @Override + public String uploadFile(MultipartFile file, String bucketName) { + try { + return this.minioFileUtil.uploadFile(file, bucketName); + } catch (IOException | ServerException | InsufficientDataException | ErrorResponseException | NoSuchAlgorithmException | InvalidKeyException | InvalidResponseException | XmlParserException | InternalException e) { + log.error("文件上传失败:" + e.getMessage(), e); + throw new MinioFileException(); + } + } + + + @Override + public void removeFile(String bucketName, String objectName) { + try { + this.minioFileUtil.removeFile(bucketName, objectName); + } catch (ServerException | InsufficientDataException | ErrorResponseException | IOException | NoSuchAlgorithmException | InvalidKeyException | InvalidResponseException | XmlParserException | InternalException e) { + log.error("文件删除失败:" + e.getMessage(), e); + throw new MinioFileException(MinioFileType.FILE_REMOVE_FAILED, "文件删除失败"); + } + } + + @Override + public InputStream getObject(String salt, String objectName) { + try { + return this.minioFileUtil.getObject(salt, objectName); + } catch (Exception e) { + log.error("获取文件失败:" + e.getMessage(), e); + throw new MinioFileException(MinioFileType.FILE_GET_FAILED, e.getMessage()); + } + } +} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/util/MinioFileUtil.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/util/MinioFileUtil.java new file mode 100644 index 00000000..56151113 --- /dev/null +++ b/object-storage/file-service/src/main/java/com/springboot/cloud/file/util/MinioFileUtil.java @@ -0,0 +1,110 @@ +package com.springboot.cloud.file.util; + +import com.springboot.cloud.file.configure.MinioProperties; +import io.minio.BucketExistsArgs; +import io.minio.GetObjectArgs; +import io.minio.MakeBucketArgs; +import io.minio.MinioClient; +import io.minio.PutObjectArgs; +import io.minio.RemoveObjectArgs; +import io.minio.errors.ErrorResponseException; +import io.minio.errors.InsufficientDataException; +import io.minio.errors.InternalException; +import io.minio.errors.InvalidResponseException; +import io.minio.errors.ServerException; +import io.minio.errors.XmlParserException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.InputStream; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Random; + +/** + * @author fengdan + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class MinioFileUtil { + + private final MinioProperties minioProperties; + + private final MinioClient client; + + /** + * 创建bucket + * + * @param bucketName 存储空间(桶) + */ + public void createBucket(String bucketName) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException { + BucketExistsArgs build = BucketExistsArgs.builder().bucket(bucketName).build(); + //判断 bucketName 是否存在 + if (!client.bucketExists(build)) { + client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build()); + } + } + + /** + * 上传文件 + * + * @param file 文件 + * @param bucketName 存储空间(桶) + * @return file url + */ + public String uploadFile(MultipartFile file, String bucketName) throws + IOException, ServerException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException { + //判断文件是否为空 + if (file == null || file.getSize() == 0) { + return null; + } + //判断存储桶是否存在,不存在则创建 + createBucket(bucketName); + //获取文件名 + String originalFilename = file.getOriginalFilename(); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + assert originalFilename != null; + //文件重名处理,bucketName+时间戳+随机数 + String fileName = bucketName + "_" + + System.currentTimeMillis() + "_" + format.format(new Date()) + "_" + new Random().nextInt(1000) + + originalFilename.substring(originalFilename.lastIndexOf(".")); + //上传 + client.putObject(PutObjectArgs.builder() + .bucket(bucketName) + .object(fileName) + .stream(file.getInputStream(), file.getSize(), -1) + .contentType(file.getContentType()) + .build()); + return minioProperties.getEndpoint() + "/" + bucketName + "/" + fileName; + } + + /** + * 删除文件 + * + * @param bucketName 存储空间(桶) + * @param objectName ⽂件名称 + */ + public void removeFile(String bucketName, String objectName) throws + ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException { + client.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); + } + + /** + * 获取⽂件 + * + * @param bucketName bucket名称 + * @param objectName ⽂件名称 + * @return ⼆进制流 + */ + public InputStream getObject(String bucketName, String objectName) throws Exception { + return client.getObject(GetObjectArgs.builder().bucket(bucketName).object(objectName).build()); + } + + +} diff --git a/object-storage/file-service/src/main/resources/application.yml b/object-storage/file-service/src/main/resources/application.yml new file mode 100644 index 00000000..4571b914 --- /dev/null +++ b/object-storage/file-service/src/main/resources/application.yml @@ -0,0 +1,37 @@ +spring: + minio: + endpoint: http://localhost:9000 + accessKey: minioadmin + secretKey: minioadmin + rabbitmq: + host: ${RABBIT_MQ_HOST:localhost} + port: ${RABBIT_MQ_PORT:5672} + username: ${RABBIT_MQ_USERNAME:guest} + password: ${RABBIT_MQ_PASSWORD:guest} + redis: + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + lettuce: + pool: + max-active: 300 + #password: ${REDIS_PASSWORD:123456} + mvc: + throw-exception-if-no-handler-found: true + servlet: + multipart: + max-request-size: "2MB" + max-file-size: "2MB" + jackson: + time-zone: GMT+8 +logging: + level: + com.springboot.cloud.file: debug + path: logs/${spring.application.name} + file: + max-size: 1GB + +management: + endpoints: + web: + exposure: + include: '*' diff --git a/object-storage/file-service/src/main/resources/bootstrap.yml b/object-storage/file-service/src/main/resources/bootstrap.yml new file mode 100644 index 00000000..39779854 --- /dev/null +++ b/object-storage/file-service/src/main/resources/bootstrap.yml @@ -0,0 +1,12 @@ +server: + port: ${SERVER_PORT:8011} +spring: + application: + name: file-service + cloud: + nacos: + discovery: + server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848} + config: + server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848} + file-extension: yml diff --git a/object-storage/file-service/src/test/java/com/springboot/cloud/file/FileServiceApplicationTests.java b/object-storage/file-service/src/test/java/com/springboot/cloud/file/FileServiceApplicationTests.java new file mode 100644 index 00000000..549ae2cf --- /dev/null +++ b/object-storage/file-service/src/test/java/com/springboot/cloud/file/FileServiceApplicationTests.java @@ -0,0 +1,16 @@ +//package com.springboot.cloud.file; +// +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.springframework.boot.test.context.SpringBootTest; +//import org.springframework.test.context.junit4.SpringRunner; +// +//@SpringBootTest +//@RunWith(SpringRunner.class) +//class FileServiceApplicationTests { +// +// @Test +// void contextLoads() { +// } +// +//} diff --git a/object-storage/pom.xml b/object-storage/pom.xml new file mode 100644 index 00000000..86a52111 --- /dev/null +++ b/object-storage/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + object-storage + 0.0.1-SNAPSHOT + pom + + object-storage + Object Storage project for Spring Boot + + + cloud + com.springboot.cloud + 0.0.1-SNAPSHOT + + + + file-service + + From b9db813d5ed3f31811493dc26fc04e9c03d2f84e Mon Sep 17 00:00:00 2001 From: fengdan <975728601@qq.com> Date: Thu, 1 Jul 2021 17:47:16 +0800 Subject: [PATCH 11/46] =?UTF-8?q?=E7=A7=BB=E9=99=A4=20kotlin-stdlib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- object-storage/file-service/pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/object-storage/file-service/pom.xml b/object-storage/file-service/pom.xml index 16e6ae93..26db7dae 100644 --- a/object-storage/file-service/pom.xml +++ b/object-storage/file-service/pom.xml @@ -56,12 +56,6 @@ web 0.0.1-SNAPSHOT - - - org.jetbrains.kotlin - kotlin-stdlib - 1.3.72 - From c04ca418749f16f23ab1df03526b38baca65b592 Mon Sep 17 00:00:00 2001 From: fengdan <975728601@qq.com> Date: Thu, 1 Jul 2021 18:12:08 +0800 Subject: [PATCH 12/46] =?UTF-8?q?MySQL=208.0.21=20=E7=89=88=E6=9C=AC,?= =?UTF-8?q?=E5=9C=A8=E5=88=9B=E5=BB=BA=20sc=5Fadmin=20schema=20,=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=84=E8=A1=A8=E5=90=8D=E4=B8=BA=20groups=20?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E4=B8=BA=20=E5=85=B3=E9=94=AE=E5=AD=97,?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E4=BF=AE=E6=94=B9=E4=B8=BA=20t=5Fgroups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sysadmin/db/db.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysadmin/db/db.sql b/sysadmin/db/db.sql index 3d45d828..a2793eff 100644 --- a/sysadmin/db/db.sql +++ b/sysadmin/db/db.sql @@ -5,8 +5,8 @@ CREATE DATABASE sc_admin DEFAULT CHARSET utf8mb4; USE sc_admin; -- 用户组表 -DROP TABLE IF EXISTS groups; -CREATE TABLE groups +DROP TABLE IF EXISTS t_groups; +CREATE TABLE t_groups ( id VARCHAR(20) PRIMARY KEY COMMENT 'id', parent_id VARCHAR(20) NOT NULL COMMENT '用户组父id', From 78e84838ea4dc752508a96a3e5e47a92690e5b90 Mon Sep 17 00:00:00 2001 From: fengdan <975728601@qq.com> Date: Thu, 1 Jul 2021 18:13:37 +0800 Subject: [PATCH 13/46] =?UTF-8?q?MySQL=208.0.21=20=E7=89=88=E6=9C=AC,?= =?UTF-8?q?=E5=9C=A8=E5=88=9B=E5=BB=BA=20sc=5Fadmin=20schema=20,=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=84=E8=A1=A8=E5=90=8D=E4=B8=BA=20groups=20?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E4=B8=BA=20=E5=85=B3=E9=94=AE=E5=AD=97,?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E4=BF=AE=E6=94=B9=E4=B8=BA=20t=5Fgroups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sysadmin/db/db.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysadmin/db/db.sql b/sysadmin/db/db.sql index a2793eff..69787cab 100644 --- a/sysadmin/db/db.sql +++ b/sysadmin/db/db.sql @@ -270,7 +270,7 @@ VALUES (101, '首席执行官', '公司CEO,负责公司整体运转', now(), n (102, '首席运营官', '公司COO,负责公司整体运营', now(), now(), 'system', 'system'), (103, '首席技术官', '公司CTO,负责公司整体运营', now(), now(), 'system', 'system'); -- 用户组 -INSERT INTO groups (id, parent_id, name, description, created_time, updated_time, created_by, updated_by) +INSERT INTO t_groups (id, parent_id, name, description, created_time, updated_time, created_by, updated_by) VALUES (101, -1, '总公司', '总公司', now(), now(), 'system', 'system'), (102, 101, '上海分公司', '上海分公司', now(), now(), 'system', 'system'), (103, 102, '研发部门', '负责产品研发', now(), now(), 'system', 'system'), From 4efb963a97fcf68f72887bf3939b7517d7af2c7f Mon Sep 17 00:00:00 2001 From: zhoutaoo Date: Thu, 5 Aug 2021 13:00:14 +0800 Subject: [PATCH 14/46] Update pom.xml 2.9.10.8 --- common/web/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/web/pom.xml b/common/web/pom.xml index 612e5a2b..5425f271 100644 --- a/common/web/pom.xml +++ b/common/web/pom.xml @@ -44,7 +44,7 @@ com.fasterxml.jackson.core jackson-databind - 2.10.0.pr1 + 2.9.10.8 From dd8ee73e192242ad3476199ef72e58c9664aad1f Mon Sep 17 00:00:00 2001 From: zhoutaoo Date: Thu, 5 Aug 2021 13:00:35 +0800 Subject: [PATCH 15/46] Update pom.xml 2.9.10.8 --- auth/authorization-server/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/authorization-server/pom.xml b/auth/authorization-server/pom.xml index 0441ff61..b5066206 100644 --- a/auth/authorization-server/pom.xml +++ b/auth/authorization-server/pom.xml @@ -31,7 +31,7 @@ com.fasterxml.jackson.core jackson-databind - 2.10.0.pr1 + 2.9.10.8 compile From 7f0ba18b6e26a813bce662c2b86e130b6e701aac Mon Sep 17 00:00:00 2001 From: Korov Date: Sat, 4 Sep 2021 13:22:18 +0800 Subject: [PATCH 16/46] perf:thin install command --- readme.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 80729f94..38f1d425 100644 --- a/readme.md +++ b/readme.md @@ -22,9 +22,7 @@ linux和mac下可在项目根目录下执行 `./install.sh` 快速搭建开发 2. 安装公共库到本地仓库: -`cd common && mvn install` - -`cd auth/authentication-client && mvn install` +`mvn -pl ./common,./auth/authentication-client install -DskipTests` 3. 生成ide配置: `mvn idea:idea`或`mvn eclipse:eclipse` 并导入对应的ide进行开发,IDE安装lombok插件(很重要,否则IDE会显示编译报错) From d6a882110aab1cdc614cf2be0c7f67f3898e0a5c Mon Sep 17 00:00:00 2001 From: Korov Date: Sat, 4 Sep 2021 14:37:49 +0800 Subject: [PATCH 17/46] fix:update docker compose config --- docker-compose/docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index f3b3228b..77521cc3 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -43,6 +43,7 @@ services: mysql-init: image: mysql:5.7 + container_name: sc-mysql-init command: /init-db.sh networks: - sc-net @@ -53,6 +54,8 @@ services: - ./init-db.sh:/init-db.sh environment: MYSQL_ROOT_PASSWORD: root123 + depends_on: + - mysql networks: sc-net: From 28c54cfe158163f0d7eb6b4a06a55e4ac29f4bb1 Mon Sep 17 00:00:00 2001 From: Korov Date: Sat, 4 Sep 2021 14:44:38 +0800 Subject: [PATCH 18/46] perf:thin install command --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 38f1d425..5b98edda 100644 --- a/readme.md +++ b/readme.md @@ -22,7 +22,7 @@ linux和mac下可在项目根目录下执行 `./install.sh` 快速搭建开发 2. 安装公共库到本地仓库: -`mvn -pl ./common,./auth/authentication-client install -DskipTests` +`mvn -pl ./common,./auth/authentication-client install` 3. 生成ide配置: `mvn idea:idea`或`mvn eclipse:eclipse` 并导入对应的ide进行开发,IDE安装lombok插件(很重要,否则IDE会显示编译报错) From 031d7d63634408937d06bb67493a5b7fcb31b76b Mon Sep 17 00:00:00 2001 From: wayne Date: Mon, 6 Sep 2021 22:38:52 +0800 Subject: [PATCH 19/46] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=89=B4=E6=9D=83?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auth/data-authentication-server/pom.xml | 19 +++++++ auth/pom.xml | 2 +- .../organization/dao/PermissionMapper.java | 11 ++++ .../entity/form/PermissionForm.java | 50 +++++++++++++++++++ .../organization/entity/po/Permission.java | 45 +++++++++++++++++ .../service/IPermissionService.java | 4 ++ .../service/impl/PermissionService.java | 8 +++ 7 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 auth/data-authentication-server/pom.xml create mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java create mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PermissionForm.java create mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java create mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java create mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java diff --git a/auth/data-authentication-server/pom.xml b/auth/data-authentication-server/pom.xml new file mode 100644 index 00000000..207cd3e1 --- /dev/null +++ b/auth/data-authentication-server/pom.xml @@ -0,0 +1,19 @@ + + + + auth + com.springboot.cloud + 0.0.1-SNAPSHOT + + 4.0.0 + + data-authentication-server + + + 8 + 8 + + + \ No newline at end of file diff --git a/auth/pom.xml b/auth/pom.xml index a426a1b3..669b33a3 100644 --- a/auth/pom.xml +++ b/auth/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.springboot.cloud auth 0.0.1-SNAPSHOT pom @@ -21,6 +20,7 @@ authentication-server authentication-client authorization-server + data-authentication-server diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java new file mode 100644 index 00000000..148b1a7a --- /dev/null +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java @@ -0,0 +1,11 @@ +package com.springboot.cloud.sysadmin.organization.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.springboot.cloud.sysadmin.organization.entity.po.Permission; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Repository +@Mapper +public interface PermissionMapper extends BaseMapper { +} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PermissionForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PermissionForm.java new file mode 100644 index 00000000..804a54c8 --- /dev/null +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PermissionForm.java @@ -0,0 +1,50 @@ +package com.springboot.cloud.sysadmin.organization.entity.form; + +import com.springboot.cloud.common.web.entity.form.BaseForm; +import com.springboot.cloud.sysadmin.organization.entity.po.Permission; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotBlank; + +/** + * 数据权限DTO + * + * @author wayne + * @date 2021/09/06 + */ +public class PermissionForm extends BaseForm { + /** + * 资源类型:hive,hdfs + */ + @NotBlank(message = "资源类型不能为空") + @ApiModelProperty(value = "资源类型") + private String resType; + + /** + * 资源地区 + */ + @NotBlank(message = "资源地区不能为空") + @ApiModelProperty(value = "资源地区") + private String area; + + /** + * 资源完整路径 + */ + @NotBlank(message = "资源路径不能为空") + @ApiModelProperty(value = "资源路径") + private String resFullPath; + + /** + * 资源全名 + */ + @NotBlank(message = "资源名称不能为空") + @ApiModelProperty(value = "资源名称") + private String resFullName; + + /** + * 资源操作位:读,写,查询 + */ + @NotBlank(message = "资源操作位不能为空") + @ApiModelProperty(value = "资源操作位") + private String operationBit; +} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java new file mode 100644 index 00000000..c35df4ad --- /dev/null +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java @@ -0,0 +1,45 @@ +package com.springboot.cloud.sysadmin.organization.entity.po; + +import com.springboot.cloud.common.web.entity.po.BasePo; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 数据权限资源 + * + * @author wayne + * @date 2021/09/06 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class Permission extends BasePo { + + /** + * 资源类型:hive,hdfs + */ + private String resType; + + /** + * 资源地区 + */ + private String area; + + /** + * 资源完整路径 + */ + private String resFullPath; + + /** + * 资源全名 + */ + private String resFullName; + + /** + * 资源操作位:读,写,查询 + */ + private String operationBit; +} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java new file mode 100644 index 00000000..cdce29d2 --- /dev/null +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java @@ -0,0 +1,4 @@ +package com.springboot.cloud.sysadmin.organization.service; + +public interface IPermissionService { +} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java new file mode 100644 index 00000000..600804a2 --- /dev/null +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java @@ -0,0 +1,8 @@ +package com.springboot.cloud.sysadmin.organization.service.impl; + +import com.springboot.cloud.sysadmin.organization.service.IPermissionService; +import org.springframework.stereotype.Service; + +@Service +public class PermissionService implements IPermissionService { +} From 803b95a90f38f03dffd0f9e95bb2fdacbe44f789 Mon Sep 17 00:00:00 2001 From: wayne Date: Mon, 13 Sep 2021 23:37:58 +0800 Subject: [PATCH 20/46] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E6=B5=81=E7=A8=8B=E6=90=AD=E5=BB=BA=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auth/authentication-client/pom.xml | 5 + .../auth/client/provider/AuthProvider.java | 18 +++ .../auth/client/service/IAuthService.java | 11 ++ .../auth/client/service/impl/AuthService.java | 6 + auth/authentication-server/pom.xml | 5 + .../auth/authentication/config/BusConfig.java | 95 ++++++++++++--- .../events/PermissionBusReceiver.java | 35 ++++++ ...Receiver.java => ResourceBusReceiver.java} | 2 +- .../provider/ResourceProvider.java | 11 +- .../provider/ResourceProviderFallback.java | 16 +++ .../rest/AuthenticationController.java | 14 +++ .../service/IAuthenticationService.java | 10 ++ .../authentication/service/IGroupService.java | 17 +++ .../service/IPermissionService.java | 36 ++++++ .../service/IResourceService.java | 4 +- .../service/impl/AuthenticationService.java | 34 ++++++ .../service/impl/GroupService.java | 23 ++++ .../service/impl/PermissionService.java | 61 ++++++++++ .../service/impl/ResourceService.java | 3 + auth/pom.xml | 1 - .../facade}/pom.xml | 4 +- .../constant/PermissionChangeTypeEnum.java | 21 ++++ .../cloud/sysadmin/facade/dto/GroupDTO.java | 27 +++++ .../facade/dto/PermissionChangeDTO.java | 26 +++++ .../sysadmin/facade/dto/PermissionDTO.java | 48 ++++++++ sysadmin/organization/pom.xml | 5 + .../organization/config/BusConfig.java | 7 +- .../dao/GroupPermissionMapper.java | 17 +++ .../organization/dao/PermissionMapper.java | 5 + .../organization/dao/UserGroupMapper.java | 17 +++ .../entity/po/GroupPermission.java | 24 ++++ .../organization/entity/po/Permission.java | 17 ++- .../organization/entity/po/UserGroup.java | 22 ++++ .../organization/rest/GroupController.java | 11 ++ .../rest/PermissionController.java | 33 ++++++ .../organization/service/IGroupService.java | 7 ++ .../service/IPermissionService.java | 44 +++++++ .../service/impl/GroupService.java | 33 ++++++ .../service/impl/PermissionService.java | 110 +++++++++++++++++- .../service/impl/ResourceService.java | 2 +- sysadmin/pom.xml | 1 + 41 files changed, 859 insertions(+), 29 deletions(-) create mode 100644 auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/PermissionBusReceiver.java rename auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/{BusReceiver.java => ResourceBusReceiver.java} (94%) create mode 100644 auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IGroupService.java create mode 100644 auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IPermissionService.java create mode 100644 auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/GroupService.java create mode 100644 auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/PermissionService.java rename {auth/data-authentication-server => sysadmin/facade}/pom.xml (86%) create mode 100644 sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java create mode 100644 sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java create mode 100644 sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java create mode 100644 sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java create mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupPermissionMapper.java create mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserGroupMapper.java create mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/GroupPermission.java create mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java create mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java diff --git a/auth/authentication-client/pom.xml b/auth/authentication-client/pom.xml index 03da59c8..b373f687 100644 --- a/auth/authentication-client/pom.xml +++ b/auth/authentication-client/pom.xml @@ -42,6 +42,11 @@ + + com.springboot.cloud + facade + 0.0.1-SNAPSHOT + com.springboot.cloud core diff --git a/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/provider/AuthProvider.java b/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/provider/AuthProvider.java index 2e7de9da..e016e7bd 100644 --- a/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/provider/AuthProvider.java +++ b/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/provider/AuthProvider.java @@ -1,6 +1,7 @@ package com.springboot.cloud.auth.client.provider; import com.springboot.cloud.common.core.entity.vo.Result; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; @@ -29,6 +30,10 @@ public interface AuthProvider { @PostMapping(value = "/auth/permission") Result auth(@RequestHeader(HttpHeaders.AUTHORIZATION) String authentication, @RequestParam("url") String url, @RequestParam("method") String method); + @PostMapping(value = "/auth/data/permission") + Result dataAuth(@RequestHeader(HttpHeaders.AUTHORIZATION) String authentication, @RequestParam("groupCode") String groupCode, @RequestParam("permissionDTO")PermissionDTO permissionDTO); + + @Component class AuthProviderFallback implements AuthProvider { /** @@ -49,5 +54,18 @@ class AuthProviderFallback implements AuthProvider { public Result auth(String authentication, String url, String method) { return Result.fail(); } + + /** + * 降级统一返回无权限 + * + * @param authentication 身份验证 + * @param groupCode 组织代码 + * @param permissionDTO 许可dto + * @return {@link Result} + */ + @Override + public Result dataAuth(String authentication, String groupCode, PermissionDTO permissionDTO) { + return Result.fail(); + } } } diff --git a/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/IAuthService.java b/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/IAuthService.java index c8aec207..06600f69 100644 --- a/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/IAuthService.java +++ b/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/IAuthService.java @@ -1,10 +1,21 @@ package com.springboot.cloud.auth.client.service; import com.springboot.cloud.common.core.entity.vo.Result; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jws; public interface IAuthService { + + /** + * 数据权限验证 + * + * @param authentication 身份验证 + * @param permissionDTO 许可dto + * @param groupCode 组织代码 + * @return {@link Result} + */ + Result dataAuthenticate(String authentication,String groupCode, PermissionDTO permissionDTO); /** * 调用签权服务,判断用户是否有权限 * diff --git a/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/impl/AuthService.java b/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/impl/AuthService.java index 22d97175..9d239a0c 100644 --- a/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/impl/AuthService.java +++ b/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/impl/AuthService.java @@ -3,6 +3,7 @@ import com.springboot.cloud.auth.client.provider.AuthProvider; import com.springboot.cloud.auth.client.service.IAuthService; import com.springboot.cloud.common.core.entity.vo.Result; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import io.jsonwebtoken.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; @@ -36,6 +37,11 @@ public class AuthService implements IAuthService { @Value("${gate.ignore.authentication.startWith}") private String ignoreUrls = "/oauth"; + @Override + public Result dataAuthenticate(String authentication, String groupCode, PermissionDTO permissionDTO) { + return authProvider.dataAuth(authentication,groupCode,permissionDTO); + } + @Override public Result authenticate(String authentication, String url, String method) { return authProvider.auth(authentication, url, method); diff --git a/auth/authentication-server/pom.xml b/auth/authentication-server/pom.xml index 34f5e787..7919b6d7 100644 --- a/auth/authentication-server/pom.xml +++ b/auth/authentication-server/pom.xml @@ -18,6 +18,11 @@ + + com.springboot.cloud + facade + 0.0.1-SNAPSHOT + com.springboot.cloud web diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/config/BusConfig.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/config/BusConfig.java index 3322db7f..18061f0f 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/config/BusConfig.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/config/BusConfig.java @@ -3,7 +3,8 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.ObjectMapper; -import com.springboot.cloud.auth.authentication.events.BusReceiver; +import com.springboot.cloud.auth.authentication.events.PermissionBusReceiver; +import com.springboot.cloud.auth.authentication.events.ResourceBusReceiver; import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.core.*; import org.springframework.amqp.rabbit.connection.ConnectionFactory; @@ -12,6 +13,7 @@ import org.springframework.amqp.support.converter.ContentTypeDelegatingMessageConverter; import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.amqp.support.converter.MessageConverter; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -21,33 +23,100 @@ public class BusConfig { private static final String EXCHANGE_NAME = "spring-boot-exchange"; - private static final String ROUTING_KEY = "organization-resource"; + private static final String RESOURCE_ROUTING_KEY = "organization-resource"; + private static final String PERMISSION_ROUTING_KEY = "organization-permission"; + private static final String PERMISSION_QUEUE_SUFFIX = "permission"; + private static final String RESOURCE_QUEUE_SUFFIX = "resource"; @Value("${spring.application.name}") private String appName; @Bean - Queue queue() { - String queueName = new Base64UrlNamingStrategy(appName + ".").generateName(); - log.info("queue name:{}", queueName); + Queue resourceQueue() { + String queueName = new Base64UrlNamingStrategy(appName + ".").generateName() + RESOURCE_QUEUE_SUFFIX; + log.info("resource queue name:{}", queueName); return new Queue(queueName, false); } + @Bean + Queue permissionQueue() { + String queueName = new Base64UrlNamingStrategy(appName + ".").generateName() + PERMISSION_QUEUE_SUFFIX; + log.info("permission queue name:{}", queueName); + return new Queue(queueName, false); + } + + /** + * 交换机 + * + * @return {@link TopicExchange} + */ @Bean TopicExchange exchange() { log.info("exchange:{}", EXCHANGE_NAME); return new TopicExchange(EXCHANGE_NAME); } + + /** + * 绑定资源更新的队列 + * + * @param queue 队列 + * @param exchange 交换机 + * @return {@link Binding} + */ + @Bean + Binding resourceBinding(@Qualifier("resourceQueue") Queue queue, TopicExchange exchange) { + log.info("binding {} to {} with {}", queue, exchange, RESOURCE_ROUTING_KEY); + return BindingBuilder.bind(queue).to(exchange).with(RESOURCE_ROUTING_KEY); + } + + /** + * 绑定权限更新的队列 + * + * @param queue 队列 + * @param exchange 交换机 + * @return {@link Binding} + */ + @Bean + Binding permissionBinding(@Qualifier("permissionQueue") Queue queue, TopicExchange exchange) { + log.info("binding {} to {} with {}", queue, exchange, PERMISSION_ROUTING_KEY); + return BindingBuilder.bind(queue).to(exchange).with(PERMISSION_ROUTING_KEY); + } + + + //////////////////// + //////////////////// 资源更新相关配置 + //////////////////// + @Bean + SimpleMessageListenerContainer resourceMessageListenerContainer(ConnectionFactory connectionFactory, @Qualifier("permissionMessageListenerAdapter") MessageListenerAdapter messageListenerAdapter, @Qualifier("resourceQueue") Queue queue) { + log.info("init resourceMessageListenerContainer {}", queue.getName()); + SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory); + container.setQueueNames(queue.getName()); + container.setMessageListener(messageListenerAdapter); + return container; + } + + + @Bean + MessageListenerAdapter resourceMessageListenerAdapter(ResourceBusReceiver resourceBusReceiver, @Qualifier("permissionMessageConverter") MessageConverter messageConverter) { + log.info("new listener"); + return new MessageListenerAdapter(resourceBusReceiver, messageConverter); + } + @Bean - Binding binding(Queue queue, TopicExchange exchange) { - log.info("binding {} to {} with {}", queue, exchange, ROUTING_KEY); - return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY); + public MessageConverter resourceMessageConverter() { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + return new ContentTypeDelegatingMessageConverter(new Jackson2JsonMessageConverter(objectMapper)); } + + //////////////////// + //////////////////// 权限更新相关配置 + //////////////////// @Bean - SimpleMessageListenerContainer simpleMessageListenerContainer(ConnectionFactory connectionFactory, MessageListenerAdapter messageListenerAdapter, Queue queue) { - log.info("init simpleMessageListenerContainer {}", queue.getName()); + SimpleMessageListenerContainer permissionMessageListenerContainer(ConnectionFactory connectionFactory, @Qualifier("permissionMessageListenerAdapter") MessageListenerAdapter messageListenerAdapter, @Qualifier("permissionQueue") Queue queue) { + log.info("init permissionMessageListenerContainer {}", queue.getName()); SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory); container.setQueueNames(queue.getName()); container.setMessageListener(messageListenerAdapter); @@ -55,13 +124,13 @@ SimpleMessageListenerContainer simpleMessageListenerContainer(ConnectionFactory } @Bean - MessageListenerAdapter messageListenerAdapter(BusReceiver busReceiver, MessageConverter messageConverter) { + MessageListenerAdapter permissionMessageListenerAdapter(PermissionBusReceiver permissionBusReceiver, @Qualifier("permissionMessageConverter") MessageConverter messageConverter) { log.info("new listener"); - return new MessageListenerAdapter(busReceiver, messageConverter); + return new MessageListenerAdapter(permissionBusReceiver, messageConverter); } @Bean - public MessageConverter messageConverter() { + public MessageConverter permissionMessageConverter() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); return new ContentTypeDelegatingMessageConverter(new Jackson2JsonMessageConverter(objectMapper)); diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/PermissionBusReceiver.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/PermissionBusReceiver.java new file mode 100644 index 00000000..ea5d1b11 --- /dev/null +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/PermissionBusReceiver.java @@ -0,0 +1,35 @@ +package com.springboot.cloud.auth.authentication.events; + + +import com.springboot.cloud.auth.authentication.service.impl.PermissionService; +import com.springboot.cloud.sysadmin.facade.constant.PermissionChangeTypeEnum; +import com.springboot.cloud.sysadmin.facade.dto.PermissionChangeDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 权限更新总线接收器 + * + * @author wayne + * @date 2021/09/08 + */ +@Component +@Slf4j +public class PermissionBusReceiver { + + @Autowired + private PermissionService permissionService; + + public void handleMessage(PermissionChangeDTO permissionChangeDTO) { + log.info("Received Message:<{}>", permissionChangeDTO); + PermissionChangeTypeEnum changeType = permissionChangeDTO.getChangeType(); + if(changeType.equals(PermissionChangeTypeEnum.DELETE)){ + permissionService.removePermission(permissionChangeDTO.getGroupCode(), permissionChangeDTO.getPermissionDTO()); + }else if(changeType.equals(PermissionChangeTypeEnum.ADD)){ + permissionService.savePermission(permissionChangeDTO.getGroupCode(), permissionChangeDTO.getPermissionDTO()); + }else{ + log.info("错误的消息,被舍弃"); + } + } +} diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/BusReceiver.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/ResourceBusReceiver.java similarity index 94% rename from auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/BusReceiver.java rename to auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/ResourceBusReceiver.java index 610a1722..7dba0b4b 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/BusReceiver.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/ResourceBusReceiver.java @@ -8,7 +8,7 @@ @Component @Slf4j -public class BusReceiver { +public class ResourceBusReceiver { @Autowired private ResourceService resourceService; diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProvider.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProvider.java index b21cb752..146ba54c 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProvider.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProvider.java @@ -1,11 +1,14 @@ package com.springboot.cloud.auth.authentication.provider; -import com.springboot.cloud.sysadmin.organization.entity.po.Resource; import com.springboot.cloud.common.core.entity.vo.Result; +import com.springboot.cloud.sysadmin.facade.dto.GroupDTO; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; +import com.springboot.cloud.sysadmin.organization.entity.po.Resource; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import java.util.List; import java.util.Set; @FeignClient(name = "organization", fallback = ResourceProviderFallback.class) @@ -16,4 +19,10 @@ public interface ResourceProvider { @GetMapping(value = "/resource/user/{username}") Result> resources(@PathVariable("username") String username); + + @GetMapping(value = "/permission/group/{groupCode}") + Result> permissions(@PathVariable("groupCode") String groupCode); + + @GetMapping(value = "/group/user/{username}") + Result> groups(@PathVariable("username") String username); } diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProviderFallback.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProviderFallback.java index 69a16442..0002ee4a 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProviderFallback.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProviderFallback.java @@ -1,11 +1,15 @@ package com.springboot.cloud.auth.authentication.provider; import com.springboot.cloud.common.core.entity.vo.Result; +import com.springboot.cloud.sysadmin.facade.dto.GroupDTO; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import com.springboot.cloud.sysadmin.organization.entity.po.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set; @Component @@ -22,4 +26,16 @@ public Result> resources(String username) { log.error("认证服务查询用户异常!查询用户资源为空!"); return Result.success(new HashSet()); } + + @Override + public Result> permissions(String groupCode) { + log.error("认证服务查询用户组权限异常!查询用户组权限为空!"); + return Result.success(new HashSet()); + } + + @Override + public Result> groups(String username) { + log.error("认证服务查询用户组异常!查询用户组列表为空!"); + return Result.success(new ArrayList()); + } } diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/rest/AuthenticationController.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/rest/AuthenticationController.java index 41351aa3..b87c15e0 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/rest/AuthenticationController.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/rest/AuthenticationController.java @@ -2,6 +2,7 @@ import com.springboot.cloud.auth.authentication.service.IAuthenticationService; import com.springboot.cloud.common.core.entity.vo.Result; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -31,4 +32,17 @@ public Result decide(@RequestParam String url, @RequestParam String method, Http return Result.success(decide); } + + @ApiOperation(value = "权限验证", notes = "根据用户token,访问的url和method判断用户是否有权限访问") + @ApiImplicitParams({ + @ApiImplicitParam(paramType = "query", name = "groupCode", value = "用户所在的应用组", required = true, dataType = "string"), + @ApiImplicitParam(paramType = "query", name = "permissionDto", value = "用户需要的权限", required = true, dataType = "PermissionDto") + }) + @ApiResponses(@ApiResponse(code = 200, message = "处理成功", response = Result.class)) + @PostMapping(value = "/auth/data/permission") + public Result dataDecide(@RequestParam String groupCode, @RequestParam PermissionDTO permissionDTO) { + boolean decide = authenticationService.dataDecide(groupCode, permissionDTO); + return Result.success(decide); + } + } \ No newline at end of file diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IAuthenticationService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IAuthenticationService.java index a63a8952..3b988a61 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IAuthenticationService.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IAuthenticationService.java @@ -1,5 +1,6 @@ package com.springboot.cloud.auth.authentication.service; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; @@ -14,4 +15,13 @@ public interface IAuthenticationService { */ boolean decide(HttpServletRequest authRequest); + /** + * 校验数据权限 + * + * @param groupCode 组织代码 + * @param permissionDTO 许可dto + * @return 是否有权限 + */ + boolean dataDecide(String groupCode, PermissionDTO permissionDTO); + } diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IGroupService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IGroupService.java new file mode 100644 index 00000000..9f9fd4e3 --- /dev/null +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IGroupService.java @@ -0,0 +1,17 @@ +package com.springboot.cloud.auth.authentication.service; + + +import com.springboot.cloud.sysadmin.facade.dto.GroupDTO; + +import java.util.List; + +public interface IGroupService { + + /** + * 根据用户名查找组列表 + * + * @param username 用户名 + * @return {@link List} + */ + List queryGroupsByUsername(String username); +} diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IPermissionService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IPermissionService.java new file mode 100644 index 00000000..d378e7ba --- /dev/null +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IPermissionService.java @@ -0,0 +1,36 @@ +package com.springboot.cloud.auth.authentication.service; + +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; + +import java.util.List; +import java.util.Set; + +public interface IPermissionService { + + + /** + * 通过组织代码查询数据权限 + * + * @param groupCode 组织代码 + * @return {@link Set } + */ + List queryPermissionsByGroupCode(String groupCode); + + + /** + * 新增数据权限 + * + * @param permissionDTO 权限dto + * @param groupCode 组织代码 + */ + void savePermission(String groupCode,PermissionDTO permissionDTO); + + /** + * 删除权限 + * + * @param permissionDTO 权限dto + * @param groupCode 组织代码 + */ + void removePermission(String groupCode,PermissionDTO permissionDTO); + +} diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IResourceService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IResourceService.java index 97e3574b..12717980 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IResourceService.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IResourceService.java @@ -2,16 +2,16 @@ import com.springboot.cloud.sysadmin.organization.entity.po.Resource; import org.springframework.security.access.ConfigAttribute; -import org.springframework.security.web.util.matcher.RequestMatcher; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; -import java.util.Map; import java.util.Set; @Service public interface IResourceService { + + /** * 动态新增更新权限 * diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/AuthenticationService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/AuthenticationService.java index 0668f161..ab4ec8c3 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/AuthenticationService.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/AuthenticationService.java @@ -1,5 +1,7 @@ package com.springboot.cloud.auth.authentication.service.impl; +import com.springboot.cloud.sysadmin.facade.dto.GroupDTO; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import com.springboot.cloud.sysadmin.organization.entity.po.Resource; import com.springboot.cloud.auth.authentication.service.IAuthenticationService; import lombok.extern.slf4j.Slf4j; @@ -10,7 +12,9 @@ import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; +import java.util.List; import java.util.Set; +import java.util.stream.Collectors; @Service @Slf4j @@ -24,6 +28,12 @@ public class AuthenticationService implements IAuthenticationService { @Autowired private ResourceService resourceService; + @Autowired + private PermissionService permissionService; + + @Autowired + private GroupService groupService; + /** * @param authRequest 访问的url,method * @return 有权限true, 无权限或全局资源中未找到请求url返回否 @@ -43,6 +53,30 @@ public boolean decide(HttpServletRequest authRequest) { return isMatch(urlConfigAttribute, userResources); } + @Override + public boolean dataDecide(String groupCode, PermissionDTO permissionDTO) { + log.debug("正在访问的权限是:{},groupCode:{}",permissionDTO.toString(),groupCode); + //获取用户认证信息 + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + List groupDTOList = groupService.queryGroupsByUsername(authentication.getName()); + //获取组权限列表 + List groupPermissions = groupDTOList.stream() + .flatMap(x -> permissionService.queryPermissionsByGroupCode(x.getName()).stream()) + .collect(Collectors.toList()); + return isContainsPermission(groupPermissions,permissionDTO); + } + + + /** + * 校验权限是否匹配 + * + * @param requiredPermission 需要的许可 + * @param groupPermissions 组权限 + * @return boolean + */ + public boolean isContainsPermission(List groupPermissions,PermissionDTO requiredPermission){ + return groupPermissions.contains(requiredPermission); + } /** * url对应资源与用户拥有资源进行匹配 * diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/GroupService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/GroupService.java new file mode 100644 index 00000000..05e8977b --- /dev/null +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/GroupService.java @@ -0,0 +1,23 @@ +package com.springboot.cloud.auth.authentication.service.impl; + +import com.springboot.cloud.auth.authentication.provider.ResourceProvider; +import com.springboot.cloud.auth.authentication.service.IGroupService; +import com.springboot.cloud.sysadmin.facade.dto.GroupDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class GroupService implements IGroupService { + + @Qualifier("com.springboot.cloud.auth.authentication.provider.ResourceProvider") + @Autowired + ResourceProvider resourceProvider; + + @Override + public List queryGroupsByUsername(String username) { + return resourceProvider.groups(username).getData(); + } +} diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/PermissionService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/PermissionService.java new file mode 100644 index 00000000..edadf5d4 --- /dev/null +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/PermissionService.java @@ -0,0 +1,61 @@ +package com.springboot.cloud.auth.authentication.service.impl; + +import com.alicp.jetcache.Cache; +import com.alicp.jetcache.anno.CachePenetrationProtect; +import com.alicp.jetcache.anno.CacheType; +import com.alicp.jetcache.anno.Cached; +import com.alicp.jetcache.anno.CreateCache; +import com.springboot.cloud.auth.authentication.provider.ResourceProvider; +import com.springboot.cloud.auth.authentication.service.IPermissionService; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Service +public class PermissionService implements IPermissionService { + + @Autowired + ResourceProvider resourceProvider; + + /** + * 权限的本地缓存列表 + */ + @CreateCache(name = "permission4Group" , localLimit = 50 ,cacheType = CacheType.LOCAL) + @CachePenetrationProtect + private Cache> permissionCache; + + + + @Override + @Cached(name = "permission4Group::",key = "#groupCode",cacheType = CacheType.BOTH) + //在一个JVM中,同一个键只有一个线程加载,其他线程等待结果。 + @CachePenetrationProtect + public List queryPermissionsByGroupCode(String groupCode) { + return resourceProvider.permissions(groupCode).getData(); + } + + @Override + public void savePermission(String groupCode, PermissionDTO permissionDTO) { + Set permissions = permissionCache.get(groupCode); + if(CollectionUtils.isEmpty(permissions)){ + HashSet set = new HashSet<>(); + set.add(permissionDTO); + permissionCache.put(groupCode, set); + }else{ + permissions.add(permissionDTO); + } + } + + @Override + public void removePermission(String groupCode, PermissionDTO permissionDTO) { + Set permissions = permissionCache.get(groupCode); + if(!CollectionUtils.isEmpty(permissions)){ + permissions.remove(permissionDTO); + } + } +} diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/ResourceService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/ResourceService.java index 745895b9..35cfd9e3 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/ResourceService.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/ResourceService.java @@ -26,6 +26,8 @@ @Slf4j public class ResourceService implements IResourceService { + + @Autowired private HandlerMappingIntrospector mvcHandlerMappingIntrospector; @@ -84,6 +86,7 @@ public Set queryByUsername(String username) { return resourceProvider.resources(username).getData(); } + /** * 创建RequestMatcher * diff --git a/auth/pom.xml b/auth/pom.xml index 669b33a3..3e0b5075 100644 --- a/auth/pom.xml +++ b/auth/pom.xml @@ -20,7 +20,6 @@ authentication-server authentication-client authorization-server - data-authentication-server diff --git a/auth/data-authentication-server/pom.xml b/sysadmin/facade/pom.xml similarity index 86% rename from auth/data-authentication-server/pom.xml rename to sysadmin/facade/pom.xml index 207cd3e1..74471dea 100644 --- a/auth/data-authentication-server/pom.xml +++ b/sysadmin/facade/pom.xml @@ -3,13 +3,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - auth + sysadmin com.springboot.cloud 0.0.1-SNAPSHOT 4.0.0 - data-authentication-server + facade 8 diff --git a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java b/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java new file mode 100644 index 00000000..b9bdbb4a --- /dev/null +++ b/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java @@ -0,0 +1,21 @@ +package com.springboot.cloud.sysadmin.facade.constant; + +/** + * 权限更新枚举类型 + * + * @author wayne + * @date 2021/09/08 + */ +public enum PermissionChangeTypeEnum { + + + /** + * 删除 + */ + DELETE, + /** + * 增加 + */ + ADD + +} diff --git a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java b/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java new file mode 100644 index 00000000..97cb59bd --- /dev/null +++ b/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java @@ -0,0 +1,27 @@ +package com.springboot.cloud.sysadmin.facade.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 集团dto + * 组DTO + * + * @author wayne + * @date 2021/09/13 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GroupDTO implements Serializable { + + private static final long serialVersionUID = 2072096618398346273L; + private String name; + private String parentId; + private String description; +} diff --git a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java b/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java new file mode 100644 index 00000000..06a142a8 --- /dev/null +++ b/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java @@ -0,0 +1,26 @@ +package com.springboot.cloud.sysadmin.facade.dto; + +import com.springboot.cloud.sysadmin.facade.constant.PermissionChangeTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 权限变动通知MQ + * + * @author wayne + * @date 2021/09/13 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PermissionChangeDTO implements Serializable { + private static final long serialVersionUID = -1793182425846093996L; + private PermissionChangeTypeEnum changeType; + private String groupCode; + private PermissionDTO permissionDTO; +} diff --git a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java b/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java new file mode 100644 index 00000000..5179d57c --- /dev/null +++ b/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java @@ -0,0 +1,48 @@ +package com.springboot.cloud.sysadmin.facade.dto; + + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 数据权限资源传输类 + * + * @author wayne + * @date 2021/09/06 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PermissionDTO implements Serializable { + + private static final long serialVersionUID = -6735224067139655403L; + /** + * 资源类型:hive,hdfs + */ + private String resType; + + /** + * 资源地区 + */ + private String area; + + /** + * 资源完整路径 + */ + private String resFullPath; + + /** + * 资源全名 + */ + private String resFullName; + + /** + * 资源操作位:读,写,查询 + */ + private String operationBit; +} diff --git a/sysadmin/organization/pom.xml b/sysadmin/organization/pom.xml index c4b6ef3f..66ac248b 100644 --- a/sysadmin/organization/pom.xml +++ b/sysadmin/organization/pom.xml @@ -23,6 +23,11 @@ jetcache-starter-redis 2.5.14 + + com.springboot.cloud + facade + 0.0.1-SNAPSHOT + diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java index 2abadf4d..6bd500c4 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java @@ -20,7 +20,8 @@ public class BusConfig { public static final String QUEUE_NAME = "event-organization"; public static final String EXCHANGE_NAME = "spring-boot-exchange"; - public static final String ROUTING_KEY = "organization-resource"; + public static final String RESOURCE_ROUTING_KEY = "organization-resource"; + public static final String PERMISSION_ROUTING_KEY = "organization-permission"; @Bean Queue queue() { @@ -36,8 +37,8 @@ TopicExchange exchange() { @Bean Binding binding(Queue queue, TopicExchange exchange) { - log.info("binding {} to {} with {}", queue, exchange, ROUTING_KEY); - return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY); + log.info("binding {} to {} with {}", queue, exchange, RESOURCE_ROUTING_KEY); + return BindingBuilder.bind(queue).to(exchange).with(RESOURCE_ROUTING_KEY); } @Bean diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupPermissionMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupPermissionMapper.java new file mode 100644 index 00000000..9bd3719f --- /dev/null +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupPermissionMapper.java @@ -0,0 +1,17 @@ +package com.springboot.cloud.sysadmin.organization.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.springboot.cloud.sysadmin.organization.entity.po.GroupPermission; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 组权限映射器 + * + * @author wayne + * @date 2021/09/09 + */ +@Repository +@Mapper +public interface GroupPermissionMapper extends BaseMapper { +} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java index 148b1a7a..e29b078c 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java @@ -5,6 +5,11 @@ import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; +/** + * + * @author wayne + * @date 2021/09/09 + */ @Repository @Mapper public interface PermissionMapper extends BaseMapper { diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserGroupMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserGroupMapper.java new file mode 100644 index 00000000..10fda2c8 --- /dev/null +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserGroupMapper.java @@ -0,0 +1,17 @@ +package com.springboot.cloud.sysadmin.organization.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.springboot.cloud.sysadmin.organization.entity.po.UserGroup; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 用户组映射器 + * + * @author wayne + * @date 2021/09/09 + */ +@Repository +@Mapper +public interface UserGroupMapper extends BaseMapper { +} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/GroupPermission.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/GroupPermission.java new file mode 100644 index 00000000..cbfa6b33 --- /dev/null +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/GroupPermission.java @@ -0,0 +1,24 @@ +package com.springboot.cloud.sysadmin.organization.entity.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.springboot.cloud.common.web.entity.po.BasePo; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 组权限 + * + * @author wayne + * @date 2021/09/09 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("group_permission_relation") +public class GroupPermission extends BasePo { + private String groupId; + private String permissionId; +} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java index c35df4ad..7e6bee06 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java @@ -1,10 +1,10 @@ package com.springboot.cloud.sysadmin.organization.entity.po; +import com.baomidou.mybatisplus.annotation.TableLogic; import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.*; + +import java.util.Date; /** * 数据权限资源 @@ -16,6 +16,7 @@ @Builder @NoArgsConstructor @AllArgsConstructor +@EqualsAndHashCode(exclude = "expireDate",callSuper = false) public class Permission extends BasePo { /** @@ -42,4 +43,12 @@ public class Permission extends BasePo { * 资源操作位:读,写,查询 */ private String operationBit; + + /** + * 过期日期 + */ + private Date expireDate; + + @TableLogic + private String deleted = "N"; } diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java new file mode 100644 index 00000000..73148318 --- /dev/null +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java @@ -0,0 +1,22 @@ +package com.springboot.cloud.sysadmin.organization.entity.po; + +import com.springboot.cloud.common.web.entity.po.BasePo; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 用户组 + * + * @author wayne + * @date 2021/09/09 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class UserGroup extends BasePo { + private String userId; + private String groupId; +} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/GroupController.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/GroupController.java index b0fa1b93..88e46fb2 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/GroupController.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/GroupController.java @@ -70,6 +70,17 @@ public Result query(@RequestParam String name) { return Result.success(groupService.query(groupQueryParam)); } + @ApiOperation(value = "根据用户名查询用户组列表", notes = "根据用户名查询用户组列表") + @ApiImplicitParam(paramType = "query", name = "name", value = "用户名称", required = true, dataType = "string") + @ApiResponses( + @ApiResponse(code = 200, message = "处理成功", response = Result.class) + ) + @GetMapping(value = "/user/{username}") + public Result queryByUsername(@PathVariable String username) { + log.debug("query with username:{}", username); + return Result.success(groupService.queryByUserName(username)); + } + @ApiOperation(value = "搜索用户组", notes = "根据条件查询用户组信息") @ApiImplicitParam(name = "groupQueryForm", value = "用户组查询参数", required = true, dataType = "GroupQueryForm") @ApiResponses( diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java new file mode 100644 index 00000000..61330a79 --- /dev/null +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java @@ -0,0 +1,33 @@ +package com.springboot.cloud.sysadmin.organization.rest; + +import com.google.common.collect.Lists; +import com.springboot.cloud.common.core.entity.vo.Result; +import com.springboot.cloud.sysadmin.organization.service.impl.PermissionService; +import io.swagger.annotations.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/permission") +@Api("permission") +@Slf4j +public class PermissionController { + + @Autowired + PermissionService permissionService; + + @ApiOperation(value = "查询权限", notes = "根据groupCode查询用户所拥有的资源信息") + @ApiImplicitParam(paramType = "path", name = "groupCode", value = "用户组Code", required = true, dataType = "string") + @ApiResponses( + @ApiResponse(code = 200, message = "处理成功", response = Result.class) + ) + @GetMapping(value = "/group/{groupCode}") + public Result queryByUsername(@PathVariable String groupCode) { + log.debug("query with groupCode:{}", groupCode); + return Result.success(permissionService.queryByGroups(Lists.newArrayList(groupCode))); + } +} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IGroupService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IGroupService.java index 5553b071..cfe95bd1 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IGroupService.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IGroupService.java @@ -37,6 +37,13 @@ public interface IGroupService extends IService { */ List queryByParentId(String id); + /** + * 根据userName查询所属的组 + * + * @return + */ + List queryByUserName(String userName); + /** * 更新用户组信息 * diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java index cdce29d2..f1368add 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java @@ -1,4 +1,48 @@ package com.springboot.cloud.sysadmin.organization.service; +import com.springboot.cloud.sysadmin.organization.entity.po.Permission; + +import java.util.List; + public interface IPermissionService { + + /** + * 查询组 + * 由集团代码查询权限 + * + * @param groupList 组列表 + * @return {@link List} + */ + List queryByGroups(List groupList); + + /** + * 新增资源 + * + * @param groupCode 组织代码 + * @param permission 许可 + * @return boolean + */ + boolean add(String groupCode, Permission permission); + + + /** + * 更新 + * 更新资源信息 + * + * @param permission 许可 + * @param groupCode 组织代码 + * @return boolean + */ + boolean update(String groupCode, Permission permission); + + /** + * 删除 + * 根据id删除资源 + * + * @param groupCode 组织代码 + * @param permission 许可 + * @return boolean + */ + boolean delete(String groupCode, Permission permission); + } diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/GroupService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/GroupService.java index 6b7f700b..ad7a824b 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/GroupService.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/GroupService.java @@ -3,21 +3,37 @@ import com.alicp.jetcache.anno.CacheInvalidate; import com.alicp.jetcache.anno.CacheType; import com.alicp.jetcache.anno.Cached; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.springboot.cloud.sysadmin.organization.dao.GroupMapper; +import com.springboot.cloud.sysadmin.organization.dao.UserGroupMapper; import com.springboot.cloud.sysadmin.organization.entity.param.GroupQueryParam; import com.springboot.cloud.sysadmin.organization.entity.po.Group; +import com.springboot.cloud.sysadmin.organization.entity.po.User; +import com.springboot.cloud.sysadmin.organization.entity.po.UserGroup; import com.springboot.cloud.sysadmin.organization.service.IGroupService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; @Service @Slf4j public class GroupService extends ServiceImpl implements IGroupService { + @Autowired + UserService userService; + + @Autowired + UserGroupMapper userGroupMapper; + + @Autowired + GroupMapper groupMapper; + @Override public boolean add(Group group) { return this.save(group); @@ -52,4 +68,21 @@ public List query(GroupQueryParam groupQueryParam) { public List queryByParentId(String id) { return this.list(new QueryWrapper().eq("parent_id", id)); } + + @Override + public List queryByUserName(String userName) { + //get user + User user = userService.getByUniqueId(userName); + LambdaQueryWrapper userGroupLambdaQueryWrapper = new LambdaQueryWrapper<>(); + userGroupLambdaQueryWrapper.eq(UserGroup::getUserId,user.getId()); + + //get groupIds + List userGroupList = userGroupMapper.selectList(userGroupLambdaQueryWrapper); + Set groupIds = userGroupList.stream().map(UserGroup::getGroupId).collect(Collectors.toSet()); + + //get groups + LambdaQueryWrapper groupLambdaQueryWrapper = new LambdaQueryWrapper<>(); + groupLambdaQueryWrapper.in(Group::getId,groupIds); + return groupMapper.selectList(groupLambdaQueryWrapper); + } } diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java index 600804a2..398b5459 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java @@ -1,8 +1,116 @@ package com.springboot.cloud.sysadmin.organization.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.springboot.cloud.sysadmin.facade.constant.PermissionChangeTypeEnum; +import com.springboot.cloud.sysadmin.facade.dto.PermissionChangeDTO; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; +import com.springboot.cloud.sysadmin.organization.config.BusConfig; +import com.springboot.cloud.sysadmin.organization.dao.GroupMapper; +import com.springboot.cloud.sysadmin.organization.dao.GroupPermissionMapper; +import com.springboot.cloud.sysadmin.organization.dao.PermissionMapper; +import com.springboot.cloud.sysadmin.organization.dao.UserGroupMapper; +import com.springboot.cloud.sysadmin.organization.entity.po.Group; +import com.springboot.cloud.sysadmin.organization.entity.po.GroupPermission; +import com.springboot.cloud.sysadmin.organization.entity.po.Permission; +import com.springboot.cloud.sysadmin.organization.events.EventSender; import com.springboot.cloud.sysadmin.organization.service.IPermissionService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.stream.Collectors; + @Service -public class PermissionService implements IPermissionService { +public class PermissionService extends ServiceImpl implements IPermissionService { + + @Autowired + EventSender eventSender; + + @Autowired + UserGroupMapper userGroupMapper; + + @Autowired + GroupPermissionMapper groupPermissionMapper; + + @Autowired + PermissionMapper permissionMapper; + + @Autowired + GroupMapper groupMapper; + + @Override + public List queryByGroups(List groupIdList) { + //get permission Id by groupIds + LambdaQueryWrapper groupPermissionQueryWrapper = new LambdaQueryWrapper<>(); + groupPermissionQueryWrapper.in(GroupPermission::getGroupId,groupIdList); + List groupPermissionList = groupPermissionMapper.selectList(groupPermissionQueryWrapper); + + //get permissions + List permissionIdList = groupPermissionList.stream().map(GroupPermission::getPermissionId).collect(Collectors.toList()); + LambdaQueryWrapper permissionLambdaQueryWrapper = new LambdaQueryWrapper<>(); + permissionLambdaQueryWrapper.in(Permission::getId,permissionIdList); + return permissionMapper.selectList(permissionLambdaQueryWrapper); + } + + @Override + public boolean add(String groupCode, Permission permission) { + LambdaQueryWrapper groupLambdaQueryWrapper = new LambdaQueryWrapper<>(); + groupLambdaQueryWrapper.eq(Group::getName,groupCode); + Group group = groupMapper.selectOne(groupLambdaQueryWrapper); + GroupPermission groupPermission = GroupPermission.builder().groupId(group.getId()).permissionId(permission.getId()).build(); + int insertGroupNum = groupPermissionMapper.insert(groupPermission); + int insertPermissionNum = permissionMapper.insert(permission); + + PermissionDTO permissionDTO = new PermissionDTO(); + BeanUtils.copyProperties(permission,permissionDTO); + PermissionChangeDTO permissionChangeDTO = PermissionChangeDTO.builder().permissionDTO(permissionDTO).groupCode(groupCode).changeType(PermissionChangeTypeEnum.ADD).build(); + eventSender.send(BusConfig.PERMISSION_ROUTING_KEY,permissionChangeDTO); + return IsInsertSuccess(insertGroupNum,insertPermissionNum); + } + + @Override + public boolean update(String groupCode, Permission permission) { + return false; + } + + @Override + public boolean delete(String groupCode, Permission permission) { + LambdaQueryWrapper groupLambdaQueryWrapper = new LambdaQueryWrapper<>(); + groupLambdaQueryWrapper.eq(Group::getName,groupCode); + Group group = groupMapper.selectOne(groupLambdaQueryWrapper); + + //delete groupPermission + LambdaQueryWrapper groupPermissionLambdaQueryWrapper = Wrappers.lambdaQuery(); + groupPermissionLambdaQueryWrapper + .eq(GroupPermission::getGroupId,group.getId()) + .eq(GroupPermission::getPermissionId,permission.getId()); + groupPermissionMapper.delete(groupPermissionLambdaQueryWrapper); + + //delete permission + LambdaQueryWrapper permissionLambdaQueryWrapper = Wrappers.lambdaQuery(); + permissionLambdaQueryWrapper + .eq(Permission::getId,permission.getId()); + permissionMapper.delete(permissionLambdaQueryWrapper); + + //send event + PermissionDTO permissionDTO = new PermissionDTO(); + BeanUtils.copyProperties(permission,permissionDTO); + PermissionChangeDTO permissionChangeDTO = PermissionChangeDTO.builder().permissionDTO(permissionDTO).groupCode(groupCode).changeType(PermissionChangeTypeEnum.ADD).build(); + eventSender.send(BusConfig.PERMISSION_ROUTING_KEY,permissionChangeDTO); + return true; + } + + /** + * 校验插入是否成功 + * + * @param insertNum1 插入num1 + * @param insertNum2 插入num2 + * @return boolean + */ + public boolean IsInsertSuccess(Integer insertNum1,Integer insertNum2){ + return (null != insertNum1 && insertNum1 >= 1) && (null != insertNum2 && insertNum2 >= 1); + } } diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java index d6737dc3..03067aea 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java @@ -45,7 +45,7 @@ public class ResourceService extends ServiceImpl imple @Override public boolean add(Resource resource) { - eventSender.send(BusConfig.ROUTING_KEY, resource); + eventSender.send(BusConfig.RESOURCE_ROUTING_KEY, resource); return this.save(resource); } diff --git a/sysadmin/pom.xml b/sysadmin/pom.xml index ad81ef1b..ac83712d 100644 --- a/sysadmin/pom.xml +++ b/sysadmin/pom.xml @@ -19,5 +19,6 @@ organization + facade \ No newline at end of file From 34c60769aedd7ff8e0fbbd533fd864d1d1891588 Mon Sep 17 00:00:00 2001 From: wayne Date: Thu, 9 Dec 2021 22:35:22 +0800 Subject: [PATCH 21/46] =?UTF-8?q?=E5=A2=9E=E5=8A=A0maven=E5=A4=9A=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-local.yml | 71 ++++++++++ .../src/main/resources/application.yml | 2 + .../src/main/resources/application-local.yml | 59 ++++++++ .../src/main/resources/application.yml | 2 + .../src/main/resources/application-local.yml | 15 +++ center/bus/src/main/resources/application.yml | 2 + facade/pom.xml | 24 ++++ .../src/main/resources/application-local.yml | 66 +++++++++ .../src/main/resources/application.yml | 2 + .../src/main/resources/application-local.yml | 91 +++++++++++++ .../src/main/resources/application.yml | 2 + pom.xml | 44 ++++++ sysadmin/facade/pom.xml | 19 --- .../src/main/resources/application-local.yml | 126 ++++++++++++++++++ .../src/main/resources/application.yml | 2 + sysadmin/pom.xml | 1 - 16 files changed, 508 insertions(+), 20 deletions(-) create mode 100644 auth/authentication-server/src/main/resources/application-local.yml create mode 100644 auth/authorization-server/src/main/resources/application-local.yml create mode 100644 center/bus/src/main/resources/application-local.yml create mode 100644 facade/pom.xml create mode 100644 gateway/gateway-admin/src/main/resources/application-local.yml create mode 100644 gateway/gateway-web/src/main/resources/application-local.yml delete mode 100644 sysadmin/facade/pom.xml create mode 100644 sysadmin/organization/src/main/resources/application-local.yml diff --git a/auth/authentication-server/src/main/resources/application-local.yml b/auth/authentication-server/src/main/resources/application-local.yml new file mode 100644 index 00000000..a94ad742 --- /dev/null +++ b/auth/authentication-server/src/main/resources/application-local.yml @@ -0,0 +1,71 @@ +spring: + rabbitmq: + host: ${RABBIT_MQ_HOST:localhost} + port: ${RABBIT_MQ_PORT:5672} + username: ${RABBIT_MQ_USERNAME:myuser} + password: ${RABBIT_MQ_PASSWORD:mypass} + redis: + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + ##password: ${REDIS_PASSWORD:} + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:${DATASOURCE_DBTYPE:mysql}://${DATASOURCE_HOST:localhost}:${DATASOURCE_PORT:3306}/sc_auth?characterEncoding=UTF-8&useUnicode=true&useSSL=false&serverTimezone=GMT + username: ${DATASOURCE_USERNAME:root} + password: ${DATASOURCE_PASSWORD:123456} + zipkin: + enabled: true + sender: + type: rabbit + sleuth: + sampler: + probability: 1.0 + mvc: + throw-exception-if-no-handler-found: true + #jwt的密钥 + security: + oauth2: + jwt: + signingKey: 123456 + cloud: + loadbalancer: + retry: + enabled: true + +feign: + sentinel: + enabled: true + okhttp: + enabled: true + +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + hidePackages: com.springboot.cloud + local: + # 短時本地緩存,主要用于要求时效较高的配置 + default: + type: caffeine + keyConvertor: fastjson + expireAfterWriteInMillis: 60000 + expireAfterAccessInMillis: 40000 + +logging: + level: + com.springboot.cloud: debug + org.springframework.web: debug + org.springframework.security: debug + path: logs/ + file: + max-size: 1GB + +management: + endpoints: + web: + exposure: + include: '*' + +mybatis: + configuration: + map-underscore-to-camel-case: true + diff --git a/auth/authentication-server/src/main/resources/application.yml b/auth/authentication-server/src/main/resources/application.yml index fb75fa8e..21b5762f 100644 --- a/auth/authentication-server/src/main/resources/application.yml +++ b/auth/authentication-server/src/main/resources/application.yml @@ -1,4 +1,6 @@ spring: + profiles: + active: local rabbitmq: host: ${RABBIT_MQ_HOST:localhost} port: ${RABBIT_MQ_PORT:5672} diff --git a/auth/authorization-server/src/main/resources/application-local.yml b/auth/authorization-server/src/main/resources/application-local.yml new file mode 100644 index 00000000..51c4a1c7 --- /dev/null +++ b/auth/authorization-server/src/main/resources/application-local.yml @@ -0,0 +1,59 @@ +spring: + rabbitmq: + host: ${RABBIT_MQ_HOST:localhost} + port: ${RABBIT_MQ_PORT:5672} + username: ${RABBIT_MQ_USERNAME:myuser} + password: ${RABBIT_MQ_PASSWORD:mypass} + redis: + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + ##password: ${REDIS_PASSWORD:} + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:${DATASOURCE_DBTYPE:mysql}://${DATASOURCE_HOST:localhost}:${DATASOURCE_PORT:3306}/sc_auth?characterEncoding=UTF-8&useUnicode=true&useSSL=false&serverTimezone=GMT + username: ${DATASOURCE_USERNAME:root} + password: ${DATASOURCE_PASSWORD:123456} + zipkin: + enabled: true + sender: + type: rabbit + sleuth: + sampler: + probability: 1.0 + mvc: + throw-exception-if-no-handler-found: true + #jwt的密钥 + security: + oauth2: + jwt: + signingKey: 123456 + cloud: + loadbalancer: + retry: + enabled: true + +logging: + level: + org.springframework.web: debug + org.springframework.security: DEBUG + org.apache.ibatis: debug + java.sql.PreparedStatement: debug + path: logs/ + file: + max-size: 1GB + +feign: + sentinel: + enabled: true + okhttp: + enabled: true + +management: + endpoints: + web: + exposure: + include: '*' + +mybatis: + configuration: + map-underscore-to-camel-case: true diff --git a/auth/authorization-server/src/main/resources/application.yml b/auth/authorization-server/src/main/resources/application.yml index 38e6630d..306e4292 100644 --- a/auth/authorization-server/src/main/resources/application.yml +++ b/auth/authorization-server/src/main/resources/application.yml @@ -1,4 +1,6 @@ spring: + profiles: + active: local rabbitmq: host: ${RABBIT_MQ_HOST:localhost} port: ${RABBIT_MQ_PORT:5672} diff --git a/center/bus/src/main/resources/application-local.yml b/center/bus/src/main/resources/application-local.yml new file mode 100644 index 00000000..9ef45a04 --- /dev/null +++ b/center/bus/src/main/resources/application-local.yml @@ -0,0 +1,15 @@ +spring: + rabbitmq: + host: ${RABBIT_MQ_HOST:localhost} + port: ${RABBIT_MQ_PORT:5672} + username: ${RABBIT_MQ_USERNAME:myuser} + password: ${RABBIT_MQ_PASSWORD:mypass} + +management: + endpoints: + web: + exposure: + include: '*' +logging: + level: + root: info \ No newline at end of file diff --git a/center/bus/src/main/resources/application.yml b/center/bus/src/main/resources/application.yml index 61618517..94cbfed0 100644 --- a/center/bus/src/main/resources/application.yml +++ b/center/bus/src/main/resources/application.yml @@ -1,4 +1,6 @@ spring: + profiles: + active: local rabbitmq: host: ${RABBIT_MQ_HOST:localhost} port: ${RABBIT_MQ_PORT:5672} diff --git a/facade/pom.xml b/facade/pom.xml new file mode 100644 index 00000000..3246bca7 --- /dev/null +++ b/facade/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + facade + 0.0.1-SNAPSHOT + jar + + facade + + + com.springboot.cloud + cloud + 0.0.1-SNAPSHOT + + + + + org.projectlombok + lombok + + + diff --git a/gateway/gateway-admin/src/main/resources/application-local.yml b/gateway/gateway-admin/src/main/resources/application-local.yml new file mode 100644 index 00000000..de7f9cd3 --- /dev/null +++ b/gateway/gateway-admin/src/main/resources/application-local.yml @@ -0,0 +1,66 @@ +spring: + rabbitmq: + host: ${RABBIT_MQ_HOST:localhost} + port: ${RABBIT_MQ_PORT:5672} + username: ${RABBIT_MQ_USERNAME:myuser} + password: ${RABBIT_MQ_PASSWORD:mypass} + redis: + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + #password: ${REDIS_PASSWORD:} + lettuce: + pool: + max-active: 300 + + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:${DATASOURCE_DBTYPE:mysql}://${DATASOURCE_HOST:localhost}:${DATASOURCE_PORT:3306}/sc_gateway?characterEncoding=UTF-8&useUnicode=true&useSSL=false + username: ${DATASOURCE_USERNAME:root} + password: ${DATASOURCE_PASSWORD:123456} + + zipkin: + enabled: true + sender: + type: rabbit + sleuth: + enabled: true + http: + legacy: + enabled: true + +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + hidePackages: com.springboot.cloud + local: + # 默认永久本地缓存 + default: + type: caffeine + keyConvertor: fastjson + remote: + # 默认永久的远程缓存 + default: + type: redis + keyConvertor: fastjson + valueEncoder: kryo + valueDecoder: kryo + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + +management: + endpoints: + web: + exposure: + include: '*' + +logging: + level: + com.springboot.cloud.gateway: debug + com.jalja.org.spring: debug + path: logs/ + file: + max-size: 1GB \ No newline at end of file diff --git a/gateway/gateway-admin/src/main/resources/application.yml b/gateway/gateway-admin/src/main/resources/application.yml index 9655c936..c14fae89 100644 --- a/gateway/gateway-admin/src/main/resources/application.yml +++ b/gateway/gateway-admin/src/main/resources/application.yml @@ -1,4 +1,6 @@ spring: + profiles: + active: local rabbitmq: host: ${RABBIT_MQ_HOST:localhost} port: ${RABBIT_MQ_PORT:5672} diff --git a/gateway/gateway-web/src/main/resources/application-local.yml b/gateway/gateway-web/src/main/resources/application-local.yml new file mode 100644 index 00000000..da2cc53b --- /dev/null +++ b/gateway/gateway-web/src/main/resources/application-local.yml @@ -0,0 +1,91 @@ +spring: + rabbitmq: + host: ${RABBIT_MQ_HOST:localhost} + port: ${RABBIT_MQ_PORT:5672} + username: ${RABBIT_MQ_USERNAME:myuser} + password: ${RABBIT_MQ_PASSWORD:mypass} + redis: + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + #password: ${REDIS_PASSWORD:} + lettuce: + pool: + max-active: 300 + + zipkin: + enabled: true + sender: + type: rabbit + sleuth: + enabled: true + http: + legacy: + enabled: true + #jwt密码 + security: + oauth2: + jwt: + signingKey: 123456 + cloud: + gateway: + default-filters: + - name: Retry + args: + retries: 3 + statuses: BAD_GATEWAY + - AddResponseHeader=X-Response-Default-Foo, Default-Bar + - name: RequestRateLimiter + args: + redis-rate-limiter.replenishRate: 2 #流速 每秒 + redis-rate-limiter.burstCapacity: 10 #令牌桶的容积 + rate-limiter: "#{@defaultRedisRateLimiter}" #SPEL表达式去的对应的bean + key-resolver: "#{@apiKeyResolver}" #SPEL表达式去的对应的bean + +feign: + sentinel: + enabled: true + okhttp: + enabled: true + +jetcache: + statIntervalMinutes: 1 + areaInCacheName: false + hidePackages: com.springboot.cloud + local: + # 默认永久本地缓存 + default: + type: caffeine + keyConvertor: fastjson + remote: + # 默认永久的远程缓存 + default: + type: redis + keyConvertor: fastjson + valueEncoder: kryo + valueDecoder: kryo + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + +#网关白名单,无需要签权url +gate: + ignore: + authentication: + startWith: /oauth,/open,/v2/api-docs + +management: + endpoints: + web: + exposure: + include: '*' + +logging: + level: + com.springboot.cloud: debug + com.jalja.org.spring: debug + path: logs/ + file: + max-size: 1GB \ No newline at end of file diff --git a/gateway/gateway-web/src/main/resources/application.yml b/gateway/gateway-web/src/main/resources/application.yml index 98cdfc5c..99143903 100644 --- a/gateway/gateway-web/src/main/resources/application.yml +++ b/gateway/gateway-web/src/main/resources/application.yml @@ -1,4 +1,6 @@ spring: + profiles: + active: local rabbitmq: host: ${RABBIT_MQ_HOST:localhost} port: ${RABBIT_MQ_PORT:5672} diff --git a/pom.xml b/pom.xml index fee24396..6a2fe68c 100644 --- a/pom.xml +++ b/pom.xml @@ -20,8 +20,52 @@ monitor sysadmin demos + facade + + + + local + + true + + + local + + + + + test + + false + + + test + + + + + dev + + false + + + dev + + + + + pro + + false + + + pro + + + + diff --git a/sysadmin/facade/pom.xml b/sysadmin/facade/pom.xml deleted file mode 100644 index 74471dea..00000000 --- a/sysadmin/facade/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - sysadmin - com.springboot.cloud - 0.0.1-SNAPSHOT - - 4.0.0 - - facade - - - 8 - 8 - - - \ No newline at end of file diff --git a/sysadmin/organization/src/main/resources/application-local.yml b/sysadmin/organization/src/main/resources/application-local.yml new file mode 100644 index 00000000..206f8339 --- /dev/null +++ b/sysadmin/organization/src/main/resources/application-local.yml @@ -0,0 +1,126 @@ +spring: + cloud: + bus: + trace: + enabled: true + rabbitmq: + host: ${RABBIT_MQ_HOST:localhost} + port: ${RABBIT_MQ_PORT:5672} + username: ${RABBIT_MQ_USERNAME:myuser} + password: ${RABBIT_MQ_PASSWORD:mypass} + redis: + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + lettuce: + pool: + max-active: 300 + #password: ${REDIS_PASSWORD:123456} + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:${DATASOURCE_DBTYPE:mysql}://${DATASOURCE_HOST:localhost}:${DATASOURCE_PORT:3306}/sc_admin?characterEncoding=UTF-8&useUnicode=true&useSSL=false + username: ${DATASOURCE_USERNAME:root} + # password: ${DATASOURCE_PASSWORD:root123} + password: ${DATASOURCE_PASSWORD:123456} + zipkin: + enabled: true + sender: + type: rabbit + sleuth: + sampler: + probability: 1.0 + mvc: + throw-exception-if-no-handler-found: true + servlet: + multipart: + max-request-size: "2MB" + max-file-size: "2MB" + jackson: + time-zone: GMT+8 +# resources: +# add-mappings: false + +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + hidePackages: com.springboot.cloud + local: + # 默认2小时本地缓存 + default: + type: caffeine + keyConvertor: fastjson + expireAfterWriteInMillis: 3600000 + expireAfterAccessInMillis: 1800000 + # 長時本地緩存,主要用于要求时效一般 + longTime: + type: caffeine + keyConvertor: fastjson + expireAfterWriteInMillis: 300000 + expireAfterAccessInMillis: 180000 + # 短時本地緩存,主要用于要求时效较高的配置 + shortTime: + type: caffeine + keyConvertor: fastjson + expireAfterWriteInMillis: 60000 + expireAfterAccessInMillis: 40000 + remote: + # 默认2小时的远程缓存 + default: + type: redis + expireAfterWriteInMillis: 43200000 + keyConvertor: fastjson + valueEncoder: kryo + valueDecoder: kryo + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + # 长时远程緩存,主要用于要求时效要求一般的集中式缓存 + longTime: + type: redis + expireAfterWriteInMillis: 7200000 + keyConvertor: fastjson + valueEncoder: kryo + valueDecoder: kryo + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + # 短時远程緩存,主要用于要求时效较高的集中式缓存 + shortTime: + type: redis + expireAfterWriteInMillis: 300000 + keyConvertor: fastjson + valueEncoder: kryo + valueDecoder: kryo + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + +management: + endpoints: + web: + exposure: + include: '*' + +logging: + level: + com.springboot.cloud: debug + java.sql.PreparedStatement: debug + path: logs/ + file: + max-size: 1GB + +mybatis-plus: + configuration: + map-underscore-to-camel-case: true + global-config: + db-config: + logic-delete-value: "Y" # 逻辑已删除值(默认为 Y) + logic-not-delete-value: "N" # 逻辑未删除值(默认为 N) diff --git a/sysadmin/organization/src/main/resources/application.yml b/sysadmin/organization/src/main/resources/application.yml index 5bb706fa..4d8d58ae 100644 --- a/sysadmin/organization/src/main/resources/application.yml +++ b/sysadmin/organization/src/main/resources/application.yml @@ -1,4 +1,6 @@ spring: + profiles: + active: local cloud: bus: trace: diff --git a/sysadmin/pom.xml b/sysadmin/pom.xml index ac83712d..ad81ef1b 100644 --- a/sysadmin/pom.xml +++ b/sysadmin/pom.xml @@ -19,6 +19,5 @@ organization - facade \ No newline at end of file From 9bcd661edb10166dbaec93d490496e472c563242 Mon Sep 17 00:00:00 2001 From: wayne Date: Thu, 9 Dec 2021 22:40:07 +0800 Subject: [PATCH 22/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=A1=A8=E5=AE=9E=E4=BD=93=E5=92=8Cdto=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=EF=BC=8Cdb.sql=E5=A2=9E=E5=8A=A0=E6=96=B0=E8=A1=A8=E7=9A=84ddl?= =?UTF-8?q?=E5=92=8Cdml=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cloud/sysadmin/facade/dto/GroupDTO.java | 1 - .../facade/dto/PermissionChangeDTO.java | 1 - .../sysadmin/facade/dto/PermissionDTO.java | 6 +- sysadmin/db/db.sql | 152 ++++++++++++++---- .../organization/entity/po/Group.java | 2 +- .../organization/entity/po/Permission.java | 3 +- .../organization/entity/po/UserGroup.java | 2 + 7 files changed, 133 insertions(+), 34 deletions(-) rename {sysadmin/facade => facade}/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java (86%) rename {sysadmin/facade => facade}/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java (88%) rename {sysadmin/facade => facade}/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java (91%) diff --git a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java similarity index 86% rename from sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java rename to facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java index 97cb59bd..d77e20b2 100644 --- a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java +++ b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java @@ -20,7 +20,6 @@ @AllArgsConstructor public class GroupDTO implements Serializable { - private static final long serialVersionUID = 2072096618398346273L; private String name; private String parentId; private String description; diff --git a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java similarity index 88% rename from sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java rename to facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java index 06a142a8..da5ea915 100644 --- a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java +++ b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java @@ -19,7 +19,6 @@ @NoArgsConstructor @AllArgsConstructor public class PermissionChangeDTO implements Serializable { - private static final long serialVersionUID = -1793182425846093996L; private PermissionChangeTypeEnum changeType; private String groupCode; private PermissionDTO permissionDTO; diff --git a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java similarity index 91% rename from sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java rename to facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java index 5179d57c..32c05eea 100644 --- a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java +++ b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java @@ -20,7 +20,11 @@ @AllArgsConstructor public class PermissionDTO implements Serializable { - private static final long serialVersionUID = -6735224067139655403L; + + /** + * 组织代码 + */ + private String groupCode; /** * 资源类型:hive,hdfs */ diff --git a/sysadmin/db/db.sql b/sysadmin/db/db.sql index 69787cab..690fe934 100644 --- a/sysadmin/db/db.sql +++ b/sysadmin/db/db.sql @@ -180,50 +180,72 @@ CREATE TABLE role_resource_relation -- DML准备初始化数据 -- 用户 -INSERT INTO users (id, username, password, deleted, enabled, account_non_expired, credentials_non_expired, account_non_locked, name, mobile, created_time, updated_time, created_by, updated_by) -VALUES -(101, 'admin', '$2a$10$vYA9wKn/hVGOtwQw2eHiceeIGNBdfLYpDmbzHgBSVmOfHXPH4iYdS', 'N', true, true, true, true, - '超级管理员', '', now(), now(), 'system', 'system'), -(102, 'zhoutaoo', '$2a$10$vYA9wKn/hVGOtwQw2eHiceeIGNBdfLYpDmbzHgBSVmOfHXPH4iYdS', 'N', true, true, true, true, - '周涛', 15619841000, now(), now(), 'system', 'system'); +INSERT INTO users (id, username, password, deleted, enabled, account_non_expired, credentials_non_expired, + account_non_locked, name, mobile, created_time, updated_time, created_by, updated_by) +VALUES (101, 'admin', '$2a$10$vYA9wKn/hVGOtwQw2eHiceeIGNBdfLYpDmbzHgBSVmOfHXPH4iYdS', 'N', true, true, true, true, + '超级管理员', '', now(), now(), 'system', 'system'), + (102, 'zhoutaoo', '$2a$10$vYA9wKn/hVGOtwQw2eHiceeIGNBdfLYpDmbzHgBSVmOfHXPH4iYdS', 'N', true, true, true, true, + '周涛', 15619841000, now(), now(), 'system', 'system'); -- 角色 INSERT INTO roles (id, code, name, description, created_time, updated_time, created_by, updated_by) VALUES (101, 'ADMIN', '超级管理员', '公司IT总负责人', now(), now(), 'system', 'system'), (102, 'FIN', '财务', '财务', now(), now(), 'system', 'system'), (103, 'IT', 'IT', 'IT角色', now(), now(), 'system', 'system'); -- 资源 -INSERT INTO resource (id, name, code, type, url, method, description, created_time, updated_time, created_by, updated_by) +INSERT INTO resource (id, name, code, type, url, method, description, created_time, updated_time, created_by, + updated_by) VALUES (101, '新增用户', 'user_manager:btn_add', 'user', '/user', 'POST', '新增用户功能', now(), now(), 'system', 'system'), (102, '编辑用户', 'user_manager:btn_edit', 'user', '/user/{id}', 'PUT', '编辑用户功能', now(), now(), 'system', 'system'), - (103, '删除用户', 'user_manager:btn_del', 'user', '/user/{id}', 'DELETE', '根据用户id删除用户', now(), now(), 'system', 'system'), + (103, '删除用户', 'user_manager:btn_del', 'user', '/user/{id}', 'DELETE', '根据用户id删除用户', now(), now(), 'system', + 'system'), (104, '查看用户', 'user_manager:view', 'user', '/user/{id}', 'GET', '根据用户id获取用户', now(), now(), 'system', 'system'), - (105, '搜索用户', 'user_manager:query', 'user', '/user/conditions', 'POST', '根据条件查询用户', now(), now(), 'system', 'system'), + (105, '搜索用户', 'user_manager:query', 'user', '/user/conditions', 'POST', '根据条件查询用户', now(), now(), 'system', + 'system'), (106, '获取用户', 'user_manager:get', 'user', '/user', 'GET', '根据唯一标识获取用户', now(), now(), 'system', 'system'), (201, '新增角色', 'role_manager:btn_add', 'role', '/role', 'POST', '新增角色功能', now(), now(), 'system', 'system'), (202, '编辑角色', 'role_manager:btn_edit', 'role', '/role/{id}', 'PUT', '编辑角色功能', now(), now(), 'system', 'system'), - (203, '删除角色', 'role_manager:btn_del', 'role', '/role/{id}', 'DELETE', '根据id删除角色', now(), now(), 'system', 'system'), + (203, '删除角色', 'role_manager:btn_del', 'role', '/role/{id}', 'DELETE', '根据id删除角色', now(), now(), 'system', + 'system'), (204, '查看角色', 'role_manager:view', 'role', '/role/{id}', 'GET', '根据id获取角色', now(), now(), 'system', 'system'), - (205, '根据用户id查询角色', 'role_manager:user', 'role', '/role/user/{userId}', 'GET', '根据用户id获取用户所拥有的角色集', now(), now(), 'system', 'system'), + (205, '根据用户id查询角色', 'role_manager:user', 'role', '/role/user/{userId}', 'GET', '根据用户id获取用户所拥有的角色集', now(), now(), + 'system', 'system'), (206, '获取所有角色', 'role_manager:all', 'role', '/role/all', 'GET', '获取所有角色', now(), now(), 'system', 'system'), - (207, '搜索角色', 'role_manager:query', 'role', '/role/conditions', 'POST', '根据条件查询角色', now(), now(), 'system', 'system'), - (301, '根据父id查询组', 'group_manager:parent', 'group', '/group/parent/{id}', 'GET', '根据父id查询用户组', now(), now(), 'system', 'system'), - (302, '查看用户组', 'group_manager:get', 'group', '/group/{id}', 'GET', '根据id查询用户组', now(), now(), 'system', 'system'), - (303, '搜索用户组', 'group_manager:query', 'group', '/group/conditions', 'POST', '根据条件查询用户组信息', now(), now(), 'system', 'system'), - (304, '删除用户组', 'group_manager:del', 'group', '/group/{id}', 'DELETE', '根据用户id删除用户组', now(), now(), 'system', 'system'), + (207, '搜索角色', 'role_manager:query', 'role', '/role/conditions', 'POST', '根据条件查询角色', now(), now(), 'system', + 'system'), + (301, '根据父id查询组', 'group_manager:parent', 'group', '/group/parent/{id}', 'GET', '根据父id查询用户组', now(), now(), + 'system', 'system'), + (302, '查看用户组', 'group_manager:get', 'group', '/group/{id}', 'GET', '根据id查询用户组', now(), now(), 'system', + 'system'), + (303, '搜索用户组', 'group_manager:query', 'group', '/group/conditions', 'POST', '根据条件查询用户组信息', now(), now(), + 'system', 'system'), + (304, '删除用户组', 'group_manager:del', 'group', '/group/{id}', 'DELETE', '根据用户id删除用户组', now(), now(), 'system', + 'system'), (305, '编辑用户组', 'group_manager:edit', 'group', '/group/{id}', 'PUT', '修改用户组', now(), now(), 'system', 'system'), (306, '新增用户组', 'group_manager:add', 'group', '/group', 'POST', '新增用户组', now(), now(), 'system', 'system'), - (307, '新增网关路由', 'gateway_manager:add', 'gateway', '/gateway/routes', 'POST', '新增网关路由', now(), now(), 'system', 'system'), - (308, '修改网关路由', 'gateway_manager:edit', 'gateway', '/gateway/routes/{id}', 'PUT', '修改网关路由', now(), now(), 'system', 'system'), - (309, '删除网关路由', 'gateway_manager:adel', 'gateway', '/gateway/routes/{id}', 'DELETE', '删除网关路由', now(), now(), 'system', 'system'), - (310, '查看网关路由', 'gateway_manager:view', 'gateway', '/gateway/routes/{id}', 'GET', '查看网关路由', now(), now(), 'system', 'system'), - (311, '搜索网关路由', 'gateway_manager:query', 'gateway', '/gateway/routes/conditions', 'POST', '搜索网关路由', now(), now(), 'system', 'system'), - (312, '全局加载路由', 'gateway_manager:overload', 'gateway', '/gateway/routes/overload', 'POST', '全局加载路由', now(), now(), 'system', 'system'), - (313, '新增网关路由', 'resource_manager:add', 'resource', '/resource', 'POST', '新增资源路由', now(), now(), 'system', 'system'), - (314, '修改网关路由', 'resource_manager:edit', 'resource', '/resource/{id}', 'PUT', '修改资源', now(), now(), 'system', 'system'), - (315, '删除网关路由', 'resource_manager:adel', 'resource', '/resource/{id}', 'DELETE', '删除资源', now(), now(), 'system', 'system'), - (316, '查看网关路由', 'resource_manager:view', 'resource', '/resource/{id}', 'GET', '查看资源', now(), now(), 'system', 'system'), - (317, '搜索网关路由', 'resource_manager:query', 'resource', '/resource/conditions', 'POST', '搜索资源', now(), now(), 'system', 'system'), - (318, '全局加载路由', 'resource_manager:all', 'resource', '/resource/all', 'GET', '查询全部资源', now(), now(), 'system', 'system'); + (307, '新增网关路由', 'gateway_manager:add', 'gateway', '/gateway/routes', 'POST', '新增网关路由', now(), now(), 'system', + 'system'), + (308, '修改网关路由', 'gateway_manager:edit', 'gateway', '/gateway/routes/{id}', 'PUT', '修改网关路由', now(), now(), + 'system', 'system'), + (309, '删除网关路由', 'gateway_manager:adel', 'gateway', '/gateway/routes/{id}', 'DELETE', '删除网关路由', now(), now(), + 'system', 'system'), + (310, '查看网关路由', 'gateway_manager:view', 'gateway', '/gateway/routes/{id}', 'GET', '查看网关路由', now(), now(), + 'system', 'system'), + (311, '搜索网关路由', 'gateway_manager:query', 'gateway', '/gateway/routes/conditions', 'POST', '搜索网关路由', now(), now(), + 'system', 'system'), + (312, '全局加载路由', 'gateway_manager:overload', 'gateway', '/gateway/routes/overload', 'POST', '全局加载路由', now(), + now(), 'system', 'system'), + (313, '新增网关路由', 'resource_manager:add', 'resource', '/resource', 'POST', '新增资源路由', now(), now(), 'system', + 'system'), + (314, '修改网关路由', 'resource_manager:edit', 'resource', '/resource/{id}', 'PUT', '修改资源', now(), now(), 'system', + 'system'), + (315, '删除网关路由', 'resource_manager:adel', 'resource', '/resource/{id}', 'DELETE', '删除资源', now(), now(), 'system', + 'system'), + (316, '查看网关路由', 'resource_manager:view', 'resource', '/resource/{id}', 'GET', '查看资源', now(), now(), 'system', + 'system'), + (317, '搜索网关路由', 'resource_manager:query', 'resource', '/resource/conditions', 'POST', '搜索资源', now(), now(), + 'system', 'system'), + (318, '全局加载路由', 'resource_manager:all', 'resource', '/resource/all', 'GET', '查询全部资源', now(), now(), 'system', + 'system'); -- 用户关系授权 INSERT INTO user_role_relation (id, user_id, role_id, created_time, updated_time, created_by, updated_by) @@ -279,7 +301,8 @@ VALUES (101, -1, '总公司', '总公司', now(), now(), 'system', 'system'), (106, 102, '销售部门', '负责公司产品销售', now(), now(), 'system', 'system'), (107, 101, '北京分公司', '北京分公司', now(), now(), 'system', 'system'); -- 菜单 -INSERT INTO menu (id, parent_id, type, href, icon, name, description, order_num, created_time, updated_time, created_by, updated_by) +INSERT INTO menu (id, parent_id, type, href, icon, name, description, order_num, created_time, updated_time, created_by, + updated_by) VALUES (101, -1, 'MENU', '/admin', 'setting', '系统管理', '系统设置管理', 0, now(), now(), 'system', 'system'), (102, 101, 'MENU', '/admin/users', 'fa-user', '用户管理', '用户新增,修改,查看,删除', 10, now(), now(), 'system', 'system'), (103, 101, 'MENU', '/admin/menus', 'category', '菜单管理', '菜单新增,修改,删除', 20, now(), now(), 'system', 'system'); @@ -300,3 +323,74 @@ VALUES (101, 101, 101, now(), now(), 'system', 'system'), (106, 103, 101, now(), now(), 'system', 'system'), (107, 103, 102, now(), now(), 'system', 'system'), (108, 103, 103, now(), now(), 'system', 'system'); + + +-- 数据权限表 +DROP TABLE IF EXISTS permission; +CREATE TABLE permission +( + id VARCHAR(20) PRIMARY KEY COMMENT '关系id', + res_type VARCHAR(20) NOT NULL COMMENT '资源类型(hive,hdfs)', + area VARCHAR(20) NOT NULL COMMENT '资源地区', + res_full_path VARCHAR(500) NOT NULL COMMENT '资源全路径', + res_full_name VARCHAR(500) NOT NULL COMMENT '资源全路径(中)', + operation_bit VARCHAR(20) NOT NULL COMMENT '权限操作位(read,write...)', + expire_date DATETIME NOT NULL COMMENT '权限过期时间', + created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', + updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', + created_by VARCHAR(100) NOT NULL COMMENT '创建人', + updated_by VARCHAR(100) NOT NULL COMMENT '更新人', + deleted VARCHAR(1) NOT NULL DEFAULT 'N' COMMENT '是否已删除Y:已删除,N:未删除' +) COMMENT '角色和资源关系表'; + + +-- 组和数据权限关系表 +DROP TABLE IF EXISTS group_permission_relation; +CREATE TABLE group_permission_relation +( + id VARCHAR(20) PRIMARY KEY COMMENT '关系id', + group_id VARCHAR(20) NOT NULL COMMENT '用户id', + permission_id VARCHAR(20) NOT NULL COMMENT '用户组id', + created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', + updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', + created_by VARCHAR(100) NOT NULL COMMENT '创建人', + updated_by VARCHAR(100) NOT NULL COMMENT '更新人' +) COMMENT '角色和资源关系表'; +-- 组和权限的关系 +INSERT INTO group_permission_relation (id, group_id, permission_id, created_time, updated_time, created_by, updated_by) +VALUES (1, 101, 101, now(), now(), 'system', 'system'), + (2, 101, 102, now(), now(), 'system', 'system'), + (3, 101, 103, now(), now(), 'system', 'system'), + (4, 102, 101, now(), now(), 'system', 'system'), + (5, 102, 102, now(), now(), 'system', 'system'), + (6, 103, 101, now(), now(), 'system', 'system'), + (7, 103, 102, now(), now(), 'system', 'system'), + (8, 103, 103, now(), now(), 'system', 'system'); + +INSERT INTO permission (id, res_type, area, res_full_path, res_full_name, operation_bit, expire_date, created_time, + updated_time, created_by, updated_by) +VALUES (101, 'hive', 'china', '/test.db/test', '/测试库/测试表', 'select', '2099-12-26 10:45:26', now(), now(), + 'system', 'system'), + (102, 'hive', 'china', '/test.db/test1', '/测试库/测试表1', 'select', '2099-12-26 10:45:26', now(), now(), + 'system', 'system'), + (103, 'hive', 'china', '/test.db', '/测试库', 'select', '2099-12-26 10:45:26', now(), now(), + 'system', 'system'); + + + +INSERT INTO sc_admin.resource (id, code, type, name, url, method, description, created_time, updated_time, created_by, + updated_by) +VALUES ('401', 'permission:auth', 'permission', '数据权限验证', '/auth/data/permission', 'POST', '验证数据权限', DEFAULT, DEFAULT, + 'system', 'system'); + + +INSERT INTO sc_admin.role_resource_relation (id, resource_id, role_id, created_time, updated_time, created_by, + updated_by) +VALUES ('601', '401', '101', DEFAULT, DEFAULT, 'system', 'system'); + + + + + + + diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Group.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Group.java index 1e600dbe..7ad26729 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Group.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Group.java @@ -12,7 +12,7 @@ @Builder @NoArgsConstructor @AllArgsConstructor -@TableName("groups") +@TableName("t_groups") public class Group extends BasePo { private String name; private String parentId; diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java index 7e6bee06..a0306ba2 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java @@ -7,6 +7,7 @@ import java.util.Date; /** + * 许可 * 数据权限资源 * * @author wayne @@ -49,6 +50,6 @@ public class Permission extends BasePo { */ private Date expireDate; - @TableLogic + @TableLogic(value = "N",delval = "Y") private String deleted = "N"; } diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java index 73148318..17bde578 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java @@ -1,5 +1,6 @@ package com.springboot.cloud.sysadmin.organization.entity.po; +import com.baomidou.mybatisplus.annotation.TableName; import com.springboot.cloud.common.web.entity.po.BasePo; import lombok.AllArgsConstructor; import lombok.Builder; @@ -16,6 +17,7 @@ @Builder @NoArgsConstructor @AllArgsConstructor +@TableName("user_group_relation") public class UserGroup extends BasePo { private String userId; private String groupId; From e14ef50a8c7f7336e9490947e4713f6be0efa250 Mon Sep 17 00:00:00 2001 From: wayne Date: Fri, 10 Dec 2021 00:37:18 +0800 Subject: [PATCH 23/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E7=9A=84=E4=B8=80=E4=BA=9B=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/client/provider/AuthProvider.java | 6 +-- .../auth/client/service/impl/AuthService.java | 2 +- .../Oauth2AuthenticationApplication.java | 2 + .../auth/authentication/config/BusConfig.java | 49 ++---------------- .../provider/ResourceProvider.java | 7 ++- .../provider/ResourceProviderFallback.java | 2 +- .../rest/AuthenticationController.java | 8 +-- .../service/IAuthenticationService.java | 4 +- .../service/IPermissionService.java | 24 ++------- .../service/impl/AuthenticationService.java | 21 +++++--- .../service/impl/GroupService.java | 10 +++- .../service/impl/PermissionService.java | 43 +++------------- .../service/impl/ResourceService.java | 2 +- .../src/main/resources/application-local.yml | 14 +++++- .../cloud/common/core/entity/vo/Result.java | 3 +- .../constant/PermissionChangeTypeEnum.java | 0 .../organization/config/BusConfig.java | 50 +++++++++++++++++++ .../events/PermissionBusReceiver.java | 23 +++++++-- .../rest/PermissionController.java | 15 +++--- .../service/IPermissionService.java | 8 +-- .../service/impl/PermissionService.java | 35 ++++++------- .../service/impl/ResourceService.java | 6 ++- 22 files changed, 165 insertions(+), 169 deletions(-) rename {sysadmin/facade => facade}/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java (100%) rename {auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication => sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization}/events/PermissionBusReceiver.java (55%) diff --git a/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/provider/AuthProvider.java b/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/provider/AuthProvider.java index e016e7bd..0e00fdda 100644 --- a/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/provider/AuthProvider.java +++ b/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/provider/AuthProvider.java @@ -6,6 +6,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; @@ -31,7 +32,7 @@ public interface AuthProvider { Result auth(@RequestHeader(HttpHeaders.AUTHORIZATION) String authentication, @RequestParam("url") String url, @RequestParam("method") String method); @PostMapping(value = "/auth/data/permission") - Result dataAuth(@RequestHeader(HttpHeaders.AUTHORIZATION) String authentication, @RequestParam("groupCode") String groupCode, @RequestParam("permissionDTO")PermissionDTO permissionDTO); + Result dataAuth(@RequestHeader(HttpHeaders.AUTHORIZATION) String authentication, @RequestBody PermissionDTO permissionDTO); @Component @@ -59,12 +60,11 @@ public Result auth(String authentication, String url, String method) { * 降级统一返回无权限 * * @param authentication 身份验证 - * @param groupCode 组织代码 * @param permissionDTO 许可dto * @return {@link Result} */ @Override - public Result dataAuth(String authentication, String groupCode, PermissionDTO permissionDTO) { + public Result dataAuth(String authentication, PermissionDTO permissionDTO) { return Result.fail(); } } diff --git a/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/impl/AuthService.java b/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/impl/AuthService.java index 9d239a0c..9c221b25 100644 --- a/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/impl/AuthService.java +++ b/auth/authentication-client/src/main/java/com/springboot/cloud/auth/client/service/impl/AuthService.java @@ -39,7 +39,7 @@ public class AuthService implements IAuthService { @Override public Result dataAuthenticate(String authentication, String groupCode, PermissionDTO permissionDTO) { - return authProvider.dataAuth(authentication,groupCode,permissionDTO); + return authProvider.dataAuth(authentication,permissionDTO); } @Override diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/Oauth2AuthenticationApplication.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/Oauth2AuthenticationApplication.java index af0cf09e..70d1b233 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/Oauth2AuthenticationApplication.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/Oauth2AuthenticationApplication.java @@ -1,6 +1,7 @@ package com.springboot.cloud.auth.authentication; import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; +import com.alicp.jetcache.anno.config.EnableMethodCache; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @@ -9,6 +10,7 @@ @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients +@EnableMethodCache(basePackages = "com.springboot.cloud") @EnableCreateCacheAnnotation public class Oauth2AuthenticationApplication { public static void main(String[] args) { diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/config/BusConfig.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/config/BusConfig.java index 18061f0f..7c11110c 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/config/BusConfig.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/config/BusConfig.java @@ -3,7 +3,6 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.ObjectMapper; -import com.springboot.cloud.auth.authentication.events.PermissionBusReceiver; import com.springboot.cloud.auth.authentication.events.ResourceBusReceiver; import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.core.*; @@ -24,8 +23,6 @@ public class BusConfig { private static final String EXCHANGE_NAME = "spring-boot-exchange"; private static final String RESOURCE_ROUTING_KEY = "organization-resource"; - private static final String PERMISSION_ROUTING_KEY = "organization-permission"; - private static final String PERMISSION_QUEUE_SUFFIX = "permission"; private static final String RESOURCE_QUEUE_SUFFIX = "resource"; @Value("${spring.application.name}") @@ -38,12 +35,6 @@ Queue resourceQueue() { return new Queue(queueName, false); } - @Bean - Queue permissionQueue() { - String queueName = new Base64UrlNamingStrategy(appName + ".").generateName() + PERMISSION_QUEUE_SUFFIX; - log.info("permission queue name:{}", queueName); - return new Queue(queueName, false); - } /** * 交换机 @@ -70,25 +61,14 @@ Binding resourceBinding(@Qualifier("resourceQueue") Queue queue, TopicExchange e return BindingBuilder.bind(queue).to(exchange).with(RESOURCE_ROUTING_KEY); } - /** - * 绑定权限更新的队列 - * - * @param queue 队列 - * @param exchange 交换机 - * @return {@link Binding} - */ - @Bean - Binding permissionBinding(@Qualifier("permissionQueue") Queue queue, TopicExchange exchange) { - log.info("binding {} to {} with {}", queue, exchange, PERMISSION_ROUTING_KEY); - return BindingBuilder.bind(queue).to(exchange).with(PERMISSION_ROUTING_KEY); - } + //////////////////// //////////////////// 资源更新相关配置 //////////////////// @Bean - SimpleMessageListenerContainer resourceMessageListenerContainer(ConnectionFactory connectionFactory, @Qualifier("permissionMessageListenerAdapter") MessageListenerAdapter messageListenerAdapter, @Qualifier("resourceQueue") Queue queue) { + SimpleMessageListenerContainer resourceMessageListenerContainer(ConnectionFactory connectionFactory, @Qualifier("resourceMessageListenerAdapter") MessageListenerAdapter messageListenerAdapter, @Qualifier("resourceQueue") Queue queue) { log.info("init resourceMessageListenerContainer {}", queue.getName()); SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory); container.setQueueNames(queue.getName()); @@ -98,7 +78,7 @@ SimpleMessageListenerContainer resourceMessageListenerContainer(ConnectionFactor @Bean - MessageListenerAdapter resourceMessageListenerAdapter(ResourceBusReceiver resourceBusReceiver, @Qualifier("permissionMessageConverter") MessageConverter messageConverter) { + MessageListenerAdapter resourceMessageListenerAdapter(ResourceBusReceiver resourceBusReceiver, @Qualifier("resourceMessageConverter") MessageConverter messageConverter) { log.info("new listener"); return new MessageListenerAdapter(resourceBusReceiver, messageConverter); } @@ -111,28 +91,5 @@ public MessageConverter resourceMessageConverter() { } - //////////////////// - //////////////////// 权限更新相关配置 - //////////////////// - @Bean - SimpleMessageListenerContainer permissionMessageListenerContainer(ConnectionFactory connectionFactory, @Qualifier("permissionMessageListenerAdapter") MessageListenerAdapter messageListenerAdapter, @Qualifier("permissionQueue") Queue queue) { - log.info("init permissionMessageListenerContainer {}", queue.getName()); - SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory); - container.setQueueNames(queue.getName()); - container.setMessageListener(messageListenerAdapter); - return container; - } - - @Bean - MessageListenerAdapter permissionMessageListenerAdapter(PermissionBusReceiver permissionBusReceiver, @Qualifier("permissionMessageConverter") MessageConverter messageConverter) { - log.info("new listener"); - return new MessageListenerAdapter(permissionBusReceiver, messageConverter); - } - @Bean - public MessageConverter permissionMessageConverter() { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); - return new ContentTypeDelegatingMessageConverter(new Jackson2JsonMessageConverter(objectMapper)); - } } diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProvider.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProvider.java index 146ba54c..e36a8ee3 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProvider.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProvider.java @@ -5,8 +5,7 @@ import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import com.springboot.cloud.sysadmin.organization.entity.po.Resource; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; @@ -20,8 +19,8 @@ public interface ResourceProvider { @GetMapping(value = "/resource/user/{username}") Result> resources(@PathVariable("username") String username); - @GetMapping(value = "/permission/group/{groupCode}") - Result> permissions(@PathVariable("groupCode") String groupCode); + @PostMapping(value = "/permission/group") + Result> permissions(@RequestBody PermissionDTO permissionDTO); @GetMapping(value = "/group/user/{username}") Result> groups(@PathVariable("username") String username); diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProviderFallback.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProviderFallback.java index 0002ee4a..bd0acc3c 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProviderFallback.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/provider/ResourceProviderFallback.java @@ -28,7 +28,7 @@ public Result> resources(String username) { } @Override - public Result> permissions(String groupCode) { + public Result> permissions(PermissionDTO permissionDTO) { log.error("认证服务查询用户组权限异常!查询用户组权限为空!"); return Result.success(new HashSet()); } diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/rest/AuthenticationController.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/rest/AuthenticationController.java index b87c15e0..7d6013ce 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/rest/AuthenticationController.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/rest/AuthenticationController.java @@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -35,14 +36,13 @@ public Result decide(@RequestParam String url, @RequestParam String method, Http @ApiOperation(value = "权限验证", notes = "根据用户token,访问的url和method判断用户是否有权限访问") @ApiImplicitParams({ - @ApiImplicitParam(paramType = "query", name = "groupCode", value = "用户所在的应用组", required = true, dataType = "string"), @ApiImplicitParam(paramType = "query", name = "permissionDto", value = "用户需要的权限", required = true, dataType = "PermissionDto") }) @ApiResponses(@ApiResponse(code = 200, message = "处理成功", response = Result.class)) @PostMapping(value = "/auth/data/permission") - public Result dataDecide(@RequestParam String groupCode, @RequestParam PermissionDTO permissionDTO) { - boolean decide = authenticationService.dataDecide(groupCode, permissionDTO); - return Result.success(decide); + public Result dataDecide(@RequestBody PermissionDTO permissionDTO) { + boolean decide = authenticationService.dataDecide(permissionDTO); + return decide ? Result.success(decide) : Result.fail("数据权限验证失败"); } } \ No newline at end of file diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IAuthenticationService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IAuthenticationService.java index 3b988a61..18d0dddf 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IAuthenticationService.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IAuthenticationService.java @@ -16,12 +16,12 @@ public interface IAuthenticationService { boolean decide(HttpServletRequest authRequest); /** + * 数据决定 * 校验数据权限 * - * @param groupCode 组织代码 * @param permissionDTO 许可dto * @return 是否有权限 */ - boolean dataDecide(String groupCode, PermissionDTO permissionDTO); + boolean dataDecide(PermissionDTO permissionDTO); } diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IPermissionService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IPermissionService.java index d378e7ba..e9d7c7b4 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IPermissionService.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/IPermissionService.java @@ -3,34 +3,18 @@ import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import java.util.List; -import java.util.Set; public interface IPermissionService { /** + * 通过组织代码查询权限 * 通过组织代码查询数据权限 * - * @param groupCode 组织代码 - * @return {@link Set } + * @param permissionDTO 许可dto + * @return {@link List} */ - List queryPermissionsByGroupCode(String groupCode); + List queryPermissionsByGroupCode(PermissionDTO permissionDTO); - /** - * 新增数据权限 - * - * @param permissionDTO 权限dto - * @param groupCode 组织代码 - */ - void savePermission(String groupCode,PermissionDTO permissionDTO); - - /** - * 删除权限 - * - * @param permissionDTO 权限dto - * @param groupCode 组织代码 - */ - void removePermission(String groupCode,PermissionDTO permissionDTO); - } diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/AuthenticationService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/AuthenticationService.java index ab4ec8c3..d54ecc44 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/AuthenticationService.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/AuthenticationService.java @@ -1,9 +1,9 @@ package com.springboot.cloud.auth.authentication.service.impl; +import com.springboot.cloud.auth.authentication.service.IAuthenticationService; import com.springboot.cloud.sysadmin.facade.dto.GroupDTO; import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import com.springboot.cloud.sysadmin.organization.entity.po.Resource; -import com.springboot.cloud.auth.authentication.service.IAuthenticationService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.ConfigAttribute; @@ -54,16 +54,16 @@ public boolean decide(HttpServletRequest authRequest) { } @Override - public boolean dataDecide(String groupCode, PermissionDTO permissionDTO) { - log.debug("正在访问的权限是:{},groupCode:{}",permissionDTO.toString(),groupCode); + public boolean dataDecide(PermissionDTO permissionDTO) { + log.debug("正在访问的权限是:{},groupCode:{}", permissionDTO.toString(), permissionDTO.getGroupCode()); //获取用户认证信息 Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); List groupDTOList = groupService.queryGroupsByUsername(authentication.getName()); //获取组权限列表 List groupPermissions = groupDTOList.stream() - .flatMap(x -> permissionService.queryPermissionsByGroupCode(x.getName()).stream()) + .flatMap(x -> permissionService.queryPermissionsByGroupCode(permissionDTO).stream()) .collect(Collectors.toList()); - return isContainsPermission(groupPermissions,permissionDTO); + return isContainsPermission(groupPermissions, permissionDTO); } @@ -74,9 +74,16 @@ public boolean dataDecide(String groupCode, PermissionDTO permissionDTO) { * @param groupPermissions 组权限 * @return boolean */ - public boolean isContainsPermission(List groupPermissions,PermissionDTO requiredPermission){ - return groupPermissions.contains(requiredPermission); + public boolean isContainsPermission(List groupPermissions, PermissionDTO requiredPermission) { + //权限的父级继承 + for (PermissionDTO groupPermission : groupPermissions) { + if(requiredPermission.getResFullPath().startsWith(groupPermission.getResFullPath())) { + return true; + } + } + return false; } + /** * url对应资源与用户拥有资源进行匹配 * diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/GroupService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/GroupService.java index 05e8977b..4d979f98 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/GroupService.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/GroupService.java @@ -1,8 +1,12 @@ package com.springboot.cloud.auth.authentication.service.impl; +import com.alicp.jetcache.anno.CacheType; +import com.alicp.jetcache.anno.Cached; import com.springboot.cloud.auth.authentication.provider.ResourceProvider; import com.springboot.cloud.auth.authentication.service.IGroupService; +import com.springboot.cloud.common.core.entity.vo.Result; import com.springboot.cloud.sysadmin.facade.dto.GroupDTO; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; @@ -10,6 +14,7 @@ import java.util.List; @Service +@Slf4j public class GroupService implements IGroupService { @Qualifier("com.springboot.cloud.auth.authentication.provider.ResourceProvider") @@ -17,7 +22,10 @@ public class GroupService implements IGroupService { ResourceProvider resourceProvider; @Override + @Cached(name = "group4User::", key = "#username", cacheType = CacheType.BOTH, expire = 5) public List queryGroupsByUsername(String username) { - return resourceProvider.groups(username).getData(); + Result> groups = resourceProvider.groups(username); + log.info("username:{},groups:{}", username, groups); + return groups.getData(); } } diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/PermissionService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/PermissionService.java index edadf5d4..fcffd354 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/PermissionService.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/PermissionService.java @@ -1,61 +1,30 @@ package com.springboot.cloud.auth.authentication.service.impl; -import com.alicp.jetcache.Cache; -import com.alicp.jetcache.anno.CachePenetrationProtect; import com.alicp.jetcache.anno.CacheType; import com.alicp.jetcache.anno.Cached; -import com.alicp.jetcache.anno.CreateCache; import com.springboot.cloud.auth.authentication.provider.ResourceProvider; import com.springboot.cloud.auth.authentication.service.IPermissionService; import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import java.util.HashSet; import java.util.List; -import java.util.Set; @Service public class PermissionService implements IPermissionService { + @Qualifier("com.springboot.cloud.auth.authentication.provider.ResourceProvider") @Autowired ResourceProvider resourceProvider; - /** - * 权限的本地缓存列表 - */ - @CreateCache(name = "permission4Group" , localLimit = 50 ,cacheType = CacheType.LOCAL) - @CachePenetrationProtect - private Cache> permissionCache; - - @Override - @Cached(name = "permission4Group::",key = "#groupCode",cacheType = CacheType.BOTH) + @Cached(name = "permission4Group::", key = "#permissionDTO.groupCode", cacheType = CacheType.BOTH, expire = 5) //在一个JVM中,同一个键只有一个线程加载,其他线程等待结果。 - @CachePenetrationProtect - public List queryPermissionsByGroupCode(String groupCode) { - return resourceProvider.permissions(groupCode).getData(); +// @CachePenetrationProtect + public List queryPermissionsByGroupCode(PermissionDTO permissionDTO) { + return resourceProvider.permissions(permissionDTO).getData(); } - @Override - public void savePermission(String groupCode, PermissionDTO permissionDTO) { - Set permissions = permissionCache.get(groupCode); - if(CollectionUtils.isEmpty(permissions)){ - HashSet set = new HashSet<>(); - set.add(permissionDTO); - permissionCache.put(groupCode, set); - }else{ - permissions.add(permissionDTO); - } - } - - @Override - public void removePermission(String groupCode, PermissionDTO permissionDTO) { - Set permissions = permissionCache.get(groupCode); - if(!CollectionUtils.isEmpty(permissions)){ - permissions.remove(permissionDTO); - } - } } diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/ResourceService.java b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/ResourceService.java index 35cfd9e3..610d82e5 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/ResourceService.java +++ b/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/service/impl/ResourceService.java @@ -81,7 +81,7 @@ public ConfigAttribute findConfigAttributesByUrl(HttpServletRequest authRequest) } @Override - @Cached(name = "resource4user::", key = "#username", cacheType = CacheType.LOCAL) + @Cached(name = "resource4user::", key = "#username", cacheType = CacheType.BOTH,expire = 5) public Set queryByUsername(String username) { return resourceProvider.resources(username).getData(); } diff --git a/auth/authentication-server/src/main/resources/application-local.yml b/auth/authentication-server/src/main/resources/application-local.yml index a94ad742..7c60e381 100644 --- a/auth/authentication-server/src/main/resources/application-local.yml +++ b/auth/authentication-server/src/main/resources/application-local.yml @@ -49,7 +49,19 @@ jetcache: keyConvertor: fastjson expireAfterWriteInMillis: 60000 expireAfterAccessInMillis: 40000 - + remote: + # 默认永久的远程缓存 + default: + type: redis + keyConvertor: fastjson + valueEncoder: kryo + valueDecoder: kryo + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} logging: level: com.springboot.cloud: debug diff --git a/common/core/src/main/java/com/springboot/cloud/common/core/entity/vo/Result.java b/common/core/src/main/java/com/springboot/cloud/common/core/entity/vo/Result.java index 2d74761d..1a41aa2a 100644 --- a/common/core/src/main/java/com/springboot/cloud/common/core/entity/vo/Result.java +++ b/common/core/src/main/java/com/springboot/cloud/common/core/entity/vo/Result.java @@ -7,13 +7,14 @@ import com.springboot.cloud.common.core.exception.SystemErrorType; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import lombok.Getter; import java.time.Instant; import java.time.ZonedDateTime; @ApiModel(description = "rest请求的返回模型,所有rest正常都返回该类的对象") -@Getter +@Data public class Result { public static final String SUCCESSFUL_CODE = "000000"; diff --git a/sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java similarity index 100% rename from sysadmin/facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java rename to facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java index 6bd500c4..325acc1b 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java @@ -11,23 +11,73 @@ import org.springframework.amqp.support.converter.ContentTypeDelegatingMessageConverter; import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.amqp.support.converter.MessageConverter; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration @Slf4j public class BusConfig { + @Value("${spring.application.name}") + private String appName; public static final String QUEUE_NAME = "event-organization"; public static final String EXCHANGE_NAME = "spring-boot-exchange"; public static final String RESOURCE_ROUTING_KEY = "organization-resource"; public static final String PERMISSION_ROUTING_KEY = "organization-permission"; + private static final String PERMISSION_QUEUE_SUFFIX = "permission"; @Bean Queue queue() { log.info("queue name:{}", QUEUE_NAME); return new Queue(QUEUE_NAME, false); } +// +// @Bean +// Queue permissionQueue() { +// String queueName = new Base64UrlNamingStrategy(appName + ".").generateName() + PERMISSION_QUEUE_SUFFIX; +// log.info("permission queue name:{}", queueName); +// return new Queue(queueName, false); +// } +// +// /** +// * 绑定权限更新的队列 +// * +// * @param queue 队列 +// * @param exchange 交换机 +// * @return {@link Binding} +// */ +// @Bean +// Binding permissionBinding(@Qualifier("permissionQueue") Queue queue, TopicExchange exchange) { +// log.info("binding {} to {} with {}", queue, exchange, PERMISSION_ROUTING_KEY); +// return BindingBuilder.bind(queue).to(exchange).with(PERMISSION_ROUTING_KEY); +// } +// +// +// //////////////////// +// //////////////////// 权限更新相关配置 +// //////////////////// +// @Bean +// SimpleMessageListenerContainer permissionMessageListenerContainer(ConnectionFactory connectionFactory, @Qualifier("permissionMessageListenerAdapter") MessageListenerAdapter messageListenerAdapter, @Qualifier("permissionQueue") Queue queue) { +// log.info("init permissionMessageListenerContainer {}", queue.getName()); +// SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory); +// container.setQueueNames(queue.getName()); +// container.setMessageListener(messageListenerAdapter); +// return container; +// } +// +// @Bean +// MessageListenerAdapter permissionMessageListenerAdapter(PermissionBusReceiver permissionBusReceiver, @Qualifier("permissionMessageConverter") MessageConverter messageConverter) { +// log.info("new listener"); +// return new MessageListenerAdapter(permissionBusReceiver, messageConverter); +// } +// +// @Bean +// public MessageConverter permissionMessageConverter() { +// ObjectMapper objectMapper = new ObjectMapper(); +// objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); +// return new ContentTypeDelegatingMessageConverter(new Jackson2JsonMessageConverter(objectMapper)); +// } @Bean TopicExchange exchange() { diff --git a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/PermissionBusReceiver.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/PermissionBusReceiver.java similarity index 55% rename from auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/PermissionBusReceiver.java rename to sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/PermissionBusReceiver.java index ea5d1b11..9bfe5112 100644 --- a/auth/authentication-server/src/main/java/com/springboot/cloud/auth/authentication/events/PermissionBusReceiver.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/PermissionBusReceiver.java @@ -1,9 +1,10 @@ -package com.springboot.cloud.auth.authentication.events; +package com.springboot.cloud.sysadmin.organization.events; -import com.springboot.cloud.auth.authentication.service.impl.PermissionService; import com.springboot.cloud.sysadmin.facade.constant.PermissionChangeTypeEnum; import com.springboot.cloud.sysadmin.facade.dto.PermissionChangeDTO; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; +import com.springboot.cloud.sysadmin.organization.dao.GroupPermissionMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -19,17 +20,29 @@ public class PermissionBusReceiver { @Autowired - private PermissionService permissionService; + GroupPermissionMapper groupPermissionMapper; public void handleMessage(PermissionChangeDTO permissionChangeDTO) { log.info("Received Message:<{}>", permissionChangeDTO); PermissionChangeTypeEnum changeType = permissionChangeDTO.getChangeType(); + PermissionDTO permissionDTO = permissionChangeDTO.getPermissionDTO(); if(changeType.equals(PermissionChangeTypeEnum.DELETE)){ - permissionService.removePermission(permissionChangeDTO.getGroupCode(), permissionChangeDTO.getPermissionDTO()); + removePermission(permissionDTO); }else if(changeType.equals(PermissionChangeTypeEnum.ADD)){ - permissionService.savePermission(permissionChangeDTO.getGroupCode(), permissionChangeDTO.getPermissionDTO()); + savePermission(permissionDTO); }else{ log.info("错误的消息,被舍弃"); } } + + + public void savePermission(PermissionDTO permissionDTO) { + //1.检查权限格式是否正确 + //2.添加权限表 + //3.添加权限 + } + + public void removePermission(PermissionDTO permissionDTO) { + //去除group_permission表中的权限关联 + } } diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java index 61330a79..8debbb7c 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java @@ -1,15 +1,12 @@ package com.springboot.cloud.sysadmin.organization.rest; -import com.google.common.collect.Lists; import com.springboot.cloud.common.core.entity.vo.Result; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import com.springboot.cloud.sysadmin.organization.service.impl.PermissionService; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/permission") @@ -25,9 +22,9 @@ public class PermissionController { @ApiResponses( @ApiResponse(code = 200, message = "处理成功", response = Result.class) ) - @GetMapping(value = "/group/{groupCode}") - public Result queryByUsername(@PathVariable String groupCode) { - log.debug("query with groupCode:{}", groupCode); - return Result.success(permissionService.queryByGroups(Lists.newArrayList(groupCode))); + @PostMapping(value = "/group") + public Result queryByUsername(@RequestBody PermissionDTO permissionDTO) { + log.debug("query with groupCode:{}", permissionDTO.getGroupCode()); + return Result.success(permissionService.queryByConditions(permissionDTO)); } } diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java index f1368add..96f2caee 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java @@ -1,5 +1,6 @@ package com.springboot.cloud.sysadmin.organization.service; +import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; import com.springboot.cloud.sysadmin.organization.entity.po.Permission; import java.util.List; @@ -7,13 +8,12 @@ public interface IPermissionService { /** - * 查询组 - * 由集团代码查询权限 + * 查询条件 * - * @param groupList 组列表 + * @param permissionDTO 许可dto * @return {@link List} */ - List queryByGroups(List groupList); + List queryByConditions(PermissionDTO permissionDTO); /** * 新增资源 diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java index 398b5459..b58b428a 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java @@ -3,10 +3,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.springboot.cloud.sysadmin.facade.constant.PermissionChangeTypeEnum; -import com.springboot.cloud.sysadmin.facade.dto.PermissionChangeDTO; import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; -import com.springboot.cloud.sysadmin.organization.config.BusConfig; import com.springboot.cloud.sysadmin.organization.dao.GroupMapper; import com.springboot.cloud.sysadmin.organization.dao.GroupPermissionMapper; import com.springboot.cloud.sysadmin.organization.dao.PermissionMapper; @@ -16,10 +13,11 @@ import com.springboot.cloud.sysadmin.organization.entity.po.Permission; import com.springboot.cloud.sysadmin.organization.events.EventSender; import com.springboot.cloud.sysadmin.organization.service.IPermissionService; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -42,33 +40,35 @@ public class PermissionService extends ServiceImpl GroupMapper groupMapper; @Override - public List queryByGroups(List groupIdList) { + public List queryByConditions(PermissionDTO permissionDTO) { //get permission Id by groupIds LambdaQueryWrapper groupPermissionQueryWrapper = new LambdaQueryWrapper<>(); - groupPermissionQueryWrapper.in(GroupPermission::getGroupId,groupIdList); + groupPermissionQueryWrapper.in(GroupPermission::getGroupId,permissionDTO.getGroupCode()); List groupPermissionList = groupPermissionMapper.selectList(groupPermissionQueryWrapper); //get permissions List permissionIdList = groupPermissionList.stream().map(GroupPermission::getPermissionId).collect(Collectors.toList()); LambdaQueryWrapper permissionLambdaQueryWrapper = new LambdaQueryWrapper<>(); - permissionLambdaQueryWrapper.in(Permission::getId,permissionIdList); + permissionLambdaQueryWrapper.in(Permission::getId,permissionIdList) + .eq(Permission::getArea,permissionDTO.getArea()) + .eq(Permission::getOperationBit,permissionDTO.getOperationBit()) + .eq(Permission::getResType,permissionDTO.getResType()) + .eq(Permission::getDeleted,"N") + .gt(Permission::getExpireDate,new Date()); return permissionMapper.selectList(permissionLambdaQueryWrapper); } @Override + @Transactional(rollbackFor = Exception.class) public boolean add(String groupCode, Permission permission) { LambdaQueryWrapper groupLambdaQueryWrapper = new LambdaQueryWrapper<>(); groupLambdaQueryWrapper.eq(Group::getName,groupCode); Group group = groupMapper.selectOne(groupLambdaQueryWrapper); GroupPermission groupPermission = GroupPermission.builder().groupId(group.getId()).permissionId(permission.getId()).build(); + //todo permission的格式校验 int insertGroupNum = groupPermissionMapper.insert(groupPermission); int insertPermissionNum = permissionMapper.insert(permission); - - PermissionDTO permissionDTO = new PermissionDTO(); - BeanUtils.copyProperties(permission,permissionDTO); - PermissionChangeDTO permissionChangeDTO = PermissionChangeDTO.builder().permissionDTO(permissionDTO).groupCode(groupCode).changeType(PermissionChangeTypeEnum.ADD).build(); - eventSender.send(BusConfig.PERMISSION_ROUTING_KEY,permissionChangeDTO); - return IsInsertSuccess(insertGroupNum,insertPermissionNum); + return isInsertSuccess(insertGroupNum,insertPermissionNum); } @Override @@ -77,6 +77,7 @@ public boolean update(String groupCode, Permission permission) { } @Override + @Transactional(rollbackFor = Exception.class) public boolean delete(String groupCode, Permission permission) { LambdaQueryWrapper groupLambdaQueryWrapper = new LambdaQueryWrapper<>(); groupLambdaQueryWrapper.eq(Group::getName,groupCode); @@ -94,12 +95,6 @@ public boolean delete(String groupCode, Permission permission) { permissionLambdaQueryWrapper .eq(Permission::getId,permission.getId()); permissionMapper.delete(permissionLambdaQueryWrapper); - - //send event - PermissionDTO permissionDTO = new PermissionDTO(); - BeanUtils.copyProperties(permission,permissionDTO); - PermissionChangeDTO permissionChangeDTO = PermissionChangeDTO.builder().permissionDTO(permissionDTO).groupCode(groupCode).changeType(PermissionChangeTypeEnum.ADD).build(); - eventSender.send(BusConfig.PERMISSION_ROUTING_KEY,permissionChangeDTO); return true; } @@ -110,7 +105,7 @@ public boolean delete(String groupCode, Permission permission) { * @param insertNum2 插入num2 * @return boolean */ - public boolean IsInsertSuccess(Integer insertNum1,Integer insertNum2){ + public boolean isInsertSuccess(Integer insertNum1, Integer insertNum2){ return (null != insertNum1 && insertNum1 >= 1) && (null != insertNum2 && insertNum2 >= 1); } } diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java index 03067aea..752aedbd 100644 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java +++ b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java @@ -83,7 +83,7 @@ public List getAll() { } @Override - @Cached(name = "resource4user::", key = "#username", cacheType = CacheType.BOTH) + @Cached(name = "resource4user::", key = "#username", cacheType = CacheType.BOTH,expire = 5) public List query(String username) { //根据用户名查询到用户所拥有的角色 User user = userService.getByUniqueId(username); @@ -95,6 +95,8 @@ public List query(String username) { //根据资源列表查询出所有资源对象 Set resourceIds = roleResources.stream().map(roleResource -> roleResource.getResourceId()).collect(Collectors.toSet()); //根据resourceId列表查询出resource对象 - return (List) this.listByIds(resourceIds); + List resources = (List) this.listByIds(resourceIds); + log.info("resources:{}",resources); + return resources; } } From 14d50f0c2dee6bcec15972054273dc2dc1eda3f9 Mon Sep 17 00:00:00 2001 From: wayne Date: Fri, 10 Dec 2021 01:10:13 +0800 Subject: [PATCH 24/46] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=A0=A1=E9=AA=8C=E8=AF=B4=E6=98=8E=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...03\351\231\220\346\240\241\351\252\214.md" | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 "auth/authentication-server/docs/\346\235\203\351\231\220\346\240\241\351\252\214.md" diff --git "a/auth/authentication-server/docs/\346\235\203\351\231\220\346\240\241\351\252\214.md" "b/auth/authentication-server/docs/\346\235\203\351\231\220\346\240\241\351\252\214.md" new file mode 100644 index 00000000..01b6fd98 --- /dev/null +++ "b/auth/authentication-server/docs/\346\235\203\351\231\220\346\240\241\351\252\214.md" @@ -0,0 +1,58 @@ +# 权限校验 + +## 核心理念 + +建立用户-组-权限资源的关系,对用户进行鉴权 + +[![o4WeAI.png](https://s1.ax1x.com/2021/12/10/o4WeAI.png)](https://imgtu.com/i/o4WeAI) + + + +## 鉴权流程 + +### 在权限表(permission)中插入资源信息 + +```sql +INSERT INTO permission (id, res_type, area, res_full_path, res_full_name, operation_bit, expire_date, created_time, + updated_time, created_by, updated_by) +VALUES (101, 'hive', 'china', '/test.db/test', '/测试库/测试表', 'select', '2099-12-26 10:45:26', now(), now(), + 'system', 'system'), + (102, 'hive', 'china', '/test.db/test1', '/测试库/测试表1', 'select', '2099-12-26 10:45:26', now(), now(), + 'system', 'system'), + (103, 'hive', 'china', '/test.db', '/测试库', 'select', '2099-12-26 10:45:26', now(), now(), + 'system', 'system'); +``` + +### 在组-权限表建立连接 + +```sql +INSERT INTO group_permission_relation (id, group_id, permission_id, created_time, updated_time, created_by, updated_by) +VALUES (1, 101, 101, now(), now(), 'system', 'system'), + (2, 101, 102, now(), now(), 'system', 'system'), + (3, 101, 103, now(), now(), 'system', 'system'), + (4, 102, 101, now(), now(), 'system', 'system'), + (5, 102, 102, now(), now(), 'system', 'system'), + (6, 103, 101, now(), now(), 'system', 'system'), + (7, 103, 102, now(), now(), 'system', 'system'), + (8, 103, 103, now(), now(), 'system', 'system'); +``` + +### 访问接口进行鉴权 + +```shell +curl --location --request POST 'http://127.0.0.1:8443/authentication-server/auth/data/permission' \ +--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsInNjb3BlIjpbInJlYWQiXSwib3JnYW5pemF0aW9uIjoiYWRtaW4iLCJleHAiOjE2MzkwNzQ1MTMsImF1dGhvcml0aWVzIjpbIkFETUlOIl0sImp0aSI6IllsVVhlV2d1VFBRbGdmSHYyY0VGOC1seEVGRSIsImNsaWVudF9pZCI6InRlc3RfY2xpZW50In0.1JqUvfv5i9wd9F7hWYW-Xafoc5bh9tFEupIoVYW09nU' \ +--header 'User-Agent: apifox/1.0.0 (https://www.apifox.cn)' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "resFullName": "/测试库/测试表", + "area": "china", + "resType": "hive", + "operationBit": "select", + "resFullPath": "/test.db/test", + "groupCode": "101" +}' +``` + +[![o4WzrQ.png](https://s1.ax1x.com/2021/12/10/o4WzrQ.png)](https://imgtu.com/i/o4WzrQ) + From 7e34bfb44f0ce2788bd53b0a30b1f747b508bcd9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 31 Mar 2022 20:58:44 +0000 Subject: [PATCH 25/46] Bump spring-webmvc from 5.1.0.RELEASE to 5.3.18 in /common/web Bumps [spring-webmvc](https://github.com/spring-projects/spring-framework) from 5.1.0.RELEASE to 5.3.18. - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v5.1.0.RELEASE...v5.3.18) --- updated-dependencies: - dependency-name: org.springframework:spring-webmvc dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- common/web/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/web/pom.xml b/common/web/pom.xml index 5425f271..cf827af8 100644 --- a/common/web/pom.xml +++ b/common/web/pom.xml @@ -39,7 +39,7 @@ org.springframework spring-webmvc - 5.1.0.RELEASE + 5.3.18 com.fasterxml.jackson.core From 754783318adf74cd4c8730bef6a2e21b65a0a336 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 May 2022 06:20:04 +0000 Subject: [PATCH 26/46] Bump spring-core from 5.0.11.RELEASE to 5.2.22.RELEASE in /common Bumps [spring-core](https://github.com/spring-projects/spring-framework) from 5.0.11.RELEASE to 5.2.22.RELEASE. - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v5.0.11.RELEASE...v5.2.22.RELEASE) --- updated-dependencies: - dependency-name: org.springframework:spring-core dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- common/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/pom.xml b/common/pom.xml index e3aa63da..add2f1ad 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -26,7 +26,7 @@ org.springframework spring-core - 5.0.11.RELEASE + 5.2.22.RELEASE From 51ca748913ac19a5d073f66b9944268210733a08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jun 2022 01:47:01 +0000 Subject: [PATCH 27/46] Bump mysql-connector-java from 8.0.16 to 8.0.28 in /demos/producer Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.16 to 8.0.28. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.16...8.0.28) --- updated-dependencies: - dependency-name: mysql:mysql-connector-java dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- demos/producer/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/producer/pom.xml b/demos/producer/pom.xml index 11ee87f0..101e0e0b 100644 --- a/demos/producer/pom.xml +++ b/demos/producer/pom.xml @@ -50,7 +50,7 @@ mysql mysql-connector-java - 8.0.16 + 8.0.28 org.flywaydb From cf22c49a9706805746e49883f59e3a7607023959 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jun 2022 01:47:03 +0000 Subject: [PATCH 28/46] Bump mysql-connector-java from 8.0.18 to 8.0.28 in /auth Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.18 to 8.0.28. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.18...8.0.28) --- updated-dependencies: - dependency-name: mysql:mysql-connector-java dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- auth/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/pom.xml b/auth/pom.xml index a426a1b3..b3fd1c19 100644 --- a/auth/pom.xml +++ b/auth/pom.xml @@ -57,7 +57,7 @@ mysql mysql-connector-java - 8.0.18 + 8.0.28 From cf488e04266bd13445b784c08b001e7f3df42a3e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jun 2022 01:47:03 +0000 Subject: [PATCH 29/46] Bump mysql-connector-java from 8.0.16 to 8.0.28 in /demos/producer-jpa Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.16 to 8.0.28. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.16...8.0.28) --- updated-dependencies: - dependency-name: mysql:mysql-connector-java dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- demos/producer-jpa/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/producer-jpa/pom.xml b/demos/producer-jpa/pom.xml index 98d98a64..d136138f 100644 --- a/demos/producer-jpa/pom.xml +++ b/demos/producer-jpa/pom.xml @@ -61,7 +61,7 @@ mysql mysql-connector-java - 8.0.16 + 8.0.28 From 4cab79b3101c5eb740a0a1aecefcfb432f467a93 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jun 2022 01:47:03 +0000 Subject: [PATCH 30/46] Bump mysql-connector-java from 8.0.16 to 8.0.28 in /webapps Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.16 to 8.0.28. - [Release notes](https://github.com/mysql/mysql-connector-j/releases) - [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES) - [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.16...8.0.28) --- updated-dependencies: - dependency-name: mysql:mysql-connector-java dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- webapps/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapps/pom.xml b/webapps/pom.xml index c1412c41..e8f6252d 100644 --- a/webapps/pom.xml +++ b/webapps/pom.xml @@ -42,7 +42,7 @@ mysql mysql-connector-java - 8.0.16 + 8.0.28 org.flywaydb From 79e079b7917f31680ea1ccae884f30061eee62a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Jun 2022 07:27:34 +0000 Subject: [PATCH 31/46] Bump jackson-databind from 2.9.10.8 to 2.12.6.1 in /common/web Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.9.10.8 to 2.12.6.1. - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) --- updated-dependencies: - dependency-name: com.fasterxml.jackson.core:jackson-databind dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- common/web/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/web/pom.xml b/common/web/pom.xml index 5425f271..5fa48c3d 100644 --- a/common/web/pom.xml +++ b/common/web/pom.xml @@ -44,7 +44,7 @@ com.fasterxml.jackson.core jackson-databind - 2.9.10.8 + 2.12.6.1 From e5d7cf54fccc500f0ee5bcd5536cce3baf43fc3c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Jun 2022 07:27:37 +0000 Subject: [PATCH 32/46] Bump jackson-databind in /auth/authorization-server Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.9.10.8 to 2.12.6.1. - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) --- updated-dependencies: - dependency-name: com.fasterxml.jackson.core:jackson-databind dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- auth/authorization-server/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/authorization-server/pom.xml b/auth/authorization-server/pom.xml index b5066206..012ef5ad 100644 --- a/auth/authorization-server/pom.xml +++ b/auth/authorization-server/pom.xml @@ -31,7 +31,7 @@ com.fasterxml.jackson.core jackson-databind - 2.9.10.8 + 2.12.6.1 compile From be912263d0db15b040c15776591d701f1252e612 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Jun 2022 07:29:34 +0000 Subject: [PATCH 33/46] Bump commons-io from 2.6 to 2.7 in /object-storage/file-service Bumps commons-io from 2.6 to 2.7. --- updated-dependencies: - dependency-name: commons-io:commons-io dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- object-storage/file-service/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object-storage/file-service/pom.xml b/object-storage/file-service/pom.xml index 26db7dae..e1729407 100644 --- a/object-storage/file-service/pom.xml +++ b/object-storage/file-service/pom.xml @@ -29,7 +29,7 @@ commons-io commons-io - 2.6 + 2.7 commons-fileupload From 9e3cdad63cfc097167eabb0c837cee8736c40720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Thu, 15 Jun 2023 23:18:40 +0800 Subject: [PATCH 34/46] =?UTF-8?q?=E6=9B=B4=E6=96=B0readme,=E5=BC=95?= =?UTF-8?q?=E5=AF=BC=E5=88=B0=E6=96=B0=E7=9A=84=E6=9E=B6=E6=9E=84=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/readme.md b/readme.md index 5b98edda..539b0b78 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,41 @@ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![codecov](https://codecov.io/gh/zhoutaoo/SpringCloud/branch/master/graph/badge.svg)](https://codecov.io/gh/zhoutaoo/SpringCloud) + +# 根据前期的使用和反馈,目前将脚手架整体进行了重构,发布了新的框架 Opensabre,当前仓库代码暂停维护 + +## 开放源码: https://github.com/opensabre/opensabre-framework + +## 在线文档: [在线文档](https://opensabre.github.io/docs/#/) + +## 架构特点 + +``` +1. 统一Restful的响应报文,controll返回原始类型即可,无需手动包装,简化代码,可读性更好。 + +2. 统一异常处理,封装了基本的异常的响应,如参数检验、文件上传等。简化代码,更方便扩展。 + +3. 默认集成Swagger 3.0 API文档,方便接口文档的传递、协作与调试。 + +4. 标准化WEB对象传递/转换/使用,方便统一开发风格,简化操作。 + +5. 框架/环境等元数据自动收集注册至properties和Nacos,方便系统运行时作为扩展判断,信息处理。 + +6. 系统启动时自动收集所有Restful url注册到权限资源,方便进行集中权限管理和授权使用。 + +7. 多机房/双活路由负载扩展支持,自定义路由和负载规则,更灵活、可控。 + +8. 默认引入spring validation,并扩展枚举、手机号等常用校验注解。 + +9. 默认引入日志trace、actuator等组件,统一日志打印格式。 + +10. 整体系统化为三层,framework框架、framework组件、基础应用,层次更清楚,结构更合理。 + +11. 配置中心,划分框架全局配置与应用配置(熔断降级、网关路由),规划中。 +``` + + + ## 快速开始 ### 先决条件 From 66330fa22403bc1db4b16f4c1bdc25116065e1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Sun, 30 Jul 2023 22:39:40 +0800 Subject: [PATCH 35/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 539b0b78..f1071b24 100644 --- a/readme.md +++ b/readme.md @@ -3,12 +3,14 @@ [![codecov](https://codecov.io/gh/zhoutaoo/SpringCloud/branch/master/graph/badge.svg)](https://codecov.io/gh/zhoutaoo/SpringCloud) -# 根据前期的使用和反馈,目前将脚手架整体进行了重构,发布了新的框架 Opensabre,当前仓库代码暂停维护 +# 根据前期的使用和反馈,目前将脚手架整体进行了重构,发布了新的框架 Opensabre,当前仓库代码暂停维护,请使用新版 ## 开放源码: https://github.com/opensabre/opensabre-framework ## 在线文档: [在线文档](https://opensabre.github.io/docs/#/) +## 进群交流: ![进群交流](https://github.com/zhoutaoo/SpringCloud/assets/3946731/b1ee1458-3e81-4228-b62b-39cee08fed39) + ## 架构特点 ``` From 6cbae728f7bc377dd4d7c36383e21733d9e33430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Wed, 1 Jan 2025 14:35:31 +0800 Subject: [PATCH 36/46] delete project --- .gitattributes | 3 - .github/ISSUE_TEMPLATE/bug_report.md | 21 - .github/ISSUE_TEMPLATE/feature_request.md | 17 - .github/workflows/maven.yml | 17 - .rancher-pipeline.yml | 8 - .travis.yml | 29 -- center/bus/.gitignore | 15 - center/bus/pom.xml | 44 -- center/bus/readme.md | 26 -- center/bus/src/main/docker/Dockerfile | 4 - .../cloud/center/bus/BusApplication.java | 13 - .../src/main/resources/application-local.yml | 15 - center/bus/src/main/resources/application.yml | 17 - center/bus/src/main/resources/bootstrap.yml | 12 - .../cloud/center/bus/BusApplicationTests.java | 16 - center/pom.xml | 30 -- cloud.ipr | 112 +++++ cloud.iws | 141 +++++++ common/core/.gitignore | 25 -- common/core/pom.xml | 40 -- common/core/readme.md | 28 -- .../cloud/common/core/entity/vo/Result.java | 168 -------- .../common/core/exception/BaseException.java | 32 -- .../common/core/exception/ErrorType.java | 17 - .../core/exception/ServiceException.java | 11 - .../core/exception/SystemErrorType.java | 34 -- .../common/core/util/UserContextHolder.java | 70 ---- common/pom.xml | 47 --- common/test/pom.xml | 29 -- common/test/readme.md | 29 -- .../cloud/common/test/PrivateHelper.java | 78 ---- .../cloud/common/test/PrivateHelperTest.java | 35 -- .../cloud/common/test/PrivateObject.java | 18 - common/web/pom.xml | 97 ----- common/web/readme.md | 28 -- .../common/web/entity/form/BaseForm.java | 43 -- .../common/web/entity/form/BaseQueryForm.java | 44 -- .../common/web/entity/param/BaseParam.java | 23 - .../cloud/common/web/entity/po/BasePo.java | 29 -- .../cloud/common/web/entity/vo/BaseVo.java | 13 - .../DefaultGlobalExceptionHandlerAdvice.java | 59 --- .../web/handler/PoMetaObjectHandler.java | 36 -- .../web/interceptor/UserInterceptor.java | 50 --- .../cloud/common/web/redis/RedisConfig.java | 48 --- ...faultGlobalExceptionHandlerAdviceTest.java | 12 - .../web/interceptor/UserInterceptorTest.java | 27 -- data/kong/.gitkeep | 0 data/mysql/.gitkeep | 0 data/rabbitmq/.gitkeep | 0 data/redis/.gitkeep | 0 demos/.project | 17 + docker-compose/.env | 63 --- docker-compose/devops/elasticsearch.yml | 7 - docker-compose/devops/kibana.yml | 104 ----- .../skywalking/config/alarm-settings.yml | 71 ---- .../devops/skywalking/config/application.yml | 111 ----- .../skywalking/config/component-libraries.yml | 281 ------------- .../devops/skywalking/config/log4j2.xml | 36 -- docker-compose/docker-compose.auth.yml | 44 -- docker-compose/docker-compose.center.yml | 14 - docker-compose/docker-compose.devops.yml | 101 ----- docker-compose/docker-compose.gateway.yml | 29 -- docker-compose/docker-compose.monitor.yml | 24 -- docker-compose/docker-compose.moss.yml | 28 -- docker-compose/docker-compose.nacos.yml | 27 -- .../docker-compose.spring-gateway.yml | 27 -- docker-compose/docker-compose.yml | 62 --- docker-compose/init-db.sh | 8 - docker-compose/moss/mysql/moss-init.sql | 368 ---------------- docker-compose/nacos/prometheus.yaml | 34 -- docker-compose/readme.md | 30 -- facade/pom.xml | 24 -- .../constant/PermissionChangeTypeEnum.java | 21 - .../cloud/sysadmin/facade/dto/GroupDTO.java | 26 -- .../facade/dto/PermissionChangeDTO.java | 25 -- .../sysadmin/facade/dto/PermissionDTO.java | 52 --- install.sh | 223 ---------- monitor/admin/.gitignore | 16 - monitor/admin/pom.xml | 60 --- monitor/admin/src/main/docker/Dockerfile | 4 - .../springboot/admin/AdminApplication.java | 15 - .../com/springboot/admin/SecurityConfig.java | 37 -- .../admin/src/main/resources/application.yml | 38 -- .../admin/src/main/resources/bootstrap.yml | 12 - .../admin/ConsumerApplicationTests.java | 16 - monitor/pom.xml | 30 -- monitor/readme.md | 154 ------- .../docs/minio\351\203\250\347\275\262.md" | 53 --- object-storage/file-service/pom.xml | 93 ---- .../file-service/src/main/docker/Dockerfile | 4 - .../cloud/file/FileServiceApplication.java | 16 - .../cloud/file/configure/MinioConfigure.java | 36 -- .../cloud/file/configure/MinioProperties.java | 26 -- .../cloud/file/entity/FileObject.java | 22 - .../GlobalExceptionHandlerAdvice.java | 21 - .../file/exception/MinioFileException.java | 22 - .../cloud/file/exception/MinioFileType.java | 31 -- .../cloud/file/rest/FileController.java | 124 ------ .../cloud/file/service/FileService.java | 37 -- .../file/service/MinIoFileServiceImpl.java | 62 --- .../cloud/file/util/MinioFileUtil.java | 110 ----- .../src/main/resources/application.yml | 37 -- .../src/main/resources/bootstrap.yml | 12 - .../file/FileServiceApplicationTests.java | 16 - object-storage/pom.xml | 22 - sysadmin/db/db.sql | 396 ------------------ sysadmin/organization/pom.xml | 56 --- .../organization/src/main/docker/Dockerfile | 4 - .../organization/OrganizationApplication.java | 19 - .../organization/config/BusConfig.java | 101 ----- .../config/MyMetaObjectHandler.java | 9 - .../organization/config/MyRedisConfig.java | 11 - .../organization/config/MybatisConfig.java | 29 -- .../organization/config/SwaggerConfig.java | 35 -- .../config/WebServerMvcConfigurerAdapter.java | 22 - .../organization/dao/GroupMapper.java | 11 - .../dao/GroupPermissionMapper.java | 17 - .../sysadmin/organization/dao/MenuMapper.java | 11 - .../organization/dao/PermissionMapper.java | 16 - .../organization/dao/PositionMapper.java | 11 - .../organization/dao/ResourceMapper.java | 11 - .../sysadmin/organization/dao/RoleMapper.java | 11 - .../organization/dao/RoleResourceMapper.java | 11 - .../organization/dao/UserGroupMapper.java | 17 - .../sysadmin/organization/dao/UserMapper.java | 11 - .../organization/dao/UserRoleMapper.java | 11 - .../organization/entity/form/GroupForm.java | 25 -- .../entity/form/GroupQueryForm.java | 31 -- .../organization/entity/form/MenuForm.java | 39 -- .../entity/form/MenuQueryForm.java | 31 -- .../entity/form/PermissionForm.java | 50 --- .../entity/form/PositionForm.java | 21 - .../entity/form/PositionQueryForm.java | 47 --- .../entity/form/ResourceForm.java | 37 -- .../entity/form/ResourceQueryForm.java | 38 -- .../organization/entity/form/RoleForm.java | 30 -- .../entity/form/RoleQueryForm.java | 32 -- .../entity/form/RoleUpdateForm.java | 27 -- .../organization/entity/form/UserForm.java | 52 --- .../entity/form/UserQueryForm.java | 35 -- .../entity/form/UserUpdateForm.java | 47 --- .../entity/param/GroupQueryParam.java | 15 - .../entity/param/MenuQueryParam.java | 14 - .../entity/param/PositionQueryParam.java | 14 - .../entity/param/ResourceQueryParam.java | 18 - .../entity/param/RoleQueryParam.java | 17 - .../entity/param/UserQueryParam.java | 16 - .../organization/entity/po/Group.java | 22 - .../entity/po/GroupPermission.java | 24 -- .../sysadmin/organization/entity/po/Menu.java | 21 - .../organization/entity/po/Permission.java | 55 --- .../organization/entity/po/Position.java | 19 - .../organization/entity/po/Resource.java | 20 - .../sysadmin/organization/entity/po/Role.java | 25 -- .../organization/entity/po/RoleResource.java | 18 - .../sysadmin/organization/entity/po/User.java | 33 -- .../organization/entity/po/UserGroup.java | 24 -- .../organization/entity/po/UserRole.java | 18 - .../organization/entity/vo/UserVo.java | 30 -- .../organization/events/EventSender.java | 31 -- .../events/PermissionBusReceiver.java | 48 --- .../GlobalExceptionHandlerAdvice.java | 18 - .../exception/OrganizationErrorType.java | 25 -- .../exception/RoleNotFoundException.java | 13 - .../exception/UserNotFoundException.java | 13 - .../organization/rest/GroupController.java | 102 ----- .../organization/rest/MenuController.java | 91 ---- .../rest/PermissionController.java | 30 -- .../organization/rest/PositionController.java | 70 ---- .../organization/rest/ResourceController.java | 90 ---- .../organization/rest/RoleController.java | 88 ---- .../organization/rest/UserController.java | 77 ---- .../organization/service/IGroupService.java | 60 --- .../organization/service/IMenuService.java | 52 --- .../service/IPermissionService.java | 48 --- .../service/IPositionService.java | 45 -- .../service/IResourceService.java | 61 --- .../service/IRoleResourceService.java | 42 -- .../organization/service/IRoleService.java | 61 --- .../service/IUserRoleService.java | 31 -- .../organization/service/IUserService.java | 55 --- .../service/impl/GroupService.java | 88 ---- .../service/impl/MenuService.java | 55 --- .../service/impl/PermissionService.java | 111 ----- .../service/impl/PositionService.java | 51 --- .../service/impl/ResourceService.java | 102 ----- .../service/impl/RoleResourceService.java | 56 --- .../service/impl/RoleService.java | 88 ---- .../service/impl/UserRoleService.java | 46 -- .../service/impl/UserService.java | 104 ----- .../src/main/resources/application-local.yml | 126 ------ .../src/main/resources/application.yml | 127 ------ .../src/main/resources/bootstrap.yml | 12 - sysadmin/pom.xml | 23 - webapps/pom.xml | 104 ----- webapps/webapp-parent/pom.xml | 31 -- 196 files changed, 270 insertions(+), 8463 deletions(-) delete mode 100644 .gitattributes delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/workflows/maven.yml delete mode 100644 .rancher-pipeline.yml delete mode 100644 .travis.yml delete mode 100644 center/bus/.gitignore delete mode 100644 center/bus/pom.xml delete mode 100644 center/bus/readme.md delete mode 100644 center/bus/src/main/docker/Dockerfile delete mode 100644 center/bus/src/main/java/com/springboot/cloud/center/bus/BusApplication.java delete mode 100644 center/bus/src/main/resources/application-local.yml delete mode 100644 center/bus/src/main/resources/application.yml delete mode 100644 center/bus/src/main/resources/bootstrap.yml delete mode 100644 center/bus/src/test/java/com/springboot/cloud/center/bus/BusApplicationTests.java delete mode 100644 center/pom.xml create mode 100644 cloud.ipr create mode 100644 cloud.iws delete mode 100644 common/core/.gitignore delete mode 100644 common/core/pom.xml delete mode 100644 common/core/readme.md delete mode 100644 common/core/src/main/java/com/springboot/cloud/common/core/entity/vo/Result.java delete mode 100644 common/core/src/main/java/com/springboot/cloud/common/core/exception/BaseException.java delete mode 100644 common/core/src/main/java/com/springboot/cloud/common/core/exception/ErrorType.java delete mode 100644 common/core/src/main/java/com/springboot/cloud/common/core/exception/ServiceException.java delete mode 100644 common/core/src/main/java/com/springboot/cloud/common/core/exception/SystemErrorType.java delete mode 100644 common/core/src/main/java/com/springboot/cloud/common/core/util/UserContextHolder.java delete mode 100644 common/pom.xml delete mode 100644 common/test/pom.xml delete mode 100644 common/test/readme.md delete mode 100644 common/test/src/main/java/com/springboot/cloud/common/test/PrivateHelper.java delete mode 100644 common/test/src/test/java/com/springboot/cloud/common/test/PrivateHelperTest.java delete mode 100644 common/test/src/test/java/com/springboot/cloud/common/test/PrivateObject.java delete mode 100644 common/web/pom.xml delete mode 100644 common/web/readme.md delete mode 100644 common/web/src/main/java/com/springboot/cloud/common/web/entity/form/BaseForm.java delete mode 100644 common/web/src/main/java/com/springboot/cloud/common/web/entity/form/BaseQueryForm.java delete mode 100644 common/web/src/main/java/com/springboot/cloud/common/web/entity/param/BaseParam.java delete mode 100644 common/web/src/main/java/com/springboot/cloud/common/web/entity/po/BasePo.java delete mode 100644 common/web/src/main/java/com/springboot/cloud/common/web/entity/vo/BaseVo.java delete mode 100644 common/web/src/main/java/com/springboot/cloud/common/web/exception/DefaultGlobalExceptionHandlerAdvice.java delete mode 100644 common/web/src/main/java/com/springboot/cloud/common/web/handler/PoMetaObjectHandler.java delete mode 100644 common/web/src/main/java/com/springboot/cloud/common/web/interceptor/UserInterceptor.java delete mode 100644 common/web/src/main/java/com/springboot/cloud/common/web/redis/RedisConfig.java delete mode 100644 common/web/src/test/java/com/springboot/cloud/common/web/exception/DefaultGlobalExceptionHandlerAdviceTest.java delete mode 100644 common/web/src/test/java/com/springboot/cloud/common/web/interceptor/UserInterceptorTest.java delete mode 100644 data/kong/.gitkeep delete mode 100644 data/mysql/.gitkeep delete mode 100644 data/rabbitmq/.gitkeep delete mode 100644 data/redis/.gitkeep create mode 100644 demos/.project delete mode 100644 docker-compose/.env delete mode 100644 docker-compose/devops/elasticsearch.yml delete mode 100644 docker-compose/devops/kibana.yml delete mode 100644 docker-compose/devops/skywalking/config/alarm-settings.yml delete mode 100644 docker-compose/devops/skywalking/config/application.yml delete mode 100644 docker-compose/devops/skywalking/config/component-libraries.yml delete mode 100644 docker-compose/devops/skywalking/config/log4j2.xml delete mode 100644 docker-compose/docker-compose.auth.yml delete mode 100644 docker-compose/docker-compose.center.yml delete mode 100644 docker-compose/docker-compose.devops.yml delete mode 100644 docker-compose/docker-compose.gateway.yml delete mode 100644 docker-compose/docker-compose.monitor.yml delete mode 100644 docker-compose/docker-compose.moss.yml delete mode 100644 docker-compose/docker-compose.nacos.yml delete mode 100644 docker-compose/docker-compose.spring-gateway.yml delete mode 100644 docker-compose/docker-compose.yml delete mode 100755 docker-compose/init-db.sh delete mode 100644 docker-compose/moss/mysql/moss-init.sql delete mode 100644 docker-compose/nacos/prometheus.yaml delete mode 100644 docker-compose/readme.md delete mode 100644 facade/pom.xml delete mode 100644 facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java delete mode 100644 facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java delete mode 100644 facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java delete mode 100644 facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java delete mode 100755 install.sh delete mode 100644 monitor/admin/.gitignore delete mode 100644 monitor/admin/pom.xml delete mode 100644 monitor/admin/src/main/docker/Dockerfile delete mode 100644 monitor/admin/src/main/java/com/springboot/admin/AdminApplication.java delete mode 100644 monitor/admin/src/main/java/com/springboot/admin/SecurityConfig.java delete mode 100644 monitor/admin/src/main/resources/application.yml delete mode 100644 monitor/admin/src/main/resources/bootstrap.yml delete mode 100644 monitor/admin/src/test/java/com/springboot/admin/ConsumerApplicationTests.java delete mode 100644 monitor/pom.xml delete mode 100644 monitor/readme.md delete mode 100644 "object-storage/docs/minio\351\203\250\347\275\262.md" delete mode 100644 object-storage/file-service/pom.xml delete mode 100644 object-storage/file-service/src/main/docker/Dockerfile delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/FileServiceApplication.java delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioConfigure.java delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioProperties.java delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/entity/FileObject.java delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/GlobalExceptionHandlerAdvice.java delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileException.java delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileType.java delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/rest/FileController.java delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/service/FileService.java delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/service/MinIoFileServiceImpl.java delete mode 100644 object-storage/file-service/src/main/java/com/springboot/cloud/file/util/MinioFileUtil.java delete mode 100644 object-storage/file-service/src/main/resources/application.yml delete mode 100644 object-storage/file-service/src/main/resources/bootstrap.yml delete mode 100644 object-storage/file-service/src/test/java/com/springboot/cloud/file/FileServiceApplicationTests.java delete mode 100644 object-storage/pom.xml delete mode 100644 sysadmin/db/db.sql delete mode 100644 sysadmin/organization/pom.xml delete mode 100644 sysadmin/organization/src/main/docker/Dockerfile delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/OrganizationApplication.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MyMetaObjectHandler.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MyRedisConfig.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MybatisConfig.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/SwaggerConfig.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/WebServerMvcConfigurerAdapter.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupPermissionMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/MenuMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PositionMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/ResourceMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/RoleMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/RoleResourceMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserGroupMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserRoleMapper.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/GroupForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/GroupQueryForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/MenuForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/MenuQueryForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PermissionForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PositionForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PositionQueryForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/ResourceForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/ResourceQueryForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleQueryForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleUpdateForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserQueryForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserUpdateForm.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/GroupQueryParam.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/MenuQueryParam.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/PositionQueryParam.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/ResourceQueryParam.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/RoleQueryParam.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/UserQueryParam.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Group.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/GroupPermission.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Menu.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Position.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Resource.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Role.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/RoleResource.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/User.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserRole.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/vo/UserVo.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/EventSender.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/PermissionBusReceiver.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/GlobalExceptionHandlerAdvice.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/OrganizationErrorType.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/RoleNotFoundException.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/UserNotFoundException.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/GroupController.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/MenuController.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PositionController.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/ResourceController.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/RoleController.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/UserController.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IGroupService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IMenuService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPositionService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IResourceService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IRoleResourceService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IRoleService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IUserRoleService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IUserService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/GroupService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/MenuService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PositionService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/RoleResourceService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/RoleService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/UserRoleService.java delete mode 100644 sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/UserService.java delete mode 100644 sysadmin/organization/src/main/resources/application-local.yml delete mode 100644 sysadmin/organization/src/main/resources/application.yml delete mode 100644 sysadmin/organization/src/main/resources/bootstrap.yml delete mode 100644 sysadmin/pom.xml delete mode 100644 webapps/pom.xml delete mode 100644 webapps/webapp-parent/pom.xml diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 22e80cdb..00000000 --- a/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -*.html linguist-language=java -*.js linguist-language=java - diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 5f2bf9e5..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: BUG提交 -about: 提交缺陷 - ---- - -**BUG描述** - -清晰的BUG描述,有助于判断问题,请按如下步骤 - - 1.说明操作的背景,使用了哪个模块什么功能? - - 2.怎么输入或操作的得到了什么结果? - - 3.预期结果与实际有什么差异? - -**截图** - -**环境** - -操作系统、组件版本、数据库等 diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 066b2d92..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 index b05aab94..00000000 --- a/.github/workflows/maven.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Java CI - -on: [push] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Build with Maven - run: mvn package --file pom.xml diff --git a/.rancher-pipeline.yml b/.rancher-pipeline.yml deleted file mode 100644 index 6252dc00..00000000 --- a/.rancher-pipeline.yml +++ /dev/null @@ -1,8 +0,0 @@ -stages: -- name: Compile - steps: - - runScriptConfig: - image: maven - shellScript: mvn compile -timeout: 60 -notification: {} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8d26d864..00000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: java -jdk: - - openjdk8 - -notification: - email: - recipients: - - zhoutaoo@foxmail.com - on_success: always - on_failure: always - -before_script: - - echo "MAVEN_OPTS='-Xms1024m -Xmx3072m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m'" > ~/.mavenrc - -before_install: - - pip install --user codecov - -after_success: - - mvn clean test jacoco:report coveralls:report - - codecov - - bash <(curl -s https://codecov.io/bash) - -branches: - only: - - master - -cache: - directories: - - $HOME/.m2 diff --git a/center/bus/.gitignore b/center/bus/.gitignore deleted file mode 100644 index 768b37c9..00000000 --- a/center/bus/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -target/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr diff --git a/center/bus/pom.xml b/center/bus/pom.xml deleted file mode 100644 index 2db9ac1a..00000000 --- a/center/bus/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - - com.springboot.cloud - bus-server - 0.0.1-SNAPSHOT - jar - - bus-server - Demo project for Spring Cloud Bus Server - - - com.springboot.cloud - center - 0.0.1-SNAPSHOT - - - - - - - com.spotify - docker-maven-plugin - 1.2.0 - - - cike/${project.artifactId} - ${project.basedir}/src/main/docker - true - - - / - ${project.build.directory} - ${project.build.finalName}.jar - - - - - - - - diff --git a/center/bus/readme.md b/center/bus/readme.md deleted file mode 100644 index 78c6a4b8..00000000 --- a/center/bus/readme.md +++ /dev/null @@ -1,26 +0,0 @@ -消息中心应用 ----------- - -## 关键词 - -`消息中心、mq、rabbitmq、Spring Cloud Bus、消息总线` - -## 简介 - -分布式中的其他服务都连接到消息系统,并且实现消息的生产、监听、和消费,可以用来建立一个多个应用之间的通信频道,以达到系统解耦、流量削锋、异步通讯等,本例中使用的是rabbitMQ,你也可以换成其它的如Kafka、RocketMq等 - -利用消息中心的机制可以做很多的事情,比如日志、指标的收集等,其中配置中心客户端刷新就是典型的应用场景之一,详情请见[配置中心文档](./center/config)。 - -## 启动 - -### 先决条件 - -- [rabbitmq](http://rabbitmq.io/download) - -### 启动命令 - -进入应用目录 - -启动命令:`mvn spring-boot:run` - -docker镜像打包:`mvn docker:build` \ No newline at end of file diff --git a/center/bus/src/main/docker/Dockerfile b/center/bus/src/main/docker/Dockerfile deleted file mode 100644 index 14b4485f..00000000 --- a/center/bus/src/main/docker/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM java:alpine -VOLUME /tmp -ADD bus-server-0.0.1-SNAPSHOT.jar app.jar -ENTRYPOINT ["java","-jar","/app.jar"] diff --git a/center/bus/src/main/java/com/springboot/cloud/center/bus/BusApplication.java b/center/bus/src/main/java/com/springboot/cloud/center/bus/BusApplication.java deleted file mode 100644 index de001372..00000000 --- a/center/bus/src/main/java/com/springboot/cloud/center/bus/BusApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.springboot.cloud.center.bus; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; - -@SpringBootApplication -@EnableDiscoveryClient -public class BusApplication { - public static void main(String[] args) { - SpringApplication.run(BusApplication.class, args); - } -} diff --git a/center/bus/src/main/resources/application-local.yml b/center/bus/src/main/resources/application-local.yml deleted file mode 100644 index 9ef45a04..00000000 --- a/center/bus/src/main/resources/application-local.yml +++ /dev/null @@ -1,15 +0,0 @@ -spring: - rabbitmq: - host: ${RABBIT_MQ_HOST:localhost} - port: ${RABBIT_MQ_PORT:5672} - username: ${RABBIT_MQ_USERNAME:myuser} - password: ${RABBIT_MQ_PASSWORD:mypass} - -management: - endpoints: - web: - exposure: - include: '*' -logging: - level: - root: info \ No newline at end of file diff --git a/center/bus/src/main/resources/application.yml b/center/bus/src/main/resources/application.yml deleted file mode 100644 index 94cbfed0..00000000 --- a/center/bus/src/main/resources/application.yml +++ /dev/null @@ -1,17 +0,0 @@ -spring: - profiles: - active: local - rabbitmq: - host: ${RABBIT_MQ_HOST:localhost} - port: ${RABBIT_MQ_PORT:5672} - username: ${RABBIT_MQ_USERNAME:guest} - password: ${RABBIT_MQ_PASSWORD:guest} - -management: - endpoints: - web: - exposure: - include: '*' -logging: - level: - root: info \ No newline at end of file diff --git a/center/bus/src/main/resources/bootstrap.yml b/center/bus/src/main/resources/bootstrap.yml deleted file mode 100644 index 3e915289..00000000 --- a/center/bus/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,12 +0,0 @@ -server: - port: ${SERVER_PORT:8071} -spring: - application: - name: bus - cloud: - nacos: - discovery: - server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848} - config: - server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848} - file-extension: yml \ No newline at end of file diff --git a/center/bus/src/test/java/com/springboot/cloud/center/bus/BusApplicationTests.java b/center/bus/src/test/java/com/springboot/cloud/center/bus/BusApplicationTests.java deleted file mode 100644 index be4e5cb4..00000000 --- a/center/bus/src/test/java/com/springboot/cloud/center/bus/BusApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.springboot.cloud.center.bus; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class BusApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/center/pom.xml b/center/pom.xml deleted file mode 100644 index 5a9d819e..00000000 --- a/center/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - 4.0.0 - - com.springboot.cloud - center - 0.0.1-SNAPSHOT - pom - - center - Demo Center Monitor project for Spring Boot - - - com.springboot.cloud - cloud - 0.0.1-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-web - - - - - bus - - diff --git a/cloud.ipr b/cloud.ipr new file mode 100644 index 00000000..72b916e6 --- /dev/null +++ b/cloud.ipr @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cloud.iws b/cloud.iws new file mode 100644 index 00000000..fc9b96a8 --- /dev/null +++ b/cloud.iws @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1735710109962 + + + + + + \ No newline at end of file diff --git a/common/core/.gitignore b/common/core/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/common/core/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/common/core/pom.xml b/common/core/pom.xml deleted file mode 100644 index 6ab74868..00000000 --- a/common/core/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - 4.0.0 - - com.springboot.cloud - core - 0.0.1-SNAPSHOT - jar - - core - Demo Core project for Spring Boot - - - UTF-8 - UTF-8 - 1.8 - 1.8 - - - - com.springboot.cloud - common - 0.0.1-SNAPSHOT - - - - - - io.springfox - springfox-swagger2 - 2.9.2 - - - io.springfox - springfox-swagger-ui - 2.9.2 - - - diff --git a/common/core/readme.md b/common/core/readme.md deleted file mode 100644 index 28efb916..00000000 --- a/common/core/readme.md +++ /dev/null @@ -1,28 +0,0 @@ -核心公共包 ----------- - -## 简介 - -主要封装一些通用公共类、工具类,如业务异常父类,对象父类等。 - -## 使用 - -进入应用目录 - -安装命令:`mvn install` - -## 使用指南 - -### 应用引入 - -需要将编译生成的jar包安装到本地maven类进入引用使用。 - -pom.xml - -``` - - com.springboot.cloud - core - 0.0.1-SNAPSHOT - -``` \ No newline at end of file diff --git a/common/core/src/main/java/com/springboot/cloud/common/core/entity/vo/Result.java b/common/core/src/main/java/com/springboot/cloud/common/core/entity/vo/Result.java deleted file mode 100644 index 1a41aa2a..00000000 --- a/common/core/src/main/java/com/springboot/cloud/common/core/entity/vo/Result.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.springboot.cloud.common.core.entity.vo; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.springboot.cloud.common.core.exception.BaseException; -import com.springboot.cloud.common.core.exception.ErrorType; -import com.springboot.cloud.common.core.exception.SystemErrorType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.Getter; - -import java.time.Instant; -import java.time.ZonedDateTime; - -@ApiModel(description = "rest请求的返回模型,所有rest正常都返回该类的对象") -@Data -public class Result { - - public static final String SUCCESSFUL_CODE = "000000"; - public static final String SUCCESSFUL_MESG = "处理成功"; - - @ApiModelProperty(value = "处理结果code", required = true) - private String code; - @ApiModelProperty(value = "处理结果描述信息") - private String mesg; - @ApiModelProperty(value = "请求结果生成时间戳") - private Instant time; - @ApiModelProperty(value = "处理结果数据信息") - @JsonInclude(JsonInclude.Include.NON_NULL) - private T data; - - public Result() { - this.time = ZonedDateTime.now().toInstant(); - } - - /** - * @param errorType - */ - public Result(ErrorType errorType) { - this.code = errorType.getCode(); - this.mesg = errorType.getMesg(); - this.time = ZonedDateTime.now().toInstant(); - } - - /** - * @param errorType - * @param data - */ - public Result(ErrorType errorType, T data) { - this(errorType); - this.data = data; - } - - /** - * 内部使用,用于构造成功的结果 - * - * @param code - * @param mesg - * @param data - */ - private Result(String code, String mesg, T data) { - this.code = code; - this.mesg = mesg; - this.data = data; - this.time = ZonedDateTime.now().toInstant(); - } - - /** - * 快速创建成功结果并返回结果数据 - * - * @param data - * @return Result - */ - public static Result success(Object data) { - return new Result<>(SUCCESSFUL_CODE, SUCCESSFUL_MESG, data); - } - - /** - * 快速创建成功结果 - * - * @return Result - */ - public static Result success() { - return success(null); - } - - /** - * 系统异常类没有返回数据 - * - * @return Result - */ - public static Result fail() { - return new Result(SystemErrorType.SYSTEM_ERROR); - } - - /** - * 系统异常类没有返回数据 - * - * @param baseException - * @return Result - */ - public static Result fail(BaseException baseException) { - return fail(baseException, null); - } - - /** - * 系统异常类并返回结果数据 - * - * @param data - * @return Result - */ - public static Result fail(BaseException baseException, Object data) { - return new Result<>(baseException.getErrorType(), data); - } - - /** - * 系统异常类并返回结果数据 - * - * @param errorType - * @param data - * @return Result - */ - public static Result fail(ErrorType errorType, Object data) { - return new Result<>(errorType, data); - } - - /** - * 系统异常类并返回结果数据 - * - * @param errorType - * @return Result - */ - public static Result fail(ErrorType errorType) { - return Result.fail(errorType, null); - } - - /** - * 系统异常类并返回结果数据 - * - * @param data - * @return Result - */ - public static Result fail(Object data) { - return new Result<>(SystemErrorType.SYSTEM_ERROR, data); - } - - - /** - * 成功code=000000 - * - * @return true/false - */ - @JsonIgnore - public boolean isSuccess() { - return SUCCESSFUL_CODE.equals(this.code); - } - - /** - * 失败 - * - * @return true/false - */ - @JsonIgnore - public boolean isFail() { - return !isSuccess(); - } -} diff --git a/common/core/src/main/java/com/springboot/cloud/common/core/exception/BaseException.java b/common/core/src/main/java/com/springboot/cloud/common/core/exception/BaseException.java deleted file mode 100644 index 020e6edf..00000000 --- a/common/core/src/main/java/com/springboot/cloud/common/core/exception/BaseException.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.springboot.cloud.common.core.exception; - -import lombok.Getter; - -@Getter -public class BaseException extends RuntimeException { - /** - * 异常对应的错误类型 - */ - private final ErrorType errorType; - - /** - * 默认是系统异常 - */ - public BaseException() { - this.errorType = SystemErrorType.SYSTEM_ERROR; - } - - public BaseException(ErrorType errorType) { - this.errorType = errorType; - } - - public BaseException(ErrorType errorType, String message) { - super(message); - this.errorType = errorType; - } - - public BaseException(ErrorType errorType, String message, Throwable cause) { - super(message, cause); - this.errorType = errorType; - } -} diff --git a/common/core/src/main/java/com/springboot/cloud/common/core/exception/ErrorType.java b/common/core/src/main/java/com/springboot/cloud/common/core/exception/ErrorType.java deleted file mode 100644 index ba712eba..00000000 --- a/common/core/src/main/java/com/springboot/cloud/common/core/exception/ErrorType.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.springboot.cloud.common.core.exception; - -public interface ErrorType { - /** - * 返回code - * - * @return - */ - String getCode(); - - /** - * 返回mesg - * - * @return - */ - String getMesg(); -} diff --git a/common/core/src/main/java/com/springboot/cloud/common/core/exception/ServiceException.java b/common/core/src/main/java/com/springboot/cloud/common/core/exception/ServiceException.java deleted file mode 100644 index 0742efbd..00000000 --- a/common/core/src/main/java/com/springboot/cloud/common/core/exception/ServiceException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.springboot.cloud.common.core.exception; - -/** - * Created by zhoutaoo on 2018/6/2. - */ -public class ServiceException extends BaseException { - - //TODO 对业务异常的返回码进行校验,规范到一定范围内 - - -} diff --git a/common/core/src/main/java/com/springboot/cloud/common/core/exception/SystemErrorType.java b/common/core/src/main/java/com/springboot/cloud/common/core/exception/SystemErrorType.java deleted file mode 100644 index 5e4bce18..00000000 --- a/common/core/src/main/java/com/springboot/cloud/common/core/exception/SystemErrorType.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.springboot.cloud.common.core.exception; - -import lombok.Getter; - -@Getter -public enum SystemErrorType implements ErrorType { - - SYSTEM_ERROR("-1", "系统异常"), - SYSTEM_BUSY("000001", "系统繁忙,请稍候再试"), - - GATEWAY_NOT_FOUND_SERVICE("010404", "服务未找到"), - GATEWAY_ERROR("010500", "网关异常"), - GATEWAY_CONNECT_TIME_OUT("010002", "网关超时"), - - ARGUMENT_NOT_VALID("020000", "请求参数校验不通过"), - INVALID_TOKEN("020001", "无效token"), - UPLOAD_FILE_SIZE_LIMIT("020010", "上传文件大小超过限制"), - - DUPLICATE_PRIMARY_KEY("030000","唯一键冲突"); - - /** - * 错误类型码 - */ - private String code; - /** - * 错误类型描述信息 - */ - private String mesg; - - SystemErrorType(String code, String mesg) { - this.code = code; - this.mesg = mesg; - } -} diff --git a/common/core/src/main/java/com/springboot/cloud/common/core/util/UserContextHolder.java b/common/core/src/main/java/com/springboot/cloud/common/core/util/UserContextHolder.java deleted file mode 100644 index a547450b..00000000 --- a/common/core/src/main/java/com/springboot/cloud/common/core/util/UserContextHolder.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.springboot.cloud.common.core.util; - -import com.google.common.collect.Maps; - -import java.util.Map; -import java.util.Optional; - -/** - * 用户上下文 - */ -public class UserContextHolder { - - private ThreadLocal> threadLocal; - - private UserContextHolder() { - this.threadLocal = new ThreadLocal<>(); - } - - /** - * 创建实例 - * - * @return - */ - public static UserContextHolder getInstance() { - return SingletonHolder.sInstance; - } - - /** - * 静态内部类单例模式 - * 单例初使化 - */ - private static class SingletonHolder { - private static final UserContextHolder sInstance = new UserContextHolder(); - } - - /** - * 用户上下文中放入信息 - * - * @param map - */ - public void setContext(Map map) { - threadLocal.set(map); - } - - /** - * 获取上下文中的信息 - * - * @return - */ - public Map getContext() { - return threadLocal.get(); - } - - /** - * 获取上下文中的用户名 - * - * @return - */ - public String getUsername() { - return Optional.ofNullable(threadLocal.get()).orElse(Maps.newHashMap()).get("user_name"); - } - - /** - * 清空上下文 - */ - public void clear() { - threadLocal.remove(); - } - -} diff --git a/common/pom.xml b/common/pom.xml deleted file mode 100644 index add2f1ad..00000000 --- a/common/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - 4.0.0 - - com.springboot.cloud - common - 0.0.1-SNAPSHOT - pom - - common - Demo Common project for Spring Boot - - - core - web - test - - - - - commons-lang - commons-lang - 2.6 - - - org.springframework - spring-core - 5.2.22.RELEASE - - - - org.projectlombok - lombok - 1.18.10 - provided - - - - junit - junit - 4.13.1 - test - - - - diff --git a/common/test/pom.xml b/common/test/pom.xml deleted file mode 100644 index 44915789..00000000 --- a/common/test/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - 4.0.0 - - com.springboot.cloud - test - 0.0.1-SNAPSHOT - jar - - test - Demo Test project for Spring Boot - - - UTF-8 - UTF-8 - 1.8 - 1.8 - - - - com.springboot.cloud - common - 0.0.1-SNAPSHOT - - - - - \ No newline at end of file diff --git a/common/test/readme.md b/common/test/readme.md deleted file mode 100644 index 93e5e7fc..00000000 --- a/common/test/readme.md +++ /dev/null @@ -1,29 +0,0 @@ -测试公共包 ----------- - -## 简介 - -主要封装一些测试用通用公共类、工具类,如测试数据生成类、私有方法测试辅助类等。 - -## 使用 - -进入应用目录 - -安装命令:`mvn install` - -## 使用指南 - -### 应用引入 - -需要将编译生成的jar包安装到本地maven类进入引用使用。 - -pom.xml - -``` - - com.springboot.cloud - test - test - 0.0.1-SNAPSHOT - -``` \ No newline at end of file diff --git a/common/test/src/main/java/com/springboot/cloud/common/test/PrivateHelper.java b/common/test/src/main/java/com/springboot/cloud/common/test/PrivateHelper.java deleted file mode 100644 index 3e95f690..00000000 --- a/common/test/src/main/java/com/springboot/cloud/common/test/PrivateHelper.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.springboot.cloud.common.test; - -import org.springframework.util.ReflectionUtils; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -public class PrivateHelper { - - private PrivateHelper() { - } - - /** - * 创建实例 - * - * @return - */ - public static PrivateHelper getInstance() { - return SingletPrivateHelper.sInstance; - } - - /** - * 静态内部类单例模式 - * 单例初使化 - */ - private static class SingletPrivateHelper { - private static final PrivateHelper sInstance = new PrivateHelper(); - } - - /** - * @param instance 实例对象 - * @param fieldName 成员变量名 - * @param value 值 - */ - public void setPrivateField(Object instance, String fieldName, Object value) { - Field signingKeyField = ReflectionUtils.findField(instance.getClass(), fieldName); - ReflectionUtils.makeAccessible(signingKeyField); - ReflectionUtils.setField(signingKeyField, instance, value); - - } - - /** - * 寻找对象有参方法 - * - * @param instance 实例对象 - * @param methodName 方法名 - * @param parameterTypes 方法参数类型 - * @return - */ - public Method findMethod(Object instance, String methodName, Class... parameterTypes) { - return ReflectionUtils.findMethod(instance.getClass(), methodName, parameterTypes); - } - - /** - * 寻找对象无参方法 - * - * @param instance 实例对象 - * @param methodName 方法名 - * @return - */ - public Method findMethod(Object instance, String methodName) { - return ReflectionUtils.findMethod(instance.getClass(), methodName); - } - - /** - * 将么有方法设置为可访问,并调用该方法 - * - * @param instance 实例对象 - * @param method 方法对象 - * @param args - */ - public Object invokePrivateMethod(Object instance, Method method, Object... args) { - ReflectionUtils.makeAccessible(method); - return ReflectionUtils.invokeMethod(method, instance, args); - } - - -} diff --git a/common/test/src/test/java/com/springboot/cloud/common/test/PrivateHelperTest.java b/common/test/src/test/java/com/springboot/cloud/common/test/PrivateHelperTest.java deleted file mode 100644 index 5dd6740a..00000000 --- a/common/test/src/test/java/com/springboot/cloud/common/test/PrivateHelperTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.springboot.cloud.common.test; - -import org.junit.Assert; -import org.junit.Test; - -import java.lang.reflect.Method; - -public class PrivateHelperTest { - - private PrivateHelper instance = PrivateHelper.getInstance(); - - @Test - public void testSetPrivateField_假如对象有一个私有成员变量_当通过该方法给私有成员变量赋值_那么可以赋值成功() throws Exception { - PrivateObject instance = new PrivateObject(); - PrivateHelper.getInstance().setPrivateField(instance, "code", "123456"); - Assert.assertEquals("123456", instance.getCode()); - } - - @Test - public void testInvokeMethod_假如对象有一个有参私有方法_当通过该方法调用私有方法_那么可以调用成功并返回结果() { - PrivateObject instance = new PrivateObject(); - Method method = this.instance.findMethod(instance, "changeCode", String.class); - String code = (String) this.instance.invokePrivateMethod(instance, method, "abcef"); - Assert.assertEquals("abcef", code); - } - - @Test - public void testInvokeMethod_假如对象有一个无参私有方法_当通过该方法调用私有方法_那么可以调用成功() { - PrivateObject instance = new PrivateObject(); - Method method = this.instance.findMethod(instance, "changeCode"); - this.instance.invokePrivateMethod(instance, method); - Assert.assertEquals("aaaaa", instance.getCode()); - } - -} \ No newline at end of file diff --git a/common/test/src/test/java/com/springboot/cloud/common/test/PrivateObject.java b/common/test/src/test/java/com/springboot/cloud/common/test/PrivateObject.java deleted file mode 100644 index d161659e..00000000 --- a/common/test/src/test/java/com/springboot/cloud/common/test/PrivateObject.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.springboot.cloud.common.test; - -public class PrivateObject { - private String code; - - public String getCode() { - return code; - } - - private String changeCode(String code) { - this.code = code; - return this.code; - } - - private void changeCode() { - this.code = "aaaaa"; - } -} diff --git a/common/web/pom.xml b/common/web/pom.xml deleted file mode 100644 index 6d64bd8d..00000000 --- a/common/web/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - 4.0.0 - - com.springboot.cloud - web - 0.0.1-SNAPSHOT - jar - - web - Demo Web project for Spring Boot - - - UTF-8 - UTF-8 - 1.8 - 1.8 - - - - com.springboot.cloud - common - 0.0.1-SNAPSHOT - - - - - com.springboot.cloud - core - 0.0.1-SNAPSHOT - - - - org.springframework - spring-web - 5.0.4.RELEASE - - - org.springframework - spring-webmvc - 5.3.18 - - - com.fasterxml.jackson.core - jackson-databind - 2.12.6.1 - - - - com.baomidou - mybatis-plus-boot-starter - 3.1.0 - - - org.mybatis - mybatis-spring - 2.0.0 - - - - org.springframework.boot - spring-boot-starter-data-redis - 2.1.4.RELEASE - - - org.apache.commons - commons-pool2 - 2.6.0 - - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - - - - org.springframework - spring-test - 5.1.6.RELEASE - - - org.springframework.boot - spring-boot-starter-test - test - RELEASE - - - org.mybatis - mybatis - 3.5.6 - compile - - - diff --git a/common/web/readme.md b/common/web/readme.md deleted file mode 100644 index 43b67e37..00000000 --- a/common/web/readme.md +++ /dev/null @@ -1,28 +0,0 @@ -WEB公共包 ----------- - -## 简介 - -主要封装一些WEB开发用到的通用公共类、工具类,如公共web拦截器、web统一异常定义等。 - -## 使用 - -进入应用目录 - -安装命令:`mvn install` - -## 使用指南 - -### 应用引入 - -需要将编译生成的jar包安装到本地maven类进入引用使用。 - -pom.xml - -``` - - com.springboot.cloud - web - 0.0.1-SNAPSHOT - -``` \ No newline at end of file diff --git a/common/web/src/main/java/com/springboot/cloud/common/web/entity/form/BaseForm.java b/common/web/src/main/java/com/springboot/cloud/common/web/entity/form/BaseForm.java deleted file mode 100644 index 2678b7c0..00000000 --- a/common/web/src/main/java/com/springboot/cloud/common/web/entity/form/BaseForm.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.springboot.cloud.common.web.entity.form; - -import com.springboot.cloud.common.web.entity.po.BasePo; -import io.swagger.annotations.ApiModel; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeanUtils; - -@ApiModel -@Slf4j -@Data -public class BaseForm { - /** - * 用户名 - */ - private String username; - - /** - * From转化为Po,进行后续业务处理 - * - * @param clazz - * @return - */ - public T toPo(Class clazz) { - T t = BeanUtils.instantiateClass(clazz); - BeanUtils.copyProperties(this, t); - return t; - } - - /** - * From转化为Po,进行后续业务处理 - * - * @param id - * @param clazz - * @return - */ - public T toPo(String id, Class clazz) { - T t = BeanUtils.instantiateClass(clazz); - t.setId(id); - BeanUtils.copyProperties(this, t); - return t; - } -} diff --git a/common/web/src/main/java/com/springboot/cloud/common/web/entity/form/BaseQueryForm.java b/common/web/src/main/java/com/springboot/cloud/common/web/entity/form/BaseQueryForm.java deleted file mode 100644 index 3bdaa5d0..00000000 --- a/common/web/src/main/java/com/springboot/cloud/common/web/entity/form/BaseQueryForm.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.springboot.cloud.common.web.entity.form; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.springboot.cloud.common.web.entity.param.BaseParam; -import io.swagger.annotations.ApiModel; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeanUtils; - -@ApiModel -@Slf4j -@Data -public class BaseQueryForm

extends BaseForm { - /** - * 分页查询的参数,当前页数 - */ - private long current = 1; - /** - * 分页查询的参数,当前页面每页显示的数量 - */ - private long size = 10; - - /** - * Form转化为Param - * - * @param clazz - * @return - */ - public P toParam(Class

clazz) { - P p = BeanUtils.instantiateClass(clazz); - BeanUtils.copyProperties(this, p); - return p; - } - - /** - * 从form中获取page参数,用于分页查询参数 - * - * @return - */ - public Page getPage() { - return new Page(this.getCurrent(), this.getSize()); - } - -} diff --git a/common/web/src/main/java/com/springboot/cloud/common/web/entity/param/BaseParam.java b/common/web/src/main/java/com/springboot/cloud/common/web/entity/param/BaseParam.java deleted file mode 100644 index 0154a4b0..00000000 --- a/common/web/src/main/java/com/springboot/cloud/common/web/entity/param/BaseParam.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.springboot.cloud.common.web.entity.param; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.Data; - -import java.util.Date; - -/** - * Created by zhoutaoo on 2018/6/1. - */ -@Data -public class BaseParam { - private Date createdTimeStart; - private Date createdTimeEnd; - - public QueryWrapper build() { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.ge(null != this.createdTimeStart, "created_time", this.createdTimeStart) - .le(null != this.createdTimeEnd, "created_time", this.createdTimeEnd); - return queryWrapper; - } -} diff --git a/common/web/src/main/java/com/springboot/cloud/common/web/entity/po/BasePo.java b/common/web/src/main/java/com/springboot/cloud/common/web/entity/po/BasePo.java deleted file mode 100644 index c21f2b43..00000000 --- a/common/web/src/main/java/com/springboot/cloud/common/web/entity/po/BasePo.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.springboot.cloud.common.web.entity.po; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -@Data -public class BasePo implements Serializable { - public final static String DEFAULT_USERNAME = "system"; - @TableId(type = IdType.ID_WORKER_STR) - private String id; - - @TableField(fill = FieldFill.INSERT) - private String createdBy; - - @TableField(fill = FieldFill.INSERT) - private Date createdTime; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updatedBy; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updatedTime; -} diff --git a/common/web/src/main/java/com/springboot/cloud/common/web/entity/vo/BaseVo.java b/common/web/src/main/java/com/springboot/cloud/common/web/entity/vo/BaseVo.java deleted file mode 100644 index 226933f9..00000000 --- a/common/web/src/main/java/com/springboot/cloud/common/web/entity/vo/BaseVo.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.springboot.cloud.common.web.entity.vo; - -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -@Data -@NoArgsConstructor -public class BaseVo implements Serializable { - private String id; -} diff --git a/common/web/src/main/java/com/springboot/cloud/common/web/exception/DefaultGlobalExceptionHandlerAdvice.java b/common/web/src/main/java/com/springboot/cloud/common/web/exception/DefaultGlobalExceptionHandlerAdvice.java deleted file mode 100644 index 1184e366..00000000 --- a/common/web/src/main/java/com/springboot/cloud/common/web/exception/DefaultGlobalExceptionHandlerAdvice.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.springboot.cloud.common.web.exception; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.common.core.exception.BaseException; -import com.springboot.cloud.common.core.exception.SystemErrorType; -import lombok.extern.slf4j.Slf4j; -import org.springframework.dao.DuplicateKeyException; -import org.springframework.http.HttpStatus; -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.ResponseStatus; -import org.springframework.web.multipart.MultipartException; - -@Slf4j -public class DefaultGlobalExceptionHandlerAdvice { - - @ExceptionHandler(value = {MissingServletRequestParameterException.class}) - public Result missingServletRequestParameterException(MissingServletRequestParameterException ex) { - log.error("missing servlet request parameter exception:{}", ex.getMessage()); - return Result.fail(SystemErrorType.ARGUMENT_NOT_VALID); - } - - @ExceptionHandler(value = {MultipartException.class}) - public Result uploadFileLimitException(MultipartException ex) { - log.error("upload file size limit:{}", ex.getMessage()); - return Result.fail(SystemErrorType.UPLOAD_FILE_SIZE_LIMIT); - } - - @ExceptionHandler(value = {MethodArgumentNotValidException.class}) - public Result serviceException(MethodArgumentNotValidException ex) { - log.error("service exception:{}", ex.getMessage()); - return Result.fail(SystemErrorType.ARGUMENT_NOT_VALID, ex.getBindingResult().getFieldError().getDefaultMessage()); - } - - @ExceptionHandler(value = {DuplicateKeyException.class}) - public Result duplicateKeyException(DuplicateKeyException ex) { - log.error("primary key duplication exception:{}", ex.getMessage()); - return Result.fail(SystemErrorType.DUPLICATE_PRIMARY_KEY); - } - - @ExceptionHandler(value = {BaseException.class}) - public Result baseException(BaseException ex) { - log.error("base exception:{}", ex.getMessage()); - return Result.fail(ex.getErrorType()); - } - - @ExceptionHandler(value = {Exception.class}) - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - public Result exception() { - return Result.fail(); - } - - @ExceptionHandler(value = {Throwable.class}) - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - public Result throwable() { - return Result.fail(); - } -} \ No newline at end of file diff --git a/common/web/src/main/java/com/springboot/cloud/common/web/handler/PoMetaObjectHandler.java b/common/web/src/main/java/com/springboot/cloud/common/web/handler/PoMetaObjectHandler.java deleted file mode 100644 index ed8ef7be..00000000 --- a/common/web/src/main/java/com/springboot/cloud/common/web/handler/PoMetaObjectHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.springboot.cloud.common.web.handler; - -import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; -import com.springboot.cloud.common.core.util.UserContextHolder; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.apache.ibatis.reflection.MetaObject; - -import java.time.ZonedDateTime; -import java.util.Date; - -@Slf4j -public class PoMetaObjectHandler implements MetaObjectHandler { - /** - * 获取当前交易的用户,为空返回默认system - * - * @return - */ - private String getCurrentUsername() { - return StringUtils.defaultIfBlank(UserContextHolder.getInstance().getUsername(), BasePo.DEFAULT_USERNAME); - } - - @Override - public void insertFill(MetaObject metaObject) { - this.setInsertFieldValByName("createdBy", getCurrentUsername(), metaObject); - this.setInsertFieldValByName("createdTime", Date.from(ZonedDateTime.now().toInstant()), metaObject); - this.updateFill(metaObject); - } - - @Override - public void updateFill(MetaObject metaObject) { - this.setUpdateFieldValByName("updatedBy", getCurrentUsername(), metaObject); - this.setUpdateFieldValByName("updatedTime", Date.from(ZonedDateTime.now().toInstant()), metaObject); - } -} \ No newline at end of file diff --git a/common/web/src/main/java/com/springboot/cloud/common/web/interceptor/UserInterceptor.java b/common/web/src/main/java/com/springboot/cloud/common/web/interceptor/UserInterceptor.java deleted file mode 100644 index bb629404..00000000 --- a/common/web/src/main/java/com/springboot/cloud/common/web/interceptor/UserInterceptor.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.springboot.cloud.common.web.interceptor; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.springboot.cloud.common.core.util.UserContextHolder; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.springframework.lang.Nullable; -import org.springframework.web.servlet.HandlerInterceptor; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Map; - -/** - * 用户信息拦截器 - */ -@Slf4j -public class UserInterceptor implements HandlerInterceptor { - /** - * 服务间调用token用户信息,格式为json - * { - * "user_name":"必须有" - * "自定义key:"value" - * } - */ - public static final String X_CLIENT_TOKEN_USER = "x-client-token-user"; - /** - * 服务间调用的认证token - */ - public static final String X_CLIENT_TOKEN = "x-client-token"; - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - //从网关获取并校验,通过校验就可信任x-client-token-user中的信息 - checkToken(request.getHeader(X_CLIENT_TOKEN)); - String userInfoString = StringUtils.defaultIfBlank(request.getHeader(X_CLIENT_TOKEN_USER), "{}"); - UserContextHolder.getInstance().setContext(new ObjectMapper().readValue(userInfoString, Map.class)); - return true; - } - - private void checkToken(String token) { - //TODO 从网关获取并校验,通过校验就可信任x-client-token-user中的信息 - log.debug("//TODO 校验token:{}", token); - } - - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception { - UserContextHolder.getInstance().clear(); - } -} diff --git a/common/web/src/main/java/com/springboot/cloud/common/web/redis/RedisConfig.java b/common/web/src/main/java/com/springboot/cloud/common/web/redis/RedisConfig.java deleted file mode 100644 index 2d0257a7..00000000 --- a/common/web/src/main/java/com/springboot/cloud/common/web/redis/RedisConfig.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.springboot.cloud.common.web.redis; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.cache.CacheManager; -import org.springframework.cache.annotation.CachingConfigurerSupport; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.redis.cache.RedisCacheConfiguration; -import org.springframework.data.redis.cache.RedisCacheManager; -import org.springframework.data.redis.cache.RedisCacheWriter; -import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; -import org.springframework.data.redis.serializer.RedisSerializationContext; - -import java.time.Duration; - -@Configuration -public class RedisConfig extends CachingConfigurerSupport { - - @Bean - public CacheManager cacheManager(RedisConnectionFactory factory) { - //对象的序列化 - RedisSerializationContext.SerializationPair valueSerializationPair - = RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer()); - //全局redis缓存过期时间 - RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig() - .entryTtl(Duration.ofDays(1)) -// .serializeKeysWith() - .serializeValuesWith(valueSerializationPair); - - return new RedisCacheManager(RedisCacheWriter.nonLockingRedisCacheWriter(factory), redisCacheConfiguration); - } - - private Jackson2JsonRedisSerializer jackson2JsonRedisSerializer() { - Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class); - jackson2JsonRedisSerializer.setObjectMapper(objectMapper()); - return jackson2JsonRedisSerializer; - } - - private ObjectMapper objectMapper() { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); - objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); - return objectMapper; - } -} \ No newline at end of file diff --git a/common/web/src/test/java/com/springboot/cloud/common/web/exception/DefaultGlobalExceptionHandlerAdviceTest.java b/common/web/src/test/java/com/springboot/cloud/common/web/exception/DefaultGlobalExceptionHandlerAdviceTest.java deleted file mode 100644 index b6043f46..00000000 --- a/common/web/src/test/java/com/springboot/cloud/common/web/exception/DefaultGlobalExceptionHandlerAdviceTest.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.springboot.cloud.common.web.exception; - -import org.junit.Test; - -public class DefaultGlobalExceptionHandlerAdviceTest { - - @Test - public void testMethod() { - - } - -} \ No newline at end of file diff --git a/common/web/src/test/java/com/springboot/cloud/common/web/interceptor/UserInterceptorTest.java b/common/web/src/test/java/com/springboot/cloud/common/web/interceptor/UserInterceptorTest.java deleted file mode 100644 index 8d761a15..00000000 --- a/common/web/src/test/java/com/springboot/cloud/common/web/interceptor/UserInterceptorTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.springboot.cloud.common.web.interceptor; - -import com.springboot.cloud.common.core.util.UserContextHolder; -import org.junit.Assert; -import org.junit.Test; -import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.mock.web.MockHttpServletResponse; - -public class UserInterceptorTest { - @Test - public void preHandle_当未设置token_user_那么正常处理下一个handle() throws Exception { - UserInterceptor userInterceptor = new UserInterceptor(); - MockHttpServletRequest request = new MockHttpServletRequest(); - MockHttpServletResponse response = new MockHttpServletResponse(); - userInterceptor.preHandle(request, response, new Object()); - } - - @Test - public void preHandle_当设置token的username_那么username可以在线程中拿出来用() throws Exception { - UserInterceptor userInterceptor = new UserInterceptor(); - MockHttpServletRequest request = new MockHttpServletRequest(); - request.addHeader("x-client-token-user", "{\"user_name\":\"zhangsan\"}"); - MockHttpServletResponse response = new MockHttpServletResponse(); - userInterceptor.preHandle(request, response, new Object()); - Assert.assertEquals(UserContextHolder.getInstance().getUsername(), "zhangsan"); - } -} \ No newline at end of file diff --git a/data/kong/.gitkeep b/data/kong/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/data/mysql/.gitkeep b/data/mysql/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/data/rabbitmq/.gitkeep b/data/rabbitmq/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/data/redis/.gitkeep b/data/redis/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/demos/.project b/demos/.project new file mode 100644 index 00000000..ffd73507 --- /dev/null +++ b/demos/.project @@ -0,0 +1,17 @@ + + + demos + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/docker-compose/.env b/docker-compose/.env deleted file mode 100644 index 573d8a37..00000000 --- a/docker-compose/.env +++ /dev/null @@ -1,63 +0,0 @@ -## docker-compose环境变量 - -### 数据源postgres实例 -#DATASOURCE_DBTYPE=postgresql -#DATASOURCE_HOST=postgres -#DATASOURCE_PORT=5432 -#DATASOURCE_USERNAME=postgres -#DATASOURCE_PASSWORD=postgres -#DATASOURCE_DRIVER=org.postgresql.Driver - -### 数据源mysql实例 -DATASOURCE_DBTYPE=mysql -DATASOURCE_HOST=mysql -DATASOURCE_PORT=3306 -DATASOURCE_USERNAME=root -DATASOURCE_PASSWORD=root123 -DATASOURCE_DRIVER=com.mysql.jdbc.Driver - -### 分布式缓存 -REDIS_HOST=redis -REDIS_PORT=6379 -REDIS_PASSWORD=123456 - -### 消息中间件 -RABBIT_MQ_HOST=rabbitmq -RABBIT_MQ_PORT=5672 -RABBIT_MQ_USERNAME=guest -RABBIT_MQ_PASSWORD=guest - -### 注册中心 -REGISTER_HOST=nacos -REGISTER_PORT=8848 - -### sentinel dashboard -SENTINEL_DASHBOARD_HOST=sentinel-dashboard -SENTINEL_DASHBOARD_PORT=8021 - -### MOSS -MOSS_DB_TYPE=mysql -MOSS_PORT=8086 -MOSS_SKYWALKING_HOST=skywalking-oap -MOSS_SKYWALKING_PORT=12800 - -### skywalking-agent 容器内路径 -SW_AGENT_OPTS=-javaagent:/skywalking/agent/skywalking-agent.jar -Dskywalking.collector.backend_service=localhost:11800 -Dskywalking.agent.service_name - -### kong数据库 -KONG_ADMIN_LISTEN=0.0.0.0:8001 -KONG_ADMIN_LISTEN_SSL=0.0.0.0:8444 -KONG_CASSANDRA_CONTACT_POINTS=mysql -KONG_DATABASE=sc_gateway_kong -KONG_PG_HOST=mysql - -### konga数据库 -TOKEN_SECRET=123456 -DB_ADAPTER:=mysql -DB_USER=root -DB_PASSWORD=root123 -DB_DATABASE=sc_gateway_konga -DB_PG_SCHEMA=public -NODE_ENV=production -DB_HOST=mysql -DB_PORT=3306 \ No newline at end of file diff --git a/docker-compose/devops/elasticsearch.yml b/docker-compose/devops/elasticsearch.yml deleted file mode 100644 index 067ef80b..00000000 --- a/docker-compose/devops/elasticsearch.yml +++ /dev/null @@ -1,7 +0,0 @@ -http.host: 0.0.0.0 -http.cors.enabled: true -http.cors.allow-origin: "*" -# Uncomment the following lines for a production cluster deployment -#transport.host: 0.0.0.0 -#discovery.zen.minimum_master_nodes: 1 -transport.host: 0.0.0.0 diff --git a/docker-compose/devops/kibana.yml b/docker-compose/devops/kibana.yml deleted file mode 100644 index 9d2aaf90..00000000 --- a/docker-compose/devops/kibana.yml +++ /dev/null @@ -1,104 +0,0 @@ -# Kibana is served by a back end server. This setting specifies the port to use. -#server.port: 5601 - -# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values. -# The default is 'localhost', which usually means remote machines will not be able to connect. -# To allow connections from remote users, set this parameter to a non-loopback address. -server.host: '0.0.0.0' - -# Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects -# the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests -# to Kibana. This setting cannot end in a slash. -# server.basePath: "" - -# The maximum payload size in bytes for incoming server requests. -#server.maxPayloadBytes: 1048576 - -# The Kibana server's name. This is used for display purposes. -#server.name: "your-hostname" - -# The URL of the Elasticsearch instance to use for all your queries. -elasticsearch.url: 'http://elasticsearch:9200' - -# When this setting's value is true Kibana uses the hostname specified in the server.host -# setting. When the value of this setting is false, Kibana uses the hostname of the host -# that connects to this Kibana instance. -#elasticsearch.preserveHost: true - -# Kibana uses an index in Elasticsearch to store saved searches, visualizations and -# dashboards. Kibana creates a new index if the index doesn't already exist. -#kibana.index: ".kibana" - -# The default application to load. -#kibana.defaultAppId: "discover" - -# If your Elasticsearch is protected with basic authentication, these settings provide -# the username and password that the Kibana server uses to perform maintenance on the Kibana -# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which -# is proxied through the Kibana server. -#elasticsearch.username: "user" -#elasticsearch.password: "pass" - -# Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively. -# These settings enable SSL for outgoing requests from the Kibana server to the browser. -#server.ssl.enabled: false -#server.ssl.certificate: /path/to/your/server.crt -#server.ssl.key: /path/to/your/server.key - -# Optional settings that provide the paths to the PEM-format SSL certificate and key files. -# These files validate that your Elasticsearch backend uses the same key files. -#elasticsearch.ssl.certificate: /path/to/your/client.crt -#elasticsearch.ssl.key: /path/to/your/client.key - -# Optional setting that enables you to specify a path to the PEM file for the certificate -# authority for your Elasticsearch instance. -#elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ] - -# To disregard the validity of SSL certificates, change this setting's value to 'none'. -#elasticsearch.ssl.verificationMode: full - -# Time in milliseconds to wait for Elasticsearch to respond to pings. Defaults to the value of -# the elasticsearch.requestTimeout setting. -#elasticsearch.pingTimeout: 1500 - -# Time in milliseconds to wait for responses from the back end or Elasticsearch. This value -# must be a positive integer. -#elasticsearch.requestTimeout: 30000 - -# List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side -# headers, set this value to [] (an empty list). -#elasticsearch.requestHeadersWhitelist: [ authorization ] - -# Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten -# by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration. -#elasticsearch.customHeaders: {} - -# Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable. -#elasticsearch.shardTimeout: 0 - -# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying. -#elasticsearch.startupTimeout: 5000 - -# Specifies the path where Kibana creates the process ID file. -#pid.file: /var/run/kibana.pid - -# Enables you specify a file where Kibana stores log output. -#logging.dest: stdout - -# Set the value of this setting to true to suppress all logging output. -#logging.silent: false - -# Set the value of this setting to true to suppress all logging output other than error messages. -#logging.quiet: false - -# Set the value of this setting to true to log all events, including system usage information -# and all requests. -#logging.verbose: false - -# Set the interval in milliseconds to sample system and process performance -# metrics. Minimum is 100ms. Defaults to 5000. -#ops.interval: 5000 - -# The default locale. This locale can be used in certain circumstances to substitute any missing -# translations. -#i18n.defaultLocale: "en" \ No newline at end of file diff --git a/docker-compose/devops/skywalking/config/alarm-settings.yml b/docker-compose/devops/skywalking/config/alarm-settings.yml deleted file mode 100644 index 63bc6b0c..00000000 --- a/docker-compose/devops/skywalking/config/alarm-settings.yml +++ /dev/null @@ -1,71 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Sample alarm rules. -rules: - # Rule unique name, must be ended with `_rule`. - service_resp_time_rule: - indicator-name: service_resp_time - op: ">" - threshold: 1000 - period: 10 - count: 3 - silence-period: 5 - message: Response time of service {name} is more than 1000ms in last 3 minutes. - service_sla_rule: - # Indicator value need to be long, double or int - indicator-name: service_sla - op: "<" - threshold: 8000 - # The length of time to evaluate the metric - period: 10 - # How many times after the metric match the condition, will trigger alarm - count: 2 - # How many times of checks, the alarm keeps silence after alarm triggered, default as same as period. - silence-period: 3 - message: Successful rate of service {name} is lower than 80% in last 2 minutes. - service_p90_sla_rule: - # Indicator value need to be long, double or int - indicator-name: service_p90 - op: ">" - threshold: 1000 - period: 10 - count: 3 - silence-period: 5 - message: 90% response time of service {name} is lower than 1000ms in last 3 minutes - service_instance_resp_time_rule: - indicator-name: service_instance_resp_time - op: ">" - threshold: 1000 - period: 10 - count: 2 - silence-period: 5 - message: Response time of service instance {name} is more than 1000ms in last 2 minutes. -# Active endpoint related metric alarm will cost more memory than service and service instance metric alarm. -# Because the number of endpoint is much more than service and instance. -# -# endpoint_avg_rule: -# indicator-name: endpoint_avg -# op: ">" -# threshold: 1000 -# period: 10 -# count: 2 -# silence-period: 5 -# message: Response time of endpoint {name} is more than 1000ms in last 2 minutes. - -webhooks: -# - http://127.0.0.1/notify/ -# - http://127.0.0.1/go-wechat/ \ No newline at end of file diff --git a/docker-compose/devops/skywalking/config/application.yml b/docker-compose/devops/skywalking/config/application.yml deleted file mode 100644 index df30c9ed..00000000 --- a/docker-compose/devops/skywalking/config/application.yml +++ /dev/null @@ -1,111 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -cluster: - standalone: - # Please check your ZooKeeper is 3.5+, However, it is also compatible with ZooKeeper 3.4.x. Replace the ZooKeeper 3.5+ - # library the oap-libs folder with your ZooKeeper 3.4.x library. -# zookeeper: -# nameSpace: ${SW_NAMESPACE:""} -# hostPort: ${SW_CLUSTER_ZK_HOST_PORT:localhost:2181} -# #Retry Policy -# baseSleepTimeMs: ${SW_CLUSTER_ZK_SLEEP_TIME:1000} # initial amount of time to wait between retries -# maxRetries: ${SW_CLUSTER_ZK_MAX_RETRIES:3} # max number of times to retry -# kubernetes: -# watchTimeoutSeconds: ${SW_CLUSTER_K8S_WATCH_TIMEOUT:60} -# namespace: ${SW_CLUSTER_K8S_NAMESPACE:default} -# labelSelector: ${SW_CLUSTER_K8S_LABEL:app=collector,release=skywalking} -# uidEnvName: ${SW_CLUSTER_K8S_UID:SKYWALKING_COLLECTOR_UID} -# consul: -# serviceName: ${SW_SERVICE_NAME:"SkyWalking_OAP_Cluster"} -# Consul cluster nodes, example: 10.0.0.1:8500,10.0.0.2:8500,10.0.0.3:8500 -# hostPort: ${SW_CLUSTER_CONSUL_HOST_PORT:localhost:8500} -core: - default: - # Mixed: Receive agent data, Level 1 aggregate, Level 2 aggregate - # Aggregator: Level 2 aggregate - role: ${SW_CORE_ROLE:Mixed} # Mixed/Receiver/Aggregator - restHost: ${SW_CORE_REST_HOST:0.0.0.0} - restPort: ${SW_CORE_REST_PORT:12800} - restContextPath: ${SW_CORE_REST_CONTEXT_PATH:/} - gRPCHost: ${SW_CORE_GRPC_HOST:0.0.0.0} - gRPCPort: ${SW_CORE_GRPC_PORT:11800} - downsampling: - - Hour - - Day - - Month - # Set a timeout on metric data. After the timeout has expired, the metric data will automatically be deleted. - recordDataTTL: ${SW_CORE_RECORD_DATA_TTL:90} # Unit is minute - minuteMetricsDataTTL: ${SW_CORE_MINUTE_METRIC_DATA_TTL:90} # Unit is minute - hourMetricsDataTTL: ${SW_CORE_HOUR_METRIC_DATA_TTL:36} # Unit is hour - dayMetricsDataTTL: ${SW_CORE_DAY_METRIC_DATA_TTL:45} # Unit is day - monthMetricsDataTTL: ${SW_CORE_MONTH_METRIC_DATA_TTL:18} # Unit is month -storage: - elasticsearch: - # set the namespace in elasticsearch - clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:elasticsearch:9200} - indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2} - indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0} - # Batch process setting, refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html - bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:2000} # Execute the bulk every 2000 requests - bulkSize: ${SW_STORAGE_ES_BULK_SIZE:20} # flush the bulk every 20mb - flushInterval: ${SW_STORAGE_ES_FLUSH_INTERVAL:10} # flush the bulk every 10 seconds whatever the number of requests - concurrentRequests: ${SW_STORAGE_ES_CONCURRENT_REQUESTS:2} # the number of concurrent requests - metadataQueryMaxSize: ${SW_STORAGE_ES_QUERY_MAX_SIZE:5000} - segmentQueryMaxSize: ${SW_STORAGE_ES_QUERY_SEGMENT_SIZE:200} -# h2: -# driver: ${SW_STORAGE_H2_DRIVER:org.h2.jdbcx.JdbcDataSource} -# url: ${SW_STORAGE_H2_URL:jdbc:h2:mem:skywalking-oap-db} -# user: ${SW_STORAGE_H2_USER:sa} -# metadataQueryMaxSize: ${SW_STORAGE_H2_QUERY_MAX_SIZE:5000} -# mysql: -# metadataQueryMaxSize: ${SW_STORAGE_H2_QUERY_MAX_SIZE:5000} -receiver-sharing-server: - default: -receiver-register: - default: -receiver-trace: - default: - bufferPath: ${SW_RECEIVER_BUFFER_PATH:../trace-buffer/} # Path to trace buffer files, suggest to use absolute path - bufferOffsetMaxFileSize: ${SW_RECEIVER_BUFFER_OFFSET_MAX_FILE_SIZE:100} # Unit is MB - bufferDataMaxFileSize: ${SW_RECEIVER_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB - bufferFileCleanWhenRestart: ${SW_RECEIVER_BUFFER_FILE_CLEAN_WHEN_RESTART:false} - sampleRate: ${SW_TRACE_SAMPLE_RATE:10000} # The sample rate precision is 1/10000. 10000 means 100% sample in default. - slowDBAccessThreshold: ${SW_SLOW_DB_THRESHOLD:default:200,mongodb:100} # The slow database access thresholds. Unit ms. -receiver-jvm: - default: -service-mesh: - default: - bufferPath: ${SW_SERVICE_MESH_BUFFER_PATH:../mesh-buffer/} # Path to trace buffer files, suggest to use absolute path - bufferOffsetMaxFileSize: ${SW_SERVICE_MESH_OFFSET_MAX_FILE_SIZE:100} # Unit is MB - bufferDataMaxFileSize: ${SW_SERVICE_MESH_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB - bufferFileCleanWhenRestart: ${SW_SERVICE_MESH_BUFFER_FILE_CLEAN_WHEN_RESTART:false} -istio-telemetry: - default: -envoy-metric: - default: -# receiver_zipkin: -# default: -# host: ${SW_RECEIVER_ZIPKIN_HOST:0.0.0.0} -# port: ${SW_RECEIVER_ZIPKIN_PORT:9411} -# contextPath: ${SW_RECEIVER_ZIPKIN_CONTEXT_PATH:/} -query: - graphql: - path: ${SW_QUERY_GRAPHQL_PATH:/graphql} -alarm: - default: -telemetry: - none: diff --git a/docker-compose/devops/skywalking/config/component-libraries.yml b/docker-compose/devops/skywalking/config/component-libraries.yml deleted file mode 100644 index f9ab4bad..00000000 --- a/docker-compose/devops/skywalking/config/component-libraries.yml +++ /dev/null @@ -1,281 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Define all component libraries' names and IDs, used in monitored application. -# This is a bothway mapping, agent or SDK could use the value(ID) to represent the component name in uplink data. -# -# ###### -# id -# ###### -# We highly recommend DO NOT change the IDs in these file, just append new one, and make sure the ID unique. -# Any replacement will cause visualization and aggregation error. -# -# All IDs in this files are reserved, even some IDs removed by some reasons, those IDs will be abandoned. -# -# ###### -# languages -# ###### -# Languages declare which languages are using this component. Multi languages should be separated by `,` - -Tomcat: - id: 1 - languages: Java -HttpClient: - id: 2 - languages: Java,C#,Node.js -Dubbo: - id: 3 - languages: Java -H2: - id: 4 - languages: Java -Mysql: - id: 5 - languages: Java,C#,Node.js -ORACLE: - id: 6 - languages: Java -Redis: - id: 7 - languages: Java,C#,Node.js -Motan: - id: 8 - languages: Java -MongoDB: - id: 9 - languages: Java,C#,Node.js -Resin: - id: 10 - languages: Java -Feign: - id: 11 - languages: Java -OKHttp: - id: 12 - languages: Java -SpringRestTemplate: - id: 13 - languages: Java -SpringMVC: - id: 14 - languages: Java -Struts2: - id: 15 - languages: Java -NutzMVC: - id: 16 - languages: Java -NutzHttp: - id: 17 - languages: Java -JettyClient: - id: 18 - languages: Java -JettyServer: - id: 19 - languages: Java -Memcached: - id: 20 - languages: Java -ShardingJDBC: - id: 21 - languages: Java -PostgreSQL: - id: 22 - languages: Java,C#,Node.js -GRPC: - id: 23 - languages: Java -ElasticJob: - id: 24 - languages: Java -RocketMQ: - id: 25 - languages: Java -httpasyncclient: - id: 26 - languages: Java -Kafka: - id: 27 - languages: Java -ServiceComb: - id: 28 - languages: Java -Hystrix: - id: 29 - languages: Java -Jedis: - id: 30 - languages: Java -SQLite: - id: 31 - languages: Java,C# -h2-jdbc-driver: - id: 32 - languages: Java -mysql-connector-java: - id: 33 - languages: Java -Spymemcached: - id: 35 - languages: Java -Xmemcached: - id: 36 - languages: Java -postgresql-jdbc-driver: - id: 37 - languages: Java -rocketMQ-producer: - id: 38 - languages: Java -rocketMQ-consumer: - id: 39 - languages: Java -kafka-producer: - id: 40 - languages: Java -kafka-consumer: - id: 41 - languages: Java -mongodb-driver: - id: 42 - languages: Java -SOFARPC: - id: 43 - languages: Java -ActiveMQ: - id: 44 - languages: Java -activemq-producer: - id: 45 - languages: Java -activemq-consumer: - id: 46 - languages: Java -Elasticsearch: - id: 47 - languages: Java -transport-client: - id: 48 - languages: Java -http: - id: 49 - languages: Java,C#,Node.js -rpc: - id: 50 - languages: Java,C#,Node.js -RabbitMQ: - id: 51 - languages: Java -rabbitmq-producer: - id: 52 - languages: Java -rabbitmq-consumer: - id: 53 - languages: Java - -# .NET/.NET Core components -# [3000, 4000) for C#/.NET only -AspNetCore: - id: 3001 - languages: C# -EntityFrameworkCore: - id: 3002 - languages: C# -SqlClient: - id: 3003 - languages: C# -CAP: - id: 3004 - languages: C# -StackExchange.Redis: - id: 3005 - languages: C# -SqlServer: - id: 3006 - languages: C# -Npgsql: - id: 3007 - languages: C# -MySqlConnector: - id: 3008 - languages: C# -EntityFrameworkCore.InMemory: - id: 3009 - languages: C# -EntityFrameworkCore.SqlServer: - id: 3010 - languages: C# -EntityFrameworkCore.Sqlite: - id: 3011 - languages: C# -Pomelo.EntityFrameworkCore.MySql: - id: 3012 - languages: C# -Npgsql.EntityFrameworkCore.PostgreSQL: - id: 3013 - languages: C# -InMemoryDatabase: - id: 3014 - languages: C# -AspNet: - id: 3015 - languages: C# - -# NoeJS components -# [4000, 5000) for Node.js agent -HttpServer: - id: 4001 - languages: Node.js -express: - id: 4002 - languages: Node.js -Egg: - id: 4003 - languages: Node.js -Koa: - id: 4004 - languages: Node.js - -# Component Server mapping defines the server display names of some components -# e.g. -# Jedis is a client library in Java for Redis server -Component-Server-Mappings: - mongodb-driver: MongoDB - rocketMQ-producer: RocketMQ - rocketMQ-consumer: RocketMQ - kafka-producer: Kafka - kafka-consumer: Kafka - activemq-producer: ActiveMQ - activemq-consumer: ActiveMQ - rabbitmq-producer: RabbitMQ - rabbitmq-consumer: RabbitMQ - postgresql-jdbc-driver: PostgreSQL - Xmemcached: Memcached - Spymemcached: Memcached - h2-jdbc-driver: H2 - mysql-connector-java: Mysql - Jedis: Redis - StackExchange.Redis: Redis - SqlClient: SqlServer - Npgsql: PostgreSQL - MySqlConnector: Mysql - EntityFrameworkCore.InMemory: InMemoryDatabase - EntityFrameworkCore.SqlServer: SqlServer - EntityFrameworkCore.Sqlite: SQLite - Pomelo.EntityFrameworkCore.MySql: Mysql - Npgsql.EntityFrameworkCore.PostgreSQL: PostgreSQL - transport-client: Elasticsearch \ No newline at end of file diff --git a/docker-compose/devops/skywalking/config/log4j2.xml b/docker-compose/devops/skywalking/config/log4j2.xml deleted file mode 100644 index dbde5de6..00000000 --- a/docker-compose/devops/skywalking/config/log4j2.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docker-compose/docker-compose.auth.yml b/docker-compose/docker-compose.auth.yml deleted file mode 100644 index 4cb030d0..00000000 --- a/docker-compose/docker-compose.auth.yml +++ /dev/null @@ -1,44 +0,0 @@ -version: '3' -services: - #授权服务 - authorization-server: - image: cike/authorization-server:latest - container_name: sc-authorization-server - restart: always - networks: - - sc-net - ports: - - 8000:8000 - env_file: .env - environment: - TZ: Asia/Shanghai - depends_on: - - authentication-server - - #认证服务 - authentication-server: - image: cike/authentication-server:latest - container_name: sc-authentication-server - restart: always - networks: - - sc-net - ports: - - 8001:8001 - env_file: .env - environment: - TZ: Asia/Shanghai - depends_on: - - organization - - #组织服务 - organization: - image: cike/organization:latest - container_name: sc-organization - restart: always - networks: - - sc-net - ports: - - 8010:8010 - env_file: .env - environment: - TZ: Asia/Shanghai \ No newline at end of file diff --git a/docker-compose/docker-compose.center.yml b/docker-compose/docker-compose.center.yml deleted file mode 100644 index cd21bb13..00000000 --- a/docker-compose/docker-compose.center.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: '3' -services: - #消息中心 - bus-server: - image: cike/bus-server:latest - container_name: sc-bus - restart: always - networks: - - sc-net - ports: - - 8071:8071 - env_file: .env - environment: - TZ: Asia/Shanghai \ No newline at end of file diff --git a/docker-compose/docker-compose.devops.yml b/docker-compose/docker-compose.devops.yml deleted file mode 100644 index 7959b7dc..00000000 --- a/docker-compose/docker-compose.devops.yml +++ /dev/null @@ -1,101 +0,0 @@ -version: '3' -services: - zipkin-server: - image: openzipkin/zipkin - container_name: sc-zipkin-server - restart: always - volumes: - - ../data/zipkin-server/logs:/var/logs - networks: - - sc-net - ports: - - 9411:9411 - environment: - - RABBIT_ADDRESSES=rabbitmq:5672 - - RABBIT_MQ_PORT=5672 - - RABBIT_PASSWORD=guest - - RABBIT_USER=guest - - STORAGE_TYPE=elasticsearch - - ES_HOSTS=http://elasticsearch:9200 - depends_on: - - rabbitmq - - elasticsearch: - image: elasticsearch:5.6-alpine - container_name: sc-elasticsearch - restart: always - environment: - - cluster.name=elasticsearch - - bootstrap.memory_lock=true - - xpack.security.enabled=false - - "ES_JAVA_OPTS=-Xms1g -Xmx1g" - - node.name=elasticsearch_node_1 - ulimits: - memlock: - soft: -1 - hard: -1 - volumes: - - ../data/elasticsearch/data:/usr/share/elasticsearch/data - - ../data/elasticsearch/logs:/usr/share/elasticsearch/logs - - ./devops/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - networks: - - sc-net - ports: - - 9200:9200 - - 9300:9300 - - skywalking-oap: - image: wutang/skywalking-oap:6.1.0 - container_name: skywalking-oap - networks: - - sc-net - depends_on: - - elasticsearch - links: - - elasticsearch - restart: always - ports: - - 11800:11800 - - 12800:12800 - volumes: - - ./devops/skywalking/config:/apache-skywalking-apm-bin/config:ro - - skywalking-ui: - image: wutang/skywalking-ui:6.1.0 - container_name: skywalking-ui - networks: - - sc-net - depends_on: - - skywalking-oap - links: - - skywalking-oap - restart: always - ports: - - 8080:8080 - environment: - collector.ribbon.listOfServers: skywalking-oap:12800 - - kibana: - image: kibana:5.6.14 - container_name: sc-kibana - restart: always - volumes: - - ../data/kibana/logs:/var/logs/kibana - - ./devops/kibana.yml:/etc/kibana/kibana.yml - networks: - - sc-net - ports: - - 5601:5601 - depends_on: - - elasticsearch - - grafana: - image: grafana/grafana - container_name: sc-grafana - restart: always - volumes: - - ../data/grafana/logs:/var/logs/grafana - networks: - - sc-net - ports: - - 3000:3000 \ No newline at end of file diff --git a/docker-compose/docker-compose.gateway.yml b/docker-compose/docker-compose.gateway.yml deleted file mode 100644 index 5397a00f..00000000 --- a/docker-compose/docker-compose.gateway.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: '3' -services: - - konga: - image: pantsel/konga - container_name: sc-konga - depends_on: - - kong - networks: - - sc-net - env_file: .env - ports: - - 1337:1337/tcp - - kong: - image: kong:latest - container_name: sc-kong - env_file: .env - volumes: - - ../data/kong:/usr/local/kong - networks: - - sc-net - ports: - - 18000:8000/tcp - - 18443:8443/tcp - - 18001:8001/tcp - - 8444:8444/tcp - depends_on: - - postgres diff --git a/docker-compose/docker-compose.monitor.yml b/docker-compose/docker-compose.monitor.yml deleted file mode 100644 index f43e2404..00000000 --- a/docker-compose/docker-compose.monitor.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: '3' -services: - #监控管理台服务 - monitor-admin: - image: cike/admin:latest - container_name: sc-monitor-admin - restart: always - networks: - - sc-net - ports: - - 8022:8022 - env_file: .env - environment: - TZ: Asia/Shanghai - - sentinel-dashboard: - image: cike/sentinel-dashboard-docker:latest - container_name: sc-sentinel-dashboard - restart: always - networks: - - sc-net - ports: - - 8021:8021 - env_file: .env diff --git a/docker-compose/docker-compose.moss.yml b/docker-compose/docker-compose.moss.yml deleted file mode 100644 index f422903b..00000000 --- a/docker-compose/docker-compose.moss.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: '3' -services: - #MOSS Mysql数据库初使化 - moss-db-init: - image: mysql:5.7 - command: /init-db.sh - networks: - - sc-net - volumes: - - ./moss/mysql:/sql - - ./init-db.sh:/init-db.sh - environment: - MYSQL_ROOT_PASSWORD: root123 - - #Moss管理中心 - moss: - image: w304807481/moss-web:latest - container_name: moss - restart: always - networks: - - sc-net - ports: - - 8086:8086 - env_file: .env - environment: - TZ: Asia/Shanghai - depends_on: - - moss-db-init \ No newline at end of file diff --git a/docker-compose/docker-compose.nacos.yml b/docker-compose/docker-compose.nacos.yml deleted file mode 100644 index 1caa1719..00000000 --- a/docker-compose/docker-compose.nacos.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: '3' -services: - nacos: - image: nacos/nacos-server:1.1.3 - container_name: sc-nacos-standalone - networks: - - sc-net - environment: - - PREFER_HOST_MODE=hostname - - MODE=standalone - volumes: - - ../data/nacos-server/logs/:/home/nacos/logs - ports: - - "8848:8848" - - prometheus: - container_name: sc-prometheus - image: prom/prometheus:latest - networks: - - sc-net - volumes: - - ./nacos/prometheus.yaml:/etc/prometheus/prometheus.yml - ports: - - "9090:9090" - depends_on: - - nacos - restart: on-failure \ No newline at end of file diff --git a/docker-compose/docker-compose.spring-gateway.yml b/docker-compose/docker-compose.spring-gateway.yml deleted file mode 100644 index 6ef24d42..00000000 --- a/docker-compose/docker-compose.spring-gateway.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: '3' -services: - #网关服务 - gateway-web: - image: cike/gateway-web:latest - container_name: sc-gateway-web - restart: always - networks: - - sc-net - ports: - - 8443:8443 - env_file: .env - environment: - TZ: Asia/Shanghai - - #网关管理服务 - gateway-admin: - image: cike/gateway-admin:latest - container_name: sc-gateway-admin - restart: always - networks: - - sc-net - ports: - - 8445:8445 - env_file: .env - environment: - TZ: Asia/Shanghai diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml deleted file mode 100644 index 77521cc3..00000000 --- a/docker-compose/docker-compose.yml +++ /dev/null @@ -1,62 +0,0 @@ -version: '3' -services: - redis: - image: redis:alpine - container_name: sc-redis - restart: always - volumes: - - ../data/redis:/data - environment: - - REDIS_PASSWORD=123456 - networks: - - sc-net - ports: - - 6379:6379 - env_file: .env - - rabbitmq: - image: rabbitmq:management-alpine - container_name: sc-rabbitmq - restart: always - volumes: - - ../data/rabbitmq:/var/lib/rabbitmq/mnesia - networks: - - sc-net - ports: - - 5672:5672 - - 15672:15672 - env_file: .env - - mysql: - image: mysql:5.7 - container_name: sc-mysql - restart: always - networks: - - sc-net - ports: - - 3306:3306 - volumes: - - ../data/mysql:/var/lib/mysql - environment: - TZ: Asia/Shanghai - MYSQL_ROOT_PASSWORD: root123 - - mysql-init: - image: mysql:5.7 - container_name: sc-mysql-init - command: /init-db.sh - networks: - - sc-net - volumes: - - ../auth/db:/sql/auth - - ../gateway/gateway-admin/src/main/db:/sql/gateway - - ../sysadmin/db:/sql/sysadmin - - ./init-db.sh:/init-db.sh - environment: - MYSQL_ROOT_PASSWORD: root123 - depends_on: - - mysql - -networks: - sc-net: - external: false \ No newline at end of file diff --git a/docker-compose/init-db.sh b/docker-compose/init-db.sh deleted file mode 100755 index b052e8d8..00000000 --- a/docker-compose/init-db.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -for file in $(find /sql -name "*.sql" -exec ls {} \;| grep -v postgres | sort | tr ' ' '|' | tr '\n' ' ') -do - file=$(echo ${file} | tr '|' ' ') - printf "Applying update ${file}\n" - mysql -uroot -p$MYSQL_ROOT_PASSWORD -h mysql < ${file} -done diff --git a/docker-compose/moss/mysql/moss-init.sql b/docker-compose/moss/mysql/moss-init.sql deleted file mode 100644 index 8d456f70..00000000 --- a/docker-compose/moss/mysql/moss-init.sql +++ /dev/null @@ -1,368 +0,0 @@ --- Create Database --- ---------------------------------------------------------- -CREATE DATABASE IF NOT EXISTS moss DEFAULT CHARACTER SET = utf8mb4; - -Use moss; - -SET NAMES utf8; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for `t_app` --- ---------------------------- -DROP TABLE IF EXISTS `t_app`; -CREATE TABLE `t_app` -( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '应用Id', - `app_id` varchar(200) NOT NULL, - `name` varchar(200) NOT NULL DEFAULT '' COMMENT '应用名称', - `owner_name` varchar(200) NOT NULL DEFAULT '' COMMENT '负责人姓名', - `owner_id` varchar(200) DEFAULT '0' COMMENT '负责人Id', - `project_name` varchar(200) NOT NULL DEFAULT '' COMMENT '所属项目名称', - `project_key` varchar(200) NOT NULL DEFAULT '0' COMMENT '所属项目Id', - `description` varchar(1000) DEFAULT '' COMMENT '应用描述', - `gmt_create` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '创建时间', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 已经删除', - `status` tinyint(4) DEFAULT '0' COMMENT '应用的状态 0-创建 1-开发中 2-运行中 3-已下线', - `take_over` tinyint(4) DEFAULT '0', - `ops_owner_name` varchar(200) DEFAULT NULL, - `ops_owner_id` varchar(200) DEFAULT NULL, - `repo_url` varchar(1000) DEFAULT NULL, - `bu_name` varchar(255) DEFAULT NULL, - `spring_application_name` varchar(255) DEFAULT NULL, - `spring_boot_version` int(2) DEFAULT '0', - `spring_cloud_version` int(2) DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE = InnoDB - AUTO_INCREMENT = 287 - DEFAULT CHARSET = utf8 COMMENT ='应用表'; - --- ---------------------------- --- Records of `t_app` --- ---------------------------- -BEGIN; -INSERT INTO `t_app` -VALUES ('1', 'halo-moss', 'halo-moss', '许进', 'xujin', 'halo', 'Halo', '', '2019-02-27 02:23:42', '2019-04-21 10:15:04', - '0', '2', '1', '韩令三', 'lingshan.han', 'https://github.com/SoftwareKing/Moss.git', 'XX', 'halo-moss', '2', '2'), - ('2', 'moss-sample-1.5.x', 'moss-sample-1.5.x', '杜为极', 'weiji.du', 'BKCASHIER', 'MOSS', '', - '2019-02-27 02:23:42', '2019-04-21 10:15:27', '0', '2', '1', '叶张', 'dingf.ye001', - 'https://github.com/SoftwareKing/Moss.git', '金融XX', 'moss-sample-1.5.x', '1', '1'), - ('3', 'moss-sample-2.1.x', 'moss-sample-2.1.x', '许进', 'guojian.li', 'MOSS', 'MOSS', '', '2019-02-27 02:23:42', - '2019-04-21 10:15:22', '0', '2', '1', '齐思宇', 'daiying.qi', 'https://github.com/SoftwareKing/Moss.git', '房XX', - 'moss-sample-2.1.x', '2', '2'); -COMMIT; - --- ---------------------------- --- Table structure for `t_app_name` --- ---------------------------- -DROP TABLE IF EXISTS `t_app_name`; -CREATE TABLE `t_app_name` -( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `name` varchar(200) NOT NULL DEFAULT '' COMMENT '应用名称', - `gmt_create` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '创建时间', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 已经删除', - PRIMARY KEY (`id`) -) ENGINE = InnoDB - AUTO_INCREMENT = 4 - DEFAULT CHARSET = utf8 COMMENT ='应用name表'; - --- ---------------------------- --- Table structure for `t_dict_data` --- ---------------------------- -DROP TABLE IF EXISTS `t_dict_data`; -CREATE TABLE `t_dict_data` -( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '数据字典详细主键', - `dict_code` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT '数据字典分类标识', - `item_name` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT '数据字典详细名称', - `item_value` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT '数据字典详细值', - `item_desc` varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '数据字典详细描述', - `item_sort` int(16) DEFAULT NULL COMMENT '排序', - `gmt_create` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '创建时间', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 已经删除', - `status` tinyint(4) DEFAULT '0' COMMENT 'COMMENT ''数据字典项启用状态,1:启用,0:未启用'',', - PRIMARY KEY (`id`) -) ENGINE = InnoDB - AUTO_INCREMENT = 22 - DEFAULT CHARSET = utf8 - COLLATE = utf8_bin COMMENT ='数据字典详细表'; - --- ---------------------------- --- Records of `t_dict_data` --- ---------------------------- -BEGIN; -INSERT INTO `t_dict_data` -VALUES ('1', 'springBootVersion', '1.5.13.RELEASE', '1', '1.5.13.RELEASE', '0', '1970-01-02 00:00:00', - '2019-03-15 17:44:15', '0', '1'), - ('2', 'springBootVersion', '2.0.7.RELEASE', '2', '2.0.7.RELEASE', '0', '1970-01-02 00:00:00', - '2019-03-15 17:44:19', '0', '1'), - ('3', 'springCloudVersion', 'Edgware.SR3', '1', 'Spring Cloud Edgware.SR3', '0', '1970-01-02 00:00:00', - '2019-03-15 17:44:27', '0', '1'), - ('4', 'springCloudVersion', 'Finchley.SR2', '2', 'Spring Cloud Finchley.SR2', '0', '1970-01-02 00:00:00', - '2019-03-15 17:44:31', '0', '1'), - ('5', 'frameworkVerison', '1.1.8.RELEASE', '1', '1.1.8.RELEASE', '0', '1970-01-02 00:00:00', - '2019-04-10 19:58:48', '1', '1'), - ('6', 'frameworkVerison', '2.0.0.RELEASE', '2', '2.0.0.RELEASE', '0', '1970-01-02 00:00:00', - '2019-04-10 19:58:48', '1', '1'), - ('11', 'appFlickerRule', '当实例数小于2', '1', '当实例数小于2时闪烁', '0', '1970-01-02 00:00:00', '2019-03-19 13:44:36', '0', - '1'), - ('12', 'scoringRules', '当实例数大于1', '1', '当实例数大于1给1颗星', '0', '1970-01-02 00:00:00', '2019-03-19 13:42:48', '0', - '1'); -COMMIT; - --- ---------------------------- --- Table structure for `t_dict_type` --- ---------------------------- -DROP TABLE IF EXISTS `t_dict_type`; -CREATE TABLE `t_dict_type` -( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '数据字典分类主键', - `dict_name` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT '数据字典分类名称', - `dict_code` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT '数据字典分类唯一标识', - `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '数据字典分类启用状态,0:启用,1:未启用', - `gmt_create` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '创建时间', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 已经删除', - PRIMARY KEY (`id`) -) ENGINE = InnoDB - AUTO_INCREMENT = 11 - DEFAULT CHARSET = utf8 - COLLATE = utf8_bin COMMENT ='数据字典分类表'; - --- ---------------------------- --- Records of `t_dict_type` --- ---------------------------- -BEGIN; -INSERT INTO `t_dict_type` -VALUES ('1', 'Spring Boot的版本', 'springBootVersion', '0', '2019-03-12 02:36:02', '2019-03-14 14:17:10', '0'), - ('2', 'Spring Cloud的版本', 'springCloudVersion', '0', '2019-03-12 02:36:42', '2019-03-14 14:17:27', '0'), - ('3', 'Summer Framework的版本', 'frameworkVerison', '0', '2019-03-12 02:37:21', '2019-03-14 14:17:41', '1'), - ('6', 'App根据实例数闪烁规则', 'appFlickerRule', '0', '2019-03-15 01:55:56', '2019-03-15 01:55:56', '0'), - ('7', '评分规则', 'scoringRules', '0', '2019-03-15 01:56:22', '2019-03-15 01:56:22', '0'); -COMMIT; - --- ---------------------------- --- Table structure for `t_menu` --- ---------------------------- -DROP TABLE IF EXISTS `t_menu`; -CREATE TABLE `t_menu` -( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `parent_id` bigint(20) DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `parent_ids` varchar(255) DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, - `roles` varchar(255) DEFAULT NULL, - `sort` int(11) NOT NULL DEFAULT '1', - `icon` varchar(255) DEFAULT NULL, - `gmt_create` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '创建时间', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 已经删除', - `key` varchar(255) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE = InnoDB - AUTO_INCREMENT = 32 - DEFAULT CHARSET = utf8; - --- ---------------------------- --- Records of `t_menu` --- ---------------------------- -BEGIN; -INSERT INTO `t_menu` -VALUES ('1', '0', '总览', '0', '/dashboard', 'USER,ADMIN', '6', 'dashboard', '1970-01-02 00:00:00', '2019-03-01 18:36:14', - '0', 'dashboard'), - ('2', '0', '服务治理', '0', '/#/application', 'USER,ADMIN', '5', 'appstore', '1970-01-02 00:00:00', - '2019-03-01 17:34:03', '0', 'serviceMgmt'), - ('5', '0', '平台管理', '0', '/#', 'USER,ADMIN', '1', 'hdd', '1970-01-02 00:00:00', '2019-04-04 04:12:52', '0', - 'projectMgmt'), - ('6', '4', '推送记录', '0', '/switchCenter', 'USER,ADMIN', '1', 'code', '1970-01-02 00:00:00', '2019-01-03 16:21:07', - '0', 'switchPushLog'), - ('10', '4', '开关管理', '0', '/switchCenter', 'USER,ADMIN', '1', 'key', '1970-01-02 00:00:00', '2019-01-03 11:01:32', - '0', 'switchManage'), - ('11', '4', '机器管理', '0', null, 'USER,ADMIN', '1', 'database', '1970-01-02 00:00:00', '2018-12-10 14:04:18', '0', - 'machine'), - ('12', '0', '系统管理', '0', '', 'ADMIN', '1', 'setting', '1970-01-02 00:00:00', '2018-12-10 14:15:55', '0', 'sys'), - ('13', '12', '菜单管理', '0', '/OSManage', 'USER,ADMIN', '1', 'profile', '1970-01-02 00:00:00', - '2018-12-10 14:04:24', '0', 'menuManage'), - ('16', '5', '应用管理', '0', '/application', 'ADMIN', '1', 'euro', '1970-01-02 00:00:00', '2019-04-19 21:47:35', '0', - 'appAccept'), - ('24', '2', '服务管理', '0', '/application', 'USER,ADMIN', '5', 'deployment-unit', '2019-02-22 03:21:10', - '2019-04-19 21:49:06', '0', 'serviceManage'), - ('25', '2', '事件中心', '0', '/application', 'USER,ADMIN', '0', 'setting', '2019-02-25 03:22:10', - '2019-02-25 03:22:24', '0', 'eventLog'), - ('26', '2', '实例管理', '0', '/application', 'USER,ADMIN', '3', 'ant-design', '1970-01-02 00:00:00', - '2019-04-19 21:50:22', '0', 'list'), - ('27', '5', '项目列表', '0', '/application', 'ADMIN', '2', 'project', '2019-03-07 02:33:31', '2019-04-19 21:48:32', - '0', 'Project'), - ('28', '12', '用户列表', '0', '/userMgmt', 'USER,ADMIN', '0', 'user', '2019-03-07 02:35:53', '2019-04-04 06:53:52', - '0', 'userMgmt'), - ('30', '12', '数据字典', '0', '/remoteConfig', 'ADMIN', '0', 'appstore', '2019-03-13 03:10:28', - '2019-03-13 03:10:28', '0', 'remoteConfig'), - ('31', '5', '注册中心', '0', '/registerCenterMgmt', 'ADMIN', '0', 'gateway', '2019-04-04 04:13:20', - '2019-04-19 21:48:02', '0', 'registerCenterMgmt'); -COMMIT; - --- ---------------------------- --- Table structure for `t_project` --- ---------------------------- -DROP TABLE IF EXISTS `t_project`; -CREATE TABLE `t_project` -( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '项目Id', - `name` varchar(200) NOT NULL DEFAULT '' COMMENT '项目名称', - `cname` varchar(200) NOT NULL DEFAULT '' COMMENT '项目中文名称', - `key` varchar(200) NOT NULL DEFAULT '0' COMMENT '项目key', - `owner_name` varchar(200) NOT NULL DEFAULT '' COMMENT '负责人姓名', - `owner_id` varchar(200) DEFAULT '0' COMMENT '负责人Id', - `description` varchar(1000) DEFAULT '' COMMENT '项目描述', - `gmt_create` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '创建时间', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 已经删除', - PRIMARY KEY (`id`) -) ENGINE = InnoDB - AUTO_INCREMENT = 216 - DEFAULT CHARSET = utf8 COMMENT ='项目表'; - --- ---------------------------- --- Records of `t_project` --- ---------------------------- -BEGIN; -INSERT INTO `t_project` -VALUES ('1', '服务治理', '服务治理', 'MOSS', '许进', 'xujin', '服务治理', '2019-02-28 21:01:18', '2019-04-05 14:42:36', '0'), - ('2', '中台项目', '中台项目', 'HALO', '许进', 'xujin', '', '2019-02-28 21:02:25', '2019-04-05 14:43:09', '0'), - ('3', 'PMO', 'PMO', 'PMO', '黎茂', 'mao.li001', '', '2019-02-28 21:02:25', '2019-03-07 16:45:13', '1'), - ('4', 'XXXUED', 'XXXUED', 'UED', '王佳琳', 'jialin.wang', '', '2019-02-28 21:02:26', '2019-03-07 16:45:17', '1'); -COMMIT; - --- ---------------------------- --- Table structure for `t_register_center` --- ---------------------------- -DROP TABLE IF EXISTS `t_register_center`; -CREATE TABLE `t_register_center` -( - `id` int(11) NOT NULL AUTO_INCREMENT, - `code` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '注册中心标识', - `url` varchar(100) COLLATE utf8_bin NOT NULL COMMENT '注册中心url', - `desc` varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '描述', - `status` tinyint(1) NOT NULL COMMENT '1 运行,0 停用', - `gmt_create` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '创建时间', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 已经删除', - `name` varchar(50) COLLATE utf8_bin DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE = InnoDB - AUTO_INCREMENT = 5 - DEFAULT CHARSET = utf8 - COLLATE = utf8_bin COMMENT ='注册中心表'; - --- ---------------------------- --- Records of `t_register_center` --- ---------------------------- -BEGIN; -INSERT INTO `t_register_center` -VALUES ('1', 'sq', 'http://eureka.springcloud.cn/eureka/', '社区注册', '1', '2019-04-04 04:28:11', '2019-04-05 18:54:45', - '0', '社区注册'), - ('4', 'zj', 'http://localhost:8071/eureka', '自己本地', '0', '2019-04-20 22:37:04', '2019-04-21 11:37:25', '0', - '自己本地'); -COMMIT; - --- ---------------------------- --- Table structure for `t_user` --- ---------------------------- -DROP TABLE IF EXISTS `t_user`; -CREATE TABLE `t_user` -( - `id` int(11) NOT NULL AUTO_INCREMENT, - `username` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '英文名唯一', - `name` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '中文名', - `password` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '密码', - `status` tinyint(1) NOT NULL COMMENT '是否启用', - `gmt_create` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '创建时间', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 已经删除', - `email` varchar(255) COLLATE utf8_bin DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE = InnoDB - AUTO_INCREMENT = 7 - DEFAULT CHARSET = utf8 - COLLATE = utf8_bin COMMENT ='用户表'; - --- ---------------------------- --- Records of `t_user` --- ---------------------------- -BEGIN; -INSERT INTO `t_user` -VALUES ('1', 'xujin', 'xujin', 'UUKHSDDI5KPA43A8VL06V0TU2', '0', '2019-03-06 20:23:50', '2019-03-08 19:15:35', '0', - 'Software_King@qq.com'), - ('6', 'admin', 'admin', 'UUKHSDDI5KPA43A8VL06V0TU2', '0', '2019-04-12 04:37:00', '2019-04-21 11:38:48', '0', - 'admin@qq.com'); -COMMIT; - --- ---------------------------- --- Table structure for `t_user_app` --- ---------------------------- -DROP TABLE IF EXISTS `t_user_app`; -CREATE TABLE `t_user_app` -( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `mail_nick_name` varchar(200) NOT NULL DEFAULT '' COMMENT '邮箱前缀名称', - `app_id` varchar(200) NOT NULL DEFAULT '' COMMENT '应用名称', - `gmt_create` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '创建时间', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 已经删除', - PRIMARY KEY (`id`) -) ENGINE = InnoDB - AUTO_INCREMENT = 48 - DEFAULT CHARSET = utf8 COMMENT ='应用name表'; - --- ---------------------------- --- Records of `t_user_app` --- ---------------------------- -BEGIN; -INSERT INTO `t_user_app` -VALUES ('38', 'xujin', 'halo-moss', '2019-03-10 05:46:39', '2019-04-05 01:31:23', '1'), - ('39', 'xujin', 'loop_test', '2019-03-10 07:44:23', '2019-03-10 07:44:27', '1'), - ('40', 'admin', 'halo-moss', '2019-03-11 22:45:05', '2019-03-11 22:45:07', '1'), - ('41', 'test', 'halo-moss', '2019-03-12 00:03:39', '2019-03-12 00:03:51', '1'), - ('42', 'test', 'loop_test', '2019-03-12 00:52:27', '2019-03-12 01:04:15', '1'), - ('43', 'admin', 'loop_test', '2019-03-12 04:37:18', '2019-03-12 04:37:21', '1'), - ('44', 'admin', 'loop_test', '2019-03-12 04:37:23', '2019-03-12 04:37:24', '1'), - ('45', 'admin', 'loop_test', '2019-03-14 09:13:35', '2019-03-14 09:13:41', '1'), - ('46', 'test', 'halo-moss', '2019-03-18 04:17:17', '2019-03-18 04:17:19', '1'), - ('47', 'xujin', 'halo-moss', '2019-04-10 06:47:12', '2019-04-10 06:47:12', '0'); -COMMIT; - --- ---------------------------- --- Table structure for `t_user_roles` --- ---------------------------- -DROP TABLE IF EXISTS `t_user_roles`; -CREATE TABLE `t_user_roles` -( - `id` int(11) NOT NULL AUTO_INCREMENT, - `username` varchar(50) COLLATE utf8_bin NOT NULL, - `role` varchar(50) COLLATE utf8_bin NOT NULL, - `gmt_create` timestamp NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '创建时间', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0 否 1 已经删除', - PRIMARY KEY (`id`), - UNIQUE KEY `ix_auth_username` (`username`, `role`) USING BTREE -) ENGINE = InnoDB - AUTO_INCREMENT = 16 - DEFAULT CHARSET = utf8 - COLLATE = utf8_bin; - --- ---------------------------- --- Records of `t_user_roles` --- ---------------------------- -BEGIN; -INSERT INTO `t_user_roles` -VALUES ('11', 'admin', 'ADMIN', '2019-03-06 20:24:51', '2019-03-07 16:27:54', '0'), - ('12', 'xujin', 'ADMIN', '2019-03-08 05:15:41', '2019-03-08 19:16:52', '0'), - ('13', 'test', 'USER', '1970-01-02 00:00:00', '2019-03-12 12:52:40', '0'); -COMMIT; - -SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/docker-compose/nacos/prometheus.yaml b/docker-compose/nacos/prometheus.yaml deleted file mode 100644 index 521e2617..00000000 --- a/docker-compose/nacos/prometheus.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# my global config -global: - scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. - evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. - # scrape_timeout is set to the global default (10s). - -# Alertmanager configuration -alerting: - alertmanagers: - - static_configs: - - targets: - # - alertmanager:9093 - -# Load rules once and periodically evaluate them according to the global 'evaluation_interval'. -rule_files: -# - "first_rules.yml" -# - "second_rules.yml" - -# A scrape configuration containing exactly one endpoint to scrape: -# Here it's Prometheus itself. -scrape_configs: - # The job name is added as a label `job=` to any timeseries scraped from this config. - - job_name: 'prometheus' - - # metrics_path defaults to '/metrics' - # scheme defaults to 'http'. - - static_configs: - - targets: ['localhost:9090'] - - - job_name: 'nacos' - metrics_path: '/nacos/actuator/prometheus' - static_configs: - - targets: ['nacos:8848'] \ No newline at end of file diff --git a/docker-compose/readme.md b/docker-compose/readme.md deleted file mode 100644 index da0caabd..00000000 --- a/docker-compose/readme.md +++ /dev/null @@ -1,30 +0,0 @@ - - -## 启动基础服务 - -mysql、redis、rabbitmq - -`docker-compose up -d` - -rabbitmq默认账号密码:guest/guest -mysql默认账号密码:root/root123 - -## 启动devops组件,如elasticsearch、zipkin、skywalking、kibana、grafana - -`docker-compose -f docker-compose.yml -f docker-compose.devops.yml up` - -## 启动阿里注册中心和配置中心nacos - -`docker-compose -f docker-compose.yml -f docker-compose.nacos.yml up` - -默认账号密码:nacos/nacos - -## 启动监控类服务,如springboot-admin、sentinel-dashboard - -`docker-compose -f docker-compose.yml -f docker-compose.monitor.yml up` - -默认账号密码:sentinel/sentinel - -## 启动MOSS - -`docker-compose -f docker-compose.yml -f docker-compose.moss.yml up moss` diff --git a/facade/pom.xml b/facade/pom.xml deleted file mode 100644 index 3246bca7..00000000 --- a/facade/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - - facade - 0.0.1-SNAPSHOT - jar - - facade - - - com.springboot.cloud - cloud - 0.0.1-SNAPSHOT - - - - - org.projectlombok - lombok - - - diff --git a/facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java deleted file mode 100644 index b9bdbb4a..00000000 --- a/facade/src/main/java/com/springboot/cloud/sysadmin/facade/constant/PermissionChangeTypeEnum.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.springboot.cloud.sysadmin.facade.constant; - -/** - * 权限更新枚举类型 - * - * @author wayne - * @date 2021/09/08 - */ -public enum PermissionChangeTypeEnum { - - - /** - * 删除 - */ - DELETE, - /** - * 增加 - */ - ADD - -} diff --git a/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java deleted file mode 100644 index d77e20b2..00000000 --- a/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/GroupDTO.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.springboot.cloud.sysadmin.facade.dto; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - * 集团dto - * 组DTO - * - * @author wayne - * @date 2021/09/13 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class GroupDTO implements Serializable { - - private String name; - private String parentId; - private String description; -} diff --git a/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java deleted file mode 100644 index da5ea915..00000000 --- a/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionChangeDTO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.springboot.cloud.sysadmin.facade.dto; - -import com.springboot.cloud.sysadmin.facade.constant.PermissionChangeTypeEnum; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - * 权限变动通知MQ - * - * @author wayne - * @date 2021/09/13 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class PermissionChangeDTO implements Serializable { - private PermissionChangeTypeEnum changeType; - private String groupCode; - private PermissionDTO permissionDTO; -} diff --git a/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java b/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java deleted file mode 100644 index 32c05eea..00000000 --- a/facade/src/main/java/com/springboot/cloud/sysadmin/facade/dto/PermissionDTO.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.springboot.cloud.sysadmin.facade.dto; - - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - * 数据权限资源传输类 - * - * @author wayne - * @date 2021/09/06 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class PermissionDTO implements Serializable { - - - /** - * 组织代码 - */ - private String groupCode; - /** - * 资源类型:hive,hdfs - */ - private String resType; - - /** - * 资源地区 - */ - private String area; - - /** - * 资源完整路径 - */ - private String resFullPath; - - /** - * 资源全名 - */ - private String resFullName; - - /** - * 资源操作位:读,写,查询 - */ - private String operationBit; -} diff --git a/install.sh b/install.sh deleted file mode 100755 index 6741c3a4..00000000 --- a/install.sh +++ /dev/null @@ -1,223 +0,0 @@ -#!/usr/bin/env bash -echo '==================1.开发环境准备================================' -echo '1.1请确保安装并java8, git, maven并设置好环境变量' -echo '1.2请确保安装并docker,docker-compose并设置好环境变量' - -#确认环境信息准备就绪 -read -r -p "开发环境准备好了吗? [Y/n] " envConfirm -case $envConfirm in - [yY][eE][sS]|[yY]) - echo "Yes 继续执行" - ;; - [nN][oO]|[nN]) - echo "No 终止执行" - exit 1 - ;; - *) - echo "Invalid input... 终止执行" - exit 1 - ;; -esac - -echo '==================1.3清理当前脚本启动的容器和产生的镜像(可选的)==============' -#清理当前脚本启动的容器和产生的镜像(可选的) -#docker stop sc-rabbitmq sc-redis sc-mysql -#docker rm sc-rabbitmq sc-redis sc-mysql -#docker image rm rabbitmq:alpine redis:alpine mysql:9.6-alpine - -#docker stop sc-monitor-admin sc-authorization-server sc-authentication-server sc-organization sc-gateway-admin sc-gateway-web -#docker rm sc-monitor-admin sc-authorization-server sc-authentication-server sc-organization sc-gateway-admin sc-gateway-web -#docker image rm cike/admin cike/authorization-server:latest cike/authentication-server:latest cike/organization:latest cike/gateway-admin:latest cike/gateway-web:latest - -echo '==================2.安装认证公共包到本地maven仓库==================' -#安装认证公共包到本地maven仓库 -cd common && mvn install -echo '当前目录:' && pwd - -#回到根目录 -cd - - -echo '==================3.安装认证客户端到本地maven仓库==================' -#安装认证客户端到本地maven仓库 -cd auth/authentication-client && mvn install -echo '当前目录:' && pwd - -#回到根目录 -cd - - -echo '==================4.docker-compose启动公共服务===================' -#去docker-compose目录 -cd docker-compose -echo '==================4.1显示环境变量: docker-compose/.env ==========' -#显示环境变量 -cat ./.env -echo '' - -#按需要开启公共服务 -echo '==================4.2启动 mysql or redis or rabbitmq ========' -docker-compose -f docker-compose.yml up -d mysql -docker-compose -f docker-compose.yml up -d redis -docker-compose -f docker-compose.yml up -d rabbitmq - -echo '当前目录:' && pwd - -#回到根目录 -cd - - -echo '==================4.3.构建镜像: 配置中心, 消息中心========' - -#构建镜像:消息中心 -cd ./center/bus -mvn package && mvn docker:build - -#回到根目录 -cd - - -echo '==================4.4.启动注册中心, 配置中心, 消息中心============' -#去docker-compose目录 -cd docker-compose - -#启动注册中心 -docker-compose -f docker-compose.yml -f docker-compose.nacos.yml up -d nacos - -#回到根目录 -cd - - -echo '==================5.构建镜像并启动网关(gateway)相关服务===============' -#构建镜像:网关服务 -cd ./gateway/gateway-web -mvn package && mvn docker:build - -#回到根目录 -cd - - -#构建镜像:网关管理服务 -cd ./gateway/gateway-admin -mvn package && mvn docker:build - -#确认初始化网关服务的DB:./gateway/gateway-admin/src/main/db -echo '你可以立即去部署网关服务的DB(脚本路径:./gateway/gateway-admin/src/main/db),然后回来继续...' -read -r -p "确认网关服务的DB部署好了吗? [Y/n] " gwDbConfirm -case $gwDbConfirm in - [yY][eE][sS]|[yY]) - echo "Yes 继续执行" - ;; - [nN][oO]|[nN]) - echo "No 终止执行" - exit 1 - ;; - *) - echo "Invalid input... 终止执行" - exit 1 - ;; -esac - -#回到根目录 -cd - - -#去docker-compose目录 -cd docker-compose - -#启动网关服务 -docker-compose -f docker-compose.yml -f docker-compose.spring-gateway.yml up -d gateway-web - -#启动网关管理服务 -docker-compose -f docker-compose.yml -f docker-compose.spring-gateway.yml up -d gateway-admin - -#回到根目录 -cd - - -echo '==================6.构建镜像并启动组织(organization)相关服务==================' -#构建镜像:组织服务 -cd ./sysadmin/organization -mvn package && mvn docker:build - -#确认初始化授权/认证服务的DB:./sysadmin/db -echo '你可以立即去部署组织服务的DB(脚本路径:./sysadmin/db),然后回来继续...' -read -r -p "确认部署组织服务的DB部署好了吗? [Y/n] " orgDbConfirm -case $orgDbConfirm in - [yY][eE][sS]|[yY]) - echo "Yes 继续执行" - ;; - [nN][oO]|[nN]) - echo "No 终止执行" - exit 1 - ;; - *) - echo "Invalid input... 终止执行" - exit 1 - ;; -esac - -#回到根目录 -cd - - -#去docker-compose目录 -cd docker-compose - -#启动组织服务 -docker-compose -f docker-compose.yml -f docker-compose.auth.yml up -d organization - -#回到根目录 -cd - - -echo '==================7.构建镜像并启动认证(auth)相关服务==================' -#构建镜像:认证服务 -cd ./auth/authentication-server -mvn package && mvn docker:build - -#回到根目录 -cd - - -#构建镜像:授权服务 -cd ./auth/authorization-server -mvn package && mvn docker:build - -#确认初始化授权/认证服务的DB:./auth/db -echo '你可以立即去部署授权/认证服务的DB(脚本路径:./auth/db),然后回来继续...' -read -r -p "确认部署授权/认证服务的DB部署好了吗? [Y/n] " authDbConfirm -case $authDbConfirm in - [yY][eE][sS]|[yY]) - echo "Yes 继续执行" - ;; - [nN][oO]|[nN]) - echo "No 终止执行" - exit 1 - ;; - *) - echo "Invalid input... 终止执行" - exit 1 - ;; -esac - -#回到根目录 -cd - - -#去docker-compose目录 -cd docker-compose - -#启动网关服务 -docker-compose -f docker-compose.yml -f docker-compose.auth.yml up -d authorization-server - -#启动网关管理服务 -docker-compose -f docker-compose.yml -f docker-compose.auth.yml up -d authentication-server - -#回到根目录 -cd - - -echo '==================8.构建镜像并启动监控(monitor)相关服务===============' -#构建镜像:管理台服务 -cd ./monitor/admin -mvn package && mvn docker:build - -#回到根目录 -cd - - -#去docker-compose目录 -cd docker-compose - -#启动网关服务 -docker-compose -f docker-compose.yml -f docker-compose.monitor.yml up -d monitor-admin - -#回到根目录 -cd - diff --git a/monitor/admin/.gitignore b/monitor/admin/.gitignore deleted file mode 100644 index 3a051984..00000000 --- a/monitor/admin/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -target/ -logs/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr diff --git a/monitor/admin/pom.xml b/monitor/admin/pom.xml deleted file mode 100644 index edda4890..00000000 --- a/monitor/admin/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - - com.springboot.cloud - admin - 0.0.1-SNAPSHOT - jar - - admin - Demo project for Spring Cloud Admin - - - com.springboot.cloud - monitor - 0.0.1-SNAPSHOT - - - - 2.1.6 - - - - - de.codecentric - spring-boot-admin-starter-server - ${admin-server.version} - - - org.springframework.boot - spring-boot-starter-security - - - - - - - - com.spotify - docker-maven-plugin - 1.2.0 - - - cike/${project.artifactId} - ${project.basedir}/src/main/docker - true - - - / - ${project.build.directory} - ${project.build.finalName}.jar - - - - - - - - diff --git a/monitor/admin/src/main/docker/Dockerfile b/monitor/admin/src/main/docker/Dockerfile deleted file mode 100644 index b2ade522..00000000 --- a/monitor/admin/src/main/docker/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM java:alpine -VOLUME /tmp -ADD admin-0.0.1-SNAPSHOT.jar app.jar -ENTRYPOINT ["java","-jar","/app.jar"] diff --git a/monitor/admin/src/main/java/com/springboot/admin/AdminApplication.java b/monitor/admin/src/main/java/com/springboot/admin/AdminApplication.java deleted file mode 100644 index 75958a3b..00000000 --- a/monitor/admin/src/main/java/com/springboot/admin/AdminApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.springboot.admin; - -import de.codecentric.boot.admin.server.config.EnableAdminServer; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableAdminServer -public class AdminApplication { - public static void main(String[] args) { - SpringApplication.run(AdminApplication.class, args); - } -} diff --git a/monitor/admin/src/main/java/com/springboot/admin/SecurityConfig.java b/monitor/admin/src/main/java/com/springboot/admin/SecurityConfig.java deleted file mode 100644 index de63a79e..00000000 --- a/monitor/admin/src/main/java/com/springboot/admin/SecurityConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.springboot.admin; - -import de.codecentric.boot.admin.server.config.AdminServerProperties; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; - -@Configuration -public class SecurityConfig extends WebSecurityConfigurerAdapter { - private final String adminContextPath; - - public SecurityConfig(AdminServerProperties adminServerProperties) { - this.adminContextPath = adminServerProperties.getContextPath(); - } - - @Override - protected void configure(HttpSecurity http) throws Exception { - // @formatter:off - SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); - successHandler.setTargetUrlParameter("redirectTo"); - - http.authorizeRequests() - .antMatchers(adminContextPath + "/assets/**").permitAll() - .antMatchers(adminContextPath + "/actuator/**").permitAll() - .antMatchers(adminContextPath + "/login").permitAll() - .anyRequest().authenticated() - .and() - .formLogin().loginPage(adminContextPath + "/login") - .successHandler(successHandler).and() - .logout().logoutUrl(adminContextPath + "/logout") - .and() - .httpBasic().and() - .csrf().disable(); - // @formatter:on - } -} \ No newline at end of file diff --git a/monitor/admin/src/main/resources/application.yml b/monitor/admin/src/main/resources/application.yml deleted file mode 100644 index 7c75b218..00000000 --- a/monitor/admin/src/main/resources/application.yml +++ /dev/null @@ -1,38 +0,0 @@ -spring: - rabbitmq: - host: ${RABBIT_MQ_HOST:localhost} - port: ${RABBIT_MQ_PORT:5672} - username: ${RABBIT_MQ_USERNAME:guest} - password: ${RABBIT_MQ_PASSWORD:guest} - redis: - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - ##password: ${REDIS_PASSWORD:} - #spring boot admin的登陆账号和密码配置 - security: - user: - name: admin - password: 123456 - #通过rabbit MQ将日志发给zipkin - zipkin: - enabled: true - sender: - type: rabbit - sleuth: - sampler: - probability: 1.0 - -management: - endpoints: - web: - exposure: - include: '*' -#日志相关配置 -logging: - level: - org.springframework.security: DEBUG - path: logs/ - file: - max-size: 1GB - - diff --git a/monitor/admin/src/main/resources/bootstrap.yml b/monitor/admin/src/main/resources/bootstrap.yml deleted file mode 100644 index f08b33cd..00000000 --- a/monitor/admin/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,12 +0,0 @@ -server: - port: ${SERVER_PORT:8022} -spring: - application: - name: admin - cloud: - nacos: - discovery: - server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848} - config: - server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848} - file-extension: yml diff --git a/monitor/admin/src/test/java/com/springboot/admin/ConsumerApplicationTests.java b/monitor/admin/src/test/java/com/springboot/admin/ConsumerApplicationTests.java deleted file mode 100644 index d6647d03..00000000 --- a/monitor/admin/src/test/java/com/springboot/admin/ConsumerApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.springboot.admin; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class ConsumerApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/monitor/pom.xml b/monitor/pom.xml deleted file mode 100644 index dcf63450..00000000 --- a/monitor/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - 4.0.0 - - com.springboot.cloud - monitor - 0.0.1-SNAPSHOT - pom - - monitor - Demo Monitor project for Spring Boot - - - com.springboot.cloud - cloud - 0.0.1-SNAPSHOT - - - - admin - - - - - org.springframework.boot - spring-boot-starter-web - - - diff --git a/monitor/readme.md b/monitor/readme.md deleted file mode 100644 index a641996a..00000000 --- a/monitor/readme.md +++ /dev/null @@ -1,154 +0,0 @@ - -快速构建spring-cloud + sleuth + rabbit + zipkin + es + kibana + grafana日志跟踪平台 -------------- - -## 简介 - - ### Spring-Cloud-Sleuth - - Spring-Cloud-Sleuth是Spring Cloud的组成部分之一,为SpringCloud应用实现了一种分布式追踪解决方案,其兼容了Zipkin, HTrace和log-based追踪 - - * 术语(Terminology) - - **Span:** 基本工作单元,例如,在一个新建的span中发送一个RPC等同于发送一个回应请求给RPC,span通过一个64位ID唯一标识,trace以另一个64位ID表示,span还有其他数据信息,比如摘要、时间戳事件、关键值注释(tags)、span的ID、以及进度ID(通常是IP地址) - - span在不断的启动和停止,同时记录了时间信息,当你创建了一个span,你必须在未来的某个时刻停止它。 - - **Trace:** 一系列spans组成的一个树状结构,例如,如果你正在跑一个分布式大数据工程,你可能需要创建一个trace。 - - **Annotation:** 用来及时记录一个事件的存在,一些核心annotations用来定义一个请求的开始和结束 - - cs - Client Sent -客户端发起一个请求,这个annotion描述了这个span的开始 - sr - Server Received -服务端获得请求并准备开始处理它,如果将其sr减去cs时间戳便可得到网络延迟 - ss - Server Sent -注解表明请求处理的完成(当请求返回客户端),如果ss减去sr时间戳便可得到服务端需要的处理请求时间 - cr - Client Received -表明span的结束,客户端成功接收到服务端的回复,如果cr减去cs时间戳便可得到客户端从服务端获取回复的所有所需时间 - - 将Span和Trace在一个系统中使用Zipkin注解的过程图形化: - - ![图片](../docs/sleuth.png) - - ### Rabbitmq: 消息队列,主要用于传输日志 - - - ### Zipkin: 服务调用链路追踪系统,聚合各业务系统调用延迟数据,达到链路调用监控与跟踪。 - - 服务调用链路 - ![图片](../docs/zipkin-server.png) - - 服务调用链路详情 - ![图片](../docs/zipkin-detail.png) - - 服务间的调用关系 - ![图片](../docs/zipkin-dependencies.png) - - ### ES + Kibana提供搜索、查看和与存储在 Elasticsearch 索引中的数据进行交互的功能。开发者或运维人员可以轻松地执行高级数据分析,并在各种图表、表格和地图中可视化数据。 - - ![图片](../docs/kibana.png) - - ### Grafana可视化图表监控工具 - - ![图片](../docs/grafana.png) - - -## zipkin-server搭建与使用 - -docker-compose - -```yaml -version: '3' -services: - rabbitmq: - image: rabbitmq:alpine - container_name: sc-rabbitmq - restart: always - volumes: - - ./data/rabbitmq:/var/lib/rabbitmq - networks: - - sc-net - ports: - - 5672:5672 - - zipkin-server: - image: openzipkin/zipkin - container_name: sc-zipkin-server - restart: always - volumes: - - ./data/logs/zipkin-server:/logs - networks: - - sc-net - ports: - - 9411:9411 - environment: - - RABBIT_ADDRESSES=rabbitmq:5672 - - RABBIT_MQ_PORT=5672 - - RABBIT_PASSWORD=guest - - RABBIT_USER=guest - depends_on: - - rabbitmq - -``` -## 搭建ES + Grafana -```yaml -version: '3' -services: - elasticsearch: - image: elasticsearch:alpine - container_name: sc-elasticsearch - restart: always - volumes: - - ./data/elasticsearch/logs:/var/logs/elasticsearch - networks: - - sc-net - ports: - - 9200:9200 - - kibana: - image: kibana - container_name: sc-kibana - restart: always - volumes: - - ./data/kibana/logs:/var/logs/kibana - networks: - - sc-net - ports: - - 5601:5601 - environment: - - ELASTICSEARCH_URL=http://elasticsearch:9200 - depends_on: - - elasticsearch - - grafana: - image: grafana/grafana - container_name: sc-grafana - restart: always - volumes: - - ./data/grafana/logs:/var/logs/grafana - networks: - - sc-net - ports: - - 3000:3000 -``` - -## 测试 - -### 启动服务 - -将以上docker-compose脚本保存为ocker-compose.yml,并在当时目录下执行`docker-compose up` - -### spring-cloud集成 - -请参考:https://github.com/zhoutaoo/SpringCloud例子 - -应用集成开发好后,请求应用的接口 - -### 查看日志 - -zipkin访问地址:http://localhost:9411,可以看到请求的耗时与路径 - -kibana访问地址:http://localhost:5601,可以看到请求打印的日志 - -grafana访问地址:http://localhost:3000,可以新增es数据源,出可视化的图表和监控 - - - - diff --git "a/object-storage/docs/minio\351\203\250\347\275\262.md" "b/object-storage/docs/minio\351\203\250\347\275\262.md" deleted file mode 100644 index e5613723..00000000 --- "a/object-storage/docs/minio\351\203\250\347\275\262.md" +++ /dev/null @@ -1,53 +0,0 @@ -### Minio 服务器 - - - -- docker 部署 - -```docker -docker pull minio/minio - -docker run -p 9000:9000 minio/minio server /data - -默认: -Access Key: minioadmin -Secret Key: minioadmin -``` -- docker 部署 MinIO自定义Access和Secret密钥 - - 要覆盖MinIO的自动生成的密钥,您可以将Access和Secret密钥设为环境变量。 MinIO允许常规字符串作为Access和Secret密钥。 -```docker -docker run -p 9000:9000 --name minio1 \ - -e "MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE" \ - -e "MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \ - -v /mnt/data:/data \ - -v /mnt/config:/root/.minio \ - minio/minio server /data -``` - - - -- macOS 部署 -```linux -brew install minio/stable/minio -minio server /data -``` - - - -- Windows系统 - - **下载二进制文件** - -| 操作系统 | CPU架构 | 地址 | -| --------------- | ------- | ------------------------------------------------------------ | -| 微软Windows系统 | 64位 | http://dl.minio.org.cn/server/minio/release/windows-amd64/minio.exe | - -```text -minio.exe server D:\Photos -``` - - - -Minio 文档 : http://docs.minio.org.cn/docs - diff --git a/object-storage/file-service/pom.xml b/object-storage/file-service/pom.xml deleted file mode 100644 index e1729407..00000000 --- a/object-storage/file-service/pom.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - 4.0.0 - - - com.springboot.cloud - object-storage - 0.0.1-SNAPSHOT - - - file-service - 0.0.1-SNAPSHOT - - file-service - - File Service project for Spring Boot - - - - io.minio - minio - 8.0.3 - - - org.apache.commons - commons-lang3 - - - commons-io - commons-io - 2.7 - - - commons-fileupload - commons-fileupload - 1.4 - - - commons-io - commons-io - - - - - org.springframework.boot - spring-boot-configuration-processor - true - - - org.springframework.boot - spring-boot-starter-web - - - com.springboot.cloud - web - 0.0.1-SNAPSHOT - - - - - - - - com.spotify - docker-maven-plugin - 1.2.0 - - - cike/${project.artifactId} - ${project.basedir}/src/main/docker - true - - - / - ${project.build.directory} - ${project.build.finalName}.jar - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 7 - 7 - - - - - - diff --git a/object-storage/file-service/src/main/docker/Dockerfile b/object-storage/file-service/src/main/docker/Dockerfile deleted file mode 100644 index 3c658eb7..00000000 --- a/object-storage/file-service/src/main/docker/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM java:alpine -VOLUME /tmp -ADD fileService-0.0.1-SNAPSHOT.jar app.jar -ENTRYPOINT ["java","-jar","/app.jar"] diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/FileServiceApplication.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/FileServiceApplication.java deleted file mode 100644 index e7a230a8..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/FileServiceApplication.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.springboot.cloud.file; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; - -/** - * @author fengdan - */ -@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) -public class FileServiceApplication { - public static void main(String[] args) { - SpringApplication.run(FileServiceApplication.class, args); - } -} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioConfigure.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioConfigure.java deleted file mode 100644 index 7624e4f8..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioConfigure.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.springboot.cloud.file.configure; - -import io.minio.MinioClient; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @author fengdan - */ -@Configuration -@EnableConfigurationProperties(MinioProperties.class) -public class MinioConfigure { - - private final MinioProperties properties; - - public MinioConfigure(@Qualifier("minioProperties") MinioProperties properties) { - this.properties = properties; - } - - /** - * 构建客户端 - * - * @return MinioClient - */ - @Bean - public MinioClient minioClient() { - return MinioClient.builder() - .endpoint(properties.getEndpoint()) - .credentials(properties.getAccessKey(), properties.getSecretKey()) - .build(); - } -} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioProperties.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioProperties.java deleted file mode 100644 index bc2576dc..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/configure/MinioProperties.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.springboot.cloud.file.configure; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * @author fengdan - */ -@Data -@Component("minioProperties") -@ConfigurationProperties(prefix = "spring.minio") -public class MinioProperties { - /** - * 连接端点 - */ - private String endpoint; - /** - * 用户名 - */ - private String accessKey; - /** - * 密码 - */ - private String secretKey; -} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/entity/FileObject.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/entity/FileObject.java deleted file mode 100644 index ce0b8123..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/entity/FileObject.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.springboot.cloud.file.entity; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author fengdan - * @date 2021年07月01日 15:04 - */ -@ApiModel -@Data -public class FileObject { - @NotBlank(message = "不能为空") - @ApiModelProperty("文件名") - private String fileName; - @NotBlank(message = "不能为空") - @ApiModelProperty("存储空间(桶)") - private String bucketName; -} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/GlobalExceptionHandlerAdvice.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/GlobalExceptionHandlerAdvice.java deleted file mode 100644 index 11438153..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/GlobalExceptionHandlerAdvice.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.springboot.cloud.file.exception; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.common.web.exception.DefaultGlobalExceptionHandlerAdvice; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; - -/** - * @author fengdan - */ -@Slf4j -@RestControllerAdvice -public class GlobalExceptionHandlerAdvice extends DefaultGlobalExceptionHandlerAdvice { - - @ExceptionHandler(value = {MinioFileException.class}) - public Result uploadFileFailure(MinioFileException ex) { - log.error(ex.getMessage()); - return Result.fail(ex.getErrorType()); - } -} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileException.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileException.java deleted file mode 100644 index 40653359..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileException.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.springboot.cloud.file.exception; - -import com.springboot.cloud.common.core.exception.BaseException; -import com.springboot.cloud.common.core.exception.ErrorType; - -/** - * @author fengdan - * @date 2021年07月01日 14:38 - */ -public class MinioFileException extends BaseException { - public MinioFileException() { - super(MinioFileType.FILE_UPLOAD_FAILED); - } - - public MinioFileException(String message) { - super(MinioFileType.FILE_UPLOAD_FAILED, message); - } - - public MinioFileException(ErrorType errorType, String message) { - super(errorType, message); - } -} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileType.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileType.java deleted file mode 100644 index 42a4d65c..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/exception/MinioFileType.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.springboot.cloud.file.exception; - -import com.springboot.cloud.common.core.exception.ErrorType; -import lombok.Getter; - -/** - * @author fengdan - * @date 2021年07月01日 14:39 - */ -@Getter -public enum MinioFileType implements ErrorType { - FILE_UPLOAD_FAILED("040100", "文件上传失败!"), - FILE_REMOVE_FAILED("040200", "文件删除失败!"), - FILE_GET_FAILED("040300", "获取文件失败!"), - FAILED_DOWNLOAD_FILE("040400", "下载文件失败!") - - ; - /** - * 错误类型码 - */ - private String code; - /** - * 错误类型描述信息 - */ - private String mesg; - - MinioFileType(String code, String mesg) { - this.code = code; - this.mesg = mesg; - } -} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/rest/FileController.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/rest/FileController.java deleted file mode 100644 index 719f3cf5..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/rest/FileController.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.springboot.cloud.file.rest; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.file.entity.FileObject; -import com.springboot.cloud.file.exception.MinioFileException; -import com.springboot.cloud.file.exception.MinioFileType; -import com.springboot.cloud.file.service.FileService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; - -/** - * @author fengdan - */ -@Api(tags = "文件管理") -@RestController -@RequestMapping(value = "/file") -public class FileController { - - private final FileService fileService; - - public FileController(@Qualifier("minioServiceImpl") FileService fileService) { - this.fileService = fileService; - } - - - @ApiOperation(value = "上传文件", notes = "上传文件", response = Result.class) - @PostMapping("/upload") - public Result upload(@RequestParam(value = "file") MultipartFile file, - @RequestParam(value = "bucketName") String bucketName) { - return Result.success(fileService.uploadFile(file, bucketName)); - } - - - @ApiOperation(value = "删除文件", notes = "删除文件", response = Result.class) - @DeleteMapping("/remove") - public Result remove(@Valid @RequestBody FileObject fileObject) { - fileService.removeFile(fileObject.getBucketName(), fileObject.getFileName()); - return Result.success(); - } - - - @ApiOperation(value = "预览图片", notes = "预览图片") - @GetMapping("/previewPicture/{fileName}") - public void previewPicture(@PathVariable("fileName") String objectName, - @RequestParam(value = "bucketName") String bucketName, - HttpServletResponse response) throws IOException { - response.setContentType("image/jpeg"); - try (ServletOutputStream out = response.getOutputStream()) { - InputStream stream = fileService.getObject(bucketName, objectName); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - byte[] buffer = new byte[4096]; - int n = 0; - while (-1 != (n = stream.read(buffer))) { - output.write(buffer, 0, n); - } - byte[] bytes = output.toByteArray(); - out.write(bytes); - out.flush(); - } - } - - - @ApiOperation(value = "下载文件到本地", notes = "下载文件到本地") - @GetMapping("/download/{fileName}") - public ResponseEntity download(@PathVariable("fileName") String objectName, - @RequestParam(value = "bucketName") String bucketName) throws Exception { - ResponseEntity responseEntity = null; - InputStream stream = null; - ByteArrayOutputStream output = null; - try { - stream = fileService.getObject(bucketName, objectName); - if (stream == null) { - throw new MinioFileException(MinioFileType.FAILED_DOWNLOAD_FILE, ""); - } - //用于转换byte - output = new ByteArrayOutputStream(); - byte[] buffer = new byte[4096]; - int n = 0; - while (-1 != (n = stream.read(buffer))) { - output.write(buffer, 0, n); - } - byte[] bytes = output.toByteArray(); - - //设置header - HttpHeaders httpHeaders = new HttpHeaders(); - httpHeaders.add("Accept-Ranges", "bytes"); - httpHeaders.add("Content-Length", bytes.length + ""); - objectName = new String(objectName.getBytes(StandardCharsets.UTF_8), "ISO8859-1"); - //把文件名按UTF-8取出并按ISO8859-1编码,保证弹出窗口中的文件名中文不乱码,中文不要太多,最多支持17个中文,因为header有150个字节限制。 - httpHeaders.add("Content-disposition", "attachment; filename=" + objectName); - httpHeaders.add("Content-Type", "text/plain;charset=utf-8"); - responseEntity = new ResponseEntity(bytes, httpHeaders, HttpStatus.CREATED); - } finally { - if (stream != null) { - stream.close(); - } - if (output != null) { - output.close(); - } - } - return responseEntity; - } -} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/FileService.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/FileService.java deleted file mode 100644 index 05b1ef7d..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/FileService.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.springboot.cloud.file.service; - -import org.springframework.web.multipart.MultipartFile; - -import java.io.InputStream; - -/** - * @author fengdan - */ -public interface FileService { - - /** - * 上传文件 - * - * @param file 文件 - * @param bucketName 存储空间(桶) - * @return file url - */ - String uploadFile(MultipartFile file, String bucketName); - - /** - * 删除文件 - * - * @param bucketName 存储空间(桶) - * @param objectName 文件名 - */ - void removeFile(String bucketName, String objectName); - - /** - * 获取文件 - * - * @param bucketName 存储空间(桶) - * @param objectName 文件名 - * @return 进制流 - */ - InputStream getObject(String bucketName, String objectName); -} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/MinIoFileServiceImpl.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/MinIoFileServiceImpl.java deleted file mode 100644 index 22af14c2..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/service/MinIoFileServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.springboot.cloud.file.service; - -import com.springboot.cloud.file.exception.MinioFileException; -import com.springboot.cloud.file.exception.MinioFileType; -import com.springboot.cloud.file.util.MinioFileUtil; -import io.minio.errors.ErrorResponseException; -import io.minio.errors.InsufficientDataException; -import io.minio.errors.InternalException; -import io.minio.errors.InvalidResponseException; -import io.minio.errors.ServerException; -import io.minio.errors.XmlParserException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; - -import java.io.IOException; -import java.io.InputStream; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; - -/** - * @author fengdan - */ -@Slf4j -@Service("minioServiceImpl") -@RequiredArgsConstructor -public class MinIoFileServiceImpl implements FileService { - - private final MinioFileUtil minioFileUtil; - - @Override - public String uploadFile(MultipartFile file, String bucketName) { - try { - return this.minioFileUtil.uploadFile(file, bucketName); - } catch (IOException | ServerException | InsufficientDataException | ErrorResponseException | NoSuchAlgorithmException | InvalidKeyException | InvalidResponseException | XmlParserException | InternalException e) { - log.error("文件上传失败:" + e.getMessage(), e); - throw new MinioFileException(); - } - } - - - @Override - public void removeFile(String bucketName, String objectName) { - try { - this.minioFileUtil.removeFile(bucketName, objectName); - } catch (ServerException | InsufficientDataException | ErrorResponseException | IOException | NoSuchAlgorithmException | InvalidKeyException | InvalidResponseException | XmlParserException | InternalException e) { - log.error("文件删除失败:" + e.getMessage(), e); - throw new MinioFileException(MinioFileType.FILE_REMOVE_FAILED, "文件删除失败"); - } - } - - @Override - public InputStream getObject(String salt, String objectName) { - try { - return this.minioFileUtil.getObject(salt, objectName); - } catch (Exception e) { - log.error("获取文件失败:" + e.getMessage(), e); - throw new MinioFileException(MinioFileType.FILE_GET_FAILED, e.getMessage()); - } - } -} diff --git a/object-storage/file-service/src/main/java/com/springboot/cloud/file/util/MinioFileUtil.java b/object-storage/file-service/src/main/java/com/springboot/cloud/file/util/MinioFileUtil.java deleted file mode 100644 index 56151113..00000000 --- a/object-storage/file-service/src/main/java/com/springboot/cloud/file/util/MinioFileUtil.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.springboot.cloud.file.util; - -import com.springboot.cloud.file.configure.MinioProperties; -import io.minio.BucketExistsArgs; -import io.minio.GetObjectArgs; -import io.minio.MakeBucketArgs; -import io.minio.MinioClient; -import io.minio.PutObjectArgs; -import io.minio.RemoveObjectArgs; -import io.minio.errors.ErrorResponseException; -import io.minio.errors.InsufficientDataException; -import io.minio.errors.InternalException; -import io.minio.errors.InvalidResponseException; -import io.minio.errors.ServerException; -import io.minio.errors.XmlParserException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import org.springframework.web.multipart.MultipartFile; - -import java.io.IOException; -import java.io.InputStream; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Random; - -/** - * @author fengdan - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class MinioFileUtil { - - private final MinioProperties minioProperties; - - private final MinioClient client; - - /** - * 创建bucket - * - * @param bucketName 存储空间(桶) - */ - public void createBucket(String bucketName) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException { - BucketExistsArgs build = BucketExistsArgs.builder().bucket(bucketName).build(); - //判断 bucketName 是否存在 - if (!client.bucketExists(build)) { - client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build()); - } - } - - /** - * 上传文件 - * - * @param file 文件 - * @param bucketName 存储空间(桶) - * @return file url - */ - public String uploadFile(MultipartFile file, String bucketName) throws - IOException, ServerException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException { - //判断文件是否为空 - if (file == null || file.getSize() == 0) { - return null; - } - //判断存储桶是否存在,不存在则创建 - createBucket(bucketName); - //获取文件名 - String originalFilename = file.getOriginalFilename(); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); - assert originalFilename != null; - //文件重名处理,bucketName+时间戳+随机数 - String fileName = bucketName + "_" + - System.currentTimeMillis() + "_" + format.format(new Date()) + "_" + new Random().nextInt(1000) + - originalFilename.substring(originalFilename.lastIndexOf(".")); - //上传 - client.putObject(PutObjectArgs.builder() - .bucket(bucketName) - .object(fileName) - .stream(file.getInputStream(), file.getSize(), -1) - .contentType(file.getContentType()) - .build()); - return minioProperties.getEndpoint() + "/" + bucketName + "/" + fileName; - } - - /** - * 删除文件 - * - * @param bucketName 存储空间(桶) - * @param objectName ⽂件名称 - */ - public void removeFile(String bucketName, String objectName) throws - ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException { - client.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); - } - - /** - * 获取⽂件 - * - * @param bucketName bucket名称 - * @param objectName ⽂件名称 - * @return ⼆进制流 - */ - public InputStream getObject(String bucketName, String objectName) throws Exception { - return client.getObject(GetObjectArgs.builder().bucket(bucketName).object(objectName).build()); - } - - -} diff --git a/object-storage/file-service/src/main/resources/application.yml b/object-storage/file-service/src/main/resources/application.yml deleted file mode 100644 index 4571b914..00000000 --- a/object-storage/file-service/src/main/resources/application.yml +++ /dev/null @@ -1,37 +0,0 @@ -spring: - minio: - endpoint: http://localhost:9000 - accessKey: minioadmin - secretKey: minioadmin - rabbitmq: - host: ${RABBIT_MQ_HOST:localhost} - port: ${RABBIT_MQ_PORT:5672} - username: ${RABBIT_MQ_USERNAME:guest} - password: ${RABBIT_MQ_PASSWORD:guest} - redis: - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - lettuce: - pool: - max-active: 300 - #password: ${REDIS_PASSWORD:123456} - mvc: - throw-exception-if-no-handler-found: true - servlet: - multipart: - max-request-size: "2MB" - max-file-size: "2MB" - jackson: - time-zone: GMT+8 -logging: - level: - com.springboot.cloud.file: debug - path: logs/${spring.application.name} - file: - max-size: 1GB - -management: - endpoints: - web: - exposure: - include: '*' diff --git a/object-storage/file-service/src/main/resources/bootstrap.yml b/object-storage/file-service/src/main/resources/bootstrap.yml deleted file mode 100644 index 39779854..00000000 --- a/object-storage/file-service/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,12 +0,0 @@ -server: - port: ${SERVER_PORT:8011} -spring: - application: - name: file-service - cloud: - nacos: - discovery: - server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848} - config: - server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848} - file-extension: yml diff --git a/object-storage/file-service/src/test/java/com/springboot/cloud/file/FileServiceApplicationTests.java b/object-storage/file-service/src/test/java/com/springboot/cloud/file/FileServiceApplicationTests.java deleted file mode 100644 index 549ae2cf..00000000 --- a/object-storage/file-service/src/test/java/com/springboot/cloud/file/FileServiceApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -//package com.springboot.cloud.file; -// -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.springframework.boot.test.context.SpringBootTest; -//import org.springframework.test.context.junit4.SpringRunner; -// -//@SpringBootTest -//@RunWith(SpringRunner.class) -//class FileServiceApplicationTests { -// -// @Test -// void contextLoads() { -// } -// -//} diff --git a/object-storage/pom.xml b/object-storage/pom.xml deleted file mode 100644 index 86a52111..00000000 --- a/object-storage/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - 4.0.0 - - object-storage - 0.0.1-SNAPSHOT - pom - - object-storage - Object Storage project for Spring Boot - - - cloud - com.springboot.cloud - 0.0.1-SNAPSHOT - - - - file-service - - diff --git a/sysadmin/db/db.sql b/sysadmin/db/db.sql deleted file mode 100644 index 690fe934..00000000 --- a/sysadmin/db/db.sql +++ /dev/null @@ -1,396 +0,0 @@ -SET NAMES utf8; - -DROP DATABASE IF EXISTS sc_admin; -CREATE DATABASE sc_admin DEFAULT CHARSET utf8mb4; -USE sc_admin; - --- 用户组表 -DROP TABLE IF EXISTS t_groups; -CREATE TABLE t_groups -( - id VARCHAR(20) PRIMARY KEY COMMENT 'id', - parent_id VARCHAR(20) NOT NULL COMMENT '用户组父id', - name VARCHAR(200) COMMENT '用户组名称', - description VARCHAR(500) COMMENT '描述', - deleted VARCHAR(1) NOT NULL DEFAULT 'N' COMMENT '是否已删除Y:已删除,N:未删除', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '用户组表'; - --- 岗位表 -DROP TABLE IF EXISTS position; -CREATE TABLE position -( - id VARCHAR(20) PRIMARY KEY COMMENT 'id', - name VARCHAR(200) COMMENT '岗位名称', - description VARCHAR(500) COMMENT '描述', - deleted VARCHAR(1) NOT NULL DEFAULT 'N' COMMENT '是否已删除Y:已删除,N:未删除', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '岗位表'; - --- 菜单表 -DROP TABLE IF EXISTS menu; -CREATE TABLE menu -( - id VARCHAR(20) PRIMARY KEY COMMENT 'id', - parent_id VARCHAR(20) NOT NULL COMMENT '父菜单id', - type VARCHAR(100) COMMENT '菜单类型', - href VARCHAR(200) COMMENT '菜单路径', - icon VARCHAR(200) COMMENT '菜单图标', - name VARCHAR(200) COMMENT '菜单名称', - description VARCHAR(500) COMMENT '描述', - order_num INTEGER COMMENT '创建时间', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '菜单表'; - - --- 用户和组关系表 -DROP TABLE IF EXISTS user_group_relation; -CREATE TABLE user_group_relation -( - id VARCHAR(20) PRIMARY KEY COMMENT 'id', - user_id VARCHAR(20) NOT NULL COMMENT '用户id', - group_id VARCHAR(20) NOT NULL COMMENT '用户组id', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '用户和组关系表'; - - --- 用户和岗位系表 -DROP TABLE IF EXISTS user_position_relation; -CREATE TABLE user_position_relation -( - id VARCHAR(20) PRIMARY KEY COMMENT 'id', - user_id VARCHAR(20) NOT NULL COMMENT '用户id', - position_id VARCHAR(20) NOT NULL COMMENT '角色id', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '用户和岗位关系表'; - - --- 角色和菜单关系表 -DROP TABLE IF EXISTS role_menu_relation; -CREATE TABLE role_menu_relation -( - id VARCHAR(20) PRIMARY KEY COMMENT 'id', - menu_id VARCHAR(20) NOT NULL COMMENT '菜单id', - role_id VARCHAR(20) NOT NULL COMMENT '角色id', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '角色和菜单关系表'; - --- 用户表 -DROP TABLE IF EXISTS users; -CREATE TABLE users -( - id VARCHAR(20) PRIMARY KEY COMMENT '用户id', - username VARCHAR(100) NOT NULL COMMENT '用户名', - password VARCHAR(100) NOT NULL COMMENT '用户密码密文', - name VARCHAR(200) COMMENT '用户姓名', - mobile VARCHAR(20) COMMENT '用户手机', - description VARCHAR(500) COMMENT '简介', - deleted VARCHAR(1) NOT NULL DEFAULT 'N' COMMENT '是否已删除Y:已删除,N:未删除', - enabled BOOLEAN COMMENT '是否有效用户', - account_non_expired BOOLEAN COMMENT '账号是否未过期', - credentials_non_expired BOOLEAN COMMENT '密码是否未过期', - account_non_locked BOOLEAN COMMENT '是否未锁定', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '用户表'; -CREATE UNIQUE INDEX ux_users_username - ON users (username); -CREATE UNIQUE INDEX ux_users_mobile - ON users (mobile); - --- 角色表 -DROP TABLE IF EXISTS roles; -CREATE TABLE roles -( - id VARCHAR(20) PRIMARY KEY COMMENT '角色id', - code VARCHAR(100) NOT NULL COMMENT '角色code', - name VARCHAR(200) COMMENT '角色名称', - description VARCHAR(500) COMMENT '简介', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '角色表'; - --- 资源表 -DROP TABLE IF EXISTS resource; -CREATE TABLE resource -( - id VARCHAR(20) PRIMARY KEY COMMENT '资源id', - code VARCHAR(100) NOT NULL COMMENT '资源code', - type VARCHAR(100) NOT NULL COMMENT '资源类型', - name VARCHAR(200) NOT NULL COMMENT '资源名称', - url VARCHAR(200) NOT NULL COMMENT '资源url', - method VARCHAR(20) NOT NULL COMMENT '资源方法', - description VARCHAR(500) COMMENT '简介', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '资源表'; -CREATE UNIQUE INDEX ux_resource_code - ON resource (code); - --- 用户和角色关系表 -DROP TABLE IF EXISTS user_role_relation; -CREATE TABLE user_role_relation -( - id VARCHAR(20) PRIMARY KEY COMMENT '关系id', - user_id VARCHAR(20) NOT NULL COMMENT '用户id', - role_id VARCHAR(20) NOT NULL COMMENT '角色id', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '用户和角色关系表'; - --- 角色和资源关系表 -DROP TABLE IF EXISTS role_resource_relation; -CREATE TABLE role_resource_relation -( - id VARCHAR(20) PRIMARY KEY COMMENT '关系id', - resource_id VARCHAR(20) NOT NULL COMMENT '角色id', - role_id VARCHAR(20) NOT NULL COMMENT '资源id', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '角色和资源关系表'; - --- DML准备初始化数据 - --- 用户 -INSERT INTO users (id, username, password, deleted, enabled, account_non_expired, credentials_non_expired, - account_non_locked, name, mobile, created_time, updated_time, created_by, updated_by) -VALUES (101, 'admin', '$2a$10$vYA9wKn/hVGOtwQw2eHiceeIGNBdfLYpDmbzHgBSVmOfHXPH4iYdS', 'N', true, true, true, true, - '超级管理员', '', now(), now(), 'system', 'system'), - (102, 'zhoutaoo', '$2a$10$vYA9wKn/hVGOtwQw2eHiceeIGNBdfLYpDmbzHgBSVmOfHXPH4iYdS', 'N', true, true, true, true, - '周涛', 15619841000, now(), now(), 'system', 'system'); --- 角色 -INSERT INTO roles (id, code, name, description, created_time, updated_time, created_by, updated_by) -VALUES (101, 'ADMIN', '超级管理员', '公司IT总负责人', now(), now(), 'system', 'system'), - (102, 'FIN', '财务', '财务', now(), now(), 'system', 'system'), - (103, 'IT', 'IT', 'IT角色', now(), now(), 'system', 'system'); --- 资源 -INSERT INTO resource (id, name, code, type, url, method, description, created_time, updated_time, created_by, - updated_by) -VALUES (101, '新增用户', 'user_manager:btn_add', 'user', '/user', 'POST', '新增用户功能', now(), now(), 'system', 'system'), - (102, '编辑用户', 'user_manager:btn_edit', 'user', '/user/{id}', 'PUT', '编辑用户功能', now(), now(), 'system', 'system'), - (103, '删除用户', 'user_manager:btn_del', 'user', '/user/{id}', 'DELETE', '根据用户id删除用户', now(), now(), 'system', - 'system'), - (104, '查看用户', 'user_manager:view', 'user', '/user/{id}', 'GET', '根据用户id获取用户', now(), now(), 'system', 'system'), - (105, '搜索用户', 'user_manager:query', 'user', '/user/conditions', 'POST', '根据条件查询用户', now(), now(), 'system', - 'system'), - (106, '获取用户', 'user_manager:get', 'user', '/user', 'GET', '根据唯一标识获取用户', now(), now(), 'system', 'system'), - (201, '新增角色', 'role_manager:btn_add', 'role', '/role', 'POST', '新增角色功能', now(), now(), 'system', 'system'), - (202, '编辑角色', 'role_manager:btn_edit', 'role', '/role/{id}', 'PUT', '编辑角色功能', now(), now(), 'system', 'system'), - (203, '删除角色', 'role_manager:btn_del', 'role', '/role/{id}', 'DELETE', '根据id删除角色', now(), now(), 'system', - 'system'), - (204, '查看角色', 'role_manager:view', 'role', '/role/{id}', 'GET', '根据id获取角色', now(), now(), 'system', 'system'), - (205, '根据用户id查询角色', 'role_manager:user', 'role', '/role/user/{userId}', 'GET', '根据用户id获取用户所拥有的角色集', now(), now(), - 'system', 'system'), - (206, '获取所有角色', 'role_manager:all', 'role', '/role/all', 'GET', '获取所有角色', now(), now(), 'system', 'system'), - (207, '搜索角色', 'role_manager:query', 'role', '/role/conditions', 'POST', '根据条件查询角色', now(), now(), 'system', - 'system'), - (301, '根据父id查询组', 'group_manager:parent', 'group', '/group/parent/{id}', 'GET', '根据父id查询用户组', now(), now(), - 'system', 'system'), - (302, '查看用户组', 'group_manager:get', 'group', '/group/{id}', 'GET', '根据id查询用户组', now(), now(), 'system', - 'system'), - (303, '搜索用户组', 'group_manager:query', 'group', '/group/conditions', 'POST', '根据条件查询用户组信息', now(), now(), - 'system', 'system'), - (304, '删除用户组', 'group_manager:del', 'group', '/group/{id}', 'DELETE', '根据用户id删除用户组', now(), now(), 'system', - 'system'), - (305, '编辑用户组', 'group_manager:edit', 'group', '/group/{id}', 'PUT', '修改用户组', now(), now(), 'system', 'system'), - (306, '新增用户组', 'group_manager:add', 'group', '/group', 'POST', '新增用户组', now(), now(), 'system', 'system'), - (307, '新增网关路由', 'gateway_manager:add', 'gateway', '/gateway/routes', 'POST', '新增网关路由', now(), now(), 'system', - 'system'), - (308, '修改网关路由', 'gateway_manager:edit', 'gateway', '/gateway/routes/{id}', 'PUT', '修改网关路由', now(), now(), - 'system', 'system'), - (309, '删除网关路由', 'gateway_manager:adel', 'gateway', '/gateway/routes/{id}', 'DELETE', '删除网关路由', now(), now(), - 'system', 'system'), - (310, '查看网关路由', 'gateway_manager:view', 'gateway', '/gateway/routes/{id}', 'GET', '查看网关路由', now(), now(), - 'system', 'system'), - (311, '搜索网关路由', 'gateway_manager:query', 'gateway', '/gateway/routes/conditions', 'POST', '搜索网关路由', now(), now(), - 'system', 'system'), - (312, '全局加载路由', 'gateway_manager:overload', 'gateway', '/gateway/routes/overload', 'POST', '全局加载路由', now(), - now(), 'system', 'system'), - (313, '新增网关路由', 'resource_manager:add', 'resource', '/resource', 'POST', '新增资源路由', now(), now(), 'system', - 'system'), - (314, '修改网关路由', 'resource_manager:edit', 'resource', '/resource/{id}', 'PUT', '修改资源', now(), now(), 'system', - 'system'), - (315, '删除网关路由', 'resource_manager:adel', 'resource', '/resource/{id}', 'DELETE', '删除资源', now(), now(), 'system', - 'system'), - (316, '查看网关路由', 'resource_manager:view', 'resource', '/resource/{id}', 'GET', '查看资源', now(), now(), 'system', - 'system'), - (317, '搜索网关路由', 'resource_manager:query', 'resource', '/resource/conditions', 'POST', '搜索资源', now(), now(), - 'system', 'system'), - (318, '全局加载路由', 'resource_manager:all', 'resource', '/resource/all', 'GET', '查询全部资源', now(), now(), 'system', - 'system'); - --- 用户关系授权 -INSERT INTO user_role_relation (id, user_id, role_id, created_time, updated_time, created_by, updated_by) -VALUES (101, 101, 101, now(), now(), 'system', 'system'), - (102, 102, 101, now(), now(), 'system', 'system'), - (103, 102, 103, now(), now(), 'system', 'system'); --- 角色与资源关系表 -INSERT INTO role_resource_relation (id, role_id, resource_id, created_time, updated_time, created_by, updated_by) -VALUES (101, 101, 101, now(), now(), 'system', 'system'), - (102, 101, 102, now(), now(), 'system', 'system'), - (103, 101, 103, now(), now(), 'system', 'system'), - (104, 101, 104, now(), now(), 'system', 'system'), - (105, 101, 105, now(), now(), 'system', 'system'), - (106, 101, 106, now(), now(), 'system', 'system'), - (201, 101, 201, now(), now(), 'system', 'system'), - (202, 101, 202, now(), now(), 'system', 'system'), - (203, 101, 203, now(), now(), 'system', 'system'), - (204, 101, 204, now(), now(), 'system', 'system'), - (205, 101, 205, now(), now(), 'system', 'system'), - (206, 101, 206, now(), now(), 'system', 'system'), - (207, 101, 207, now(), now(), 'system', 'system'), - (208, 101, 301, now(), now(), 'system', 'system'), - (209, 101, 302, now(), now(), 'system', 'system'), - (210, 101, 303, now(), now(), 'system', 'system'), - (211, 101, 304, now(), now(), 'system', 'system'), - (212, 101, 305, now(), now(), 'system', 'system'), - (213, 101, 306, now(), now(), 'system', 'system'), - (401, 101, 307, now(), now(), 'system', 'system'), - (402, 101, 308, now(), now(), 'system', 'system'), - (403, 101, 309, now(), now(), 'system', 'system'), - (404, 101, 310, now(), now(), 'system', 'system'), - (405, 101, 311, now(), now(), 'system', 'system'), - (406, 101, 312, now(), now(), 'system', 'system'), - (501, 101, 313, now(), now(), 'system', 'system'), - (502, 101, 314, now(), now(), 'system', 'system'), - (503, 101, 315, now(), now(), 'system', 'system'), - (504, 101, 316, now(), now(), 'system', 'system'), - (505, 101, 317, now(), now(), 'system', 'system'), - (506, 101, 318, now(), now(), 'system', 'system'); - --- 岗位 -INSERT INTO position (id, name, description, created_time, updated_time, created_by, updated_by) -VALUES (101, '首席执行官', '公司CEO,负责公司整体运转', now(), now(), 'system', 'system'), - (102, '首席运营官', '公司COO,负责公司整体运营', now(), now(), 'system', 'system'), - (103, '首席技术官', '公司CTO,负责公司整体运营', now(), now(), 'system', 'system'); --- 用户组 -INSERT INTO t_groups (id, parent_id, name, description, created_time, updated_time, created_by, updated_by) -VALUES (101, -1, '总公司', '总公司', now(), now(), 'system', 'system'), - (102, 101, '上海分公司', '上海分公司', now(), now(), 'system', 'system'), - (103, 102, '研发部门', '负责产品研发', now(), now(), 'system', 'system'), - (104, 102, '产品部门', '负责产品设计', now(), now(), 'system', 'system'), - (105, 102, '运营部门', '负责公司产品运营', now(), now(), 'system', 'system'), - (106, 102, '销售部门', '负责公司产品销售', now(), now(), 'system', 'system'), - (107, 101, '北京分公司', '北京分公司', now(), now(), 'system', 'system'); --- 菜单 -INSERT INTO menu (id, parent_id, type, href, icon, name, description, order_num, created_time, updated_time, created_by, - updated_by) -VALUES (101, -1, 'MENU', '/admin', 'setting', '系统管理', '系统设置管理', 0, now(), now(), 'system', 'system'), - (102, 101, 'MENU', '/admin/users', 'fa-user', '用户管理', '用户新增,修改,查看,删除', 10, now(), now(), 'system', 'system'), - (103, 101, 'MENU', '/admin/menus', 'category', '菜单管理', '菜单新增,修改,删除', 20, now(), now(), 'system', 'system'); - -INSERT INTO user_group_relation (id, user_id, group_id, created_time, updated_time, created_by, updated_by) -VALUES (101, 101, 101, now(), now(), 'system', 'system'), - (102, 102, 101, now(), now(), 'system', 'system'); -INSERT INTO user_position_relation (id, user_id, position_id, created_time, updated_time, created_by, updated_by) -VALUES (101, 101, 103, now(), now(), 'system', 'system'), - (102, 102, 103, now(), now(), 'system', 'system'); --- 角色关系表 -INSERT INTO role_menu_relation (id, role_id, menu_id, created_time, updated_time, created_by, updated_by) -VALUES (101, 101, 101, now(), now(), 'system', 'system'), - (102, 101, 102, now(), now(), 'system', 'system'), - (103, 101, 103, now(), now(), 'system', 'system'), - (104, 102, 101, now(), now(), 'system', 'system'), - (105, 102, 102, now(), now(), 'system', 'system'), - (106, 103, 101, now(), now(), 'system', 'system'), - (107, 103, 102, now(), now(), 'system', 'system'), - (108, 103, 103, now(), now(), 'system', 'system'); - - --- 数据权限表 -DROP TABLE IF EXISTS permission; -CREATE TABLE permission -( - id VARCHAR(20) PRIMARY KEY COMMENT '关系id', - res_type VARCHAR(20) NOT NULL COMMENT '资源类型(hive,hdfs)', - area VARCHAR(20) NOT NULL COMMENT '资源地区', - res_full_path VARCHAR(500) NOT NULL COMMENT '资源全路径', - res_full_name VARCHAR(500) NOT NULL COMMENT '资源全路径(中)', - operation_bit VARCHAR(20) NOT NULL COMMENT '权限操作位(read,write...)', - expire_date DATETIME NOT NULL COMMENT '权限过期时间', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人', - deleted VARCHAR(1) NOT NULL DEFAULT 'N' COMMENT '是否已删除Y:已删除,N:未删除' -) COMMENT '角色和资源关系表'; - - --- 组和数据权限关系表 -DROP TABLE IF EXISTS group_permission_relation; -CREATE TABLE group_permission_relation -( - id VARCHAR(20) PRIMARY KEY COMMENT '关系id', - group_id VARCHAR(20) NOT NULL COMMENT '用户id', - permission_id VARCHAR(20) NOT NULL COMMENT '用户组id', - created_time DATETIME NOT NULL DEFAULT now() COMMENT '创建时间', - updated_time DATETIME NOT NULL DEFAULT now() COMMENT '更新时间', - created_by VARCHAR(100) NOT NULL COMMENT '创建人', - updated_by VARCHAR(100) NOT NULL COMMENT '更新人' -) COMMENT '角色和资源关系表'; --- 组和权限的关系 -INSERT INTO group_permission_relation (id, group_id, permission_id, created_time, updated_time, created_by, updated_by) -VALUES (1, 101, 101, now(), now(), 'system', 'system'), - (2, 101, 102, now(), now(), 'system', 'system'), - (3, 101, 103, now(), now(), 'system', 'system'), - (4, 102, 101, now(), now(), 'system', 'system'), - (5, 102, 102, now(), now(), 'system', 'system'), - (6, 103, 101, now(), now(), 'system', 'system'), - (7, 103, 102, now(), now(), 'system', 'system'), - (8, 103, 103, now(), now(), 'system', 'system'); - -INSERT INTO permission (id, res_type, area, res_full_path, res_full_name, operation_bit, expire_date, created_time, - updated_time, created_by, updated_by) -VALUES (101, 'hive', 'china', '/test.db/test', '/测试库/测试表', 'select', '2099-12-26 10:45:26', now(), now(), - 'system', 'system'), - (102, 'hive', 'china', '/test.db/test1', '/测试库/测试表1', 'select', '2099-12-26 10:45:26', now(), now(), - 'system', 'system'), - (103, 'hive', 'china', '/test.db', '/测试库', 'select', '2099-12-26 10:45:26', now(), now(), - 'system', 'system'); - - - -INSERT INTO sc_admin.resource (id, code, type, name, url, method, description, created_time, updated_time, created_by, - updated_by) -VALUES ('401', 'permission:auth', 'permission', '数据权限验证', '/auth/data/permission', 'POST', '验证数据权限', DEFAULT, DEFAULT, - 'system', 'system'); - - -INSERT INTO sc_admin.role_resource_relation (id, resource_id, role_id, created_time, updated_time, created_by, - updated_by) -VALUES ('601', '401', '101', DEFAULT, DEFAULT, 'system', 'system'); - - - - - - - diff --git a/sysadmin/organization/pom.xml b/sysadmin/organization/pom.xml deleted file mode 100644 index 66ac248b..00000000 --- a/sysadmin/organization/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - 4.0.0 - - organization - 0.0.1-SNAPSHOT - jar - - organization - Demo Organization project for Spring Boot - - - sysadmin - com.springboot.cloud - 0.0.1-SNAPSHOT - - - - - com.alicp.jetcache - jetcache-starter-redis - 2.5.14 - - - com.springboot.cloud - facade - 0.0.1-SNAPSHOT - - - - - - - - com.spotify - docker-maven-plugin - 1.2.0 - - - cike/${project.artifactId} - ${project.basedir}/src/main/docker - true - - - / - ${project.build.directory} - ${project.build.finalName}.jar - - - - - - - \ No newline at end of file diff --git a/sysadmin/organization/src/main/docker/Dockerfile b/sysadmin/organization/src/main/docker/Dockerfile deleted file mode 100644 index d8371cc7..00000000 --- a/sysadmin/organization/src/main/docker/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM java:alpine -VOLUME /tmp -ADD organization-0.0.1-SNAPSHOT.jar app.jar -ENTRYPOINT ["java","-jar","/app.jar"] diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/OrganizationApplication.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/OrganizationApplication.java deleted file mode 100644 index 524dcf9d..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/OrganizationApplication.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.springboot.cloud.sysadmin.organization; - -import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; -import com.alicp.jetcache.anno.config.EnableMethodCache; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableCircuitBreaker -@EnableMethodCache(basePackages = "com.springboot.cloud") -@EnableCreateCacheAnnotation -public class OrganizationApplication { - public static void main(String[] args) { - SpringApplication.run(OrganizationApplication.class, args); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java deleted file mode 100644 index 325acc1b..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/BusConfig.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.config; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.extern.slf4j.Slf4j; -import org.springframework.amqp.core.Binding; -import org.springframework.amqp.core.BindingBuilder; -import org.springframework.amqp.core.Queue; -import org.springframework.amqp.core.TopicExchange; -import org.springframework.amqp.support.converter.ContentTypeDelegatingMessageConverter; -import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; -import org.springframework.amqp.support.converter.MessageConverter; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -@Slf4j -public class BusConfig { - @Value("${spring.application.name}") - private String appName; - - public static final String QUEUE_NAME = "event-organization"; - public static final String EXCHANGE_NAME = "spring-boot-exchange"; - public static final String RESOURCE_ROUTING_KEY = "organization-resource"; - public static final String PERMISSION_ROUTING_KEY = "organization-permission"; - private static final String PERMISSION_QUEUE_SUFFIX = "permission"; - - @Bean - Queue queue() { - log.info("queue name:{}", QUEUE_NAME); - return new Queue(QUEUE_NAME, false); - } -// -// @Bean -// Queue permissionQueue() { -// String queueName = new Base64UrlNamingStrategy(appName + ".").generateName() + PERMISSION_QUEUE_SUFFIX; -// log.info("permission queue name:{}", queueName); -// return new Queue(queueName, false); -// } -// -// /** -// * 绑定权限更新的队列 -// * -// * @param queue 队列 -// * @param exchange 交换机 -// * @return {@link Binding} -// */ -// @Bean -// Binding permissionBinding(@Qualifier("permissionQueue") Queue queue, TopicExchange exchange) { -// log.info("binding {} to {} with {}", queue, exchange, PERMISSION_ROUTING_KEY); -// return BindingBuilder.bind(queue).to(exchange).with(PERMISSION_ROUTING_KEY); -// } -// -// -// //////////////////// -// //////////////////// 权限更新相关配置 -// //////////////////// -// @Bean -// SimpleMessageListenerContainer permissionMessageListenerContainer(ConnectionFactory connectionFactory, @Qualifier("permissionMessageListenerAdapter") MessageListenerAdapter messageListenerAdapter, @Qualifier("permissionQueue") Queue queue) { -// log.info("init permissionMessageListenerContainer {}", queue.getName()); -// SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory); -// container.setQueueNames(queue.getName()); -// container.setMessageListener(messageListenerAdapter); -// return container; -// } -// -// @Bean -// MessageListenerAdapter permissionMessageListenerAdapter(PermissionBusReceiver permissionBusReceiver, @Qualifier("permissionMessageConverter") MessageConverter messageConverter) { -// log.info("new listener"); -// return new MessageListenerAdapter(permissionBusReceiver, messageConverter); -// } -// -// @Bean -// public MessageConverter permissionMessageConverter() { -// ObjectMapper objectMapper = new ObjectMapper(); -// objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); -// return new ContentTypeDelegatingMessageConverter(new Jackson2JsonMessageConverter(objectMapper)); -// } - - @Bean - TopicExchange exchange() { - log.info("exchange:{}", EXCHANGE_NAME); - return new TopicExchange(EXCHANGE_NAME); - } - - @Bean - Binding binding(Queue queue, TopicExchange exchange) { - log.info("binding {} to {} with {}", queue, exchange, RESOURCE_ROUTING_KEY); - return BindingBuilder.bind(queue).to(exchange).with(RESOURCE_ROUTING_KEY); - } - - @Bean - public MessageConverter messageConverter() { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); - return new ContentTypeDelegatingMessageConverter(new Jackson2JsonMessageConverter(objectMapper)); - } - -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MyMetaObjectHandler.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MyMetaObjectHandler.java deleted file mode 100644 index 83b26193..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MyMetaObjectHandler.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.config; - -import com.springboot.cloud.common.web.handler.PoMetaObjectHandler; -import org.springframework.stereotype.Component; - -@Component -public class MyMetaObjectHandler extends PoMetaObjectHandler { - -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MyRedisConfig.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MyRedisConfig.java deleted file mode 100644 index 97f25298..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MyRedisConfig.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.config; - -import com.springboot.cloud.common.web.redis.RedisConfig; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.Configuration; - -@Configuration -@EnableCaching -public class MyRedisConfig extends RedisConfig { - -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MybatisConfig.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MybatisConfig.java deleted file mode 100644 index ce05428c..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/MybatisConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.config; - -import com.baomidou.mybatisplus.core.injector.ISqlInjector; -import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector; -import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.annotation.EnableTransactionManagement; - - -@EnableTransactionManagement -@Configuration -public class MybatisConfig { - /** - * 初使化Mybatis审计字段自动赋值的interceptor - */ - @Bean - public ISqlInjector sqlInjector() { - return new LogicSqlInjector(); - } - - /** - * 分页插件 - */ - @Bean - public PaginationInterceptor paginationInterceptor() { - return new PaginationInterceptor(); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/SwaggerConfig.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/SwaggerConfig.java deleted file mode 100644 index 20f19d48..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/SwaggerConfig.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.config; - -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.ApiInfo; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -@Configuration -@EnableSwagger2 -public class SwaggerConfig { - @Bean - public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.basePackage("com.springboot.cloud.sysadmin.organization")) - .paths(PathSelectors.any()) - .build(); - } - - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("系统管理API") - .description("系统管理,组织人员管理、角色权限管理、岗位管理") - .termsOfServiceUrl("https://github.com/zhoutaoo/SpringCloud") - .version("2.0") - .build(); - } - -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/WebServerMvcConfigurerAdapter.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/WebServerMvcConfigurerAdapter.java deleted file mode 100644 index acd71b5b..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/config/WebServerMvcConfigurerAdapter.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.config; - -import com.springboot.cloud.common.web.interceptor.UserInterceptor; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class WebServerMvcConfigurerAdapter implements WebMvcConfigurer { - - @Bean - public HandlerInterceptor userInterceptor() { - return new UserInterceptor(); - } - - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(userInterceptor()); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupMapper.java deleted file mode 100644 index 4c613edf..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.Group; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -@Repository -@Mapper -public interface GroupMapper extends BaseMapper { -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupPermissionMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupPermissionMapper.java deleted file mode 100644 index 9bd3719f..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/GroupPermissionMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.GroupPermission; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -/** - * 组权限映射器 - * - * @author wayne - * @date 2021/09/09 - */ -@Repository -@Mapper -public interface GroupPermissionMapper extends BaseMapper { -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/MenuMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/MenuMapper.java deleted file mode 100644 index 0d9f1a1b..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/MenuMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.Menu; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -@Repository -@Mapper -public interface MenuMapper extends BaseMapper { -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java deleted file mode 100644 index e29b078c..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PermissionMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.Permission; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -/** - * - * @author wayne - * @date 2021/09/09 - */ -@Repository -@Mapper -public interface PermissionMapper extends BaseMapper { -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PositionMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PositionMapper.java deleted file mode 100644 index 4a9afe2a..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/PositionMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.Position; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -@Repository -@Mapper -public interface PositionMapper extends BaseMapper { -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/ResourceMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/ResourceMapper.java deleted file mode 100644 index 1a43cf34..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/ResourceMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.Resource; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -@Repository -@Mapper -public interface ResourceMapper extends BaseMapper { -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/RoleMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/RoleMapper.java deleted file mode 100644 index 37378a2c..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/RoleMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.Role; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -@Repository -@Mapper -public interface RoleMapper extends BaseMapper { -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/RoleResourceMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/RoleResourceMapper.java deleted file mode 100644 index 3c8f3d5c..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/RoleResourceMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.RoleResource; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -@Repository -@Mapper -public interface RoleResourceMapper extends BaseMapper { -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserGroupMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserGroupMapper.java deleted file mode 100644 index 10fda2c8..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserGroupMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.UserGroup; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -/** - * 用户组映射器 - * - * @author wayne - * @date 2021/09/09 - */ -@Repository -@Mapper -public interface UserGroupMapper extends BaseMapper { -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserMapper.java deleted file mode 100644 index 9a330210..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.User; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -@Repository -@Mapper -public interface UserMapper extends BaseMapper { -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserRoleMapper.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserRoleMapper.java deleted file mode 100644 index d26170ce..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/dao/UserRoleMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.UserRole; -import org.apache.ibatis.annotations.Mapper; -import org.springframework.stereotype.Repository; - -@Repository -@Mapper -public interface UserRoleMapper extends BaseMapper { -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/GroupForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/GroupForm.java deleted file mode 100644 index 54cf714f..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/GroupForm.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseForm; -import com.springboot.cloud.sysadmin.organization.entity.po.Group; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -@ApiModel -@Data -public class GroupForm extends BaseForm { - - @NotBlank(message = "用户组父id不能为空") - @ApiModelProperty(value = "用户组父id") - private String parentId; - - @NotBlank(message = "用户组名称不能为空") - @ApiModelProperty(value = "用户组名称") - private String name; - - @ApiModelProperty(value = "用户组描述") - private String description; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/GroupQueryForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/GroupQueryForm.java deleted file mode 100644 index cf245a6a..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/GroupQueryForm.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.param.GroupQueryParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Past; -import java.util.Date; - -@ApiModel -@Data -public class GroupQueryForm extends BaseQueryForm { - - @NotBlank(message = "用户组名称不能为空") - @ApiModelProperty(value = "用户组名称", required = true) - private String name; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询开始时间必须小于当前日期") - @ApiModelProperty(value = "查询开始时间") - private Date createdTimeStart; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询结束时间必须小于当前日期") - @ApiModelProperty(value = "查询结束时间") - private Date createdTimeEnd; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/MenuForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/MenuForm.java deleted file mode 100644 index 30e9dfa3..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/MenuForm.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseForm; -import com.springboot.cloud.sysadmin.organization.entity.po.Menu; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -@ApiModel -@Data -public class MenuForm extends BaseForm { - - @NotBlank(message = "菜单父id不能为空") - @ApiModelProperty(value = "菜单父id") - private String parentId; - - @NotBlank(message = "菜单名称不能为空") - @ApiModelProperty(value = "菜单名称") - private String name; - - @NotBlank(message = "菜单类型不能为空") - @ApiModelProperty(value = "菜单类型") - private String type; - - @NotBlank(message = "菜单路径不能为空") - @ApiModelProperty(value = "菜单路径") - private String href; - - @ApiModelProperty(value = "菜单图标") - private String icon; - - @ApiModelProperty(value = "菜单序号") - private String orderNum; - - @ApiModelProperty(value = "菜单描述") - private String description; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/MenuQueryForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/MenuQueryForm.java deleted file mode 100644 index b93a99a6..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/MenuQueryForm.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.param.MenuQueryParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Past; -import java.util.Date; - -@ApiModel -@Data -public class MenuQueryForm extends BaseQueryForm { - - @NotBlank(message = "菜单名称不能为空") - @ApiModelProperty(value = "菜单名称", required = true) - private String name; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询开始时间必须小于当前日期") - @ApiModelProperty(value = "查询开始时间") - private Date createdTimeStart; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询结束时间必须小于当前日期") - @ApiModelProperty(value = "查询结束时间") - private Date createdTimeEnd; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PermissionForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PermissionForm.java deleted file mode 100644 index 804a54c8..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PermissionForm.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseForm; -import com.springboot.cloud.sysadmin.organization.entity.po.Permission; -import io.swagger.annotations.ApiModelProperty; - -import javax.validation.constraints.NotBlank; - -/** - * 数据权限DTO - * - * @author wayne - * @date 2021/09/06 - */ -public class PermissionForm extends BaseForm { - /** - * 资源类型:hive,hdfs - */ - @NotBlank(message = "资源类型不能为空") - @ApiModelProperty(value = "资源类型") - private String resType; - - /** - * 资源地区 - */ - @NotBlank(message = "资源地区不能为空") - @ApiModelProperty(value = "资源地区") - private String area; - - /** - * 资源完整路径 - */ - @NotBlank(message = "资源路径不能为空") - @ApiModelProperty(value = "资源路径") - private String resFullPath; - - /** - * 资源全名 - */ - @NotBlank(message = "资源名称不能为空") - @ApiModelProperty(value = "资源名称") - private String resFullName; - - /** - * 资源操作位:读,写,查询 - */ - @NotBlank(message = "资源操作位不能为空") - @ApiModelProperty(value = "资源操作位") - private String operationBit; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PositionForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PositionForm.java deleted file mode 100644 index 13d7f1f3..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PositionForm.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseForm; -import com.springboot.cloud.sysadmin.organization.entity.po.Position; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -@ApiModel -@Data -public class PositionForm extends BaseForm { - - @NotBlank(message = "职位名称不能为空") - @ApiModelProperty(value = "职位名称") - private String name; - - @ApiModelProperty(value = "职位描述") - private String description; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PositionQueryForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PositionQueryForm.java deleted file mode 100644 index 07a1a03e..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/PositionQueryForm.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.param.ResourceQueryParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Past; -import java.util.Date; - -@ApiModel -@Data -public class PositionQueryForm extends BaseQueryForm { - - @NotBlank(message = "资源名称不能为空") - @ApiModelProperty(value = "资源名称", required = true) - private String name; - - @NotBlank(message = "资源编码不能为空") - @ApiModelProperty(value = "资源编码") - private String code; - - @NotBlank(message = "资源类型不能为空") - @ApiModelProperty(value = "资源类型") - private String type; - - @NotBlank(message = "资源路径不能为空") - @ApiModelProperty(value = "资源路径") - private String url; - - @NotBlank(message = "资源方法不能为空") - @ApiModelProperty(value = "资源方法") - private String method; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询开始时间必须小于当前日期") - @ApiModelProperty(value = "查询开始时间") - private Date createdTimeStart; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询结束时间必须小于当前日期") - @ApiModelProperty(value = "查询结束时间") - private Date createdTimeEnd; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/ResourceForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/ResourceForm.java deleted file mode 100644 index 5b8b5d1b..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/ResourceForm.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseForm; -import com.springboot.cloud.sysadmin.organization.entity.po.Resource; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -@ApiModel -@Data -public class ResourceForm extends BaseForm { - - @NotBlank(message = "资源名称不能为空") - @ApiModelProperty(value = "资源名称") - private String name; - - @NotBlank(message = "资源编码不能为空") - @ApiModelProperty(value = "资源编码") - private String code; - - @NotBlank(message = "资源类型不能为空") - @ApiModelProperty(value = "资源类型") - private String type; - - @NotBlank(message = "资源路径不能为空") - @ApiModelProperty(value = "资源路径") - private String url; - - @NotBlank(message = "资源方法不能为空") - @ApiModelProperty(value = "资源方法") - private String method; - - @ApiModelProperty(value = "资源描述") - private String description; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/ResourceQueryForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/ResourceQueryForm.java deleted file mode 100644 index ee1c81cd..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/ResourceQueryForm.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.param.ResourceQueryParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.Past; -import java.util.Date; - -@ApiModel -@Data -public class ResourceQueryForm extends BaseQueryForm { - - @ApiModelProperty(value = "资源名称") - private String name; - - @ApiModelProperty(value = "资源编码") - private String code; - - @ApiModelProperty(value = "资源路径") - private String url; - - @ApiModelProperty(value = "资源方法") - private String method; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询开始时间必须小于当前日期") - @ApiModelProperty(value = "查询开始时间") - private Date createdTimeStart; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询结束时间必须小于当前日期") - @ApiModelProperty(value = "查询结束时间") - private Date createdTimeEnd; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleForm.java deleted file mode 100644 index b9291f60..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleForm.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseForm; -import com.springboot.cloud.sysadmin.organization.entity.po.Role; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.util.Set; - -@ApiModel -@Data -public class RoleForm extends BaseForm { - - @NotBlank(message = "角色编码不能为空") - @ApiModelProperty(value = "角色编码") - private String code; - - @NotBlank(message = "角色名称不能为空") - @ApiModelProperty(value = "角色名称") - private String name; - - @ApiModelProperty(value = "角色描述") - private String description; - - @ApiModelProperty(value = "角色拥有的资源id列表") - private Set resourceIds; - -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleQueryForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleQueryForm.java deleted file mode 100644 index b431f536..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleQueryForm.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.param.RoleQueryParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.Past; -import java.util.Date; - -@ApiModel -@Data -public class RoleQueryForm extends BaseQueryForm { - - @ApiModelProperty(value = "角色编码") - private String code; - - @ApiModelProperty(value = "角色名称") - private String name; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询开始时间必须小于当前日期") - @ApiModelProperty(value = "查询开始时间") - private Date createdTimeStart; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询结束时间必须小于当前日期") - @ApiModelProperty(value = "查询结束时间") - private Date createdTimeEnd; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleUpdateForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleUpdateForm.java deleted file mode 100644 index aac40554..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/RoleUpdateForm.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseForm; -import com.springboot.cloud.sysadmin.organization.entity.po.Role; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Set; - -@ApiModel -@Data -public class RoleUpdateForm extends BaseForm { - - @ApiModelProperty(value = "角色编码") - private String code; - - @ApiModelProperty(value = "角色名称") - private String name; - - @ApiModelProperty(value = "角色描述") - private String description; - - @ApiModelProperty(value = "角色拥有的资源id列表") - private Set resourceIds; - -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserForm.java deleted file mode 100644 index bb3c5c86..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserForm.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseForm; -import com.springboot.cloud.sysadmin.organization.entity.po.User; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotBlank; -import java.util.Set; - -@ApiModel -@Data -public class UserForm extends BaseForm { - - @ApiModelProperty(value = "用户账号") - @NotBlank(message = "用户名不能为空") - @Length(min = 3, max = 20, message = "用户名长度在3到20个字符") - private String username; - - @ApiModelProperty(value = "用户密码") - @NotBlank(message = "用户密码不能为空") - @Length(min = 5, max = 20, message = "密码长度在5到20个字符") - private String password; - - @ApiModelProperty(value = "用户手机号") - @NotBlank(message = "用户手机号不能为空") - private String mobile; - - @ApiModelProperty(value = "用户姓名") - @NotBlank(message = "用户姓名不能为空") - private String name; - - @ApiModelProperty(value = "用户描述") - private String description; - - @ApiModelProperty(value = "用户拥有的角色id列表") - private Set roleIds; - - @ApiModelProperty(value = "用户状态,true为可用") - private Boolean enabled = true; - - @ApiModelProperty(value = "用户账号是否过期,true为未过期") - private Boolean accountNonExpired = true; - - @ApiModelProperty(value = "用户密码是否过期,true为未过期") - private Boolean credentialsNonExpired = true; - - @ApiModelProperty(value = "用户账号是否被锁定,true为未锁定") - private Boolean accountNonLocked = true; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserQueryForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserQueryForm.java deleted file mode 100644 index 7452ecc1..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserQueryForm.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.param.UserQueryParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.Past; -import java.util.Date; - -@ApiModel -@Data -public class UserQueryForm extends BaseQueryForm { - - @ApiModelProperty(value = "用户名") - private String username; - - @ApiModelProperty(value = "用户姓名") - private String name; - - @ApiModelProperty(value = "手机号") - private String mobile; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询开始时间必须小于当前日期") - @ApiModelProperty(value = "查询开始时间") - private Date createdTimeStart; - - @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) - @Past(message = "查询结束时间必须小于当前日期") - @ApiModelProperty(value = "查询结束时间") - private Date createdTimeEnd; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserUpdateForm.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserUpdateForm.java deleted file mode 100644 index cabd2a6b..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/form/UserUpdateForm.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.form; - -import com.springboot.cloud.common.web.entity.form.BaseForm; -import com.springboot.cloud.sysadmin.organization.entity.po.User; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.hibernate.validator.constraints.Length; - -import java.util.Set; - -@ApiModel -@Data -public class UserUpdateForm extends BaseForm { - - @ApiModelProperty(value = "用户账号") - @Length(min = 3, max = 20, message = "用户名长度在3到20个字符") - private String username; - - @ApiModelProperty(value = "用户密码") - @Length(min = 5, max = 20, message = "密码长度在5到20个字符") - private String password; - - @ApiModelProperty(value = "用户手机号") - private String mobile; - - @ApiModelProperty(value = "用户姓名") - private String name; - - @ApiModelProperty(value = "用户描述") - private String description; - - @ApiModelProperty(value = "用户拥有的角色id列表") - private Set roleIds; - - @ApiModelProperty(value = "用户状态,true为可用") - private Boolean enabled = true; - - @ApiModelProperty(value = "用户账号是否过期,true为未过期") - private Boolean accountNonExpired = true; - - @ApiModelProperty(value = "用户密码是否过期,true为未过期") - private Boolean credentialsNonExpired = true; - - @ApiModelProperty(value = "用户账号是否被锁定,true为未锁定") - private Boolean accountNonLocked = true; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/GroupQueryParam.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/GroupQueryParam.java deleted file mode 100644 index 5e9436be..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/GroupQueryParam.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.param; - -import com.springboot.cloud.common.web.entity.param.BaseParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Group; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class GroupQueryParam extends BaseParam { - private String name; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/MenuQueryParam.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/MenuQueryParam.java deleted file mode 100644 index e1fc68c9..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/MenuQueryParam.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.param; - -import com.springboot.cloud.common.web.entity.param.BaseParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Menu; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class MenuQueryParam extends BaseParam { - private String name; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/PositionQueryParam.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/PositionQueryParam.java deleted file mode 100644 index aa52c354..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/PositionQueryParam.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.param; - -import com.springboot.cloud.common.web.entity.param.BaseParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Position; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class PositionQueryParam extends BaseParam { - private String name; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/ResourceQueryParam.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/ResourceQueryParam.java deleted file mode 100644 index 73d2731f..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/ResourceQueryParam.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.param; - -import com.springboot.cloud.common.web.entity.param.BaseParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Resource; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ResourceQueryParam extends BaseParam { - private String name; - private String code; - private String type; - private String url; - private String method; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/RoleQueryParam.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/RoleQueryParam.java deleted file mode 100644 index 7a532d9a..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/RoleQueryParam.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.param; - -import com.springboot.cloud.common.web.entity.param.BaseParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Role; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class RoleQueryParam extends BaseParam { - private String code; - private String name; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/UserQueryParam.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/UserQueryParam.java deleted file mode 100644 index 49ff7786..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/param/UserQueryParam.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.param; - -import com.springboot.cloud.common.web.entity.param.BaseParam; -import com.springboot.cloud.sysadmin.organization.entity.po.User; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class UserQueryParam extends BaseParam { - private String name; - private String mobile; - private String username; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Group.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Group.java deleted file mode 100644 index 7ad26729..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Group.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@TableName("t_groups") -public class Group extends BasePo { - private String name; - private String parentId; - private String description; - @TableLogic - private String deleted = "N"; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/GroupPermission.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/GroupPermission.java deleted file mode 100644 index cbfa6b33..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/GroupPermission.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 组权限 - * - * @author wayne - * @date 2021/09/09 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@TableName("group_permission_relation") -public class GroupPermission extends BasePo { - private String groupId; - private String permissionId; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Menu.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Menu.java deleted file mode 100644 index d0236957..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Menu.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class Menu extends BasePo { - private String parentId; - private String name; - private String type; - private String href; - private String icon; - private int orderNum; - private String description; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java deleted file mode 100644 index a0306ba2..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Permission.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.*; - -import java.util.Date; - -/** - * 许可 - * 数据权限资源 - * - * @author wayne - * @date 2021/09/06 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(exclude = "expireDate",callSuper = false) -public class Permission extends BasePo { - - /** - * 资源类型:hive,hdfs - */ - private String resType; - - /** - * 资源地区 - */ - private String area; - - /** - * 资源完整路径 - */ - private String resFullPath; - - /** - * 资源全名 - */ - private String resFullName; - - /** - * 资源操作位:读,写,查询 - */ - private String operationBit; - - /** - * 过期日期 - */ - private Date expireDate; - - @TableLogic(value = "N",delval = "Y") - private String deleted = "N"; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Position.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Position.java deleted file mode 100644 index 383592de..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Position.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class Position extends BasePo { - private String name; - private String description; - @TableLogic - private String deleted = "N"; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Resource.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Resource.java deleted file mode 100644 index 80b4f56c..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Resource.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class Resource extends BasePo { - private String code; - private String type; - private String url; - private String method; - private String name; - private String description; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Role.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Role.java deleted file mode 100644 index 01a18152..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/Role.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Set; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@TableName("roles") -public class Role extends BasePo { - private String code; - private String name; - private String description; - - @TableField(exist = false) - private Set resourceIds; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/RoleResource.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/RoleResource.java deleted file mode 100644 index 193db7ef..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/RoleResource.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@TableName("role_resource_relation") -public class RoleResource extends BasePo { - private String roleId; - private String resourceId; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/User.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/User.java deleted file mode 100644 index b2290500..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/User.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Set; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@TableName("users") -public class User extends BasePo { - private String name; - private String mobile; - private String username; - private String password; - private String description; - private Boolean enabled; - private Boolean accountNonExpired; - private Boolean credentialsNonExpired; - private Boolean accountNonLocked; - @TableField(exist = false) - private Set roleIds; - @TableLogic - private String deleted = "N"; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java deleted file mode 100644 index 17bde578..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserGroup.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 用户组 - * - * @author wayne - * @date 2021/09/09 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@TableName("user_group_relation") -public class UserGroup extends BasePo { - private String userId; - private String groupId; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserRole.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserRole.java deleted file mode 100644 index 19b38bea..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/po/UserRole.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.po; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.springboot.cloud.common.web.entity.po.BasePo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@TableName("user_role_relation") -public class UserRole extends BasePo { - private String userId; - private String roleId; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/vo/UserVo.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/vo/UserVo.java deleted file mode 100644 index 2e463516..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/entity/vo/UserVo.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.entity.vo; - -import com.springboot.cloud.common.web.entity.vo.BaseVo; -import com.springboot.cloud.sysadmin.organization.entity.po.User; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springframework.beans.BeanUtils; - -import java.util.Date; -import java.util.Set; - -@Data -@NoArgsConstructor -public class UserVo extends BaseVo { - - public UserVo(User user) { - BeanUtils.copyProperties(user, this); - } - - private String name; - private String mobile; - private String username; - private String description; - private String deleted; - private Set roleIds; - private String createdBy; - private String updatedBy; - private Date createdTime; - private Date updatedTime; -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/EventSender.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/EventSender.java deleted file mode 100644 index 19d961ed..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/EventSender.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.events; - -import com.springboot.cloud.sysadmin.organization.config.BusConfig; -import lombok.extern.slf4j.Slf4j; -import org.springframework.amqp.rabbit.core.RabbitTemplate; -import org.springframework.amqp.support.converter.MessageConverter; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; - -@Component -@Slf4j -public class EventSender { - - @Autowired - private RabbitTemplate rabbitTemplate; - - @Autowired - private MessageConverter messageConverter; - - @PostConstruct - public void init() { - rabbitTemplate.setMessageConverter(messageConverter); - } - - public void send(String routingKey, Object object) { - log.info("routingKey:{}=>message:{}", routingKey, object); - rabbitTemplate.convertAndSend(BusConfig.EXCHANGE_NAME, routingKey, object); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/PermissionBusReceiver.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/PermissionBusReceiver.java deleted file mode 100644 index 9bfe5112..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/events/PermissionBusReceiver.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.events; - - -import com.springboot.cloud.sysadmin.facade.constant.PermissionChangeTypeEnum; -import com.springboot.cloud.sysadmin.facade.dto.PermissionChangeDTO; -import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; -import com.springboot.cloud.sysadmin.organization.dao.GroupPermissionMapper; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 权限更新总线接收器 - * - * @author wayne - * @date 2021/09/08 - */ -@Component -@Slf4j -public class PermissionBusReceiver { - - @Autowired - GroupPermissionMapper groupPermissionMapper; - - public void handleMessage(PermissionChangeDTO permissionChangeDTO) { - log.info("Received Message:<{}>", permissionChangeDTO); - PermissionChangeTypeEnum changeType = permissionChangeDTO.getChangeType(); - PermissionDTO permissionDTO = permissionChangeDTO.getPermissionDTO(); - if(changeType.equals(PermissionChangeTypeEnum.DELETE)){ - removePermission(permissionDTO); - }else if(changeType.equals(PermissionChangeTypeEnum.ADD)){ - savePermission(permissionDTO); - }else{ - log.info("错误的消息,被舍弃"); - } - } - - - public void savePermission(PermissionDTO permissionDTO) { - //1.检查权限格式是否正确 - //2.添加权限表 - //3.添加权限 - } - - public void removePermission(PermissionDTO permissionDTO) { - //去除group_permission表中的权限关联 - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/GlobalExceptionHandlerAdvice.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/GlobalExceptionHandlerAdvice.java deleted file mode 100644 index 1c5563ec..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/GlobalExceptionHandlerAdvice.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.exception; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.common.web.exception.DefaultGlobalExceptionHandlerAdvice; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; - -@RestControllerAdvice -@Slf4j -public class GlobalExceptionHandlerAdvice extends DefaultGlobalExceptionHandlerAdvice { - - @ExceptionHandler(value = {UserNotFoundException.class}) - public Result userNotFound(UserNotFoundException ex) { - log.error(ex.getMessage()); - return Result.fail(ex.getErrorType()); - } -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/OrganizationErrorType.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/OrganizationErrorType.java deleted file mode 100644 index c2442351..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/OrganizationErrorType.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.exception; - -import com.springboot.cloud.common.core.exception.ErrorType; -import lombok.Getter; - -@Getter -public enum OrganizationErrorType implements ErrorType { - - USER_NOT_FOUND("030100", "用户未找到!"), - ROLE_NOT_FOUND("030200", "角色未找到!"); - - /** - * 错误类型码 - */ - private String code; - /** - * 错误类型描述信息 - */ - private String mesg; - - OrganizationErrorType(String code, String mesg) { - this.code = code; - this.mesg = mesg; - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/RoleNotFoundException.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/RoleNotFoundException.java deleted file mode 100644 index f48b1592..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/RoleNotFoundException.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.exception; - -import com.springboot.cloud.common.core.exception.BaseException; - -public class RoleNotFoundException extends BaseException { - public RoleNotFoundException() { - super(OrganizationErrorType.ROLE_NOT_FOUND); - } - - public RoleNotFoundException(String message) { - super(OrganizationErrorType.ROLE_NOT_FOUND, message); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/UserNotFoundException.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/UserNotFoundException.java deleted file mode 100644 index b6cdb7fe..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/exception/UserNotFoundException.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.exception; - -import com.springboot.cloud.common.core.exception.BaseException; - -public class UserNotFoundException extends BaseException { - public UserNotFoundException() { - super(OrganizationErrorType.USER_NOT_FOUND); - } - - public UserNotFoundException(String message) { - super(OrganizationErrorType.USER_NOT_FOUND, message); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/GroupController.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/GroupController.java deleted file mode 100644 index 88e46fb2..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/GroupController.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.rest; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.sysadmin.organization.entity.form.GroupForm; -import com.springboot.cloud.sysadmin.organization.entity.form.GroupQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.param.GroupQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Group; -import com.springboot.cloud.sysadmin.organization.service.IGroupService; -import io.swagger.annotations.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -@RestController -@RequestMapping("/group") -@Api("group") -@Slf4j -public class GroupController { - - @Autowired - private IGroupService groupService; - - @ApiOperation(value = "新增用户组", notes = "新增一个用户组") - @ApiImplicitParam(name = "groupForm", value = "新增用户组form表单", required = true, dataType = "GroupForm") - @PostMapping - public Result add(@Valid @RequestBody GroupForm groupForm) { - log.debug("name:{}", groupForm); - return Result.success(groupService.add(groupForm.toPo(Group.class))); - } - - @ApiOperation(value = "删除用户组", notes = "根据url的id来指定删除对象") - @ApiImplicitParam(paramType = "path", name = "id", value = "用户组ID", required = true, dataType = "string") - @DeleteMapping(value = "/{id}") - public Result delete(@PathVariable String id) { - return Result.success(groupService.delete(id)); - } - - @ApiOperation(value = "修改用户组", notes = "修改指定用户组信息") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "用户组ID", required = true, dataType = "string"), - @ApiImplicitParam(name = "groupForm", value = "用户组实体", required = true, dataType = "GroupForm") - }) - @PutMapping(value = "/{id}") - public Result update(@PathVariable String id, @Valid @RequestBody GroupForm groupForm) { - Group group = groupForm.toPo(Group.class); - group.setId(id); - return Result.success(groupService.update(group)); - } - - @ApiOperation(value = "获取用户组", notes = "获取指定用户组信息") - @ApiImplicitParam(paramType = "path", name = "id", value = "用户组ID", required = true, dataType = "string") - @GetMapping(value = "/{id}") - public Result get(@PathVariable String id) { - log.debug("get with id:{}", id); - return Result.success(groupService.get(id)); - } - - @ApiOperation(value = "查询用户组", notes = "根据条件查询用户组信息,简单查询") - @ApiImplicitParam(paramType = "query", name = "name", value = "用户组名称", required = true, dataType = "string") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @GetMapping - public Result query(@RequestParam String name) { - log.debug("query with name:{}", name); - GroupQueryParam groupQueryParam = new GroupQueryParam(); - groupQueryParam.setName(name); - return Result.success(groupService.query(groupQueryParam)); - } - - @ApiOperation(value = "根据用户名查询用户组列表", notes = "根据用户名查询用户组列表") - @ApiImplicitParam(paramType = "query", name = "name", value = "用户名称", required = true, dataType = "string") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @GetMapping(value = "/user/{username}") - public Result queryByUsername(@PathVariable String username) { - log.debug("query with username:{}", username); - return Result.success(groupService.queryByUserName(username)); - } - - @ApiOperation(value = "搜索用户组", notes = "根据条件查询用户组信息") - @ApiImplicitParam(name = "groupQueryForm", value = "用户组查询参数", required = true, dataType = "GroupQueryForm") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @PostMapping(value = "/conditions") - public Result search(@Valid @RequestBody GroupQueryForm groupQueryForm) { - log.debug("search with groupQueryForm:{}", groupQueryForm); - return Result.success(groupService.query(groupQueryForm.toParam(GroupQueryParam.class))); - } - - @ApiOperation(value = "根据父id查询用户组", notes = "根据父id查询用户组列表") - @ApiImplicitParam(paramType = "path", name = "id", value = "用户组父ID", required = true, dataType = "string") - @GetMapping(value = "/parent/{id}") - public Result search(@PathVariable String id) { - log.debug("query with parent id:{}", id); - return Result.success(groupService.queryByParentId(id)); - } -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/MenuController.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/MenuController.java deleted file mode 100644 index dd0bfd44..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/MenuController.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.rest; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.sysadmin.organization.entity.form.MenuForm; -import com.springboot.cloud.sysadmin.organization.entity.form.MenuQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.param.MenuQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Menu; -import com.springboot.cloud.sysadmin.organization.service.IMenuService; -import io.swagger.annotations.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -@RestController -@RequestMapping("/menu") -@Api("menu") -@Slf4j -public class MenuController { - - @Autowired - private IMenuService menuService; - - @ApiOperation(value = "新增菜单", notes = "新增一个菜单") - @ApiImplicitParam(name = "menuForm", value = "新增菜单form表单", required = true, dataType = "MenuForm") - @PostMapping - public Result add(@Valid @RequestBody MenuForm menuForm) { - log.debug("name:{}", menuForm); - Menu menu = menuForm.toPo(Menu.class); - return Result.success(menuService.add(menu)); - } - - @ApiOperation(value = "删除菜单", notes = "根据url的id来指定删除对象") - @ApiImplicitParam(paramType = "path", name = "id", value = "菜单ID", required = true, dataType = "string") - @DeleteMapping(value = "/{id}") - public Result delete(@PathVariable String id) { - return Result.success(menuService.delete(id)); - } - - @ApiOperation(value = "修改菜单", notes = "修改指定菜单信息") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "菜单ID", required = true, dataType = "string"), - @ApiImplicitParam(name = "menuForm", value = "菜单实体", required = true, dataType = "MenuForm") - }) - @PutMapping(value = "/{id}") - public Result update(@PathVariable String id, @Valid @RequestBody MenuForm menuForm) { - Menu menu = menuForm.toPo(Menu.class); - menu.setId(id); - return Result.success(menuService.update(menu)); - } - - @ApiOperation(value = "获取菜单", notes = "获取指定菜单信息") - @ApiImplicitParam(paramType = "path", name = "id", value = "菜单ID", required = true, dataType = "string") - @GetMapping(value = "/{id}") - public Result get(@PathVariable String id) { - log.debug("get with id:{}", id); - return Result.success(menuService.get(id)); - } - - @ApiOperation(value = "查询菜单", notes = "根据条件查询菜单信息,简单查询") - @ApiImplicitParam(paramType = "query", name = "name", value = "菜单名称", required = true, dataType = "string") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @GetMapping - public Result query(@RequestParam String name) { - log.debug("query with name:{}", name); - MenuQueryParam menuQueryParam = new MenuQueryParam(name); - return Result.success(menuService.query(menuQueryParam)); - } - - @ApiOperation(value = "搜索菜单", notes = "根据条件查询菜单信息") - @ApiImplicitParam(name = "menuQueryForm", value = "菜单查询参数", required = true, dataType = "MenuQueryForm") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @PostMapping(value = "/conditions") - public Result search(@Valid @RequestBody MenuQueryForm menuQueryForm) { - log.debug("search with menuQueryForm:{}", menuQueryForm); - return Result.success(menuService.query(menuQueryForm.toParam(MenuQueryParam.class))); - } - - @ApiOperation(value = "根据父id查询菜单", notes = "根据父id查询菜单列表") - @ApiImplicitParam(paramType = "path", name = "id", value = "菜单父ID", required = true, dataType = "string") - @GetMapping(value = "/parent/{id}") - public Result search(@PathVariable String id) { - log.debug("query with parent id:{}", id); - return Result.success(menuService.queryByParentId(id)); - } -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java deleted file mode 100644 index 8debbb7c..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PermissionController.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.rest; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; -import com.springboot.cloud.sysadmin.organization.service.impl.PermissionService; -import io.swagger.annotations.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/permission") -@Api("permission") -@Slf4j -public class PermissionController { - - @Autowired - PermissionService permissionService; - - @ApiOperation(value = "查询权限", notes = "根据groupCode查询用户所拥有的资源信息") - @ApiImplicitParam(paramType = "path", name = "groupCode", value = "用户组Code", required = true, dataType = "string") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @PostMapping(value = "/group") - public Result queryByUsername(@RequestBody PermissionDTO permissionDTO) { - log.debug("query with groupCode:{}", permissionDTO.getGroupCode()); - return Result.success(permissionService.queryByConditions(permissionDTO)); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PositionController.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PositionController.java deleted file mode 100644 index 668c421d..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/PositionController.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.rest; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.sysadmin.organization.entity.form.PositionForm; -import com.springboot.cloud.sysadmin.organization.entity.param.PositionQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Position; -import com.springboot.cloud.sysadmin.organization.service.IPositionService; -import io.swagger.annotations.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -@RestController -@RequestMapping("/position") -@Api("position") -@Slf4j -public class PositionController { - - @Autowired - private IPositionService positionService; - - @ApiOperation(value = "新增职位", notes = "新增一个职位") - @ApiImplicitParam(name = "positionForm", value = "新增职位form表单", required = true, dataType = "PositionForm") - @PostMapping - public Result add(@Valid @RequestBody PositionForm positionForm) { - log.debug("name:{}", positionForm); - Position position = positionForm.toPo(Position.class); - return Result.success(positionService.add(position)); - } - - @ApiOperation(value = "删除职位", notes = "根据url的id来指定删除对象") - @ApiImplicitParam(paramType = "path", name = "id", value = "职位ID", required = true, dataType = "string") - @DeleteMapping(value = "/{id}") - public Result delete(@PathVariable String id) { - return Result.success(positionService.delete(id)); - } - - @ApiOperation(value = "修改职位", notes = "修改指定职位信息") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "职位ID", required = true, dataType = "string"), - @ApiImplicitParam(name = "positionForm", value = "职位实体", required = true, dataType = "PositionForm") - }) - @PutMapping(value = "/{id}") - public Result update(@PathVariable String id, @Valid @RequestBody PositionForm positionForm) { - Position position = positionForm.toPo(Position.class); - position.setId(id); - return Result.success(positionService.update(position)); - } - - @ApiOperation(value = "获取职位", notes = "获取指定职位信息") - @ApiImplicitParam(paramType = "path", name = "id", value = "职位ID", required = true, dataType = "string") - @GetMapping(value = "/{id}") - public Result get(@PathVariable String id) { - log.debug("get with id:{}", id); - return Result.success(positionService.get(id)); - } - - @ApiOperation(value = "查询职位", notes = "根据条件查询职位信息,简单查询") - @ApiImplicitParam(paramType = "query", name = "name", value = "职位名称", required = true, dataType = "string") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @GetMapping - public Result query(@RequestParam String name) { - log.debug("query with name:{}", name); - return Result.success(positionService.query(new PositionQueryParam(name))); - } -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/ResourceController.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/ResourceController.java deleted file mode 100644 index 8f6b19c6..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/ResourceController.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.rest; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.sysadmin.organization.entity.form.ResourceForm; -import com.springboot.cloud.sysadmin.organization.entity.form.ResourceQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.param.ResourceQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Resource; -import com.springboot.cloud.sysadmin.organization.service.IResourceService; -import io.swagger.annotations.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -@RestController -@RequestMapping("/resource") -@Api("resource") -@Slf4j -public class ResourceController { - - @Autowired - private IResourceService resourceService; - - @ApiOperation(value = "新增资源", notes = "新增一个资源") - @ApiImplicitParam(name = "resourceForm", value = "新增资源form表单", required = true, dataType = "ResourceForm") - @PostMapping - public Result add(@Valid @RequestBody ResourceForm resourceForm) { - log.debug("name:{}", resourceForm); - Resource resource = resourceForm.toPo(Resource.class); - return Result.success(resourceService.add(resource)); - } - - @ApiOperation(value = "删除资源", notes = "根据url的id来指定删除对象") - @ApiImplicitParam(paramType = "path", name = "id", value = "资源ID", required = true, dataType = "string") - @DeleteMapping(value = "/{id}") - public Result delete(@PathVariable String id) { - return Result.success(resourceService.delete(id)); - } - - @ApiOperation(value = "修改资源", notes = "修改指定资源信息") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "资源ID", required = true, dataType = "string"), - @ApiImplicitParam(name = "resourceForm", value = "资源实体", required = true, dataType = "ResourceForm") - }) - @PutMapping(value = "/{id}") - public Result update(@PathVariable String id, @Valid @RequestBody ResourceForm resourceForm) { - Resource resource = resourceForm.toPo(id, Resource.class); - return Result.success(resourceService.update(resource)); - } - - @ApiOperation(value = "获取资源", notes = "获取指定资源信息") - @ApiImplicitParam(paramType = "path", name = "id", value = "资源ID", required = true, dataType = "string") - @GetMapping(value = "/{id}") - public Result get(@PathVariable String id) { - log.debug("get with id:{}", id); - return Result.success(resourceService.get(id)); - } - - @ApiOperation(value = "查询资源", notes = "根据userId查询用户所拥有的资源信息") - @ApiImplicitParam(paramType = "path", name = "userId", value = "用户id", required = true, dataType = "string") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @GetMapping(value = "/user/{username}") - public Result queryByUsername(@PathVariable String username) { - log.debug("query with username:{}", username); - return Result.success(resourceService.query(username)); - } - - @ApiOperation(value = "查询所有资源", notes = "查询所有资源信息") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @GetMapping(value = "/all") - public Result queryAll() { - return Result.success(resourceService.getAll()); - } - - @ApiOperation(value = "搜索资源", notes = "根据条件搜索资源信息") - @ApiImplicitParam(name = "resourceQueryForm", value = "资源查询参数", required = true, dataType = "RoleQueryForm") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @PostMapping(value = "/conditions") - public Result query(@Valid @RequestBody ResourceQueryForm resourceQueryForm) { - log.debug("query with name:{}", resourceQueryForm); - return Result.success(resourceService.query(resourceQueryForm.getPage(), resourceQueryForm.toParam(ResourceQueryParam.class))); - } -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/RoleController.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/RoleController.java deleted file mode 100644 index 9384b95e..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/RoleController.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.rest; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.sysadmin.organization.entity.form.RoleForm; -import com.springboot.cloud.sysadmin.organization.entity.form.RoleQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.form.RoleUpdateForm; -import com.springboot.cloud.sysadmin.organization.entity.param.RoleQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Role; -import com.springboot.cloud.sysadmin.organization.service.IRoleService; -import io.swagger.annotations.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -@RestController -@RequestMapping("/role") -@Api("role") -@Slf4j -public class RoleController { - - @Autowired - private IRoleService roleService; - - @ApiOperation(value = "新增角色", notes = "新增一个角色") - @ApiImplicitParam(name = "roleForm", value = "新增角色form表单", required = true, dataType = "RoleForm") - @PostMapping - public Result add(@Valid @RequestBody RoleForm roleForm) { - log.debug("name:{}", roleForm); - Role role = roleForm.toPo(Role.class); - return Result.success(roleService.add(role)); - } - - @ApiOperation(value = "删除角色", notes = "根据url的id来指定删除对象") - @ApiImplicitParam(paramType = "path", name = "id", value = "角色ID", required = true, dataType = "string") - @DeleteMapping(value = "/{id}") - public Result delete(@PathVariable String id) { - return Result.success(roleService.delete(id)); - } - - @ApiOperation(value = "修改角色", notes = "修改指定角色信息") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "角色ID", required = true, dataType = "string"), - @ApiImplicitParam(name = "roleForm", value = "角色实体", required = true, dataType = "RoleUpdateForm") - }) - @PutMapping(value = "/{id}") - public Result update(@PathVariable String id, @Valid @RequestBody RoleUpdateForm roleUpdateForm) { - Role role = roleUpdateForm.toPo(id, Role.class); - return Result.success(roleService.update(role)); - } - - @ApiOperation(value = "获取角色", notes = "获取指定角色信息") - @ApiImplicitParam(paramType = "path", name = "id", value = "角色ID", required = true, dataType = "string") - @GetMapping(value = "/{id}") - public Result get(@PathVariable String id) { - log.debug("get with id:{}", id); - return Result.success(roleService.get(id)); - } - - @ApiOperation(value = "获取所有角色", notes = "获取所有角色") - @GetMapping(value = "/all") - public Result get() { - return Result.success(roleService.getAll()); - } - - @ApiOperation(value = "查询角色", notes = "根据用户id查询用户所拥有的角色信息") - @ApiImplicitParam(paramType = "path", name = "userId", value = "用户id", required = true, dataType = "string") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @GetMapping(value = "/user/{userId}") - public Result query(@PathVariable String userId) { - log.debug("query with userId:{}", userId); - return Result.success(roleService.query(userId)); - } - - @ApiOperation(value = "搜索角色", notes = "根据条件搜索角色信息") - @ApiImplicitParam(name = "roleQueryForm", value = "角色查询参数", required = true, dataType = "RoleQueryForm") - @ApiResponses( - @ApiResponse(code = 200, message = "处理成功", response = Result.class) - ) - @PostMapping(value = "/conditions") - public Result query(@Valid @RequestBody RoleQueryForm roleQueryForm) { - log.debug("query with name:{}", roleQueryForm); - return Result.success(roleService.query(roleQueryForm.getPage(), roleQueryForm.toParam(RoleQueryParam.class))); - } -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/UserController.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/UserController.java deleted file mode 100644 index 5e8a7f1e..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/rest/UserController.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.rest; - -import com.springboot.cloud.common.core.entity.vo.Result; -import com.springboot.cloud.sysadmin.organization.entity.form.UserForm; -import com.springboot.cloud.sysadmin.organization.entity.form.UserQueryForm; -import com.springboot.cloud.sysadmin.organization.entity.form.UserUpdateForm; -import com.springboot.cloud.sysadmin.organization.entity.param.UserQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.User; -import com.springboot.cloud.sysadmin.organization.service.IUserService; -import io.swagger.annotations.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -@RestController -@RequestMapping("/user") -@Api("user") -@Slf4j -public class UserController { - - @Autowired - private IUserService userService; - - @ApiOperation(value = "新增用户", notes = "新增一个用户") - @ApiImplicitParam(name = "userForm", value = "新增用户form表单", required = true, dataType = "UserForm") - @PostMapping - public Result add(@Valid @RequestBody UserForm userForm) { - log.debug("name:{}", userForm); - User user = userForm.toPo(User.class); - return Result.success(userService.add(user)); - } - - @ApiOperation(value = "删除用户", notes = "根据url的id来指定删除对象,逻辑删除") - @ApiImplicitParam(paramType = "path", name = "id", value = "用户ID", required = true, dataType = "string") - @DeleteMapping(value = "/{id}") - public Result delete(@PathVariable String id) { - return Result.success(userService.delete(id)); - } - - @ApiOperation(value = "修改用户", notes = "修改指定用户信息") - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "string"), - @ApiImplicitParam(name = "userUpdateForm", value = "用户实体", required = true, dataType = "UserUpdateForm")}) - @PutMapping(value = "/{id}") - public Result update(@PathVariable String id, @Valid @RequestBody UserUpdateForm userUpdateForm) { - User user = userUpdateForm.toPo(User.class); - user.setId(id); - return Result.success(userService.update(user)); - } - - @ApiOperation(value = "获取用户", notes = "获取指定用户信息") - @ApiImplicitParam(paramType = "path", name = "id", value = "用户ID", required = true, dataType = "string") - @GetMapping(value = "/{id}") - public Result get(@PathVariable String id) { - log.debug("get with id:{}", id); - return Result.success(userService.get(id)); - } - - @ApiOperation(value = "获取用户", notes = "根据用户唯一标识(username or mobile)获取用户信息") - @ApiImplicitParam(paramType = "query", name = "uniqueId", value = "用户唯一标识", required = true, dataType = "string") - @ApiResponses(@ApiResponse(code = 200, message = "处理成功", response = Result.class)) - @GetMapping - public Result query(@RequestParam String uniqueId) { - log.debug("query with username or mobile:{}", uniqueId); - return Result.success(userService.getByUniqueId(uniqueId)); - } - - @ApiOperation(value = "搜索用户", notes = "根据条件查询用户信息") - @ApiImplicitParam(name = "userQueryForm", value = "用户查询参数", required = true, dataType = "UserQueryForm") - @ApiResponses(@ApiResponse(code = 200, message = "处理成功", response = Result.class)) - @PostMapping(value = "/conditions") - public Result search(@Valid @RequestBody UserQueryForm userQueryForm) { - log.debug("search with userQueryForm:{}", userQueryForm); - return Result.success(userService.query(userQueryForm.getPage(), userQueryForm.toParam(UserQueryParam.class))); - } -} \ No newline at end of file diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IGroupService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IGroupService.java deleted file mode 100644 index cfe95bd1..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IGroupService.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.springboot.cloud.sysadmin.organization.entity.param.GroupQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Group; - -import java.util.List; - -public interface IGroupService extends IService { - /** - * 获取用户组 - * - * @param id - * @return - */ - Group get(String id); - - /** - * 新增用户组 - * - * @param group - * @return true为新增成功 - */ - boolean add(Group group); - - /** - * 查询用户组 - * - * @return - */ - List query(GroupQueryParam groupQueryParam); - - /** - * 根据父id查询用户组 - * - * @return - */ - List queryByParentId(String id); - - /** - * 根据userName查询所属的组 - * - * @return - */ - List queryByUserName(String userName); - - /** - * 更新用户组信息 - * - * @param group - */ - boolean update(Group group); - - /** - * 根据id删除用户组 - * - * @param id - */ - boolean delete(String id); -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IMenuService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IMenuService.java deleted file mode 100644 index 5b0ee0e0..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IMenuService.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service; - -import com.springboot.cloud.sysadmin.organization.entity.param.MenuQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Menu; - -import java.util.List; - -public interface IMenuService { - /** - * 获取菜单 - * - * @param id - * @return - */ - Menu get(String id); - - /** - * 新增菜单 - * - * @param menu - * @return - */ - boolean add(Menu menu); - - /** - * 查询菜单 - * - * @return - */ - List query(MenuQueryParam menuQueryParam); - - /** - * 根据父id查询菜单 - * - * @return - */ - List queryByParentId(String id); - - /** - * 更新菜单信息 - * - * @param menu - */ - boolean update(Menu menu); - - /** - * 根据id删除菜单 - * - * @param id - */ - boolean delete(String id); -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java deleted file mode 100644 index 96f2caee..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPermissionService.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service; - -import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; -import com.springboot.cloud.sysadmin.organization.entity.po.Permission; - -import java.util.List; - -public interface IPermissionService { - - /** - * 查询条件 - * - * @param permissionDTO 许可dto - * @return {@link List} - */ - List queryByConditions(PermissionDTO permissionDTO); - - /** - * 新增资源 - * - * @param groupCode 组织代码 - * @param permission 许可 - * @return boolean - */ - boolean add(String groupCode, Permission permission); - - - /** - * 更新 - * 更新资源信息 - * - * @param permission 许可 - * @param groupCode 组织代码 - * @return boolean - */ - boolean update(String groupCode, Permission permission); - - /** - * 删除 - * 根据id删除资源 - * - * @param groupCode 组织代码 - * @param permission 许可 - * @return boolean - */ - boolean delete(String groupCode, Permission permission); - -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPositionService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPositionService.java deleted file mode 100644 index e9b60f73..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IPositionService.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service; - -import com.springboot.cloud.sysadmin.organization.entity.param.PositionQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Position; - -import java.util.List; - -public interface IPositionService { - /** - * 获取职位 - * - * @param id - * @return - */ - Position get(String id); - - /** - * 新增职位 - * - * @param position - * @return - */ - boolean add(Position position); - - /** - * 查询职位 - * - * @return - */ - List query(PositionQueryParam positionQueryParam); - - /** - * 更新职位信息 - * - * @param position - */ - boolean update(Position position); - - /** - * 根据id删除职位 - * - * @param id - */ - boolean delete(String id); -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IResourceService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IResourceService.java deleted file mode 100644 index 0faa1c9a..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IResourceService.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.springboot.cloud.sysadmin.organization.entity.param.ResourceQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Resource; - -import java.util.List; - -public interface IResourceService { - /** - * 获取资源 - * - * @param id - * @return - */ - Resource get(String id); - - /** - * 新增资源 - * - * @param resource - * @return - */ - boolean add(Resource resource); - - /** - * 查询资源,分页 - * - * @return - */ - IPage query(Page page, ResourceQueryParam resourceQueryParam); - - /** - * 查询所有资源 - * - * @return - */ - List getAll(); - - /** - * 根据username查询角色拥有的资源 - * - * @return - */ - List query(String username); - - /** - * 更新资源信息 - * - * @param resource - */ - boolean update(Resource resource); - - /** - * 根据id删除资源 - * - * @param id - */ - boolean delete(String id); -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IRoleResourceService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IRoleResourceService.java deleted file mode 100644 index b342d337..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IRoleResourceService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service; - -import com.springboot.cloud.sysadmin.organization.entity.po.RoleResource; - -import java.util.List; -import java.util.Set; - -public interface IRoleResourceService { - - /** - * 批量给角色添加资源 - * - * @param roleId 角色id - * @param resourceIds 资源id列表 - * @return 是否操作成功 - */ - boolean saveBatch(String roleId, Set resourceIds); - - /** - * 删除角色拥有的资源 - * - * @param roleId 角色id - * @return 是否操作成功 - */ - boolean removeByRoleId(String roleId); - - /** - * 查询角色拥有资源id - * - * @param roleId 角色id - * @return 角色拥有的资源id集合 - */ - Set queryByRoleId(String roleId); - - /** - * 根据角色id列表查询资源关系 - * - * @param roleIds 角色id集合 - * @return 角色资源关系集合 - */ - List queryByRoleIds(Set roleIds); -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IRoleService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IRoleService.java deleted file mode 100644 index d7fcc9a0..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IRoleService.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.springboot.cloud.sysadmin.organization.entity.param.RoleQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Role; - -import java.util.List; - -public interface IRoleService { - /** - * 获取角色 - * - * @param id - * @return - */ - Role get(String id); - - /** - * 获取所有角色 - * - * @return - */ - List getAll(); - - /** - * 新增角色 - * - * @param role - * @return - */ - boolean add(Role role); - - /** - * 查询角色 - * - * @return - */ - IPage query(Page page, RoleQueryParam roleQueryParam); - - /** - * 根据用户id查询用户拥有的角色 - * - * @return - */ - List query(String userId); - - /** - * 更新角色信息 - * - * @param role - */ - boolean update(Role role); - - /** - * 根据id删除角色 - * - * @param id - */ - boolean delete(String id); -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IUserRoleService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IUserRoleService.java deleted file mode 100644 index dead074a..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IUserRoleService.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service; - -import java.util.Set; - -public interface IUserRoleService { - - /** - * 给用户添加角色 - * - * @param userId - * @param roleIds - * @return - */ - boolean saveBatch(String userId, Set roleIds); - - /** - * 删除用户拥有的角色 - * - * @param userId - * @return - */ - boolean removeByUserId(String userId); - - /** - * 根据userId查询用户拥有角色id集合 - * - * @param userId - * @return - */ - Set queryByUserId(String userId); -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IUserService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IUserService.java deleted file mode 100644 index e5f56b41..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/IUserService.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.springboot.cloud.sysadmin.organization.entity.param.UserQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.User; -import com.springboot.cloud.sysadmin.organization.entity.vo.UserVo; - -public interface IUserService { - /** - * 获取用户 - * - * @param id 用户id - * @return UserVo - */ - UserVo get(String id); - - /** - * 根据用户唯一标识获取用户信息 - * 目前用户标识不用户名或mobile - * - * @param uniqueId - * @return - */ - User getByUniqueId(String uniqueId); - - /** - * 新增用户 - * - * @param user - * @return - */ - boolean add(User user); - - /** - * 查询用户 - * - * @return - */ - IPage query(Page page, UserQueryParam userQueryParam); - - /** - * 更新用户信息 - * - * @param user - */ - boolean update(User user); - - /** - * 根据id删除用户 - * - * @param id - */ - boolean delete(String id); -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/GroupService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/GroupService.java deleted file mode 100644 index ad7a824b..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/GroupService.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service.impl; - -import com.alicp.jetcache.anno.CacheInvalidate; -import com.alicp.jetcache.anno.CacheType; -import com.alicp.jetcache.anno.Cached; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.springboot.cloud.sysadmin.organization.dao.GroupMapper; -import com.springboot.cloud.sysadmin.organization.dao.UserGroupMapper; -import com.springboot.cloud.sysadmin.organization.entity.param.GroupQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Group; -import com.springboot.cloud.sysadmin.organization.entity.po.User; -import com.springboot.cloud.sysadmin.organization.entity.po.UserGroup; -import com.springboot.cloud.sysadmin.organization.service.IGroupService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -@Service -@Slf4j -public class GroupService extends ServiceImpl implements IGroupService { - - @Autowired - UserService userService; - - @Autowired - UserGroupMapper userGroupMapper; - - @Autowired - GroupMapper groupMapper; - - @Override - public boolean add(Group group) { - return this.save(group); - } - - @Override - @CacheInvalidate(name = "group::", key = "#id") - public boolean delete(String id) { - return this.removeById(id); - } - - @Override - @CacheInvalidate(name = "group::", key = "#group.id") - public boolean update(Group group) { - return this.updateById(group); - } - - @Override - @Cached(name = "group::", key = "#id", cacheType = CacheType.BOTH) - public Group get(String id) { - return this.getById(id); - } - - @Override - public List query(GroupQueryParam groupQueryParam) { - QueryWrapper queryWrapper = groupQueryParam.build(); - queryWrapper.eq("name", groupQueryParam.getName()); - return this.list(queryWrapper); - } - - @Override - public List queryByParentId(String id) { - return this.list(new QueryWrapper().eq("parent_id", id)); - } - - @Override - public List queryByUserName(String userName) { - //get user - User user = userService.getByUniqueId(userName); - LambdaQueryWrapper userGroupLambdaQueryWrapper = new LambdaQueryWrapper<>(); - userGroupLambdaQueryWrapper.eq(UserGroup::getUserId,user.getId()); - - //get groupIds - List userGroupList = userGroupMapper.selectList(userGroupLambdaQueryWrapper); - Set groupIds = userGroupList.stream().map(UserGroup::getGroupId).collect(Collectors.toSet()); - - //get groups - LambdaQueryWrapper groupLambdaQueryWrapper = new LambdaQueryWrapper<>(); - groupLambdaQueryWrapper.in(Group::getId,groupIds); - return groupMapper.selectList(groupLambdaQueryWrapper); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/MenuService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/MenuService.java deleted file mode 100644 index 3db6c375..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/MenuService.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service.impl; - -import com.alicp.jetcache.anno.CacheInvalidate; -import com.alicp.jetcache.anno.CacheType; -import com.alicp.jetcache.anno.Cached; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.springboot.cloud.sysadmin.organization.dao.MenuMapper; -import com.springboot.cloud.sysadmin.organization.entity.param.MenuQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Menu; -import com.springboot.cloud.sysadmin.organization.service.IMenuService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -@Service -@Slf4j -public class MenuService extends ServiceImpl implements IMenuService { - - @Override - public boolean add(Menu menu) { - return this.save(menu); - } - - @Override - @CacheInvalidate(name = "menu::", key = "#id") - public boolean delete(String id) { - return this.removeById(id); - } - - @Override - @CacheInvalidate(name = "menu::", key = "#menu.id") - public boolean update(Menu menu) { - return this.updateById(menu); - } - - @Override - @Cached(name = "menu::", key = "#id", cacheType = CacheType.BOTH) - public Menu get(String id) { - return this.getById(id); - } - - @Override - public List query(MenuQueryParam menuQueryParam) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq(null != menuQueryParam.getName(), "name", menuQueryParam.getName()); - return this.list(queryWrapper); - } - - @Override - public List queryByParentId(String id) { - return this.list(new QueryWrapper().eq("parent_id", id)); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java deleted file mode 100644 index b58b428a..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PermissionService.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.springboot.cloud.sysadmin.facade.dto.PermissionDTO; -import com.springboot.cloud.sysadmin.organization.dao.GroupMapper; -import com.springboot.cloud.sysadmin.organization.dao.GroupPermissionMapper; -import com.springboot.cloud.sysadmin.organization.dao.PermissionMapper; -import com.springboot.cloud.sysadmin.organization.dao.UserGroupMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.Group; -import com.springboot.cloud.sysadmin.organization.entity.po.GroupPermission; -import com.springboot.cloud.sysadmin.organization.entity.po.Permission; -import com.springboot.cloud.sysadmin.organization.events.EventSender; -import com.springboot.cloud.sysadmin.organization.service.IPermissionService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Date; -import java.util.List; -import java.util.stream.Collectors; - -@Service -public class PermissionService extends ServiceImpl implements IPermissionService { - - @Autowired - EventSender eventSender; - - @Autowired - UserGroupMapper userGroupMapper; - - @Autowired - GroupPermissionMapper groupPermissionMapper; - - @Autowired - PermissionMapper permissionMapper; - - @Autowired - GroupMapper groupMapper; - - @Override - public List queryByConditions(PermissionDTO permissionDTO) { - //get permission Id by groupIds - LambdaQueryWrapper groupPermissionQueryWrapper = new LambdaQueryWrapper<>(); - groupPermissionQueryWrapper.in(GroupPermission::getGroupId,permissionDTO.getGroupCode()); - List groupPermissionList = groupPermissionMapper.selectList(groupPermissionQueryWrapper); - - //get permissions - List permissionIdList = groupPermissionList.stream().map(GroupPermission::getPermissionId).collect(Collectors.toList()); - LambdaQueryWrapper permissionLambdaQueryWrapper = new LambdaQueryWrapper<>(); - permissionLambdaQueryWrapper.in(Permission::getId,permissionIdList) - .eq(Permission::getArea,permissionDTO.getArea()) - .eq(Permission::getOperationBit,permissionDTO.getOperationBit()) - .eq(Permission::getResType,permissionDTO.getResType()) - .eq(Permission::getDeleted,"N") - .gt(Permission::getExpireDate,new Date()); - return permissionMapper.selectList(permissionLambdaQueryWrapper); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean add(String groupCode, Permission permission) { - LambdaQueryWrapper groupLambdaQueryWrapper = new LambdaQueryWrapper<>(); - groupLambdaQueryWrapper.eq(Group::getName,groupCode); - Group group = groupMapper.selectOne(groupLambdaQueryWrapper); - GroupPermission groupPermission = GroupPermission.builder().groupId(group.getId()).permissionId(permission.getId()).build(); - //todo permission的格式校验 - int insertGroupNum = groupPermissionMapper.insert(groupPermission); - int insertPermissionNum = permissionMapper.insert(permission); - return isInsertSuccess(insertGroupNum,insertPermissionNum); - } - - @Override - public boolean update(String groupCode, Permission permission) { - return false; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean delete(String groupCode, Permission permission) { - LambdaQueryWrapper groupLambdaQueryWrapper = new LambdaQueryWrapper<>(); - groupLambdaQueryWrapper.eq(Group::getName,groupCode); - Group group = groupMapper.selectOne(groupLambdaQueryWrapper); - - //delete groupPermission - LambdaQueryWrapper groupPermissionLambdaQueryWrapper = Wrappers.lambdaQuery(); - groupPermissionLambdaQueryWrapper - .eq(GroupPermission::getGroupId,group.getId()) - .eq(GroupPermission::getPermissionId,permission.getId()); - groupPermissionMapper.delete(groupPermissionLambdaQueryWrapper); - - //delete permission - LambdaQueryWrapper permissionLambdaQueryWrapper = Wrappers.lambdaQuery(); - permissionLambdaQueryWrapper - .eq(Permission::getId,permission.getId()); - permissionMapper.delete(permissionLambdaQueryWrapper); - return true; - } - - /** - * 校验插入是否成功 - * - * @param insertNum1 插入num1 - * @param insertNum2 插入num2 - * @return boolean - */ - public boolean isInsertSuccess(Integer insertNum1, Integer insertNum2){ - return (null != insertNum1 && insertNum1 >= 1) && (null != insertNum2 && insertNum2 >= 1); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PositionService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PositionService.java deleted file mode 100644 index e8530945..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/PositionService.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service.impl; - -import com.alicp.jetcache.anno.CacheInvalidate; -import com.alicp.jetcache.anno.CacheType; -import com.alicp.jetcache.anno.Cached; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.springboot.cloud.sysadmin.organization.dao.PositionMapper; -import com.springboot.cloud.sysadmin.organization.entity.param.PositionQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Position; -import com.springboot.cloud.sysadmin.organization.service.IPositionService; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.springframework.stereotype.Service; - -import java.util.List; - -@Service -@Slf4j -public class PositionService extends ServiceImpl implements IPositionService { - - @Override - public boolean add(Position position) { - return this.save(position); - } - - @Override - @CacheInvalidate(name = "position::", key = "#id") - public boolean delete(String id) { - return this.removeById(id); - } - - @Override - @CacheInvalidate(name = "position::", key = "#position.id") - public boolean update(Position position) { - return this.updateById(position); - } - - @Override - @Cached(name = "position::", key = "#id", cacheType = CacheType.BOTH) - public Position get(String id) { - return this.getById(id); - } - - @Override - public List query(PositionQueryParam positionQueryParam) { - QueryWrapper queryWrapper = positionQueryParam.build(); - queryWrapper.eq(StringUtils.isNotBlank(positionQueryParam.getName()), "name", positionQueryParam.getName()); - return this.list(queryWrapper); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java deleted file mode 100644 index 752aedbd..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/ResourceService.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service.impl; - -import com.alicp.jetcache.anno.CacheType; -import com.alicp.jetcache.anno.Cached; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.springboot.cloud.sysadmin.organization.config.BusConfig; -import com.springboot.cloud.sysadmin.organization.dao.ResourceMapper; -import com.springboot.cloud.sysadmin.organization.entity.param.ResourceQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Resource; -import com.springboot.cloud.sysadmin.organization.entity.po.Role; -import com.springboot.cloud.sysadmin.organization.entity.po.RoleResource; -import com.springboot.cloud.sysadmin.organization.entity.po.User; -import com.springboot.cloud.sysadmin.organization.events.EventSender; -import com.springboot.cloud.sysadmin.organization.service.IResourceService; -import com.springboot.cloud.sysadmin.organization.service.IRoleResourceService; -import com.springboot.cloud.sysadmin.organization.service.IRoleService; -import com.springboot.cloud.sysadmin.organization.service.IUserService; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -@Service -@Slf4j -public class ResourceService extends ServiceImpl implements IResourceService { - - @Autowired - private IRoleResourceService roleResourceService; - - @Autowired - private IRoleService roleService; - - @Autowired - private IUserService userService; - - @Autowired - private EventSender eventSender; - - @Override - public boolean add(Resource resource) { - eventSender.send(BusConfig.RESOURCE_ROUTING_KEY, resource); - return this.save(resource); - } - - @Override - @Cached(name = "resource::", key = "#id", cacheType = CacheType.BOTH) - public boolean delete(String id) { - return this.removeById(id); - } - - @Override - @Cached(name = "resource::", key = "#resource.id", cacheType = CacheType.BOTH) - public boolean update(Resource resource) { - return this.updateById(resource); - } - - @Override - @Cached(name = "resource::", key = "#id", cacheType = CacheType.BOTH) - public Resource get(String id) { - return this.getById(id); - } - - @Override - public IPage query(Page page, ResourceQueryParam resourceQueryParam) { - QueryWrapper queryWrapper = resourceQueryParam.build(); - queryWrapper.eq(StringUtils.isNotBlank(resourceQueryParam.getName()), "name", resourceQueryParam.getName()); - queryWrapper.eq(StringUtils.isNotBlank(resourceQueryParam.getType()), "type", resourceQueryParam.getType()); - queryWrapper.eq(StringUtils.isNotBlank(resourceQueryParam.getUrl()), "url", resourceQueryParam.getUrl()); - queryWrapper.eq(StringUtils.isNotBlank(resourceQueryParam.getMethod()), "method", resourceQueryParam.getMethod()); - return this.page(page, queryWrapper); - } - - @Override - public List getAll() { - return this.list(); - } - - @Override - @Cached(name = "resource4user::", key = "#username", cacheType = CacheType.BOTH,expire = 5) - public List query(String username) { - //根据用户名查询到用户所拥有的角色 - User user = userService.getByUniqueId(username); - List roles = roleService.query(user.getId()); - //提取用户所拥有角色id列表 - Set roleIds = roles.stream().map(role -> role.getId()).collect(Collectors.toSet()); - //根据角色列表查询到角色的资源的关联关系 - List roleResources = roleResourceService.queryByRoleIds(roleIds); - //根据资源列表查询出所有资源对象 - Set resourceIds = roleResources.stream().map(roleResource -> roleResource.getResourceId()).collect(Collectors.toSet()); - //根据resourceId列表查询出resource对象 - List resources = (List) this.listByIds(resourceIds); - log.info("resources:{}",resources); - return resources; - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/RoleResourceService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/RoleResourceService.java deleted file mode 100644 index 79e73391..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/RoleResourceService.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service.impl; - -import com.alicp.jetcache.anno.CacheType; -import com.alicp.jetcache.anno.Cached; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.springboot.cloud.sysadmin.organization.dao.RoleResourceMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.RoleResource; -import com.springboot.cloud.sysadmin.organization.service.IRoleResourceService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -@Service -@Slf4j -public class RoleResourceService extends ServiceImpl implements IRoleResourceService { - - @Override - @Transactional - public boolean saveBatch(String roleId, Set resourceIds) { - if (CollectionUtils.isEmpty(resourceIds)) - return false; - removeByRoleId(roleId); - Set userRoles = resourceIds.stream().map(resourceId -> new RoleResource(roleId, resourceId)).collect(Collectors.toSet()); - return saveBatch(userRoles); - } - - @Override - @Transactional - public boolean removeByRoleId(String roleId) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(RoleResource::getRoleId, roleId); - return remove(queryWrapper); - } - - @Override - @Cached(area = "shortTime", name = "resource4role::", key = "#roleId", cacheType = CacheType.BOTH) - public Set queryByRoleId(String roleId) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("role_id", roleId); - List userRoleList = list(queryWrapper); - return userRoleList.stream().map(RoleResource::getResourceId).collect(Collectors.toSet()); - } - - @Override - public List queryByRoleIds(Set roleIds) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.in("role_id", roleIds); - return this.list(queryWrapper); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/RoleService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/RoleService.java deleted file mode 100644 index 0db04130..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/RoleService.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service.impl; - -import com.alicp.jetcache.anno.CacheInvalidate; -import com.alicp.jetcache.anno.CacheType; -import com.alicp.jetcache.anno.Cached; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.springboot.cloud.sysadmin.organization.dao.RoleMapper; -import com.springboot.cloud.sysadmin.organization.entity.param.RoleQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.Role; -import com.springboot.cloud.sysadmin.organization.exception.RoleNotFoundException; -import com.springboot.cloud.sysadmin.organization.service.IRoleResourceService; -import com.springboot.cloud.sysadmin.organization.service.IRoleService; -import com.springboot.cloud.sysadmin.organization.service.IUserRoleService; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Objects; -import java.util.Set; - -@Service -@Slf4j -public class RoleService extends ServiceImpl implements IRoleService { - - @Autowired - private IUserRoleService userRoleService; - - @Autowired - private IRoleResourceService roleResourceService; - - @Override - public boolean add(Role role) { - boolean isSuccess = this.save(role); - roleResourceService.saveBatch(role.getId(), role.getResourceIds()); - return isSuccess; - } - - @Override - @CacheInvalidate(name = "role::", key = "#id") - public boolean delete(String id) { - roleResourceService.removeByRoleId(id); - return this.removeById(id); - } - - @Override - @CacheInvalidate(name = "role::", key = "#role.id") - public boolean update(Role role) { - boolean isSuccess = this.updateById(role); - roleResourceService.saveBatch(role.getId(), role.getResourceIds()); - return isSuccess; - } - - @Override - @Cached(name = "role::", key = "#id", cacheType = CacheType.BOTH) - public Role get(String id) { - Role role = this.getById(id); - if (Objects.isNull(role)) { - throw new RoleNotFoundException("role not found with id:" + id); - } - role.setResourceIds(roleResourceService.queryByRoleId(id)); - return role; - } - - @Override - public List getAll() { - return this.list(); - } - - @Override - @Cached(name = "role4user::", key = "#userId", cacheType = CacheType.BOTH) - public List query(String userId) { - Set roleIds = userRoleService.queryByUserId(userId); - return (List) this.listByIds(roleIds); - } - - @Override - public IPage query(Page page, RoleQueryParam roleQueryParam) { - QueryWrapper queryWrapper = roleQueryParam.build(); - queryWrapper.eq(StringUtils.isNotBlank(roleQueryParam.getName()), "name", roleQueryParam.getName()); - queryWrapper.eq(StringUtils.isNotBlank(roleQueryParam.getCode()), "code", roleQueryParam.getCode()); - return this.page(page, queryWrapper); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/UserRoleService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/UserRoleService.java deleted file mode 100644 index 21d594d1..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/UserRoleService.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.springboot.cloud.sysadmin.organization.dao.UserRoleMapper; -import com.springboot.cloud.sysadmin.organization.entity.po.UserRole; -import com.springboot.cloud.sysadmin.organization.service.IUserRoleService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -@Service -@Slf4j -public class UserRoleService extends ServiceImpl implements IUserRoleService { - - @Override - @Transactional - public boolean saveBatch(String userId, Set roleIds) { - if (CollectionUtils.isEmpty(roleIds)) - return false; - removeByUserId(userId); - Set userRoles = roleIds.stream().map(roleId -> new UserRole(userId, roleId)).collect(Collectors.toSet()); - return saveBatch(userRoles); - } - - @Override - @Transactional - public boolean removeByUserId(String userId) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(UserRole::getUserId, userId); - return remove(queryWrapper); - } - - @Override - public Set queryByUserId(String userId) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("user_id", userId); - List userRoleList = list(queryWrapper); - return userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toSet()); - } -} diff --git a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/UserService.java b/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/UserService.java deleted file mode 100644 index 972506a3..00000000 --- a/sysadmin/organization/src/main/java/com/springboot/cloud/sysadmin/organization/service/impl/UserService.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.springboot.cloud.sysadmin.organization.service.impl; - -import com.alicp.jetcache.anno.CacheInvalidate; -import com.alicp.jetcache.anno.CacheType; -import com.alicp.jetcache.anno.Cached; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.springboot.cloud.sysadmin.organization.dao.UserMapper; -import com.springboot.cloud.sysadmin.organization.entity.param.UserQueryParam; -import com.springboot.cloud.sysadmin.organization.entity.po.User; -import com.springboot.cloud.sysadmin.organization.entity.vo.UserVo; -import com.springboot.cloud.sysadmin.organization.exception.UserNotFoundException; -import com.springboot.cloud.sysadmin.organization.service.IUserRoleService; -import com.springboot.cloud.sysadmin.organization.service.IUserService; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Objects; - -@Service -@Slf4j -public class UserService extends ServiceImpl implements IUserService { - - @Autowired - private IUserRoleService userRoleService; - - @Bean - public PasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); - } - - @Override - @Transactional - public boolean add(User user) { - if (StringUtils.isNotBlank(user.getPassword())) - user.setPassword(passwordEncoder().encode(user.getPassword())); - boolean inserts = this.save(user); - userRoleService.saveBatch(user.getId(), user.getRoleIds()); - return inserts; - } - - @Override - @Transactional - @CacheInvalidate(name = "user::", key = "#id") - public boolean delete(String id) { - this.removeById(id); - return userRoleService.removeByUserId(id); - } - - @Override - @Transactional - @CacheInvalidate(name = "user::", key = "#user.id") - public boolean update(User user) { - if (StringUtils.isNotBlank(user.getPassword())) - user.setPassword(passwordEncoder().encode(user.getPassword())); - boolean isSuccess = this.updateById(user); - userRoleService.saveBatch(user.getId(), user.getRoleIds()); - return isSuccess; - } - - @Override - @Cached(name = "user::", key = "#id", cacheType = CacheType.BOTH) - public UserVo get(String id) { - User user = this.getById(id); - if (Objects.isNull(user)) { - throw new UserNotFoundException("user not found with id:" + id); - } - user.setRoleIds(userRoleService.queryByUserId(id)); - return new UserVo(user); - } - - @Override - @Cached(name = "user::", key = "#uniqueId", cacheType = CacheType.BOTH) - public User getByUniqueId(String uniqueId) { - User user = this.getOne(new QueryWrapper() - .eq("username", uniqueId) - .or() - .eq("mobile", uniqueId)); - if (Objects.isNull(user)) { - throw new UserNotFoundException("user not found with uniqueId:" + uniqueId); - } - user.setRoleIds(userRoleService.queryByUserId(user.getId())); - return user; - } - - @Override - public IPage query(Page page, UserQueryParam userQueryParam) { - QueryWrapper queryWrapper = userQueryParam.build(); - queryWrapper.eq(StringUtils.isNotBlank(userQueryParam.getName()), "name", userQueryParam.getName()); - queryWrapper.eq(StringUtils.isNotBlank(userQueryParam.getUsername()), "username", userQueryParam.getUsername()); - queryWrapper.eq(StringUtils.isNotBlank(userQueryParam.getMobile()), "mobile", userQueryParam.getMobile()); - // 转换成VO - IPage iPageUser = this.page(page, queryWrapper); - return iPageUser.convert(UserVo::new); - } -} diff --git a/sysadmin/organization/src/main/resources/application-local.yml b/sysadmin/organization/src/main/resources/application-local.yml deleted file mode 100644 index 206f8339..00000000 --- a/sysadmin/organization/src/main/resources/application-local.yml +++ /dev/null @@ -1,126 +0,0 @@ -spring: - cloud: - bus: - trace: - enabled: true - rabbitmq: - host: ${RABBIT_MQ_HOST:localhost} - port: ${RABBIT_MQ_PORT:5672} - username: ${RABBIT_MQ_USERNAME:myuser} - password: ${RABBIT_MQ_PASSWORD:mypass} - redis: - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - lettuce: - pool: - max-active: 300 - #password: ${REDIS_PASSWORD:123456} - datasource: - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:${DATASOURCE_DBTYPE:mysql}://${DATASOURCE_HOST:localhost}:${DATASOURCE_PORT:3306}/sc_admin?characterEncoding=UTF-8&useUnicode=true&useSSL=false - username: ${DATASOURCE_USERNAME:root} - # password: ${DATASOURCE_PASSWORD:root123} - password: ${DATASOURCE_PASSWORD:123456} - zipkin: - enabled: true - sender: - type: rabbit - sleuth: - sampler: - probability: 1.0 - mvc: - throw-exception-if-no-handler-found: true - servlet: - multipart: - max-request-size: "2MB" - max-file-size: "2MB" - jackson: - time-zone: GMT+8 -# resources: -# add-mappings: false - -jetcache: - statIntervalMinutes: 15 - areaInCacheName: false - hidePackages: com.springboot.cloud - local: - # 默认2小时本地缓存 - default: - type: caffeine - keyConvertor: fastjson - expireAfterWriteInMillis: 3600000 - expireAfterAccessInMillis: 1800000 - # 長時本地緩存,主要用于要求时效一般 - longTime: - type: caffeine - keyConvertor: fastjson - expireAfterWriteInMillis: 300000 - expireAfterAccessInMillis: 180000 - # 短時本地緩存,主要用于要求时效较高的配置 - shortTime: - type: caffeine - keyConvertor: fastjson - expireAfterWriteInMillis: 60000 - expireAfterAccessInMillis: 40000 - remote: - # 默认2小时的远程缓存 - default: - type: redis - expireAfterWriteInMillis: 43200000 - keyConvertor: fastjson - valueEncoder: kryo - valueDecoder: kryo - poolConfig: - minIdle: 5 - maxIdle: 20 - maxTotal: 50 - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - # 长时远程緩存,主要用于要求时效要求一般的集中式缓存 - longTime: - type: redis - expireAfterWriteInMillis: 7200000 - keyConvertor: fastjson - valueEncoder: kryo - valueDecoder: kryo - poolConfig: - minIdle: 5 - maxIdle: 20 - maxTotal: 50 - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - # 短時远程緩存,主要用于要求时效较高的集中式缓存 - shortTime: - type: redis - expireAfterWriteInMillis: 300000 - keyConvertor: fastjson - valueEncoder: kryo - valueDecoder: kryo - poolConfig: - minIdle: 5 - maxIdle: 20 - maxTotal: 50 - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - -management: - endpoints: - web: - exposure: - include: '*' - -logging: - level: - com.springboot.cloud: debug - java.sql.PreparedStatement: debug - path: logs/ - file: - max-size: 1GB - -mybatis-plus: - configuration: - map-underscore-to-camel-case: true - global-config: - db-config: - logic-delete-value: "Y" # 逻辑已删除值(默认为 Y) - logic-not-delete-value: "N" # 逻辑未删除值(默认为 N) diff --git a/sysadmin/organization/src/main/resources/application.yml b/sysadmin/organization/src/main/resources/application.yml deleted file mode 100644 index 4d8d58ae..00000000 --- a/sysadmin/organization/src/main/resources/application.yml +++ /dev/null @@ -1,127 +0,0 @@ -spring: - profiles: - active: local - cloud: - bus: - trace: - enabled: true - rabbitmq: - host: ${RABBIT_MQ_HOST:localhost} - port: ${RABBIT_MQ_PORT:5672} - username: ${RABBIT_MQ_USERNAME:guest} - password: ${RABBIT_MQ_PASSWORD:guest} - redis: - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - lettuce: - pool: - max-active: 300 - #password: ${REDIS_PASSWORD:123456} - datasource: - driver-class-name: com.mysql.jdbc.Driver - url: jdbc:${DATASOURCE_DBTYPE:mysql}://${DATASOURCE_HOST:localhost}:${DATASOURCE_PORT:3306}/sc_admin?characterEncoding=UTF-8&useUnicode=true&useSSL=false - username: ${DATASOURCE_USERNAME:root} - password: ${DATASOURCE_PASSWORD:root123} - zipkin: - enabled: true - sender: - type: rabbit - sleuth: - sampler: - probability: 1.0 - mvc: - throw-exception-if-no-handler-found: true - servlet: - multipart: - max-request-size: "2MB" - max-file-size: "2MB" - jackson: - time-zone: GMT+8 -# resources: -# add-mappings: false - -jetcache: - statIntervalMinutes: 15 - areaInCacheName: false - hidePackages: com.springboot.cloud - local: - # 默认2小时本地缓存 - default: - type: caffeine - keyConvertor: fastjson - expireAfterWriteInMillis: 3600000 - expireAfterAccessInMillis: 1800000 - # 長時本地緩存,主要用于要求时效一般 - longTime: - type: caffeine - keyConvertor: fastjson - expireAfterWriteInMillis: 300000 - expireAfterAccessInMillis: 180000 - # 短時本地緩存,主要用于要求时效较高的配置 - shortTime: - type: caffeine - keyConvertor: fastjson - expireAfterWriteInMillis: 60000 - expireAfterAccessInMillis: 40000 - remote: - # 默认2小时的远程缓存 - default: - type: redis - expireAfterWriteInMillis: 43200000 - keyConvertor: fastjson - valueEncoder: kryo - valueDecoder: kryo - poolConfig: - minIdle: 5 - maxIdle: 20 - maxTotal: 50 - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - # 长时远程緩存,主要用于要求时效要求一般的集中式缓存 - longTime: - type: redis - expireAfterWriteInMillis: 7200000 - keyConvertor: fastjson - valueEncoder: kryo - valueDecoder: kryo - poolConfig: - minIdle: 5 - maxIdle: 20 - maxTotal: 50 - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - # 短時远程緩存,主要用于要求时效较高的集中式缓存 - shortTime: - type: redis - expireAfterWriteInMillis: 300000 - keyConvertor: fastjson - valueEncoder: kryo - valueDecoder: kryo - poolConfig: - minIdle: 5 - maxIdle: 20 - maxTotal: 50 - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - -management: - endpoints: - web: - exposure: - include: '*' - -logging: - level: - com.springboot.cloud: debug - java.sql.PreparedStatement: debug - path: logs/ - file: - max-size: 1GB - -mybatis-plus: - configuration: - map-underscore-to-camel-case: true - global-config: - db-config: - logic-delete-value: "Y" # 逻辑已删除值(默认为 Y) - logic-not-delete-value: "N" # 逻辑未删除值(默认为 N) diff --git a/sysadmin/organization/src/main/resources/bootstrap.yml b/sysadmin/organization/src/main/resources/bootstrap.yml deleted file mode 100644 index f81aa231..00000000 --- a/sysadmin/organization/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,12 +0,0 @@ -server: - port: ${SERVER_PORT:8010} -spring: - application: - name: organization - cloud: - nacos: - discovery: - server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848} - config: - server-addr: ${REGISTER_HOST:localhost}:${REGISTER_PORT:8848} - file-extension: yml diff --git a/sysadmin/pom.xml b/sysadmin/pom.xml deleted file mode 100644 index ad81ef1b..00000000 --- a/sysadmin/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - sysadmin - 0.0.1-SNAPSHOT - pom - - sysadmin - Demo Sysadmin project for Spring Boot - - - webapp-parent - com.springboot.cloud - 0.0.1-SNAPSHOT - ../webapps/webapp-parent/pom.xml - - - - organization - - \ No newline at end of file diff --git a/webapps/pom.xml b/webapps/pom.xml deleted file mode 100644 index e8f6252d..00000000 --- a/webapps/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - 4.0.0 - - webapps - pom - 0.0.1-SNAPSHOT - - webapps - Demo Webapps project for Spring Boot - - - cloud - com.springboot.cloud - 0.0.1-SNAPSHOT - - - - webapp-parent - - - - - org.springframework.boot - spring-boot-starter-web - - - - com.springboot.cloud - web - 0.0.1-SNAPSHOT - - - - com.alibaba - druid-spring-boot-starter - 1.1.9 - - - - mysql - mysql-connector-java - 8.0.28 - - - org.flywaydb - flyway-core - test - 5.1.3 - - - - io.springfox - springfox-swagger2 - 2.9.2 - - - io.springfox - springfox-swagger-ui - 2.9.2 - - - - - - - io.github.swagger2markup - swagger2markup-maven-plugin - 1.3.4 - - http://localhost:8001/v2/api-docs - src/main/docs/asciidoc/generated - - ASCIIDOC - - - - - - org.asciidoctor - asciidoctor-maven-plugin - 1.5.6 - - src/main/docs/asciidoc/generated - src/main/gst/asciidoc/html - html - coderay - - book - left - 3 - - - - - - - - - - - \ No newline at end of file diff --git a/webapps/webapp-parent/pom.xml b/webapps/webapp-parent/pom.xml deleted file mode 100644 index b7635495..00000000 --- a/webapps/webapp-parent/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 4.0.0 - - webapp-parent - pom - 0.0.1-SNAPSHOT - - - webapps - com.springboot.cloud - 0.0.1-SNAPSHOT - - - - - - com.baomidou - mybatis-plus-boot-starter - 3.1.0 - - - org.mybatis - mybatis-spring - 2.0.0 - - - - \ No newline at end of file From a16a9f146f3b2f7b1b920a97a9db986ccf6960fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Wed, 1 Jan 2025 15:13:44 +0800 Subject: [PATCH 37/46] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=90=E6=A8=A1?= =?UTF-8?q?=E5=9D=97examples?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 3 +++ examples | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 examples diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..f3e7d82a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "examples"] + path = examples + url = https://github.com/opensabre/examples.git diff --git a/examples b/examples new file mode 160000 index 00000000..e5b9e6f6 --- /dev/null +++ b/examples @@ -0,0 +1 @@ +Subproject commit e5b9e6f6ace51de688a8611570deec28357b0be8 From 485280c7ae6b584c054eef866bfc25ea5e08ac75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Wed, 1 Jan 2025 15:25:20 +0800 Subject: [PATCH 38/46] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E5=AD=90=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 3 +++ opensabre-framework | 1 + 2 files changed, 4 insertions(+) create mode 160000 opensabre-framework diff --git a/.gitmodules b/.gitmodules index f3e7d82a..cd918a11 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "examples"] path = examples url = https://github.com/opensabre/examples.git +[submodule "opensabre-framework"] + path = opensabre-framework + url = https://github.com/opensabre/opensabre-framework.git diff --git a/opensabre-framework b/opensabre-framework new file mode 160000 index 00000000..27dd9dd5 --- /dev/null +++ b/opensabre-framework @@ -0,0 +1 @@ +Subproject commit 27dd9dd57088f2b2cabaa5a6dbb1398013100180 From 79f429bfa2c2c9a130804fd3bd21a240531b09e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Wed, 1 Jan 2025 15:28:12 +0800 Subject: [PATCH 39/46] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=BB=84=E7=BB=87=E7=AE=A1=E7=90=86=E5=92=8C?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=8E=88=E6=9D=83=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 6 ++++++ base-authorization | 1 + base-organization | 1 + 3 files changed, 8 insertions(+) create mode 160000 base-authorization create mode 160000 base-organization diff --git a/.gitmodules b/.gitmodules index cd918a11..e8aaf80c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,9 @@ [submodule "opensabre-framework"] path = opensabre-framework url = https://github.com/opensabre/opensabre-framework.git +[submodule "base-authorization"] + path = base-authorization + url = https://github.com/opensabre/base-authorization.git +[submodule "base-organization"] + path = base-organization + url = https://github.com/opensabre/base-organization.git diff --git a/base-authorization b/base-authorization new file mode 160000 index 00000000..ad893d22 --- /dev/null +++ b/base-authorization @@ -0,0 +1 @@ +Subproject commit ad893d22d666788b57f5260f2df0e3fd1a3e5604 diff --git a/base-organization b/base-organization new file mode 160000 index 00000000..47122257 --- /dev/null +++ b/base-organization @@ -0,0 +1 @@ +Subproject commit 47122257d83b0e871576c96f6485a0c49cbb56c6 From 7c0166ee9275c32637d1a5a7115e7cdaad55beaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Wed, 1 Jan 2025 16:15:55 +0800 Subject: [PATCH 40/46] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E7=BD=91=E5=85=B3,=E5=9F=BA=E4=BA=8Espringcloud-gateway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 3 +++ base-gateway | 1 + 2 files changed, 4 insertions(+) create mode 160000 base-gateway diff --git a/.gitmodules b/.gitmodules index e8aaf80c..c9932314 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "base-organization"] path = base-organization url = https://github.com/opensabre/base-organization.git +[submodule "base-gateway"] + path = base-gateway + url = https://github.com/opensabre/base-gateway.git diff --git a/base-gateway b/base-gateway new file mode 160000 index 00000000..219afda5 --- /dev/null +++ b/base-gateway @@ -0,0 +1 @@ +Subproject commit 219afda5dddffd8579de24819eb7f559d6f120de From 98c3854dc6cd3e2c98e82b4a539fea8ca8650994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B6=9B?= Date: Wed, 1 Jan 2025 17:41:39 +0800 Subject: [PATCH 41/46] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cloud.ipr | 5738 ++++++++++++++++- cloud.iws | 222 +- demos/.project | 17 - demos/consumer-feign/.gitignore | 15 - demos/consumer-feign/pom.xml | 32 - .../demos/feign/FeignConsumerApplication.java | 15 - .../demos/feign/rest/ClassController.java | 26 - .../demos/feign/service/ClassService.java | 20 - .../feign/service/ClassServiceFallback.java | 20 - .../src/main/resources/application.yml | 44 - .../src/main/resources/bootstrap.yml | 18 - .../cloud/demos/feign/ApplicationTests.java | 16 - .../demos/feign/rest/ClassControllerTest.java | 31 - .../src/test/resources/application.yml | 28 - demos/consumer-ribbon/.gitignore | 16 - demos/consumer-ribbon/pom.xml | 27 - .../ribbon/RibbonConsumerApplication.java | 25 - .../demos/ribbon/rest/ClassController.java | 26 - .../demos/ribbon/service/ClassService.java | 35 - .../src/main/resources/application.yml | 34 - .../src/main/resources/bootstrap.yml | 18 - .../RibbonConsumerApplicationTests.java | 16 - demos/pom.xml | 38 - demos/producer-jpa/.gitignore | 24 - demos/producer-jpa/pom.xml | 136 - demos/producer-jpa/src/main/db/db.sql | 16 - demos/producer-jpa/src/main/docker/Dockerfile | 4 - .../producer/jpa/ProducerApplication.java | 15 - .../demos/producer/jpa/dao/ProductMapper.java | 9 - .../producer/jpa/entity/po/JpaBasePo.java | 18 - .../demos/producer/jpa/entity/po/Product.java | 29 - .../GlobalExceptionHandlerAdvice.java | 9 - .../src/main/resources/application.yml | 47 - .../src/main/resources/bootstrap.yml | 18 - .../jpa/rest/ProductControllerTests.java | 27 - .../src/test/resources/application.yml | 44 - demos/producer/.gitignore | 24 - demos/producer/pom.xml | 149 - demos/producer/src/main/db/db.sql | 16 - demos/producer/src/main/docker/Dockerfile | 4 - .../docs/asciidoc/generated/definitions.adoc | 141 - .../docs/asciidoc/generated/overview.adoc | 30 - .../main/docs/asciidoc/generated/paths.adoc | 283 - .../docs/asciidoc/generated/security.adoc | 2 - .../main/docs/asciidoc/html/definitions.html | 873 --- .../src/main/docs/asciidoc/html/overview.html | 581 -- .../src/main/docs/asciidoc/html/paths.html | 1259 ---- .../src/main/docs/asciidoc/html/security.html | 531 -- .../demos/producer/ProducerApplication.java | 15 - .../demos/producer/config/BusConfig.java | 47 - .../demos/producer/config/MyRedisConfig.java | 11 - .../demos/producer/config/MybatisConfig.java | 17 - .../demos/producer/config/SwaggerConfig.java | 35 - .../config/WebServerMvcConfigurerAdapter.java | 22 - .../demos/producer/dao/ProductMapper.java | 11 - .../producer/entity/form/ProductForm.java | 21 - .../entity/form/ProductQueryForm.java | 30 - .../entity/param/ProductQueryParam.java | 16 - .../demos/producer/entity/po/Product.java | 19 - .../demos/producer/events/BusReceiver.java | 22 - .../demos/producer/events/BusSender.java | 19 - .../demos/producer/events/RabbitReceiver.java | 18 - .../demos/producer/events/RedisReceiver.java | 22 - .../demos/producer/events/RedisSender.java | 34 - .../GlobalExceptionHandlerAdvice.java | 9 - .../interceptor/MyMetaObjectHandler.java | 51 - .../demos/producer/rest/FooController.java | 33 - .../demos/producer/rest/HelloController.java | 20 - .../producer/rest/ProductController.java | 84 - .../producer/service/IProductService.java | 45 - .../producer/service/ProductService.java | 55 - .../demos/producer/task/ScheduledTasks.java | 34 - .../src/main/resources/application.yml | 67 - .../producer/src/main/resources/bootstrap.yml | 18 - .../cloud/demos/producer/MvcMockTest.java | 18 - .../producer/rest/HelloControllerTests.java | 29 - .../producer/rest/ProductControllerTests.java | 29 - .../producer/service/ProductServiceTests.java | 23 - .../src/test/resources/application.yml | 42 - .../contracts/HelloController.groovy | 25 - docs/development.md | 101 - docs/grafana.png | Bin 260846 -> 0 bytes docs/kibana.png | Bin 186955 -> 0 bytes docs/pattern.md | 108 - docs/register-nacos.png | Bin 362626 -> 0 bytes docs/register.md | 104 - docs/register.png | Bin 16691 -> 0 bytes docs/zipkin-dependencies.png | Bin 24824 -> 0 bytes docs/zipkin-detail.png | Bin 332432 -> 0 bytes docs/zipkin-server.png | Bin 271339 -> 0 bytes readme.md | 219 +- 91 files changed, 5933 insertions(+), 6306 deletions(-) delete mode 100644 demos/.project delete mode 100644 demos/consumer-feign/.gitignore delete mode 100644 demos/consumer-feign/pom.xml delete mode 100644 demos/consumer-feign/src/main/java/com/springboot/cloud/demos/feign/FeignConsumerApplication.java delete mode 100644 demos/consumer-feign/src/main/java/com/springboot/cloud/demos/feign/rest/ClassController.java delete mode 100644 demos/consumer-feign/src/main/java/com/springboot/cloud/demos/feign/service/ClassService.java delete mode 100644 demos/consumer-feign/src/main/java/com/springboot/cloud/demos/feign/service/ClassServiceFallback.java delete mode 100644 demos/consumer-feign/src/main/resources/application.yml delete mode 100644 demos/consumer-feign/src/main/resources/bootstrap.yml delete mode 100644 demos/consumer-feign/src/test/java/com/springboot/cloud/demos/feign/ApplicationTests.java delete mode 100644 demos/consumer-feign/src/test/java/com/springboot/cloud/demos/feign/rest/ClassControllerTest.java delete mode 100644 demos/consumer-feign/src/test/resources/application.yml delete mode 100644 demos/consumer-ribbon/.gitignore delete mode 100644 demos/consumer-ribbon/pom.xml delete mode 100644 demos/consumer-ribbon/src/main/java/com/springboot/cloud/demos/ribbon/RibbonConsumerApplication.java delete mode 100644 demos/consumer-ribbon/src/main/java/com/springboot/cloud/demos/ribbon/rest/ClassController.java delete mode 100644 demos/consumer-ribbon/src/main/java/com/springboot/cloud/demos/ribbon/service/ClassService.java delete mode 100644 demos/consumer-ribbon/src/main/resources/application.yml delete mode 100644 demos/consumer-ribbon/src/main/resources/bootstrap.yml delete mode 100644 demos/consumer-ribbon/src/test/java/com/springboot/cloud/demos/ribbon/RibbonConsumerApplicationTests.java delete mode 100644 demos/pom.xml delete mode 100644 demos/producer-jpa/.gitignore delete mode 100644 demos/producer-jpa/pom.xml delete mode 100644 demos/producer-jpa/src/main/db/db.sql delete mode 100644 demos/producer-jpa/src/main/docker/Dockerfile delete mode 100644 demos/producer-jpa/src/main/java/com/springboot/cloud/demos/producer/jpa/ProducerApplication.java delete mode 100644 demos/producer-jpa/src/main/java/com/springboot/cloud/demos/producer/jpa/dao/ProductMapper.java delete mode 100644 demos/producer-jpa/src/main/java/com/springboot/cloud/demos/producer/jpa/entity/po/JpaBasePo.java delete mode 100644 demos/producer-jpa/src/main/java/com/springboot/cloud/demos/producer/jpa/entity/po/Product.java delete mode 100644 demos/producer-jpa/src/main/java/com/springboot/cloud/demos/producer/jpa/exception/GlobalExceptionHandlerAdvice.java delete mode 100644 demos/producer-jpa/src/main/resources/application.yml delete mode 100644 demos/producer-jpa/src/main/resources/bootstrap.yml delete mode 100644 demos/producer-jpa/src/test/java/com/springboot/cloud/demos/producer/jpa/rest/ProductControllerTests.java delete mode 100644 demos/producer-jpa/src/test/resources/application.yml delete mode 100644 demos/producer/.gitignore delete mode 100644 demos/producer/pom.xml delete mode 100644 demos/producer/src/main/db/db.sql delete mode 100644 demos/producer/src/main/docker/Dockerfile delete mode 100644 demos/producer/src/main/docs/asciidoc/generated/definitions.adoc delete mode 100644 demos/producer/src/main/docs/asciidoc/generated/overview.adoc delete mode 100644 demos/producer/src/main/docs/asciidoc/generated/paths.adoc delete mode 100644 demos/producer/src/main/docs/asciidoc/generated/security.adoc delete mode 100644 demos/producer/src/main/docs/asciidoc/html/definitions.html delete mode 100644 demos/producer/src/main/docs/asciidoc/html/overview.html delete mode 100644 demos/producer/src/main/docs/asciidoc/html/paths.html delete mode 100644 demos/producer/src/main/docs/asciidoc/html/security.html delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/ProducerApplication.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/config/BusConfig.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/config/MyRedisConfig.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/config/MybatisConfig.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/config/SwaggerConfig.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/config/WebServerMvcConfigurerAdapter.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/dao/ProductMapper.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/entity/form/ProductForm.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/entity/form/ProductQueryForm.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/entity/param/ProductQueryParam.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/entity/po/Product.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/events/BusReceiver.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/events/BusSender.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/events/RabbitReceiver.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/events/RedisReceiver.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/events/RedisSender.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/exception/GlobalExceptionHandlerAdvice.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/interceptor/MyMetaObjectHandler.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/rest/FooController.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/rest/HelloController.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/rest/ProductController.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/service/IProductService.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/service/ProductService.java delete mode 100644 demos/producer/src/main/java/com/springboot/cloud/demos/producer/task/ScheduledTasks.java delete mode 100644 demos/producer/src/main/resources/application.yml delete mode 100644 demos/producer/src/main/resources/bootstrap.yml delete mode 100644 demos/producer/src/test/java/com/springboot/cloud/demos/producer/MvcMockTest.java delete mode 100644 demos/producer/src/test/java/com/springboot/cloud/demos/producer/rest/HelloControllerTests.java delete mode 100644 demos/producer/src/test/java/com/springboot/cloud/demos/producer/rest/ProductControllerTests.java delete mode 100644 demos/producer/src/test/java/com/springboot/cloud/demos/producer/service/ProductServiceTests.java delete mode 100644 demos/producer/src/test/resources/application.yml delete mode 100644 demos/producer/src/test/resources/contracts/HelloController.groovy delete mode 100644 docs/development.md delete mode 100644 docs/grafana.png delete mode 100644 docs/kibana.png delete mode 100644 docs/pattern.md delete mode 100644 docs/register-nacos.png delete mode 100644 docs/register.md delete mode 100644 docs/register.png delete mode 100644 docs/zipkin-dependencies.png delete mode 100644 docs/zipkin-detail.png delete mode 100644 docs/zipkin-server.png diff --git a/cloud.ipr b/cloud.ipr index 72b916e6..2c8f3f08 100644 --- a/cloud.ipr +++ b/cloud.ipr @@ -4,6 +4,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -63,7 +105,10 @@ @@ -71,10 +116,21 @@ - + + + + + + + + + - + + + + @@ -109,4 +165,5682 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cloud.iws b/cloud.iws index fc9b96a8..a7f9f449 100644 --- a/cloud.iws +++ b/cloud.iws @@ -5,80 +5,97 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +