feat():集数据
parent
5785187839
commit
fa7a82c540
|
@ -22,6 +22,6 @@ public class DataSet {
|
||||||
|
|
||||||
private String ruleVersionText;
|
private String ruleVersionText;
|
||||||
|
|
||||||
private RuleData[][] ruleData;
|
private DataValue[][] dataValue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
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:Data
|
||||||
|
* @Date:2024/9/8 下午11:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ValueData {
|
||||||
|
|
||||||
|
private String ruleVersionType;
|
||||||
|
|
||||||
|
private String ruleVersionText;
|
||||||
|
|
||||||
|
private DataValue dataValue;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.muyu.generate;
|
||||||
|
|
||||||
|
import com.muyu.common.domain.DataValue;
|
||||||
|
import com.muyu.common.domain.DataSet;
|
||||||
|
import com.muyu.engine.basic.abstracts.DataEngineSetActuator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: admin
|
||||||
|
* @date: 2024/09/08 20:17:14
|
||||||
|
* @Description: 集测试1.0_WQQEAS
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class GenerateSetWQQEAS extends DataEngineSetActuator {
|
||||||
|
@Override
|
||||||
|
public void run () {
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.domain.DataRecord;
|
import com.muyu.common.domain.DataRecord;
|
||||||
import com.muyu.common.domain.DataSet;
|
import com.muyu.common.domain.DataSet;
|
||||||
import com.muyu.common.domain.RuleVersion;
|
import com.muyu.common.domain.RuleVersion;
|
||||||
|
import com.muyu.common.domain.ValueData;
|
||||||
import com.muyu.common.domain.req.RuleVersionAddReq;
|
import com.muyu.common.domain.req.RuleVersionAddReq;
|
||||||
import com.muyu.common.domain.req.RuleVersionUpdCodeReq;
|
import com.muyu.common.domain.req.RuleVersionUpdCodeReq;
|
||||||
import com.muyu.common.domain.req.RuleVersionUpdReq;
|
import com.muyu.common.domain.req.RuleVersionUpdReq;
|
||||||
|
@ -149,18 +150,16 @@ public class RuleVersionController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 版本测试
|
* 版本测试
|
||||||
* @param ruleVersionAddReq
|
* @param valueData
|
||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@PostMapping("/compileLoad")
|
@PostMapping("/compileLoad")
|
||||||
@Operation(summary = "版本测试",description = "版本测试")
|
@Operation(summary = "版本测试",description = "版本测试")
|
||||||
public Result<String> compileLoad(
|
public Result<String> compileLoad(
|
||||||
@Validated @RequestBody RuleVersionAddReq ruleVersionAddReq
|
@Validated @RequestBody ValueData valueData
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
Result<Object> objectResult = ALiYunUpload.uploadJavaFiles(ruleVersionAddReq.getRuleVersionText(), ruleVersionAddReq.getRuleVersionType());
|
ruleVersionService.valueTest(valueData);
|
||||||
System.out.println(objectResult.getMsg());
|
|
||||||
OSSFileLoad.streamingJavaDownload(ruleVersionAddReq.getRuleVersionType());
|
|
||||||
return Result.success(null,"测试成功");
|
return Result.success(null,"测试成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.common.domain.DataRecord;
|
import com.muyu.common.domain.DataRecord;
|
||||||
import com.muyu.common.domain.DataSet;
|
import com.muyu.common.domain.DataSet;
|
||||||
import com.muyu.common.domain.RuleVersion;
|
import com.muyu.common.domain.RuleVersion;
|
||||||
|
import com.muyu.common.domain.ValueData;
|
||||||
import com.muyu.common.domain.req.RuleVersionUpdReq;
|
import com.muyu.common.domain.req.RuleVersionUpdReq;
|
||||||
import com.muyu.common.domain.resp.RuleVersionResp;
|
import com.muyu.common.domain.resp.RuleVersionResp;
|
||||||
|
|
||||||
|
@ -36,4 +37,6 @@ public interface RuleVersionService extends IService<RuleVersion> {
|
||||||
void rowTest(DataRecord dataRecord);
|
void rowTest(DataRecord dataRecord);
|
||||||
|
|
||||||
void setTest(DataSet dataSet);
|
void setTest(DataSet dataSet);
|
||||||
|
|
||||||
|
void valueTest(ValueData valueData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,56 @@ public class RuleVersionServiceImpl
|
||||||
return ruleVersion;
|
return ruleVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void valueTest(ValueData valueData) {
|
||||||
|
|
||||||
|
//上传java文件
|
||||||
|
log.info("上传OSS:java文件");
|
||||||
|
Result<Object> objectResult = ALiYunUpload.uploadJavaFiles(valueData.getRuleVersionText(), valueData.getRuleVersionType());
|
||||||
|
log.info(objectResult.getData());
|
||||||
|
|
||||||
|
try {
|
||||||
|
OSSFileLoad.streamingJavaDownload(valueData.getRuleVersionType());
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.info(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
//编译class
|
||||||
|
System.out.println("执行编译");
|
||||||
|
FilesCompilerLoad.javaCompiler(valueData.getRuleVersionType());
|
||||||
|
|
||||||
|
//上传class
|
||||||
|
log.info("上传OSS:class文件");
|
||||||
|
ALiYunUpload.uploadClassFiles(
|
||||||
|
valueData.getRuleVersionType(),
|
||||||
|
ClassPath+valueData.getRuleVersionType()+ MethodSuffix.CLASSSUFFIX);
|
||||||
|
log.info("开始拉取....");
|
||||||
|
|
||||||
|
//下载class
|
||||||
|
try {
|
||||||
|
OSSFileLoad.streamingClassDownload(valueData.getRuleVersionType());
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
//对路径里的.class文件进行编译
|
||||||
|
log.info("执行加载class:[{}]",valueData.getRuleVersionType());
|
||||||
|
Result<Class<?>> classResult = FilesCompilerLoad.classLoad(valueData.getRuleVersionType());
|
||||||
|
Class<?> clazz = classResult.getData();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Object instance = clazz.getDeclaredConstructor().newInstance();
|
||||||
|
engineValueMap.put(valueData.getRuleVersionType(), (BasicEngine<DataValue>) instance);
|
||||||
|
|
||||||
|
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
detection(valueData.getRuleVersionType(),valueData.getDataValue());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rowTest(DataRecord dataRecord) {
|
public void rowTest(DataRecord dataRecord) {
|
||||||
|
|
||||||
|
@ -166,12 +216,12 @@ public class RuleVersionServiceImpl
|
||||||
System.out.println("测试数据"+dataRecord);
|
System.out.println("测试数据"+dataRecord);
|
||||||
log.info("测试数据:[{}]",dataRecord.getDataValues());
|
log.info("测试数据:[{}]",dataRecord.getDataValues());
|
||||||
|
|
||||||
BasicEngine<DataValue[]> engine = engineRecordMap.get(dataRecord.getRuleVersionType());
|
detection(dataRecord.getRuleVersionType(),dataValues);
|
||||||
engine.set(dataRecord.getDataValues());
|
|
||||||
engine.execution();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTest(DataSet dataSet) {
|
public void setTest(DataSet dataSet) {
|
||||||
|
|
||||||
|
@ -218,6 +268,26 @@ public class RuleVersionServiceImpl
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detection(dataSet.getRuleVersionType(),dataSet.getDataValue());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void detection(String methodName,DataValue dataValue){
|
||||||
|
BasicEngine<DataValue> engine = engineValueMap.get(methodName);
|
||||||
|
engine.set(dataValue);
|
||||||
|
engine.execution();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void detection(String methodName,DataValue[] dataValue){
|
||||||
|
BasicEngine<DataValue[]> engine = engineRecordMap.get(methodName);
|
||||||
|
engine.set(dataValue);
|
||||||
|
engine.execution();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void detection(String methodName,DataValue[][] dataValue){
|
||||||
|
BasicEngine<DataValue[][]> engine = engineSetMap.get(methodName);
|
||||||
|
engine.set(dataValue);
|
||||||
|
engine.execution();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getClassName(String versionCode){
|
public static String getClassName(String versionCode){
|
||||||
|
|
Loading…
Reference in New Issue