feat: 引擎版本初始化
commit
714adfad49
|
@ -20,4 +20,9 @@ public class ServiceNameConstants {
|
|||
* 文件服务的serviceid
|
||||
*/
|
||||
public static final String FILE_SERVICE = "ruoyi-file";
|
||||
|
||||
/**
|
||||
* 数据元管理系统的serviceid
|
||||
*/
|
||||
public static final String DATA_SOURCE = "ruoyi-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-data-source</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-data-source-clinet</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-data-source-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.source.clinet.config;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* 数据接入客户端配置类
|
||||
*
|
||||
* @ClassName DataSourceClinetConfig
|
||||
* @Author AnNan.Wang
|
||||
* @Date 2024/5/8 20:41
|
||||
*/
|
||||
|
||||
@ComponentScan
|
||||
@Import(value = {DataSourceClinetRunner.class})
|
||||
public class DataSourceClinetConfig {
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.source.clinet.config;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.data.source.domain.DataSource;
|
||||
import com.muyu.data.source.domain.SysDictionary;
|
||||
import com.muyu.data.source.domain.req.DataSourceQueryReq;
|
||||
import com.muyu.data.source.remote.RemoteDataManagerService;
|
||||
import lombok.extern.java.Log;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 初始化加载
|
||||
*
|
||||
* @ClassName DataSourceClinetRunner
|
||||
* @Author AnNan.Wang
|
||||
* @Date 2024/5/8 20:46
|
||||
*/
|
||||
|
||||
@Log4j2
|
||||
public class DataSourceClinetRunner implements ApplicationRunner {
|
||||
@Autowired
|
||||
private RemoteDataManagerService remoteDataManagerService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
Result<TableDataInfo<DataSource>> list = remoteDataManagerService.list(new DataSourceQueryReq());
|
||||
log.info(list);
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.source.clinet.config.DataSourceClinetConfig
|
|
@ -17,4 +17,15 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</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>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.data.source.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.data.source.domain.DataSource;
|
||||
import com.muyu.data.source.domain.SysDictionary;
|
||||
import com.muyu.data.source.domain.req.DataSourceQueryReq;
|
||||
import com.muyu.data.source.remote.factory.RemoteDataManagerServiceFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据源远程调用
|
||||
*
|
||||
* @ClassName RemoteDataManagerService
|
||||
* @Author AnNan.Wang
|
||||
* @Date 2024/5/8 19:49
|
||||
*/
|
||||
|
||||
@FeignClient(
|
||||
contextId = "RemoteSys",
|
||||
value = ServiceNameConstants.DATA_SOURCE,
|
||||
fallbackFactory = RemoteDataManagerServiceFactory.class,
|
||||
path = "/source"
|
||||
)
|
||||
public interface RemoteDataManagerService {
|
||||
@PostMapping("/list")
|
||||
public Result<TableDataInfo<DataSource>> list(DataSourceQueryReq dataSourceQueryReq);
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.data.source.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.data.source.domain.DataSource;
|
||||
import com.muyu.data.source.domain.SysDictionary;
|
||||
import com.muyu.data.source.domain.req.DataSourceQueryReq;
|
||||
import com.muyu.data.source.remote.RemoteDataManagerService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 熔断
|
||||
*
|
||||
* @ClassName RemoteDataManagerServiceFactory
|
||||
* @Author AnNan.Wang
|
||||
* @Date 2024/5/8 19:52
|
||||
*/
|
||||
|
||||
|
||||
public class RemoteDataManagerServiceFactory implements FallbackFactory<RemoteDataManagerService> {
|
||||
@Override
|
||||
public RemoteDataManagerService create(Throwable cause) {
|
||||
return new RemoteDataManagerService() {
|
||||
@Override
|
||||
public Result<TableDataInfo<DataSource>> list(@RequestBody DataSourceQueryReq dataSourceQueryReq) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.data.source.remote.factory.RemoteDataManagerServiceFactory
|
|
@ -37,8 +37,7 @@ public class DataSourceController extends BaseController {
|
|||
* 查询数据源列表
|
||||
*/
|
||||
@ApiOperation("获取数据源列表")
|
||||
@RequiresPermissions("source:source:list")
|
||||
@GetMapping("/list")
|
||||
@PostMapping("/list")
|
||||
public Result<TableDataInfo<DataSource>> list(DataSourceQueryReq dataSourceQueryReq) {
|
||||
startPage();
|
||||
List<DataSource> list = dataSourceService.list(DataSource.queryBuild(dataSourceQueryReq));
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<module>muyu-data-source-common</module>
|
||||
<module>muyu-data-source-remote</module>
|
||||
<module>muyu-data-source-server</module>
|
||||
<module>muyu-data-source-clinet</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
<?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-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-data-unit</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-data-source-clinet</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-rule-clinet</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-data-source-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.data.unlt;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* 数据启动类
|
||||
*
|
||||
* @ClassName DataUnltApplication
|
||||
* @Author AnNan.Wang
|
||||
* @Date 2024/5/8 20:57
|
||||
*/
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
|
||||
@EnableAsync
|
||||
public class DataUnltApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(DataUnltApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9225
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: ruoyi-source-unit
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.243.166:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.243.166:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.data.source.mapper: DEBUG
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-data-unit"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -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-rule</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-rule-clinet</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>
|
|
@ -11,7 +11,7 @@ import lombok.Data;
|
|||
@Data
|
||||
public class RuleContentReq {
|
||||
|
||||
private Long ruleId;
|
||||
private String className;
|
||||
|
||||
private String ruleContent;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.engine;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/6
|
||||
* @Description: 引擎
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface Engine<V> {
|
||||
|
||||
public void execution();
|
||||
|
||||
public V get();
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.muyu.engine.action;
|
||||
|
||||
/**
|
||||
* @ClassName ActionDiscard
|
||||
* @Author AnNan.Wang
|
||||
* @Date 2024/5/8 21:59
|
||||
*/
|
||||
|
||||
|
||||
public class ActionDiscard extends RuntimeException{
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.engine.scope;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/4/29
|
||||
* @Description: 数据模型
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class DataModelContext {
|
||||
|
||||
private final DataSetContext dataSetContext;
|
||||
|
||||
public DataModelContext (DataSetContext dataSetContext) {
|
||||
this.dataSetContext = dataSetContext;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.muyu.engine.scope;
|
||||
|
||||
import com.muyu.engine.Engine;
|
||||
import com.muyu.model.DataModel;
|
||||
import com.muyu.scope.DataModelContext;
|
||||
import com.muyu.scope.model.DataProcessModel;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/6
|
||||
* @Description: 数据模型引擎接口
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public abstract class DataModelEngine implements Engine<DataProcessModel> {
|
||||
|
||||
private DataModelContext dataModelContext;
|
||||
|
||||
@Override
|
||||
public DataProcessModel get (){
|
||||
return dataModelContext.get();
|
||||
}
|
||||
|
||||
public DataModel getModel(){
|
||||
return get().getDataModel();
|
||||
}
|
||||
|
||||
|
||||
public String getKey () {
|
||||
return getModel().getKey();
|
||||
}
|
||||
|
||||
public Object getValue () {
|
||||
return getModel().getValue();
|
||||
}
|
||||
|
||||
public String getSourceType () {
|
||||
return getModel().getSourceType();
|
||||
}
|
||||
|
||||
public String getProcessType () {
|
||||
return getModel().getProcessType();
|
||||
}
|
||||
|
||||
public Class<?> getProcessClass () {
|
||||
return getModel().getProcessClass();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.engine.scope;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/4/29
|
||||
* @Description: 数据集
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class DataSetContext {
|
||||
|
||||
private final RecordContext recordContext;
|
||||
|
||||
public DataSetContext (RecordContext recordContext) {
|
||||
this.recordContext = recordContext;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.engine.scope;
|
||||
|
||||
import com.muyu.engine.Engine;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/6
|
||||
* @Description: 数据模型引擎接口
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface DataSetEngine extends Engine {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.engine.scope;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/4/29
|
||||
* @Description: 记录/资产模型
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class RecordContext {
|
||||
|
||||
private final TaskContext taskContext;
|
||||
|
||||
public RecordContext (TaskContext taskContext) {
|
||||
this.taskContext = taskContext;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.engine.scope;
|
||||
|
||||
import com.muyu.engine.Engine;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/6
|
||||
* @Description: 数据模型引擎接口
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface RecordEngine extends Engine {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.engine.scope;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/4/29
|
||||
* @Description: 任务上下文
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class TaskContext {
|
||||
|
||||
public static TaskContext build(){
|
||||
return new TaskContext();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.muyu.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/5
|
||||
* @Description: 数据模型
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class DataModel {
|
||||
|
||||
/**
|
||||
* 数据键
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 数据值
|
||||
*/
|
||||
private Object value;
|
||||
|
||||
/**
|
||||
* 源标准-枚举
|
||||
*/
|
||||
private String sourceType;
|
||||
|
||||
/**
|
||||
* 处理标准-枚举
|
||||
*/
|
||||
private String processType;
|
||||
|
||||
/**
|
||||
* 处理类型
|
||||
*/
|
||||
private Class<?> processClass;
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.model;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/5
|
||||
* @Description: 一页
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class DataSetModel {
|
||||
|
||||
// [[DataModel,DataModel,DataModel],[DataModel,DataModel,DataModel]]
|
||||
|
||||
private RecordModel[] recordModelArr = null;
|
||||
|
||||
private DataSetModel(int recordModelLength){
|
||||
recordModelArr = new RecordModel[recordModelLength];
|
||||
}
|
||||
private DataSetModel(RecordModel[] recordModelArr){
|
||||
recordModelArr = recordModelArr;
|
||||
}
|
||||
|
||||
public static DataSetModel build(int recordModelLength){
|
||||
return new DataSetModel(recordModelLength);
|
||||
}
|
||||
|
||||
public static DataSetModel build(RecordModel[] recordModelArr){
|
||||
return new DataSetModel(recordModelArr);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.model;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/5
|
||||
* @Description: 数据标准
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface DataStandard {
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.model;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/5
|
||||
* @Description: 记录模型
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class RecordModel {
|
||||
// [DataModel,DataModel,DataModel]
|
||||
|
||||
private RecordModel(int dataModelLength){
|
||||
dataModelArr = new DataModel[dataModelLength];
|
||||
}
|
||||
private RecordModel(DataModel[] dataModelArr){
|
||||
dataModelArr = dataModelArr;
|
||||
}
|
||||
|
||||
private DataModel[] dataModelArr = null;
|
||||
|
||||
public static RecordModel build(int dataModelLength){
|
||||
return new RecordModel(dataModelLength);
|
||||
}
|
||||
|
||||
public static RecordModel build(DataModel[] dataModelArr){
|
||||
return new RecordModel(dataModelArr);
|
||||
}
|
||||
}
|
|
@ -33,5 +33,8 @@ public class EngineVersionController {
|
|||
return engineVersionService.versionsAdd(engineVersion);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/versionsUpd")
|
||||
public Result<String> versionsUpd(@RequestBody EngineVersion engineVersion){
|
||||
return engineVersionService.versionsUpd(engineVersion);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,4 +14,5 @@ import com.muyu.rule.domain.EngineVersion;
|
|||
public interface EngineVersionService extends IService<EngineVersion> {
|
||||
Result<String> versionsAdd(EngineVersion engineVersion);
|
||||
|
||||
Result<String> versionsUpd(EngineVersion engineVersion);
|
||||
}
|
||||
|
|
|
@ -85,15 +85,15 @@ public class EngineMaintenanceServiceImpl extends ServiceImpl<EngineMaintenanceM
|
|||
|
||||
@Override
|
||||
public Result compiler(RuleContentReq ruleContentReq) {
|
||||
Long ruleId = ruleContentReq.getRuleId();
|
||||
String className = ruleContentReq.getClassName();
|
||||
String content = ruleContentReq.getRuleContent();
|
||||
// 指定输出目录
|
||||
String targetDirectory = "D:\\work\\etl\\cloud-server\\muyu-modules\\muyu-rule\\muyu-rule-server\\src\\main\\java\\com\\muyu\\rule\\controller";
|
||||
String targetDirectory = "D:\\work\\etl\\cloud-server\\muyu-modules\\muyu-rule\\muyu-rule-server\\src\\main\\java\\com\\muyu\\engine";
|
||||
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null)) {
|
||||
// 创建一个内存中的源文件
|
||||
JavaFileObject sourceFileObject = new JavaSourceFromString("Test"+ruleId, content);
|
||||
JavaFileObject sourceFileObject = new JavaSourceFromString(className, content);
|
||||
|
||||
// 编译选项
|
||||
Iterable<String> options = Arrays.asList("-d", targetDirectory);
|
||||
|
@ -103,16 +103,15 @@ public class EngineMaintenanceServiceImpl extends ServiceImpl<EngineMaintenanceM
|
|||
boolean success = task.call();
|
||||
|
||||
if (success) {
|
||||
engineMaintenanceMapper.addRulecontent(ruleContentReq);
|
||||
System.out.println("编译成功");
|
||||
return Result.success("编译成功");
|
||||
} else {
|
||||
System.out.println("编译失败");
|
||||
return Result.error("编译失败");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Result.error(e.getMessage());
|
||||
}
|
||||
return Result.success("编译成功");
|
||||
return Result.error("编译失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,4 +33,13 @@ public class EngineVersionServiceImpl extends ServiceImpl<EngineVersionMapper, E
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result<String> versionsUpd(EngineVersion engineVersion) {
|
||||
int i = engineVersionMapper.updateById(engineVersion);
|
||||
if (i>0) {
|
||||
return Result.success("代码保存成功");
|
||||
}else {
|
||||
return Result.error("代码保存成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.scope;
|
||||
|
||||
import com.muyu.scope.model.DataProcessModel;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/4/29
|
||||
* @Description: 数据模型
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class DataModelContext implements ScopeContext <DataProcessModel>{
|
||||
|
||||
private static final ThreadLocal<DataProcessModel> THREAD_LOCAL = new ThreadLocal<>();
|
||||
|
||||
private final DataSetContext dataSetContext;
|
||||
|
||||
public DataModelContext (DataSetContext dataSetContext) {
|
||||
this.dataSetContext = dataSetContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataProcessModel get () {
|
||||
return THREAD_LOCAL.get();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.scope;
|
||||
|
||||
import com.muyu.scope.model.DataSetProcessModel;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/4/29
|
||||
* @Description: 数据集
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class DataSetContext {
|
||||
|
||||
private static final ThreadLocal<DataSetProcessModel> THREAD_LOCAL = new ThreadLocal<>();
|
||||
|
||||
private final RecordContext recordContext;
|
||||
|
||||
public DataSetContext (RecordContext recordContext) {
|
||||
this.recordContext = recordContext;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.scope;
|
||||
|
||||
import com.muyu.scope.model.RecordProcessModel;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/4/29
|
||||
* @Description: 记录/资产模型
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class RecordContext {
|
||||
|
||||
private static final ThreadLocal<RecordProcessModel> THREAD_LOCAL = new ThreadLocal<>();
|
||||
|
||||
private final TaskContext taskContext;
|
||||
|
||||
private RecordContext (TaskContext taskContext) {
|
||||
this.taskContext = taskContext;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.muyu.scope;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/6
|
||||
* @Description: 数据域规范
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface ScopeContext<V> {
|
||||
|
||||
V get();
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.scope;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/4/29
|
||||
* @Description: 任务上下文
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class TaskContext {
|
||||
|
||||
public static TaskContext build(){
|
||||
return new TaskContext();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.scope.model;
|
||||
|
||||
import com.muyu.model.DataModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/5
|
||||
* @Description: 数据处理模型
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class DataProcessModel {
|
||||
|
||||
private DataModel dataModel;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.scope.model;
|
||||
|
||||
import com.muyu.model.DataSetModel;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/5
|
||||
* @Description: 数据集处理模型
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class DataSetProcessModel {
|
||||
|
||||
private DataSetModel dataSetModel;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.scope.model;
|
||||
|
||||
import com.muyu.model.RecordModel;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/5
|
||||
* @Description: 行级别任务处理模型
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class RecordProcessModel {
|
||||
|
||||
private String[] keys;
|
||||
|
||||
private RecordModel recordModel;
|
||||
}
|
|
@ -15,6 +15,7 @@
|
|||
<module>muyu-rule-common</module>
|
||||
<module>muyu-rule-remote</module>
|
||||
<module>muyu-rule-server</module>
|
||||
<module>muyu-rule-clinet</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<module>muyu-file</module>
|
||||
<module>muyu-data-source</module>
|
||||
<module>muyu-rule</module>
|
||||
<module>muyu-data-unit</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
|
|
Loading…
Reference in New Issue