feat():规则版本展示
parent
28f98b4e9c
commit
e9501ad6fc
|
@ -29,5 +29,5 @@ public class ServiceNameConstants {
|
|||
/**
|
||||
* 数据接入服务的serviceid
|
||||
*/
|
||||
public static final String DATA_ACCESS_SERVICE = "muyu-etl";
|
||||
public static final String DATA_ACCESS_SERVICE = "muyu-data-access";
|
||||
}
|
||||
|
|
|
@ -42,4 +42,5 @@ public class DataAccessClientRunner implements ApplicationRunner {
|
|||
MyDataSource.addBack(con);
|
||||
MyDataSource.size(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,12 +18,13 @@ import java.util.logging.Logger;
|
|||
/**
|
||||
* @ClassName MyDataSource
|
||||
* @Description 数据库连接池管理
|
||||
* @Author Xin.Yao
|
||||
* @Author Peng.Jiang
|
||||
* @Date 2024/5/9 19:36
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
public class MyDataSource {
|
||||
|
||||
private static HashMap<String, DruidDataSource> pools = new HashMap<>();
|
||||
|
||||
/**
|
||||
|
@ -40,7 +41,7 @@ public class MyDataSource {
|
|||
druidSource.setUrl(jdbcUrl);
|
||||
druidSource.setUsername(dataSource.getUsername());
|
||||
druidSource.setPassword(dataSource.getPassword());
|
||||
// 配置连接池大小
|
||||
// 配置连接池大小 测试数据的展示
|
||||
druidSource.setInitialSize(Integer.valueOf(dataSource.getInitNum().toString()));
|
||||
druidSource.setMinIdle(5);
|
||||
druidSource.setMaxActive(Integer.valueOf(dataSource.getMaxNum().toString()));
|
||||
|
@ -102,7 +103,6 @@ public class MyDataSource {
|
|||
for (String s : pools.keySet()) {
|
||||
log.info("连接池名称: "+s);
|
||||
}
|
||||
|
||||
//根据key获取连接池
|
||||
DruidDataSource druidDataSource = pools.get(key);
|
||||
//获取正在使用的连接数量
|
||||
|
|
|
@ -29,72 +29,5 @@
|
|||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- PostgreSQL JDBC驱动 -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</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>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -24,17 +24,7 @@
|
|||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-engine-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-data-access-client</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
|
|
@ -18,11 +18,6 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-data-access-client</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.data.unit;
|
||||
|
||||
import com.muyu.rule.model.DataModel;
|
||||
import com.muyu.rule.scope.DataModelContext;
|
||||
import com.muyu.rule.scope.model.DataProcessModel;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TestClass {
|
||||
|
||||
public static void main(String[] args) {
|
||||
DataModel dataModel = new DataModel();
|
||||
dataModel.setValue("测试");
|
||||
dataModel.setKey("string");
|
||||
dataModel.setSourceType("varchar");
|
||||
dataModel.setProcessType("string");
|
||||
dataModel.setProcessClass(String.class);
|
||||
DataProcessModel dataProcessModel = new DataProcessModel();
|
||||
dataProcessModel.setDataModel(dataModel);
|
||||
DataModelContext.set(dataProcessModel);
|
||||
TestConstant testConstant = new TestConstant();
|
||||
testConstant.execution();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.data.unit;
|
||||
|
||||
import com.muyu.rule.engine.scope.DataModelEngine;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
||||
@Log4j2
|
||||
public class TestConstant extends DataModelEngine {
|
||||
@Override
|
||||
public void execution() {
|
||||
Object value = getValue();
|
||||
log.info("value",value);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package com.muyu.rule.engine.req;
|
||||
|
||||
import com.muyu.etl.domain.DataAsset;
|
||||
import com.muyu.etl.domain.DataSource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.poi.poifs.nio.DataSource;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.rule.engine.req;
|
||||
|
||||
import com.muyu.etl.domain.AssetModel;
|
||||
import com.muyu.rule.engine.domain.EngineVersion;
|
||||
import com.muyu.rule.scope.model.DataProcessModel;
|
||||
import com.muyu.rule.scope.model.DataSetProcessModel;
|
||||
import com.muyu.rule.scope.model.RecordProcessModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TestInterfaceReq {
|
||||
|
||||
private DataProcessModel dataProcessModel;
|
||||
private RecordProcessModel recordProcessModel;
|
||||
private DataSetProcessModel dataSetProcessModel;
|
||||
private EngineVersion engineVersion;
|
||||
private List<AssetModel> assetModelListl;
|
||||
|
||||
}
|
|
@ -14,29 +14,29 @@ public abstract class DataModelEngine implements Engine<DataProcessModel> {
|
|||
return dataModelContext.get();
|
||||
}
|
||||
|
||||
public DataModel getModel(){
|
||||
public DataModel getDataModel(){
|
||||
return get().getDataModel();
|
||||
}
|
||||
|
||||
|
||||
public String getKey () {
|
||||
return getModel().getKey();
|
||||
return getDataModel().getKey();
|
||||
}
|
||||
|
||||
public Object getValue () {
|
||||
return getModel().getValue();
|
||||
return getDataModel().getValue();
|
||||
}
|
||||
|
||||
public String getSourceType () {
|
||||
return getModel().getSourceType();
|
||||
return getDataModel().getSourceType();
|
||||
}
|
||||
|
||||
public String getProcessType () {
|
||||
return getModel().getProcessType();
|
||||
return getDataModel().getProcessType();
|
||||
}
|
||||
|
||||
public Class<?> getProcessClass () {
|
||||
return getModel().getProcessClass();
|
||||
return getDataModel().getProcessClass();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.rule.engine.scope;
|
|||
|
||||
import com.muyu.rule.engine.Engine;
|
||||
import com.muyu.rule.model.DataSetModel;
|
||||
import com.muyu.rule.model.RecordModel;
|
||||
import com.muyu.rule.scope.DataSetContext;
|
||||
import com.muyu.rule.scope.model.DataSetProcessModel;
|
||||
|
||||
|
@ -16,11 +17,8 @@ public abstract class DataSetEngine implements Engine<DataSetProcessModel> {
|
|||
return get().getDataSetModel();
|
||||
}
|
||||
|
||||
public DataSetContext getDataSetContext() {
|
||||
return dataSetContext;
|
||||
public RecordModel[] getRecordModelArr(){
|
||||
return getDataSetModel().getRecordModelArr();
|
||||
}
|
||||
|
||||
public void setDataSetContext(DataSetContext dataSetContext) {
|
||||
this.dataSetContext = dataSetContext;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,32 @@
|
|||
package com.muyu.rule.engine.scope;
|
||||
|
||||
import com.muyu.rule.engine.Engine;
|
||||
import com.muyu.rule.model.DataModel;
|
||||
import com.muyu.rule.model.RecordModel;
|
||||
import com.muyu.rule.scope.RecordContext;
|
||||
import com.muyu.rule.scope.model.RecordProcessModel;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public abstract class RecordEngine implements Engine<RecordProcessModel> {
|
||||
|
||||
private RecordContext recordContext;
|
||||
|
||||
@Override
|
||||
public RecordProcessModel get() {
|
||||
return null;
|
||||
return recordContext.get();
|
||||
}
|
||||
|
||||
public RecordModel getRecordModel() {
|
||||
return get().getRecordModel();
|
||||
}
|
||||
|
||||
public String[] getKeys() {
|
||||
return get().getKeys();
|
||||
}
|
||||
|
||||
public DataModel[] getDataModelArr() {
|
||||
return getRecordModel().getDataModelArr();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package com.muyu.rule.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DataSetModel {
|
||||
|
||||
private RecordModel[] recordModelArr = null;
|
||||
|
@ -7,7 +10,6 @@ public class DataSetModel {
|
|||
private DataSetModel(int recordModelLength){
|
||||
recordModelArr = new RecordModel[recordModelLength];
|
||||
}
|
||||
|
||||
private DataSetModel(RecordModel[] recordModelArr){
|
||||
recordModelArr = recordModelArr;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package com.muyu.rule.model;
|
||||
|
||||
public class DataStandard {
|
||||
public interface DataStandard {
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ public class RecordModel {
|
|||
private RecordModel(int dataModelLength){
|
||||
this.dataModelArr = new DataModel[dataModelLength];
|
||||
}
|
||||
|
||||
private RecordModel(DataModel[] dataModelArr){
|
||||
this.dataModelArr = dataModelArr;
|
||||
}
|
||||
|
|
|
@ -1,31 +1,20 @@
|
|||
package com.muyu.rule.scope;
|
||||
|
||||
import com.muyu.rule.scope.model.DataProcessModel;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class DataModelContext implements ScopeContext <DataProcessModel>{
|
||||
public class DataModelContext {
|
||||
|
||||
private static final ThreadLocal<DataProcessModel> THREAD_LOCAL = new ThreadLocal<>();
|
||||
|
||||
private final RecordContext recordContext;
|
||||
|
||||
public DataModelContext (RecordContext recordContext) {
|
||||
this.recordContext = recordContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataProcessModel get () {
|
||||
public static DataProcessModel get () {
|
||||
return THREAD_LOCAL.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(DataProcessModel dataProcessModel){
|
||||
public static void set (DataProcessModel dataProcessModel) {
|
||||
THREAD_LOCAL.set(dataProcessModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(){
|
||||
public static void clear(){
|
||||
THREAD_LOCAL.remove();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.muyu.rule.scope;
|
||||
|
||||
import com.muyu.rule.scope.model.DataSetProcessModel;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
public class DataSetContext implements ScopeContext <DataSetProcessModel>{
|
||||
@Component
|
||||
public class DataSetContext{
|
||||
|
||||
private static final ThreadLocal<DataSetProcessModel> THREAD_LOCAL = new ThreadLocal<>();
|
||||
|
||||
|
@ -12,18 +14,16 @@ public class DataSetContext implements ScopeContext <DataSetProcessModel>{
|
|||
this.taskContext = taskContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSetProcessModel get() {
|
||||
|
||||
public static DataSetProcessModel get() {
|
||||
return THREAD_LOCAL.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(){
|
||||
public static void clear() {
|
||||
THREAD_LOCAL.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(DataSetProcessModel dataSetProcessModel){
|
||||
public static void set(DataSetProcessModel dataSetProcessModel) {
|
||||
THREAD_LOCAL.set(dataSetProcessModel);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.muyu.rule.scope.model.RecordProcessModel;
|
|||
* @Description: 记录/资产模型
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class RecordContext implements ScopeContext<RecordProcessModel>{
|
||||
public class RecordContext {
|
||||
|
||||
private static final ThreadLocal<RecordProcessModel> THREAD_LOCAL = new ThreadLocal<>();
|
||||
|
||||
|
@ -18,18 +18,18 @@ public class RecordContext implements ScopeContext<RecordProcessModel>{
|
|||
this.dataSetContext = dataSetContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecordProcessModel get() {
|
||||
|
||||
public static RecordProcessModel get() {
|
||||
return THREAD_LOCAL.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
public static void clear() {
|
||||
THREAD_LOCAL.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(RecordProcessModel recordProcessModel) {
|
||||
|
||||
public static void set(RecordProcessModel recordProcessModel) {
|
||||
THREAD_LOCAL.set(recordProcessModel);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,6 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-data-access-client</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-engine-common</artifactId>
|
||||
|
|
|
@ -119,4 +119,10 @@ public class EngineVersionController extends BaseController
|
|||
{
|
||||
return toAjax(engineVersionService.deleteEngineVersionByIds(ids));
|
||||
}
|
||||
|
||||
@PostMapping("/TestRuleVersion")
|
||||
public Result testRuleVersion(){
|
||||
return engineVersionService.testRuleVersion();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,4 +68,6 @@ public interface IEngineVersionService
|
|||
|
||||
Result getDataRegionList(DataSourceAssetModelReq dataSourceAssetModelReq);
|
||||
|
||||
Result testRuleVersion();
|
||||
|
||||
}
|
||||
|
|
|
@ -121,14 +121,6 @@ public class EngineVersionServiceImpl implements IEngineVersionService
|
|||
|
||||
@Override
|
||||
public Result generatedCode(EngineVersion engineVersion) {
|
||||
// //根据引擎ID获取规则引擎信息
|
||||
// EngineMaintenance engineMaintenance = engineMaintenanceMapper.selectEngineMaintenanceById(engineVersion.getEngineMaintenanceId());
|
||||
// //生成规则版本类名
|
||||
// engineVersion.setVersionCode(engineMaintenance.getEngineCode()+"_"+engineVersion.getCode());
|
||||
// //生成规则版本代码
|
||||
// engineVersion.setCodeIng(GenerateConstant.generateConstant(engineMaintenance,engineVersion));
|
||||
// return Result.success(engineVersion);
|
||||
//根据引擎ID获取规则引擎信息
|
||||
EngineMaintenance engineMaintenance = engineMaintenanceMapper.selectEngineMaintenanceById(engineVersion.getEngineMaintenanceId());
|
||||
//生成规则版本类名
|
||||
engineVersion.setVersionCode(engineMaintenance.getEngineCode()+"-"+engineVersion.getCode());
|
||||
|
@ -226,4 +218,10 @@ public class EngineVersionServiceImpl implements IEngineVersionService
|
|||
}
|
||||
return Result.success(kvtList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result testRuleVersion() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue