11111
parent
30cd9fc1c3
commit
5a55653454
|
@ -20,6 +20,10 @@
|
|||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-datasources-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.rule.common.basic.abstracts;
|
||||
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.rule.common.basic.BasicEngine;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.rule.common.basic.handler.DataEngineDataSetHandler;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.rule.common.basic.abstracts;
|
||||
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.rule.common.basic.BasicEngine;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.rule.common.basic.handler.DataEngineRowHandler;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.rule.common.basic.abstracts;
|
||||
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.rule.common.basic.BasicEngine;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.rule.common.basic.handler.DataEngineValueHandler;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.muyu.rule.common.basic.handler;
|
||||
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.common.domain.DataValue;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
|
@ -8,7 +8,7 @@ import com.muyu.rule.common.domain.DataValue;
|
|||
* @Project:cloud-etl-rule
|
||||
* @name:DataEngineValueHandler
|
||||
* @Date:2024/8/29 14:35
|
||||
* @Description:数据值处理对象
|
||||
* @Description:数据集作用域
|
||||
*/
|
||||
public class DataEngineDataSetHandler {
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ package com.muyu.rule.common.basic.handler;
|
|||
* @Author:张承志
|
||||
* @Package:com.muyu.rule.server.basic
|
||||
* @Project:cloud-etl-rule
|
||||
* @name:DataEngineHandler
|
||||
* @name:规则引擎作用域
|
||||
* @Date:2024/8/29 14:21
|
||||
*/
|
||||
public class DataEngineHandler {
|
||||
|
@ -19,6 +19,7 @@ public class DataEngineHandler {
|
|||
public static <T> T get(){
|
||||
|
||||
return (T) dataEngineHandler.get();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package com.muyu.rule.common.basic.handler;
|
||||
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.common.domain.DataValue;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.rule.server.basic.handler
|
||||
* @Project:cloud-etl-rule
|
||||
* @name:DataEngineValueHandler
|
||||
* @name:数据记录/行作用域
|
||||
* @Date:2024/8/29 14:35
|
||||
* @Description:数据值处理对象
|
||||
*/
|
||||
public class DataEngineRowHandler {
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.muyu.rule.common.basic.handler;
|
||||
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.common.domain.DataValue;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.rule.server.basic.handler
|
||||
* @Project:cloud-etl-rule
|
||||
* @name:DataEngineValueHandler
|
||||
* @name:数据值作用域
|
||||
* @Date:2024/8/29 14:35
|
||||
*/
|
||||
public class DataEngineValueHandler {
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
package com.muyu.rule.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.rule.common.domain
|
||||
* @Project:cloud-etl-rule
|
||||
* @name:Data
|
||||
* @Date:2024/8/27 9:18
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DataValue {
|
||||
|
||||
/**
|
||||
* 键
|
||||
*/
|
||||
public String key;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
|
||||
public String type;
|
||||
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
|
||||
public String label;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
|
||||
public Object value;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -25,12 +25,11 @@ public class VersionAddReq {
|
|||
* 版本名称
|
||||
*/
|
||||
private String versionName;
|
||||
|
||||
/**
|
||||
* 版本类名
|
||||
*/
|
||||
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 版本编码
|
||||
*/
|
||||
|
@ -67,13 +66,4 @@ public class VersionAddReq {
|
|||
private String remark;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.muyu.rule.common.engine.dataSet;
|
||||
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.rule.common.basic.abstracts.DataEngineDataSetActuator;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.rule.common.exception.ActionDiscard;
|
||||
import com.muyu.rule.common.exception.DeliteException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ public class ENGINE_DataSet_asdf_S1 extends DataEngineDataSetActuator {
|
|||
DataValue[][] dataValues = get();
|
||||
|
||||
if (dataValues == null || "".equals(dataValues) || "null".equals(dataValues)) {
|
||||
throw new ActionDiscard();
|
||||
throw new DeliteException();
|
||||
}else {
|
||||
System.out.println("数据检测无异常");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.rule.common.engine.row;
|
||||
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.rule.common.basic.abstracts.DataEngineRowActuator;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
@ -29,6 +29,8 @@ public class ENGINE_ROW_HANG_R1 extends DataEngineRowActuator {
|
|||
// 将 Set 转换回数组
|
||||
DataValue[] uniqueArray = uniquePeople.toArray(new DataValue[0]);
|
||||
|
||||
|
||||
|
||||
System.out.println(Arrays.toString(uniqueArray));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package com.muyu.rule.common.engine.value;
|
||||
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.rule.common.basic.abstracts.DataEngineValueActuator;
|
||||
import com.muyu.rule.common.exception.DeliteException;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.rule.server.basic.engine
|
||||
* @Project:cloud-etl-rule
|
||||
* @name:ENGINE_VALUE_VFD1000_V1
|
||||
* @name:非空抛出异常 进行删除
|
||||
* @Date:2024/8/29 15:51
|
||||
*/
|
||||
public class ENGINE_VALUE_VFD1000_V1 extends DataEngineValueActuator {
|
||||
|
@ -15,11 +16,9 @@ public class ENGINE_VALUE_VFD1000_V1 extends DataEngineValueActuator {
|
|||
public void run() {
|
||||
DataValue dataValue = get();
|
||||
if (dataValue.getValue() == null){
|
||||
System.out.println("数据为空,需要丢弃");
|
||||
throw new DeliteException("数据为空,需要丢弃!");
|
||||
}else{
|
||||
System.out.println("数据非空:"+dataValue.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.muyu.rule.common.engine.value;
|
||||
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.common.enums.DataType;
|
||||
import com.muyu.rule.common.basic.abstracts.DataEngineValueActuator;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.rule.common.utils.Desensitization;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
|
@ -14,9 +16,30 @@ import com.muyu.rule.common.utils.Desensitization;
|
|||
public class ENGINE_VALUE_VFD1000_V2 extends DataEngineValueActuator {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
DataValue dataValue = get();
|
||||
|
||||
String string = Desensitization.mobilePhoneDesensitization((String) dataValue.getValue());
|
||||
System.out.println("手机号脱敏的结果是====>"+string);
|
||||
if (dataValue.getValue()==null){
|
||||
|
||||
DataType type = dataValue.getType();
|
||||
//如果为空,添加默认值
|
||||
//String string = DataType.convertTypeString((String) );
|
||||
//为整数 默认值为0
|
||||
// if ("Integer".equals(string)){
|
||||
// dataValue.setValue(0);
|
||||
// }
|
||||
// //为字符串 默认值为null
|
||||
// if ("String".equals(string)){
|
||||
// dataValue.setValue(null);
|
||||
// }
|
||||
// //为时间 默认值为当前时间
|
||||
// if ("Date".equals(string)){
|
||||
// LocalDateTime dateTime = LocalDateTime.now();
|
||||
// dataValue.setValue(dateTime);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
package com.muyu.rule.common.engine.value;
|
||||
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.rule.common.basic.abstracts.DataEngineValueActuator;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.rule.server.basic.engine
|
||||
* @Project:cloud-etl-rule
|
||||
* @name:非空
|
||||
* @name:字典字段 转换
|
||||
* @Date:2024/8/29 15:51
|
||||
*/
|
||||
public class ENGINE_phone_zzzzz_V9 extends DataEngineValueActuator {
|
||||
public class ENGINE_VALUE_VFD1000_V3 extends DataEngineValueActuator {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
DataValue dataValue = get();
|
||||
if (dataValue.getValue() == null){
|
||||
System.out.println("数据为空");
|
||||
}else {
|
||||
System.out.println("数据非空:"+dataValue.getValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -7,24 +7,24 @@ package com.muyu.rule.common.exception;
|
|||
* @name:ActionDiscard
|
||||
* @Date:2024/8/26 22:08
|
||||
*/
|
||||
public class ActionDiscard extends RuntimeException {
|
||||
public ActionDiscard() {
|
||||
public class DeliteException extends RuntimeException {
|
||||
public DeliteException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ActionDiscard(String message) {
|
||||
public DeliteException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ActionDiscard(String message, Throwable cause) {
|
||||
public DeliteException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ActionDiscard(Throwable cause) {
|
||||
public DeliteException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
protected ActionDiscard(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
protected DeliteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.rule.server;
|
||||
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.common.enums.DataType;
|
||||
import com.muyu.rule.common.basic.BasicEngine;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -47,7 +48,7 @@ public class Main {
|
|||
|
||||
System.out.println("字段规则测试:");
|
||||
DataValue dataValue = DataValue.builder()
|
||||
.type("String")
|
||||
.type(DataType.valueOf("String"))
|
||||
.label("姓名")
|
||||
.key("name")
|
||||
.value(null)
|
||||
|
@ -77,10 +78,6 @@ public class Main {
|
|||
|
||||
DataValue[][] dataValuesSet = new DataValue[3][3];
|
||||
|
||||
dataValuesSet[0][0] = new DataValue("name","String","姓名","张三");
|
||||
dataValuesSet[0][1] = new DataValue("age","int","年龄",22);
|
||||
dataValuesSet[0][2] = new DataValue("sex","String","性别","张三");
|
||||
dataValuesSet[1][0] = new DataValue("name","String",null,"张三");
|
||||
|
||||
BasicEngine<DataValue[][]> engineDataSetAsdfS1 = engineDataSetMap.get("ENGINE_DataSet_asdf_S1");
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.rule.server;
|
||||
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.common.enums.DataType;
|
||||
import com.muyu.rule.common.utils.OssUtil;
|
||||
import com.muyu.rule.common.basic.BasicEngine;
|
||||
import com.muyu.rule.server.complie.SourceCodeComplier;
|
||||
|
@ -56,7 +57,7 @@ public class OSSClassLoaderExample {
|
|||
BasicEngine<DataValue> object =(BasicEngine<DataValue>)aClass.newInstance();
|
||||
|
||||
DataValue dataValue = DataValue.builder()
|
||||
.type("String")
|
||||
.type(DataType.valueOf("String"))
|
||||
.label("姓名")
|
||||
.key("name")
|
||||
.value(null)
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.muyu.rule.server.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.rule.server.service.SourceDisposeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.muyu.rule.server.controller;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.rule.common.domain.RuleEngineVersion;
|
||||
import com.muyu.rule.common.domain.req.VersionAddReq;
|
||||
import com.muyu.rule.server.service.RuleEngineVersionService;
|
||||
|
@ -106,15 +106,12 @@ public class RuleEngineVersionController {
|
|||
* @return
|
||||
*/
|
||||
|
||||
@PostMapping("/deposit")
|
||||
public Result deposit(@RequestBody VersionAddReq ver ){
|
||||
@PostMapping("/deposit/{type}}")
|
||||
public Result deposit(@PathVariable("type")Integer type){
|
||||
|
||||
log.info("传入参数{}"+ver);
|
||||
log.info("传入参数{}"+type);
|
||||
|
||||
String versionClazz = ver.getVersionClazz();
|
||||
String className = ver.getClassName();
|
||||
|
||||
// versionService.Upload(versionClazz,className);
|
||||
String versionClass = versionService.deposit(type);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.rule.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.rule.common.domain.RuleEngineVersion;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -73,5 +73,7 @@ public interface RuleEngineVersionService extends IService<RuleEngineVersion> {
|
|||
* @param dataValue ktvl数据
|
||||
*/
|
||||
|
||||
void testEngine(String className,DataValue dataValue);
|
||||
void testEngine(String className, DataValue dataValue);
|
||||
|
||||
String deposit(Integer type);
|
||||
}
|
||||
|
|
|
@ -5,10 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.enums.SystemYesNo;
|
||||
import com.muyu.rule.common.domain.DataValue;
|
||||
import com.muyu.common.domain.DataValue;
|
||||
import com.muyu.rule.common.domain.RuleEngineVersion;
|
||||
import com.muyu.rule.common.utils.OssUtil;
|
||||
import com.muyu.rule.server.EngineConfig;
|
||||
import com.muyu.rule.common.basic.BasicEngine;
|
||||
import com.muyu.rule.server.load.ExternalClassLoader;
|
||||
import com.muyu.rule.server.mapper.RuleEngineVersionMapper;
|
||||
|
@ -132,11 +131,6 @@ public static final String importClassAndPackPath="home/lib/";
|
|||
public void complierClass(String className, String versionClazz) {
|
||||
log.info("======>"+versionClazz);
|
||||
String ossFilePath = className + Suffix_JAVA;
|
||||
String ossFilePath2 = className + Suffix_CLASS;
|
||||
EngineConfig engineConfig = new EngineConfig();
|
||||
|
||||
// String filePath ="home/"+ossFilePath;
|
||||
String filePath = engineWorkSourcePath + ossFilePath;
|
||||
//创建服务器项目容器的java源码文件目录路径
|
||||
File serverFile = new File(engineWorkSourcePath, ossFilePath);
|
||||
//如果目录不存在,则创建目录
|
||||
|
@ -166,6 +160,7 @@ public static final String importClassAndPackPath="home/lib/";
|
|||
} else {
|
||||
System.out.println("错误");
|
||||
}
|
||||
|
||||
OssUtil.ssss(className);
|
||||
|
||||
|
||||
|
@ -248,6 +243,18 @@ public static final String importClassAndPackPath="home/lib/";
|
|||
valueBasicEngine.execution();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String deposit(Integer type) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改激活
|
||||
*
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue