feat:规则引擎(数据源接入,测试)
parent
f91ab4522c
commit
7dcbe492a5
|
@ -20,4 +20,14 @@ public class ServiceNameConstants {
|
||||||
* 文件服务的serviceid
|
* 文件服务的serviceid
|
||||||
*/
|
*/
|
||||||
public static final String FILE_SERVICE = "etl-file";
|
public static final String FILE_SERVICE = "etl-file";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源服务
|
||||||
|
*/
|
||||||
|
public static final String DATA_SOURCE_SERVICE = "etl-data-source";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据规则引擎服务
|
||||||
|
*/
|
||||||
|
public static final String DATA_RULE_ENGINE_SERVICE = "etl-data-rule-engine";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package com.etl.data.client.config;
|
package com.etl.data.client.config;
|
||||||
|
|
||||||
|
|
||||||
|
import com.etl.data.client.jdbcUtils.JDBCConcreteClass;
|
||||||
import com.etl.data.domain.DataSource;
|
import com.etl.data.domain.DataSource;
|
||||||
import com.etl.data.domain.config.DataSourceConfig;
|
import com.etl.data.domain.dataSource.DataSourceConfig;
|
||||||
import com.etl.data.domain.req.DataSourceQueryReq;
|
import com.etl.data.domain.req.DataSourceQueryReq;
|
||||||
import com.etl.data.source.remote.RemoteDataSourceService;
|
import com.etl.data.source.remote.RemoteDataSourceService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
@ -10,13 +11,16 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSetMetaData;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据访问客户端运行程序
|
* 数据访问客户端运行程序
|
||||||
* @author YunFei.Du
|
*
|
||||||
* @date 14:10 2024/5/10
|
* @author YunFei.Du
|
||||||
|
* @date 14:10 2024/5/10
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class DataAccessClientRunner implements ApplicationRunner {
|
public class DataAccessClientRunner implements ApplicationRunner {
|
||||||
|
@ -26,18 +30,27 @@ public class DataAccessClientRunner implements ApplicationRunner {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) {
|
public void run(ApplicationArguments args) {
|
||||||
try {
|
|
||||||
List< DataSource > dataSourceList = remoteDataSourceService.getDataSourceList ( new DataSourceQueryReq () ).getData ( ).getRows ( );
|
|
||||||
HashMap< String, javax.sql.DataSource > hashMap = new HashMap<> ( );
|
|
||||||
|
|
||||||
for (DataSource dataSource : dataSourceList) {
|
List< DataSource > dataSourceList = remoteDataSourceService.getDataSourceList ( new DataSourceQueryReq ( ) ).getData ( ).getRows ( );
|
||||||
|
try {
|
||||||
|
dataSourceList.stream ( ).forEach ( dataSource -> {
|
||||||
log.info ( "dataSource:{}", dataSource );
|
log.info ( "dataSource:{}", dataSource );
|
||||||
javax.sql.DataSource dataSource1 = DataSourceConfig.dataSource ( dataSource.getHost ( ), dataSource.getDatabaseName ( ), dataSource.getPort ( ), dataSource.getUsername ( ), dataSource.getPassword ( ) );
|
DataSourceConfig.init ( dataSource );
|
||||||
log.info ( "dataSource111:{}", dataSource1 );
|
} );
|
||||||
hashMap.put ( dataSource.getName ( ), dataSource1 );
|
String key = dataSourceList.get ( 0 ).getName ( ) + dataSourceList.get ( 0 ).getId ( );
|
||||||
|
DataSourceConfig.getNum ( key );
|
||||||
|
Connection connection = DataSourceConfig.getConnection ( key );
|
||||||
|
JDBCConcreteClass jdbcConcreteClass = new JDBCConcreteClass ( );
|
||||||
|
PreparedStatement preparedStatement = jdbcConcreteClass.getPreparedStatement ( connection, "select * from car" );
|
||||||
|
ResultSetMetaData rsd = preparedStatement.getMetaData ( );
|
||||||
|
for (int i = 1; i <= rsd.getColumnCount ( ); i++) {
|
||||||
|
log.info ( "类型:{}", rsd.getColumnClassName ( i ) );
|
||||||
}
|
}
|
||||||
|
DataSourceConfig.close ( connection );
|
||||||
|
DataSourceConfig.getNum ( key );
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error ( "失败了" );
|
log.error ( "数据访问客户端运行程序异常:{}", e.getMessage ( ) );
|
||||||
|
throw new RuntimeException ( e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.etl.data.client.jdbcUtils;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorOrder;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* jdbc抽象类
|
||||||
|
* @author YunFei.Du
|
||||||
|
* @date 15:34 2024/5/14
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public abstract class JDBCAbstractClass {
|
||||||
|
|
||||||
|
|
||||||
|
public abstract PreparedStatement getPreparedStatement(Connection connection, String sql);
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.etl.data.client.jdbcUtils;
|
||||||
|
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* jdbc实体类
|
||||||
|
* @author YunFei.Du
|
||||||
|
* @date 15:36 2024/5/14
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
public class JDBCConcreteClass extends JDBCAbstractClass{
|
||||||
|
@Override
|
||||||
|
public PreparedStatement getPreparedStatement(Connection connection,String sql) {
|
||||||
|
try {
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement ( sql );
|
||||||
|
log.info ( "查询结果:" + preparedStatement );
|
||||||
|
return preparedStatement;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException ( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
package com.etl.data.domain.dataSource;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import com.etl.data.domain.DataSource;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源连接池配置
|
||||||
|
* @author YunFei.Du
|
||||||
|
* @date 9:09 2024/5/14
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
public class DataSourceConfig {
|
||||||
|
|
||||||
|
|
||||||
|
private static HashMap<String,DruidDataSource> dataSourceMap= new HashMap<> ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化数据库连接池。
|
||||||
|
* @param dataSource 提供数据库连接配置信息的对象,包括用户名、密码、数据库地址、端口、数据库名称、JDBC驱动类名、初始化连接数和最大活动连接数等。
|
||||||
|
*/
|
||||||
|
public static void init(DataSource dataSource) {
|
||||||
|
// 创建Druid数据源实例
|
||||||
|
DruidDataSource druidDataSource = new DruidDataSource();
|
||||||
|
druidDataSource.setUsername(dataSource.getUsername ());
|
||||||
|
druidDataSource.setPassword(dataSource.getPassword());
|
||||||
|
druidDataSource.setUrl ( "jdbc:mysql://"+dataSource.getHost ( )+":"+dataSource.getPort ( )+"/"+dataSource.getDatabaseName ( ) );
|
||||||
|
druidDataSource.setDriverClassName ( dataSource.getJdbcDriver () );
|
||||||
|
// 设置初始化连接数和最小空闲连接数
|
||||||
|
druidDataSource.setInitialSize ( Integer.valueOf ( dataSource.getInitNum () ) );
|
||||||
|
druidDataSource.setMinIdle ( Integer.valueOf ( dataSource.getInitNum () ) );
|
||||||
|
// 设置最大活动连接数
|
||||||
|
druidDataSource.setMaxActive ( Integer.valueOf ( dataSource.getMaxNum () ) );
|
||||||
|
try {
|
||||||
|
//初始化连接池
|
||||||
|
druidDataSource.init();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error ( "初始化数据源失败" );
|
||||||
|
}
|
||||||
|
// 将数据源实例添加到dataSourceMap中,以名称+ID作为键
|
||||||
|
dataSourceMap.put(dataSource.getName ()+dataSource.getId(), druidDataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取连接池信息
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
public static void getNum(String key) {
|
||||||
|
DruidDataSource druidDataSource = dataSourceMap.get ( key );
|
||||||
|
log.info(key + "正在使用连接" + druidDataSource.getActiveCount () + "个,线程数量:" + druidDataSource.getPoolingCount () + "个");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Connection getConnection(String key) {
|
||||||
|
|
||||||
|
DruidDataSource druidDataSource = dataSourceMap.get ( key );
|
||||||
|
if (druidDataSource != null){
|
||||||
|
try {
|
||||||
|
return druidDataSource.getConnection ( );
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException ( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放连接
|
||||||
|
* @param connection
|
||||||
|
*/
|
||||||
|
public static void close(Connection connection) {
|
||||||
|
try {
|
||||||
|
connection.close ();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error ( "释放连接失败" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.etl.data.domain.dataSource;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import com.etl.data.domain.DataSource;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库连接池管理
|
||||||
|
* @author YunFei.Du
|
||||||
|
* @date 15:23 2024/5/13
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class MyDataSource {
|
||||||
|
private static HashMap<String, DruidDataSource > polls=new HashMap<> ( );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库连接池初始化
|
||||||
|
*/
|
||||||
|
public static void info(List< DataSource> dataSourceList){
|
||||||
|
for (DataSource dataSource : dataSourceList) {
|
||||||
|
String jdbUrl ="jdbc:"+dataSource.getJdbcDriver()+"://"+dataSource.getHost()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName();
|
||||||
|
String key=dataSource.getId ()+"_"+dataSource.getName ();
|
||||||
|
//创建德鲁伊数据库连接池
|
||||||
|
DruidDataSource druidSource = new DruidDataSource ( );
|
||||||
|
druidSource.setUrl ( jdbUrl );
|
||||||
|
druidSource.setUsername ( dataSource.getUsername () );
|
||||||
|
druidSource.setPassword ( dataSource.getPassword () );
|
||||||
|
druidSource.setInitialSize ( Integer.valueOf ( dataSource.getInitNum () ) );
|
||||||
|
druidSource.setMinIdle ( Integer.valueOf ( dataSource.getMaxNum ()) );
|
||||||
|
druidSource.setMaxActive ( Integer.valueOf ( dataSource.getMaxNum ()) );
|
||||||
|
try {
|
||||||
|
druidSource.init ();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException ( e );
|
||||||
|
}
|
||||||
|
addDataSource ( key,druidSource );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addDataSource(String key, DruidDataSource druidSource) {
|
||||||
|
if (!polls.containsKey ( key )){
|
||||||
|
polls.put ( key,druidSource );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取连接 直接使用数据库连接池对象条用getConnection()方法
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Connection getConnection(String key) {
|
||||||
|
//根据key获取连接池
|
||||||
|
DruidDataSource druidDataSource = polls.get ( key );
|
||||||
|
if (druidDataSource!=null){
|
||||||
|
try {
|
||||||
|
return druidDataSource.getConnection ();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException ( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放连接
|
||||||
|
*/
|
||||||
|
public static void close(Connection connection) {
|
||||||
|
if (connection!=null){
|
||||||
|
try {
|
||||||
|
connection.close ();
|
||||||
|
} catch (SQLException e){
|
||||||
|
log.error ( "释放连接失败" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.etl.data.unit.service.impl;/**
|
||||||
|
* @ClassName A
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YunFei Du
|
||||||
|
* @Date 2024/05/13 15:01
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.etl.data.unit.service.Basic;
|
||||||
|
import com.etl.data.unit.domain.DataModel;
|
||||||
|
import com.etl.data.unit.domain.TreadConstant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*A
|
||||||
|
* 描述
|
||||||
|
* YunFei Du
|
||||||
|
*2024/05/13 15:01
|
||||||
|
*/
|
||||||
|
public class A implements Basic {
|
||||||
|
public void show(){
|
||||||
|
DataModel dataModel = TreadConstant.get();
|
||||||
|
System.out.println(dataModel.getValue());
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void execution() {
|
||||||
|
DataModel dataModel = TreadConstant.get();
|
||||||
|
System.out.println(dataModel.getValue());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.etl.data.unit.service.impl;/**
|
||||||
|
* @ClassName B
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YunFei Du
|
||||||
|
* @Date 2024/05/13 15:01
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.etl.data.unit.service.Basic;
|
||||||
|
import com.etl.data.unit.domain.DataModel;
|
||||||
|
import com.etl.data.unit.domain.TreadConstant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*B
|
||||||
|
* 描述
|
||||||
|
* YunFei Du
|
||||||
|
*2024/05/13 15:01
|
||||||
|
*/
|
||||||
|
public class B implements Basic {
|
||||||
|
public void udp(){
|
||||||
|
DataModel dataModel = TreadConstant.get();
|
||||||
|
dataModel.setValue("李四");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execution() {
|
||||||
|
DataModel dataModel = TreadConstant.get();
|
||||||
|
dataModel.setValue("李四");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.etl.data.unit.service.impl;/**
|
||||||
|
* @ClassName C
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YunFei Du
|
||||||
|
* @Date 2024/05/13 15:01
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.etl.data.unit.service.Basic;
|
||||||
|
import com.etl.data.unit.domain.DataModel;
|
||||||
|
import com.etl.data.unit.domain.TreadConstant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*C
|
||||||
|
* 描述
|
||||||
|
* YunFei Du
|
||||||
|
*2024/05/13 15:01
|
||||||
|
*/
|
||||||
|
public class C implements Basic {
|
||||||
|
public void eq(){
|
||||||
|
DataModel dataModel = TreadConstant.get();
|
||||||
|
if ("张三".equals(dataModel.getValue())){
|
||||||
|
System.out.println("是张三");
|
||||||
|
}else{
|
||||||
|
System.out.println(String.format("不是张三,而是%s",dataModel.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void execution() {
|
||||||
|
DataModel dataModel = TreadConstant.get();
|
||||||
|
if ("张三".equals(dataModel.getValue())){
|
||||||
|
System.out.println("是张三");
|
||||||
|
}else{
|
||||||
|
System.out.println(String.format("不是张三,而是%s",dataModel.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.etl.rule.engine.ClassLoading;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName CustomClassLoader
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YunFei.Du
|
||||||
|
* @Date 2024/5/1 19:37
|
||||||
|
*/
|
||||||
|
public class CustomClassLoader extends ClassLoader {
|
||||||
|
public Class<?> defineClassFromBytes(String name, byte[] data) {
|
||||||
|
return defineClass(name, data, 0, data.length);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.etl.rule.engine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/5/6
|
||||||
|
* @Description: 引擎
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public interface Engine<V> {
|
||||||
|
|
||||||
|
public void execution();
|
||||||
|
|
||||||
|
public V get();
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.etl.rule.engine.constant;
|
||||||
|
|
||||||
|
import com.etl.common.security.utils.SecurityUtils;
|
||||||
|
import com.etl.rule.engine.domain.EngineMaintenance;
|
||||||
|
import com.etl.rule.engine.domain.RuleEngineVersion;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName GenerateConstant
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YunFei.Du
|
||||||
|
* @Date 2024/5/7 19:45
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class GenerateConstant {
|
||||||
|
public static final String DATA_FIELD = "DataModelEngine";
|
||||||
|
public static final String DATA_RECORD = "RecordEngine";
|
||||||
|
public static final String DATA_SET = "DataSetEngine";
|
||||||
|
public static final String ACTION_IMPORT = "import com.etl.rule.engine.action.ActionDiscard;\n";
|
||||||
|
public static final String SCOPE_IMPORT = "import com.etl.rule.engine.scope.";
|
||||||
|
public static final String PACKAGE_PATH = "package com.etl.rule.engine.custom;";
|
||||||
|
|
||||||
|
public static String getClassName(String versionCode){
|
||||||
|
String[] splits = versionCode.split("_");
|
||||||
|
String className="";
|
||||||
|
for (String split : splits) {
|
||||||
|
className += split.substring(0,1).toUpperCase()+split.substring(1);
|
||||||
|
}
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String generateConstant(EngineMaintenance engineMaintenance, RuleEngineVersion engineVersion){
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||||
|
String format = simpleDateFormat.format(new Date());
|
||||||
|
String level = selectType(engineMaintenance.getLevel());
|
||||||
|
return PACKAGE_PATH+"\n\n" +
|
||||||
|
ACTION_IMPORT +
|
||||||
|
SCOPE_IMPORT+level+";\n" +
|
||||||
|
"\n" +
|
||||||
|
"/**\n" +
|
||||||
|
" * @Author: "+ SecurityUtils.getUsername() +"\n" +
|
||||||
|
" * @date: "+format+"\n" +
|
||||||
|
" * @Description: "+engineVersion.getName()+engineVersion.getCode()+"\n" +
|
||||||
|
" * @Version: 1.0\n" +
|
||||||
|
" */\n" +
|
||||||
|
"public class "+getClassName(engineVersion.getVersionCode())+" extends "+level+" {\n" +
|
||||||
|
" @Override\n" +
|
||||||
|
" public void execution () {\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String selectType(String level){
|
||||||
|
String type = "";
|
||||||
|
switch (level) {
|
||||||
|
case "data-field":
|
||||||
|
type = DATA_FIELD;
|
||||||
|
break;
|
||||||
|
case "data-record":
|
||||||
|
type = DATA_RECORD;
|
||||||
|
break;
|
||||||
|
case "data-set":
|
||||||
|
type = DATA_SET;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.etl.rule.engine.constant;
|
||||||
|
|
||||||
|
public class PathConstant {
|
||||||
|
public static final String JAVA_PATH = "D:\\projects\\shixun\\fei-cloud-service\\etl-modules\\etl-rule-engine\\etl-rule-engine-common\\src\\main\\java\\com\\etl\\rule\\engine\\custom\\";
|
||||||
|
public static final String CLASS_PATH = "D:\\projects\\shixun\\fei-cloud-service\\etl-modules\\etl-rule-engine\\etl-rule-engine-common\\target\\classes\\";
|
||||||
|
public static final String PACKAGE_PATH_SERVICE = "com.etl.rule.engine.custom";
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.etl.rule.engine.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 引擎维护
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-05-02
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("engine_maintenance")
|
||||||
|
public class EngineMaintenance extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 规则引擎名称 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 规则引擎类型 */
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 规则引擎激活状态 */
|
||||||
|
private String isActivate;
|
||||||
|
|
||||||
|
/** 规则引擎状态 */
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 规则引擎描述 */
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/** 规则引擎编码 */
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/** 编码*/
|
||||||
|
private String engineCode;
|
||||||
|
|
||||||
|
/** 规则引擎级别 */
|
||||||
|
private String level;
|
||||||
|
|
||||||
|
/** 编辑代码文本 */
|
||||||
|
private String codeText;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.etl.rule.engine.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
|
import com.etl.rule.engine.domain.EngineMaintenance;
|
||||||
|
import com.etl.rule.engine.domain.RuleEngineVersion;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName EngineMaintenanceResq
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YunFei.Du
|
||||||
|
* @Date 2024/5/7 14:42
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class EngineMaintenanceResp extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 规则引擎名称 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 规则引擎类型 */
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 规则引擎激活状态 */
|
||||||
|
private String isActivate;
|
||||||
|
|
||||||
|
/** 规则引擎状态 */
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 规则引擎描述 */
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/** 规则引擎编码 */
|
||||||
|
private String code;
|
||||||
|
/** 编码*/
|
||||||
|
private String engineCode;
|
||||||
|
/** 规则引擎级别 */
|
||||||
|
private String level;
|
||||||
|
|
||||||
|
/** 编辑代码文本 */
|
||||||
|
private String codeText;
|
||||||
|
|
||||||
|
/** 规则版本列表*/
|
||||||
|
private List< RuleEngineVersion > ruleEngineVersionList;
|
||||||
|
|
||||||
|
public static EngineMaintenanceResp engineMaintenanceBuild(EngineMaintenance engineMaintenance, List< RuleEngineVersion > ruleEngineVersionList) {
|
||||||
|
return EngineMaintenanceResp.builder ()
|
||||||
|
.id (engineMaintenance.getId ())
|
||||||
|
.name (engineMaintenance.getName ())
|
||||||
|
.type (engineMaintenance.getType ())
|
||||||
|
.isActivate (engineMaintenance.getIsActivate ())
|
||||||
|
.status (engineMaintenance.getStatus ())
|
||||||
|
.description (engineMaintenance.getDescription ())
|
||||||
|
.code (engineMaintenance.getCode ())
|
||||||
|
.engineCode (engineMaintenance.getEngineCode ())
|
||||||
|
.level (engineMaintenance.getLevel ())
|
||||||
|
.codeText (engineMaintenance.getCodeText ())
|
||||||
|
.ruleEngineVersionList (ruleEngineVersionList)
|
||||||
|
.build ();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.etl.rule.engine.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.etl.rule.engine.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.etl.rule.engine.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/5/5
|
||||||
|
* @Description: 数据标准
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public interface DataStandard {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.etl.rule.engine.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/5/5
|
||||||
|
* @Description: 记录模型
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RecordModel {
|
||||||
|
// [DataModel,DataModel,DataModel]
|
||||||
|
|
||||||
|
private RecordModel(int dataModelLength){
|
||||||
|
this.dataModelArr = new DataModel[dataModelLength];
|
||||||
|
}
|
||||||
|
private RecordModel(DataModel[] dataModelArr){
|
||||||
|
this.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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.etl.rule.engine.scope;
|
||||||
|
|
||||||
|
import com.etl.rule.engine.scope.model.DataProcessModel;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/4/29
|
||||||
|
* @Description: 数据模型
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class DataModelContext implements ScopeContext <DataProcessModel>{
|
||||||
|
|
||||||
|
private static final ThreadLocal<DataProcessModel> THREAD_LOCAL = new ThreadLocal<>();
|
||||||
|
|
||||||
|
private final RecordContext recordContext;
|
||||||
|
|
||||||
|
public DataModelContext (RecordContext recordContext) {
|
||||||
|
this.recordContext = recordContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataProcessModel get () {
|
||||||
|
return THREAD_LOCAL.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set (DataProcessModel dataProcessModel) {
|
||||||
|
THREAD_LOCAL.set(dataProcessModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear(){
|
||||||
|
THREAD_LOCAL.remove();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.etl.rule.engine.scope;
|
||||||
|
|
||||||
|
import com.etl.rule.engine.Engine;
|
||||||
|
import com.etl.rule.engine.model.DataModel;
|
||||||
|
import com.etl.rule.engine.scope.model.DataProcessModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @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,38 @@
|
||||||
|
package com.etl.rule.engine.scope;
|
||||||
|
|
||||||
|
import com.etl.rule.engine.scope.model.DataSetProcessModel;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/4/29
|
||||||
|
* @Description: 数据集
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class DataSetContext implements ScopeContext <DataSetProcessModel>{
|
||||||
|
|
||||||
|
private static final ThreadLocal<DataSetProcessModel> THREAD_LOCAL = new ThreadLocal<>();
|
||||||
|
|
||||||
|
private final TaskContext taskContext;
|
||||||
|
|
||||||
|
public DataSetContext (TaskContext taskContext) {
|
||||||
|
this.taskContext = taskContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSetProcessModel get() {
|
||||||
|
return THREAD_LOCAL.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
THREAD_LOCAL.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(DataSetProcessModel dataSetProcessModel) {
|
||||||
|
THREAD_LOCAL.set(dataSetProcessModel);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.etl.rule.engine.scope;
|
||||||
|
|
||||||
|
import com.etl.rule.engine.Engine;
|
||||||
|
import com.etl.rule.engine.model.DataSetModel;
|
||||||
|
import com.etl.rule.engine.scope.model.DataSetProcessModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/5/6
|
||||||
|
* @Description: 数据模型引擎接口
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public abstract class DataSetEngine implements Engine<DataSetProcessModel> {
|
||||||
|
private DataSetContext dataSetContext;
|
||||||
|
@Override
|
||||||
|
public DataSetProcessModel get() {
|
||||||
|
return dataSetContext.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataSetModel getDataSetModel() {
|
||||||
|
return get().getDataSetModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataSetContext getDataSetContext() {
|
||||||
|
return dataSetContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataSetContext(DataSetContext dataSetContext) {
|
||||||
|
this.dataSetContext = dataSetContext;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.etl.rule.engine.scope;
|
||||||
|
|
||||||
|
import com.etl.rule.engine.scope.model.RecordProcessModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/4/29
|
||||||
|
* @Description: 记录/资产模型
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class RecordContext implements ScopeContext<RecordProcessModel>{
|
||||||
|
|
||||||
|
private static final ThreadLocal<RecordProcessModel> THREAD_LOCAL = new ThreadLocal<>();
|
||||||
|
|
||||||
|
private final DataSetContext dataSetContext;
|
||||||
|
|
||||||
|
private RecordContext (DataSetContext dataSetContext) {
|
||||||
|
this.dataSetContext = dataSetContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecordProcessModel get() {
|
||||||
|
return THREAD_LOCAL.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
THREAD_LOCAL.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(RecordProcessModel recordProcessModel) {
|
||||||
|
THREAD_LOCAL.set(recordProcessModel);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.etl.rule.engine.scope;
|
||||||
|
|
||||||
|
import com.etl.rule.engine.Engine;
|
||||||
|
import com.etl.rule.engine.scope.model.RecordProcessModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/5/6
|
||||||
|
* @Description: 数据模型引擎接口
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public abstract class RecordEngine implements Engine<RecordProcessModel> {
|
||||||
|
private RecordContext recordContext;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecordProcessModel get() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.etl.rule.engine.scope;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/5/6
|
||||||
|
* @Description: 数据域规范
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public interface ScopeContext<V> {
|
||||||
|
|
||||||
|
V get();
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
void set(V v);
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.etl.rule.engine.scope;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/4/29
|
||||||
|
* @Description: 任务上下文
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class TaskContext {
|
||||||
|
|
||||||
|
public static TaskContext build(){
|
||||||
|
return new TaskContext();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.etl.rule.engine.scope.model;
|
||||||
|
|
||||||
|
import com.etl.rule.engine.model.DataModel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/5/5
|
||||||
|
* @Description: 数据处理模型
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DataProcessModel {
|
||||||
|
|
||||||
|
private DataModel dataModel;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.etl.rule.engine.scope.model;
|
||||||
|
|
||||||
|
import com.etl.rule.engine.model.DataSetModel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/5/5
|
||||||
|
* @Description: 数据集处理模型
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DataSetProcessModel {
|
||||||
|
|
||||||
|
private DataSetModel dataSetModel;
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.etl.rule.engine.scope.model;
|
||||||
|
|
||||||
|
import com.etl.rule.engine.model.RecordModel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: YunFei.Du
|
||||||
|
* @date: 2024/5/5
|
||||||
|
* @Description: 行级别任务处理模型
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RecordProcessModel {
|
||||||
|
|
||||||
|
private String[] keys;
|
||||||
|
|
||||||
|
private RecordModel recordModel;
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.etl;
|
package com.etl.rule.engine;
|
||||||
|
|
||||||
import com.etl.common.security.annotation.EnableCustomConfig;
|
import com.etl.common.security.annotation.EnableCustomConfig;
|
||||||
import com.etl.common.security.annotation.EnableMyFeignClients;
|
import com.etl.common.security.annotation.EnableMyFeignClients;
|
|
@ -6,7 +6,9 @@ import com.etl.common.core.web.controller.BaseController;
|
||||||
import com.etl.common.core.web.page.TableDataInfo;
|
import com.etl.common.core.web.page.TableDataInfo;
|
||||||
import com.etl.common.log.annotation.Log;
|
import com.etl.common.log.annotation.Log;
|
||||||
import com.etl.common.log.enums.BusinessType;
|
import com.etl.common.log.enums.BusinessType;
|
||||||
|
|
||||||
import com.etl.rule.engine.domain.EngineMaintenance;
|
import com.etl.rule.engine.domain.EngineMaintenance;
|
||||||
|
import com.etl.rule.engine.domain.resp.EngineMaintenanceResp;
|
||||||
import com.etl.rule.engine.service.IEngineMaintenanceService;
|
import com.etl.rule.engine.service.IEngineMaintenanceService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -15,10 +17,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Controller
|
* 引擎维护 控制层
|
||||||
*
|
* @author YunFei.Du
|
||||||
* @author ruoyi
|
* @date 20:20 2024/5/6
|
||||||
* @date 2024-05-02
|
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/maintenance")
|
@RequestMapping("/maintenance")
|
||||||
|
@ -28,30 +29,46 @@ public class EngineMaintenanceController extends BaseController
|
||||||
private IEngineMaintenanceService engineMaintenanceService;
|
private IEngineMaintenanceService engineMaintenanceService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】列表
|
* 引擎状态改变
|
||||||
|
* @param engineMaintenance
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("ActivateEngine")
|
||||||
|
public Result activateEngine(@RequestBody EngineMaintenance engineMaintenance )
|
||||||
|
{
|
||||||
|
return engineMaintenanceService.activateEngine(engineMaintenance);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询引擎维护 列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<TableDataInfo<EngineMaintenance>> list(EngineMaintenance engineMaintenance)
|
public Result<TableDataInfo< EngineMaintenanceResp >> list(EngineMaintenance engineMaintenance)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<EngineMaintenance> list = engineMaintenanceService.selectEngineMaintenanceList(engineMaintenance);
|
List<EngineMaintenanceResp> list = engineMaintenanceService.selectEngineMaintenanceList(engineMaintenance);
|
||||||
return getDataAsset ( list );
|
return getDataAsset ( list );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 导出【请填写功能名称】列表
|
// * 导出引擎维护 列表
|
||||||
*/
|
// */
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
// @Log(title = "引擎维护 ", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
// @PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, EngineMaintenance engineMaintenance)
|
// public void export(HttpServletResponse response, EngineMaintenance engineMaintenance)
|
||||||
{
|
// {
|
||||||
List<EngineMaintenance> list = engineMaintenanceService.selectEngineMaintenanceList(engineMaintenance);
|
// List<EngineMaintenanceResp> list = engineMaintenanceService.selectEngineMaintenanceList(engineMaintenance);
|
||||||
ExcelUtil<EngineMaintenance> util = new ExcelUtil<EngineMaintenance>(EngineMaintenance.class);
|
// ExcelUtil<EngineMaintenance> util = new ExcelUtil<EngineMaintenance>(EngineMaintenance.class);
|
||||||
util.exportExcel(response, list, "【请填写功能名称】数据");
|
// util.exportExcel(response, list, "引擎维护 数据");
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取【请填写功能名称】详细信息
|
* 获取引擎维护 详细信息
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public Result getInfo(@PathVariable("id") Long id)
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
@ -71,9 +88,9 @@ public class EngineMaintenanceController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增【请填写功能名称】
|
* 新增引擎维护
|
||||||
*/
|
*/
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
@Log(title = "引擎维护 ", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result add(@RequestBody EngineMaintenance engineMaintenance)
|
public Result add(@RequestBody EngineMaintenance engineMaintenance)
|
||||||
{
|
{
|
||||||
|
@ -90,22 +107,25 @@ public class EngineMaintenanceController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改【请填写功能名称】
|
* 修改引擎维护
|
||||||
*/
|
*/
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
@Log(title = "引擎维护 ", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public Result edit(@RequestBody EngineMaintenance engineMaintenance)
|
public Result edit(@RequestBody EngineMaintenance engineMaintenance)
|
||||||
{
|
{
|
||||||
return toAjax(engineMaintenanceService.updateEngineMaintenance(engineMaintenance));
|
return engineMaintenanceService.updateEngineMaintenance(engineMaintenance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除【请填写功能名称】
|
* 删除引擎维护
|
||||||
*/
|
*/
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
@Log(title = "引擎维护 ", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public Result remove(@PathVariable Long[] ids)
|
public Result remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
return toAjax(engineMaintenanceService.deleteEngineMaintenanceByIds(ids));
|
return toAjax(engineMaintenanceService.deleteEngineMaintenanceByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("version")
|
@RequestMapping("version")
|
||||||
public class RuleEngineVersionController {
|
public class RuleEngineVersionController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRuleEngineVersionService ruleEngineVersionService;
|
private IRuleEngineVersionService ruleEngineVersionService;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.etl.rule.engine.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.etl.rule.engine.domain.EngineMaintenance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName EngineMaintenanceMapper
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YunFei.Du
|
||||||
|
* @Date 2024/5/6 20:51
|
||||||
|
*/
|
||||||
|
public interface EngineMaintenanceMapper extends BaseMapper< EngineMaintenance > {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.etl.rule.engine.scope;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName DataModelEngine
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YunFei.Du
|
||||||
|
* @Date 2024/5/14 18:36
|
||||||
|
*/
|
||||||
|
public class DataModelEngine {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.etl.rule.engine.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.common.core.domain.Result;
|
||||||
|
import com.etl.rule.engine.domain.EngineMaintenance;
|
||||||
|
import com.etl.rule.engine.domain.resp.EngineMaintenanceResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 引擎维护 Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-05-02
|
||||||
|
*/
|
||||||
|
public interface IEngineMaintenanceService extends IService< EngineMaintenance>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询引擎维护
|
||||||
|
*
|
||||||
|
* @param id 引擎维护 主键
|
||||||
|
* @return 引擎维护
|
||||||
|
*/
|
||||||
|
public EngineMaintenanceResp selectEngineMaintenanceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询引擎维护 列表
|
||||||
|
*
|
||||||
|
* @param engineMaintenance 引擎维护
|
||||||
|
* @return 引擎维护 集合
|
||||||
|
*/
|
||||||
|
public List< EngineMaintenanceResp > selectEngineMaintenanceList(EngineMaintenance engineMaintenance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增引擎维护
|
||||||
|
*
|
||||||
|
* @param engineMaintenance 引擎维护
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertEngineMaintenance(EngineMaintenance engineMaintenance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改引擎维护
|
||||||
|
*
|
||||||
|
* @param engineMaintenance 引擎维护
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public Result updateEngineMaintenance(EngineMaintenance engineMaintenance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除引擎维护
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的引擎维护 主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEngineMaintenanceByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除引擎维护 信息
|
||||||
|
*
|
||||||
|
* @param id 引擎维护 主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEngineMaintenanceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化规则引擎类
|
||||||
|
*/
|
||||||
|
Result initializeRuleEngine(EngineMaintenance engineMaintenance);
|
||||||
|
|
||||||
|
Result testMethod(String code);
|
||||||
|
|
||||||
|
|
||||||
|
Result activateEngine(EngineMaintenance engineMaintenance);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.etl.rule.engine.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.rule.engine.domain.RuleEngineVersion;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName RuleEngineVersionService
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YunFei.Du
|
||||||
|
* @Date 2024/5/6 20:55
|
||||||
|
*/
|
||||||
|
public interface IRuleEngineVersionService extends IService< RuleEngineVersion > {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,13 +1,21 @@
|
||||||
package com.etl.rule.engine.service.impl;
|
package com.etl.rule.engine.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.etl.common.core.domain.Result;
|
import com.etl.common.core.domain.Result;
|
||||||
import com.etl.common.core.utils.DateUtils;
|
import com.etl.common.core.utils.DateUtils;
|
||||||
import com.etl.common.security.utils.SecurityUtils;
|
import com.etl.common.security.utils.SecurityUtils;
|
||||||
import com.etl.rule.engine.ClassLoading.CustomClassLoader;
|
import com.etl.rule.engine.ClassLoading.CustomClassLoader;
|
||||||
import com.etl.rule.engine.domain.EngineMaintenance;
|
import com.etl.rule.engine.domain.EngineMaintenance;
|
||||||
|
import com.etl.rule.engine.domain.RuleEngineVersion;
|
||||||
|
import com.etl.rule.engine.domain.resp.EngineMaintenanceResp;
|
||||||
import com.etl.rule.engine.mapper.EngineMaintenanceMapper;
|
import com.etl.rule.engine.mapper.EngineMaintenanceMapper;
|
||||||
import com.etl.rule.engine.service.IEngineMaintenanceService;
|
import com.etl.rule.engine.service.IEngineMaintenanceService;
|
||||||
|
import com.etl.rule.engine.service.IRuleEngineVersionService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -19,50 +27,58 @@ import java.io.FileWriter;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Service业务层处理
|
* 引擎维护 Service业务层处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
* @date 2024-05-02
|
* @date 2024-05-02
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class EngineMaintenanceServiceImpl implements IEngineMaintenanceService
|
public class EngineMaintenanceServiceImpl extends ServiceImpl<EngineMaintenanceMapper, EngineMaintenance> implements IEngineMaintenanceService {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EngineMaintenanceMapper engineMaintenanceMapper;
|
private IRuleEngineVersionService ruleEngineVersionService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询引擎维护
|
||||||
*
|
*
|
||||||
* @param id 【请填写功能名称】主键
|
* @param id 引擎维护 主键
|
||||||
* @return 【请填写功能名称】
|
* @return 引擎维护
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public EngineMaintenance selectEngineMaintenanceById(Long id)
|
public EngineMaintenanceResp selectEngineMaintenanceById(Long id) {
|
||||||
{
|
EngineMaintenance engineMaintenance = this.getById ( id );
|
||||||
return engineMaintenanceMapper.selectEngineMaintenanceById(id);
|
List< RuleEngineVersion > engineVersions = ruleEngineVersionService.list ( new LambdaQueryWrapper< RuleEngineVersion > ( ).in ( RuleEngineVersion::getEngineMaintenanceId, engineMaintenance.getId ( ) ) );
|
||||||
|
return EngineMaintenanceResp.engineMaintenanceBuild ( engineMaintenance, engineVersions );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】列表
|
* 查询引擎维护 列表
|
||||||
*
|
*
|
||||||
* @param engineMaintenance 【请填写功能名称】
|
* @param engineMaintenance 引擎维护
|
||||||
* @return 【请填写功能名称】
|
* @return 引擎维护
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<EngineMaintenance> selectEngineMaintenanceList(EngineMaintenance engineMaintenance)
|
public List< EngineMaintenanceResp > selectEngineMaintenanceList(EngineMaintenance engineMaintenance) {
|
||||||
{
|
ArrayList< EngineMaintenanceResp > engineMaintenanceList = new ArrayList<> ( );
|
||||||
return engineMaintenanceMapper.selectEngineMaintenanceList(engineMaintenance);
|
List< EngineMaintenance > list = this.list ( );
|
||||||
|
for (EngineMaintenance maintenance : list) {
|
||||||
|
List< RuleEngineVersion > engineVersions = ruleEngineVersionService.list ( new LambdaQueryWrapper< RuleEngineVersion > ( ).in ( RuleEngineVersion::getEngineMaintenanceId, maintenance.getId ( ) ) );
|
||||||
|
EngineMaintenanceResp engineMaintenanceResp1 = EngineMaintenanceResp.engineMaintenanceBuild ( maintenance, engineVersions );
|
||||||
|
engineMaintenanceList.add ( engineMaintenanceResp1 );
|
||||||
|
}
|
||||||
|
return engineMaintenanceList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增【请填写功能名称】
|
* 新增引擎维护
|
||||||
*
|
*
|
||||||
* @param engineMaintenance 【请填写功能名称】
|
* @param engineMaintenance 引擎维护
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -74,46 +90,65 @@ public class EngineMaintenanceServiceImpl implements IEngineMaintenanceService
|
||||||
engineMaintenance.setCodeText("package com.etl.rule.engine.domain;\n\n\n"+
|
engineMaintenance.setCodeText("package com.etl.rule.engine.domain;\n\n\n"+
|
||||||
"public class " + className + " {\n" +
|
"public class " + className + " {\n" +
|
||||||
"}");
|
"}");
|
||||||
return engineMaintenanceMapper.insertEngineMaintenance(engineMaintenance);
|
boolean save = this.save ( engineMaintenance );
|
||||||
|
if (save){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改【请填写功能名称】
|
* 修改引擎维护
|
||||||
* @param engineMaintenance 【请填写功能名称】
|
* @param engineMaintenance 引擎维护
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateEngineMaintenance(EngineMaintenance engineMaintenance)
|
public Result updateEngineMaintenance(EngineMaintenance engineMaintenance) {
|
||||||
{
|
boolean update = this.update ( new LambdaUpdateWrapper< EngineMaintenance > ( )
|
||||||
engineMaintenance.setUpdateTime(DateUtils.getNowDate());
|
.set ( EngineMaintenance::getIsActivate, engineMaintenance.getIsActivate () )
|
||||||
engineMaintenance.setUpdateBy(SecurityUtils.getUsername());
|
.set ( EngineMaintenance::getStatus, engineMaintenance.getStatus () )
|
||||||
return engineMaintenanceMapper.updateEngineMaintenance(engineMaintenance);
|
.set ( EngineMaintenance::getUpdateTime, DateUtils.getNowDate ( ) )
|
||||||
|
.set ( EngineMaintenance::getUpdateBy, SecurityUtils.getUsername ( ) )
|
||||||
|
.eq ( EngineMaintenance::getId, engineMaintenance.getId ( )));
|
||||||
|
|
||||||
|
if (update?true:false){
|
||||||
|
return Result.success ();
|
||||||
|
}else {
|
||||||
|
return Result.error ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除【请填写功能名称】
|
* 批量删除引擎维护
|
||||||
*
|
*
|
||||||
* @param ids 需要删除的【请填写功能名称】主键
|
* @param ids 需要删除的引擎维护 主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteEngineMaintenanceByIds(Long[] ids)
|
public int deleteEngineMaintenanceByIds(Long[] ids) {
|
||||||
{
|
boolean b = this.removeBatchByIds ( Arrays.asList ( ids ) );
|
||||||
return engineMaintenanceMapper.deleteEngineMaintenanceByIds(ids);
|
if (b){
|
||||||
|
return 1;
|
||||||
|
}else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除【请填写功能名称】信息
|
* 删除引擎维护 信息
|
||||||
*
|
*
|
||||||
* @param id 【请填写功能名称】主键
|
* @param id 引擎维护 主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteEngineMaintenanceById(Long id)
|
public int deleteEngineMaintenanceById(Long id) {
|
||||||
{
|
boolean b = this.removeById ( id );
|
||||||
return engineMaintenanceMapper.deleteEngineMaintenanceById(id);
|
if (b){
|
||||||
|
return 1;
|
||||||
|
}else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result initializeRuleEngine(EngineMaintenance engineMaintenance) {
|
public Result initializeRuleEngine(EngineMaintenance engineMaintenance) {
|
||||||
try {
|
try {
|
||||||
|
@ -195,4 +230,9 @@ public class EngineMaintenanceServiceImpl implements IEngineMaintenanceService
|
||||||
}
|
}
|
||||||
return Result.success("测试成功");
|
return Result.success("测试成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result activateEngine(EngineMaintenance engineMaintenance) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -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/etl-system"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<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.etl" 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>
|
|
@ -15,6 +15,7 @@
|
||||||
<module>etl-file</module>
|
<module>etl-file</module>
|
||||||
<module>etl-data-source</module>
|
<module>etl-data-source</module>
|
||||||
<module>etl-rule-engine</module>
|
<module>etl-rule-engine</module>
|
||||||
|
<module>etl-data-unit</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>etl-modules</artifactId>
|
<artifactId>etl-modules</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue