diff --git a/README.md b/README.md index 160b57d742f850cb14665bdd348c694e8b618f35..03c4399d0e47c8bece0d56949dce9d8ea101e914 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # acp-admin-cloud -###### v6.8.1 [版本更新日志](doc/version_history.md) +###### v6.9.0 [版本更新日志](doc/version_history.md) - 使用Application Construction Platform 应用构建平台作为脚手架 - 基于 Spring Cloud 的微服务版本,基于 Spring Boot @@ -9,9 +9,9 @@ ## 相关组件版本 -- [Spring Boot 3.4.6](https://projects.spring.io/spring-boot) -- [Spring Boot Admin 3.4.7](https://github.com/codecentric/spring-boot-admin) -- [Acp 2025.4.1](https://gitee.com/zhangbinhub/acp) +- [Spring Boot 3.5.3](https://projects.spring.io/spring-boot) +- [Spring Boot Admin 3.5.1](https://github.com/codecentric/spring-boot-admin) +- [Acp 2025.5.0](https://gitee.com/zhangbinhub/acp) - [sensitive](https://github.com/houbb/sensitive) ## 技术栈 diff --git a/build.gradle b/build.gradle index 33c754e1a2f626c10710613a85943081fd90d8ea..d8659bc36aab5f1958a0dcae845a0f87ee62cfd2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,27 +1,16 @@ import org.apache.tools.ant.filters.ReplaceTokens import org.jetbrains.kotlin.gradle.dsl.JvmTarget -ext { - println("Environment : JAVA_HOME=$System.env.JAVA_HOME") - println("Gradle Version : ${projectProperties.getProperty('gradleVersion')}") - println("Target JDK Version : ${projectProperties.getProperty('javaVersion')}") - println("Kotlin Version : $versions.kotlin") - println("Spring Boot Version : $versions.springBoot") - println("Acp Version : $versions.acp") - println("Encoding : ${projectProperties.getProperty('encoding')}") -} - buildscript { ext { projectProperties = new Properties() projectProperties.load(new FileInputStream("$rootDir${File.separator}project.properties")) } - apply from: "$rootDir${File.separator}gradle${File.separator}dependencies.gradle" dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin" - classpath "org.jetbrains.kotlin:kotlin-allopen:$versions.kotlin" - classpath "org.jetbrains.kotlin:kotlin-noarg:$versions.kotlin" - classpath "org.springframework.boot:spring-boot-gradle-plugin:$versions.springBoot" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${libs.versions.kotlin.get()}" + classpath "org.jetbrains.kotlin:kotlin-allopen:${libs.versions.kotlin.get()}" + classpath "org.jetbrains.kotlin:kotlin-noarg:${libs.versions.kotlin.get()}" + classpath "org.springframework.boot:spring-boot-gradle-plugin:${libs.versions.springBoot.get()}" } repositories { mavenLocal() @@ -35,6 +24,20 @@ buildscript { } } +ext { + println("Environment : JAVA_HOME=$System.env.JAVA_HOME") + println("Gradle Version : ${projectProperties.getProperty('gradleVersion')}") + println("Target JDK Version : ${projectProperties.getProperty('javaVersion')}") + println("Kotlin Version : ${libs.versions.kotlin.get()}") + println("Spring Boot Version : ${libs.versions.springBoot.get()}") + println("Acp Version : ${libs.versions.acp.get()}") + println("Encoding : ${projectProperties.getProperty('encoding')}") +} +wrapper { + def gradleVersion = projectProperties.getProperty('gradleVersion') + def distributionType = Wrapper.DistributionType.ALL.name().toLowerCase(Locale.ENGLISH) + distributionUrl = "https://mirrors.cloud.tencent.com/gradle/gradle-$gradleVersion-${distributionType}.zip" +} apply from: "$rootDir${File.separator}gradle${File.separator}globalTask.gradle" apply from: "$rootDir${File.separator}gradle${File.separator}moduleVersion.gradle" @@ -42,8 +45,6 @@ allprojects { group project.group.toString().isBlank() ? projectProperties.getProperty('group') : "${projectProperties.getProperty('group')}.$project.group" - apply from: "$rootDir${File.separator}gradle${File.separator}dependencies.gradle" - apply plugin: 'java' apply plugin: 'kotlin' apply plugin: 'kotlin-spring' diff --git a/common/acp-admin-cloud-constant/src/main/kotlin/io/gitee/zhangbinhub/admin/common/api/WorkFlowApi.kt b/common/acp-admin-cloud-constant/src/main/kotlin/io/gitee/zhangbinhub/admin/common/api/WorkFlowApi.kt index 7d8825c9858fc2189aa20893de18a08e6ea5acf1..d6a6f462061a8218e2012de0b8c817f021754c42 100644 --- a/common/acp-admin-cloud-constant/src/main/kotlin/io/gitee/zhangbinhub/admin/common/api/WorkFlowApi.kt +++ b/common/acp-admin-cloud-constant/src/main/kotlin/io/gitee/zhangbinhub/admin/common/api/WorkFlowApi.kt @@ -17,7 +17,6 @@ object WorkFlowApi { const val process = "/process" const val history = "/history" const val instance = "/instance" - const val instanceChart = "/instance-chart" const val termination = "$instance/termination" const val myProcess = "$instance/my-process" const val task = "/task" diff --git a/common/acp-admin-cloud-dependencies-resource-server/build.gradle b/common/acp-admin-cloud-dependencies-resource-server/build.gradle index 37511c2031e9ea69d78e7f83cc391fd231fa64b3..f668e04251b54c21cff9d0cb1164cd5895fe563c 100644 --- a/common/acp-admin-cloud-dependencies-resource-server/build.gradle +++ b/common/acp-admin-cloud-dependencies-resource-server/build.gradle @@ -2,7 +2,7 @@ apply from: "$rootDir/gradle/publish.gradle" apply plugin: "io.spring.dependency-management" dependencyManagement { imports { - mavenBom("io.gitee.zhangbinhub.acp:acp-spring-dependency:$versions.acp") + mavenBom("io.gitee.zhangbinhub.acp:acp-spring-dependency:${libs.versions.acp.get()}") } dependencies { dependency "$group:$name:$version" diff --git a/common/acp-admin-cloud-dependencies/build.gradle b/common/acp-admin-cloud-dependencies/build.gradle index 8f518a3f8e73d2e9f53aa671b250a470acd6d76b..c907a578ffbea26ff6bbc849d325016fb3cb71fe 100644 --- a/common/acp-admin-cloud-dependencies/build.gradle +++ b/common/acp-admin-cloud-dependencies/build.gradle @@ -2,7 +2,7 @@ apply from: "$rootDir/gradle/publish.gradle" apply plugin: "io.spring.dependency-management" dependencyManagement { imports { - mavenBom("io.gitee.zhangbinhub.acp:acp-spring-dependency:$versions.acp") + mavenBom("io.gitee.zhangbinhub.acp:acp-spring-dependency:${libs.versions.acp.get()}") } dependencies { dependency "$group:$name:$version" @@ -16,16 +16,13 @@ dependencies { api "io.opentelemetry:opentelemetry-exporter-zipkin" api "io.zipkin.reporter2:zipkin-sender-kafka" - api "org.springframework.boot:spring-boot-starter-data-redis" api "org.springframework.boot:spring-boot-starter-data-redis-reactive" - // zk 客户端 - api "org.apache.curator:curator-recipes" // 脱敏工具 - api("com.github.houbb:sensitive-core:$versions.sensitive") { + api("com.github.houbb:sensitive-core:${libs.versions.sensitive.get()}") { exclude group: "com.github.houbb", module: "deep-copy-fastjson" } - api "com.github.houbb:deep-copy-jackson:$versions.sensitiveDeepCopy" - api "com.github.houbb:sensitive-logback:$versions.sensitive" + api "com.github.houbb:deep-copy-jackson:${libs.versions.sensitiveDeepCopy.get()}" + api "com.github.houbb:sensitive-logback:${libs.versions.sensitive.get()}" testImplementation platform("org.junit:junit-bom") testImplementation("org.junit.jupiter:junit-jupiter") diff --git a/common/acp-admin-cloud-dependencies/src/main/java/io/gitee/zhangbinhub/admin/common/conf/ZkClientConfiguration.java b/common/acp-admin-cloud-dependencies/src/main/java/io/gitee/zhangbinhub/admin/common/conf/ZkClientConfiguration.java deleted file mode 100644 index 453bd42c8b35725b8b052427c64d737bed21506f..0000000000000000000000000000000000000000 --- a/common/acp-admin-cloud-dependencies/src/main/java/io/gitee/zhangbinhub/admin/common/conf/ZkClientConfiguration.java +++ /dev/null @@ -1,79 +0,0 @@ -package io.gitee.zhangbinhub.admin.common.conf; - -import org.springframework.boot.context.properties.ConfigurationProperties; - -@ConfigurationProperties(prefix = "acp.cloud.zookeeper") -public class ZkClientConfiguration { - public String getConnect() { - return connect; - } - - public void setConnect(String connect) { - this.connect = connect; - } - - public Boolean getAclEnable() { - return aclEnable; - } - - public void setAclEnable(Boolean aclEnable) { - this.aclEnable = aclEnable; - } - - public String getAclSchema() { - return aclSchema; - } - - public void setAclSchema(String aclSchema) { - this.aclSchema = aclSchema; - } - - public String getAclUsername() { - return aclUsername; - } - - public void setAclUsername(String aclUsername) { - this.aclUsername = aclUsername; - } - - public String getAclPassword() { - return aclPassword; - } - - public void setAclPassword(String aclPassword) { - this.aclPassword = aclPassword; - } - - public Integer getSessionTimeOut() { - return sessionTimeOut; - } - - public void setSessionTimeOut(Integer sessionTimeOut) { - this.sessionTimeOut = sessionTimeOut; - } - - public Integer getConnectionTimeOut() { - return connectionTimeOut; - } - - public void setConnectionTimeOut(Integer connectionTimeOut) { - this.connectionTimeOut = connectionTimeOut; - } - - public Integer getRetryIntervalMs() { - return retryIntervalMs; - } - - public void setRetryIntervalMs(Integer retryIntervalMs) { - this.retryIntervalMs = retryIntervalMs; - } - - private String connect = ""; - private Boolean aclEnable = false; - private String aclSchema = "digest"; - private String aclUsername = ""; - private String aclPassword = ""; - private Integer sessionTimeOut = 60 * 1000; - private Integer connectionTimeOut = 15 * 1000; - private Integer retryIntervalMs = 5000; -} diff --git a/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/AcpAdminComponentAutoConfiguration.kt b/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/AcpAdminComponentAutoConfiguration.kt index 76301f71fb09dbb9b1cf8c73ec06f8b74ff98354..5d4c12911b08a58a76b7330ad37327c69f353a88 100644 --- a/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/AcpAdminComponentAutoConfiguration.kt +++ b/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/AcpAdminComponentAutoConfiguration.kt @@ -1,58 +1,24 @@ package io.gitee.zhangbinhub.admin.common -import io.gitee.zhangbinhub.admin.common.conf.ZkClientConfiguration -import io.gitee.zhangbinhub.admin.common.serialnumber.GenerateSerialNumber -import io.gitee.zhangbinhub.admin.common.serialnumber.RedisGenerateSerialNumber -import org.apache.curator.framework.CuratorFramework -import org.apache.curator.framework.CuratorFrameworkFactory -import org.apache.curator.retry.RetryForever import org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinAutoConfiguration import org.springframework.boot.autoconfigure.AutoConfiguration -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration import org.springframework.boot.autoconfigure.kafka.KafkaProperties -import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.cloud.bus.jackson.BusJacksonAutoConfiguration import org.springframework.cloud.bus.jackson.RemoteApplicationEventScan import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Import -import org.springframework.data.redis.core.RedisOperations -import org.springframework.data.redis.core.StringRedisTemplate import zipkin2.reporter.BytesMessageSender import zipkin2.reporter.kafka.KafkaSender /** - * @author zhang by 30/07/2019 * @since JDK 11 */ @AutoConfiguration(before = [BusJacksonAutoConfiguration::class, ZipkinAutoConfiguration::class]) -@EnableConfigurationProperties(ZkClientConfiguration::class) @RemoteApplicationEventScan(basePackageClasses = [AcpAdminComponentAutoConfiguration::class]) @Import(RedisAutoConfiguration::class) class AcpAdminComponentAutoConfiguration { - @Bean - @ConditionalOnClass(RedisOperations::class) - @ConditionalOnMissingBean(GenerateSerialNumber::class) - fun redisGenerateSerialNumber(stringRedisTemplate: StringRedisTemplate): GenerateSerialNumber = - RedisGenerateSerialNumber(stringRedisTemplate) - - @Bean - @ConditionalOnClass(CuratorFramework::class) - @ConditionalOnMissingBean(CuratorFramework::class) - fun acpZkClient(zkClientConfiguration: ZkClientConfiguration): CuratorFramework = - CuratorFrameworkFactory.builder().apply { - this.connectString(zkClientConfiguration.connect).sessionTimeoutMs(zkClientConfiguration.sessionTimeOut) - .connectionTimeoutMs(zkClientConfiguration.connectionTimeOut) - .retryPolicy(RetryForever(zkClientConfiguration.retryIntervalMs)) - if (zkClientConfiguration.aclEnable) { - this.authorization( - zkClientConfiguration.aclSchema, - "${zkClientConfiguration.aclUsername}:${zkClientConfiguration.aclPassword}".toByteArray() - ) - } - }.build().apply { this.start() } - @Bean @ConditionalOnMissingBean(BytesMessageSender::class) fun zipkinKafkaSender(kafkaProperties: KafkaProperties): BytesMessageSender = diff --git a/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/AcpAdminDistributedLockAutoConfiguration.kt b/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/AcpAdminDistributedLockAutoConfiguration.kt deleted file mode 100644 index 55281b8cbc94128951b938e3ab4f3119d7728cc4..0000000000000000000000000000000000000000 --- a/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/AcpAdminDistributedLockAutoConfiguration.kt +++ /dev/null @@ -1,28 +0,0 @@ -package io.gitee.zhangbinhub.admin.common - -import io.gitee.zhangbinhub.acp.boot.log.LogAdapter -import io.gitee.zhangbinhub.acp.cloud.AcpCloudLogAutoConfiguration -import io.gitee.zhangbinhub.acp.cloud.lock.DistributedLock -import io.gitee.zhangbinhub.admin.common.lock.ZkDistributedLock -import org.apache.curator.framework.CuratorFramework -import org.springframework.boot.autoconfigure.AutoConfiguration -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Import -import org.springframework.context.annotation.Primary - -/** - * @author zhang by 30/09/2019 - * @since JDK 11 - */ -@AutoConfiguration(after = [AcpAdminComponentAutoConfiguration::class]) -@ConditionalOnMissingBean(DistributedLock::class) -@Import(AcpCloudLogAutoConfiguration::class) -class AcpAdminDistributedLockAutoConfiguration { - @Bean - @Primary - @ConditionalOnBean(CuratorFramework::class) - fun zkDistributedLock(curatorFramework: CuratorFramework, logAdapter: LogAdapter): DistributedLock = - ZkDistributedLock(curatorFramework, logAdapter) -} \ No newline at end of file diff --git a/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/lock/ZkDistributedLock.kt b/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/lock/ZkDistributedLock.kt deleted file mode 100644 index c1d86352a92e82b140a885352bfc2a3884cf6739..0000000000000000000000000000000000000000 --- a/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/lock/ZkDistributedLock.kt +++ /dev/null @@ -1,75 +0,0 @@ -package io.gitee.zhangbinhub.admin.common.lock - -import io.gitee.zhangbinhub.acp.boot.log.LogAdapter -import io.gitee.zhangbinhub.acp.cloud.lock.DistributedLock -import org.apache.curator.framework.CuratorFramework -import org.apache.curator.framework.recipes.locks.InterProcessMutex -import java.util.concurrent.ConcurrentHashMap -import java.util.concurrent.TimeUnit - - -/** - * @author zhang by 30/09/2019 - * @since JDK 11 - */ -class ZkDistributedLock( - private val curatorFramework: CuratorFramework, - private val logAdapter: LogAdapter -) : DistributedLock { - - /** - * 获取分布式锁 - * 获取锁的过程会阻塞 - * 成功时,返回true - * 失败时,一直阻塞直到成功获取锁,阻塞时间超过超时时间时返回false - * @param lockId 锁ID - * @param clientId 客户端ID - * @param timeOut 超时时间 - * @param reentrant 是否可重入 - * @return true|false 是否成功获取锁 - */ - override fun getLock(lockId: String, clientId: String, timeOut: Long, reentrant: Boolean): Boolean { - val key = "${lockId}_${clientId}_${Thread.currentThread().hashCode()}" - if (reentrant) { - distributedLockMap[key]?.let { lock -> - if (lock.isOwnedByCurrentThread) { - lock - } else { - InterProcessMutex(curatorFramework, "$DISTRIBUTED_LOCK_ROOT_PATH/$lockId") - } - } ?: InterProcessMutex(curatorFramework, "$DISTRIBUTED_LOCK_ROOT_PATH/$lockId") - } else { - InterProcessMutex(curatorFramework, "$DISTRIBUTED_LOCK_ROOT_PATH/$lockId") - }.let { lock -> - return try { - val result = lock.acquire(timeOut, TimeUnit.MILLISECONDS) - if (result) { - distributedLockMap[key] = lock - } - return result - } catch (e: Exception) { - logAdapter.error(e.message, e) - false - } - } - } - - override fun releaseLock(lockId: String, clientId: String) { - val key = "${lockId}_${clientId}_${Thread.currentThread().hashCode()}" - try { - distributedLockMap[key]?.let { lock -> - lock.release() - if (!lock.isAcquiredInThisProcess) { - distributedLockMap.remove(key) - } - } - } catch (e: Exception) { - logAdapter.error(e.message, e) - } - } - - companion object { - private const val DISTRIBUTED_LOCK_ROOT_PATH = "/_acp_distribute_lock" - private val distributedLockMap: ConcurrentHashMap = ConcurrentHashMap() - } -} \ No newline at end of file diff --git a/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/serialnumber/GenerateSerialNumber.kt b/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/serialnumber/GenerateSerialNumber.kt deleted file mode 100644 index f7bc6ce0b37949b067c6462cdb5fb3425a313fda..0000000000000000000000000000000000000000 --- a/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/serialnumber/GenerateSerialNumber.kt +++ /dev/null @@ -1,16 +0,0 @@ -package io.gitee.zhangbinhub.admin.common.serialnumber - -import io.gitee.zhangbinhub.acp.core.common.CalendarTools - -/** - * @author zhang by 05/03/2020 - * @since JDK 11 - */ -interface GenerateSerialNumber { - /** - * 生成序列号 - * @param keyString 序列号键名称 - * @param expirationTime 过期时间(重新计数超时时间),单位毫秒,默认24小时 - */ - fun getSerialNumber(keyString: String = CalendarTools.getNowString(), expirationTime: Long = 86400000): Long -} \ No newline at end of file diff --git a/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/serialnumber/RedisGenerateSerialNumber.kt b/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/serialnumber/RedisGenerateSerialNumber.kt deleted file mode 100644 index 609908e15575bc861dde09e94d27039fad32797c..0000000000000000000000000000000000000000 --- a/common/acp-admin-cloud-dependencies/src/main/kotlin/io/gitee/zhangbinhub/admin/common/serialnumber/RedisGenerateSerialNumber.kt +++ /dev/null @@ -1,31 +0,0 @@ -package io.gitee.zhangbinhub.admin.common.serialnumber - -import org.springframework.data.redis.core.StringRedisTemplate - -/** - * @author zhang by 03/08/2019 - * @since JDK 11 - */ -class RedisGenerateSerialNumber(private val stringRedisTemplate: StringRedisTemplate) : GenerateSerialNumber { - - /** - * 生成序列号 - * @param keyString 序列号键名称 - * @param expirationTime 过期时间(重新计数超时时间),单位毫秒,默认24小时 - */ - override fun getSerialNumber(keyString: String, expirationTime: Long): Long = - (stringRedisTemplate.execute { connection -> - connection.execute("incr", keyString.toByteArray()) - } as Long).also { - if (it == 1L) { - stringRedisTemplate.execute { connection -> - connection.execute( - "pexpire", - keyString.toByteArray(), - expirationTime.toString().toByteArray() - ) - } - } - } - -} \ No newline at end of file diff --git a/common/acp-admin-cloud-dependencies/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/common/acp-admin-cloud-dependencies/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 556a104b9de17fa76dbcce4968ef0958ffb3f2d4..38da65a24267a191b52a922065ce45d22e9fea31 100644 --- a/common/acp-admin-cloud-dependencies/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/common/acp-admin-cloud-dependencies/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,3 +1,2 @@ io.gitee.zhangbinhub.admin.common.AcpAdminComponentAutoConfiguration -io.gitee.zhangbinhub.admin.common.AcpAdminDistributedLockAutoConfiguration io.gitee.zhangbinhub.admin.common.AcpAdminInfoAutoConfiguration \ No newline at end of file diff --git a/deploy/docker/middleware/.env b/deploy/docker/middleware/.env index 7ac3d61d4bcf37e301d60882d4a0f9f4af4c8c68..f2f6c280958e793b5524ccd7358118b85e675e35 100644 --- a/deploy/docker/middleware/.env +++ b/deploy/docker/middleware/.env @@ -1 +1,2 @@ -HOST_MACHINE_IP=10.100.137.68 \ No newline at end of file +HOST_MACHINE_IP=10.100.137.68 +KAFKA_CLUSTER_ID=acp_admin_cloud_test \ No newline at end of file diff --git a/deploy/docker/middleware/docker-compose.yaml b/deploy/docker/middleware/docker-compose.yaml index 5bcb2d2d93912df4c10fe2af14db5ca581b085cb..aadd61119037b8f6b6626710f27722dc00891e1c 100644 --- a/deploy/docker/middleware/docker-compose.yaml +++ b/deploy/docker/middleware/docker-compose.yaml @@ -1,18 +1,19 @@ version: "3.7" services: nacos: - image: nacos/nacos-server:v2.5.1 + image: nacos/nacos-server:v3.0.2 container_name: nacos-standalone-mysql restart: always environment: JVM_XMS: 256m JVM_XMX: 512m MODE: standalone - NACOS_APPLICATION_PORT: 8848 NACOS_AUTH_ENABLE: true NACOS_AUTH_TOKEN: SecretKey012345678901234567890123456789012345678901234567890123456799 NACOS_AUTH_IDENTITY_KEY: nacos NACOS_AUTH_IDENTITY_VALUE: nacos + NACOS_CONSOLE_PORT: 8080 + NACOS_CONSOLE_CONTEXTPATH: /nacos SPRING_DATASOURCE_PLATFORM: mysql MYSQL_SERVICE_HOST: mysql MYSQL_SERVICE_PORT: 3306 @@ -23,6 +24,7 @@ services: volumes: - ./nacos/logs/:/home/nacos/logs ports: + - "8080:8080" - "8848:8848" - "9848:9848" - "9849:9849" @@ -54,25 +56,19 @@ services: networks: - mysql_net - zookeeper: - image: bitnami/zookeeper:3.8.0 - hostname: zookeeper - container_name: zookeeper - restart: always - volumes: - - ./zk/data:/bitnami/zookeeper/data + kafka-ui: + container_name: kafka-ui + image: provectuslabs/kafka-ui:latest ports: - - "21810:21810" + - "8989:8080" + depends_on: + - kafka-1 + - kafka-2 + - kafka-3 environment: - ZOO_PORT_NUMBER: 21810 - ZOO_SERVER_ID: 1 - ZOO_SERVERS: server.1=0.0.0.0:2888:3888 - ZOO_ENABLE_AUTH: "yes" - # ZOO_SERVER_USER: zk_srv - # ZOO_SERVER_PASSWORD: zk_srv_pwd - ZOO_CLIENT_USER: zk - ZOO_CLIENT_PASSWORD: zk_pwd - JVMFLAGS: "-Xms1024m -Xmx1024m" + - KAFKA_CLUSTERS_0_NAME=kafkaCluster + - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=${HOST_MACHINE_IP}:9091,${HOST_MACHINE_IP}:9092,${HOST_MACHINE_IP}:9093 + - DYNAMIC_CONFIG_ENABLED=true networks: - mysql_net @@ -85,82 +81,111 @@ services: - ./kafka/data/kafka-1:/bitnami/kafka/data ports: - "9091:9091" + - "9191:9191" + - "9291:9291" - "9891:9891" - "9991:9991" environment: ALLOW_PLAINTEXT_LISTENER: "yes" + # 使用Kafka时的集群id,集群内的Kafka都要用这个id做初始化,生成一个UUID即可 KAFKA_BROKER_ID: 1 - KAFKA_ZOOKEEPER_PROTOCOL: "PLAINTEXT" - KAFKA_ZOOKEEPER_USER: zk - KAFKA_ZOOKEEPER_PASSWORD: zk_pwd - KAFKA_CFG_LISTENERS: OUTSIDE://0.0.0.0:9091,INTERNAL://:9191 - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: "OUTSIDE:PLAINTEXT,INTERNAL:PLAINTEXT" - KAFKA_CFG_ADVERTISED_LISTENERS: OUTSIDE://${HOST_MACHINE_IP}:9091,INTERNAL://:9191 + KAFKA_CFG_NODE_ID: 1 + KAFKA_ENABLE_KRAFT: "yes" + KAFKA_KRAFT_CLUSTER_ID: ${KAFKA_CLUSTER_ID} + KAFKA_CFG_PROCESS_ROLES: broker,controller + # 集群地址 + KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 1@kafka-1:9291,2@kafka-2:9292,3@kafka-3:9293 + KAFKA_CFG_LISTENERS: OUTSIDE://0.0.0.0:9091,INTERNAL://:9191,CONTROLLER://0.0.0.0:9291 + KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: "OUTSIDE:PLAINTEXT,INTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT" + KAFKA_CFG_ADVERTISED_LISTENERS: OUTSIDE://${HOST_MACHINE_IP}:9091,INTERNAL://kafka-1:9191 + KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER KAFKA_CFG_INTER_BROKER_LISTENER_NAME: INTERNAL - # KAFKA_CFG_ADVERTISED_PORT: 9091 - KAFKA_CFG_ZOOKEEPER_CONNECT: "zookeeper:21810" # 非必须,设置保存7天数据,为默认值 KAFKA_CFG_LOG_RETENTION_HOURS: 168 - KAFKA_CFG_NUM_PARTITIONS: 1 - KAFKA_CFG_DEFAULT_REPLICATION_FACTOR: 1 - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_CFG_NUM_PARTITIONS: 3 + KAFKA_CFG_DEFAULT_REPLICATION_FACTOR: 3 + KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "true" - # KAFKA_HEAP_OPTS: "-Xmx1G -Xms1G" -# HOST_MACHINE_IP: ${HOST_MACHINE_IP} KAFKA_JMX_OPTS: "-Dcom.sun.management.jmxremote.port=9891 -Dcom.sun.management.jmxremote.rmi.port=9991 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" - depends_on: - - zookeeper networks: - mysql_net - efak: - image: seawenc/efak:3.0.6 - container_name: efak + kafka-2: + image: bitnami/kafka:3.8.0 + hostname: kafka-2 + container_name: kafka-2 restart: always volumes: - - ./efak/conf/system-config.properties:/opt/app/efak/conf/system-config.properties - - ./efak/data:/data + - ./kafka/data/kafka-2:/bitnami/kafka/data ports: - - "8048:8048" - depends_on: - - zookeeper + - "9092:9092" + - "9192:9192" + - "9292:9292" + - "9892:9892" + - "9992:9992" + environment: + ALLOW_PLAINTEXT_LISTENER: "yes" + # 使用Kafka时的集群id,集群内的Kafka都要用这个id做初始化,生成一个UUID即可 + KAFKA_BROKER_ID: 2 + KAFKA_CFG_NODE_ID: 2 + KAFKA_ENABLE_KRAFT: "yes" + KAFKA_KRAFT_CLUSTER_ID: ${KAFKA_CLUSTER_ID} + KAFKA_CFG_PROCESS_ROLES: broker,controller + # 集群地址 + KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 1@kafka-1:9291,2@kafka-2:9292,3@kafka-3:9293 + KAFKA_CFG_LISTENERS: OUTSIDE://0.0.0.0:9092,INTERNAL://:9192,CONTROLLER://0.0.0.0:9292 + KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: "OUTSIDE:PLAINTEXT,INTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT" + KAFKA_CFG_ADVERTISED_LISTENERS: OUTSIDE://${HOST_MACHINE_IP}:9092,INTERNAL://kafka-2:9192 + KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER + KAFKA_CFG_INTER_BROKER_LISTENER_NAME: INTERNAL + # 非必须,设置保存7天数据,为默认值 + KAFKA_CFG_LOG_RETENTION_HOURS: 168 + KAFKA_CFG_NUM_PARTITIONS: 3 + KAFKA_CFG_DEFAULT_REPLICATION_FACTOR: 3 + KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 + KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "true" + KAFKA_JMX_OPTS: "-Dcom.sun.management.jmxremote.port=9892 -Dcom.sun.management.jmxremote.rmi.port=9992 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" networks: - mysql_net - # mysql-zipkin: - # image: mysql:8.0.33 - # container_name: mysql-zipkin - # restart: always - # environment: - # MYSQL_ROOT_PASSWORD: test - # MYSQL_DATABASE: zipkin - # MYSQL_USER: zipkin - # MYSQL_PASSWORD: zipkin - # volumes: - # - ./mysql-zipkin:/var/lib/mysql - # ports: - # - "3307:3306" - # networks: - # - middleware_net - - zipkin-server: - image: openzipkin/zipkin:2.24.3 - container_name: zipkin-server + kafka-3: + image: bitnami/kafka:3.8.0 + hostname: kafka-3 + container_name: kafka-3 restart: always + volumes: + - ./kafka/data/kafka-3:/bitnami/kafka/data ports: - - "9411:9411" + - "9093:9093" + - "9193:9193" + - "9293:9293" + - "9893:9893" + - "9993:9993" environment: - - KAFKA_BOOTSTRAP_SERVERS=kafka-1:9191 - # - STORAGE_TYPE=mysql - # - MYSQL_HOST=mysql-zipkin - # - MYSQL_TCP_PORT=3306 - # - MYSQL_DB=zipkin - # - MYSQL_USER=zipkin - # - MYSQL_PASS=zipkin - - kMEM_MAX_SPANS=100000 - # - "JAVA_OPTS=-Xms512m -Xmx2g -XX:+ExitOnOutOfMemoryError" + ALLOW_PLAINTEXT_LISTENER: "yes" + # 使用Kafka时的集群id,集群内的Kafka都要用这个id做初始化,生成一个UUID即可 + KAFKA_BROKER_ID: 3 + KAFKA_CFG_NODE_ID: 3 + KAFKA_ENABLE_KRAFT: "yes" + KAFKA_KRAFT_CLUSTER_ID: ${KAFKA_CLUSTER_ID} + KAFKA_CFG_PROCESS_ROLES: broker,controller + # 集群地址 + KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 1@kafka-1:9291,2@kafka-2:9292,3@kafka-3:9293 + KAFKA_CFG_LISTENERS: OUTSIDE://0.0.0.0:9093,INTERNAL://:9193,CONTROLLER://0.0.0.0:9293 + KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: "OUTSIDE:PLAINTEXT,INTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT" + KAFKA_CFG_ADVERTISED_LISTENERS: OUTSIDE://${HOST_MACHINE_IP}:9093,INTERNAL://kafka-2:9193 + KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER + KAFKA_CFG_INTER_BROKER_LISTENER_NAME: INTERNAL + # 非必须,设置保存7天数据,为默认值 + KAFKA_CFG_LOG_RETENTION_HOURS: 168 + KAFKA_CFG_NUM_PARTITIONS: 3 + KAFKA_CFG_DEFAULT_REPLICATION_FACTOR: 3 + KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 + KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "true" + KAFKA_JMX_OPTS: "-Dcom.sun.management.jmxremote.port=9893 -Dcom.sun.management.jmxremote.rmi.port=9993 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" networks: - mysql_net + networks: mysql_net: external: true \ No newline at end of file diff --git a/deploy/docker/middleware/efak/conf/system-config.properties b/deploy/docker/middleware/efak/conf/system-config.properties deleted file mode 100644 index 848b7c818fa0a3ed31492bbf3c8f974f5a5d6bc4..0000000000000000000000000000000000000000 --- a/deploy/docker/middleware/efak/conf/system-config.properties +++ /dev/null @@ -1,138 +0,0 @@ -###################################### -# multi zookeeper & kafka cluster list -# Settings prefixed with 'kafka.eagle.' will be deprecated, use 'efak.' instead -###################################### -efak.zk.cluster.alias=cluster1 -cluster1.zk.list=zookeeper:21810 -cluster2.zk.list=zookeeper:21810 - -###################################### -# zookeeper enable acl -###################################### -cluster1.zk.acl.enable=true -cluster1.zk.acl.schema=digest -cluster1.zk.acl.username=zk -cluster1.zk.acl.password=zk_pwd - -###################################### -# broker size online list -###################################### -cluster1.efak.broker.size=20 - -###################################### -# zk client thread limit -###################################### -kafka.zk.limit.size=16 - -###################################### -# EFAK webui port -###################################### -efak.webui.port=8048 - -###################################### -# EFAK enable distributed -###################################### -efak.distributed.enable=false -efak.cluster.mode.status=master -efak.worknode.master.host=localhost -efak.worknode.port=8085 - -###################################### -# kafka jmx acl and ssl authenticate -###################################### -cluster1.efak.jmx.acl=false -cluster1.efak.jmx.user=keadmin -cluster1.efak.jmx.password=keadmin123 -cluster1.efak.jmx.ssl=false -cluster1.efak.jmx.truststore.location=/data/ssl/certificates/kafka.truststore -cluster1.efak.jmx.truststore.password=ke123456 - -###################################### -# kafka offset storage -###################################### -cluster1.efak.offset.storage=kafka -cluster2.efak.offset.storage=zk - -###################################### -# kafka jmx uri -###################################### -cluster1.efak.jmx.uri=service:jmx:rmi:///jndi/rmi://%s/jmxrmi - -###################################### -# kafka metrics, 15 days by default -###################################### -efak.metrics.charts=true -efak.metrics.retain=15 - -###################################### -# kafka sql topic records max -###################################### -efak.sql.topic.records.max=5000 -efak.sql.topic.preview.records.max=10 - -###################################### -# delete kafka topic token -###################################### -efak.topic.token=keadmin - -###################################### -# kafka sasl authenticate -###################################### -cluster1.efak.sasl.enable=false -cluster1.efak.sasl.protocol=SASL_PLAINTEXT -cluster1.efak.sasl.mechanism=PLAIN -cluster1.efak.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="aaBB@1122"; -cluster1.efak.sasl.client.id= -cluster1.efak.blacklist.topics= -cluster1.efak.sasl.cgroup.enable=false -cluster1.efak.sasl.cgroup.topics= -cluster2.efak.sasl.enable=false -cluster2.efak.sasl.protocol=SASL_PLAINTEXT -cluster2.efak.sasl.mechanism=PLAIN -cluster2.efak.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="kafka" password="kafka-eagle"; -cluster2.efak.sasl.client.id= -cluster2.efak.blacklist.topics= -cluster2.efak.sasl.cgroup.enable=false -cluster2.efak.sasl.cgroup.topics= - -###################################### -# kafka ssl authenticate -###################################### -cluster3.efak.ssl.enable=false -cluster3.efak.ssl.protocol=SSL -cluster3.efak.ssl.truststore.location= -cluster3.efak.ssl.truststore.password= -cluster3.efak.ssl.keystore.location= -cluster3.efak.ssl.keystore.password= -cluster3.efak.ssl.key.password= -cluster3.efak.ssl.endpoint.identification.algorithm=https -cluster3.efak.blacklist.topics= -cluster3.efak.ssl.cgroup.enable=false -cluster3.efak.ssl.cgroup.topics= - -###################################### -# kafka sqlite jdbc driver address -###################################### -#efak.driver=org.sqlite.JDBC -#efak.url=jdbc:sqlite:/hadoop/kafka-eagle/db/ke.db -#efak.username=root -#efak.password=www.kafka-eagle.org - -###################################### -# kafka mysql jdbc driver address -###################################### -###################################### -# kafka sqlite jdbc driver address -###################################### -efak.driver=org.sqlite.JDBC -efak.url=jdbc:sqlite:/data/ke.db -efak.username=root -efak.password=www.kafka-eagle.org - -###################################### -# kafka mysql jdbc driver address -###################################### -#efak.driver=com.mysql.cj.jdbc.Driver -#efak.url=jdbc:mysql://127.0.0.1:3306/ke?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull -#efak.username=root -#efak.password=123456 \ No newline at end of file diff --git a/deploy/docker/middleware/efak/data/777 b/deploy/docker/middleware/efak/data/777 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/deploy/docker/middleware/redis/data/777 b/deploy/docker/middleware/redis/data/777 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/deploy/docker/middleware/zk/data/777 b/deploy/docker/middleware/zk/data/777 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/doc/atom-server-common-dev.yaml b/doc/atom-server-common-dev.yaml index 58e2e4e869c9f5b4fb1b8dab2bec7d4c08816782..a50f84a94bae610b4184a6fe8bb121feab2ddf29 100644 --- a/doc/atom-server-common-dev.yaml +++ b/doc/atom-server-common-dev.yaml @@ -45,7 +45,7 @@ spring: redis: url: redis://:redis@127.0.0.1:6379 kafka: - bootstrap-servers: 127.0.0.1:9091 + bootstrap-servers: 127.0.0.1:9091,127.0.0.1:9092,127.0.0.1:9093 producer: # 0代表:不进行消息接收是否成功的确认(默认值); # 1代表:当Leader副本接收成功后,返回接收成功确认信息; @@ -114,11 +114,4 @@ springdoc: enabled: true feign: sentinel: - enabled: true -acp: - cloud: - zookeeper: - connect: 127.0.0.1:21810 - acl-enable: true - acl-username: zk - acl-password: zk_pwd \ No newline at end of file + enabled: true \ No newline at end of file diff --git a/doc/nacos_config_export_dev.zip b/doc/nacos_config_export_dev.zip index fb0a2ff1a75a47bd7d692969613aabf8d0f50988..c500787d9efe2f53c9d57d34e25be7211d9b7c0c 100644 Binary files a/doc/nacos_config_export_dev.zip and b/doc/nacos_config_export_dev.zip differ diff --git a/doc/version_history.md b/doc/version_history.md index 318004eb411538658edbf11ad6fde436ad1356e3..39362330c7334fd3ce49b3f4026017723f7f2f84 100644 --- a/doc/version_history.md +++ b/doc/version_history.md @@ -1,5 +1,20 @@ ## 版本更新记录 +##### v6.9.0 + +- Global + - [Upgrade] 升级依赖 + - Acp 2025.5.0 + - Spring Boot 3.5.3 + - Spring Boot Admin 3.5.1 +- acp-admin-cloud-dependencies + - [Delete] 去除自定义分布式锁和生成序列号 +- gateway-server + - [Upgrade] 修改路由配置 +- workflow-server + - [Upgrade] 取消工作流后端渲染流程图接口 + - [Upgrade] 自定义事务处理,解决`JPA`和`Mybatis-Flex`共存时事务失效的问题 + ##### v6.8.1 - Global diff --git a/gradle/application.gradle b/gradle/application.gradle index 36809dc4db5fd8467d6c49b7df123f429cbbc7cd..b124c4445b8c737b0e175f7028b346bcae209d60 100644 --- a/gradle/application.gradle +++ b/gradle/application.gradle @@ -2,13 +2,13 @@ apply plugin: "org.springframework.boot" apply plugin: "io.spring.dependency-management" dependencyManagement { imports { - mavenBom("io.gitee.zhangbinhub.acp:acp-spring-dependency:$versions.acp") + mavenBom("io.gitee.zhangbinhub.acp:acp-spring-dependency:${libs.versions.acp.get()}") } } bootJar { duplicatesStrategy DuplicatesStrategy.INCLUDE manifest { - attributes('Implementation-Vendor': "${project.group}", 'Implementation-Title': "${project.name}", 'Implementation-Version': "${project.version}", 'Build-By': "Gradle ${projectProperties.getProperty('gradleVersion')}", 'Jvm-Version': "${projectProperties.getProperty('javaVersion')}", 'Kotlin-Version': "$versions.kotlin", 'Spring-Boot-Version': "$versions.springBoot") + attributes('Implementation-Vendor': "${project.group}", 'Implementation-Title': "${project.name}", 'Implementation-Version': "${project.version}", 'Build-By': "Gradle ${projectProperties.getProperty('gradleVersion')}", 'Jvm-Version': "${projectProperties.getProperty('javaVersion')}", 'Kotlin-Version': "${libs.versions.kotlin.get()}", 'Spring-Boot-Version': "${libs.versions.springBoot.get()}") } } springBoot { @@ -22,16 +22,16 @@ tasks.register('buildImage', Exec) { workingDir projectDir commandLine "docker", "build", "-t", "${projectProperties.getProperty('imagePushUrl')}/${project.name}:${project.version}", - "--force-rm", "--build-arg", "appJar=${project.name}-${project.version}.jar", + "--build-arg", "appJar=${project.name}-${project.version}.jar", "." +} +tasks.register('buildAndSaveImage', Exec) { + dependsOn(buildImage) + workingDir projectDir + commandLine "docker", "save", "-o", + "$rootDir${File.separator}release${File.separator}images${File.separator}${project.name}_${project.version}.tar", + "${projectProperties.getProperty('imagePushUrl')}/${project.name}:${project.version}" doLast { - mkdir("$rootDir${File.separator}release${File.separator}images") - exec { - workingDir projectDir - commandLine "docker", "save", "-o", - "$rootDir${File.separator}release${File.separator}images${File.separator}${project.name}_${project.version}.tar", - "${projectProperties.getProperty('imagePushUrl')}/${project.name}:${project.version}" - } println("Save image [${projectProperties.getProperty('imagePushUrl')}/${project.name}:${project.version}] to $rootDir${File.separator}release${File.separator}images${File.separator}${project.name}_${project.version}.tar") } } diff --git a/gradle/commonTask.gradle b/gradle/commonTask.gradle index 4ccf07ee9982e5bb3cb029336f54f1b6b375dfcc..f695394417bb54ddc1f93b708173664483a6d8f4 100644 --- a/gradle/commonTask.gradle +++ b/gradle/commonTask.gradle @@ -82,7 +82,7 @@ jar { println("Begin building jar: ${project.name}-${project.version}.jar whith ${project.group}:${project.name}:${project.version} ...") } manifest { - attributes('Implementation-Vendor': "${project.group}", 'Implementation-Title': "${project.name}", 'Implementation-Version': "${project.version}", 'Build-By': "Gradle ${projectProperties.getProperty('gradleVersion')}", 'Jvm-Version': "${projectProperties.getProperty('javaVersion')}", 'Kotlin-Version': "$versions.kotlin") + attributes('Implementation-Vendor': "${project.group}", 'Implementation-Title': "${project.name}", 'Implementation-Version': "${project.version}", 'Build-By': "Gradle ${projectProperties.getProperty('gradleVersion')}", 'Jvm-Version': "${projectProperties.getProperty('javaVersion')}", 'Kotlin-Version': "${libs.versions.kotlin.get()}") } } diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle deleted file mode 100644 index f7fb1b804490754e2a4be55717e640f3ceb681df..0000000000000000000000000000000000000000 --- a/gradle/dependencies.gradle +++ /dev/null @@ -1,13 +0,0 @@ -ext { - versions = [:] -} - -versions += [ - kotlin : "2.1.21", - springBoot : "3.4.6", - springBootAdmin : "3.4.7", - acp : "2025.4.1", - sensitive : "1.7.0", - sensitiveDeepCopy: "0.0.1", - mysql : "9.2.0" -] \ No newline at end of file diff --git a/gradle/environment.gradle b/gradle/environment.gradle index 4c4456ded7449b7fe3e6b69c5200395e216221f2..94881be3f638982b5a0759c683619162c0bd2993 100644 --- a/gradle/environment.gradle +++ b/gradle/environment.gradle @@ -1,7 +1,6 @@ ext { jvmMemoryParam = [:] jvmExtParam = [:] - imageParam = [:] } jvmMemoryParam += [ 'default': '-Xms256m -Xmx512m' diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000000000000000000000000000000000000..bd13cd5193f4d4e41c426f95bf5385a65a0c8719 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,10 @@ +[versions] +######################## gradle plugins ##################### +kotlin = "2.1.21" +######################## dependencies ##################### +acp = "2025.5.0" +springBoot = "3.5.3" +springBootAdmin = "3.5.1" +sensitive = "1.7.0" +sensitiveDeepCopy = "0.0.1" +mysql = "9.2.0" \ No newline at end of file diff --git a/gradle/moduleVersion.gradle b/gradle/moduleVersion.gradle index 95058a1490900b635d50a826dee4084e3b92bf9c..8c3ba0d8f51986f0123b183c4f2561c0e72f4762 100644 --- a/gradle/moduleVersion.gradle +++ b/gradle/moduleVersion.gradle @@ -1,30 +1,30 @@ project(':acp-admin-cloud-constant') { - version '6.8.1' + version '6.9.0' } project(':acp-admin-cloud-dependencies') { - version '6.8.1' + version '6.9.0' } project(':acp-admin-cloud-dependencies-resource-server') { - version '6.8.1' + version '6.9.0' } project(':admin-server') { - version '6.8.1' + version '6.9.0' } project(':deploy-server') { - version '6.8.1' + version '6.9.0' } project(':gateway-server') { - version '6.8.1' + version '6.9.0' } project(':log-server') { - version '6.8.1' + version '6.9.0' } project(':oauth-server') { - version '6.8.1' + version '6.9.0' } project(':route-server') { - version '6.8.1' + version '6.9.0' } project(':workflow-server') { - version '6.8.1' + version '6.9.0' } \ No newline at end of file diff --git a/modules/admin-server/build.gradle b/modules/admin-server/build.gradle index 32926cee1abea199530aa15b7eb057a11d917dad..e42fb3e0ccbff98db5d7a1fc0fbb46fc58d3548b 100644 --- a/modules/admin-server/build.gradle +++ b/modules/admin-server/build.gradle @@ -1,7 +1,7 @@ apply from: "$rootDir/gradle/application.gradle" dependencyManagement { imports { - mavenBom "de.codecentric:spring-boot-admin-dependencies:$versions.springBootAdmin" + mavenBom "de.codecentric:spring-boot-admin-dependencies:${libs.versions.springBootAdmin.get()}" } } dependencies { diff --git a/modules/admin-server/src/main/kotlin/io/gitee/zhangbinhub/admin/adminserver/conf/AdminServerAutoConfiguration.kt b/modules/admin-server/src/main/kotlin/io/gitee/zhangbinhub/admin/adminserver/conf/AdminServerAutoConfiguration.kt index aa5941f8cff2f8f449f200edfce8567a11e4c74c..60bc2b27fb0002f51cf8f7cdae4c82764c449ef1 100644 --- a/modules/admin-server/src/main/kotlin/io/gitee/zhangbinhub/admin/adminserver/conf/AdminServerAutoConfiguration.kt +++ b/modules/admin-server/src/main/kotlin/io/gitee/zhangbinhub/admin/adminserver/conf/AdminServerAutoConfiguration.kt @@ -8,7 +8,7 @@ import org.springframework.security.config.Customizer import org.springframework.security.config.annotation.web.builders.HttpSecurity import org.springframework.security.web.SecurityFilterChain import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler -import org.springframework.security.web.util.matcher.AntPathRequestMatcher +import org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher @Configuration class AdminServerAutoConfiguration @Autowired @@ -29,14 +29,14 @@ constructor(adminServerProperties: AdminServerProperties) { successHandler.setDefaultTargetUrl("$adminContextPath/") return http.csrf { it.disable() }.authorizeHttpRequests { authorize -> authorize.requestMatchers( - AntPathRequestMatcher("$adminContextPath/assets/**"), - AntPathRequestMatcher("$adminContextPath/instances"), - AntPathRequestMatcher("$adminContextPath/instances/**"), - AntPathRequestMatcher("$adminContextPath/login"), - AntPathRequestMatcher("$adminContextPath/error"), - AntPathRequestMatcher("$adminContextPath/webjars/**"), - AntPathRequestMatcher("$adminContextPath/notifications/**"), - AntPathRequestMatcher("$adminContextPath/proxy.stream") + PathPatternRequestMatcher.withDefaults().matcher("$adminContextPath/assets/**"), + PathPatternRequestMatcher.withDefaults().matcher("$adminContextPath/instances"), + PathPatternRequestMatcher.withDefaults().matcher("$adminContextPath/instances/**"), + PathPatternRequestMatcher.withDefaults().matcher("$adminContextPath/login"), + PathPatternRequestMatcher.withDefaults().matcher("$adminContextPath/error"), + PathPatternRequestMatcher.withDefaults().matcher("$adminContextPath/webjars/**"), + PathPatternRequestMatcher.withDefaults().matcher("$adminContextPath/notifications/**"), + PathPatternRequestMatcher.withDefaults().matcher("$adminContextPath/proxy.stream") ).permitAll().anyRequest().authenticated() }.httpBasic(Customizer.withDefaults()) .formLogin { it.loginPage("$adminContextPath/login").successHandler(successHandler) } diff --git a/modules/admin-server/src/main/resources/application.yaml b/modules/admin-server/src/main/resources/application.yaml index c06f3f7e9fc2fffd5f84ce0cc87a5397dbbba76c..9db9c04ec44bf4e1b3c7ed3b7681010f0edcec48 100644 --- a/modules/admin-server/src/main/resources/application.yaml +++ b/modules/admin-server/src/main/resources/application.yaml @@ -16,8 +16,6 @@ spring: loadbalancer: cache: ttl: 5s - nacos: - enabled: true nacos: username: ${acp_nacos_username:nacos} password: ${acp_nacos_password:nacos} diff --git a/modules/admin-server/src/main/resources/logback-spring.xml b/modules/admin-server/src/main/resources/logback-spring.xml index 0d2548e3120208e2fbd610dbf744f5165e9bdbfd..2fe7764f2f504c2ea4f2cb76f28e710c0bfb9d74 100644 --- a/modules/admin-server/src/main/resources/logback-spring.xml +++ b/modules/admin-server/src/main/resources/logback-spring.xml @@ -1,9 +1,8 @@ + class="com.github.houbb.sensitive.logback.converter.SensitiveLogbackConverter"/> - \ No newline at end of file diff --git a/modules/deploy-server/build.gradle b/modules/deploy-server/build.gradle index 4b9acc43434d1c0818812452999fd7ff25443510..1dcee965bcb3e20d745fe21363212c55d35f267c 100644 --- a/modules/deploy-server/build.gradle +++ b/modules/deploy-server/build.gradle @@ -3,7 +3,7 @@ dependencies { implementation project(":acp-admin-cloud-dependencies-resource-server") // 数据库及驱动 implementation "org.springframework.boot:spring-boot-starter-data-jpa" - implementation "com.mysql:mysql-connector-j:$versions.mysql" + implementation "com.mysql:mysql-connector-j:${libs.versions.mysql.get()}" testImplementation "org.springframework.boot:spring-boot-starter-test" } \ No newline at end of file diff --git a/modules/deploy-server/src/main/kotlin/io/gitee/zhangbinhub/admin/deploy/bus/listener/DeployExecuteEventListener.kt b/modules/deploy-server/src/main/kotlin/io/gitee/zhangbinhub/admin/deploy/bus/listener/DeployExecuteEventListener.kt index ea336e6c77b20c816dd4f0fc46b2ff87b0e68370..924924fba5edbd2df2144ac539f5e89e6910eef4 100644 --- a/modules/deploy-server/src/main/kotlin/io/gitee/zhangbinhub/admin/deploy/bus/listener/DeployExecuteEventListener.kt +++ b/modules/deploy-server/src/main/kotlin/io/gitee/zhangbinhub/admin/deploy/bus/listener/DeployExecuteEventListener.kt @@ -68,7 +68,6 @@ constructor( private fun getLock(): Boolean = distributedLock.getLock( DeployConstant.DEPLOY_EXECUTE_DISTRIBUTED_LOCK_PREFIX + cloudTools.getServerIp(), - cloudTools.getServerIp() + ":" + cloudTools.getServerPort(), DeployConstant.DISTRIBUTED_LOCK_TIME_OUT ) @@ -77,8 +76,7 @@ constructor( delay(DeployConstant.DISTRIBUTED_LOCK_TIME_OUT) } distributedLock.releaseLock( - DeployConstant.DEPLOY_EXECUTE_DISTRIBUTED_LOCK_PREFIX + cloudTools.getServerIp(), - cloudTools.getServerIp() + ":" + cloudTools.getServerPort() + DeployConstant.DEPLOY_EXECUTE_DISTRIBUTED_LOCK_PREFIX + cloudTools.getServerIp() ) } } \ No newline at end of file diff --git a/modules/deploy-server/src/main/resources/application.yaml b/modules/deploy-server/src/main/resources/application.yaml index f5deeb77a5625b330f9e023fb0f1c94d2e342325..5c4275468f7ceac30afce94392c4acb2523d3e46 100644 --- a/modules/deploy-server/src/main/resources/application.yaml +++ b/modules/deploy-server/src/main/resources/application.yaml @@ -19,8 +19,6 @@ spring: loadbalancer: cache: ttl: 5s - nacos: - enabled: true nacos: username: ${acp_nacos_username:nacos} password: ${acp_nacos_password:nacos} diff --git a/modules/deploy-server/src/main/resources/logback-spring.xml b/modules/deploy-server/src/main/resources/logback-spring.xml index 0d2548e3120208e2fbd610dbf744f5165e9bdbfd..2fe7764f2f504c2ea4f2cb76f28e710c0bfb9d74 100644 --- a/modules/deploy-server/src/main/resources/logback-spring.xml +++ b/modules/deploy-server/src/main/resources/logback-spring.xml @@ -1,9 +1,8 @@ + class="com.github.houbb.sensitive.logback.converter.SensitiveLogbackConverter"/> - \ No newline at end of file diff --git a/modules/gateway-server/build.gradle b/modules/gateway-server/build.gradle index 8d759909dc6f577f60ef84343aaff7c746d2f522..128355d0a83a7f9d7608a4721dfa7fd12d21af7d 100644 --- a/modules/gateway-server/build.gradle +++ b/modules/gateway-server/build.gradle @@ -2,5 +2,5 @@ apply from: "$rootDir/gradle/application.gradle" dependencies { implementation project(":acp-admin-cloud-dependencies") implementation "org.springframework.boot:spring-boot-starter-security" - implementation "org.springframework.cloud:spring-cloud-starter-gateway" + implementation "org.springframework.cloud:spring-cloud-starter-gateway-server-webflux" } \ No newline at end of file diff --git a/modules/gateway-server/src/main/resources/application.yaml b/modules/gateway-server/src/main/resources/application.yaml index 0ef92ce006b24cbe22993d78f28102c2b3c32199..b9b44b6c25c60295c7e9f6cf0688f366ff66d749 100644 --- a/modules/gateway-server/src/main/resources/application.yaml +++ b/modules/gateway-server/src/main/resources/application.yaml @@ -16,8 +16,6 @@ spring: loadbalancer: cache: ttl: 5s - nacos: - enabled: true nacos: username: ${acp_nacos_username:nacos} password: ${acp_nacos_password:nacos} @@ -36,49 +34,51 @@ spring: # = GateWay Config # =============================== gateway: - httpclient: - connect-timeout: 30000 - pool: - max-idle-time: 10000 - loadbalancer: - use404: true - routes: - - id: deploy-server-api - uri: lb://deploy-server - predicates: - - Path=/api/deploy/** - filters: - - StripPrefix=1 - - id: log-server-api - uri: lb://log-server - predicates: - - Path=/api/log/** - filters: - - StripPrefix=1 - - id: route-server-api - uri: lb://route-server - predicates: - - Path=/api/route/** - filters: - - StripPrefix=1 - - id: oauth-server-api - uri: lb://oauth-server - predicates: - - Path=/api/oauth/** - filters: - - StripPrefix=1 - - id: oauth-server-open - uri: lb://oauth-server - predicates: - - Path=/open/oauth/** - filters: - - RewritePath=/open/oauth/(?.*),/open/$\{segment} - # - name: RequestRateLimiter - # args: - # redis-rate-limiter.replenishRate: 10 - # redis-rate-limiter.burstCapacity: 20 - # rate-limiter: "#{@myRateLimiter}" - # key-resolver: "#{@userKeyResolver}" + server: + webflux: + httpclient: + connect-timeout: 30000 + pool: + max-idle-time: 10000 + loadbalancer: + use404: true + routes: + - id: deploy-server-api + uri: lb://deploy-server + predicates: + - Path=/api/deploy/** + filters: + - StripPrefix=1 + - id: log-server-api + uri: lb://log-server + predicates: + - Path=/api/log/** + filters: + - StripPrefix=1 + - id: route-server-api + uri: lb://route-server + predicates: + - Path=/api/route/** + filters: + - StripPrefix=1 + - id: oauth-server-api + uri: lb://oauth-server + predicates: + - Path=/api/oauth/** + filters: + - StripPrefix=1 + - id: oauth-server-open + uri: lb://oauth-server + predicates: + - Path=/open/oauth/** + filters: + - RewritePath=/open/oauth/(?.*),/open/$\{segment} + # - name: RequestRateLimiter + # args: + # redis-rate-limiter.replenishRate: 10 + # redis-rate-limiter.burstCapacity: 20 + # rate-limiter: "#{@myRateLimiter}" + # key-resolver: "#{@userKeyResolver}" config: import: - optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml?group=${spring.cloud.nacos.discovery.group} diff --git a/modules/gateway-server/src/main/resources/logback-spring.xml b/modules/gateway-server/src/main/resources/logback-spring.xml index 0d2548e3120208e2fbd610dbf744f5165e9bdbfd..2fe7764f2f504c2ea4f2cb76f28e710c0bfb9d74 100644 --- a/modules/gateway-server/src/main/resources/logback-spring.xml +++ b/modules/gateway-server/src/main/resources/logback-spring.xml @@ -1,9 +1,8 @@ + class="com.github.houbb.sensitive.logback.converter.SensitiveLogbackConverter"/> - \ No newline at end of file diff --git a/modules/log-server/build.gradle b/modules/log-server/build.gradle index e7c4bd380e4005c2ce3c9a55b21724cb2b553131..6a0b5be92e0de44756a14bc70a3f552fc2f7efde 100644 --- a/modules/log-server/build.gradle +++ b/modules/log-server/build.gradle @@ -3,5 +3,5 @@ dependencies { implementation project(":acp-admin-cloud-dependencies-resource-server") // 数据库及驱动 implementation "org.springframework.boot:spring-boot-starter-data-jpa" - implementation "com.mysql:mysql-connector-j:$versions.mysql" + implementation "com.mysql:mysql-connector-j:${libs.versions.mysql.get()}" } \ No newline at end of file diff --git a/modules/log-server/src/main/kotlin/io/gitee/zhangbinhub/admin/log/schedule/LogDailyHistory.kt b/modules/log-server/src/main/kotlin/io/gitee/zhangbinhub/admin/log/schedule/LogDailyHistory.kt index 1bd609c63a453b2bd97040da9e3163baecec3573..9497397924eaa5ab4c9e14f45bbcd445e0365ad0 100644 --- a/modules/log-server/src/main/kotlin/io/gitee/zhangbinhub/admin/log/schedule/LogDailyHistory.kt +++ b/modules/log-server/src/main/kotlin/io/gitee/zhangbinhub/admin/log/schedule/LogDailyHistory.kt @@ -35,8 +35,7 @@ constructor( override fun beforeExecuteFun(): Boolean = distributedLock.getLock( - LogBackUp.LOG_BACKUP_DISTRIBUTED_LOCK_KEY, - cloudTools.getServerIp() + ":" + cloudTools.getServerPort(), + LogBackUp.LOG_BACKUP_DISTRIBUTED_LOCK_KEY + "_" + cloudTools.getServerIp() + ":" + cloudTools.getServerPort(), LogBackUp.LOG_BACKUP_DISTRIBUTED_LOCK_TIME_OUT ) @@ -103,7 +102,7 @@ constructor( if (logServerCustomerConfiguration.maxHistoryDayNumber > 0) doDeleteHistory() distributedLock.releaseLock( - LogBackUp.LOG_BACKUP_DISTRIBUTED_LOCK_KEY, cloudTools.getServerIp() + ":" + cloudTools.getServerPort(), + LogBackUp.LOG_BACKUP_DISTRIBUTED_LOCK_KEY + "_" + cloudTools.getServerIp() + ":" + cloudTools.getServerPort() ) } diff --git a/modules/log-server/src/main/kotlin/io/gitee/zhangbinhub/admin/log/schedule/LogFileBackUpTask.kt b/modules/log-server/src/main/kotlin/io/gitee/zhangbinhub/admin/log/schedule/LogFileBackUpTask.kt index c6b520ca64d2a9d7f09fca7c1a07075b0842be7c..b75e8ebe63027c2d4a6125220e601f9464523fa3 100644 --- a/modules/log-server/src/main/kotlin/io/gitee/zhangbinhub/admin/log/schedule/LogFileBackUpTask.kt +++ b/modules/log-server/src/main/kotlin/io/gitee/zhangbinhub/admin/log/schedule/LogFileBackUpTask.kt @@ -33,8 +33,7 @@ constructor( override fun beforeExecuteFun(): Boolean = distributedLock.getLock( - "${LogBackUp.LOG_BACKUP_DISTRIBUTED_LOCK_KEY}_$lockName", - cloudTools.getServerIp() + ":" + cloudTools.getServerPort(), + "${LogBackUp.LOG_BACKUP_DISTRIBUTED_LOCK_KEY}_$lockName" + "_" + cloudTools.getServerIp() + ":" + cloudTools.getServerPort(), LogBackUp.LOG_BACKUP_DISTRIBUTED_LOCK_TIME_OUT ) @@ -47,7 +46,7 @@ constructor( } else { 1 } - for (i in 0 until dayNumber) { + (0 until dayNumber).forEach { i -> val logFileDate = CalendarTools.getDateTimeString(day, CalendarTools.DATE_FORMAT) val logFold = File(logServerCustomerConfiguration.logFilePath) val logFoldPath = logFold.canonicalPath @@ -98,8 +97,7 @@ constructor( logAdapter.error(e.message, e) } finally { distributedLock.releaseLock( - "${LogBackUp.LOG_BACKUP_DISTRIBUTED_LOCK_KEY}_$lockName", - cloudTools.getServerIp() + ":" + cloudTools.getServerPort() + "${LogBackUp.LOG_BACKUP_DISTRIBUTED_LOCK_KEY}_$lockName" + "_" + cloudTools.getServerIp() + ":" + cloudTools.getServerPort() ) } } @@ -116,7 +114,7 @@ constructor( val filterZipFileNameRegex: MutableSet = mutableSetOf() // 保留当天和历史最大天数的文件 var day = CalendarTools.getNowDateTime() - for (i in 0..logServerCustomerConfiguration.maxHistoryDayNumber) { + (0..logServerCustomerConfiguration.maxHistoryDayNumber).forEach { i -> filterFileNameRegex.add(CalendarTools.getDateTimeString(day, CalendarTools.DATE_FORMAT)) filterZipFileNameRegex.add( LogBackUp.ZIP_FILE_PREFIX + CalendarTools.getDateTimeString( diff --git a/modules/log-server/src/main/resources/application.yaml b/modules/log-server/src/main/resources/application.yaml index 788045491cacb8a13c70d3c5537d100fa64c11ed..bfaafe44ade43472c3021cf375a283f1476541c1 100644 --- a/modules/log-server/src/main/resources/application.yaml +++ b/modules/log-server/src/main/resources/application.yaml @@ -15,8 +15,6 @@ spring: loadbalancer: cache: ttl: 5s - nacos: - enabled: true nacos: username: ${acp_nacos_username:nacos} password: ${acp_nacos_password:nacos} diff --git a/modules/log-server/src/main/resources/logback-spring.xml b/modules/log-server/src/main/resources/logback-spring.xml index 64a281bea22b2eeae08e02d81a31bcf3ac7e7f90..024364880cd08ae2585697464fbaafec7bbc3188 100644 --- a/modules/log-server/src/main/resources/logback-spring.xml +++ b/modules/log-server/src/main/resources/logback-spring.xml @@ -1,7 +1,7 @@ + class="com.github.houbb.sensitive.logback.converter.SensitiveLogbackConverter"/> diff --git a/modules/oauth-server/build.gradle b/modules/oauth-server/build.gradle index b23f72120bc41e8f50af3c992634306a6afb17c4..2607a311076eeb9af8db7e212bc8578f6aa9d27f 100644 --- a/modules/oauth-server/build.gradle +++ b/modules/oauth-server/build.gradle @@ -6,7 +6,7 @@ dependencies { } // 数据库及驱动 implementation "org.springframework.boot:spring-boot-starter-data-jpa" - implementation "com.mysql:mysql-connector-j:$versions.mysql" + implementation "com.mysql:mysql-connector-j:${libs.versions.mysql.get()}" testImplementation "org.springframework.boot:spring-boot-starter-test" } \ No newline at end of file diff --git a/modules/oauth-server/src/main/kotlin/io/gitee/zhangbinhub/admin/oauth/conf/AuthorizationServerConfiguration.kt b/modules/oauth-server/src/main/kotlin/io/gitee/zhangbinhub/admin/oauth/conf/AuthorizationServerConfiguration.kt index 7987961121cefcce623060cdf142149ca097fafa..62a1277f582311c85aaf58f099ec668a37bea59a 100644 --- a/modules/oauth-server/src/main/kotlin/io/gitee/zhangbinhub/admin/oauth/conf/AuthorizationServerConfiguration.kt +++ b/modules/oauth-server/src/main/kotlin/io/gitee/zhangbinhub/admin/oauth/conf/AuthorizationServerConfiguration.kt @@ -25,6 +25,7 @@ import org.springframework.boot.autoconfigure.web.ServerProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.annotation.Order +import org.springframework.http.HttpMethod import org.springframework.http.HttpStatus import org.springframework.security.config.Customizer import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity @@ -40,10 +41,8 @@ import org.springframework.security.oauth2.server.authorization.token.OAuth2Toke import org.springframework.security.oauth2.server.authorization.web.authentication.OAuth2ClientCredentialsAuthenticationConverter import org.springframework.security.web.SecurityFilterChain import org.springframework.security.web.authentication.DelegatingAuthenticationConverter -import org.springframework.security.web.util.matcher.AntPathRequestMatcher -import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher import org.springframework.web.client.RestClient -import java.util.* /** * @author zhangbin by 11/04/2018 14:34 @@ -63,8 +62,7 @@ class AuthorizationServerConfiguration @Autowired constructor( private val oAuth2ResourceServerProperties: OAuth2ResourceServerProperties, private val acpCloudResourceServerConfiguration: AcpCloudResourceServerConfiguration, private val acpCloudResourceServerComponentAutoConfiguration: AcpCloudResourceServerComponentAutoConfiguration, - @Qualifier("acpSpringCloudResourceServerRestClientBuilder") - private val restClientBuilder: RestClient.Builder, + @Qualifier("acpSpringCloudResourceServerRestClientBuilder") private val restClientBuilder: RestClient.Builder, private val authUserService: AuthUserService, private val webEndpointProperties: WebEndpointProperties ) { @@ -76,16 +74,11 @@ class AuthorizationServerConfiguration @Autowired constructor( @Throws(Exception::class) fun acpBasicSecurityFilterChain(httpSecurity: HttpSecurity): SecurityFilterChain? { // 配置 endpoint 策略 - httpSecurity.csrf { it.ignoringRequestMatchers("/**") } - .securityMatcher( - "$contextPath${webEndpointProperties.basePath}", - "$contextPath${webEndpointProperties.basePath}/**" - ) - .authorizeHttpRequests { authorizeRequests -> + httpSecurity.csrf { it.ignoringRequestMatchers("/**") }.securityMatcher( + "$contextPath${webEndpointProperties.basePath}", "$contextPath${webEndpointProperties.basePath}/**" + ).authorizeHttpRequests { authorizeRequests -> authorizeRequests.anyRequest().permitAll() - } - .userDetailsService(basicUserDetailsService) - .httpBasic(Customizer.withDefaults()) + }.userDetailsService(basicUserDetailsService).httpBasic(Customizer.withDefaults()) return httpSecurity.build() } @@ -106,10 +99,12 @@ class AuthorizationServerConfiguration @Autowired constructor( // 配置 endpoint 策略 httpSecurity.csrf { it.ignoringRequestMatchers("/**") }.authorizeHttpRequests { authorizeRequests -> authorizeRequests.requestMatchers(authorizationServerConfigurer.endpointsMatcher).permitAll() - .requestMatchers(AntPathRequestMatcher("/**", RequestMethod.OPTIONS.name)).permitAll() - .requestMatchers(*security.map { AntPathRequestMatcher(it) }.toTypedArray()).authenticated() - .requestMatchers(*permitAll.map { AntPathRequestMatcher(it) }.toTypedArray()).permitAll() - .anyRequest().authenticated() + .requestMatchers(PathPatternRequestMatcher.withDefaults().matcher(HttpMethod.OPTIONS, "/**")) + .permitAll() + .requestMatchers(*security.map { PathPatternRequestMatcher.withDefaults().matcher(it) }.toTypedArray()) + .authenticated() + .requestMatchers(*permitAll.map { PathPatternRequestMatcher.withDefaults().matcher(it) }.toTypedArray()) + .permitAll().anyRequest().authenticated() } // 自定义token端点配置 val tokenGenerator: OAuth2TokenGenerator = @@ -118,8 +113,7 @@ class AuthorizationServerConfiguration @Autowired constructor( tokenEndpoint.accessTokenRequestConverter( DelegatingAuthenticationConverter( listOf( - OAuth2ClientCredentialsAuthenticationConverter(), - OauthUserPasswordAuthenticationConverter() + OAuth2ClientCredentialsAuthenticationConverter(), OauthUserPasswordAuthenticationConverter() ) ) ) @@ -130,18 +124,12 @@ class AuthorizationServerConfiguration @Autowired constructor( ) tokenEndpoint.authenticationProvider( OauthUserPasswordAuthenticationProvider( - logAdapter, - tokenTools, - authUserService, - authPasswordEncrypt, - tokenGenerator, - authTokenService + logAdapter, tokenTools, authUserService, authPasswordEncrypt, tokenGenerator, authTokenService ) ) tokenEndpoint.errorResponseHandler { _, response, exception -> servletExceptionHandler.responseGlobalException( - response, - WebException(HttpStatus.UNAUTHORIZED, exception.message) + response, WebException(HttpStatus.UNAUTHORIZED, exception.message) ) } }.tokenGenerator(tokenGenerator) @@ -152,14 +140,12 @@ class AuthorizationServerConfiguration @Autowired constructor( configurer.opaqueToken { it.introspector(opaqueTokenIntrospect()) } configurer.authenticationEntryPoint { _, response, authException -> servletExceptionHandler.responseGlobalException( - response, - authException + response, authException ) } configurer.accessDeniedHandler { _, response, accessDeniedException -> servletExceptionHandler.responseGlobalException( - response, - accessDeniedException + response, accessDeniedException ) } } @@ -172,18 +158,13 @@ class AuthorizationServerConfiguration @Autowired constructor( * @return ProviderSettings */ @Bean - fun authorizationServerSettings(): AuthorizationServerSettings = AuthorizationServerSettings.builder() - .authorizationEndpoint("/oauth/authorize") - .tokenEndpoint("/inner/oauth/token") - .jwkSetEndpoint("/oauth/jwks") - .tokenRevocationEndpoint("/oauth/revoke") - .tokenIntrospectionEndpoint("/inner/oauth/introspect") - .build() + fun authorizationServerSettings(): AuthorizationServerSettings = + AuthorizationServerSettings.builder().authorizationEndpoint("/oauth/authorize") + .tokenEndpoint("/inner/oauth/token").jwkSetEndpoint("/oauth/jwks").tokenRevocationEndpoint("/oauth/revoke") + .tokenIntrospectionEndpoint("/inner/oauth/introspect").build() @Bean fun opaqueTokenIntrospect() = AcpOpaqueTokenServletIntrospect( - cloudTools, - oAuth2ResourceServerProperties.opaquetoken.introspectionUri, - restClientBuilder + cloudTools, oAuth2ResourceServerProperties.opaquetoken.introspectionUri, restClientBuilder ) } diff --git a/modules/oauth-server/src/main/resources/application.yaml b/modules/oauth-server/src/main/resources/application.yaml index 648068e0c34b7f38ec4b76f93b913fdaf310889d..03bded2bdb8e1c921cc446d10c1c141c76ed763d 100644 --- a/modules/oauth-server/src/main/resources/application.yaml +++ b/modules/oauth-server/src/main/resources/application.yaml @@ -15,8 +15,6 @@ spring: loadbalancer: cache: ttl: 5s - nacos: - enabled: true nacos: username: ${acp_nacos_username:nacos} password: ${acp_nacos_password:nacos} diff --git a/modules/oauth-server/src/main/resources/logback-spring.xml b/modules/oauth-server/src/main/resources/logback-spring.xml index 0d2548e3120208e2fbd610dbf744f5165e9bdbfd..2fe7764f2f504c2ea4f2cb76f28e710c0bfb9d74 100644 --- a/modules/oauth-server/src/main/resources/logback-spring.xml +++ b/modules/oauth-server/src/main/resources/logback-spring.xml @@ -1,9 +1,8 @@ + class="com.github.houbb.sensitive.logback.converter.SensitiveLogbackConverter"/> - \ No newline at end of file diff --git a/modules/route-server/build.gradle b/modules/route-server/build.gradle index 4b9acc43434d1c0818812452999fd7ff25443510..1dcee965bcb3e20d745fe21363212c55d35f267c 100644 --- a/modules/route-server/build.gradle +++ b/modules/route-server/build.gradle @@ -3,7 +3,7 @@ dependencies { implementation project(":acp-admin-cloud-dependencies-resource-server") // 数据库及驱动 implementation "org.springframework.boot:spring-boot-starter-data-jpa" - implementation "com.mysql:mysql-connector-j:$versions.mysql" + implementation "com.mysql:mysql-connector-j:${libs.versions.mysql.get()}" testImplementation "org.springframework.boot:spring-boot-starter-test" } \ No newline at end of file diff --git a/modules/route-server/src/main/kotlin/io/gitee/zhangbinhub/admin/route/service/RouteService.kt b/modules/route-server/src/main/kotlin/io/gitee/zhangbinhub/admin/route/service/RouteService.kt index e6843b602c3ae7e487a6b0032da1697b56998191..19867b0198982e8bb3383b17712e4de93885c7f8 100644 --- a/modules/route-server/src/main/kotlin/io/gitee/zhangbinhub/admin/route/service/RouteService.kt +++ b/modules/route-server/src/main/kotlin/io/gitee/zhangbinhub/admin/route/service/RouteService.kt @@ -97,8 +97,7 @@ constructor( val routeList = routeRepository.findAllByEnabled(true) logAdapter.info("查询到启用的路由信息共 " + routeList.size + " 条") try { - val uuid = CommonTools.getUuid() - if (distributedLock.getLock(RouteConstant.ROUTES_LOCK_KEY, uuid, RouteConstant.ROUTES_LOCK_TIME_OUT)) { + if (distributedLock.getLock(RouteConstant.ROUTES_LOCK_KEY, RouteConstant.ROUTES_LOCK_TIME_OUT)) { try { stringRedisTemplate.delete(ROUTES_DEFINITION_KEY) logAdapter.info("清理 Redis 缓存完成") @@ -135,7 +134,7 @@ constructor( } logAdapter.info("路由信息更新至 Redis,共 " + routeList.size + " 条") } finally { - distributedLock.releaseLock(RouteConstant.ROUTES_LOCK_KEY, uuid) + distributedLock.releaseLock(RouteConstant.ROUTES_LOCK_KEY) } } else { throw WebException("系统正在进行路由信息更新,请稍后重试") diff --git a/modules/route-server/src/main/resources/application.yaml b/modules/route-server/src/main/resources/application.yaml index 962293569907a460111419ce10ef298a82bacf40..e30b725fd343e656e47fd2163b09be5bed1d1195 100644 --- a/modules/route-server/src/main/resources/application.yaml +++ b/modules/route-server/src/main/resources/application.yaml @@ -15,8 +15,6 @@ spring: loadbalancer: cache: ttl: 5s - nacos: - enabled: true nacos: username: ${acp_nacos_username:nacos} password: ${acp_nacos_password:nacos} diff --git a/modules/route-server/src/main/resources/logback-spring.xml b/modules/route-server/src/main/resources/logback-spring.xml index 0d2548e3120208e2fbd610dbf744f5165e9bdbfd..2fe7764f2f504c2ea4f2cb76f28e710c0bfb9d74 100644 --- a/modules/route-server/src/main/resources/logback-spring.xml +++ b/modules/route-server/src/main/resources/logback-spring.xml @@ -1,9 +1,8 @@ + class="com.github.houbb.sensitive.logback.converter.SensitiveLogbackConverter"/> - \ No newline at end of file diff --git a/modules/workflow-server/build.gradle b/modules/workflow-server/build.gradle index 49c41a207b26b94960b3183059cea76e6c16bc03..dac6ba03d817dc27f9ec68bce077d588b82cf179 100644 --- a/modules/workflow-server/build.gradle +++ b/modules/workflow-server/build.gradle @@ -3,7 +3,7 @@ dependencies { implementation project(":acp-admin-cloud-dependencies-resource-server") // 数据库及驱动 implementation "org.springframework.boot:spring-boot-starter-data-jpa" - implementation "com.mysql:mysql-connector-j:$versions.mysql" + implementation "com.mysql:mysql-connector-j:${libs.versions.mysql.get()}" implementation "io.gitee.zhangbinhub.acp:acp-spring-boot-warm-flow-mybatis-flex" diff --git a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/conf/JpaTransactionAutoConfiguration.kt b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/conf/JpaTransactionAutoConfiguration.kt new file mode 100644 index 0000000000000000000000000000000000000000..1934766faff860b05a571418a59f92abb9f24151 --- /dev/null +++ b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/conf/JpaTransactionAutoConfiguration.kt @@ -0,0 +1,72 @@ +package io.gitee.zhangbinhub.admin.workflow.conf + +import com.zaxxer.hikari.HikariDataSource +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties +import org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings +import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties +import org.springframework.boot.context.properties.ConfigurationProperties +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.context.annotation.Primary +import org.springframework.data.jpa.repository.config.EnableJpaRepositories +import org.springframework.orm.jpa.JpaTransactionManager +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter +import org.springframework.transaction.PlatformTransactionManager +import org.springframework.transaction.annotation.EnableTransactionManagement +import java.util.* + +/** + * @since JDK 17 + */ +@Configuration +@EnableTransactionManagement +@EnableJpaRepositories( + basePackages = ["io.gitee.zhangbinhub.admin.workflow.repo"], + entityManagerFactoryRef = "entityManagerFactoryPrimary", + transactionManagerRef = "transactionManagerPrimary" +) +class JpaTransactionAutoConfiguration @Autowired constructor( + private val jpaProperties: JpaProperties, + private val hibernateProperties: HibernateProperties +) { + private fun buildEntityManagerFactory(hikariDataSource: HikariDataSource): LocalContainerEntityManagerFactoryBean { + val em = LocalContainerEntityManagerFactoryBean() + em.dataSource = hikariDataSource + em.setPackagesToScan( + *hikariDataSource.dataSourceProperties.getProperty("scan-package").split(",".toRegex()) + .dropLastWhile { it.isEmpty() }.toTypedArray() + ) + val vendorAdapter = HibernateJpaVendorAdapter() + em.jpaVendorAdapter = vendorAdapter + em.setJpaPropertyMap( + hibernateProperties.determineHibernateProperties( + jpaProperties.properties, + HibernateSettings() + ) + ) + return em + } + + @Primary + @Bean("dataSourcePrimary") + @ConfigurationProperties(prefix = "spring.datasource.hikari") + fun primaryDataSource(): HikariDataSource { + return HikariDataSource() + } + + @Primary + @Bean(name = ["entityManagerFactoryPrimary"]) + fun entityManagerFactoryPrimary(): LocalContainerEntityManagerFactoryBean { + val em: LocalContainerEntityManagerFactoryBean = buildEntityManagerFactory(primaryDataSource()) + em.persistenceUnitName = "persistenceUnitPrimary" + return em + } + + @Primary + @Bean(name = ["transactionManagerPrimary"]) + fun transactionManagerPrimary(): PlatformTransactionManager { + return JpaTransactionManager(Objects.requireNonNull(entityManagerFactoryPrimary().getObject())) + } +} diff --git a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/conf/MybatisFlexTransactionAutoConfiguration.kt b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/conf/MybatisFlexTransactionAutoConfiguration.kt new file mode 100644 index 0000000000000000000000000000000000000000..d933e0e44de231d565162bd5647ebc81ae8c70bc --- /dev/null +++ b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/conf/MybatisFlexTransactionAutoConfiguration.kt @@ -0,0 +1,22 @@ +package io.gitee.zhangbinhub.admin.workflow.conf + +import com.mybatisflex.spring.FlexTransactionManager +import com.mybatisflex.spring.boot.MybatisFlexAutoConfiguration +import org.springframework.boot.autoconfigure.AutoConfigureAfter +import org.springframework.boot.autoconfigure.AutoConfigureBefore +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration +import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager +import org.springframework.transaction.annotation.TransactionManagementConfigurer + +@AutoConfigureAfter(MybatisFlexAutoConfiguration::class) +@AutoConfigureBefore(value = [TransactionAutoConfiguration::class, DataSourceTransactionManagerAutoConfiguration::class]) +@Configuration(proxyBeanMethods = false) +class MybatisFlexTransactionAutoConfiguration : TransactionManagementConfigurer { + private val flexTransactionManager = FlexTransactionManager() + + @Bean(name = ["mybatisFlexTransactionManager"]) + override fun annotationDrivenTransactionManager(): PlatformTransactionManager = flexTransactionManager +} \ No newline at end of file diff --git a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/controller/api/WorkFlowController.kt b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/controller/api/WorkFlowController.kt index 92bd9db0ccbcc0542eff46adb4957e5e2f302bbb..6a824df6511c5a8c8021b5c56239cd666f7549b4 100644 --- a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/controller/api/WorkFlowController.kt +++ b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/controller/api/WorkFlowController.kt @@ -253,12 +253,4 @@ class WorkFlowController @Autowired constructor( @PathVariable(name = "taskId") taskId: Long ): ResponseEntity = ResponseEntity.ok(workFlowService.findTaskById(bearerTokenAuthentication.name, taskId)) - - @Operation(summary = "获取流程图", description = "获取指定流程定义高亮元素") - @GetMapping(value = [WorkFlowApi.instanceChart + "/{processInstanceId}"], produces = [MediaType.TEXT_PLAIN_VALUE]) - @Throws(WebException::class) - fun queryFlowChart( - @Parameter(name = "流程实例id", required = true) - @PathVariable(name = "processInstanceId") processInstanceId: Long - ): ResponseEntity = ResponseEntity.ok(workFlowService.chartFlow(processInstanceId)) } diff --git a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/controller/openinner/OpenInnerWorkFlowController.kt b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/controller/openinner/OpenInnerWorkFlowController.kt index 99ea3301a00a7fec9da96509494d031abcdfb17d..f9b191598e109a35928930cdb98c38d08d721106 100644 --- a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/controller/openinner/OpenInnerWorkFlowController.kt +++ b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/controller/openinner/OpenInnerWorkFlowController.kt @@ -98,15 +98,4 @@ constructor( @PathVariable(name = "processInstanceId") processInstanceId: Long ): ResponseEntity = ResponseEntity.ok(workFlowService.findProcessInstance(processInstanceId)) - - @Operation(summary = "获取流程图", description = "获取指定流程定义高亮元素") - @GetMapping( - value = [WorkFlowApi.instanceChart + "/{processInstanceId}"], - produces = [MediaType.TEXT_PLAIN_VALUE] - ) - @Throws(WebException::class) - fun queryFlowChart( - @Parameter(description = "流程实例id", required = true) - @PathVariable(name = "processInstanceId") processInstanceId: Long - ): ResponseEntity = ResponseEntity.ok(workFlowService.chartFlow(processInstanceId)) } diff --git a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/repo/MyProcessInstanceRepository.kt b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/repo/MyProcessInstanceRepository.kt index decd9dd59e89f069c57c9b6016fb7c125ee90a91..0b0a9fc2f28ac03e89fc09f7a9306892cb380689 100644 --- a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/repo/MyProcessInstanceRepository.kt +++ b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/repo/MyProcessInstanceRepository.kt @@ -2,8 +2,10 @@ package io.gitee.zhangbinhub.admin.workflow.repo import io.gitee.zhangbinhub.admin.workflow.base.BaseRepository import io.gitee.zhangbinhub.admin.workflow.entity.MyProcessInstance +import org.springframework.transaction.annotation.Transactional import java.util.* +@Transactional(transactionManager = "transactionManagerPrimary") interface MyProcessInstanceRepository : BaseRepository { fun findByUserIdAndProcessInstanceId(userId: String, processInstanceId: Long): Optional } \ No newline at end of file diff --git a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/MyProcessInstanceService.kt b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/MyProcessInstanceService.kt new file mode 100644 index 0000000000000000000000000000000000000000..b72647258596e5834629f7d9acdf3cc5b15b2ac6 --- /dev/null +++ b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/MyProcessInstanceService.kt @@ -0,0 +1,33 @@ +package io.gitee.zhangbinhub.admin.workflow.service + +import io.gitee.zhangbinhub.admin.resource.server.vo.ProcessInstanceVo +import io.gitee.zhangbinhub.admin.workflow.base.BaseWorkFlowService +import io.gitee.zhangbinhub.admin.workflow.entity.MyProcessInstance +import io.gitee.zhangbinhub.admin.workflow.repo.MyProcessInstanceRepository +import org.dromara.warm.flow.core.entity.Instance +import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional + +@Service +@Transactional(readOnly = true) +class MyProcessInstanceService( + private val myProcessInstanceRepository: MyProcessInstanceRepository, +) : BaseWorkFlowService() { + @Transactional + fun addMyProcessInstance(userId: String, instance: Instance, processInstanceVo: ProcessInstanceVo) { + myProcessInstanceRepository.findByUserIdAndProcessInstanceId(userId, instance.id).let { + if (it.isEmpty) { + myProcessInstanceRepository.save( + MyProcessInstance( + processInstanceId = instance.id, + processDefinitionKey = processInstanceVo.processDefinitionKey!!, + businessKey = instance.businessId, + startUserId = processInstanceVo.startUser?.id, + userId = userId, + startTime = processInstanceVo.startTime + ) + ) + } + } + } +} \ No newline at end of file diff --git a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/WorkFlowDefinitionService.kt b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/WorkFlowDefinitionService.kt index 3d1886f2c05c21b42d8f25636f524c0841255a16..3d7cc957be768a2cb19b1a654624930d9b400c86 100644 --- a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/WorkFlowDefinitionService.kt +++ b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/WorkFlowDefinitionService.kt @@ -20,7 +20,7 @@ import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @Service -@Transactional(readOnly = true) +@Transactional(transactionManager = "mybatisFlexTransactionManager", readOnly = true) class WorkFlowDefinitionService( private val defService: DefService, private val fileDownLoadHandle: FileDownLoadHandle diff --git a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/WorkFlowService.kt b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/WorkFlowService.kt index 060ce42b1e07ddd75efd9454a995df270ac6d5b0..204155cc0b05a4b684676eeebce44ac88dc23670 100644 --- a/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/WorkFlowService.kt +++ b/modules/workflow-server/src/main/kotlin/io/gitee/zhangbinhub/admin/workflow/service/WorkFlowService.kt @@ -6,8 +6,6 @@ import io.gitee.zhangbinhub.acp.boot.exceptions.WebException import io.gitee.zhangbinhub.acp.boot.log.LogAdapter import io.gitee.zhangbinhub.acp.core.common.CommonTools import io.gitee.zhangbinhub.admin.common.vo.CustomerQueryPageVo -import io.gitee.zhangbinhub.admin.workflow.component.WorkFlowGlobalListener -import io.gitee.zhangbinhub.admin.workflow.component.WorkFlowPermissionHandler import io.gitee.zhangbinhub.admin.resource.server.feign.CommonOauthServer import io.gitee.zhangbinhub.admin.resource.server.po.* import io.gitee.zhangbinhub.admin.resource.server.vo.ProcessHisTaskVo @@ -15,12 +13,12 @@ import io.gitee.zhangbinhub.admin.resource.server.vo.ProcessInstanceVo import io.gitee.zhangbinhub.admin.resource.server.vo.ProcessTaskVo import io.gitee.zhangbinhub.admin.resource.server.vo.UserVo import io.gitee.zhangbinhub.admin.workflow.base.BaseWorkFlowService +import io.gitee.zhangbinhub.admin.workflow.component.WorkFlowGlobalListener +import io.gitee.zhangbinhub.admin.workflow.component.WorkFlowPermissionHandler import io.gitee.zhangbinhub.admin.workflow.constant.WorkFlowParamKey -import io.gitee.zhangbinhub.admin.workflow.entity.MyProcessInstance import io.gitee.zhangbinhub.admin.workflow.repo.MyProcessInstanceRepository import jakarta.persistence.criteria.Predicate import org.dromara.warm.flow.core.FlowEngine -import org.dromara.warm.flow.core.chart.BetweenChart import org.dromara.warm.flow.core.dto.DefJson import org.dromara.warm.flow.core.dto.FlowParams import org.dromara.warm.flow.core.entity.HisTask @@ -38,11 +36,9 @@ import org.dromara.warm.flow.orm.entity.FlowUser import org.dromara.warm.flow.orm.mapper.FlowTaskMapper import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional -import java.awt.Color - @Service -@Transactional(readOnly = true) +@Transactional(transactionManager = "mybatisFlexTransactionManager", readOnly = true) class WorkFlowService( private val logAdapter: LogAdapter, private val myProcessInstanceRepository: MyProcessInstanceRepository, @@ -52,10 +48,10 @@ class WorkFlowService( private val taskService: TaskService, private val userService: UserService, private val hisTaskService: HisTaskService, - private val chartService: ChartService, private val flowTaskMapper: FlowTaskMapper, private val workFlowPermissionHandler: WorkFlowPermissionHandler, - private val workFlowGlobalListener: WorkFlowGlobalListener + private val workFlowGlobalListener: WorkFlowGlobalListener, + private val myProcessInstanceService: MyProcessInstanceService ) : BaseWorkFlowService() { @Throws(WebException::class) private fun getUserById(id: String?): UserVo = if (CommonTools.isNullStr(id)) { @@ -517,21 +513,7 @@ class WorkFlowService( }】意见【$comment】" ) // 添加至我处理过的流程实例 - myProcessInstanceRepository.findByUserIdAndProcessInstanceId(userId, instance.id).let { - if (it.isEmpty) { - val processInstanceVo = findProcessInstance(instance.id) - myProcessInstanceRepository.save( - MyProcessInstance( - processInstanceId = instance.id, - processDefinitionKey = processInstanceVo.processDefinitionKey!!, - businessKey = instance.businessId, - startUserId = processInstanceVo.startUser?.id, - userId = userId, - startTime = processInstanceVo.startTime - ) - ) - } - } + myProcessInstanceService.addMyProcessInstance(userId, instance, findProcessInstance(instance.id)) } } ?: throw WebException("获取当前登录用户信息失败!") } catch (e: Exception) { @@ -776,19 +758,4 @@ class WorkFlowService( logAdapter.error(e.message, e) throw WebException(e.message) } - - @Throws(WebException::class) - fun chartFlow(processInstanceId: Long): String = chartService.chartIns(processInstanceId) { flowChartChain -> - flowChartChain.flowChartList.forEach { flowChart -> - if (flowChart is BetweenChart) { - // 给节点顶部增加文字说明 - // flowChart.topText("办理时间: 2025-02-08 12:12:12", Color.red); - flowChart.nodeJson.extMap.forEach { (key, value) -> - // 给节点中追加文字 - flowChart.addText("$key: ", Color.blue) - flowChart.addText("$value", Color.blue) - } - } - } - } } diff --git a/modules/workflow-server/src/main/resources/application.yaml b/modules/workflow-server/src/main/resources/application.yaml index 3673df41e8efce915267b87866a63213371a82a7..b7f93c61f1662a2fc04aa22ddee4cb644a30f7b4 100644 --- a/modules/workflow-server/src/main/resources/application.yaml +++ b/modules/workflow-server/src/main/resources/application.yaml @@ -21,8 +21,6 @@ spring: loadbalancer: cache: ttl: 5s - nacos: - enabled: true nacos: username: ${acp_nacos_username:nacos} password: ${acp_nacos_password:nacos} @@ -50,6 +48,14 @@ info: app-name: ${spring.application.name} tags: environment: ${spring.profiles.active} +warm-flow: + enabled: true + banner: false + ## 如果需要工作流共享业务系统权限,默认Authorization,如果有多个token,用逗号分隔 + token-name: Authorization +mybatis-flex: + global-config: + printBanner: false acp: cloud: log-server: diff --git a/modules/workflow-server/src/main/resources/init-sql/mysql/warm-flow-all.sql b/modules/workflow-server/src/main/resources/init-sql/mysql/warm-flow-all.sql index e35a53ec00aa87f0abf628fab712a72534695a05..05bb94127b4298fd9de268e06d9384bacdacfbc2 100644 --- a/modules/workflow-server/src/main/resources/init-sql/mysql/warm-flow-all.sql +++ b/modules/workflow-server/src/main/resources/init-sql/mysql/warm-flow-all.sql @@ -26,7 +26,7 @@ CREATE TABLE IF NOT EXISTS `flow_node` `definition_id` bigint NOT NULL COMMENT '流程定义id', `node_code` varchar(100) NOT NULL COMMENT '流程节点编码', `node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称', - `permission_flag` varchar(200) DEFAULT NULL COMMENT '权限标识(权限类型:权限标识,可以多个,用逗号隔开)', + `permission_flag` varchar(200) DEFAULT NULL COMMENT '权限标识(权限类型:权限标识,可以多个,用@@隔开)', `node_ratio` decimal(6, 3) DEFAULT NULL COMMENT '流程签署比例值', `coordinate` varchar(100) DEFAULT NULL COMMENT '坐标', `any_node_skip` varchar(100) DEFAULT NULL COMMENT '任意结点跳转', @@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS `flow_node` `version` varchar(20) NOT NULL COMMENT '版本', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_time` datetime DEFAULT NULL COMMENT '更新时间', - `ext` text COMMENT '扩展属性', + `ext` text COMMENT '节点扩展属性', `del_flag` char(1) DEFAULT '0' COMMENT '删除标志', `tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id', PRIMARY KEY (`id`) USING BTREE @@ -131,6 +131,7 @@ CREATE TABLE IF NOT EXISTS `flow_his_task` PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB COMMENT ='历史任务记录表'; + CREATE TABLE IF NOT EXISTS `flow_user` ( `id` bigint NOT NULL COMMENT '主键id', diff --git a/modules/workflow-server/src/main/resources/logback-spring.xml b/modules/workflow-server/src/main/resources/logback-spring.xml index 0d2548e3120208e2fbd610dbf744f5165e9bdbfd..2fe7764f2f504c2ea4f2cb76f28e710c0bfb9d74 100644 --- a/modules/workflow-server/src/main/resources/logback-spring.xml +++ b/modules/workflow-server/src/main/resources/logback-spring.xml @@ -1,9 +1,8 @@ + class="com.github.houbb.sensitive.logback.converter.SensitiveLogbackConverter"/> - \ No newline at end of file