Compare commits
45 Commits
577bc3e1c0
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 956d3f69ea | |||
|
|
8b3fe9b548 | ||
|
|
db30244cd1 | ||
|
|
c9bc62fb8c | ||
|
|
9d54395c29 | ||
|
|
35fd1c8937 | ||
|
|
579d0f2bd8 | ||
|
|
7f8abf2ff2 | ||
|
|
f1bcd3812d | ||
|
|
d3fda27bb0 | ||
|
|
538a43f597 | ||
|
|
fcab8585c5 | ||
|
|
0ffc42ab69 | ||
|
|
46bead08a0 | ||
|
|
e07b11ef95 | ||
|
|
a78781782e | ||
|
|
0b55384442 | ||
|
|
43837901f3 | ||
|
|
8898cd2e6f | ||
|
|
f34274ea35 | ||
|
|
5ffdb5e508 | ||
|
|
a5a3c93135 | ||
|
|
af697e9304 | ||
|
|
e7abfca9f7 | ||
|
|
1058d666a0 | ||
|
|
58d36a3d6d | ||
|
|
b544391b5c | ||
|
|
e12c3c0302 | ||
|
|
d8c429d000 | ||
|
|
7909ea8acb | ||
|
|
444c31612d | ||
|
|
a3e34424d8 | ||
|
|
76065ed5c4 | ||
|
|
70de3c68a8 | ||
|
|
3bb9178399 | ||
|
|
82fcedfa97 | ||
|
|
294e5d687e | ||
|
|
a246c88341 | ||
|
|
c9d5c38b52 | ||
|
|
9ded6b757c | ||
|
|
015030d650 | ||
|
|
b67f493678 | ||
| e3be036bd3 | |||
| 0daa1c19cf | |||
|
|
a440094138 |
2
.gitignore
vendored
@@ -8,6 +8,8 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
node_modules/
|
||||
|
||||
######################################################################
|
||||
# IDE
|
||||
|
||||
|
||||
@@ -70,6 +70,12 @@
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-algo</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-rule</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.solution.web.controller.algo;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.solution.common.annotation.Log;
|
||||
import com.solution.common.core.controller.BaseController;
|
||||
import com.solution.common.core.domain.AjaxResult;
|
||||
import com.solution.common.enums.BusinessType;
|
||||
import com.solution.algo.domain.Algorithm;
|
||||
import com.solution.algo.service.IAlgorithmService;
|
||||
import com.solution.common.utils.poi.ExcelUtil;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 规则Controller
|
||||
*
|
||||
* @author zouju
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
@RestController
|
||||
@Api("规则模块")
|
||||
@RequestMapping("/api/algo/algorithm")
|
||||
public class AlgorithmController extends BaseController {
|
||||
@Autowired
|
||||
private IAlgorithmService algorithmService;
|
||||
|
||||
/**
|
||||
* 导出规则列表
|
||||
*/
|
||||
@ApiOperation("运行python程序")
|
||||
@PostMapping("/run")
|
||||
public Object run(@RequestBody Algorithm algorithm) {
|
||||
List<Algorithm> list = algorithmService.selectAlgorithmList(algorithm);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
for (Algorithm al : list) {
|
||||
String codePath = al.getCodePath();
|
||||
|
||||
try {
|
||||
String jsonInput = objectMapper.writeValueAsString(al);
|
||||
String pythonExe = "E:\\Apps\\anaconda3\\python.exe";
|
||||
ProcessBuilder pb = new ProcessBuilder(pythonExe, codePath);
|
||||
Process process = pb.start();
|
||||
|
||||
try (OutputStream os = process.getOutputStream()) {
|
||||
os.write(jsonInput.getBytes(StandardCharsets.UTF_8));
|
||||
os.flush();
|
||||
}
|
||||
|
||||
String result;
|
||||
// 修改你 Java 代码中的这一段
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
result = reader.lines().collect(Collectors.joining("\n"));
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
if (exitCode != 0) {
|
||||
return "Python执行失败,错误码:" + exitCode;
|
||||
}
|
||||
|
||||
return objectMapper.readTree(result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "执行异常: " + e.getMessage();
|
||||
}
|
||||
}
|
||||
return "未找到算法";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询规则列表
|
||||
*/
|
||||
@ApiOperation("查询规则列表")
|
||||
@PreAuthorize("@ss.hasPermi('algo:algorithm:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Algorithm algorithm) {
|
||||
startPage();
|
||||
List<Algorithm> list = algorithmService.selectAlgorithmList(algorithm);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出规则列表
|
||||
*/
|
||||
@ApiOperation("导出规则列表")
|
||||
@PreAuthorize("@ss.hasPermi('algo:algorithm:export')")
|
||||
@Log(title = "规则", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, @RequestBody Algorithm algorithm) {
|
||||
List<Algorithm> list = algorithmService.selectAlgorithmList(algorithm);
|
||||
ExcelUtil<Algorithm> util = new ExcelUtil<Algorithm>(Algorithm.class);
|
||||
util.exportExcel(response, list, "规则数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取规则详细信息
|
||||
*/
|
||||
@ApiOperation("获取规则详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('algo:algorithm:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(algorithmService.selectAlgorithmById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增规则
|
||||
*/
|
||||
@ApiOperation("新增规则")
|
||||
@PreAuthorize("@ss.hasPermi('algo:algorithm:add')")
|
||||
@Log(title = "规则", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Algorithm algorithm) {
|
||||
return toAjax(algorithmService.insertAlgorithm(algorithm));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规则
|
||||
*/
|
||||
@ApiOperation("修改规则")
|
||||
@PreAuthorize("@ss.hasPermi('algo:algorithm:edit')")
|
||||
@Log(title = "规则", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Algorithm algorithm) {
|
||||
return toAjax(algorithmService.updateAlgorithm(algorithm));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除规则
|
||||
*/
|
||||
@ApiOperation("删除规则")
|
||||
@PreAuthorize("@ss.hasPermi('algo:algorithm:remove')")
|
||||
@Log(title = "规则", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(algorithmService.deleteAlgorithmByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package com.solution.web.controller.algo;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.solution.common.annotation.Log;
|
||||
import com.solution.common.core.controller.BaseController;
|
||||
import com.solution.common.core.domain.AjaxResult;
|
||||
import com.solution.common.enums.BusinessType;
|
||||
import com.solution.algo.domain.SysAlgoConfig;
|
||||
import com.solution.algo.service.ISysAlgoConfigService;
|
||||
import com.solution.common.utils.poi.ExcelUtil;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 动态规则配置Controller
|
||||
*
|
||||
* @author zouju
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/algo/algo")
|
||||
public class SysAlgoConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysAlgoConfigService sysAlgoConfigService;
|
||||
|
||||
/**
|
||||
* 查询动态规则配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('algo:algo:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysAlgoConfig sysAlgoConfig)
|
||||
{
|
||||
startPage();
|
||||
List<SysAlgoConfig> list = sysAlgoConfigService.selectSysAlgoConfigList(sysAlgoConfig);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出动态规则配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('algo:algo:export')")
|
||||
@Log(title = "动态规则配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysAlgoConfig sysAlgoConfig)
|
||||
{
|
||||
List<SysAlgoConfig> list = sysAlgoConfigService.selectSysAlgoConfigList(sysAlgoConfig);
|
||||
ExcelUtil<SysAlgoConfig> util = new ExcelUtil<SysAlgoConfig>(SysAlgoConfig.class);
|
||||
util.exportExcel(response, list, "动态规则配置数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取动态规则配置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('algo:algo:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(sysAlgoConfigService.selectSysAlgoConfigById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增动态规则配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('algo:algo:add')")
|
||||
@Log(title = "动态规则配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysAlgoConfig sysAlgoConfig)
|
||||
{
|
||||
return toAjax(sysAlgoConfigService.insertSysAlgoConfig(sysAlgoConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改动态规则配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('algo:algo:edit')")
|
||||
@Log(title = "动态规则配置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysAlgoConfig sysAlgoConfig)
|
||||
{
|
||||
return toAjax(sysAlgoConfigService.updateSysAlgoConfig(sysAlgoConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除动态规则配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('algo:algo:remove')")
|
||||
@Log(title = "动态规则配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysAlgoConfigService.deleteSysAlgoConfigByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.solution.web.controller.behaviour;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.solution.web.core.BehaviortreeProcessor;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -32,12 +33,15 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@Api("行为树管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/behaviortree")
|
||||
@RequestMapping("/api/system/behaviortree")
|
||||
public class BehaviortreeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBehaviortreeService behaviortreeService;
|
||||
|
||||
@Autowired
|
||||
private BehaviortreeProcessor behaviortreeProcessor;
|
||||
|
||||
/**
|
||||
* 查询行为树主列表
|
||||
*/
|
||||
@@ -84,7 +88,7 @@ public class BehaviortreeController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Behaviortree behaviortree)
|
||||
{
|
||||
return toAjax(behaviortreeService.insertBehaviortree(behaviortree));
|
||||
return toAjax(behaviortreeProcessor.create(behaviortree));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +100,7 @@ public class BehaviortreeController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Behaviortree behaviortree)
|
||||
{
|
||||
return toAjax(behaviortreeService.updateBehaviortree(behaviortree));
|
||||
return toAjax(behaviortreeProcessor.update(behaviortree));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@Api("节点连接管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/nodeconnection")
|
||||
@RequestMapping("/api/system/nodeconnection")
|
||||
public class NodeconnectionController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@Api("节点参数管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/nodeparameter")
|
||||
@RequestMapping("/api/system/nodeparameter")
|
||||
public class NodeparameterController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
|
||||
@@ -7,6 +7,11 @@ import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.solution.common.core.domain.R;
|
||||
import com.solution.system.domain.NodeTemplateEntity;
|
||||
import com.solution.system.domain.Nodeparameter;
|
||||
import com.solution.system.domain.Templateparameterdef;
|
||||
import com.solution.system.service.INodeparameterService;
|
||||
import com.solution.system.service.ITemplateparameterdefService;
|
||||
import com.solution.web.controller.behaviour.vo.NodetemplateDTO;
|
||||
import com.solution.web.controller.behaviour.vo.NodetemplateVO;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -14,6 +19,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@@ -39,11 +45,17 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@Api("节点模板管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/nodetemplate")
|
||||
@RequestMapping("/api/system/nodetemplate")
|
||||
public class NodetemplateController extends BaseController {
|
||||
@Autowired
|
||||
private INodetemplateService nodetemplateService;
|
||||
|
||||
@Autowired
|
||||
private INodeparameterService nodeparameterService;
|
||||
|
||||
@Autowired
|
||||
private ITemplateparameterdefService templateparameterdefService;
|
||||
|
||||
/**
|
||||
* 查询节点模板列表
|
||||
*/
|
||||
@@ -55,10 +67,29 @@ public class NodetemplateController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("节点模板列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:all')")
|
||||
@GetMapping("/all")
|
||||
public R<List<NodeTemplateEntity>> all() {
|
||||
Nodetemplate nodetemplate = new Nodetemplate();
|
||||
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return R.ok(null);
|
||||
}
|
||||
List<NodeTemplateEntity> entities = new ArrayList<>();
|
||||
for (Nodetemplate template : list) {
|
||||
Templateparameterdef def = new Templateparameterdef();
|
||||
def.setTemplateId(template.getId());
|
||||
List<Templateparameterdef> parameters = templateparameterdefService.selectTemplateparameterdefList(def);
|
||||
entities.add(new NodeTemplateEntity(template, parameters));
|
||||
}
|
||||
return R.ok(entities);
|
||||
}
|
||||
|
||||
@ApiOperation("节点模板列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:list')")
|
||||
@GetMapping("/listAll")
|
||||
public R<List<NodetemplateVO>> listAll() {
|
||||
public R<List<Nodetemplate>> listAll() {
|
||||
Nodetemplate nodetemplate = new Nodetemplate();
|
||||
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
@@ -72,18 +103,19 @@ public class NodetemplateController extends BaseController {
|
||||
dto.setDescription(template.getDescription());
|
||||
dto.setEnglishName(template.getEnglishName());
|
||||
dto.setLogicHandler(template.getLogicHandler());
|
||||
dto.setTemplateType(template.getTemplateType());
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.groupingBy(NodetemplateDTO::getTempleteType));
|
||||
.collect(Collectors.groupingBy(NodetemplateDTO::getTemplateType));
|
||||
List<NodetemplateVO> vos = new ArrayList<>();
|
||||
groupedByTemplateType.forEach((key, value) -> {
|
||||
// 处理逻辑
|
||||
NodetemplateVO vo = new NodetemplateVO();
|
||||
vo.setTempleteType(key);
|
||||
vo.setTemplateType(key);
|
||||
vo.setDtoList(value);
|
||||
vos.add(vo);
|
||||
});
|
||||
return R.ok(vos);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/templateparameterdef")
|
||||
@RequestMapping("/api/system/templateparameterdef")
|
||||
public class TemplateparameterdefController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
|
||||
@@ -48,7 +48,7 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@Api("行为树实例节点管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/treenodeinstance")
|
||||
@RequestMapping("/api/system/treenodeinstance")
|
||||
public class TreenodeinstanceController extends BaseController {
|
||||
@Autowired
|
||||
private ITreenodeinstanceService treenodeinstanceService;
|
||||
@@ -141,14 +141,15 @@ public class TreenodeinstanceController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:add')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/saveOrUpdate")
|
||||
public R<Integer> saveOrUpdate(@RequestBody Treenodeinstance treenodeinstance) {
|
||||
public R<Long> saveOrUpdate(@RequestBody Treenodeinstance treenodeinstance) {
|
||||
if (null == treenodeinstance.getId()) {
|
||||
//新增
|
||||
treenodeinstanceService.insertTreenodeinstance(treenodeinstance);
|
||||
Templateparameterdef templateparameterdef = new Templateparameterdef();
|
||||
templateparameterdef.setTemplateId(treenodeinstance.getTemplateId());
|
||||
List<Templateparameterdef> templateparameterdefs = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
|
||||
if (CollectionUtils.isEmpty(templateparameterdefs)) {
|
||||
return R.ok(treenodeinstanceService.insertTreenodeinstance(treenodeinstance));
|
||||
return R.ok(treenodeinstance.getId());
|
||||
}
|
||||
templateparameterdefs.forEach(t -> {
|
||||
Nodeparameter nodeparameter = new Nodeparameter();
|
||||
@@ -158,7 +159,8 @@ public class TreenodeinstanceController extends BaseController {
|
||||
nodeparameterService.insertNodeparameter(nodeparameter);
|
||||
});
|
||||
}
|
||||
return R.ok(treenodeinstanceService.updateTreenodeinstance(treenodeinstance));
|
||||
treenodeinstanceService.updateTreenodeinstance(treenodeinstance);
|
||||
return R.ok(treenodeinstance.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@ public class NodetemplateDTO {
|
||||
@ApiModelProperty("afsim 中转换的节点名")
|
||||
private String englishName;
|
||||
|
||||
private String templeteType;
|
||||
private String templateType;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
@@ -65,11 +65,11 @@ public class NodetemplateDTO {
|
||||
this.englishName = englishName;
|
||||
}
|
||||
|
||||
public String getTempleteType() {
|
||||
return templeteType;
|
||||
public String getTemplateType() {
|
||||
return templateType;
|
||||
}
|
||||
|
||||
public void setTempleteType(String templeteType) {
|
||||
this.templeteType = templeteType;
|
||||
public void setTemplateType(String templateType) {
|
||||
this.templateType = templateType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,17 +9,17 @@ import java.util.List;
|
||||
public class NodetemplateVO {
|
||||
/** 模版类型,节点模版或者条件判断,例如“node”,precondition“ */
|
||||
@ApiModelProperty("模版类型,节点模版或者条件判断,例如“node”,precondition“")
|
||||
private String templeteType;
|
||||
private String templateType;
|
||||
|
||||
@ApiModelProperty("节点模板数据")
|
||||
private List<NodetemplateDTO> dtoList;
|
||||
|
||||
public String getTempleteType() {
|
||||
return templeteType;
|
||||
public String getTemplateType() {
|
||||
return templateType;
|
||||
}
|
||||
|
||||
public void setTempleteType(String templeteType) {
|
||||
this.templeteType = templeteType;
|
||||
public void setTemplateType(String templateType) {
|
||||
this.templateType = templateType;
|
||||
}
|
||||
|
||||
public List<NodetemplateDTO> getDtoList() {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.solution.web.controller.rule;
|
||||
|
||||
import com.solution.common.core.controller.BaseController;
|
||||
import com.solution.common.core.domain.AjaxResult;
|
||||
import com.solution.rule.domain.dto.RequestDTO;
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import com.solution.rule.service.RuleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Api("火力规则")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/firerule")
|
||||
public class RuleController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private RuleService ruleService;
|
||||
|
||||
|
||||
/**
|
||||
* 开始执行规则匹配
|
||||
* @param sceneType 场景参数
|
||||
* @param weaponModelDTO 敌方参数
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/start")
|
||||
@ApiOperation("开始执行规则匹配")
|
||||
public AjaxResult execute(Integer sceneType, WeaponModelDTO weaponModelDTO){
|
||||
return success(ruleService.execute(sceneType,weaponModelDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有武器平台和组件
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/weapon")
|
||||
@ApiOperation("获取所有武器平台和组件")
|
||||
public AjaxResult getPlatformComponentNames(){
|
||||
return success(ruleService.getPlatformComponentNames());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.solution.web.core;
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.solution.system.domain.*;
|
||||
import com.solution.system.service.IBehaviortreeService;
|
||||
import com.solution.system.service.INodeconnectionService;
|
||||
import com.solution.system.service.INodeparameterService;
|
||||
import com.solution.system.service.ITreenodeinstanceService;
|
||||
import com.solution.web.core.graph.Graph;
|
||||
import com.solution.web.core.graph.GraphEdge;
|
||||
import com.solution.web.core.graph.GraphNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class BehaviortreeProcessor {
|
||||
|
||||
@Autowired
|
||||
private IBehaviortreeService behaviortreeService;
|
||||
|
||||
@Autowired
|
||||
private ITreenodeinstanceService treenodeinstanceService;
|
||||
|
||||
@Autowired
|
||||
private INodeparameterService nodeparameterService;
|
||||
|
||||
@Autowired
|
||||
private INodeconnectionService nodeconnectionService;
|
||||
|
||||
private ObjectMapper objectMapper = createObjectMapper();
|
||||
|
||||
public static ObjectMapper createObjectMapper() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
public int create(Behaviortree behaviortree) {
|
||||
int result = behaviortreeService.insertBehaviortree(behaviortree);
|
||||
processGraph(behaviortree);
|
||||
return result;
|
||||
}
|
||||
|
||||
public int update(Behaviortree behaviortree) {
|
||||
int result = behaviortreeService.updateBehaviortree(behaviortree);
|
||||
|
||||
// 删除节点实例
|
||||
treenodeinstanceService.deleteByTreeId(behaviortree.getId());
|
||||
|
||||
// 删除参数
|
||||
nodeparameterService.deleteByTreeId(behaviortree.getId());
|
||||
|
||||
// 删除连线
|
||||
nodeconnectionService.deleteByTreeId(behaviortree.getId());
|
||||
|
||||
processGraph(behaviortree);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void processGraph(Behaviortree behaviortree) {
|
||||
|
||||
Graph graph = null;
|
||||
try {
|
||||
graph = objectMapper.readValue(behaviortree.getXmlContent(), Graph.class);
|
||||
} catch (Exception e) {
|
||||
// skip
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (null == graph) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 插入节点 treenodeinstance
|
||||
Map<String, Treenodeinstance> instanceKeyMap = new HashMap<>();
|
||||
Map<String, Long> nodeKeyIndexMap = new HashMap<>();
|
||||
if (graph.hasNodes()) {
|
||||
Long index = 0L;
|
||||
for (GraphNode node : graph.getNodes()) {
|
||||
Treenodeinstance instance = createNodeInstance(behaviortree, node);
|
||||
treenodeinstanceService.insertTreenodeinstance(instance);
|
||||
instanceKeyMap.put(node.getKey(), instance);
|
||||
|
||||
if (node.hasParameters()) {
|
||||
// 插入parameter nodeparameter
|
||||
for (Templateparameterdef parameter : node.getParameters()) {
|
||||
Nodeparameter nodeparameter = createNodeParameter(behaviortree, parameter, instance);
|
||||
nodeparameterService.insertNodeparameter(nodeparameter);
|
||||
}
|
||||
}
|
||||
nodeKeyIndexMap.put(node.getKey(), index);
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
// 插入连线 nodeconnection
|
||||
if (graph.hasEdges()) {
|
||||
for (GraphEdge edge : graph.getEdges()) {
|
||||
Nodeconnection connection = createConnection(behaviortree, edge, instanceKeyMap, nodeKeyIndexMap);
|
||||
nodeconnectionService.insertNodeconnection(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Nodeconnection createConnection(Behaviortree behaviortree, GraphEdge edge,
|
||||
Map<String, Treenodeinstance> instanceKeyMap,
|
||||
Map<String, Long> nodeKeyIndexMap) {
|
||||
Nodeconnection connection = new Nodeconnection();
|
||||
connection.setTreeId(behaviortree.getId());
|
||||
if (null != instanceKeyMap.get(edge.getSource().getCell())) {
|
||||
Treenodeinstance parent = instanceKeyMap.get(edge.getSource().getCell());
|
||||
connection.setParentNodeId(parent.getId());
|
||||
}
|
||||
if (null != instanceKeyMap.get(edge.getTarget().getCell())) {
|
||||
Treenodeinstance children = instanceKeyMap.get(edge.getTarget().getCell());
|
||||
connection.setChildNodeId(children.getId());
|
||||
}
|
||||
if (null != nodeKeyIndexMap.get(edge.getSource().getCell())) {
|
||||
connection.setOrderIndex(nodeKeyIndexMap.get(edge.getSource().getCell()));
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
private Nodeparameter createNodeParameter(Behaviortree behaviortree, Templateparameterdef parameter,
|
||||
Treenodeinstance instance) {
|
||||
Nodeparameter nodeparameter = new Nodeparameter();
|
||||
nodeparameter.setTreeId(behaviortree.getId());
|
||||
nodeparameter.setNodeInstanceId(instance.getId());
|
||||
nodeparameter.setParamDefId(parameter.getId());
|
||||
nodeparameter.setValue(parameter.getDefaultValue());
|
||||
return nodeparameter;
|
||||
}
|
||||
|
||||
private Treenodeinstance createNodeInstance(Behaviortree behaviortree, GraphNode node) {
|
||||
Treenodeinstance instance = new Treenodeinstance();
|
||||
instance.setTreeId(behaviortree.getId());
|
||||
instance.setTemplateId((long) node.getTemplate());
|
||||
instance.setInstanceName(node.getName());
|
||||
instance.setIsRoot((long) (node.isRoot() ? 1 : 0));
|
||||
if ("precondition".equalsIgnoreCase(node.getTemplateType())) {
|
||||
instance.setPreconditionTempleteId((long) node.getTemplate());
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.solution.web.core.graph;
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class Graph implements Serializable {
|
||||
|
||||
private List<GraphNode> nodes;
|
||||
|
||||
private List<GraphEdge> edges;
|
||||
|
||||
public boolean hasNodes() {
|
||||
return nodes != null && !nodes.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasEdges() {
|
||||
return edges != null && !edges.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Graph{" +
|
||||
"nodes=" + nodes +
|
||||
", edges=" + edges +
|
||||
'}';
|
||||
}
|
||||
|
||||
public List<GraphNode> getNodes() {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public void setNodes(List<GraphNode> nodes) {
|
||||
this.nodes = nodes;
|
||||
}
|
||||
|
||||
public List<GraphEdge> getEdges() {
|
||||
return edges;
|
||||
}
|
||||
|
||||
public void setEdges(List<GraphEdge> edges) {
|
||||
this.edges = edges;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.solution.web.core.graph;
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class GraphEdge implements Serializable {
|
||||
|
||||
private String key;
|
||||
|
||||
private Line source;
|
||||
|
||||
private Line target;
|
||||
|
||||
public boolean hasSource() {
|
||||
return source != null && StringUtils.hasText(source.cell);
|
||||
}
|
||||
|
||||
public boolean hasTarget() {
|
||||
return target != null && StringUtils.hasText(target.cell);
|
||||
}
|
||||
|
||||
public static class Line implements Serializable {
|
||||
|
||||
private String cell;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Line{" +
|
||||
"cell='" + cell + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getCell() {
|
||||
return cell;
|
||||
}
|
||||
|
||||
public void setCell(String cell) {
|
||||
this.cell = cell;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GraphEdge{" +
|
||||
"key='" + key + '\'' +
|
||||
", source='" + source + '\'' +
|
||||
", target='" + target + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public Line getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(Line source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public Line getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(Line target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.solution.web.core.graph;
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import com.solution.system.domain.Templateparameterdef;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class GraphNode implements Serializable {
|
||||
|
||||
private int id;
|
||||
|
||||
private int template;
|
||||
|
||||
private String templateType;
|
||||
|
||||
private String type;
|
||||
|
||||
private String key;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private String category;
|
||||
|
||||
private List<Templateparameterdef> parameters;
|
||||
|
||||
private List<GraphVariable> variables;
|
||||
|
||||
public boolean hasParameters() {
|
||||
return parameters != null && !parameters.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasVariables() {
|
||||
return variables != null && !variables.isEmpty();
|
||||
}
|
||||
|
||||
public boolean isRoot() {
|
||||
return "root".equalsIgnoreCase(this.category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GraphNode{" +
|
||||
"id=" + id +
|
||||
", key='" + key + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", parameters=" + parameters +
|
||||
", variables=" + variables +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getTemplateType() {
|
||||
return templateType;
|
||||
}
|
||||
|
||||
public void setTemplateType(String templateType) {
|
||||
this.templateType = templateType;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
public void setTemplate(int template) {
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public List<Templateparameterdef> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setParameters(List<Templateparameterdef> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public List<GraphVariable> getVariables() {
|
||||
return variables;
|
||||
}
|
||||
|
||||
public void setVariables(List<GraphVariable> variables) {
|
||||
this.variables = variables;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.solution.web.core.graph;
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class GraphVariable implements Serializable {
|
||||
|
||||
private String key;
|
||||
|
||||
private String value;
|
||||
|
||||
private String defaults;
|
||||
|
||||
private String unit;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GraphVariable{" +
|
||||
"key='" + key + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
", defaults='" + defaults + '\'' +
|
||||
", unit='" + unit + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getDefaults() {
|
||||
return defaults;
|
||||
}
|
||||
|
||||
public void setDefaults(String defaults) {
|
||||
this.defaults = defaults;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,9 +6,11 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://192.168.166.71:3306/behaviortreedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://192.168.166.71:3306/behaviortreedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://localhost:3306/autosolution_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: 123456
|
||||
# password: 123456
|
||||
password: 1234
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
||||
@@ -67,13 +67,15 @@ spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 192.168.166.71
|
||||
# host: 192.168.166.71
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password:
|
||||
# password:
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
@@ -104,6 +106,8 @@ mybatis:
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.solution.algo;
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.type.CollectionType;
|
||||
import com.solution.algo.domain.AlgorithmConfig;
|
||||
import org.apache.ibatis.type.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@MappedTypes(List.class)
|
||||
@MappedJdbcTypes({
|
||||
JdbcType.VARCHAR,
|
||||
JdbcType.BLOB
|
||||
})
|
||||
public class AlgorithmConfigTypeHandler extends BaseTypeHandler<List<AlgorithmConfig>>
|
||||
implements TypeHandler<List<AlgorithmConfig>> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
private final CollectionType collectionType = objectMapper.getTypeFactory()
|
||||
.constructCollectionType(List.class, AlgorithmConfig.class);
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, List<AlgorithmConfig> parameter, JdbcType jdbcType)
|
||||
throws SQLException {
|
||||
ps.setString(i, serialize(parameter));
|
||||
}
|
||||
|
||||
public String serialize(List<AlgorithmConfig> indicatorConfig) {
|
||||
if (null != indicatorConfig) {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(indicatorConfig);
|
||||
} catch (Exception e) {
|
||||
logger.error("Can not serialize", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<AlgorithmConfig> deserialize(String config) throws SQLException {
|
||||
if (StringUtils.hasText(config)) {
|
||||
try {
|
||||
return objectMapper.readValue(config, collectionType);
|
||||
} catch (Exception e) {
|
||||
logger.error("Can not deserialize", e);
|
||||
}
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlgorithmConfig> getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
String jsonValue = rs.getString(columnName);
|
||||
return deserialize(jsonValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlgorithmConfig> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
String jsonValue = rs.getString(columnIndex);
|
||||
return deserialize(jsonValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlgorithmConfig> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
String jsonValue = cs.getString(columnIndex);
|
||||
return deserialize(jsonValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.solution.algo.domain;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.solution.common.annotation.Excel;
|
||||
import com.solution.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 规则对象 algorithm
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
public class Algorithm
|
||||
{
|
||||
|
||||
/** */
|
||||
private Long id;
|
||||
|
||||
/** 算法名称 */
|
||||
@Excel(name = "算法名称")
|
||||
private String name;
|
||||
|
||||
/** 业务类型 */
|
||||
@Excel(name = "业务类型")
|
||||
private String type;
|
||||
|
||||
/** 算法文件路径 */
|
||||
@Excel(name = "算法文件路径")
|
||||
private String codePath;
|
||||
|
||||
/** 算法描述 */
|
||||
@Excel(name = "算法描述")
|
||||
private String description;
|
||||
|
||||
/** 算法配置 */
|
||||
@Excel(name = "算法配置")
|
||||
private String algoConfig;
|
||||
|
||||
/** 算法配置 */
|
||||
private List<AlgorithmConfig> algoConfigList;
|
||||
|
||||
/** 算法参数定义信息 */
|
||||
private List<AlgorithmParam> algorithmParamList;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setCodePath(String codePath)
|
||||
{
|
||||
this.codePath = codePath;
|
||||
}
|
||||
|
||||
public String getCodePath()
|
||||
{
|
||||
return codePath;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setAlgoConfig(String algoConfig)
|
||||
{
|
||||
this.algoConfig = algoConfig;
|
||||
}
|
||||
|
||||
public String getAlgoConfig()
|
||||
{
|
||||
return algoConfig;
|
||||
}
|
||||
|
||||
public List<AlgorithmParam> getAlgorithmParamList()
|
||||
{
|
||||
return algorithmParamList;
|
||||
}
|
||||
|
||||
public void setAlgorithmParamList(List<AlgorithmParam> algorithmParamList)
|
||||
{
|
||||
this.algorithmParamList = algorithmParamList;
|
||||
}
|
||||
|
||||
public List<AlgorithmConfig> getAlgoConfigList() {
|
||||
return algoConfigList;
|
||||
}
|
||||
|
||||
public void setAlgoConfigList(List<AlgorithmConfig> algoConfigList) {
|
||||
this.algoConfigList = algoConfigList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("type", getType())
|
||||
.append("codePath", getCodePath())
|
||||
.append("description", getDescription())
|
||||
.append("algoConfig", getAlgoConfig())
|
||||
.append("algorithmParamList", getAlgorithmParamList())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.solution.algo.domain;
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AlgorithmConfig implements Serializable {
|
||||
|
||||
private String name;
|
||||
|
||||
private String operation;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getOperation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
public void setOperation(String operation) {
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.solution.algo.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.solution.common.annotation.Excel;
|
||||
import com.solution.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 算法参数定义对象 algorithm_param
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
public class AlgorithmParam
|
||||
{
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 算法ID */
|
||||
@Excel(name = "算法ID")
|
||||
private Long algorithmId;
|
||||
|
||||
/** 参数名 */
|
||||
@Excel(name = "参数名")
|
||||
private String paramName;
|
||||
|
||||
/** 默认值 */
|
||||
@Excel(name = "默认值")
|
||||
private String defaultValue;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setAlgorithmId(Long algorithmId)
|
||||
{
|
||||
this.algorithmId = algorithmId;
|
||||
}
|
||||
|
||||
public Long getAlgorithmId()
|
||||
{
|
||||
return algorithmId;
|
||||
}
|
||||
public void setParamName(String paramName)
|
||||
{
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public String getParamName()
|
||||
{
|
||||
return paramName;
|
||||
}
|
||||
public void setDefaultValue(String defaultValue)
|
||||
{
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getDefaultValue()
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("algorithmId", getAlgorithmId())
|
||||
.append("paramName", getParamName())
|
||||
.append("defaultValue", getDefaultValue())
|
||||
.append("description", getDescription())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
package com.solution.algo.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.solution.common.annotation.Excel;
|
||||
import com.solution.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 动态规则配置对象 sys_algo_config
|
||||
*
|
||||
* @author zouju
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public class SysAlgoConfig extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 算法唯一标识(Type),用于接口路由 */
|
||||
@Excel(name = "算法唯一标识(Type),用于接口路由")
|
||||
private String algoType;
|
||||
|
||||
/** 算法名称,后台展示用 */
|
||||
@Excel(name = "算法名称,后台展示用")
|
||||
private String algoName;
|
||||
|
||||
/** 执行引擎类型: GROOVY, PYTHON, JS, LUA等 */
|
||||
@Excel(name = "执行引擎类型: GROOVY, PYTHON, JS, LUA等")
|
||||
private String engineType;
|
||||
|
||||
/** 参数定义模型(JSON Schema),用于自动校验入参 */
|
||||
@Excel(name = "参数定义模型(JSON Schema),用于自动校验入参")
|
||||
private String inputSchema;
|
||||
|
||||
/** 算法脚本代码或规则表达式 */
|
||||
@Excel(name = "算法脚本代码或规则表达式")
|
||||
private String scriptContent;
|
||||
|
||||
/** 算法描述 */
|
||||
@Excel(name = "算法描述")
|
||||
private String description;
|
||||
|
||||
/** 状态: 1-启用, 0-禁用 */
|
||||
@Excel(name = "状态: 1-启用, 0-禁用")
|
||||
private Long status;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date createdAt;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date updatedAt;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setAlgoType(String algoType)
|
||||
{
|
||||
this.algoType = algoType;
|
||||
}
|
||||
|
||||
public String getAlgoType()
|
||||
{
|
||||
return algoType;
|
||||
}
|
||||
|
||||
public void setAlgoName(String algoName)
|
||||
{
|
||||
this.algoName = algoName;
|
||||
}
|
||||
|
||||
public String getAlgoName()
|
||||
{
|
||||
return algoName;
|
||||
}
|
||||
|
||||
public void setEngineType(String engineType)
|
||||
{
|
||||
this.engineType = engineType;
|
||||
}
|
||||
|
||||
public String getEngineType()
|
||||
{
|
||||
return engineType;
|
||||
}
|
||||
|
||||
public void setInputSchema(String inputSchema)
|
||||
{
|
||||
this.inputSchema = inputSchema;
|
||||
}
|
||||
|
||||
public String getInputSchema()
|
||||
{
|
||||
return inputSchema;
|
||||
}
|
||||
|
||||
public void setScriptContent(String scriptContent)
|
||||
{
|
||||
this.scriptContent = scriptContent;
|
||||
}
|
||||
|
||||
public String getScriptContent()
|
||||
{
|
||||
return scriptContent;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setStatus(Long status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt)
|
||||
{
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Date getCreatedAt()
|
||||
{
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Date updatedAt)
|
||||
{
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public Date getUpdatedAt()
|
||||
{
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("algoType", getAlgoType())
|
||||
.append("algoName", getAlgoName())
|
||||
.append("engineType", getEngineType())
|
||||
.append("inputSchema", getInputSchema())
|
||||
.append("scriptContent", getScriptContent())
|
||||
.append("description", getDescription())
|
||||
.append("status", getStatus())
|
||||
.append("createdAt", getCreatedAt())
|
||||
.append("updatedAt", getUpdatedAt())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.solution.algo.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.algo.domain.Algorithm;
|
||||
import com.solution.algo.domain.AlgorithmParam;
|
||||
|
||||
/**
|
||||
* 规则Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
public interface AlgorithmMapper
|
||||
{
|
||||
/**
|
||||
* 查询规则
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 规则
|
||||
*/
|
||||
public Algorithm selectAlgorithmById(Long id);
|
||||
|
||||
/**
|
||||
* 查询规则列表
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 规则集合
|
||||
*/
|
||||
public List<Algorithm> selectAlgorithmList(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 新增规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAlgorithm(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 修改规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAlgorithm(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 删除规则
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除规则
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除算法参数定义
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmParamByAlgorithmIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增算法参数定义
|
||||
*
|
||||
* @param algorithmParamList 算法参数定义列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchAlgorithmParam(List<AlgorithmParam> algorithmParamList);
|
||||
|
||||
|
||||
/**
|
||||
* 通过规则主键删除算法参数定义信息
|
||||
*
|
||||
* @param id 规则ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmParamByAlgorithmId(Long id);
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.solution.algo.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.algo.domain.SysAlgoConfig;
|
||||
|
||||
/**
|
||||
* 动态规则配置Mapper接口
|
||||
*
|
||||
* @author zouju
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface SysAlgoConfigMapper
|
||||
{
|
||||
/**
|
||||
* 查询动态规则配置
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 动态规则配置
|
||||
*/
|
||||
public SysAlgoConfig selectSysAlgoConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询动态规则配置列表
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 动态规则配置集合
|
||||
*/
|
||||
public List<SysAlgoConfig> selectSysAlgoConfigList(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 新增动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 修改动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 删除动态规则配置
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAlgoConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除动态规则配置
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAlgoConfigByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.solution.algo.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.algo.domain.Algorithm;
|
||||
|
||||
/**
|
||||
* 规则Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
public interface IAlgorithmService
|
||||
{
|
||||
/**
|
||||
* 查询规则
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 规则
|
||||
*/
|
||||
public Algorithm selectAlgorithmById(Long id);
|
||||
|
||||
/**
|
||||
* 查询规则列表
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 规则集合
|
||||
*/
|
||||
public List<Algorithm> selectAlgorithmList(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 新增规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAlgorithm(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 修改规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAlgorithm(Algorithm algorithm);
|
||||
|
||||
/**
|
||||
* 批量删除规则
|
||||
*
|
||||
* @param ids 需要删除的规则主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除规则信息
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlgorithmById(Long id);
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.solution.algo.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.algo.domain.SysAlgoConfig;
|
||||
|
||||
/**
|
||||
* 动态规则配置Service接口
|
||||
*
|
||||
* @author zouju
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface ISysAlgoConfigService
|
||||
{
|
||||
/**
|
||||
* 查询动态规则配置
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 动态规则配置
|
||||
*/
|
||||
public SysAlgoConfig selectSysAlgoConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询动态规则配置列表
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 动态规则配置集合
|
||||
*/
|
||||
public List<SysAlgoConfig> selectSysAlgoConfigList(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 新增动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 修改动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
|
||||
|
||||
/**
|
||||
* 批量删除动态规则配置
|
||||
*
|
||||
* @param ids 需要删除的动态规则配置主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAlgoConfigByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除动态规则配置信息
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysAlgoConfigById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.solution.algo.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import com.solution.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.solution.algo.domain.AlgorithmParam;
|
||||
import com.solution.algo.mapper.AlgorithmMapper;
|
||||
import com.solution.algo.domain.Algorithm;
|
||||
import com.solution.algo.service.IAlgorithmService;
|
||||
|
||||
/**
|
||||
* 规则Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
@Service
|
||||
public class AlgorithmServiceImpl implements IAlgorithmService
|
||||
{
|
||||
@Autowired
|
||||
private AlgorithmMapper algorithmMapper;
|
||||
|
||||
/**
|
||||
* 查询规则
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 规则
|
||||
*/
|
||||
@Override
|
||||
public Algorithm selectAlgorithmById(Long id)
|
||||
{
|
||||
return algorithmMapper.selectAlgorithmById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询规则列表
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 规则
|
||||
*/
|
||||
@Override
|
||||
public List<Algorithm> selectAlgorithmList(Algorithm algorithm)
|
||||
{
|
||||
return algorithmMapper.selectAlgorithmList(algorithm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int insertAlgorithm(Algorithm algorithm)
|
||||
{
|
||||
int rows = algorithmMapper.insertAlgorithm(algorithm);
|
||||
insertAlgorithmParam(algorithm);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规则
|
||||
*
|
||||
* @param algorithm 规则
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateAlgorithm(Algorithm algorithm)
|
||||
{
|
||||
algorithmMapper.deleteAlgorithmParamByAlgorithmId(algorithm.getId());
|
||||
insertAlgorithmParam(algorithm);
|
||||
return algorithmMapper.updateAlgorithm(algorithm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除规则
|
||||
*
|
||||
* @param ids 需要删除的规则主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteAlgorithmByIds(Long[] ids)
|
||||
{
|
||||
algorithmMapper.deleteAlgorithmParamByAlgorithmIds(ids);
|
||||
return algorithmMapper.deleteAlgorithmByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除规则信息
|
||||
*
|
||||
* @param id 规则主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteAlgorithmById(Long id)
|
||||
{
|
||||
algorithmMapper.deleteAlgorithmParamByAlgorithmId(id);
|
||||
return algorithmMapper.deleteAlgorithmById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增算法参数定义信息
|
||||
*
|
||||
* @param algorithm 规则对象
|
||||
*/
|
||||
public void insertAlgorithmParam(Algorithm algorithm)
|
||||
{
|
||||
List<AlgorithmParam> algorithmParamList = algorithm.getAlgorithmParamList();
|
||||
Long id = algorithm.getId();
|
||||
if (StringUtils.isNotNull(algorithmParamList))
|
||||
{
|
||||
List<AlgorithmParam> list = new ArrayList<AlgorithmParam>();
|
||||
for (AlgorithmParam algorithmParam : algorithmParamList)
|
||||
{
|
||||
algorithmParam.setAlgorithmId(id);
|
||||
list.add(algorithmParam);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
algorithmMapper.batchAlgorithmParam(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package com.solution.algo.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.solution.algo.mapper.SysAlgoConfigMapper;
|
||||
import com.solution.algo.domain.SysAlgoConfig;
|
||||
import com.solution.algo.service.ISysAlgoConfigService;
|
||||
|
||||
/**
|
||||
* 动态规则配置Service业务层处理
|
||||
*
|
||||
* @author zouju
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
public class SysAlgoConfigServiceImpl implements ISysAlgoConfigService
|
||||
{
|
||||
@Autowired
|
||||
private SysAlgoConfigMapper sysAlgoConfigMapper;
|
||||
|
||||
/**
|
||||
* 查询动态规则配置
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 动态规则配置
|
||||
*/
|
||||
@Override
|
||||
public SysAlgoConfig selectSysAlgoConfigById(Long id)
|
||||
{
|
||||
return sysAlgoConfigMapper.selectSysAlgoConfigById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询动态规则配置列表
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 动态规则配置
|
||||
*/
|
||||
@Override
|
||||
public List<SysAlgoConfig> selectSysAlgoConfigList(SysAlgoConfig sysAlgoConfig)
|
||||
{
|
||||
return sysAlgoConfigMapper.selectSysAlgoConfigList(sysAlgoConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysAlgoConfig(SysAlgoConfig sysAlgoConfig)
|
||||
{
|
||||
return sysAlgoConfigMapper.insertSysAlgoConfig(sysAlgoConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改动态规则配置
|
||||
*
|
||||
* @param sysAlgoConfig 动态规则配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysAlgoConfig(SysAlgoConfig sysAlgoConfig)
|
||||
{
|
||||
return sysAlgoConfigMapper.updateSysAlgoConfig(sysAlgoConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除动态规则配置
|
||||
*
|
||||
* @param ids 需要删除的动态规则配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysAlgoConfigByIds(Long[] ids)
|
||||
{
|
||||
return sysAlgoConfigMapper.deleteSysAlgoConfigByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除动态规则配置信息
|
||||
*
|
||||
* @param id 动态规则配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysAlgoConfigById(Long id)
|
||||
{
|
||||
return sysAlgoConfigMapper.deleteSysAlgoConfigById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.solution.algo.mapper.AlgorithmMapper">
|
||||
|
||||
<resultMap type="Algorithm" id="AlgorithmResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="type" column="type" />
|
||||
<result property="codePath" column="code_path" />
|
||||
<result property="description" column="description" />
|
||||
<result property="algoConfig" column="algo_config" />
|
||||
<result property="algoConfigList" column="algo_config_list" typeHandler="com.solution.algo.AlgorithmConfigTypeHandler" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="AlgorithmAlgorithmParamResult" type="Algorithm" extends="AlgorithmResult">
|
||||
<collection property="algorithmParamList" ofType="AlgorithmParam" column="id" select="selectAlgorithmParamList" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="AlgorithmParam" id="AlgorithmParamResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="algorithmId" column="algorithm_id" />
|
||||
<result property="paramName" column="param_name" />
|
||||
<result property="defaultValue" column="default_value" />
|
||||
<result property="description" column="description" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAlgorithmVo">
|
||||
select id, name, type, code_path, description, algo_config, algo_config_list from algorithm
|
||||
</sql>
|
||||
|
||||
<select id="selectAlgorithmList" parameterType="Algorithm" resultMap="AlgorithmAlgorithmParamResult">
|
||||
<include refid="selectAlgorithmVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="codePath != null and codePath != ''"> and code_path = #{codePath}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="algoConfig != null and algoConfig != ''"> and algo_config = #{algoConfig}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAlgorithmById" parameterType="Long" resultMap="AlgorithmAlgorithmParamResult">
|
||||
select id, name, type, code_path, description, algo_config
|
||||
from algorithm
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectAlgorithmParamList" resultMap="AlgorithmParamResult">
|
||||
select id, algorithm_id, param_name, default_value, description
|
||||
from algorithm_param
|
||||
where algorithm_id = #{algorithm_id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAlgorithm" parameterType="Algorithm" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into algorithm
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="codePath != null">code_path,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="algoConfig != null">algo_config,</if>
|
||||
<if test="algoConfigList != null">algo_config_list,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="codePath != null">#{codePath},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="algoConfig != null">#{algoConfig},</if>
|
||||
<if test="algoConfigList != null">#{algoConfigList,typeHandler=com.solution.algo.AlgorithmConfigTypeHandler},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAlgorithm" parameterType="Algorithm">
|
||||
update algorithm
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="codePath != null">code_path = #{codePath},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="algoConfig != null">algo_config = #{algoConfig},</if>
|
||||
<if test="algoConfigList != null">algo_config_list = #{algoConfigList,typeHandler=com.solution.algo.AlgorithmConfigTypeHandler},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAlgorithmById" parameterType="Long">
|
||||
delete from algorithm where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAlgorithmByIds" parameterType="String">
|
||||
delete from algorithm where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAlgorithmParamByAlgorithmIds" parameterType="String">
|
||||
delete from algorithm_param where algorithm_id in
|
||||
<foreach item="algorithmId" collection="array" open="(" separator="," close=")">
|
||||
#{algorithmId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAlgorithmParamByAlgorithmId" parameterType="Long">
|
||||
delete from algorithm_param where algorithm_id = #{algorithmId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchAlgorithmParam">
|
||||
insert into algorithm_param( id, algorithm_id, param_name, default_value, description) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.algorithmId}, #{item.paramName}, #{item.defaultValue}, #{item.description})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.solution.algo.mapper.SysAlgoConfigMapper">
|
||||
|
||||
<resultMap type="SysAlgoConfig" id="SysAlgoConfigResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="algoType" column="algo_type" />
|
||||
<result property="algoName" column="algo_name" />
|
||||
<result property="engineType" column="engine_type" />
|
||||
<result property="inputSchema" column="input_schema" />
|
||||
<result property="scriptContent" column="script_content" />
|
||||
<result property="description" column="description" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="updatedAt" column="updated_at" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysAlgoConfigVo">
|
||||
select id, algo_type, algo_name, engine_type, input_schema, script_content, description, status, created_at, updated_at from sys_algo_config
|
||||
</sql>
|
||||
|
||||
<select id="selectSysAlgoConfigList" parameterType="SysAlgoConfig" resultMap="SysAlgoConfigResult">
|
||||
<include refid="selectSysAlgoConfigVo"/>
|
||||
<where>
|
||||
<if test="algoType != null and algoType != ''"> and algo_type = #{algoType}</if>
|
||||
<if test="algoName != null and algoName != ''"> and algo_name like concat('%', #{algoName}, '%')</if>
|
||||
<if test="engineType != null and engineType != ''"> and engine_type = #{engineType}</if>
|
||||
<if test="inputSchema != null and inputSchema != ''"> and input_schema = #{inputSchema}</if>
|
||||
<if test="scriptContent != null and scriptContent != ''"> and script_content = #{scriptContent}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="createdAt != null "> and created_at = #{createdAt}</if>
|
||||
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysAlgoConfigById" parameterType="Long" resultMap="SysAlgoConfigResult">
|
||||
<include refid="selectSysAlgoConfigVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysAlgoConfig" parameterType="SysAlgoConfig" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_algo_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="algoType != null and algoType != ''">algo_type,</if>
|
||||
<if test="algoName != null and algoName != ''">algo_name,</if>
|
||||
<if test="engineType != null and engineType != ''">engine_type,</if>
|
||||
<if test="inputSchema != null">input_schema,</if>
|
||||
<if test="scriptContent != null">script_content,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createdAt != null">created_at,</if>
|
||||
<if test="updatedAt != null">updated_at,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="algoType != null and algoType != ''">#{algoType},</if>
|
||||
<if test="algoName != null and algoName != ''">#{algoName},</if>
|
||||
<if test="engineType != null and engineType != ''">#{engineType},</if>
|
||||
<if test="inputSchema != null">#{inputSchema},</if>
|
||||
<if test="scriptContent != null">#{scriptContent},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createdAt != null">#{createdAt},</if>
|
||||
<if test="updatedAt != null">#{updatedAt},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysAlgoConfig" parameterType="SysAlgoConfig">
|
||||
update sys_algo_config
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="algoType != null and algoType != ''">algo_type = #{algoType},</if>
|
||||
<if test="algoName != null and algoName != ''">algo_name = #{algoName},</if>
|
||||
<if test="engineType != null and engineType != ''">engine_type = #{engineType},</if>
|
||||
<if test="inputSchema != null">input_schema = #{inputSchema},</if>
|
||||
<if test="scriptContent != null">script_content = #{scriptContent},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysAlgoConfigById" parameterType="Long">
|
||||
delete from sys_algo_config where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysAlgoConfigByIds" parameterType="String">
|
||||
delete from sys_algo_config where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.solution.system.domain;
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NodeTemplateEntity extends Nodetemplate {
|
||||
|
||||
private List<Templateparameterdef> parameters = new ArrayList<>();
|
||||
|
||||
public NodeTemplateEntity() {
|
||||
}
|
||||
|
||||
public NodeTemplateEntity(List<Templateparameterdef> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public NodeTemplateEntity(NodeTemplateEntity entity) {
|
||||
super(entity);
|
||||
this.parameters = entity.getParameters();
|
||||
}
|
||||
|
||||
public NodeTemplateEntity(Nodetemplate entity, List<Templateparameterdef> parameters) {
|
||||
super(entity);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public List<Templateparameterdef> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setParameters(List<Templateparameterdef> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,8 @@ public class Nodeconnection extends BaseEntity
|
||||
/** 连接ID (主键) */
|
||||
private Long id;
|
||||
|
||||
private Long treeId;
|
||||
|
||||
/** 父节点 (外键: TreeInstanceNode.id) */
|
||||
@Excel(name = "父节点 (外键: TreeInstanceNode.id)")
|
||||
private Long parentNodeId;
|
||||
@@ -40,6 +42,14 @@ public class Nodeconnection extends BaseEntity
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getTreeId() {
|
||||
return treeId;
|
||||
}
|
||||
|
||||
public void setTreeId(Long treeId) {
|
||||
this.treeId = treeId;
|
||||
}
|
||||
|
||||
public void setParentNodeId(Long parentNodeId)
|
||||
{
|
||||
this.parentNodeId = parentNodeId;
|
||||
|
||||
@@ -18,6 +18,8 @@ public class Nodeparameter extends BaseEntity
|
||||
/** 节点参数ID (主键) */
|
||||
private Long id;
|
||||
|
||||
private Long treeId;
|
||||
|
||||
/** 关联到哪个节点实例 (外键: TreeInstanceNode.id) */
|
||||
@Excel(name = "关联到哪个节点实例 (外键: TreeInstanceNode.id)")
|
||||
private Long nodeInstanceId;
|
||||
@@ -40,6 +42,14 @@ public class Nodeparameter extends BaseEntity
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getTreeId() {
|
||||
return treeId;
|
||||
}
|
||||
|
||||
public void setTreeId(Long treeId) {
|
||||
this.treeId = treeId;
|
||||
}
|
||||
|
||||
public void setNodeInstanceId(Long nodeInstanceId)
|
||||
{
|
||||
this.nodeInstanceId = nodeInstanceId;
|
||||
|
||||
@@ -40,7 +40,20 @@ public class Nodetemplate extends BaseEntity
|
||||
|
||||
/** 模版类型,节点模版或者条件判断,例如“node”,precondition“ */
|
||||
@Excel(name = "模版类型,节点模版或者条件判断,例如“node”,precondition“")
|
||||
private String templeteType;
|
||||
private String templateType;
|
||||
|
||||
public Nodetemplate() {
|
||||
}
|
||||
|
||||
public Nodetemplate(Nodetemplate template) {
|
||||
this.id = template.id;
|
||||
this.type = template.type;
|
||||
this.name = template.name;
|
||||
this.logicHandler = template.logicHandler;
|
||||
this.description = template.description;
|
||||
this.englishName = template.englishName;
|
||||
this.templateType = template.templateType;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
@@ -102,14 +115,14 @@ public class Nodetemplate extends BaseEntity
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public void setTempleteType(String templeteType)
|
||||
public void setTemplateType(String templateType)
|
||||
{
|
||||
this.templeteType = templeteType;
|
||||
this.templateType = templateType;
|
||||
}
|
||||
|
||||
public String getTempleteType()
|
||||
public String getTemplateType()
|
||||
{
|
||||
return templeteType;
|
||||
return templateType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,7 +134,7 @@ public class Nodetemplate extends BaseEntity
|
||||
.append("logicHandler", getLogicHandler())
|
||||
.append("description", getDescription())
|
||||
.append("englishName", getEnglishName())
|
||||
.append("templeteType", getTempleteType())
|
||||
.append("templateType", getTemplateType())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.solution.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Nodeconnection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 节点连接Mapper接口
|
||||
@@ -11,6 +12,8 @@ import com.solution.system.domain.Nodeconnection;
|
||||
*/
|
||||
public interface NodeconnectionMapper
|
||||
{
|
||||
void deleteByTreeId(@Param("treeId") Long treeId);
|
||||
|
||||
/**
|
||||
* 查询节点连接
|
||||
*
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.solution.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Nodeparameter;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 节点参数Mapper接口
|
||||
@@ -11,6 +12,8 @@ import com.solution.system.domain.Nodeparameter;
|
||||
*/
|
||||
public interface NodeparameterMapper
|
||||
{
|
||||
void deleteByTreeId(@Param("treeId") Long treeId);
|
||||
|
||||
/**
|
||||
* 查询节点参数
|
||||
*
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.solution.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Treenodeinstance;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 行为树实例节点Mapper接口
|
||||
@@ -11,6 +12,8 @@ import com.solution.system.domain.Treenodeinstance;
|
||||
*/
|
||||
public interface TreenodeinstanceMapper
|
||||
{
|
||||
void deleteByTreeId(@Param(value = "treeId") Long treeId);
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点
|
||||
*
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.solution.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Nodeconnection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 节点连接Service接口
|
||||
@@ -11,6 +12,9 @@ import com.solution.system.domain.Nodeconnection;
|
||||
*/
|
||||
public interface INodeconnectionService
|
||||
{
|
||||
|
||||
void deleteByTreeId(@Param("treeId") Long treeId);
|
||||
|
||||
/**
|
||||
* 查询节点连接
|
||||
*
|
||||
|
||||
@@ -11,6 +11,9 @@ import com.solution.system.domain.Nodeparameter;
|
||||
*/
|
||||
public interface INodeparameterService
|
||||
{
|
||||
|
||||
void deleteByTreeId(Long treeId);
|
||||
|
||||
/**
|
||||
* 查询节点参数
|
||||
*
|
||||
|
||||
@@ -11,6 +11,9 @@ import com.solution.system.domain.Treenodeinstance;
|
||||
*/
|
||||
public interface ITreenodeinstanceService
|
||||
{
|
||||
|
||||
void deleteByTreeId(Long treeId);
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点
|
||||
*
|
||||
|
||||
@@ -19,6 +19,11 @@ public class NodeconnectionServiceImpl implements INodeconnectionService
|
||||
@Autowired
|
||||
private NodeconnectionMapper nodeconnectionMapper;
|
||||
|
||||
@Override
|
||||
public void deleteByTreeId(Long treeId) {
|
||||
nodeconnectionMapper.deleteByTreeId(treeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点连接
|
||||
*
|
||||
|
||||
@@ -19,6 +19,11 @@ public class NodeparameterServiceImpl implements INodeparameterService
|
||||
@Autowired
|
||||
private NodeparameterMapper nodeparameterMapper;
|
||||
|
||||
@Override
|
||||
public void deleteByTreeId(Long treeId) {
|
||||
nodeparameterMapper.deleteByTreeId(treeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点参数
|
||||
*
|
||||
|
||||
@@ -19,6 +19,11 @@ public class TreenodeinstanceServiceImpl implements ITreenodeinstanceService
|
||||
@Autowired
|
||||
private TreenodeinstanceMapper treenodeinstanceMapper;
|
||||
|
||||
@Override
|
||||
public void deleteByTreeId(Long treeId) {
|
||||
treenodeinstanceMapper.deleteByTreeId(treeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点
|
||||
*
|
||||
|
||||
@@ -6,18 +6,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<resultMap type="Nodeconnection" id="NodeconnectionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="treeId" column="tree_id" />
|
||||
<result property="parentNodeId" column="parent_node_id" />
|
||||
<result property="childNodeId" column="child_node_id" />
|
||||
<result property="orderIndex" column="order_index" />
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteByTreeId">
|
||||
delete from nodeconnection where tree_id=#{treeId}
|
||||
</delete>
|
||||
|
||||
<sql id="selectNodeconnectionVo">
|
||||
select id, parent_node_id, child_node_id, order_index from nodeconnection
|
||||
select id, tree_id, parent_node_id, child_node_id, order_index from nodeconnection
|
||||
</sql>
|
||||
|
||||
<select id="selectNodeconnectionList" parameterType="Nodeconnection" resultMap="NodeconnectionResult">
|
||||
<include refid="selectNodeconnectionVo"/>
|
||||
<where>
|
||||
<if test="treeId != null "> and tree_id = #{treeId}</if>
|
||||
<if test="parentNodeId != null "> and parent_node_id = #{parentNodeId}</if>
|
||||
<if test="childNodeId != null "> and child_node_id = #{childNodeId}</if>
|
||||
<if test="orderIndex != null "> and order_index = #{orderIndex}</if>
|
||||
@@ -32,11 +38,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insertNodeconnection" parameterType="Nodeconnection" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into nodeconnection
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="treeId != null">tree_id,</if>
|
||||
<if test="parentNodeId != null">parent_node_id,</if>
|
||||
<if test="childNodeId != null">child_node_id,</if>
|
||||
<if test="orderIndex != null">order_index,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="treeId != null">#{treeId},</if>
|
||||
<if test="parentNodeId != null">#{parentNodeId},</if>
|
||||
<if test="childNodeId != null">#{childNodeId},</if>
|
||||
<if test="orderIndex != null">#{orderIndex},</if>
|
||||
@@ -46,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<update id="updateNodeconnection" parameterType="Nodeconnection">
|
||||
update nodeconnection
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="treeId != null">tree_id = #{treeId},</if>
|
||||
<if test="parentNodeId != null">parent_node_id = #{parentNodeId},</if>
|
||||
<if test="childNodeId != null">child_node_id = #{childNodeId},</if>
|
||||
<if test="orderIndex != null">order_index = #{orderIndex},</if>
|
||||
|
||||
@@ -6,13 +6,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<resultMap type="Nodeparameter" id="NodeparameterResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="treeId" column="tree_id" />
|
||||
<result property="nodeInstanceId" column="node_instance_id" />
|
||||
<result property="paramDefId" column="param_def_id" />
|
||||
<result property="value" column="value" />
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteByTreeId">
|
||||
delete from nodeparameter where tree_id=#{treeId}
|
||||
</delete>
|
||||
|
||||
<sql id="selectNodeparameterVo">
|
||||
select id, node_instance_id, param_def_id, value from nodeparameter
|
||||
select id, treeId, node_instance_id, param_def_id, value from nodeparameter
|
||||
</sql>
|
||||
|
||||
<select id="selectNodeparameterList" parameterType="Nodeparameter" resultMap="NodeparameterResult">
|
||||
@@ -32,11 +37,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insertNodeparameter" parameterType="Nodeparameter" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into nodeparameter
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="treeId != null">tree_id,</if>
|
||||
<if test="nodeInstanceId != null">node_instance_id,</if>
|
||||
<if test="paramDefId != null">param_def_id,</if>
|
||||
<if test="value != null">value,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="treeId != null">#{treeId},</if>
|
||||
<if test="nodeInstanceId != null">#{nodeInstanceId},</if>
|
||||
<if test="paramDefId != null">#{paramDefId},</if>
|
||||
<if test="value != null">#{value},</if>
|
||||
@@ -46,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<update id="updateNodeparameter" parameterType="Nodeparameter">
|
||||
update nodeparameter
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="treeId != null">tree_id = #{treeId},</if>
|
||||
<if test="nodeInstanceId != null">node_instance_id = #{nodeInstanceId},</if>
|
||||
<if test="paramDefId != null">param_def_id = #{paramDefId},</if>
|
||||
<if test="value != null">value = #{value},</if>
|
||||
|
||||
@@ -11,7 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="logicHandler" column="logic_handler" />
|
||||
<result property="description" column="description" />
|
||||
<result property="englishName" column="english_name" />
|
||||
<result property="templeteType" column="templete_type" />
|
||||
<result property="templateType" column="templete_type" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectNodetemplateVo">
|
||||
@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="logicHandler != null and logicHandler != ''"> and logic_handler = #{logicHandler}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="englishName != null and englishName != ''"> and english_name like concat('%', #{englishName}, '%')</if>
|
||||
<if test="templeteType != null and templeteType != ''"> and templete_type = #{templeteType}</if>
|
||||
<if test="templateType != null and templateType != ''"> and templete_type = #{templateType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="logicHandler != null">logic_handler,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="englishName != null">english_name,</if>
|
||||
<if test="templeteType != null and templeteType != ''">templete_type,</if>
|
||||
<if test="templateType != null and templateType != ''">templete_type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
@@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="logicHandler != null">#{logicHandler},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="englishName != null">#{englishName},</if>
|
||||
<if test="templeteType != null and templeteType != ''">#{templeteType},</if>
|
||||
<if test="templateType != null and templateType != ''">#{templateType},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -63,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="logicHandler != null">logic_handler = #{logicHandler},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="englishName != null">english_name = #{englishName},</if>
|
||||
<if test="templeteType != null and templeteType != ''">templete_type = #{templeteType},</if>
|
||||
<if test="templateType != null and templateType != ''">templete_type = #{templateType},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -15,6 +15,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="desciption" column="desciption" />
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteByTreeId">
|
||||
delete from treenodeinstance where tree_id=#{treeId}
|
||||
</delete>
|
||||
|
||||
<sql id="selectTreenodeinstanceVo">
|
||||
select id, tree_id, template_id, instance_name, is_root, precondition_templete_id, uuid,desciption from treenodeinstance
|
||||
</sql>
|
||||
|
||||
@@ -113,6 +113,12 @@
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.25</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.solution.common.constant;
|
||||
|
||||
/**
|
||||
* 火力规则常量
|
||||
*/
|
||||
public class ExceptionConstants {
|
||||
|
||||
public static final String PARAMETER_EXCEPTION = "参数异常";
|
||||
|
||||
public static final String RESULT_EXCEPTION = "结果异常";
|
||||
|
||||
public static final String NOT_FOUND_CARRIAGE_CHAIN_HANDLER = "not found carriage chain handler!";
|
||||
|
||||
public static final String NOT_FOUND_F22_COMPONENT = "未找到 F-22 组件";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.solution.common.constant;
|
||||
|
||||
|
||||
public class PlatformAndModuleConstants {
|
||||
|
||||
public static final String F22 = "f22";
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class SysLoginService
|
||||
public String login(String username, String password, String code, String uuid)
|
||||
{
|
||||
// 验证码校验
|
||||
validateCaptcha(username, code, uuid);
|
||||
// validateCaptcha(username, code, uuid);
|
||||
// 登录前置校验
|
||||
loginPreCheck(username, password);
|
||||
// 用户验证
|
||||
|
||||
1184
modeler/.editorconfig
Normal file
0
modeler/.env
Normal file
17
modeler/.env.development
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# This file is part of the kernelstudio package.
|
||||
#
|
||||
# (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
#
|
||||
# For the full copyright and license information, please view the LICENSE file
|
||||
# that was distributed with this source code.
|
||||
#
|
||||
NODE_ENV=development
|
||||
APP_BASE_URL=/
|
||||
APP_API_URL=/api/v1
|
||||
APP_API_TIMEOUT=60000
|
||||
APP_PORT=9999
|
||||
APP_PROXY_HOST=http://127.0.0.1
|
||||
APP_PROXY_PORT=12000
|
||||
APP_ASSETS_HOST=http://127.0.0.1:9999
|
||||
APP_DIST_DIR=assets/web
|
||||
16
modeler/.env.production
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# This file is part of the kernelstudio package.
|
||||
#
|
||||
# (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
#
|
||||
# For the full copyright and license information, please view the LICENSE file
|
||||
# that was distributed with this source code.
|
||||
#
|
||||
APP_BASE_URL=/
|
||||
APP_API_URL=/api/v1
|
||||
APP_API_TIMEOUT=60000
|
||||
APP_PORT=9999
|
||||
APP_PROXY_HOST=http://127.0.0.1
|
||||
APP_PROXY_PORT=12000
|
||||
APP_ASSETS_HOST=http://app.kernelstudio.com
|
||||
APP_DIST_DIR=assets/web
|
||||
98
modeler/.eslintrc-auto-import.json
Normal file
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"globals": {
|
||||
"Component": true,
|
||||
"ComponentPublicInstance": true,
|
||||
"ComputedRef": true,
|
||||
"DirectiveBinding": true,
|
||||
"EffectScope": true,
|
||||
"ExtractDefaultPropTypes": true,
|
||||
"ExtractPropTypes": true,
|
||||
"ExtractPublicPropTypes": true,
|
||||
"InjectionKey": true,
|
||||
"MaybeRef": true,
|
||||
"MaybeRefOrGetter": true,
|
||||
"PropType": true,
|
||||
"Ref": true,
|
||||
"ShallowRef": true,
|
||||
"Slot": true,
|
||||
"Slots": true,
|
||||
"VNode": true,
|
||||
"WritableComputedRef": true,
|
||||
"acceptHMRUpdate": true,
|
||||
"computed": true,
|
||||
"createApp": true,
|
||||
"createPinia": true,
|
||||
"customRef": true,
|
||||
"defineAsyncComponent": true,
|
||||
"defineComponent": true,
|
||||
"defineStore": true,
|
||||
"effectScope": true,
|
||||
"getActivePinia": true,
|
||||
"getCurrentInstance": true,
|
||||
"getCurrentScope": true,
|
||||
"getCurrentWatcher": true,
|
||||
"inject": true,
|
||||
"isProxy": true,
|
||||
"isReactive": true,
|
||||
"isReadonly": true,
|
||||
"isRef": true,
|
||||
"isShallow": true,
|
||||
"mapActions": true,
|
||||
"mapGetters": true,
|
||||
"mapState": true,
|
||||
"mapStores": true,
|
||||
"mapWritableState": true,
|
||||
"markRaw": true,
|
||||
"nextTick": true,
|
||||
"onActivated": true,
|
||||
"onBeforeMount": true,
|
||||
"onBeforeRouteLeave": true,
|
||||
"onBeforeRouteUpdate": true,
|
||||
"onBeforeUnmount": true,
|
||||
"onBeforeUpdate": true,
|
||||
"onDeactivated": true,
|
||||
"onErrorCaptured": true,
|
||||
"onMounted": true,
|
||||
"onRenderTracked": true,
|
||||
"onRenderTriggered": true,
|
||||
"onScopeDispose": true,
|
||||
"onServerPrefetch": true,
|
||||
"onUnmounted": true,
|
||||
"onUpdated": true,
|
||||
"onWatcherCleanup": true,
|
||||
"provide": true,
|
||||
"reactive": true,
|
||||
"readonly": true,
|
||||
"ref": true,
|
||||
"resolveComponent": true,
|
||||
"setActivePinia": true,
|
||||
"setMapStoreSuffix": true,
|
||||
"shallowReactive": true,
|
||||
"shallowReadonly": true,
|
||||
"shallowRef": true,
|
||||
"storeToRefs": true,
|
||||
"toRaw": true,
|
||||
"toRef": true,
|
||||
"toRefs": true,
|
||||
"toValue": true,
|
||||
"triggerRef": true,
|
||||
"unref": true,
|
||||
"useAttrs": true,
|
||||
"useClipboard": true,
|
||||
"useCssModule": true,
|
||||
"useCssVars": true,
|
||||
"useDebounceFn": true,
|
||||
"useId": true,
|
||||
"useLink": true,
|
||||
"useLocalStorage": true,
|
||||
"useModel": true,
|
||||
"useRoute": true,
|
||||
"useRouter": true,
|
||||
"useSlots": true,
|
||||
"useTemplateRef": true,
|
||||
"watch": true,
|
||||
"watchEffect": true,
|
||||
"watchPostEffect": true,
|
||||
"watchSyncEffect": true
|
||||
}
|
||||
}
|
||||
15
modeler/.gitattributes
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# .gitattributes
|
||||
* text=auto eol=lf
|
||||
*.html text eol=lf
|
||||
*.css text eol=lf
|
||||
*.js text eol=lf
|
||||
*.scss text eol=lf
|
||||
*.hbs text eol=lf
|
||||
*.sh text eol=lf
|
||||
*.md text eol=lf
|
||||
*.json text eol=lf
|
||||
*.yml text eol=lf
|
||||
.browserslistrc text eol=lf
|
||||
.gitignore text eol=lf
|
||||
*.js linguist-detectable=true
|
||||
*.vue linguist-detectable=true
|
||||
13
modeler/.prettierignore
Normal file
@@ -0,0 +1,13 @@
|
||||
/dist/*
|
||||
/docs/*
|
||||
.local
|
||||
.output.js
|
||||
auto-imports.d.ts
|
||||
/node_modules/**
|
||||
|
||||
**/*.svg
|
||||
**/*.sh
|
||||
|
||||
/public/*
|
||||
/tmp/*
|
||||
|
||||
19
modeler/.prettierrc
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"printWidth": 200,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"vueIndentScriptAndStyle": true,
|
||||
"singleQuote": true,
|
||||
"quoteProps": "as-needed",
|
||||
"bracketSpacing": true,
|
||||
"trailingComma": "es5",
|
||||
"jsxBracketSameLine": true,
|
||||
"jsxSingleQuote": false,
|
||||
"arrowParens": "always",
|
||||
"insertPragma": false,
|
||||
"requirePragma": false,
|
||||
"proseWrap": "preserve",
|
||||
"htmlWhitespaceSensitivity": "strict",
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
6
modeler/.stylelintignore
Normal file
@@ -0,0 +1,6 @@
|
||||
/dist/*
|
||||
/public/*
|
||||
/docs/*
|
||||
/tmp/*
|
||||
/bin/*
|
||||
/config/*
|
||||
7
modeler/.vercelignore
Normal file
@@ -0,0 +1,7 @@
|
||||
node_modules
|
||||
.git
|
||||
*.log
|
||||
.DS_Store
|
||||
dist
|
||||
.vscode
|
||||
.idea
|
||||
3
modeler/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["Vue.volar"]
|
||||
}
|
||||
5
modeler/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Vue 3 + TypeScript + Vite
|
||||
|
||||
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||
|
||||
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
|
||||
10
modeler/config/grafana/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM grafana/grafana-enterprise:v12.3.1
|
||||
|
||||
USER root
|
||||
|
||||
RUN mkdir -p /usr/share/grafana/public/views \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --chown=grafana:grafana ./views /usr/share/grafana/public/views
|
||||
|
||||
USER grafana
|
||||
61
modeler/config/grafana/views/error.html
Normal file
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta name="theme-color" content="#000" />
|
||||
|
||||
|
||||
<title>[[.AppTitle]] - Error</title>
|
||||
|
||||
<base href="[[.AppSubUrl]]/" />
|
||||
|
||||
[[ if eq .ThemeType "light" ]]
|
||||
<link rel="stylesheet" href="[[.Assets.Light]]" />
|
||||
[[ else ]]
|
||||
<link rel="stylesheet" href="[[.Assets.Dark]]" />
|
||||
[[ end ]]
|
||||
|
||||
<link rel="icon" type="image/png" href="public/img/fav32.png" />
|
||||
<link rel="mask-icon" href="public/img/grafana_mask_icon.svg" color="#F05A28" />
|
||||
</head>
|
||||
|
||||
<body class="theme-[[ .ThemeType ]]">
|
||||
<div class="main-view">
|
||||
<div class="page-container">
|
||||
<div class="page-header">
|
||||
<div class="page-header__inner">
|
||||
<span class="page-header__logo">
|
||||
<i class="page-header__icon fa fa-frown-o"></i>
|
||||
</span>
|
||||
<div class="page-header__info-block">
|
||||
<h1 class="page-header__title">
|
||||
<a class="text-link" href="login">Grafana</a><span> / Server Error</span><span></span>
|
||||
</h1>
|
||||
<div class="page-header__sub-title">Sadly something went wrong</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-container page-body ng-scope" style="padding: 2rem">
|
||||
<div class="alert">
|
||||
<div class="alert-icon"><icon name="'exclamation-triangle'"></icon></div>
|
||||
<div class="alert-body">
|
||||
<div class="alert-title">[[.Title]]</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
[[if .ErrorMsg]]
|
||||
<h4 class="page-heading">Error details</h4>
|
||||
<div class="alert-text">
|
||||
<pre>[[.ErrorMsg]]</pre>
|
||||
</div>
|
||||
[[end]]
|
||||
<div style="padding: 2rem 0 0">
|
||||
<p>Check the Grafana server logs for the detailed error message.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
387
modeler/config/grafana/views/index.html
Normal file
@@ -0,0 +1,387 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="[[.User.Language]]">
|
||||
<head>
|
||||
[[ if and .CSPEnabled .IsDevelopmentEnv ]]
|
||||
<!-- Cypress overwrites CSP headers in HTTP requests, so this is required for e2e tests-->
|
||||
<meta http-equiv="Content-Security-Policy" content="[[.CSPContent]]"/>
|
||||
[[ end ]]
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta name="theme-color" content="#000" />
|
||||
|
||||
<title>[[.AppTitle]]</title>
|
||||
|
||||
<base href="[[.AppSubUrl]]/" />
|
||||
|
||||
<link rel="icon" type="image/png" href="[[.FavIcon]]" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="[[.AppleTouchIcon]]" />
|
||||
<link rel="mask-icon" href="[[.Assets.ContentDeliveryURL]]public/img/grafana_mask_icon.svg" color="#F05A28" />
|
||||
|
||||
[[range $asset := .Assets.CSSFiles]]
|
||||
<link rel="stylesheet" href="[[$asset.FilePath]]" />
|
||||
[[end]]
|
||||
|
||||
<!-- If theme is "system", we inject the stylesheets with javascript further down the page -->
|
||||
[[ if eq .ThemeType "light" ]]
|
||||
<link rel="stylesheet" href="[[.Assets.Light]]" />
|
||||
[[ else if eq .ThemeType "dark" ]]
|
||||
<link rel="stylesheet" href="[[.Assets.Dark]]" />
|
||||
[[ end ]]
|
||||
|
||||
<script nonce="[[.Nonce]]">
|
||||
performance.mark('frontend_boot_css_time_seconds');
|
||||
</script>
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
<meta name="msapplication-TileColor" content="#2b5797" />
|
||||
<meta name="msapplication-config" content="public/img/browserconfig.xml" />
|
||||
</head>
|
||||
|
||||
<body class="theme-[[ .ThemeType ]] [[.AppNameBodyClass]]">
|
||||
<style>
|
||||
.preloader {
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 0 32px;
|
||||
}
|
||||
|
||||
.preloader__enter {
|
||||
opacity: 0;
|
||||
animation-name: preloader-fade-in;
|
||||
animation-iteration-count: 1;
|
||||
animation-duration: 0.9s;
|
||||
animation-delay: 0.5s;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
.preloader__bounce {
|
||||
text-align: center;
|
||||
animation-name: preloader-bounce;
|
||||
animation-duration: 0.9s;
|
||||
animation-iteration-count: infinite;
|
||||
}
|
||||
|
||||
.preloader__logo {
|
||||
display: inline-block;
|
||||
animation-name: preloader-squash;
|
||||
animation-duration: 0.9s;
|
||||
animation-iteration-count: infinite;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
background-image: url('[[.LoadingLogo]]');
|
||||
}
|
||||
|
||||
.preloader__text {
|
||||
margin-top: 16px;
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
font-family: Sans-serif;
|
||||
opacity: 0;
|
||||
animation-name: preloader-fade-in;
|
||||
animation-duration: 0.9s;
|
||||
animation-delay: 0.5s;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
.theme-light .preloader__text {
|
||||
color: #52545c;
|
||||
}
|
||||
|
||||
.theme-dark .preloader__text {
|
||||
color: #d8d9da;
|
||||
}
|
||||
|
||||
@keyframes preloader-fade-in {
|
||||
0% {
|
||||
opacity: 0;
|
||||
/*animation-timing-function: linear;*/
|
||||
animation-timing-function: cubic-bezier(0, 0, 0.5, 1);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes preloader-bounce {
|
||||
from,
|
||||
to {
|
||||
transform: translateY(0px);
|
||||
animation-timing-function: cubic-bezier(0.3, 0, 0.1, 1);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-50px);
|
||||
animation-timing-function: cubic-bezier(0.9, 0, 0.7, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes preloader-squash {
|
||||
0% {
|
||||
transform: scaleX(1.3) scaleY(0.8);
|
||||
animation-timing-function: cubic-bezier(0.3, 0, 0.1, 1);
|
||||
}
|
||||
15% {
|
||||
transform: scaleX(0.75) scaleY(1.25);
|
||||
animation-timing-function: cubic-bezier(0, 0, 0.7, 0.75);
|
||||
}
|
||||
55% {
|
||||
transform: scaleX(1.05) scaleY(0.95);
|
||||
animation-timing-function: cubic-bezier(0.9, 0, 1, 1);
|
||||
}
|
||||
95% {
|
||||
transform: scaleX(0.75) scaleY(1.25);
|
||||
animation-timing-function: cubic-bezier(0, 0, 0, 1);
|
||||
}
|
||||
100% {
|
||||
transform: scaleX(1.3) scaleY(0.8);
|
||||
animation-timing-function: cubic-bezier(0, 0, 0.7, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Fail info */
|
||||
.preloader__text--fail {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* stop logo animation */
|
||||
.preloader--done .preloader__bounce,
|
||||
.preloader--done .preloader__logo {
|
||||
animation-name: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.preloader--done .preloader__logo,
|
||||
.preloader--done .preloader__text {
|
||||
display: none;
|
||||
color: #ff5705 !important;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.theme-light .preloader--done .preloader__text {
|
||||
color: #52545c !important;
|
||||
}
|
||||
|
||||
.preloader--done .preloader__text--fail {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.preloader--done .preloader__text--fail a {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.theme-light .preloader--done .preloader__text--fail a {
|
||||
color: rgb(31, 98, 224);
|
||||
}
|
||||
|
||||
.preloader--done code {
|
||||
white-space: nowrap;
|
||||
padding: 2px 5px;
|
||||
margin: 0px 2px;
|
||||
font-size: 0.8rem;
|
||||
background-color: rgb(24, 27, 31);
|
||||
color: rgb(204, 204, 220);
|
||||
border: 1px solid rgba(204, 204, 220, 0.2);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.preloader__error-list li {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
[ng\:cloak],
|
||||
[ng-cloak],
|
||||
.ng-cloak {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="preloader">
|
||||
<div class="preloader__enter">
|
||||
<div class="preloader__bounce">
|
||||
<div class="preloader__logo" aria-live="polite" role="status" aria-label="Loading Grafana"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="preloader__text preloader__text--fail">
|
||||
<main>
|
||||
<h1>If you're seeing this Grafana has failed to load its application files</h1>
|
||||
<ol class="preloader__error-list">
|
||||
<li>This could be caused by your reverse proxy settings.</li>
|
||||
<li>If you host grafana under a subpath make sure your <code>grafana.ini</code> <code>root_url</code> setting
|
||||
includes subpath. If not using a reverse proxy make sure to set <code>serve_from_sub_path</code> to true.</li>
|
||||
<li>If you have a local dev build make sure you build frontend using: <code>yarn start</code>, or
|
||||
<code>yarn build</code>.</li>
|
||||
<li>Sometimes restarting <code>grafana-server</code> can help.</li>
|
||||
<li>Check if you are using a non-supported browser. For more information, refer to the list of
|
||||
<a href="https://grafana.com/docs/grafana/latest/installation/requirements/#supported-web-browsers">
|
||||
supported browsers </a
|
||||
>.</li>
|
||||
</ol>
|
||||
</main>
|
||||
</div>
|
||||
<script nonce="[[.Nonce]]">
|
||||
// Check to see if browser is not supported by Grafana
|
||||
// Source file in app/core/utils/browser.ts & tests make edits there and copy compiled typescript here
|
||||
function checkBrowserCompatibility() {
|
||||
var isIE = navigator.userAgent.indexOf('MSIE') > -1;
|
||||
var isEdge = navigator.userAgent.indexOf('Edge/') > -1 || navigator.userAgent.indexOf('Edg/') > -1;
|
||||
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
|
||||
|
||||
/* Check for
|
||||
<= IE11 (Trident 7)
|
||||
Edge <= 16
|
||||
Firefox <= 64
|
||||
Chrome <= 54
|
||||
*/
|
||||
var isEdgeVersion = /Edge\/([0-9.]+)/.exec(navigator.userAgent);
|
||||
|
||||
if (isIE && parseFloat(/Trident\/([0-9.]+)/.exec(navigator.userAgent)[1]) <= 7) {
|
||||
return false;
|
||||
} else if (
|
||||
isEdge &&
|
||||
((isEdgeVersion && parseFloat(isEdgeVersion[1]) <= 16) ||
|
||||
parseFloat(/Edg\/([0-9.]+)/.exec(navigator.userAgent)[1]) <= 16)
|
||||
) {
|
||||
return false;
|
||||
} else if (isFirefox && parseFloat(/Firefox\/([0-9.]+)/.exec(navigator.userAgent)[1]) <= 64) {
|
||||
return false;
|
||||
} else if (isChrome && parseFloat(/Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1]) <= 54) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!checkBrowserCompatibility()) {
|
||||
alert('Your browser is not fully supported, please try newer version.');
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div id="reactRoot"></div>
|
||||
|
||||
<script nonce="[[.Nonce]]">
|
||||
window.grafanaBootData = {
|
||||
user: [[.User]],
|
||||
settings: [[.Settings]],
|
||||
navTree: [[.NavTree]],
|
||||
assets: [[.Assets]]
|
||||
};
|
||||
|
||||
// FEMT index.html uses this, and we want to keep the index.ts the same for both
|
||||
window.__grafana_boot_data_promise = Promise.resolve();
|
||||
|
||||
// Set theme to match system only on startup.
|
||||
// Do not react to changes in system theme after startup.
|
||||
if (window.grafanaBootData.user.theme === "system") {
|
||||
document.body.classList.remove("theme-system");
|
||||
var darkQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
var cssLink = document.createElement("link");
|
||||
cssLink.rel = 'stylesheet';
|
||||
|
||||
if (darkQuery.matches) {
|
||||
document.body.classList.add("theme-dark");
|
||||
cssLink.href = window.grafanaBootData.assets.dark;
|
||||
window.grafanaBootData.user.lightTheme = false;
|
||||
} else {
|
||||
document.body.classList.add("theme-light");
|
||||
cssLink.href = window.grafanaBootData.assets.light;
|
||||
window.grafanaBootData.user.lightTheme = true;
|
||||
}
|
||||
document.head.appendChild(cssLink);
|
||||
}
|
||||
|
||||
window.__grafana_load_failed = function() {
|
||||
var preloader = document.getElementsByClassName("preloader");
|
||||
if (preloader.length) {
|
||||
preloader[0].className = "preloader preloader--done";
|
||||
}
|
||||
}
|
||||
|
||||
// In case the js files fails to load the code below will show an info message.
|
||||
window.onload = function() {
|
||||
if (window.__grafana_app_bundle_loaded) {
|
||||
return;
|
||||
}
|
||||
window.__grafana_load_failed();
|
||||
};
|
||||
|
||||
[[if .Assets.ContentDeliveryURL]]
|
||||
window.public_cdn_path = '[[.Assets.ContentDeliveryURL]]public/build/';
|
||||
[[end]]
|
||||
[[if .Nonce]]
|
||||
window.nonce = '[[.Nonce]]';
|
||||
[[end]]
|
||||
</script>
|
||||
|
||||
[[if .GoogleTagManagerId]]
|
||||
<!-- Google Tag Manager -->
|
||||
<script nonce="[[.Nonce]]">
|
||||
dataLayer = [
|
||||
{
|
||||
IsSignedIn: '[[.User.IsSignedIn]]',
|
||||
Email: '[[.User.Email]]',
|
||||
Name: '[[.User.Name]]',
|
||||
UserId: '[[.User.Id]]',
|
||||
OrgId: '[[.User.OrgId]]',
|
||||
OrgName: '[[.User.OrgName]]',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
<noscript>
|
||||
<iframe
|
||||
src="//www.googletagmanager.com/ns.html?id=[[.GoogleTagManagerId]]"
|
||||
height="0"
|
||||
width="0"
|
||||
style="display: none; visibility: hidden"
|
||||
></iframe>
|
||||
</noscript>
|
||||
<script nonce="[[.Nonce]]">
|
||||
(function (w, d, s, l, i) {
|
||||
w[l] = w[l] || [];
|
||||
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
|
||||
var f = d.getElementsByTagName(s)[0],
|
||||
j = d.createElement(s),
|
||||
dl = l != 'dataLayer' ? '&l=' + l : '';
|
||||
j.async = true;
|
||||
j.src = '//www.googletagmanager.com/gtm.js?id=' + i + dl;
|
||||
f.parentNode.insertBefore(j, f);
|
||||
})(window, document, 'script', 'dataLayer', '[[.GoogleTagManagerId]]');
|
||||
</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
[[end]]
|
||||
|
||||
[[if .Settings.FeatureToggles.assetSriChecks ]]
|
||||
[[range $asset := .Assets.JSFiles]]
|
||||
<script
|
||||
nonce="[[$.Nonce]]"
|
||||
src="[[$asset.FilePath]]"
|
||||
integrity="[[$asset.Integrity]]"
|
||||
crossorigin="anonymous"
|
||||
type="text/javascript"
|
||||
defer
|
||||
></script>
|
||||
[[end]]
|
||||
[[else]]
|
||||
[[range $asset := .Assets.JSFiles]]
|
||||
<script
|
||||
nonce="[[$.Nonce]]"
|
||||
src="[[$asset.FilePath]]"
|
||||
type="text/javascript"
|
||||
defer
|
||||
></script>
|
||||
[[end]]
|
||||
[[end]]
|
||||
|
||||
<script nonce="[[.Nonce]]">
|
||||
performance.mark('frontend_boot_js_done_time_seconds');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
39
modeler/config/grafana/views/swagger.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
[[ if and .CSPEnabled .IsDevelopmentEnv ]]
|
||||
<!-- Cypress overwrites CSP headers in HTTP requests, so this is required for e2e tests-->
|
||||
<meta http-equiv="Content-Security-Policy" content="[[.CSPContent]]" />
|
||||
[[ end ]]
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta name="theme-color" content="#000" />
|
||||
|
||||
<title>Grafana API Reference</title>
|
||||
|
||||
[[range $asset := .Assets.SwaggerCSSFiles]]
|
||||
<link rel="stylesheet" href="[[$asset.FilePath]]" />
|
||||
[[end]]
|
||||
|
||||
<link rel="stylesheet" href="[[.Assets.Light]]" />
|
||||
|
||||
<link rel="icon" type="image/png" href="[[.FavIcon]]" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="[[.AppleTouchIcon]]" />
|
||||
<link rel="mask-icon" href="[[.Assets.ContentDeliveryURL]]public/img/grafana_mask_icon.svg" color="#F05A28" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript> You need to enable JavaScript to run this app. </noscript>
|
||||
<script nonce="[[$.Nonce]]">
|
||||
[[if .Assets.ContentDeliveryURL]]
|
||||
window.public_cdn_path = '[[.Assets.ContentDeliveryURL]]public/build/';
|
||||
[[end]]
|
||||
</script>
|
||||
<div id="root"></div>
|
||||
[[range $asset := .Assets.Swagger]]
|
||||
<script nonce="[[$.Nonce]]" src="[[$asset.FilePath]]" type="text/javascript"></script>
|
||||
[[end]]
|
||||
<script></script>
|
||||
</body>
|
||||
</html>
|
||||
98
modeler/config/nginx.conf
Normal file
@@ -0,0 +1,98 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name monitor.kernelstudio.com;
|
||||
include server/error.conf;
|
||||
access_log /var/log/nginx/monitor.kernelstudio.com.access.log access;
|
||||
error_log /var/log/nginx/monitor.kernelstudio.com.error.log debug; # 临时开启debug,排查WS错误
|
||||
|
||||
# 核心:屏蔽后端 X-Frame-Options + 统一设置
|
||||
proxy_hide_header X-Frame-Options;
|
||||
add_header X-Frame-Options "sameorigin" always;
|
||||
|
||||
# 全局跨域头(开发环境)
|
||||
add_header Access-Control-Allow-Origin "*" always;
|
||||
add_header Access-Control-Allow-Methods "GET,POST,PUT,DELETE,OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Content-Type,Authorization,X-Grafana-Org-Id,Upgrade,Connection" always;
|
||||
# 允许跨域预检请求(OPTIONS)
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
|
||||
# 全局 proxy 基础配置
|
||||
proxy_http_version 1.1;
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_set_header X-Host $host;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
# ========== 最高优先级:Grafana Live WS(覆盖所有带参数的WS请求) ==========
|
||||
# 正则匹配 /api/live/ws 及后续所有参数/路径
|
||||
location ~ ^/api/live/ws {
|
||||
# WebSocket 必须的头部
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# 保持其他头部传递
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# WebSocket 超时设置
|
||||
proxy_read_timeout 86400;
|
||||
proxy_connect_timeout 86400;
|
||||
proxy_send_timeout 86400;
|
||||
|
||||
# 禁用缓冲
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
|
||||
proxy_pass http://192.168.1.200:3000;
|
||||
}
|
||||
|
||||
# ========== 次优先级:Grafana 其他 API/页面路径 ==========
|
||||
# 1. 匹配 /apis/(带s)开头的所有路径
|
||||
location ~ ^/apis/ {
|
||||
proxy_next_upstream http_500 http_502 http_504 error timeout invalid_header;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_pass http://192.168.1.200:3000;
|
||||
}
|
||||
|
||||
# 2. 匹配 /api/ 下的 Grafana 核心 API(排除 live/ws,已单独匹配)
|
||||
location ~ ^/api/(user|frontend-metrics|datasources|ds|dashboards|prometheus|plugins|features\.grafana\.ap|public)($|/) {
|
||||
proxy_next_upstream http_500 http_502 http_504 error timeout invalid_header;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_pass http://192.168.1.200:3000;
|
||||
}
|
||||
|
||||
# 3. 匹配 Grafana 页面路径
|
||||
location ~ ^/(d|login|public|avatar)($|/) {
|
||||
proxy_next_upstream http_500 http_502 http_504 error timeout invalid_header;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_pass http://192.168.1.200:3000;
|
||||
}
|
||||
|
||||
# ========== Vite 相关路径(最后匹配) ==========
|
||||
# 1. Vite HMR 的 WebSocket 路径
|
||||
location /ws {
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_read_timeout 86400s;
|
||||
proxy_pass http://192.168.1.200:8888;
|
||||
}
|
||||
|
||||
# 2. Vite 开发环境兜底
|
||||
location / {
|
||||
include custom/api.access.conf;
|
||||
proxy_next_upstream http_500 http_502 http_504 error timeout invalid_header;
|
||||
# 禁用缓存
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
||||
add_header Pragma "no-cache" always;
|
||||
add_header Expires "0" always;
|
||||
proxy_pass http://192.168.1.200:8888;
|
||||
}
|
||||
}
|
||||
BIN
modeler/docs/ui/001-工程管理-tab1-工程列表.jpg
Normal file
|
After Width: | Height: | Size: 660 KiB |
BIN
modeler/docs/ui/001-工程管理-tab2-自定义模版-create.jpg
Normal file
|
After Width: | Height: | Size: 634 KiB |
BIN
modeler/docs/ui/001-工程管理-tab2-自定义模版.jpg
Normal file
|
After Width: | Height: | Size: 698 KiB |
BIN
modeler/docs/ui/001-工程管理-工程详情.jpg
Normal file
|
After Width: | Height: | Size: 718 KiB |
BIN
modeler/docs/ui/001-工程管理-工程详情2.jpg
Normal file
|
After Width: | Height: | Size: 667 KiB |
BIN
modeler/docs/ui/001-工程管理-新建-step1.jpg
Normal file
|
After Width: | Height: | Size: 622 KiB |
BIN
modeler/docs/ui/001-工程管理-新建-step2.jpg
Normal file
|
After Width: | Height: | Size: 625 KiB |
BIN
modeler/docs/ui/001-工程管理-新建-step3.jpg
Normal file
|
After Width: | Height: | Size: 647 KiB |
BIN
modeler/docs/ui/002-模型构建-002-模型组件设置-tab1.jpg
Normal file
|
After Width: | Height: | Size: 650 KiB |
BIN
modeler/docs/ui/002-模型构建-002-模型组件设置-tab2.jpg
Normal file
|
After Width: | Height: | Size: 605 KiB |
BIN
modeler/docs/ui/002-模型构建-002-模型组件设置-tab3.jpg
Normal file
|
After Width: | Height: | Size: 643 KiB |
BIN
modeler/docs/ui/003-模型训练-训练任务配置-step0.jpg
Normal file
|
After Width: | Height: | Size: 696 KiB |
BIN
modeler/docs/ui/003-模型训练-训练任务配置-step1.jpg
Normal file
|
After Width: | Height: | Size: 746 KiB |
BIN
modeler/docs/ui/003-模型训练-训练任务配置-step2.jpg
Normal file
|
After Width: | Height: | Size: 689 KiB |
BIN
modeler/docs/ui/003-模型训练-训练任务配置-step3.jpg
Normal file
|
After Width: | Height: | Size: 623 KiB |
BIN
modeler/docs/ui/004-模型应用-模型部署与推理.jpg
Normal file
|
After Width: | Height: | Size: 695 KiB |
BIN
modeler/docs/ui/005-模型构建.jpg
Normal file
|
After Width: | Height: | Size: 633 KiB |
13
modeler/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>决策管理</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" class="w-full h-full"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
46
modeler/jsconfig.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
],
|
||||
"@/views/*": [
|
||||
"src/views/*"
|
||||
],
|
||||
"@/components/*": [
|
||||
"src/components/*"
|
||||
],
|
||||
"@/assets/*": [
|
||||
"src/assets/*"
|
||||
],
|
||||
"@/config/*": [
|
||||
"src/config/*"
|
||||
],
|
||||
"@/core/*": [
|
||||
"src/core/*"
|
||||
],
|
||||
"@/api/*": [
|
||||
"src/api/*"
|
||||
],
|
||||
"@/stores/*": [
|
||||
"src/stores/*"
|
||||
],
|
||||
"@/utils/*": [
|
||||
"src/utils/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist",
|
||||
"docs",
|
||||
"tmp",
|
||||
"config",
|
||||
"public"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
||||
179
modeler/mock/behavior.ts
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
import {MockMethod} from 'vite-plugin-mock';
|
||||
import {createResponse} from './core';
|
||||
|
||||
const statusOption = {
|
||||
type: 'select',
|
||||
defaults: 0,
|
||||
name: 'status',
|
||||
tips: '状态',
|
||||
options: [
|
||||
{
|
||||
name: '默认',
|
||||
value: 'default',
|
||||
},
|
||||
{
|
||||
name: '运行中',
|
||||
value: 'running',
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
name: '已完成',
|
||||
value: 'finished',
|
||||
color: 'teal'
|
||||
},
|
||||
{
|
||||
name: '错误',
|
||||
value: 'error',
|
||||
color: 'red',
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
const behaviors = [
|
||||
{
|
||||
id: 'behavior_001',
|
||||
name: '行为树1',
|
||||
desc: '行为树1说明',
|
||||
status: null,
|
||||
options: {},
|
||||
// data: [
|
||||
// {
|
||||
// id: '5a0c4b08-0b02-44f3-8918-79c6f9ab22fa',
|
||||
// type: 'startEvent',
|
||||
// name: '开始',
|
||||
// description: '',
|
||||
// width: 160,
|
||||
// height: 40,
|
||||
// position: {
|
||||
// x: 460,
|
||||
// y: 120,
|
||||
// },
|
||||
// data: {
|
||||
// status: 'default',
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: 'ec8741db-9580-44ab-8a58-8c731bf1faad',
|
||||
// type: 'sequenceFlow',
|
||||
// name: null,
|
||||
// description: null,
|
||||
// source: '5a0c4b08-0b02-44f3-8918-79c6f9ab22fa',
|
||||
// target: '7422aefc-7781-457a-b910-783f73ac0ac5',
|
||||
// data: {
|
||||
// status: 'default',
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// id: '7422aefc-7781-457a-b910-783f73ac0ac5',
|
||||
// type: 'task',
|
||||
// name: '任务',
|
||||
// description: '',
|
||||
// width: 160,
|
||||
// height: 40,
|
||||
// position: {
|
||||
// x: 460,
|
||||
// y: 120,
|
||||
// },
|
||||
// data: {
|
||||
// status: 'default',
|
||||
// }
|
||||
// },
|
||||
// ]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
const definitions = [
|
||||
{
|
||||
type: 'sequenceFlow',
|
||||
label: null,
|
||||
options: [
|
||||
{
|
||||
type: 'input',
|
||||
defaults: null,
|
||||
name: 'label',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'startEvent',
|
||||
label: '开始',
|
||||
desc: '行为树的开始节点,每个行为树仅允许一个开始节点',
|
||||
options: [
|
||||
statusOption
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'task',
|
||||
label: '任务节点',
|
||||
desc: '执行特定任务',
|
||||
options: [
|
||||
statusOption,
|
||||
{
|
||||
type: 'number',
|
||||
defaults: 0,
|
||||
name: 'counter',
|
||||
tips: '统计数量'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'parallelGateway',
|
||||
label: '并行网关',
|
||||
desc: '并行执行子节点',
|
||||
options: [
|
||||
statusOption,
|
||||
{
|
||||
type: 'number',
|
||||
defaults: 0,
|
||||
name: 'counter',
|
||||
tips: '统计数量'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'exclusiveGateway',
|
||||
label: '排他网关',
|
||||
desc: '选择满足条件的一个子节点执行',
|
||||
options: [
|
||||
statusOption,
|
||||
{
|
||||
type: 'number',
|
||||
defaults: 0,
|
||||
name: 'counter',
|
||||
tips: '统计数量'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/behavior/trees',
|
||||
method: 'get',
|
||||
response: () => {
|
||||
return createResponse(behaviors)
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/api/behavior/trees',
|
||||
method: 'post',
|
||||
response: ({body}) => {
|
||||
let value = behaviors.filter((b) => b.id == body?.id)
|
||||
if (value && value.length > 0) {
|
||||
value[0] = Object.assign(value[0], body)
|
||||
} else {
|
||||
behaviors.push(body)
|
||||
}
|
||||
return createResponse(behaviors)
|
||||
},
|
||||
},
|
||||
] as MockMethod[];
|
||||
16
modeler/mock/core.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
export const createResponse = (result: any,success: boolean = true, message: String = null)=> {
|
||||
return {
|
||||
success: success,
|
||||
message: message,
|
||||
result: result,
|
||||
}
|
||||
}
|
||||
61
modeler/mock/files.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
import {MockMethod} from 'vite-plugin-mock';
|
||||
import {createResponse} from './core';
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/finder/browser',
|
||||
method: 'post',
|
||||
response: () => {
|
||||
return {
|
||||
success: true,
|
||||
message: null,
|
||||
data: [
|
||||
{
|
||||
name: 'home',
|
||||
directory: true,
|
||||
path: '/home',
|
||||
children: [
|
||||
{
|
||||
name: 'users',
|
||||
directory: true,
|
||||
path: '/users',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'usr',
|
||||
directory: true,
|
||||
path: '/usr',
|
||||
children: [
|
||||
{
|
||||
name: 'opt',
|
||||
directory: true,
|
||||
path: '/opt',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'var',
|
||||
directory: true,
|
||||
path: '/var',
|
||||
children: [
|
||||
{
|
||||
name: 'lib',
|
||||
directory: true,
|
||||
path: '/lib',
|
||||
},
|
||||
]
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
] as MockMethod[];
|
||||
22
modeler/mock/samples.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
import {MockMethod} from 'vite-plugin-mock';
|
||||
import {createResponse} from './core';
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/samples',
|
||||
method: 'get',
|
||||
response: () => {
|
||||
return createResponse( {
|
||||
name: 'vben',
|
||||
})
|
||||
},
|
||||
},
|
||||
] as MockMethod[];
|
||||
6315
modeler/package-lock.json
generated
Normal file
47
modeler/package.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "modeler",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc -b && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@antv/x6": "^3.1.2",
|
||||
"@antv/x6-vue-shape": "^3.0.2",
|
||||
"ant-design-vue": "^4.2.6",
|
||||
"axios": "^1.13.2",
|
||||
"echarts": "^6.0.0",
|
||||
"js-cookie": "^3.0.5",
|
||||
"pinia": "^3.0.4",
|
||||
"vue": "^3.5.24",
|
||||
"vue-draggable-next": "^2.3.0",
|
||||
"vue-router": "^4.6.4",
|
||||
"vuedraggable": "^2.24.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
||||
"@tailwindcss/postcss": "^4.1.18",
|
||||
"@tailwindcss/vite": "^4.1.18",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/node": "^24.10.1",
|
||||
"@vitejs/plugin-vue": "^6.0.3",
|
||||
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
||||
"@vue/tsconfig": "^0.8.1",
|
||||
"autoprefixer": "^10.4.22",
|
||||
"less": "^4.4.2",
|
||||
"mockjs": "^1.1.0",
|
||||
"postcss-selector-parser": "^7.1.1",
|
||||
"tailwindcss": "^4.1.18",
|
||||
"typescript": "~5.9.3",
|
||||
"unplugin-auto-import": "^20.3.0",
|
||||
"unplugin-vue-components": "^30.0.0",
|
||||
"vite": "^7.2.4",
|
||||
"vite-plugin-dts": "^4.5.4",
|
||||
"vite-plugin-mock": "^3.0.2",
|
||||
"vitest": "^4.0.15",
|
||||
"vue-tsc": "^3.1.4"
|
||||
}
|
||||
}
|
||||
15
modeler/postcss.config.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
export default {
|
||||
plugins: {
|
||||
'@tailwindcss/postcss': {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
28
modeler/prettier.config.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
"printWidth": 200,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"vueIndentScriptAndStyle": true,
|
||||
"singleQuote": true,
|
||||
"quoteProps": "as-needed",
|
||||
"bracketSpacing": true,
|
||||
"trailingComma": "es5",
|
||||
"jsxBracketSameLine": true,
|
||||
"jsxSingleQuote": false,
|
||||
"arrowParens": "always",
|
||||
"insertPragma": false,
|
||||
"requirePragma": false,
|
||||
"proseWrap": "preserve",
|
||||
"htmlWhitespaceSensitivity": "strict",
|
||||
"endOfLine": "lf"
|
||||
};
|
||||
27
modeler/src/api/user.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the kernelstudio package.
|
||||
*
|
||||
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE file
|
||||
* that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import request, { HttpRequestClient } from '@/utils/request';
|
||||
import type { BasicResponse, UserLoginForm, UserLoginResult, UserSessionResult } from '@/types';
|
||||
|
||||
const req = new HttpRequestClient(HttpRequestClient.build({
|
||||
baseURL: '/',
|
||||
}));
|
||||
|
||||
export const fetchUserSession = (): Promise<UserSessionResult> => {
|
||||
return req.get<UserSessionResult>('/getInfo');
|
||||
};
|
||||
|
||||
export const signinByForm = (form: UserLoginForm): Promise<UserLoginResult> => {
|
||||
return req.postJson<UserLoginResult>('/login', form);
|
||||
};
|
||||
|
||||
export const logoutSession = (): Promise<BasicResponse> => {
|
||||
return request.post<BasicResponse>('/logout');
|
||||
};
|
||||
9
modeler/src/assets/actions/delete.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg t="1768461123253" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10989" width="200" height="200">
|
||||
<path
|
||||
d="M684.6425 277.598412l-1.436722-1.467421c-12.489452-12.461823-32.730449-12.461823-45.159526 0L479.700875 434.510138l-158.286026-158.315702c-12.555967-12.524245-32.793894-12.524245-45.225017 0-12.555967 12.462846-12.555967 32.701796 0 45.223994l158.348448 158.317749L276.129456 638.049834c-12.495592 12.429077-12.495592 32.671097 0 45.163619l1.49812 1.434675c12.429077 12.494569 32.66905 12.494569 45.221948 0l158.287049-158.286026 158.283979 158.286026c12.491499 12.494569 32.731472 12.494569 45.220924 0 12.495592-12.493545 12.495592-32.731472 0-45.222971l-158.285003-158.285003 158.285003-158.314679C697.138092 310.299185 697.138092 290.060235 684.6425 277.598412"
|
||||
p-id="10990" fill="#bfbfbf" ></path>
|
||||
<path
|
||||
d="M818.881854 140.522454c-187.332573-187.363272-491.033479-187.363272-678.364005 0-187.329503 187.329503-187.329503 491.032456 0 678.362982 187.330526 187.392948 491.031433 187.392948 678.364005 0C1006.274802 631.55491 1006.274802 327.851956 818.881854 140.522454M773.656837 773.660418c-162.344458 162.343435-425.569512 162.407903-587.914994 0-162.40688-162.344458-162.40688-425.602258 0-587.914994 162.344458-162.40688 425.569512-162.40688 587.914994 0C936.063717 348.059184 936.000272 611.31596 773.656837 773.660418"
|
||||
p-id="10991" fill="#bfbfbf" ></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |