规则通过id查询
parent
a4fdebccc5
commit
96902f3114
|
@ -1,85 +0,0 @@
|
||||||
//package com.muyu.config;
|
|
||||||
//
|
|
||||||
//import com.muyu.common.core.domain.Result;
|
|
||||||
//import com.muyu.ruleEngine.context.DataModelContextHolder;
|
|
||||||
//import com.muyu.ruleEngine.context.DataSetContextHolder;
|
|
||||||
//import com.muyu.ruleEngine.context.RecordContextHolder;
|
|
||||||
//import com.muyu.ruleEngine.domain.EngineVersion;
|
|
||||||
//import com.muyu.ruleEngine.domain.req.EngineVersionTestReq;
|
|
||||||
//import com.muyu.ruleEngine.dynamicLoad.DynamicLoader;
|
|
||||||
//import com.muyu.ruleEngine.model.DataModel;
|
|
||||||
//import com.muyu.ruleEngine.model.DataSetModel;
|
|
||||||
//import com.muyu.ruleEngine.model.RecordModel;
|
|
||||||
//import com.muyu.ruleEngine.model.process.DataProcessModel;
|
|
||||||
//import com.muyu.ruleEngine.model.process.DataSetProcessModel;
|
|
||||||
//import com.muyu.ruleEngine.model.process.RecordProcessModel;
|
|
||||||
//import com.muyu.source.engine.client.ruleEngineInit.RuleEngineInit;
|
|
||||||
//import com.muyu.source.remote.RemoteVersionService;
|
|
||||||
//import lombok.extern.log4j.Log4j2;
|
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
//import org.springframework.context.annotation.ComponentScan;
|
|
||||||
//import org.springframework.context.annotation.Import;
|
|
||||||
//
|
|
||||||
//import java.lang.reflect.Method;
|
|
||||||
//import java.util.ArrayList;
|
|
||||||
//import java.util.List;
|
|
||||||
//import java.util.Map;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * 规则引擎客户端配置类
|
|
||||||
// *
|
|
||||||
// * @author qdm
|
|
||||||
// * on 2024/5/9 星期四
|
|
||||||
// */
|
|
||||||
//@Log4j2
|
|
||||||
//@ComponentScan
|
|
||||||
//@Import(value = {RuleEngineClientRunner.class})
|
|
||||||
//public class RuleEngineClientConfig {
|
|
||||||
//
|
|
||||||
// @Autowired
|
|
||||||
// private RemoteVersionService remoteVersionService;
|
|
||||||
//
|
|
||||||
// public Result engineVersionTest(EngineVersionTestReq testReq) {
|
|
||||||
// if (testReq.getScope() == 4) {
|
|
||||||
// DataProcessModel dataProcessModel = DataProcessModel.builder().dataModel(testReq.getDataModel()).build();
|
|
||||||
// DataModelContextHolder.set(dataProcessModel);
|
|
||||||
// } else if (testReq.getScope() == 3) {
|
|
||||||
// RecordModel recordModel = RecordModel.builder().dataModels(testReq.getDataModelList()).build();
|
|
||||||
// RecordProcessModel recordProcessModel = RecordProcessModel.builder()
|
|
||||||
// .keys(testReq.getKeys())
|
|
||||||
// .recordModel(recordModel)
|
|
||||||
// .build();
|
|
||||||
// RecordContextHolder.set(recordProcessModel);
|
|
||||||
// } else if (testReq.getScope() == 2) {
|
|
||||||
// List<RecordModel> recordModelList = new ArrayList<>();
|
|
||||||
// List<List<DataModel>> dataModelLists = testReq.getDataModelLists();
|
|
||||||
// dataModelLists.stream().forEach(dataModelList -> {
|
|
||||||
// RecordModel recordModel = RecordModel.builder().dataModels(dataModelList).build();
|
|
||||||
// recordModelList.add(recordModel);
|
|
||||||
// });
|
|
||||||
// DataSetModel dataSetModel = DataSetModel.builder()
|
|
||||||
// .recordModels(recordModelList)
|
|
||||||
// .build();
|
|
||||||
// DataSetProcessModel dataSetProcessModel = DataSetProcessModel.builder()
|
|
||||||
// .dataSetModel(dataSetModel)
|
|
||||||
// .build();
|
|
||||||
// DataSetContextHolder.set(dataSetProcessModel);
|
|
||||||
// }
|
|
||||||
// Result<EngineVersion> versionResult = remoteVersionService.getVersion(testReq.getEngineVersionId());
|
|
||||||
// EngineVersion engineVersion = versionResult.getData();
|
|
||||||
// Map<String, byte[]> engineMap = RuleEngineInit.getEngineMap(testReq.getEngineVersionId());
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// @SuppressWarnings("resource")
|
|
||||||
// DynamicLoader.MemoryClassLoader classLoader = new DynamicLoader.MemoryClassLoader(engineMap);
|
|
||||||
// Class<?> aClass = classLoader.loadClass(engineVersion.getVersionClass());
|
|
||||||
// Method method = aClass.getDeclaredMethod("execution");
|
|
||||||
// Object o = aClass.newInstance();
|
|
||||||
// method.invoke(o);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// log.info(e.getMessage());
|
|
||||||
// return Result.success("程序异常: 信息[" + e.getLocalizedMessage() + "]异常");
|
|
||||||
// }
|
|
||||||
// return Result.success("测试正常,无异常数据返回");
|
|
||||||
// }
|
|
||||||
//}
|
|
|
@ -1,34 +0,0 @@
|
||||||
//package com.muyu.config;
|
|
||||||
//
|
|
||||||
//import com.muyu.common.core.domain.Result;
|
|
||||||
//import com.muyu.ruleEngine.domain.EngineVersion;
|
|
||||||
//import com.muyu.source.engine.client.ruleEngineInit.RuleEngineInit;
|
|
||||||
//import com.muyu.source.remote.RemoteVersionService;
|
|
||||||
//import lombok.extern.log4j.Log4j2;
|
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
//import org.springframework.boot.ApplicationArguments;
|
|
||||||
//import org.springframework.boot.ApplicationRunner;
|
|
||||||
//
|
|
||||||
//import java.util.List;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * 初始化加载
|
|
||||||
// *
|
|
||||||
// * @author qdm
|
|
||||||
// * on 2024/5/9 星期四
|
|
||||||
// */
|
|
||||||
//@Log4j2
|
|
||||||
//public class RuleEngineClientRunner implements ApplicationRunner {
|
|
||||||
//
|
|
||||||
// @Autowired
|
|
||||||
// private RemoteVersionService remoteVersionService;
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void run(ApplicationArguments args) throws Exception {
|
|
||||||
// Result<List<EngineVersion>> versionListResult = remoteVersionService.getVersionList();
|
|
||||||
// log.info(versionListResult);
|
|
||||||
// List<EngineVersion> engineVersionList = versionListResult.getData();
|
|
||||||
// RuleEngineInit.init(engineVersionList);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//}
|
|
|
@ -1,37 +0,0 @@
|
||||||
//package com.muyu.ruleEngineLnit;
|
|
||||||
//
|
|
||||||
//import com.muyu.ruleEngine.constant.RuleOperationConstants;
|
|
||||||
//import com.muyu.ruleEngine.domain.EngineVersion;
|
|
||||||
//import com.muyu.ruleEngine.dynamicLoad.DynamicLoader;
|
|
||||||
//import org.springframework.stereotype.Component;
|
|
||||||
//
|
|
||||||
//import java.util.HashMap;
|
|
||||||
//import java.util.List;
|
|
||||||
//import java.util.Map;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * 规则引擎初始化
|
|
||||||
// *
|
|
||||||
// * @author qdm
|
|
||||||
// * on 2024/5/14 星期二
|
|
||||||
// */
|
|
||||||
//@Component
|
|
||||||
//public class RuleEngineInit {
|
|
||||||
// private static Map<Long, Map<String, byte[]>> engineMap = new HashMap();
|
|
||||||
//
|
|
||||||
// public static void init(List<EngineVersion> engineVersionList){
|
|
||||||
//// Map<String, byte[]> map = new HashMap<>();
|
|
||||||
// engineVersionList.stream().forEach(engineVersion -> {
|
|
||||||
// // 获取版本内容
|
|
||||||
// String content = engineVersion.getRuleContent().replaceAll("\r\n", "");
|
|
||||||
// // 对source进行编译生成class文件存放在Map中,这里用bytecode接收
|
|
||||||
// Map<String, byte[]> bytecode = DynamicLoader.compile(engineVersion.getVersionClass() +
|
|
||||||
// RuleOperationConstants.FILE_SUFFIX, content);
|
|
||||||
// engineMap.put(engineVersion.getId(), bytecode);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static Map<String, byte[]> getEngineMap(Long ruleId) {
|
|
||||||
// return engineMap.get(ruleId);
|
|
||||||
// }
|
|
||||||
//}
|
|
|
@ -1,7 +0,0 @@
|
||||||
package com.muyu;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
System.out.println("Hello world!");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,14 +3,12 @@ package com.muyu.controller;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
import com.muyu.domain.EngineLevelEntity;
|
import com.muyu.domain.EngineLevelEntity;
|
||||||
import com.muyu.domain.EngineMaintenance;
|
import com.muyu.domain.EngineMaintenance;
|
||||||
|
import com.muyu.domain.EngineVersion;
|
||||||
import com.muyu.domain.constants.Result;
|
import com.muyu.domain.constants.Result;
|
||||||
import com.muyu.service.EngineLevelService;
|
import com.muyu.service.EngineLevelService;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -32,7 +30,7 @@ public class EngineLevelController {
|
||||||
* 查询
|
* 查询
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectLevelList")
|
@PostMapping("/selectLevelList")
|
||||||
public List<EngineLevelController> selectLevelList() {
|
public List<EngineLevelEntity> selectLevelList() {
|
||||||
return engineLevelService.selectLevelLists();
|
return engineLevelService.selectLevelLists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +62,7 @@ public class EngineLevelController {
|
||||||
* 批量删除 id
|
* 批量删除 id
|
||||||
*/
|
*/
|
||||||
@PostMapping("/deleteBatch")
|
@PostMapping("/deleteBatch")
|
||||||
public Result deleteBatch(Integer[] ids) {
|
public Result deleteBatch(@RequestParam("id") Integer[] ids) {
|
||||||
return engineLevelService.deleteBatch(ids);
|
return engineLevelService.deleteBatch(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,14 +73,4 @@ public class EngineLevelController {
|
||||||
public Result selectById(@PathVariable Integer id) {
|
public Result selectById(@PathVariable Integer id) {
|
||||||
return engineLevelService.selectById(id);
|
return engineLevelService.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 导出
|
|
||||||
// */
|
|
||||||
// @PostMapping("/export")
|
|
||||||
// public void export(HttpServletResponse httpServletResponse, EngineLevelEntity engineLevelEntity) {
|
|
||||||
// List<EngineLevelEntity> list = engineLevelService.list();
|
|
||||||
// ExcelUtil<EngineLevelEntity> engineMaintenanceExcelUtil = new ExcelUtil<>(EngineLevelEntity.class);
|
|
||||||
// engineMaintenanceExcelUtil.exportExcel(httpServletResponse, list, "规则引擎版本");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,5 @@ public interface EnginLevelMapper {
|
||||||
|
|
||||||
EngineLevelEntity selectById(@Param("id") Integer id);
|
EngineLevelEntity selectById(@Param("id") Integer id);
|
||||||
|
|
||||||
List<EngineLevelController> lists();
|
List<EngineLevelEntity> lists();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,5 @@ public interface EngineLevelService {
|
||||||
|
|
||||||
Result selectById(Integer id);
|
Result selectById(Integer id);
|
||||||
|
|
||||||
List<EngineLevelController> selectLevelLists();
|
List<EngineLevelEntity> selectLevelLists();
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,8 @@ public class EngineLevelServiceImpl implements EngineLevelService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EngineLevelController> selectLevelLists() {
|
public List<EngineLevelEntity> selectLevelLists() {
|
||||||
List<EngineLevelController> list = enginLevelMapper.lists();
|
List<EngineLevelEntity> list = enginLevelMapper.lists();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
select id,name
|
select id,name
|
||||||
from t_level
|
from t_level
|
||||||
</select>
|
</select>
|
||||||
<select id="lists" resultType="com.muyu.controller.EngineLevelController">
|
<select id="lists" resultType="com.muyu.domain.EngineLevelEntity">
|
||||||
select id,name
|
select id,name
|
||||||
from t_level
|
from t_level
|
||||||
</select>
|
</select>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue