From 4a47e4b93f62b5e636ac0e76f3e4ee98e2b83154 Mon Sep 17 00:00:00 2001 From: houzhongjian <houzhongyi@126.com> Date: 星期五, 02 八月 2024 08:32:55 +0800 Subject: [PATCH] 1、全局配置文件修改 2、工作流bpm功能修改 --- iailab-cloud/iailab-xxl-job/src/main/resources/logback.xml | 6 iailab-module-data/iailab-module-data-biz/src/test/java/com/iailab/InfluxDBTest.java | 8 iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-local.yaml | 21 - iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/dal/dataobject/definition/BpmUserGroupDO.java | 4 iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-dev.yaml | 55 ++- iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java | 5 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/framework/file/core/client/s3/S3FileClient.java | 13 iailab-module-model/iailab-module-model-biz/src/main/resources/application-dev.yml | 4 iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application-dev.yaml | 44 ++ iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java | 14 iailab-module-bpm/iailab-module-bpm-biz/pom.xml | 16 iailab-cloud/iailab-nacos/src/main/resources/application.yaml | 2 iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/core/redis/TenantRedisCacheManager.java | 12 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java | 4 iailab-cloud/iailab-xxl-job/src/main/resources/application.yaml | 20 + iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application-local.yaml | 3 iailab-module-bpm/iailab-module-bpm-api/src/main/java/com/iailab/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java | 2 iailab-module-report/iailab-module-report-biz/src/main/resources/application-local.yaml | 7 iailab-cloud/iailab-gateway/src/main/resources/application.yaml | 29 + iailab-module-data/iailab-module-data-biz/src/main/resources/application-local.yml | 17 - iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/definition/BpmProcessDefinitionServiceImpl.java | 7 iailab-framework/iailab-common-web/src/main/java/com/iailab/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java | 36 ++ iailab-module-infra/iailab-module-infra-biz/src/main/resources/application.yaml | 20 + iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml | 20 + iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/IailabTenantAutoConfiguration.java | 5 iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application.yaml | 35 ++ iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/convert/task/BpmProcessInstanceConvert.java | 3 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/service/config/ConfigService.java | 2 iailab-module-data/iailab-module-data-biz/pom.xml | 32 + iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/TenantProperties.java | 7 iailab-cloud/iailab-nacos/pom.xml | 6 pom.xml | 7 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java | 4 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/framework/file/core/client/s3/S3FileClientConfig.java | 1 iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/mybatis/core/mapper/BaseMapperX.java | 2 iailab-module-bpm/iailab-module-bpm-api/src/main/java/com/iailab/module/bpm/enums/DictTypeConstants.java | 4 iailab-module-report/iailab-module-report-biz/pom.xml | 4 iailab-module-report/iailab-module-report-biz/src/main/resources/bootstrap.yaml | 2 iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/task/BpmTaskServiceImpl.java | 1 iailab-module-data/iailab-module-data-biz/src/test/java/com/iailab/OadpTagCollectorTest.java | 81 ++-- iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml | 2 iailab-framework/iailab-common-biz-ip/src/main/java/com/iailab/framework/ip/core/Area.java | 5 iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/config/ConfigController.java | 2 iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/core/service/SecurityFrameworkServiceImpl.java | 18 iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/definition/BpmModelServiceImpl.java | 5 iailab-module-model/iailab-module-model-biz/src/main/resources/application-local.yml | 17 - iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/OadpTagCollectorTest.java | 81 ++-- /dev/null | 16 - iailab-cloud/iailab-xxl-job/pom.xml | 4 iailab-module-data/iailab-module-data-biz/src/main/resources/application.yml | 20 + iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/config/ConfigApiImpl.java | 7 iailab-module-report/iailab-module-report-biz/src/main/resources/application.yaml | 40 ++ iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml | 35 +- iailab-module-model/iailab-module-model-biz/pom.xml | 44 ++ iailab-module-report/iailab-module-report-biz/src/main/resources/bootstrap-local.yaml | 2 iailab-module-system/iailab-module-system-biz/src/main/resources/application.yaml | 30 + 56 files changed, 577 insertions(+), 316 deletions(-) diff --git a/iailab-cloud/iailab-gateway/src/main/resources/application-local.yaml b/iailab-cloud/iailab-gateway/src/main/resources/application-local.yaml deleted file mode 100644 index 9d47283..0000000 --- a/iailab-cloud/iailab-gateway/src/main/resources/application-local.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- #################### 注册中心 + 配置中心相关配置 #################### -spring: - cloud: - nacos: - server-addr: 127.0.0.1:8848 # Nacos 服务器地址 - username: nacos - password: nacos - discovery: # 【配置中心】配置项 - namespace: a7112341-c9e2-4177-bc5b-0d2e8cf0b3bb # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP - config: # 【注册中心】配置项 - namespace: a7112341-c9e2-4177-bc5b-0d2e8cf0b3bb # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP - -# 日志文件配置 -logging: - level: - org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿:先禁用,Spring Boot 3.X 存在部分错误的 WARN 提示 diff --git a/iailab-cloud/iailab-gateway/src/main/resources/application.yaml b/iailab-cloud/iailab-gateway/src/main/resources/application.yaml index 846d4de..f158874 100644 --- a/iailab-cloud/iailab-gateway/src/main/resources/application.yaml +++ b/iailab-cloud/iailab-gateway/src/main/resources/application.yaml @@ -2,11 +2,11 @@ application: name: gateway-server - profiles: - active: local - main: allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 + + profiles: + active: @profiles.active@ config: import: @@ -14,6 +14,20 @@ - optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置 cloud: + nacos: + server-addr: @nacos.server@ # Nacos 服务器地址 + username: @nacos.username@ + password: @nacos.password@ + discovery: # 【配置中心】配置项 + namespace: @profiles.active@ + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + metadata: + version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 + management.context-path: ${server.servlet.context-path}/actuator + config: # 【注册中心】配置项 + namespace: @profiles.active@ + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + # Spring Cloud Gateway 配置项,对应 GatewayProperties 类 gateway: # 路由配置项,对应 RouteDefinition 数组 @@ -109,7 +123,7 @@ logging: file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 + name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径 knife4j: # 聚合 Swagger 文档,参考 https://doc.xiaominfo.com/docs/action/springcloud-gateway 文档 @@ -148,4 +162,9 @@ include: "*" endpoint: health: - show-details: always \ No newline at end of file + show-details: always + +# 日志文件配置 +logging: + level: + org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿:先禁用,Spring Boot 3.X 存在部分错误的 WARN 提示 \ No newline at end of file diff --git a/iailab-cloud/iailab-nacos/pom.xml b/iailab-cloud/iailab-nacos/pom.xml index b8d71da..d653570 100644 --- a/iailab-cloud/iailab-nacos/pom.xml +++ b/iailab-cloud/iailab-nacos/pom.xml @@ -29,8 +29,6 @@ <properties> <nacos.version>2.3.2</nacos.version> <!-- 需要与 Nacos 内置 Boot 版本保持一致 --> - <spring-boot.version>2.7.18</spring-boot.version> - <spring-boot-admin.version>2.7.15</spring-boot-admin.version> <nacos.lib.path>${project.basedir}/src/main/resources/lib</nacos.lib.path> </properties> @@ -40,7 +38,7 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> - <version>${spring-boot.version}</version> + <version>${spring.boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> @@ -321,7 +319,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>${spring-boot.version}</version> + <version>${spring.boot.version}</version> <executions> <execution> <goals> diff --git a/iailab-cloud/iailab-nacos/src/main/resources/application.yaml b/iailab-cloud/iailab-nacos/src/main/resources/application.yaml index 91b9139..89c04a6 100644 --- a/iailab-cloud/iailab-nacos/src/main/resources/application.yaml +++ b/iailab-cloud/iailab-nacos/src/main/resources/application.yaml @@ -1,7 +1,7 @@ db: num: 1 url: - '0': jdbc:mysql://localhost:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true + '0': jdbc:mysql://172.16.8.100:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true password: '0': 123456 user: diff --git a/iailab-cloud/iailab-xxl-job/pom.xml b/iailab-cloud/iailab-xxl-job/pom.xml index 326b2a2..33e9afe 100644 --- a/iailab-cloud/iailab-xxl-job/pom.xml +++ b/iailab-cloud/iailab-xxl-job/pom.xml @@ -25,7 +25,7 @@ <gson.version>2.10.1</gson.version> <spring.version>5.3.34</spring.version> - <spring-boot.version>2.7.18</spring-boot.version> +<!-- <spring-boot.version>2.7.18</spring-boot.version>--> <mybatis-spring-boot-starter.version>2.3.2</mybatis-spring-boot-starter.version> <mysql-connector-j.version>8.3.0</mysql-connector-j.version> @@ -125,7 +125,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>${spring-boot.version}</version> + <version>${spring.boot.version}</version> <executions> <execution> <goals> diff --git a/iailab-cloud/iailab-xxl-job/src/main/resources/application-local.yaml b/iailab-cloud/iailab-xxl-job/src/main/resources/application-local.yaml deleted file mode 100644 index dd84d4d..0000000 --- a/iailab-cloud/iailab-xxl-job/src/main/resources/application-local.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- #################### 注册中心 + 配置中心相关配置 #################### -spring: - cloud: - nacos: - server-addr: @nacos.server@ # Nacos 服务器地址 - username: @nacos.username@ - password: @nacos.password@ - discovery: # 【配置中心】配置项 - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP - metadata: - version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 - management.context-path: ${server.servlet.context-path}/actuator - config: # 【注册中心】配置项 - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP diff --git a/iailab-cloud/iailab-xxl-job/src/main/resources/application.yaml b/iailab-cloud/iailab-xxl-job/src/main/resources/application.yaml index 115d06d..2e01529 100644 --- a/iailab-cloud/iailab-xxl-job/src/main/resources/application.yaml +++ b/iailab-cloud/iailab-xxl-job/src/main/resources/application.yaml @@ -5,7 +5,7 @@ logging: file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 + name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径 spring: application: @@ -13,7 +13,23 @@ profiles: # 环境配置 # active: @profiles.active@ - active: local + active: @profiles.active@ + + cloud: + nacos: + server-addr: @nacos.server@ # Nacos 服务器地址 + username: @nacos.username@ + password: @nacos.password@ + discovery: # 【配置中心】配置项 + namespace: @profiles.active@ # 命名空间。这里使用 dev 开发环境 + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + metadata: + version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 + management.context-path: ${server.servlet.context-path}/actuator + config: # 【注册中心】配置项 + namespace: @profiles.active@ # 命名空间。这里使用 dev 开发环境 + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + # Spring Boot Admin 配置项 boot: admin: diff --git a/iailab-cloud/iailab-xxl-job/src/main/resources/logback.xml b/iailab-cloud/iailab-xxl-job/src/main/resources/logback.xml index 4206db9..55c7617 100644 --- a/iailab-cloud/iailab-xxl-job/src/main/resources/logback.xml +++ b/iailab-cloud/iailab-xxl-job/src/main/resources/logback.xml @@ -2,7 +2,7 @@ <configuration debug="false" scan="true" scanPeriod="1 seconds"> <contextName>logback</contextName> - <property name="log.path" value="/sda2/data/applogs/xxl-job/xxl-job-admin.log"/> + <property name="xxl-job-log.path" value="/data/applogs/xxl-job/xxl-job-admin.log"/> <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <encoder> @@ -11,9 +11,9 @@ </appender> <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.path}</file> + <file>${xxl-job-log.path}</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern> + <fileNamePattern>${xxl-job-log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern> </rollingPolicy> <encoder> <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n diff --git a/iailab-framework/iailab-common-biz-ip/src/main/java/com/iailab/framework/ip/core/Area.java b/iailab-framework/iailab-common-biz-ip/src/main/java/com/iailab/framework/ip/core/Area.java index 2f94e55..fba926e 100644 --- a/iailab-framework/iailab-common-biz-ip/src/main/java/com/iailab/framework/ip/core/Area.java +++ b/iailab-framework/iailab-common-biz-ip/src/main/java/com/iailab/framework/ip/core/Area.java @@ -1,9 +1,11 @@ package com.iailab.framework.ip.core; +import com.fasterxml.jackson.annotation.JsonManagedReference; import com.iailab.framework.ip.core.enums.AreaTypeEnum; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import lombok.ToString; import java.util.List; @@ -17,6 +19,7 @@ @Data @AllArgsConstructor @NoArgsConstructor +@ToString(exclude = {"parent"}) public class Area { /** @@ -46,10 +49,12 @@ /** * 父节点 */ + @JsonManagedReference private Area parent; /** * 子节点 */ + @JsonManagedReference private List<Area> children; } diff --git a/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/IailabTenantAutoConfiguration.java b/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/IailabTenantAutoConfiguration.java index 79c8067..285c740 100644 --- a/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/IailabTenantAutoConfiguration.java +++ b/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/IailabTenantAutoConfiguration.java @@ -133,12 +133,13 @@ @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean public RedisCacheManager tenantRedisCacheManager(RedisTemplate<String, Object> redisTemplate, RedisCacheConfiguration redisCacheConfiguration, - IailabCacheProperties iailabCacheProperties) { + IailabCacheProperties iailabCacheProperties, + TenantProperties tenantProperties) { // 创建 RedisCacheWriter 对象 RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, BatchStrategies.scan(iailabCacheProperties.getRedisScanBatchSize())); // 创建 TenantRedisCacheManager 对象 - return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration); + return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration, tenantProperties.getIgnoreCaches()); } } diff --git a/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/TenantProperties.java b/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/TenantProperties.java index 18d5a6c..4fc2ddf 100644 --- a/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/TenantProperties.java +++ b/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/config/TenantProperties.java @@ -39,4 +39,11 @@ */ private Set<String> ignoreTables = Collections.emptySet(); + /** + * 需要忽略多租户的 Spring Cache 缓存 + * + * 即默认所有缓存都开启多租户的功能,所以记得添加对应的 tenant_id 字段哟 + */ + private Set<String> ignoreCaches = Collections.emptySet(); + } diff --git a/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/core/redis/TenantRedisCacheManager.java b/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/core/redis/TenantRedisCacheManager.java index 00d821d..9394cf2 100644 --- a/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/core/redis/TenantRedisCacheManager.java +++ b/iailab-framework/iailab-common-biz-tenant/src/main/java/com/iailab/framework/tenant/core/redis/TenantRedisCacheManager.java @@ -1,5 +1,6 @@ package com.iailab.framework.tenant.core.redis; +import cn.hutool.core.collection.CollUtil; import com.iailab.framework.redis.core.TimeoutRedisCacheManager; import com.iailab.framework.tenant.core.context.TenantContextHolder; import lombok.extern.slf4j.Slf4j; @@ -7,6 +8,8 @@ import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheWriter; + +import java.util.Set; /** * 多租户的 {@link RedisCacheManager} 实现类 @@ -18,16 +21,21 @@ @Slf4j public class TenantRedisCacheManager extends TimeoutRedisCacheManager { + private final Set<String> ignoreCaches; + public TenantRedisCacheManager(RedisCacheWriter cacheWriter, - RedisCacheConfiguration defaultCacheConfiguration) { + RedisCacheConfiguration defaultCacheConfiguration, + Set<String> ignoreCaches) { super(cacheWriter, defaultCacheConfiguration); + this.ignoreCaches = ignoreCaches; } @Override public Cache getCache(String name) { // 如果开启多租户,则 name 拼接租户后缀 if (!TenantContextHolder.isIgnore() - && TenantContextHolder.getTenantId() != null) { + && TenantContextHolder.getTenantId() != null + && !CollUtil.contains(ignoreCaches, name)) { name = name + ":" + TenantContextHolder.getTenantId(); } diff --git a/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/mybatis/core/mapper/BaseMapperX.java b/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/mybatis/core/mapper/BaseMapperX.java index 0924bf0..b8ae784 100644 --- a/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/mybatis/core/mapper/BaseMapperX.java +++ b/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/mybatis/core/mapper/BaseMapperX.java @@ -56,7 +56,7 @@ default <D> PageResult<D> selectJoinPage(PageParam pageParam, Class<D> clazz, MPJLambdaWrapper<T> lambdaWrapper) { // 特殊:不分页,直接查询全部 - if (PageParam.PAGE_SIZE_NONE.equals(pageParam.getPageNo())) { + if (PageParam.PAGE_SIZE_NONE.equals(pageParam.getPageSize())) { List<D> list = selectJoinList(clazz, lambdaWrapper); return new PageResult<>(list, (long) list.size()); } diff --git a/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/core/service/SecurityFrameworkServiceImpl.java b/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/core/service/SecurityFrameworkServiceImpl.java index cdfe90c..c4e4ec1 100644 --- a/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/core/service/SecurityFrameworkServiceImpl.java +++ b/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/core/service/SecurityFrameworkServiceImpl.java @@ -1,13 +1,7 @@ package com.iailab.framework.security.core.service; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.ListUtil; -import cn.hutool.core.util.ArrayUtil; -import cn.hutool.core.util.HashUtil; -import cn.hutool.core.util.ObjectUtil; import com.iailab.framework.common.core.KeyValue; -import com.iailab.framework.common.pojo.CommonResult; -import com.iailab.framework.common.util.cache.CacheUtils; import com.iailab.framework.security.core.LoginUser; import com.iailab.framework.security.core.util.SecurityFrameworkUtils; import com.iailab.module.system.api.permission.PermissionApi; @@ -70,7 +64,11 @@ @Override @SneakyThrows public boolean hasAnyPermissions(String... permissions) { - return hasAnyPermissionsCache.get(new KeyValue<>(getLoginUserId(), Arrays.asList(permissions))); + Long userId = getLoginUserId(); + if (userId == null) { + return false; + } + return hasAnyPermissionsCache.get(new KeyValue<>(userId, Arrays.asList(permissions))); } @Override @@ -81,7 +79,11 @@ @Override @SneakyThrows public boolean hasAnyRoles(String... roles) { - return hasAnyRolesCache.get(new KeyValue<>(getLoginUserId(), Arrays.asList(roles))); + Long userId = getLoginUserId(); + if (userId == null) { + return false; + } + return hasAnyRolesCache.get(new KeyValue<>(userId, Arrays.asList(roles))); } @Override diff --git a/iailab-framework/iailab-common-web/src/main/java/com/iailab/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java b/iailab-framework/iailab-common-web/src/main/java/com/iailab/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java index dffe38d..f22500a 100644 --- a/iailab-framework/iailab-common-web/src/main/java/com/iailab/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java +++ b/iailab-framework/iailab-common-web/src/main/java/com/iailab/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java @@ -1,6 +1,8 @@ package com.iailab.framework.apilog.core.interceptor; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.resource.ResourceUtil; import cn.hutool.core.util.StrUtil; import com.iailab.framework.common.util.servlet.ServletUtils; import com.iailab.framework.common.util.spring.SpringUtils; @@ -11,7 +13,11 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.lang.reflect.Method; +import java.util.List; import java.util.Map; +import java.util.Optional; +import java.util.stream.IntStream; /** * API 访问日志 Interceptor @@ -49,6 +55,8 @@ StopWatch stopWatch = new StopWatch(); stopWatch.start(); request.setAttribute(ATTRIBUTE_STOP_WATCH, stopWatch); + // 打印 Controller 路径 + printHandlerMethodPosition(handlerMethod); } return true; } @@ -64,4 +72,32 @@ } } + /** + * 打印 Controller 方法路径 + */ + private void printHandlerMethodPosition(HandlerMethod handlerMethod) { + if (handlerMethod == null) { + return; + } + Method method = handlerMethod.getMethod(); + Class<?> clazz = method.getDeclaringClass(); + try { + // 获取 method 的 lineNumber + List<String> clazzContents = FileUtil.readUtf8Lines( + ResourceUtil.getResource(null, clazz).getPath().replace("/target/classes/", "/src/main/java/") + + clazz.getSimpleName() + ".java"); + Optional<Integer> lineNumber = IntStream.range(0, clazzContents.size()) + .filter(i -> clazzContents.get(i).contains(" " + method.getName() + "(")) // 简单匹配,不考虑方法重名 + .mapToObj(i -> i + 1) // 行号从 1 开始 + .findFirst(); + if (!lineNumber.isPresent()) { + return; + } + // 打印结果 + System.out.printf("\tController 方法路径:%s(%s.java:%d)\n", clazz.getName(), clazz.getSimpleName(), lineNumber.get()); + } catch (Exception ignore) { + // 忽略异常。原因:仅仅打印,非重要逻辑 + } + } + } diff --git a/iailab-module-bpm/iailab-module-bpm-api/src/main/java/com/iailab/module/bpm/enums/DictTypeConstants.java b/iailab-module-bpm/iailab-module-bpm-api/src/main/java/com/iailab/module/bpm/enums/DictTypeConstants.java index f489ab0..132ff9b 100644 --- a/iailab-module-bpm/iailab-module-bpm-api/src/main/java/com/iailab/module/bpm/enums/DictTypeConstants.java +++ b/iailab-module-bpm/iailab-module-bpm-api/src/main/java/com/iailab/module/bpm/enums/DictTypeConstants.java @@ -7,7 +7,7 @@ */ public interface DictTypeConstants { - String TASK_ASSIGN_RULE_TYPE = "bpm_task_assign_rule_type"; // 任务分配规则类型 - String TASK_ASSIGN_SCRIPT = "bpm_task_assign_script"; // 任务分配自定义脚本 +// String TASK_ASSIGN_RULE_TYPE = "bpm_task_assign_rule_type"; // 任务分配规则类型 +// String TASK_ASSIGN_SCRIPT = "bpm_task_assign_script"; // 任务分配自定义脚本 } diff --git a/iailab-module-bpm/iailab-module-bpm-api/src/main/java/com/iailab/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java b/iailab-module-bpm/iailab-module-bpm-api/src/main/java/com/iailab/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java index 9da1a68..a63df43 100644 --- a/iailab-module-bpm/iailab-module-bpm-api/src/main/java/com/iailab/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java +++ b/iailab-module-bpm/iailab-module-bpm-api/src/main/java/com/iailab/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java @@ -33,7 +33,7 @@ @Override public int[] array() { - return new int[0]; + return ARRAYS; } } diff --git a/iailab-module-bpm/iailab-module-bpm-biz/pom.xml b/iailab-module-bpm/iailab-module-bpm-biz/pom.xml index 67b05d5..4d11427 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/pom.xml +++ b/iailab-module-bpm/iailab-module-bpm-biz/pom.xml @@ -18,8 +18,8 @@ <dependencies> <!-- Spring Cloud 基础 --> <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-bootstrap</artifactId> + <groupId>com.iailab</groupId> + <artifactId>iailab-common-env</artifactId> </dependency> <dependency> @@ -106,10 +106,22 @@ <dependency> <groupId>org.flowable</groupId> <artifactId>flowable-spring-boot-starter-process</artifactId> + <exclusions> + <exclusion> + <groupId>org.mybatis</groupId> + <artifactId>mybatis</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.flowable</groupId> <artifactId>flowable-spring-boot-starter-actuator</artifactId> + <exclusions> + <exclusion> + <groupId>org.mybatis</groupId> + <artifactId>mybatis</artifactId> + </exclusion> + </exclusions> </dependency> </dependencies> diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java index 8d6d710..9e83900 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java @@ -77,7 +77,6 @@ @GetMapping ("/list") @Operation(summary = "获得流程定义列表") @Parameter(name = "suspensionState", description = "挂起状态", required = true, example = "1") // 参见 Flowable SuspensionState 枚举 - @PreAuthorize("@ss.hasPermission('bpm:process-definition:query')") public CommonResult<List<BpmProcessDefinitionRespVO>> getProcessDefinitionList( @RequestParam("suspensionState") Integer suspensionState) { List<ProcessDefinition> list = processDefinitionService.getProcessDefinitionListBySuspensionState(suspensionState); @@ -96,7 +95,6 @@ @Operation(summary = "获得流程定义") @Parameter(name = "id", description = "流程编号", required = true, example = "1024") @Parameter(name = "key", description = "流程定义标识", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('bpm:process-definition:query')") public CommonResult<BpmProcessDefinitionRespVO> getProcessDefinition( @RequestParam(value = "id", required = false) String id, @RequestParam(value = "key", required = false) String key) { @@ -105,10 +103,11 @@ if (processDefinition == null) { return success(null); } + BpmProcessDefinitionInfoDO processDefinitionInfo = processDefinitionService.getProcessDefinitionInfo(processDefinition.getId()); BpmnModel bpmnModel = processDefinitionService.getProcessDefinitionBpmnModel(processDefinition.getId()); List<UserTask> userTaskList = BpmTaskCandidateStartUserSelectStrategy.getStartUserSelectUserTaskList(bpmnModel); return success(BpmProcessDefinitionConvert.INSTANCE.buildProcessDefinition( - processDefinition, null, null, null, null, bpmnModel, userTaskList)); + processDefinition, null, processDefinitionInfo, null, null, bpmnModel, userTaskList)); } } diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/convert/task/BpmProcessInstanceConvert.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/convert/task/BpmProcessInstanceConvert.java index e0682be..84dfc43 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/convert/task/BpmProcessInstanceConvert.java +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/convert/task/BpmProcessInstanceConvert.java @@ -47,7 +47,8 @@ BpmProcessInstanceRespVO respVO = vpPageResult.getList().get(i); respVO.setStatus(FlowableUtils.getProcessInstanceStatus(pageResult.getList().get(i))); MapUtils.findAndThen(processDefinitionMap, respVO.getProcessDefinitionId(), - processDefinition -> respVO.setCategory(processDefinition.getCategory())); + processDefinition -> respVO.setCategory(processDefinition.getCategory()) + .setProcessDefinition(BeanUtils.toBean(processDefinition, BpmProcessDefinitionRespVO.class))); MapUtils.findAndThen(categoryMap, respVO.getCategory(), category -> respVO.setCategoryName(category.getName())); respVO.setTasks(BeanUtils.toBean(taskMap.get(respVO.getId()), BpmProcessInstanceRespVO.Task.class)); // user diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/dal/dataobject/definition/BpmUserGroupDO.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/dal/dataobject/definition/BpmUserGroupDO.java index 5c4ebb7..e45dea7 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/dal/dataobject/definition/BpmUserGroupDO.java +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/dal/dataobject/definition/BpmUserGroupDO.java @@ -1,8 +1,8 @@ package com.iailab.module.bpm.dal.dataobject.definition; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.iailab.framework.common.enums.CommonStatusEnum; import com.iailab.framework.mybatis.core.dataobject.BaseDO; -import com.iailab.framework.mybatis.core.type.JsonLongSetTypeHandler; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -47,7 +47,7 @@ /** * 成员用户编号数组 */ - @TableField(typeHandler = JsonLongSetTypeHandler.class) + @TableField(typeHandler = JacksonTypeHandler.class) private Set<Long> userIds; } diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/definition/BpmModelServiceImpl.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/definition/BpmModelServiceImpl.java index 5fc0e1a..d611acd 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/definition/BpmModelServiceImpl.java +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/definition/BpmModelServiceImpl.java @@ -77,8 +77,11 @@ if (count == 0) { return PageResult.empty(count); } + // 关闭多租户查询,不添加tenantId条件 + if (StrUtil.isNotBlank(FlowableUtils.getTenantId())) { + modelQuery.modelTenantId(FlowableUtils.getTenantId()); + } List<Model> models = modelQuery - .modelTenantId(FlowableUtils.getTenantId()) .orderByCreateTime().desc() .listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); return new PageResult<>(models, count); diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/definition/BpmProcessDefinitionServiceImpl.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/definition/BpmProcessDefinitionServiceImpl.java index 9f2de67..a59f234 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/definition/BpmProcessDefinitionServiceImpl.java +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/definition/BpmProcessDefinitionServiceImpl.java @@ -195,7 +195,12 @@ query.active(); } // 执行查询 - query.processDefinitionTenantId(FlowableUtils.getTenantId()); + // 关闭多租户查询,不添加tenantId条件 + if (StrUtil.isNotBlank(FlowableUtils.getTenantId())) { + query.processDefinitionTenantId(FlowableUtils.getTenantId()); + } else { + query.processDefinitionWithoutTenantId(); + } return query.list(); } diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/task/BpmTaskServiceImpl.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/task/BpmTaskServiceImpl.java index 0778ba0..8014f5e 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/task/BpmTaskServiceImpl.java +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/task/BpmTaskServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.util.date.DateUtils; import com.iailab.framework.common.util.number.NumberUtils; diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application-dev.yaml b/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application-dev.yaml index 58ac072..2301e24 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application-dev.yaml +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application-dev.yaml @@ -1,9 +1,9 @@ ---- #################### 数据库相关配置 #################### spring: # 数据源配置项 autoconfigure: exclude: - com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源 + - de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置 datasource: druid: # Druid 【监控】相关的全局配置 web-stat-filter: @@ -25,8 +25,8 @@ multi-statement-allow: true dynamic: # 多数据源配置 druid: # Druid 【连接池】相关的全局配置 - initial-size: 5 # 初始连接数 - min-idle: 10 # 最小连接池数量 + initial-size: 1 # 初始连接数 + min-idle: 1 # 最小连接池数量 max-active: 20 # 最大连接池数量 max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒 time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒 @@ -40,26 +40,37 @@ datasource: master: url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + # url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例 + # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 + # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 + # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro # SQLServer 连接的示例 + # url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例 username: root password: 123456 - slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 + # username: sa # SQL Server 连接的示例 + # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # SQL Server 连接的示例 + # username: SYSDBA # DM 连接的示例 + # password: SYSDBA # DM 连接的示例 + slave: # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true username: root password: 123456 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 redis: - host: 400-infra.server.iocoder.cn # 地址 + host: 127.0.0.1 # 地址 port: 6379 # 端口 - database: 1 # 数据库索引 -# password: 123456 # 密码,建议生产环境开启 + database: 0 # 数据库索引 + password: 123456 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### --- #################### 定时任务相关配置 #################### + xxl: job: + enabled: true # 是否开启调度中心,默认为 true 开启 admin: addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址 @@ -89,13 +100,20 @@ instance: service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME] +# 日志文件配置 +logging: + level: + # 配置自己写的 MyBatis Mapper 打印日志 + com.iailab.module.bpm.dal.mysql: info + --- #################### 平台相关配置 #################### # 平台配置项,设置当前项目所有自定义的配置 iailab: - xss: + env: # 多环境的配置项 + tag: ${HOSTNAME} + security: + mock-enable: true + access-log: # 访问日志的配置项 enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 - demo: true # 开启演示模式 + demo: false # 关闭演示模式 diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application-local.yaml b/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application-local.yaml index 829d98f..2301e24 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application-local.yaml +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application-local.yaml @@ -1,4 +1,3 @@ ---- #################### 数据库相关配置 #################### spring: # 数据源配置项 autoconfigure: @@ -105,7 +104,7 @@ logging: level: # 配置自己写的 MyBatis Mapper 打印日志 - com.iailab.module.bpm.dal.mysql: debug + com.iailab.module.bpm.dal.mysql: info --- #################### 平台相关配置 #################### diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application.yaml b/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application.yaml index 93f0506..a15236e 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application.yaml +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/resources/application.yaml @@ -1,7 +1,32 @@ spring: + application: + name: bpm-server + + profiles: + active: @profiles.active@ + + cloud: + nacos: + server-addr: @nacos.server@ # Nacos 服务器地址 + username: @nacos.username@ + password: @nacos.password@ + discovery: # 【配置中心】配置项 + namespace: ${spring.profiles.active} + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + metadata: + version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 + config: # 【注册中心】配置项 + namespace: ${spring.profiles.active} + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + main: allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务 + + config: + import: + - optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置 + - optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置 # Servlet 配置 servlet: @@ -26,6 +51,13 @@ type: REDIS redis: time-to-live: 1h # 设置过期时间为 1 小时 + +server: + port: 48083 + +logging: + file: + name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径 --- #################### 接口文档配置 #################### @@ -58,6 +90,7 @@ mybatis-plus: configuration: map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl global-config: db-config: id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。 @@ -96,7 +129,7 @@ job: executor: appname: ${spring.application.name} # 执行器 AppName - logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 + logpath: @log.path@/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 accessToken: default_token # 执行器通讯TOKEN --- #################### 平台相关配置 #################### diff --git a/iailab-module-data/iailab-module-data-biz/pom.xml b/iailab-module-data/iailab-module-data-biz/pom.xml index 7af3b45..0da9f4b 100644 --- a/iailab-module-data/iailab-module-data-biz/pom.xml +++ b/iailab-module-data/iailab-module-data-biz/pom.xml @@ -156,6 +156,12 @@ <version>6.8.0</version> </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + <!-- <!– websocket –>--> <!-- <dependency>--> <!-- <groupId>org.springframework.boot</groupId>--> @@ -170,17 +176,23 @@ <plugins> <!-- 打包 --> <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <version>${spring.boot.version}</version> - <executions> - <execution> - <goals> - <goal>repackage</goal> <!-- 将引入的 jar 打入其中 --> - </goals> - </execution> - </executions> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.1</version> </plugin> + + <!-- <plugin>--> +<!-- <groupId>org.springframework.boot</groupId>--> +<!-- <artifactId>spring-boot-maven-plugin</artifactId>--> +<!-- <version>${spring.boot.version}</version>--> +<!-- <executions>--> +<!-- <execution>--> +<!-- <goals>--> +<!-- <goal>repackage</goal> <!– 将引入的 jar 打入其中 –>--> +<!-- </goals>--> +<!-- </execution>--> +<!-- </executions>--> +<!-- </plugin>--> </plugins> </build> diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java index d855638..bdde24f 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java @@ -1,10 +1,10 @@ package com.iailab.module.data.channel.modbus.controller.admin; +import cn.hutool.core.codec.Base64; import com.iailab.module.data.common.utils.PageUtils; import com.iailab.module.data.common.utils.R; import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; import com.iailab.module.data.channel.modbus.service.ChannelModbusTagService; -import com.sun.xml.internal.messaging.saaj.util.Base64; import javax.annotation.Resource; import org.springframework.web.bind.annotation.*; @@ -40,7 +40,7 @@ */ @GetMapping("/info/{id}") public R tagInfo(@PathVariable("id") String id){ - ChannelModBusTagEntity info= channelModbusTagService.info(Base64.base64Decode(id)); + ChannelModBusTagEntity info= channelModbusTagService.info(Base64.decodeStr(id)); return R.ok().put("data", info); } /** diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java index ca2b965..94f65c7 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java @@ -1,11 +1,11 @@ package com.iailab.module.data.channel.opcua.controller.admin; +import cn.hutool.core.codec.Base64; import com.iailab.module.data.common.exception.RRException; import com.iailab.module.data.common.utils.PageUtils; import com.iailab.module.data.common.utils.R; import com.iailab.module.data.channel.opcua.entity.ChannelOPCUATagEntity; import com.iailab.module.data.channel.opcua.service.ChannelOPCUATagService; -import com.sun.xml.internal.messaging.saaj.util.Base64; import javax.annotation.Resource; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -42,7 +42,7 @@ */ @GetMapping("/info/{id}") public R tagInfo(@PathVariable("id") String id){ - ChannelOPCUATagEntity info= channelOpcuaTagService.info(Base64.base64Decode(id)); + ChannelOPCUATagEntity info= channelOpcuaTagService.info(Base64.decodeStr(id)); return R.ok().put("data", info); } /** diff --git a/iailab-module-data/iailab-module-data-biz/src/main/resources/application-local.yml b/iailab-module-data/iailab-module-data-biz/src/main/resources/application-local.yml index 8829ec0..90734e4 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/resources/application-local.yml +++ b/iailab-module-data/iailab-module-data-biz/src/main/resources/application-local.yml @@ -1,20 +1,3 @@ ---- #################### 注册中心 + 配置中心相关配置 #################### - -spring: - cloud: - nacos: - server-addr: @nacos.server@ # Nacos 服务器地址 - username: @nacos.username@ - password: @nacos.password@ - discovery: # 【配置中心】配置项 - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP - metadata: - version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 - config: # 【注册中心】配置项 - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP - --- #################### 数据库相关配置 #################### spring: # 数据源配置项 diff --git a/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yml b/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yml index 072936a..b4f0a7a 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yml +++ b/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yml @@ -3,7 +3,21 @@ name: data-server profiles: - active: local + active: @profiles.active@ + + cloud: + nacos: + server-addr: @nacos.server@ # Nacos 服务器地址 + username: @nacos.username@ + password: @nacos.password@ + discovery: # 【配置中心】配置项 + namespace: ${spring.profiles.active} + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + metadata: + version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 + config: # 【注册中心】配置项 + namespace: ${spring.profiles.active} + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP main: allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 @@ -43,7 +57,7 @@ logging: file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 + name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径 --- #################### 接口文档配置 #################### @@ -132,7 +146,7 @@ job: executor: appname: ${spring.application.name} # 执行器 AppName - logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 + logpath: @log.path@/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 accessToken: default_token # 执行器通讯TOKEN diff --git a/iailab-module-data/iailab-module-data-biz/src/test/java/com/iailab/InfluxDBTest.java b/iailab-module-data/iailab-module-data-biz/src/test/java/com/iailab/InfluxDBTest.java index 8dc472b..026c73a 100644 --- a/iailab-module-data/iailab-module-data-biz/src/test/java/com/iailab/InfluxDBTest.java +++ b/iailab-module-data/iailab-module-data-biz/src/test/java/com/iailab/InfluxDBTest.java @@ -3,11 +3,9 @@ import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO; import com.iailab.module.data.influxdb.pojo.InfluxPointValueSimPOJO; import com.iailab.module.data.influxdb.service.InfluxDBService; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; + import javax.annotation.Resource; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; import java.util.ArrayList; import java.util.Calendar; @@ -19,8 +17,6 @@ * @Description * @createTime 2023年12月10日 12:19:00 */ -@SpringBootTest -@RunWith(SpringRunner.class) public class InfluxDBTest { @Resource diff --git a/iailab-module-data/iailab-module-data-biz/src/test/java/com/iailab/OadpTagCollectorTest.java b/iailab-module-data/iailab-module-data-biz/src/test/java/com/iailab/OadpTagCollectorTest.java index d69fd61..adbdec0 100644 --- a/iailab-module-data/iailab-module-data-biz/src/test/java/com/iailab/OadpTagCollectorTest.java +++ b/iailab-module-data/iailab-module-data-biz/src/test/java/com/iailab/OadpTagCollectorTest.java @@ -1,43 +1,38 @@ -package com.iailab; - -import com.iailab.module.collection.tag.impl.OadpTagCollector; -import org.junit.Test; -import org.junit.runner.RunWith; -import javax.annotation.Resource; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; - -/** - * @author PanZhibao - * @Description - * @createTime 2023年04月25日 16:17:00 - */ -@SpringBootTest -@RunWith(SpringRunner.class) -public class OadpTagCollectorTest { - - @Resource - private OadpTagCollector tagCollector; - - @Test - public void test() { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.MILLISECOND, 0); - List<String> tags = new ArrayList<>(); - tags.add("source=producer-modbus;id=device0.change_random_int32"); - tags.add("source=producer-modbus;id=device0.change_random_float"); - tagCollector.collect(calendar.getTime(), tags); - } - - - @Test - public void testSp() { - String regex = "[+\\-\\*/()\\&&\\||]"; - String expression = "324123423&&34576||9999||66666+536345"; - String[] arr = expression.split(regex); - } -} +//package com.iailab; +// +//import org.testng.annotations.Test; +// +//import javax.annotation.Resource; +// +//import java.util.ArrayList; +//import java.util.Calendar; +//import java.util.List; +// +///** +// * @author PanZhibao +// * @Description +// * @createTime 2023年04月25日 16:17:00 +// */ +//public class OadpTagCollectorTest { +// +// @Resource +// private OadpTagCollector tagCollector; +// +// @Test +// public void test() { +// Calendar calendar = Calendar.getInstance(); +// calendar.set(Calendar.MILLISECOND, 0); +// List<String> tags = new ArrayList<>(); +// tags.add("source=producer-modbus;id=device0.change_random_int32"); +// tags.add("source=producer-modbus;id=device0.change_random_float"); +// tagCollector.collect(calendar.getTime(), tags); +// } +// +// +// @Test +// public void testSp() { +// String regex = "[+\\-\\*/()\\&&\\||]"; +// String expression = "324123423&&34576||9999||66666+536345"; +// String[] arr = expression.split(regex); +// } +//} diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/config/ConfigApiImpl.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/config/ConfigApiImpl.java index 9c1a38d..e81f869 100644 --- a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/config/ConfigApiImpl.java +++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/config/ConfigApiImpl.java @@ -3,6 +3,7 @@ import com.iailab.framework.common.pojo.CommonResult; import com.iailab.module.infra.dal.dataobject.config.ConfigDO; import com.iailab.module.infra.service.config.ConfigService; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RestController; @@ -18,6 +19,12 @@ private ConfigService configService; @Override + public String queryConfigByCode(String configCode) { + ConfigDO configByKey = configService.getConfigByKey(configCode); + return ObjectUtils.isNotEmpty(configByKey) ? configByKey.getValue() : ""; + } + + @Override public CommonResult<String> getConfigValueByKey(String key) { ConfigDO config = configService.getConfigByKey(key); return success(config != null ? config.getValue() : null); diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/config/ConfigController.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/config/ConfigController.java index 7febba0..dde7ba8 100644 --- a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/config/ConfigController.java +++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/controller/admin/config/ConfigController.java @@ -96,7 +96,7 @@ @Operation(summary = "导出参数配置") @PreAuthorize("@ss.hasPermission('infra:config:export')") @ApiAccessLog(operateType = EXPORT) - public void exportConfig(@Valid ConfigPageReqVO exportReqVO, + public void exportConfig(ConfigPageReqVO exportReqVO, HttpServletResponse response) throws IOException { exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); List<ConfigDO> list = configService.getConfigPage(exportReqVO).getList(); diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/framework/file/core/client/s3/S3FileClient.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/framework/file/core/client/s3/S3FileClient.java index 3e8cda0..d0fed92 100644 --- a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/framework/file/core/client/s3/S3FileClient.java +++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/framework/file/core/client/s3/S3FileClient.java @@ -37,6 +37,7 @@ .region(buildRegion()) // Region .credentials(config.getAccessKey(), config.getAccessSecret()) // 认证密钥 .build(); + enableVirtualStyleEndpoint(); } /** @@ -86,6 +87,18 @@ return null; } + /** + * 开启 VirtualStyle 模式 + */ + private void enableVirtualStyleEndpoint() { + if (StrUtil.containsAll(config.getEndpoint(), + S3FileClientConfig.ENDPOINT_TENCENT, // 腾讯云 https://cloud.tencent.com/document/product/436/41284 + S3FileClientConfig.ENDPOINT_VOLCES)) { // 火山云 https://www.volcengine.com/docs/6349/1288493 + client.enableVirtualStyleEndpoint(); + } + } + + @Override public String upload(byte[] content, String path, String type) throws Exception { // 执行上传 diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/framework/file/core/client/s3/S3FileClientConfig.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/framework/file/core/client/s3/S3FileClientConfig.java index 8e2920a..28da3b5 100644 --- a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/framework/file/core/client/s3/S3FileClientConfig.java +++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/framework/file/core/client/s3/S3FileClientConfig.java @@ -20,6 +20,7 @@ public static final String ENDPOINT_QINIU = "qiniucs.com"; public static final String ENDPOINT_ALIYUN = "aliyuncs.com"; public static final String ENDPOINT_TENCENT = "myqcloud.com"; + public static final String ENDPOINT_VOLCES = "volces.com"; // 火山云(字节) /** * 节点地址 diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/service/config/ConfigService.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/service/config/ConfigService.java index b9a7a3f..e9e68a4 100644 --- a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/service/config/ConfigService.java +++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/service/config/ConfigService.java @@ -58,7 +58,7 @@ * @param reqVO 分页条件 * @return 分页列表 */ - PageResult<ConfigDO> getConfigPage(@Valid ConfigPageReqVO reqVO); + PageResult<ConfigDO> getConfigPage(ConfigPageReqVO reqVO); /** * 根据参数编码,获取参数的value值 diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-dev.yaml b/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-dev.yaml index b1a0d1c..c873f28 100644 --- a/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-dev.yaml +++ b/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-dev.yaml @@ -1,9 +1,14 @@ --- #################### 数据库相关配置 #################### spring: + # 数据源配置项 autoconfigure: exclude: - com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源 + # - de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置 + # - de.codecentric.boot.admin.server.cloud.config.AdminServerDiscoveryAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置 + # - de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置 + # - de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置 datasource: druid: # Druid 【监控】相关的全局配置 web-stat-filter: @@ -25,8 +30,8 @@ multi-statement-allow: true dynamic: # 多数据源配置 druid: # Druid 【连接池】相关的全局配置 - initial-size: 5 # 初始连接数 - min-idle: 10 # 最小连接池数量 + initial-size: 1 # 初始连接数 + min-idle: 1 # 最小连接池数量 max-active: 20 # 最大连接池数量 max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒 time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒 @@ -39,44 +44,54 @@ primary: master datasource: master: - url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://172.16.8.100:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + # url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例 + # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 + # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 + # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro # SQLServer 连接的示例 + # url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例 username: root password: 123456 - slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 + # username: sa # SQL Server 连接的示例 + # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # SQL Server 连接的示例 + # username: SYSDBA # DM 连接的示例 + # password: SYSDBA # DM 连接的示例 + slave: # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true username: root password: 123456 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 redis: - host: 127.0.0.1 # 地址 + host: 172.16.8.100 # 地址 port: 6379 # 端口 - database: 1 # 数据库索引 + database: 0 # 数据库索引 password: 123456 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 #################### # rocketmq 配置项,对应 RocketMQProperties 配置类 rocketmq: - name-server: 127.0.0.1:9876 # RocketMQ Namesrv + name-server: 172.16.8.100:9876 # RocketMQ Namesrv spring: # RabbitMQ 配置项,对应 RabbitProperties 配置类 rabbitmq: - host: 127.0.0.1 # RabbitMQ 服务的地址 + host: 172.16.8.100 # RabbitMQ 服务的地址 port: 5672 # RabbitMQ 服务的端口 username: guest # RabbitMQ 服务的账号 password: guest # RabbitMQ 服务的密码 # Kafka 配置项,对应 KafkaProperties 配置类 kafka: - bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔 + bootstrap-servers: 172.16.8.100:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔 --- #################### 定时任务相关配置 #################### xxl: job: + enabled: false # 是否开启调度中心,默认为 true 开启 admin: - addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址 + addresses: http://172.16.8.100:9090/xxl-job-admin # 调度中心部署跟地址 --- #################### 服务保障相关配置 #################### @@ -106,13 +121,21 @@ # Spring Boot Admin Server 服务端的相关配置 context-path: /admin # 配置 Spring +# 日志文件配置 +logging: + level: + # 配置自己写的 MyBatis Mapper 打印日志 + com.iailab.module.infra.dal.mysql: debug + com.iailab.module.infra.dal.mysql.logger.ApiErrorLogMapper: INFO # 配置 ApiErrorLogMapper 的日志级别为 info,避免和 GlobalExceptionHandler 重复打印 + com.iailab.module.infra.dal.mysql.file.FileConfigMapper: INFO # 配置 FileConfigMapper 的日志级别为 info + --- #################### 平台相关配置 #################### # 平台配置项,设置当前项目所有自定义的配置 iailab: - xss: + env: # 多环境的配置项 + tag: ${HOSTNAME} + security: + mock-enable: true + access-log: # 访问日志的配置项 enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 - demo: true # 开启演示模式 diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-local.yaml b/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-local.yaml index cf43456..5072cf1 100644 --- a/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-local.yaml +++ b/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application-local.yaml @@ -1,20 +1,3 @@ ---- #################### 注册中心 + 配置中心相关配置 #################### - -spring: - cloud: - nacos: - server-addr: @nacos.server@ # Nacos 服务器地址 - username: @nacos.username@ - password: @nacos.password@ - discovery: # 【配置中心】配置项 - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP - metadata: - version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 - config: # 【注册中心】配置项 - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP - --- #################### 数据库相关配置 #################### spring: @@ -61,7 +44,7 @@ primary: master datasource: master: - url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://172.16.8.100:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -81,7 +64,7 @@ # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 redis: - host: 127.0.0.1 # 地址 + host: 172.16.8.100 # 地址 port: 6379 # 端口 database: 0 # 数据库索引 password: 123456 # 密码,建议生产环境开启 diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application.yaml b/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application.yaml index 94fd5ec..ef4ebfa 100644 --- a/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application.yaml +++ b/iailab-module-infra/iailab-module-infra-biz/src/main/resources/application.yaml @@ -3,7 +3,21 @@ name: infra-server profiles: - active: local + active: @profiles.active@ + + cloud: + nacos: + server-addr: @nacos.server@ # Nacos 服务器地址 + username: @nacos.username@ + password: @nacos.password@ + discovery: # 【配置中心】配置项 + namespace: @profiles.active@ + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + metadata: + version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 + config: # 【注册中心】配置项 + namespace: @profiles.active@ + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP main: allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 @@ -43,7 +57,7 @@ logging: file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 + name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径 --- #################### 接口文档配置 #################### @@ -126,7 +140,7 @@ job: executor: appname: ${spring.application.name} # 执行器 AppName - logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 + logpath: @log.path@/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 accessToken: default_token # 执行器通讯TOKEN --- #################### 平台相关配置 #################### diff --git a/iailab-module-model/iailab-module-model-biz/pom.xml b/iailab-module-model/iailab-module-model-biz/pom.xml index a8e0e2e..5627af3 100644 --- a/iailab-module-model/iailab-module-model-biz/pom.xml +++ b/iailab-module-model/iailab-module-model-biz/pom.xml @@ -179,14 +179,46 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId> </dependency> -<!-- <dependency>--> -<!-- <groupId>io.swagger.core.v3</groupId>--> -<!-- <artifactId>swagger-annotations</artifactId>--> -<!-- <version>2.2.21</version>--> -<!-- <scope>compile</scope>--> -<!-- </dependency>--> + <dependency> + <groupId>com.iailab</groupId> + <artifactId>iailab-module-data-biz</artifactId> + <version>0.0.1</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> </dependencies> + <build> + <!-- 设置构建的 jar 包名 --> + <finalName>${project.artifactId}</finalName> + <plugins> + <!-- 打包 --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.1</version> + </plugin> + + <!-- <plugin>--> + <!-- <groupId>org.springframework.boot</groupId>--> + <!-- <artifactId>spring-boot-maven-plugin</artifactId>--> + <!-- <version>${spring.boot.version}</version>--> + <!-- <executions>--> + <!-- <execution>--> + <!-- <goals>--> + <!-- <goal>repackage</goal> <!– 将引入的 jar 打入其中 –>--> + <!-- </goals>--> + <!-- </execution>--> + <!-- </executions>--> + <!-- </plugin>--> + </plugins> + </build> + </project> \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/application-dev.yml b/iailab-module-model/iailab-module-model-biz/src/main/resources/application-dev.yml index 34c4424..64abc09 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/resources/application-dev.yml +++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/application-dev.yml @@ -7,12 +7,12 @@ username: @nacos.username@ password: @nacos.password@ discovery: # 【配置中心】配置项 - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 + namespace: @profiles.active@ # 命名空间。这里使用 dev 开发环境 group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP metadata: version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 config: # 【注册中心】配置项 - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 + namespace: @profiles.active@ # 命名空间。这里使用 dev 开发环境 group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP --- #################### 数据库相关配置 #################### diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/application-local.yml b/iailab-module-model/iailab-module-model-biz/src/main/resources/application-local.yml index 9e75d86..c253d89 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/resources/application-local.yml +++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/application-local.yml @@ -1,20 +1,3 @@ ---- #################### 注册中心 + 配置中心相关配置 #################### - -spring: - cloud: - nacos: - server-addr: @nacos.server@ # Nacos 服务器地址 - username: @nacos.username@ - password: @nacos.password@ - discovery: # 【配置中心】配置项 - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP - metadata: - version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 - config: # 【注册中心】配置项 - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP - --- #################### 数据库相关配置 #################### spring: # 数据源配置项 diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml b/iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml index 99fe1a8..c6e8935 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml +++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml @@ -3,7 +3,21 @@ name: model-server profiles: - active: local + active: ${spring.profiles.active} + + cloud: + nacos: + server-addr: @nacos.server@ # Nacos 服务器地址 + username: @nacos.username@ + password: @nacos.password@ + discovery: # 【配置中心】配置项 + namespace: ${spring.profiles.active} + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + metadata: + version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 + config: # 【注册中心】配置项 + namespace: ${spring.profiles.active} + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP main: allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 @@ -43,7 +57,7 @@ logging: file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 + name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径 --- #################### 接口文档配置 #################### @@ -132,7 +146,7 @@ job: executor: appname: ${spring.application.name} # 执行器 AppName - logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 + logpath: @log.path@/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 accessToken: default_token # 执行器通讯TOKEN diff --git a/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java b/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java index 0ca16f4..026c73a 100644 --- a/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java +++ b/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java @@ -1,13 +1,11 @@ package com.iailab; -import com.iailab.module.model.influxdb.pojo.InfluxPointValuePOJO; -import com.iailab.module.model.influxdb.pojo.InfluxPointValueSimPOJO; -import com.iailab.module.model.influxdb.service.InfluxDBService; -import org.junit.Test; -import org.junit.runner.RunWith; +import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO; +import com.iailab.module.data.influxdb.pojo.InfluxPointValueSimPOJO; +import com.iailab.module.data.influxdb.service.InfluxDBService; +import org.junit.jupiter.api.Test; + import javax.annotation.Resource; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; import java.util.ArrayList; import java.util.Calendar; @@ -19,8 +17,6 @@ * @Description * @createTime 2023年12月10日 12:19:00 */ -@SpringBootTest -@RunWith(SpringRunner.class) public class InfluxDBTest { @Resource diff --git a/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/OadpTagCollectorTest.java b/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/OadpTagCollectorTest.java index d69fd61..adbdec0 100644 --- a/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/OadpTagCollectorTest.java +++ b/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/OadpTagCollectorTest.java @@ -1,43 +1,38 @@ -package com.iailab; - -import com.iailab.module.collection.tag.impl.OadpTagCollector; -import org.junit.Test; -import org.junit.runner.RunWith; -import javax.annotation.Resource; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; - -/** - * @author PanZhibao - * @Description - * @createTime 2023年04月25日 16:17:00 - */ -@SpringBootTest -@RunWith(SpringRunner.class) -public class OadpTagCollectorTest { - - @Resource - private OadpTagCollector tagCollector; - - @Test - public void test() { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.MILLISECOND, 0); - List<String> tags = new ArrayList<>(); - tags.add("source=producer-modbus;id=device0.change_random_int32"); - tags.add("source=producer-modbus;id=device0.change_random_float"); - tagCollector.collect(calendar.getTime(), tags); - } - - - @Test - public void testSp() { - String regex = "[+\\-\\*/()\\&&\\||]"; - String expression = "324123423&&34576||9999||66666+536345"; - String[] arr = expression.split(regex); - } -} +//package com.iailab; +// +//import org.testng.annotations.Test; +// +//import javax.annotation.Resource; +// +//import java.util.ArrayList; +//import java.util.Calendar; +//import java.util.List; +// +///** +// * @author PanZhibao +// * @Description +// * @createTime 2023年04月25日 16:17:00 +// */ +//public class OadpTagCollectorTest { +// +// @Resource +// private OadpTagCollector tagCollector; +// +// @Test +// public void test() { +// Calendar calendar = Calendar.getInstance(); +// calendar.set(Calendar.MILLISECOND, 0); +// List<String> tags = new ArrayList<>(); +// tags.add("source=producer-modbus;id=device0.change_random_int32"); +// tags.add("source=producer-modbus;id=device0.change_random_float"); +// tagCollector.collect(calendar.getTime(), tags); +// } +// +// +// @Test +// public void testSp() { +// String regex = "[+\\-\\*/()\\&&\\||]"; +// String expression = "324123423&&34576||9999||66666+536345"; +// String[] arr = expression.split(regex); +// } +//} diff --git a/iailab-module-report/iailab-module-report-biz/pom.xml b/iailab-module-report/iailab-module-report-biz/pom.xml index af71238..56c235f 100644 --- a/iailab-module-report/iailab-module-report-biz/pom.xml +++ b/iailab-module-report/iailab-module-report-biz/pom.xml @@ -20,8 +20,8 @@ <dependencies> <!-- Spring Cloud 基础 --> <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-bootstrap</artifactId> + <groupId>com.iailab</groupId> + <artifactId>iailab-common-env</artifactId> </dependency> <!-- 依赖服务 --> diff --git a/iailab-module-report/iailab-module-report-biz/src/main/resources/application-local.yaml b/iailab-module-report/iailab-module-report-biz/src/main/resources/application-local.yaml index 1882f39..06504da 100644 --- a/iailab-module-report/iailab-module-report-biz/src/main/resources/application-local.yaml +++ b/iailab-module-report/iailab-module-report-biz/src/main/resources/application-local.yaml @@ -1,6 +1,5 @@ --- #################### 数据库相关配置 #################### spring: - # 数据源配置项 autoconfigure: exclude: @@ -110,11 +109,5 @@ tag: ${HOSTNAME} security: mock-enable: true - xss: - enable: false - exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 enable: false - demo: false # 关闭演示模式 diff --git a/iailab-module-report/iailab-module-report-biz/src/main/resources/application.yaml b/iailab-module-report/iailab-module-report-biz/src/main/resources/application.yaml index 58b4db9..912897d 100644 --- a/iailab-module-report/iailab-module-report-biz/src/main/resources/application.yaml +++ b/iailab-module-report/iailab-module-report-biz/src/main/resources/application.yaml @@ -1,7 +1,32 @@ spring: + application: + name: report-server + + profiles: + active: ${spring.profiles.active} + + cloud: + nacos: + server-addr: @nacos.server@ # Nacos 服务器地址 + username: @nacos.username@ + password: @nacos.password@ + discovery: # 【配置中心】配置项 + namespace: ${spring.profiles.active} + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + metadata: + version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 + config: # 【注册中心】配置项 + namespace: ${spring.profiles.active} + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + main: allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务 + + config: + import: + - optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置 + - optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置 # Servlet 配置 servlet: @@ -26,6 +51,14 @@ type: REDIS redis: time-to-live: 1h # 设置过期时间为 1 小时 + +server: + port: 48084 + +# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件 +logging: + file: + name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径 --- #################### 接口文档配置 #################### @@ -95,12 +128,15 @@ web: admin-ui: url: http://dashboard.iailab.iocoder.cn # Admin 管理后台 UI 的地址 + xss: + enable: false + exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 swagger: title: 管理后台 description: 提供管理员管理的所有功能 version: ${iailab.info.version} - base-package: ${iailab.info.base-package} tenant: # 多租户相关配置项 - enable: true + enable: false debug: false diff --git a/iailab-module-report/iailab-module-report-biz/src/main/resources/bootstrap-local.yaml b/iailab-module-report/iailab-module-report-biz/src/main/resources/bootstrap-local.yaml index 764b54c..07ea2f8 100644 --- a/iailab-module-report/iailab-module-report-biz/src/main/resources/bootstrap-local.yaml +++ b/iailab-module-report/iailab-module-report-biz/src/main/resources/bootstrap-local.yaml @@ -7,7 +7,7 @@ username: @nacos.username@ password: @nacos.password@ discovery: - namespace: @nacos.namespace@ # 命名空间。这里使用 dev 开发环境 + namespace: @profiles.active@ # 命名空间。这里使用 dev 开发环境 autoRegister: true metadata: version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 diff --git a/iailab-module-report/iailab-module-report-biz/src/main/resources/bootstrap.yaml b/iailab-module-report/iailab-module-report-biz/src/main/resources/bootstrap.yaml index caf41b1..dddb22e 100644 --- a/iailab-module-report/iailab-module-report-biz/src/main/resources/bootstrap.yaml +++ b/iailab-module-report/iailab-module-report-biz/src/main/resources/bootstrap.yaml @@ -11,4 +11,4 @@ # 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件 logging: file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 + name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径 diff --git a/iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml b/iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml index 095bdae..0a86082 100644 --- a/iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml +++ b/iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml @@ -141,7 +141,7 @@ pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify pay-return-url: http://niubi.natapp1.cc/api/pay/order/return refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify - demo: true # 开启演示模式 + demo: false # 开启演示模式 justauth: enabled: true diff --git a/iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml b/iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml index 3761309..b4df7ae 100644 --- a/iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml +++ b/iailab-module-system/iailab-module-system-biz/src/main/resources/application-local.yaml @@ -1,18 +1,19 @@ --- #################### 注册中心 + 配置中心相关配置 #################### -spring: - cloud: - nacos: - server-addr: 127.0.0.1:8848 # Nacos 服务器地址 - username: nacos - password: nacos - discovery: # 【配置中心】配置项 - namespace: a7112341-c9e2-4177-bc5b-0d2e8cf0b3bb - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP - metadata: - version: 1.0.0 # 服务实例的版本号,可用于灰度发布 - config: # 【注册中心】配置项 - namespace: a7112341-c9e2-4177-bc5b-0d2e8cf0b3bb - group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + +#spring: +# cloud: +# nacos: +# server-addr: @nacos.server@ # Nacos 服务器地址 +# username: @nacos.username@ +# password: @nacos.password@ +# discovery: # 【配置中心】配置项 +# namespace: @profiles.active@ # 命名空间。这里使用 dev 开发环境 +# group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP +# metadata: +# version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 +# config: # 【注册中心】配置项 +# namespace: @profiles.active@ # 命名空间。这里使用 dev 开发环境 +# group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP --- #################### 数据库相关配置 #################### spring: @@ -56,7 +57,7 @@ primary: master datasource: master: - url: jdbc:mysql://127.0.0.1:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://172.16.8.100:3306/iailab-platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -96,7 +97,7 @@ password: guest # RabbitMQ 服务的密码 # Kafka 配置项,对应 KafkaProperties 配置类 kafka: - bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔 + bootstrap-servers: 172.16.8.100:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔 --- #################### 定时任务相关配置 #################### @@ -104,7 +105,7 @@ job: enabled: true # 是否开启调度中心,默认为 true 开启 admin: - addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址 + addresses: http://172.16.8.100:9090/xxl-job-admin # 调度中心部署跟地址 --- #################### 服务保障相关配置 #################### diff --git a/iailab-module-system/iailab-module-system-biz/src/main/resources/application.yaml b/iailab-module-system/iailab-module-system-biz/src/main/resources/application.yaml index 1ec8ca2..1847746 100644 --- a/iailab-module-system/iailab-module-system-biz/src/main/resources/application.yaml +++ b/iailab-module-system/iailab-module-system-biz/src/main/resources/application.yaml @@ -1,9 +1,24 @@ +--- #################### 注册中心 + 配置中心相关配置 #################### spring: application: name: system-server profiles: - active: local + active: @profiles.active@ + + cloud: + nacos: + server-addr: @nacos.server@ # Nacos 服务器地址 + username: @nacos.username@ + password: @nacos.password@ + discovery: # 【配置中心】配置项 + namespace: @profiles.active@ + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP + metadata: + version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布 + config: # 【注册中心】配置项 + namespace: @profiles.active@ + group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP main: allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 @@ -43,7 +58,7 @@ logging: file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 + name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径 --- #################### 接口文档配置 #################### @@ -127,7 +142,7 @@ job: executor: appname: ${spring.application.name} # 执行器 AppName - logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 + logpath: @log.path@/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 accessToken: default_token # 执行器通讯TOKEN --- #################### 验证码相关配置 #################### @@ -167,7 +182,7 @@ description: 提供管理员管理的所有功能 version: ${iailab.info.version} tenant: # 多租户相关配置项 - enable: false + enable: true ignore-urls: - /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号 - /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号 @@ -178,6 +193,13 @@ - /rpc-api/system/tenant/valid # 防止递归。避免调用 /rpc-api/system/tenant/valid 接口时,又去触发 /rpc-api/system/tenant/valid 去校验 - /rpc-api/system/tenant/id-list # 获得租户列表的时候,无需传递租户编号 - /rpc-api/system/oauth2/token/check # 访问令牌校验时,无需传递租户编号;主要解决上传文件的场景,前端不会传递 tenant-id! + ignore-caches: + - permission_menu_ids + - oauth_client + - notify_template + - mail_account + - mail_template + - sms_template ignore-tables: - system_tenant - system_tenant_package diff --git a/pom.xml b/pom.xml index d0a380e..68b9bb4 100644 --- a/pom.xml +++ b/pom.xml @@ -11,6 +11,7 @@ <module>iailab-framework</module> <module>iailab-cloud</module> <!-- 各种 module 拓展 --> +<!-- <module>iailab-module-ai</module>--> <module>iailab-module-system</module> <module>iailab-module-infra</module> <module>iailab-module-bpm</module> @@ -48,7 +49,7 @@ <dynamic-datasource.version>4.3.1</dynamic-datasource.version> <mybatis-plus-join.version>1.4.13</mybatis-plus-join.version> <easy-trans.version>3.0.5</easy-trans.version> - <redisson.version>3.32.0</redisson.version> <!-- Spring Boot 2.X 最多使用 3.18.0 版本,否则会报 Tuple NoClassDefFoundError --> + <redisson.version>3.18.0</redisson.version> <!-- Spring Boot 2.X 最多使用 3.18.0 版本,否则会报 Tuple NoClassDefFoundError --> <dm8.jdbc.version>8.1.3.62</dm8.jdbc.version> <!-- 消息队列 --> <rocketmq-spring.version>2.3.0</rocketmq-spring.version> @@ -115,8 +116,8 @@ <nacos.config.group>DEFAULT_GROUP</nacos.config.group> <nacos.username>nacos</nacos.username> <nacos.password>nacos</nacos.password> - <nacos.namespace>a7112341-c9e2-4177-bc5b-0d2e8cf0b3bb</nacos.namespace> <nacos.metadata.version>1.0.0</nacos.metadata.version> + <log.path>D:\data</log.path> <logstash.address>127.0.0.1:4560</logstash.address> </properties> <activation> @@ -134,8 +135,8 @@ <nacos.config.group>DEFAULT_GROUP</nacos.config.group> <nacos.username>nacos</nacos.username> <nacos.password>nacos</nacos.password> - <nacos.namespace>a7112341-c9e2-4177-bc5b-0d2e8cf0b3bb</nacos.namespace> <nacos.metadata.version>1.0.0</nacos.metadata.version> + <log.path>/home/iailab</log.path> <logstash.address>127.0.0.1:4560</logstash.address> </properties> </profile> -- Gitblit v1.9.3