fix:对规则引擎进行分层
parent
5ebca27b6d
commit
49487a999d
|
@ -20,4 +20,15 @@ public class ServiceNameConstants {
|
||||||
* 文件服务的serviceid
|
* 文件服务的serviceid
|
||||||
*/
|
*/
|
||||||
public static final String FILE_SERVICE = "muyu-file";
|
public static final String FILE_SERVICE = "muyu-file";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源的serviceid
|
||||||
|
*/
|
||||||
|
public static final String SOURCE_SERVICE="muyu-source";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎的serviceid
|
||||||
|
*/
|
||||||
|
public static final String RULE_ENGINE_SERVICE="muyu-rule-engine";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,9 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
*
|
*
|
||||||
* @author hufangming
|
* @author hufangming
|
||||||
*/
|
*/
|
||||||
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
@FeignClient(contextId = "remoteFileService",
|
||||||
|
value = ServiceNameConstants.FILE_SERVICE,
|
||||||
|
fallbackFactory = RemoteFileFallbackFactory.class)
|
||||||
public interface RemoteFileService {
|
public interface RemoteFileService {
|
||||||
/**
|
/**
|
||||||
* 上传文件
|
* 上传文件
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-data-source</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-data-source-client</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1 @@
|
||||||
|
com.muyu.data.source.client.config.SourceClientConfig
|
|
@ -88,6 +88,10 @@ public class DataSource extends BaseEntity {
|
||||||
@Excel(name = "数据连接参数")
|
@Excel(name = "数据连接参数")
|
||||||
@ApiModelProperty(name = "数据连接参数", value = "数据连接参数")
|
@ApiModelProperty(name = "数据连接参数", value = "数据连接参数")
|
||||||
private String connectionParam;
|
private String connectionParam;
|
||||||
|
/*.*是否初始化*/
|
||||||
|
@Excel(name = "是否初始化")
|
||||||
|
@ApiModelProperty(name = "是否初始化", value = "是否初始化")
|
||||||
|
private String isInit;
|
||||||
|
|
||||||
/** 状态 'Y'/'N' */
|
/** 状态 'Y'/'N' */
|
||||||
@Excel(name = "状态 'Y'/'N'")
|
@Excel(name = "状态 'Y'/'N'")
|
||||||
|
@ -138,6 +142,7 @@ public class DataSource extends BaseEntity {
|
||||||
.user(dataSourceSaveReq.getUser())
|
.user(dataSourceSaveReq.getUser())
|
||||||
.password(dataSourceSaveReq.getPassword())
|
.password(dataSourceSaveReq.getPassword())
|
||||||
.type(dataSourceSaveReq.getType())
|
.type(dataSourceSaveReq.getType())
|
||||||
|
.initNum(dataSourceSaveReq.getInitNum())
|
||||||
.connectionParam(dataSourceSaveReq.getConnectionParam())
|
.connectionParam(dataSourceSaveReq.getConnectionParam())
|
||||||
.initNum(dataSourceSaveReq.getInitNum())
|
.initNum(dataSourceSaveReq.getInitNum())
|
||||||
.maxNum(dataSourceSaveReq.getMaxNum())
|
.maxNum(dataSourceSaveReq.getMaxNum())
|
||||||
|
@ -163,6 +168,7 @@ public class DataSource extends BaseEntity {
|
||||||
.databaseName(dataSourceEditReq.getDatabaseName())
|
.databaseName(dataSourceEditReq.getDatabaseName())
|
||||||
.user(dataSourceEditReq.getUser())
|
.user(dataSourceEditReq.getUser())
|
||||||
.password(dataSourceEditReq.getPassword())
|
.password(dataSourceEditReq.getPassword())
|
||||||
|
.initNum(dataSourceEditReq.getInitNum())
|
||||||
.type(dataSourceEditReq.getType())
|
.type(dataSourceEditReq.getType())
|
||||||
.connectionParam(dataSourceEditReq.getConnectionParam())
|
.connectionParam(dataSourceEditReq.getConnectionParam())
|
||||||
.initNum(dataSourceEditReq.getInitNum())
|
.initNum(dataSourceEditReq.getInitNum())
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.data.source.domain.req;
|
package com.muyu.data.source.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -43,6 +44,10 @@ public class DataSourceEditReq extends BaseEntity {
|
||||||
@ApiModelProperty(name = "主机地址", value = "主机地址")
|
@ApiModelProperty(name = "主机地址", value = "主机地址")
|
||||||
private String host;
|
private String host;
|
||||||
|
|
||||||
|
/*.*是否初始化*/
|
||||||
|
@Excel(name = "是否初始化")
|
||||||
|
@ApiModelProperty(name = "是否初始化", value = "是否初始化")
|
||||||
|
private String isInit;
|
||||||
/** 端口号 */
|
/** 端口号 */
|
||||||
@ApiModelProperty(name = "端口号", value = "端口号")
|
@ApiModelProperty(name = "端口号", value = "端口号")
|
||||||
private String port;
|
private String port;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.data.source.domain.req;
|
package com.muyu.data.source.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -38,6 +39,11 @@ public class DataSourceSaveReq extends BaseEntity {
|
||||||
@ApiModelProperty(name = "数据来源系统名称", value = "数据来源系统名称")
|
@ApiModelProperty(name = "数据来源系统名称", value = "数据来源系统名称")
|
||||||
private String systemName;
|
private String systemName;
|
||||||
|
|
||||||
|
/*.*是否初始化*/
|
||||||
|
@Excel(name = "是否初始化")
|
||||||
|
@ApiModelProperty(name = "是否初始化", value = "是否初始化")
|
||||||
|
private String isInit;
|
||||||
|
|
||||||
/** 数据库名称 */
|
/** 数据库名称 */
|
||||||
|
|
||||||
@ApiModelProperty(name = "数据库名称", value = "数据库名称")
|
@ApiModelProperty(name = "数据库名称", value = "数据库名称")
|
||||||
|
|
|
@ -17,4 +17,15 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-data-source-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.data.source.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.data.source.domain.DataSource;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 熔断
|
||||||
|
*
|
||||||
|
* @author HuFangMing
|
||||||
|
* @ClassName: RemoteDataSourceFactory
|
||||||
|
* @createTime: 2024/5/10 20:03
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class RemoteDataSourceFactory implements FallbackFactory<RemoteDataSourceService> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteDataSourceService create(Throwable cause) {
|
||||||
|
return new RemoteDataSourceService() {
|
||||||
|
@Override
|
||||||
|
public Result<List<DataSource>> getDataSourceList() {
|
||||||
|
return Result.error(cause.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.muyu.data.source.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.data.source.domain.DataSource;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源远程调用
|
||||||
|
*
|
||||||
|
* @author HuFangMing
|
||||||
|
* @ClassName: RemoteDataSourceService
|
||||||
|
* @createTime: 2024/5/10 19:47
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId ="RemoteDataSourceService",
|
||||||
|
value = ServiceNameConstants.SOURCE_SERVICE,
|
||||||
|
fallbackFactory = RemoteDataSourceFactory.class,
|
||||||
|
path = "/data"
|
||||||
|
)
|
||||||
|
|
||||||
|
public interface RemoteDataSourceService {
|
||||||
|
@GetMapping("/getDataSourceList")
|
||||||
|
public Result<List<DataSource>> getDataSourceList();
|
||||||
|
}
|
|
@ -17,6 +17,7 @@
|
||||||
<module>muyu-data-source-common</module>
|
<module>muyu-data-source-common</module>
|
||||||
<module>muyu-data-source-remote</module>
|
<module>muyu-data-source-remote</module>
|
||||||
<module>muyu-data-source-server</module>
|
<module>muyu-data-source-server</module>
|
||||||
|
<module>muyu-data-source-client</module>
|
||||||
</modules>
|
</modules>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule_engine</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-rule-client</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule_engine-remote</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.muyu.rule.client.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎客户端配置类
|
||||||
|
*
|
||||||
|
* @author HuFangMing
|
||||||
|
* @ClassName: RuleEngineClientConfig
|
||||||
|
* @createTime: 2024/5/10 15:15
|
||||||
|
*/
|
||||||
|
|
||||||
|
@ComponentScan
|
||||||
|
@Import(value = RuleEngineClientRunner.class)
|
||||||
|
public class RuleEngineClientConfig {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.rule.client.config;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.ruleEngine.domain.EngineMaintenance;
|
||||||
|
import com.muyu.ruleEngine.remote.RemoteEngineMaintenanceService;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.ApplicationArguments;
|
||||||
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化加载
|
||||||
|
*
|
||||||
|
* @author HuFangMing
|
||||||
|
* @ClassName: RuleEngineClientRunner
|
||||||
|
* @createTime: 2024/5/10 15:17
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
public class RuleEngineClientRunner implements ApplicationRunner {
|
||||||
|
@Autowired
|
||||||
|
private RemoteEngineMaintenanceService engineMaintenanceService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
|
Result<List<EngineMaintenance>> maintenanceList = engineMaintenanceService.getMaintenanceList();
|
||||||
|
|
||||||
|
log.info(maintenanceList);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
com.muyu.rule.engine.client.config.RuleEngineClientConfig
|
|
@ -16,5 +16,15 @@
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule_engine-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.ruleEngine.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.ruleEngine.domain.EngineMaintenance;
|
||||||
|
import com.muyu.ruleEngine.remote.factory.RemoteEngineMaintenanceFactory;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源远程调用
|
||||||
|
*
|
||||||
|
* @author HuFangMing
|
||||||
|
* @ClassName: RemoteEngineMaintenanceService
|
||||||
|
* @createTime: 2024/5/10 20:44
|
||||||
|
*/
|
||||||
|
|
||||||
|
@FeignClient(contextId = "RemoteEngineMaintenanceService",
|
||||||
|
value = ServiceNameConstants.RULE_ENGINE_SERVICE,
|
||||||
|
fallbackFactory = RemoteEngineMaintenanceFactory.class,
|
||||||
|
path = "/maintenance"
|
||||||
|
)
|
||||||
|
public interface RemoteEngineMaintenanceService {
|
||||||
|
@GetMapping("/getMaintenanceList")
|
||||||
|
public Result<List<EngineMaintenance>> getMaintenanceList();
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.muyu.ruleEngine.remote.factory;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.ruleEngine.domain.EngineMaintenance;
|
||||||
|
import com.muyu.ruleEngine.remote.RemoteEngineMaintenanceService;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 熔断
|
||||||
|
*
|
||||||
|
* @author HuFangMing
|
||||||
|
* @ClassName: RemoteEngineMaintenanceFactory
|
||||||
|
* @createTime: 2024/5/10 20:53
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class RemoteEngineMaintenanceFactory implements FallbackFactory<RemoteEngineMaintenanceService> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteEngineMaintenanceService create(Throwable cause) {
|
||||||
|
return new RemoteEngineMaintenanceService() {
|
||||||
|
@Override
|
||||||
|
public Result<List<EngineMaintenance>> getMaintenanceList() {
|
||||||
|
return Result.error(cause.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -143,4 +143,10 @@ public class EngineMaintenanceController extends BaseController {
|
||||||
EngineVersionListResp engineConfigListResp=engineMaintenanceService.getRuleEngineInfo(id);
|
EngineVersionListResp engineConfigListResp=engineMaintenanceService.getRuleEngineInfo(id);
|
||||||
return Result.success(engineConfigListResp);
|
return Result.success(engineConfigListResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/maintenance")
|
||||||
|
public Result<List<EngineMaintenance>> getMaintenanceList(){
|
||||||
|
List<EngineMaintenance> list=engineMaintenanceService.list();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<module>muyu-rule_engine-common</module>
|
<module>muyu-rule_engine-common</module>
|
||||||
<module>muyu-rule_engine-remote</module>
|
<module>muyu-rule_engine-remote</module>
|
||||||
<module>muyu-rule_engine-server</module>
|
<module>muyu-rule_engine-server</module>
|
||||||
|
<module>muyu-rule-client</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
Loading…
Reference in New Issue