Merge branch 'dev' into test
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.framework.swagger.config;
|
||||
|
||||
import com.zt.plat.framework.common.enums.RpcConstants;
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Contact;
|
||||
@@ -11,6 +12,7 @@ import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.springdoc.core.customizers.OpenApiBuilderCustomizer;
|
||||
import org.springdoc.core.customizers.OpenApiCustomizer;
|
||||
import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
|
||||
import org.springdoc.core.models.GroupedOpenApi;
|
||||
import org.springdoc.core.properties.SpringDocConfigProperties;
|
||||
@@ -123,12 +125,26 @@ public class ZtSwaggerAutoConfiguration {
|
||||
return GroupedOpenApi.builder()
|
||||
.group(group)
|
||||
.pathsToMatch("/admin-api/" + path + "/**", "/app-api/" + path + "/**")
|
||||
.pathsToExclude(RpcConstants.RPC_API_PREFIX + "/**")
|
||||
.addOperationCustomizer((operation, handlerMethod) -> operation
|
||||
.addParametersItem(buildTenantHeaderParameter())
|
||||
.addParametersItem(buildSecurityHeaderParameter()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public OpenApiCustomizer rpcApiPathExclusionCustomiser() {
|
||||
return openApi -> {
|
||||
if (openApi == null || openApi.getPaths() == null) {
|
||||
return;
|
||||
}
|
||||
openApi.getPaths().entrySet().removeIf(entry -> {
|
||||
String path = entry.getKey();
|
||||
return path != null && path.startsWith(RpcConstants.RPC_API_PREFIX);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 Tenant 租户编号请求头参数
|
||||
*
|
||||
|
||||
@@ -8,17 +8,25 @@ import com.zt.plat.module.bpm.framework.flowable.core.event.BpmProcessInstanceEv
|
||||
import com.zt.plat.module.system.api.user.AdminUserApi;
|
||||
import org.flowable.common.engine.api.delegate.FlowableFunctionDelegate;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEventListener;
|
||||
import org.flowable.engine.ProcessEngineConfiguration;
|
||||
import org.flowable.spring.SpringProcessEngineConfiguration;
|
||||
import org.flowable.spring.boot.EngineConfigurationConfigurer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.task.AsyncListenableTaskExecutor;
|
||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.List;
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* BPM 模块的 Flowable 配置类
|
||||
@@ -28,6 +36,8 @@ import java.util.List;
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class BpmFlowableConfiguration {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BpmFlowableConfiguration.class);
|
||||
|
||||
/**
|
||||
* 参考 {@link org.flowable.spring.boot.FlowableJobConfiguration} 类,创建对应的 AsyncListenableTaskExecutor Bean
|
||||
*
|
||||
@@ -69,6 +79,37 @@ public class BpmFlowableConfiguration {
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EngineConfigurationConfigurer<SpringProcessEngineConfiguration> dmProcessEngineConfigurationConfigurer(DataSource dataSource) {
|
||||
return configuration -> {
|
||||
try {
|
||||
configureDmCompatibility(configuration, dataSource);
|
||||
} catch (SQLException ex) {
|
||||
log.warn("Failed to inspect datasource for DM compatibility; Flowable will keep default settings", ex);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void configureDmCompatibility(SpringProcessEngineConfiguration configuration, DataSource dataSource) throws SQLException {
|
||||
Connection connection = null;
|
||||
try {
|
||||
connection = DataSourceUtils.getConnection(dataSource);
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
String productName = metaData.getDatabaseProductName();
|
||||
String jdbcUrl = metaData.getURL();
|
||||
boolean dmProduct = productName != null && productName.toLowerCase().contains("dm");
|
||||
boolean dmUrl = jdbcUrl != null && jdbcUrl.toLowerCase().startsWith("jdbc:dm");
|
||||
if (!dmProduct && !dmUrl) {
|
||||
return;
|
||||
}
|
||||
log.info("Detected DM database (product='{}'); enabling Flowable Oracle compatibility with automatic schema updates", productName);
|
||||
configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
|
||||
configuration.setDatabaseType("oracle");
|
||||
} finally {
|
||||
DataSourceUtils.releaseConnection(connection, dataSource);
|
||||
}
|
||||
}
|
||||
|
||||
// =========== 审批人相关的 Bean ==========
|
||||
|
||||
@Bean
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
package liquibase.datatype.core;
|
||||
|
||||
import liquibase.database.Database;
|
||||
import liquibase.database.core.DmDatabase;
|
||||
import liquibase.datatype.DataTypeInfo;
|
||||
import liquibase.datatype.DatabaseDataType;
|
||||
|
||||
@DataTypeInfo(
|
||||
name = "boolean",
|
||||
aliases = {"java.sql.Types.BOOLEAN", "java.lang.Boolean", "bit", "bool"},
|
||||
minParameters = 0,
|
||||
maxParameters = 0,
|
||||
priority = 2
|
||||
)
|
||||
public class DmBooleanType extends BooleanType {
|
||||
|
||||
@Override
|
||||
public boolean supports(Database database) {
|
||||
if (database instanceof DmDatabase) {
|
||||
return true;
|
||||
}
|
||||
return super.supports(database);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseDataType toDatabaseDataType(Database database) {
|
||||
if (database instanceof DmDatabase) {
|
||||
return new DatabaseDataType("NUMBER", 1);
|
||||
}
|
||||
return super.toDatabaseDataType(database);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -13,6 +13,7 @@ liquibase.database.core.MariaDBDatabase
|
||||
liquibase.database.core.MockDatabase
|
||||
liquibase.database.core.MySQLDatabase
|
||||
liquibase.database.core.OracleDatabase
|
||||
liquibase.database.core.DmDatabase
|
||||
liquibase.database.core.PostgresDatabase
|
||||
liquibase.database.core.SQLiteDatabase
|
||||
liquibase.database.core.SybaseASADatabase
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
liquibase.datatype.core.DmBooleanType
|
||||
@@ -39,14 +39,14 @@ spring:
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://172.16.46.247:4787/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||
username: jygk-test
|
||||
password: Zgty@0527
|
||||
url: jdbc:dm://172.16.46.247:1050?schema=BPM
|
||||
username: SYSDBA
|
||||
password: pgbsci6ddJ6Sqj@e
|
||||
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
|
||||
lazy: true # 开启懒加载,保证启动速度
|
||||
url: jdbc:mysql://172.16.46.247:4787/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||
username: jygk-test
|
||||
password: Zgty@0527
|
||||
url: jdbc:dm://172.16.46.247:1050?schema=BPM
|
||||
username: SYSDBA
|
||||
password: pgbsci6ddJ6Sqj@e
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
data:
|
||||
@@ -56,6 +56,11 @@ spring:
|
||||
database: 0 # 数据库索引
|
||||
# password: 123456 # 密码,建议生产环境开启
|
||||
|
||||
# Flowable 在 DM 场景下需要识别为 Oracle 并自动升级表结构
|
||||
flowable:
|
||||
database-schema-update: true
|
||||
database-type: oracle
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
create table FLW_RU_BATCH (
|
||||
ID_ VARCHAR2(64) not null,
|
||||
REV_ INTEGER,
|
||||
TYPE_ VARCHAR2(64) not null,
|
||||
SEARCH_KEY_ VARCHAR2(255),
|
||||
SEARCH_KEY2_ VARCHAR2(255),
|
||||
CREATE_TIME_ TIMESTAMP(6) not null,
|
||||
COMPLETE_TIME_ TIMESTAMP(6),
|
||||
STATUS_ VARCHAR2(255),
|
||||
BATCH_DOC_ID_ VARCHAR2(64),
|
||||
TENANT_ID_ VARCHAR2(255) default '',
|
||||
primary key (ID_)
|
||||
);
|
||||
|
||||
create table FLW_RU_BATCH_PART (
|
||||
ID_ VARCHAR2(64) not null,
|
||||
REV_ INTEGER,
|
||||
BATCH_ID_ VARCHAR2(64),
|
||||
TYPE_ VARCHAR2(64) not null,
|
||||
SCOPE_ID_ VARCHAR2(64),
|
||||
SUB_SCOPE_ID_ VARCHAR2(64),
|
||||
SCOPE_TYPE_ VARCHAR2(64),
|
||||
SEARCH_KEY_ VARCHAR2(255),
|
||||
SEARCH_KEY2_ VARCHAR2(255),
|
||||
CREATE_TIME_ TIMESTAMP(6) not null,
|
||||
COMPLETE_TIME_ TIMESTAMP(6),
|
||||
STATUS_ VARCHAR2(255),
|
||||
RESULT_DOC_ID_ VARCHAR2(64),
|
||||
TENANT_ID_ VARCHAR2(255) default '',
|
||||
primary key (ID_)
|
||||
);
|
||||
|
||||
create index FLW_IDX_BATCH_PART on FLW_RU_BATCH_PART(BATCH_ID_);
|
||||
|
||||
alter table FLW_RU_BATCH_PART
|
||||
add constraint FLW_FK_BATCH_PART_PARENT
|
||||
foreign key (BATCH_ID_)
|
||||
references FLW_RU_BATCH (ID_);
|
||||
|
||||
insert into ACT_GE_PROPERTY values ('batch.schema.version', '7.0.1.1', 1);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user