feat():行数据
parent
50c64f0e46
commit
86ac6484e5
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.common.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:蓬叁
|
||||||
|
* @Package:com.muyu.common.domain
|
||||||
|
* @Project:cloud-rule
|
||||||
|
* @name:DataRecord
|
||||||
|
* @Date:2024/9/7 上午10:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DataRecord {
|
||||||
|
|
||||||
|
private String ruleVersionType;
|
||||||
|
|
||||||
|
private RuleData[] ruleData;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.common.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:蓬叁
|
||||||
|
* @Package:com.muyu.common.domain
|
||||||
|
* @Project:cloud-rule
|
||||||
|
* @name:DataSet
|
||||||
|
* @Date:2024/9/7 上午10:25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DataSet {
|
||||||
|
|
||||||
|
private String ruleVersionType;
|
||||||
|
|
||||||
|
private RuleData[][] ruleData;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.common.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:蓬叁
|
||||||
|
* @Package:com.muyu.common.domain
|
||||||
|
* @Project:cloud-rule
|
||||||
|
* @name:SingleField
|
||||||
|
* @Date:2024/9/6 下午8:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SingleField {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -22,7 +22,10 @@ public class GenerateConstant {
|
||||||
public static final String DATA_FIELD = "DataEngineValueActuator";
|
public static final String DATA_FIELD = "DataEngineValueActuator";
|
||||||
public static final String DATA_RECORD = "DataEngineRecordActuator";
|
public static final String DATA_RECORD = "DataEngineRecordActuator";
|
||||||
public static final String DATA_SET = "DataEngineSetActuator";
|
public static final String DATA_SET = "DataEngineSetActuator";
|
||||||
public static final String ACTION_IMPORT = "import com.muyu.common.domain.DataValue;";
|
public static final String TYPE_FIELD = "DataValue";
|
||||||
|
public static final String TYPE_RECORD = "DataRecord";
|
||||||
|
public static final String TYPE_SET = "DataSet";
|
||||||
|
public static final String ACTION_IMPORT = "import com.muyu.common.domain.;";
|
||||||
public static final String SCOPE_IMPORT = "import com.muyu.engine.basic.abstracts.";
|
public static final String SCOPE_IMPORT = "import com.muyu.engine.basic.abstracts.";
|
||||||
public static final String PACKAGE_PATH = "package com.muyu.generate;\n";
|
public static final String PACKAGE_PATH = "package com.muyu.generate;\n";
|
||||||
|
|
||||||
|
@ -38,9 +41,10 @@ public class GenerateConstant {
|
||||||
public static String generateConstant(RuleData ruleData, RuleVersion ruleVersion){
|
public static String generateConstant(RuleData ruleData, RuleVersion ruleVersion){
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||||
String format = simpleDateFormat.format(new Date());
|
String format = simpleDateFormat.format(new Date());
|
||||||
String level = selectType(ruleData.getRuleRegion());
|
String type = selectType(ruleData.getRuleRegion());
|
||||||
|
String level = selectData(ruleData.getRuleRegion());
|
||||||
return PACKAGE_PATH + "\n" +
|
return PACKAGE_PATH + "\n" +
|
||||||
ACTION_IMPORT + "\n" +
|
ACTION_IMPORT + type + ";\n" +
|
||||||
SCOPE_IMPORT + level + ";\n" +
|
SCOPE_IMPORT + level + ";\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"/**\n" +
|
"/**\n" +
|
||||||
|
@ -56,7 +60,7 @@ public class GenerateConstant {
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String selectType(String level){
|
public static String selectData(String level){
|
||||||
String type = "";
|
String type = "";
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case "F":
|
case "F":
|
||||||
|
@ -72,4 +76,20 @@ public class GenerateConstant {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String selectType(String level){
|
||||||
|
String type = "";
|
||||||
|
switch (level) {
|
||||||
|
case "F":
|
||||||
|
type = TYPE_FIELD;
|
||||||
|
break;
|
||||||
|
case "R":
|
||||||
|
type = TYPE_RECORD;
|
||||||
|
break;
|
||||||
|
case "C":
|
||||||
|
type = TYPE_SET;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.muyu.engine.basic.abstracts;
|
||||||
import com.muyu.common.domain.DataValue;
|
import com.muyu.common.domain.DataValue;
|
||||||
import com.muyu.engine.basic.BasicEngine;
|
import com.muyu.engine.basic.BasicEngine;
|
||||||
import com.muyu.engine.basic.handler.DataEngineRecordHandler;
|
import com.muyu.engine.basic.handler.DataEngineRecordHandler;
|
||||||
import com.muyu.engine.basic.handler.DataEngineSetHandler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:蓬叁
|
* @Author:蓬叁
|
||||||
|
@ -13,14 +12,14 @@ import com.muyu.engine.basic.handler.DataEngineSetHandler;
|
||||||
* @Date:2024/8/30 上午11:13
|
* @Date:2024/8/30 上午11:13
|
||||||
* @Description: 记录
|
* @Description: 记录
|
||||||
*/
|
*/
|
||||||
public abstract class DataEngineRecordActuator implements BasicEngine<DataValue> {
|
public abstract class DataEngineRecordActuator implements BasicEngine<DataValue[]> {
|
||||||
|
|
||||||
public void set(DataValue dataValue){
|
public void set(DataValue[] dataValue){
|
||||||
DataEngineRecordHandler.set(dataValue);
|
DataEngineRecordHandler.set(dataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取原始值
|
//获取原始值
|
||||||
public DataValue get(){
|
public DataValue[] get(){
|
||||||
return DataEngineRecordHandler.get();
|
return DataEngineRecordHandler.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,4 +31,5 @@ public abstract class DataEngineRecordActuator implements BasicEngine<DataValue>
|
||||||
|
|
||||||
public abstract void run();
|
public abstract void run();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
package com.muyu.engine.basic.abstracts;
|
|
||||||
|
|
||||||
import com.muyu.common.domain.DataValue;
|
|
||||||
import com.muyu.engine.basic.BasicEngine;
|
|
||||||
import com.muyu.engine.basic.handler.DataEngineRowHandler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:蓬叁
|
|
||||||
* @Package:com.muyu.engine.basic.handler
|
|
||||||
* @Project:cloud-rule
|
|
||||||
* @name:DataEngineValueActuator
|
|
||||||
* @Date:2024/8/29 下午4:21
|
|
||||||
* @Description: 数据值处理对象
|
|
||||||
*/
|
|
||||||
public abstract class DataEngineRowActuator implements BasicEngine<DataValue[]> {
|
|
||||||
|
|
||||||
public void set(DataValue[] dataValue){
|
|
||||||
DataEngineRowHandler.set(dataValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取原始值
|
|
||||||
public DataValue[] get(){
|
|
||||||
return DataEngineRowHandler.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -13,11 +13,11 @@ import com.muyu.common.domain.DataValue;
|
||||||
*/
|
*/
|
||||||
public class DataEngineRecordHandler {
|
public class DataEngineRecordHandler {
|
||||||
|
|
||||||
public static void set(DataValue dataValue){
|
public static void set(DataValue[] dataValue){
|
||||||
DataEngineHandler.set(dataValue);
|
DataEngineHandler.set(dataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataValue get(){
|
public static DataValue[] get(){
|
||||||
return DataEngineHandler.get();
|
return DataEngineHandler.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class DataEngineRecordHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getValue(){
|
public static Object getValue(){
|
||||||
return get().getValue();
|
return get().getClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getIntegerValue(){
|
public static Integer getIntegerValue(){
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package com.muyu.engine.basic.handler;
|
|
||||||
|
|
||||||
import com.muyu.common.domain.DataValue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:蓬叁
|
|
||||||
* @Package:com.muyu.engine.basic.handler
|
|
||||||
* @Project:cloud-rule
|
|
||||||
* @name:DataEngineValueHandler
|
|
||||||
* @Date:2024/8/29 下午3:21
|
|
||||||
* @Description: 数据记录/行作用域
|
|
||||||
*/
|
|
||||||
public class DataEngineRowHandler {
|
|
||||||
|
|
||||||
public static void set(DataValue[] dataValue){
|
|
||||||
DataEngineHandler.set(dataValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DataValue[] get(){
|
|
||||||
return DataEngineHandler.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -12,5 +12,11 @@ import com.muyu.engine.basic.abstracts.DataEngineValueActuator;
|
||||||
public class GenerateEmailAWEOIF extends DataEngineValueActuator {
|
public class GenerateEmailAWEOIF extends DataEngineValueActuator {
|
||||||
@Override
|
@Override
|
||||||
public void run () {
|
public void run () {
|
||||||
|
DataValue dataValue = get();
|
||||||
|
if (dataValue == null){
|
||||||
|
System.out.println("数据为空,需要丢弃。");
|
||||||
|
} else {
|
||||||
|
System.out.println("数据非空,数据:" + dataValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.muyu.server;
|
package com.muyu.server;
|
||||||
|
|
||||||
|
import com.muyu.common.domain.DataRecord;
|
||||||
import com.muyu.common.domain.DataValue;
|
import com.muyu.common.domain.DataValue;
|
||||||
|
import com.muyu.common.domain.RuleData;
|
||||||
import com.muyu.engine.basic.abstracts.DataEngineValueActuator;
|
import com.muyu.engine.basic.abstracts.DataEngineValueActuator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -162,4 +162,10 @@ public class RuleVersionController {
|
||||||
return Result.success(null,"测试成功");
|
return Result.success(null,"测试成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Result<String> test(
|
||||||
|
|
||||||
|
){
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue