feat():分离客户端
parent
8ec267ac4b
commit
0f399010c9
|
@ -0,0 +1,30 @@
|
|||
<?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-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-common-cache</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>
|
||||
<!-- MuYu Common Security -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.cache.redis;
|
||||
|
||||
/**
|
||||
* @ClassName RedisCache
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/5/10 19:01
|
||||
*/
|
||||
public interface RedisCache<K,V,T> {
|
||||
K getKey(T t);
|
||||
|
||||
V get(K key);
|
||||
|
||||
void put(K k ,V v);
|
||||
|
||||
void remove(K k);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -17,9 +17,13 @@ public class ServiceNameConstants {
|
|||
public static final String SYSTEM_SERVICE = "muyu-system";
|
||||
|
||||
/**
|
||||
* 系统模块的serviceid
|
||||
* 规则引擎模块的serviceid
|
||||
*/
|
||||
public static final String ENGINE_SERVICE = "muyu-engine";
|
||||
/**
|
||||
* etl模块的serviceid
|
||||
*/
|
||||
public static final String ETL_SERVICE = "muyu-etl";
|
||||
|
||||
/**
|
||||
* 文件服务的serviceid
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<module>muyu-common-datascope</module>
|
||||
<module>muyu-common-datasource</module>
|
||||
<module>muyu-common-system</module>
|
||||
<module>muyu-common-cache</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-common</artifactId>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.etl;
|
||||
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.uitl.DruidUtilsFactory;
|
||||
import com.muyu.etl.uitl.service.ConnectionPoolFactory;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName AssetClientRunner
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/5/9 21:26
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
public class AssetClientRunner implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
private RemoteAssetService remoteAssetService;
|
||||
@Autowired
|
||||
private ConnectionPoolFactory connectionPoolFactory;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws ServletException {
|
||||
Result<TableDataInfo<BasicConfigInfo>> result = remoteAssetService.list(new BasicConfigInfo(), SecurityConstants.INNER);
|
||||
log.info("初始话内容为{}",result);
|
||||
if (result.getData().getRows().isEmpty()) throw new ServletException("初始化调用失败,无数据");
|
||||
result.getData().getRows().stream().map(basicConfigInfo -> {
|
||||
DruidPooledConnection init = null;
|
||||
try {
|
||||
init = connectionPoolFactory.init(basicConfigInfo);
|
||||
log.info("初始化结果:{}",init);
|
||||
} catch (SQLException e) {
|
||||
log.error("初始化异常:{}",e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return init;
|
||||
});
|
||||
log.info("初始化完成");
|
||||
log.info("连接池::{}",DruidUtilsFactory.map);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package com.muyu.etl;
|
||||
|
||||
import com.etl.RemoteAssetService;
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName EtlRunner
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/5/9 21:26
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
public class EtlRunner implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
private RemoteAssetService remoteAssetService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
List<BasicConfigInfo> rows = remoteAssetService.list(null, SecurityConstants.INNER).getData().getRows();
|
||||
log.info(rows);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.muyu.etl.config;
|
||||
|
||||
import com.muyu.etl.EtlRunner;
|
||||
import com.muyu.etl.AssetClientRunner;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
|
|||
* @Date 2024/5/9 21:45
|
||||
*/
|
||||
@Component
|
||||
@Import(value = {EtlRunner.class})
|
||||
@Import(value = {AssetClientRunner.class})
|
||||
public class AssetClientConfig {
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package com.muyu.etl.uitl;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
import com.muyu.etl.uitl.service.ConnectionPoolFactory;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class DruidUtilsFactory implements ConnectionPoolFactory<BasicConfigInfo> {
|
||||
// 连接池容器
|
||||
public static HashMap<String, DruidPooledConnection> map = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 初始化连接池
|
||||
* @param basicConfigInfo
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
@Override
|
||||
public DruidPooledConnection init(BasicConfigInfo basicConfigInfo) throws SQLException {
|
||||
// 连接池对象
|
||||
DruidDataSource source = new DruidDataSource();
|
||||
// 定义下面需要的对象
|
||||
String host = basicConfigInfo.getHost();
|
||||
String port = basicConfigInfo.getPort();
|
||||
String databaseName = basicConfigInfo.getDatabaseName();
|
||||
String databaseType = basicConfigInfo.getDatabaseType();
|
||||
// 引擎配置
|
||||
source.setUrl("jdbc:" + databaseType + "://" + host + ":" + port + "/" + databaseName + "?" + basicConfigInfo.getConnectionParams());
|
||||
source.setUsername(basicConfigInfo.getUsername());
|
||||
source.setPassword(basicConfigInfo.getPassword());
|
||||
source.setInitialSize(Math.toIntExact(basicConfigInfo.getInitLinkNum()));
|
||||
source.setMaxActive(Math.toIntExact(basicConfigInfo.getMaxLinkNum()));
|
||||
source.setMaxWaitThreadCount(Math.toIntExact(basicConfigInfo.getMaxWaitTimes()));
|
||||
source.setMaxEvictableIdleTimeMillis(basicConfigInfo.getMaxWaitTime());
|
||||
DruidPooledConnection pool = source.getConnection();
|
||||
map.put(host + ":" + port + "/" + databaseName, pool);
|
||||
// 获取并返回连接池对象
|
||||
return pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据接入取出一个连接对象
|
||||
* @param basicConfigInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Connection getConnection(BasicConfigInfo basicConfigInfo) {
|
||||
String host = basicConfigInfo.getHost();
|
||||
String port = basicConfigInfo.getPort();
|
||||
String databaseName = basicConfigInfo.getDatabaseName();
|
||||
DruidPooledConnection druidPooledConnection = map.get(host + ":" + port + "/" + databaseName);
|
||||
Connection connection = druidPooledConnection.getConnection();
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将连接对象放回连接池
|
||||
* @param basicConfigInfo
|
||||
* @param connection
|
||||
*/
|
||||
@Override
|
||||
public void giveBack(BasicConfigInfo basicConfigInfo, Connection connection) throws SQLException {
|
||||
String host = basicConfigInfo.getHost();
|
||||
String port = basicConfigInfo.getPort();
|
||||
String databaseName = basicConfigInfo.getDatabaseName();
|
||||
DruidPooledConnection druidPooledConnection = map.get(host + ":" + port + "/" + databaseName);
|
||||
druidPooledConnection.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package com.muyu.etl.uitl;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.sql.*;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* JdbcUtils 工具类
|
||||
* @author : Saisai.Liu
|
||||
* @version : 21.0
|
||||
*/
|
||||
public class JDBCUtils {
|
||||
private static String driver; //Driver驱动
|
||||
private static String url; //Uniform Resource Locator,包含数据库信息
|
||||
private static String user; //用户名
|
||||
private static String password; //用户密码
|
||||
|
||||
static {
|
||||
Properties properties = new Properties();
|
||||
try {
|
||||
//Class.forName(driver);
|
||||
|
||||
properties.load(new FileInputStream("src/api/connection/mysql.properties"));
|
||||
driver = properties.getProperty("driver");
|
||||
url = properties.getProperty("url");
|
||||
user = properties.getProperty("user");
|
||||
password = properties.getProperty("password");
|
||||
} catch (IOException e) {
|
||||
/*
|
||||
实际开发中,往往将捕获到的编译期异常转换为一个运行期异常抛出去;
|
||||
这时对于调用者来说,
|
||||
既可以选择捕获该异常,进行进一步的业务处理,也可以选择默认处理该异常,比较方便。
|
||||
*/
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
//获取连接
|
||||
public static Connection getConnection() {
|
||||
try {
|
||||
return DriverManager.getConnection(url, user, password);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
//释放资源
|
||||
/**
|
||||
* @param resultSet : 结果集(DQL产生)
|
||||
* @param statement : Statement接口或PreparedStatement接口的实现类
|
||||
* @param connection : 即通过getConnection方法获取到的连接
|
||||
*/
|
||||
public static void close(ResultSet resultSet, Statement statement, Connection connection) {
|
||||
/*
|
||||
DML的执行不产生ResultSet结果集,可以传入一个null;
|
||||
因此要先判断传入的对象是否为空,若非空则调用close方法关闭资源(动态绑定)
|
||||
*/
|
||||
try {
|
||||
if (resultSet != null) {
|
||||
resultSet.close();
|
||||
}
|
||||
if (statement != null) {
|
||||
statement.close();
|
||||
}
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.etl.uitl.service;
|
||||
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* @ClassName PoolFactory
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/5/10 16:28
|
||||
*/
|
||||
public interface ConnectionPoolFactory<T> {
|
||||
/**
|
||||
* 根据所给信息构造连接池并存入大池
|
||||
* @param t
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
public DruidPooledConnection init(T t) throws SQLException;
|
||||
|
||||
public Connection getConnection(T t);
|
||||
|
||||
public void giveBack(T t, Connection connection) throws SQLException;
|
||||
|
||||
}
|
|
@ -1 +1,2 @@
|
|||
com.etl.factory.RemoteRuleEngineFallbackFactory
|
||||
com.muyu.etl.AssetClientRunner
|
||||
com.muyu.etl.uitl.DruidUtilsFactory
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9215
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-etl-client
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.etl.mapper: DEBUG
|
||||
com.example.springmvctest.feign.api: DEBUG
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.etl.domain.pool;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import javax.sql.PooledConnection;
|
||||
|
||||
/**
|
||||
* @ClassName BeanPool
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/5/10 15:19
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BeanPool {
|
||||
private String key;
|
||||
private PooledConnection druidPooledConnection;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package com.etl;
|
||||
|
||||
import com.etl.factory.RemoteAssetFallbackFactory;
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
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.etl.domain.BasicConfigInfo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
/**
|
||||
* 用户服务
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@FeignClient(contextId = "remoteRuleEngineService", value = ServiceNameConstants.ENGINE_SERVICE, fallbackFactory = RemoteAssetFallbackFactory.class)
|
||||
public interface RemoteAssetService {
|
||||
/**
|
||||
* 通过用户名查询用户信息
|
||||
*
|
||||
* @param basicConfigInfo 用户名
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<BasicConfigInfo>> list(BasicConfigInfo basicConfigInfo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.etl;
|
||||
|
||||
import feign.Logger;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class FeignConfig {
|
||||
/**
|
||||
* feignClient 配置日志级别
|
||||
*/
|
||||
@Bean
|
||||
public Logger.Level feignLoggerLevel() {
|
||||
// 请求和响应的头信息,请求和响应的正文及元数据
|
||||
return Logger.Level.FULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.etl;
|
||||
|
||||
import com.muyu.etl.factory.RemoteAssetFallbackFactory;
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
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.etl.domain.BasicConfigInfo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
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.RequestHeader;
|
||||
|
||||
/**
|
||||
* 用户服务
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@FeignClient(contextId = "remoteAssetService",
|
||||
value = ServiceNameConstants.ETL_SERVICE,
|
||||
fallbackFactory = RemoteAssetFallbackFactory.class)
|
||||
public interface RemoteAssetService {
|
||||
/**
|
||||
* 获取所有接入信息信息
|
||||
*
|
||||
* @param basicConfigInfo 请求参数
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/info/list")
|
||||
public Result<TableDataInfo<BasicConfigInfo>> list(@RequestBody BasicConfigInfo basicConfigInfo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.etl.factory;
|
||||
package com.muyu.etl.factory;
|
||||
|
||||
import com.etl.RemoteAssetService;
|
||||
import com.muyu.etl.RemoteAssetService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.etl.domain.BasicConfigInfo;
|
||||
|
@ -25,7 +25,7 @@ public class RemoteAssetFallbackFactory implements FallbackFactory<RemoteAssetSe
|
|||
|
||||
@Override
|
||||
public Result<TableDataInfo<BasicConfigInfo>> list(BasicConfigInfo basicConfigInfo, String source) {
|
||||
return Result.error("查询接入信息失败");
|
||||
return Result.error("查询接入信息失败,"+throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1 +1 @@
|
|||
com.etl.factory.RemoteRuleEngineFallbackFactory
|
||||
com.muyu.etl.factory.RemoteAssetFallbackFactory
|
||||
|
|
|
@ -89,6 +89,11 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.2.8</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -43,8 +43,8 @@ public class BasicConfigInfoController extends BaseController {
|
|||
/**
|
||||
* 查询基础信息列表
|
||||
*/
|
||||
@RequiresPermissions("etl:info:list")
|
||||
@GetMapping("/list")
|
||||
// @RequiresPermissions("etl:info:list")
|
||||
@PostMapping("/list")
|
||||
public Result<TableDataInfo<BasicConfigInfo>> list(BasicConfigInfo basicConfigInfo) {
|
||||
startPage();
|
||||
List<BasicConfigInfo> list = basicConfigInfoService.selectBasicConfigInfoList(basicConfigInfo);
|
||||
|
|
|
@ -171,10 +171,10 @@ public class VelocityUtils {
|
|||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
|
||||
} else if (template.contains("mapper.java.vm")) {
|
||||
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
||||
} else if (template.contains("service.java.vm")) {
|
||||
fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className);
|
||||
} else if (template.contains("redis.java.vm")) {
|
||||
fileName = StringUtils.format("{}/redis/I{}Service.java", javaPath, className);
|
||||
} else if (template.contains("serviceImpl.java.vm")) {
|
||||
fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
|
||||
fileName = StringUtils.format("{}/redis/impl/{}ServiceImpl.java", javaPath, className);
|
||||
} else if (template.contains("controller.java.vm")) {
|
||||
fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className);
|
||||
} else if (template.contains("mapper.xml.vm")) {
|
||||
|
|
|
@ -129,7 +129,7 @@ public class RuleEngineVersionServiceImpl extends ServiceImpl<RuleEngineVersionM
|
|||
fileName = fileName.substring(0, fileName.indexOf("implements")).trim();
|
||||
}
|
||||
//代码编译
|
||||
File file = new File("D:/ruoyi/FinallyTest/muyu-modules/muyu-ruleEngine/muyu-ruleEngine-service/src/main/java/" + path + "/" + fileName + ".java");
|
||||
File file = new File("D:/ruoyi/FinallyTest/muyu-modules/muyu-ruleEngine/muyu-ruleEngine-redis/src/main/java/" + path + "/" + fileName + ".java");
|
||||
if (!file.exists()) {
|
||||
//不存在创建
|
||||
file.createNewFile();
|
||||
|
@ -176,8 +176,8 @@ public class RuleEngineVersionServiceImpl extends ServiceImpl<RuleEngineVersionM
|
|||
String fileName = codeIng.substring(codeIng.indexOf("class") + 6, codeIng.indexOf("{")).trim();
|
||||
String name = path + "." + fileName;
|
||||
String javaPackageName = name.replace(".", File.separator) + ".java";
|
||||
String javaAbsolutePath = "D:/ruoyi/FinallyTest/muyu-modules/muyu-ruleEngine/muyu-ruleEngine-service/src/main/java/" + javaPackageName;
|
||||
String jarAbsolutePath = "D:/ruoyi/FinallyTest/muyu-modules/muyu-ruleEngine/muyu-ruleEngine-service/target/classes/com/muyu/engine/domain/test";
|
||||
String javaAbsolutePath = "D:/ruoyi/FinallyTest/muyu-modules/muyu-ruleEngine/muyu-ruleEngine-redis/src/main/java/" + javaPackageName;
|
||||
String jarAbsolutePath = "D:/ruoyi/FinallyTest/muyu-modules/muyu-ruleEngine/muyu-ruleEngine-redis/target/classes/com/muyu/engine/domain/test";
|
||||
Process process = Runtime.getRuntime().exec("javac -classpath " + jarAbsolutePath + " " + javaAbsolutePath);
|
||||
try {
|
||||
int exitVal = process.waitFor();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
//import com.muyu.common.log.enums.BusinessType;
|
||||
//import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
//import com.muyu.system.domain.AsNoticeUser;
|
||||
//import com.muyu.system.service.AsNoticeUserService;
|
||||
//import com.muyu.system.redis.AsNoticeUserService;
|
||||
//import com.muyu.common.core.web.controller.BaseController;
|
||||
//import com.muyu.common.core.domain.Result;
|
||||
//import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
|
|
Loading…
Reference in New Issue