Compare commits
254 Commits
60bcac32c5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 5079f17df0 | |||
| 913dea7afa | |||
| 6f48a06438 | |||
| 6941954e14 | |||
| 2c834b9b2f | |||
| 447aef0fe3 | |||
| 873e31970f | |||
| b39a85a074 | |||
| d8c3429163 | |||
| dbbc8a27c3 | |||
| 8e96285c0a | |||
| 559a550157 | |||
| a08e061979 | |||
| 8975777cd5 | |||
| f51619526a | |||
| 0691fddbf1 | |||
| 2d60a8b90f | |||
| e92423ee54 | |||
| 99dfb6f009 | |||
| 4404d0e411 | |||
| a67e3e42ba | |||
| 44ff489c08 | |||
| 3c06e77c6d | |||
| e555c95058 | |||
| 8839c65d7f | |||
| f9eb10c783 | |||
| 949e059c8f | |||
| 9858787570 | |||
| 5a8c707340 | |||
| e1fe2cf7da | |||
| 3ae6a693e1 | |||
| 178bceabbb | |||
| 6969fe5744 | |||
| d43effe612 | |||
| f66d707520 | |||
| e82455a220 | |||
| 2b2a11831d | |||
| a10b16a0ff | |||
| 85b4a7dd2f | |||
| 835bb56851 | |||
| 5c83b561cc | |||
| bb45ff557b | |||
| eff0b87da8 | |||
| 254401d8f1 | |||
| d8c238a9bb | |||
| aefc2c688e | |||
| 5f1ba38c6b | |||
| e57f0f19d5 | |||
| 79364b951d | |||
| 1270bd7d02 | |||
| a277fe22a6 | |||
| b424774f3b | |||
| 766425bae5 | |||
| 836e42625e | |||
| 0e6b6d9f45 | |||
| 50c1cc5bf2 | |||
| 69c01bc62b | |||
| 7c71a38f68 | |||
| bd62efca3f | |||
| 3946bc561a | |||
| 5179ab785c | |||
| 5276a6b16f | |||
| c0da7bd0d9 | |||
| dafd7115a8 | |||
| 1061020791 | |||
| 045117011b | |||
| ee019d3c0f | |||
| 8a0dfb1ab8 | |||
| 08030c77c2 | |||
| 230116bdd7 | |||
| a65d296421 | |||
| 78e5833514 | |||
| 6add28fdfb | |||
| 2fafd931cc | |||
| 72f4caf555 | |||
| 866fd215f2 | |||
| 3e871e2dbd | |||
| 094dcf857d | |||
| 50a369c722 | |||
| 80fa2de819 | |||
|
|
b97f9aa32b | ||
| 94b15ef412 | |||
| 11e25fd0de | |||
| eb57d2d228 | |||
| bcb0ca03b1 | |||
| 7610076760 | |||
| e52aaa1680 | |||
|
|
fecfb8d39c | ||
| 4e28782d59 | |||
|
|
150966824e | ||
|
|
a4d9e8d8eb | ||
|
|
a0d8f555f9 | ||
| 615eac3bfe | |||
|
|
705021b391 | ||
| e24920acf1 | |||
|
|
889cc02631 | ||
|
|
cc1e003bc4 | ||
| eeed692ba6 | |||
| b3563a05d6 | |||
| a7c19fb7e7 | |||
| 36809d4033 | |||
| 1dba7584cd | |||
| 35d2766442 | |||
| ce832fb16d | |||
| e9503358d3 | |||
| 3b3370c440 | |||
| d8719c30c6 | |||
| 9ff0e50bba | |||
|
|
2838938cfa | ||
| 1c562c134c | |||
| c4cc3cc30b | |||
|
|
d1f720f691 | ||
|
|
cb1019b7d7 | ||
| 18827cfbe7 | |||
| 3fe32e4ac3 | |||
| c6c38332d9 | |||
|
|
168ced6b27 | ||
|
|
499734efe8 | ||
|
|
27c8fc13c6 | ||
|
|
505092bcf4 | ||
| f51b27dc7c | |||
|
|
41ba11dc9b | ||
| a6c6cf2427 | |||
|
|
158512cd12 | ||
|
|
3a3ab0c9c6 | ||
|
|
b08c74260d | ||
|
|
02e9ca26a1 | ||
| 373dc390fa | |||
|
|
8958ecd6dc | ||
|
|
6656479327 | ||
|
|
18ccf490e4 | ||
| 2ed1129fe4 | |||
| 4a0602ce4e | |||
| 8844830afc | |||
| bcc450141e | |||
| 25e6ac1cbe | |||
| 8b2f4dab89 | |||
| 4f60d68c4f | |||
| b63ad360d0 | |||
|
|
c724a7acf7 | ||
|
|
185e490560 | ||
| ce4c23eff8 | |||
| 9f4ef1ab94 | |||
| c800811bed | |||
|
|
d13359c803 | ||
|
|
65ea1cfd6b | ||
|
|
4455d38a61 | ||
|
|
6dd4392f0c | ||
|
|
974f403784 | ||
|
|
82bbfb83ca | ||
|
|
fc7b5e6c63 | ||
|
|
8dc867acb6 | ||
|
|
c17197d6e5 | ||
| 235fd9b6e1 | |||
| 76022cf09a | |||
| 4ff5bf500c | |||
| be417189e0 | |||
| a88d74ea1d | |||
|
|
c2bfb43d41 | ||
|
|
c5d81a4c52 | ||
|
|
6d76cb8d5e | ||
|
|
b97837ec6a | ||
|
|
f2e81c6e5c | ||
|
|
83a38c6db8 | ||
|
|
22e71a24d3 | ||
|
|
6019738aca | ||
| 7847dbc89f | |||
| cc01c9ece8 | |||
| 8f29e230d0 | |||
| 711d7bf3da | |||
|
|
29e17773af | ||
|
|
db97d8a026 | ||
|
|
2e55254412 | ||
|
|
1504c3fc1b | ||
|
|
0cf4c9b47e | ||
|
|
fa0c93044c | ||
|
|
33a77428db | ||
| 26a89a66d1 | |||
| f72105134f | |||
|
|
2198e108a4 | ||
|
|
fe94cec559 | ||
| af3a97175a | |||
| c1c67e826b | |||
| 8a946c4c84 | |||
| d9a55d0c95 | |||
|
|
7b578f5d63 | ||
| dde470c9da | |||
| 91adb9517e | |||
| 99c100f2ac | |||
|
|
a2f2cbb185 | ||
|
|
d96941ea9b | ||
|
|
5a7b57d603 | ||
|
|
27f8810401 | ||
|
|
4980ba2da4 | ||
|
|
3a086e9405 | ||
| f2f8892276 | |||
| 152a7b59af | |||
| 956d3f69ea | |||
| 6fb020355b | |||
|
|
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 | ||
| 577bc3e1c0 | |||
| 7c5c5d89ee | |||
| cd18e2a71d | |||
| 06426bcb31 | |||
|
|
000f8d4bc5 | ||
| ba5913a50b | |||
|
|
c8a889815d | ||
| 19024e8486 | |||
|
|
0bf9a5da94 | ||
| c90dfd8ccb | |||
|
|
4363155c50 |
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@@ -0,0 +1,9 @@
|
||||
**/target/
|
||||
**/.git/
|
||||
**/.idea/
|
||||
**/*.iml
|
||||
**/.vscode/
|
||||
**/node_modules/
|
||||
**/*.log
|
||||
**/.DS_Store
|
||||
**/uploadPath/
|
||||
15
.env.example
Normal file
15
.env.example
Normal file
@@ -0,0 +1,15 @@
|
||||
# 复制为 .env 后 docker compose 会自动加载
|
||||
# copy .env.example .env
|
||||
|
||||
MYSQL_ROOT_PASSWORD=root
|
||||
MYSQL_DATABASE=autosolution_db
|
||||
MYSQL_PORT=3307
|
||||
|
||||
REDIS_PASSWORD=123456
|
||||
REDIS_PORT=6379
|
||||
|
||||
APP_PORT=1777
|
||||
APP_IMAGE_TAG=latest
|
||||
|
||||
# JVM 可选
|
||||
# JAVA_OPTS=-Xms512m -Xmx1024m
|
||||
15
.gitignore
vendored
15
.gitignore
vendored
@@ -8,6 +8,8 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
node_modules/
|
||||
|
||||
######################################################################
|
||||
# IDE
|
||||
|
||||
@@ -36,6 +38,10 @@ dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
######################################################################
|
||||
# Docker / local secrets
|
||||
.env
|
||||
|
||||
######################################################################
|
||||
# Others
|
||||
*.log
|
||||
@@ -45,3 +51,12 @@ nbdist/
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
||||
modeler/pnpm-lock.yaml
|
||||
|
||||
######################################################################
|
||||
# Mock bundled cache files
|
||||
**/*.bundled_*.mjs
|
||||
**/__*.bundled_*.mjs
|
||||
**/___*.bundled_*.mjs
|
||||
modeler/types/components.d.ts
|
||||
modeler/types/auto-imports.d.ts
|
||||
|
||||
114
DEPLOY_OFFLINE.md
Normal file
114
DEPLOY_OFFLINE.md
Normal file
@@ -0,0 +1,114 @@
|
||||
# Docker 离线部署说明(方式 A)
|
||||
|
||||
执行 `docker compose up -d` 即可启动。
|
||||
|
||||
## 1. 交付清单
|
||||
|
||||
请将以下内容放在同一目录(示例:`app/`):
|
||||
|
||||
- `docker-compose.yml`
|
||||
- `.env`(或将 `.env.example` 复制为 `.env` 后修改)
|
||||
- `bundle-images.tar`(包含 `auto-solution-admin`、`mysql:8.0`、`redis:7-alpine`)
|
||||
- `docker/mysql/init/01-ruoyi-table.sql`
|
||||
- `docker/mysql/init/02-ruoyi-extra.sql`
|
||||
- `docker/mysql/init/03-data.sql`
|
||||
|
||||
目录示例:
|
||||
|
||||
```text
|
||||
app/
|
||||
├─ docker-compose.yml
|
||||
├─ .env
|
||||
├─ bundle-images.tar
|
||||
└─ docker/
|
||||
└─ mysql/
|
||||
└─ init/
|
||||
├─ 00-create-db.sql
|
||||
├─ 03-data.sql
|
||||
```
|
||||
|
||||
## 2. 首次部署
|
||||
|
||||
在 `app` 目录执行:
|
||||
|
||||
```bash
|
||||
docker load -i bundle-images.tar
|
||||
docker compose down -v
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
说明:
|
||||
|
||||
- `down -v` 会删除旧数据卷,确保 MySQL 首次初始化时执行 `docker/mysql/init` 下的 SQL。
|
||||
- SQL 执行顺序按文件名字典序,务必保持 `01 -> 02 -> 03`。
|
||||
|
||||
## 3. 启动验证
|
||||
|
||||
```bash
|
||||
docker ps
|
||||
docker inspect autosolution-mysql --format '{{.State.Health.Status}}'
|
||||
docker logs --tail 100 autosolution-mysql
|
||||
docker logs --tail 100 autosolution-app
|
||||
```
|
||||
|
||||
期望结果:
|
||||
|
||||
- `autosolution-mysql` 状态为 `healthy`
|
||||
- `autosolution-app` 状态为 `Up`
|
||||
|
||||
## 4. 访问地址
|
||||
|
||||
- 后端默认端口:`1777`
|
||||
- 访问地址:`http://<服务器IP>:1777`
|
||||
|
||||
## 5. 常见问题
|
||||
|
||||
### 5.1 `Table 'autosolution_db.sys_config' doesn't exist`
|
||||
|
||||
原因:初始化 SQL 未执行或执行失败。
|
||||
|
||||
处理:
|
||||
|
||||
1. 确认 `docker/mysql/init` 下 SQL 文件存在且顺序正确
|
||||
2. 执行:
|
||||
|
||||
```bash
|
||||
docker compose down -v
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
3. 查看 MySQL 日志定位 SQL 报错:
|
||||
|
||||
```bash
|
||||
docker logs --tail 300 autosolution-mysql
|
||||
```
|
||||
|
||||
### 5.2 `dependency failed to start: container autosolution-mysql is unhealthy`
|
||||
|
||||
原因:MySQL 未通过健康检查(通常是 SQL 未执行完成或报错)。
|
||||
|
||||
处理:
|
||||
|
||||
```bash
|
||||
docker logs --tail 300 autosolution-mysql
|
||||
```
|
||||
|
||||
根据日志修复 SQL 后重新 `down -v` 再启动。
|
||||
|
||||
## 6. 版本升级
|
||||
|
||||
替换新的 `bundle-images.tar`(及必要 SQL)后执行:
|
||||
|
||||
```bash
|
||||
docker load -i bundle-images.tar
|
||||
docker compose down
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
如果本次升级包含库初始化变更并要求重建,请改用:
|
||||
|
||||
```bash
|
||||
docker compose down -v
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
18
Dockerfile
Normal file
18
Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
# 运行已打包的 JAR(不依赖源码目录)
|
||||
# 要求构建上下文中存在 solution-admin.jar
|
||||
# 构建:docker build -t auto-solution-admin:latest .
|
||||
|
||||
FROM eclipse-temurin:11-jre-jammy
|
||||
LABEL org.opencontainers.image.title="auto-solution-admin"
|
||||
|
||||
WORKDIR /app
|
||||
RUN mkdir -p /app/uploadPath
|
||||
|
||||
COPY solution-admin.jar /app/app.jar
|
||||
|
||||
ENV TZ=Asia/Shanghai \
|
||||
JAVA_OPTS="-Xms512m -Xmx1024m"
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app/app.jar --spring.profiles.active=druid,docker"]
|
||||
@@ -61,6 +61,26 @@
|
||||
<artifactId>solution-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-behaviour</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-algo</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-rule</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-scene</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -14,6 +14,16 @@ public class SolutionApplication
|
||||
{
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SolutionApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 方案自动化生成启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
System.out.println("方案自动化生成启动成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
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.checkerframework.checker.units.qual.A;
|
||||
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.system.domain.Behaviortree;
|
||||
import com.solution.system.service.IBehaviortreeService;
|
||||
import com.solution.common.utils.poi.ExcelUtil;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 行为树主Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Api("行为树管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/behaviortree")
|
||||
public class BehaviortreeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBehaviortreeService behaviortreeService;
|
||||
|
||||
@Autowired
|
||||
private BehaviortreeProcessor behaviortreeProcessor;
|
||||
|
||||
@GetMapping(value = "/platform/{id}")
|
||||
public AjaxResult fromPlatform(@PathVariable("id") Integer id)
|
||||
{
|
||||
return success(behaviortreeService.findOneByPlatformId(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询行为树主列表
|
||||
*/
|
||||
@ApiOperation("获取行为树列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Behaviortree behaviortree)
|
||||
{
|
||||
startPage();
|
||||
List<Behaviortree> list = behaviortreeService.selectBehaviortreeList(behaviortree);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出行为树主列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:export')")
|
||||
@Log(title = "行为树主", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Behaviortree behaviortree)
|
||||
{
|
||||
List<Behaviortree> list = behaviortreeService.selectBehaviortreeList(behaviortree);
|
||||
ExcelUtil<Behaviortree> util = new ExcelUtil<Behaviortree>(Behaviortree.class);
|
||||
util.exportExcel(response, list, "行为树主数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取行为树主详细信息
|
||||
*/
|
||||
@ApiOperation("获取行为树详情")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(behaviortreeService.selectBehaviortreeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增行为树主
|
||||
*/
|
||||
@ApiOperation("新增行为树主")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:add')")
|
||||
@Log(title = "行为树主", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Behaviortree behaviortree)
|
||||
{
|
||||
return toAjax(behaviortreeProcessor.create(behaviortree));
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制行为树
|
||||
*/
|
||||
@ApiOperation("复制行为树")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:add')")
|
||||
@Log(title = "行为树主", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/copy")
|
||||
public AjaxResult copy(@RequestBody Behaviortree behaviortree)
|
||||
{
|
||||
//return toAjax(behaviortreeService.copy(behaviortree));
|
||||
return toAjax(behaviortreeProcessor.copy(behaviortree));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行为树主
|
||||
*/
|
||||
@ApiOperation("修改行为树主")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:edit')")
|
||||
@Log(title = "行为树主", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Behaviortree behaviortree)
|
||||
{
|
||||
return toAjax(behaviortreeProcessor.update(behaviortree));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除行为树主
|
||||
*/
|
||||
@ApiOperation("删除行为树主")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:remove')")
|
||||
@Log(title = "行为树主", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(behaviortreeService.deleteBehaviortreeByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据平台id获取该行为树的下属
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("根据平台id获取该行为树的下属")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:query')")
|
||||
@GetMapping("/underling/{platformId}")
|
||||
public AjaxResult getUnderling(@PathVariable Integer platformId)
|
||||
{
|
||||
return success(behaviortreeService.getUnderling(platformId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据场景id获取总指挥的行为树的原数据
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("根据场景id获取总指挥的行为树的原数据")
|
||||
@GetMapping("/commander/{scenarioId}")
|
||||
public AjaxResult getCommander(@PathVariable Integer scenarioId){
|
||||
return success(behaviortreeService.getCommander(scenarioId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.solution.web.controller.behaviour;
|
||||
|
||||
import com.solution.common.core.controller.BaseController;
|
||||
import com.solution.common.core.domain.AjaxResult;
|
||||
import com.solution.system.service.HbNodeCommandService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/node/command")
|
||||
public class HbNodeCommandController extends BaseController {
|
||||
|
||||
private final HbNodeCommandService nodeCommandService;
|
||||
|
||||
public HbNodeCommandController(HbNodeCommandService nodeCommandService) {
|
||||
this.nodeCommandService = nodeCommandService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/all")
|
||||
public AjaxResult all() {
|
||||
return success(nodeCommandService.findAll());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.solution.web.controller.behaviour;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.solution.system.domain.Nodeconnection;
|
||||
import com.solution.system.service.INodeconnectionService;
|
||||
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.common.utils.poi.ExcelUtil;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 节点连接Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Api("节点连接管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/nodeconnection")
|
||||
public class NodeconnectionController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private INodeconnectionService nodeconnectionService;
|
||||
|
||||
/**
|
||||
* 查询节点连接列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeconnection:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Nodeconnection nodeconnection)
|
||||
{
|
||||
startPage();
|
||||
List<Nodeconnection> list = nodeconnectionService.selectNodeconnectionList(nodeconnection);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出节点连接列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeconnection:export')")
|
||||
@Log(title = "节点连接", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Nodeconnection nodeconnection)
|
||||
{
|
||||
List<Nodeconnection> list = nodeconnectionService.selectNodeconnectionList(nodeconnection);
|
||||
ExcelUtil<Nodeconnection> util = new ExcelUtil<Nodeconnection>(Nodeconnection.class);
|
||||
util.exportExcel(response, list, "节点连接数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点连接详细信息
|
||||
*/
|
||||
@ApiOperation("获取节点连接详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeconnection:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(nodeconnectionService.selectNodeconnectionById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增节点连接
|
||||
*/
|
||||
@ApiOperation("新增节点连接")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeconnection:add')")
|
||||
@Log(title = "节点连接", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Nodeconnection nodeconnection)
|
||||
{
|
||||
return toAjax(nodeconnectionService.insertNodeconnection(nodeconnection));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改节点连接
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeconnection:edit')")
|
||||
@Log(title = "节点连接", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Nodeconnection nodeconnection)
|
||||
{
|
||||
return toAjax(nodeconnectionService.updateNodeconnection(nodeconnection));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除节点连接
|
||||
*/
|
||||
@ApiOperation("删除节点连接")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeconnection:remove')")
|
||||
@Log(title = "节点连接", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(nodeconnectionService.deleteNodeconnectionByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.solution.web.controller.behaviour;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
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.system.domain.Nodeparameter;
|
||||
import com.solution.system.service.INodeparameterService;
|
||||
import com.solution.common.utils.poi.ExcelUtil;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 节点参数Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Api("节点参数管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/nodeparameter")
|
||||
public class NodeparameterController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private INodeparameterService nodeparameterService;
|
||||
|
||||
/**
|
||||
* 查询节点参数列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeparameter:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Nodeparameter nodeparameter)
|
||||
{
|
||||
startPage();
|
||||
List<Nodeparameter> list = nodeparameterService.selectNodeparameterList(nodeparameter);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出节点参数列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeparameter:export')")
|
||||
@Log(title = "节点参数", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Nodeparameter nodeparameter)
|
||||
{
|
||||
List<Nodeparameter> list = nodeparameterService.selectNodeparameterList(nodeparameter);
|
||||
ExcelUtil<Nodeparameter> util = new ExcelUtil<Nodeparameter>(Nodeparameter.class);
|
||||
util.exportExcel(response, list, "节点参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点参数详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeparameter:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(nodeparameterService.selectNodeparameterById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增节点参数
|
||||
*/
|
||||
@ApiOperation("新增节点参数")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeparameter:add')")
|
||||
@Log(title = "节点参数", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Nodeparameter nodeparameter)
|
||||
{
|
||||
return toAjax(nodeparameterService.insertNodeparameter(nodeparameter));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改节点参数
|
||||
*/
|
||||
@ApiOperation("修改节点参数")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeparameter:edit')")
|
||||
@Log(title = "节点参数", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Nodeparameter nodeparameter)
|
||||
{
|
||||
return toAjax(nodeparameterService.updateNodeparameter(nodeparameter));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除节点参数
|
||||
*/
|
||||
@ApiOperation("删除节点参数")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeparameter:remove')")
|
||||
@Log(title = "节点参数", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(nodeparameterService.deleteNodeparameterByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.solution.web.controller.behaviour;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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;
|
||||
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;
|
||||
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.system.domain.Nodetemplate;
|
||||
import com.solution.system.service.INodetemplateService;
|
||||
import com.solution.common.utils.poi.ExcelUtil;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 节点模板Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Api("节点模板管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/nodetemplate")
|
||||
public class NodetemplateController extends BaseController {
|
||||
@Autowired
|
||||
private INodetemplateService nodetemplateService;
|
||||
|
||||
@Autowired
|
||||
private INodeparameterService nodeparameterService;
|
||||
|
||||
@Autowired
|
||||
private ITemplateparameterdefService templateparameterdefService;
|
||||
|
||||
/**
|
||||
* 查询节点模板列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Nodetemplate nodetemplate) {
|
||||
startPage();
|
||||
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
|
||||
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<Nodetemplate>> listAll() {
|
||||
Nodetemplate nodetemplate = new Nodetemplate();
|
||||
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return R.ok(null);
|
||||
}
|
||||
Map<String, List<NodetemplateDTO>> groupedByTemplateType = list.stream()
|
||||
.map(template -> {
|
||||
NodetemplateDTO dto = new NodetemplateDTO();
|
||||
dto.setId(template.getId());
|
||||
dto.setName(template.getName());
|
||||
dto.setDescription(template.getDescription());
|
||||
dto.setEnglishName(template.getEnglishName());
|
||||
dto.setLogicHandler(template.getLogicHandler());
|
||||
dto.setTemplateType(template.getTemplateType());
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.groupingBy(NodetemplateDTO::getTemplateType));
|
||||
List<NodetemplateVO> vos = new ArrayList<>();
|
||||
groupedByTemplateType.forEach((key, value) -> {
|
||||
// 处理逻辑
|
||||
NodetemplateVO vo = new NodetemplateVO();
|
||||
vo.setTemplateType(key);
|
||||
vo.setDtoList(value);
|
||||
vos.add(vo);
|
||||
});
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出节点模板列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:export')")
|
||||
@Log(title = "节点模板", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Nodetemplate nodetemplate) {
|
||||
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
|
||||
ExcelUtil<Nodetemplate> util = new ExcelUtil<Nodetemplate>(Nodetemplate.class);
|
||||
util.exportExcel(response, list, "节点模板数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点模板详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(nodetemplateService.selectNodetemplateById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增节点模板
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:add')")
|
||||
@Log(title = "节点模板", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Nodetemplate nodetemplate) {
|
||||
return toAjax(nodetemplateService.insertNodetemplate(nodetemplate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改节点模板
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:edit')")
|
||||
@Log(title = "节点模板", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Nodetemplate nodetemplate) {
|
||||
return toAjax(nodetemplateService.updateNodetemplate(nodetemplate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除节点模板
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:remove')")
|
||||
@Log(title = "节点模板", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(nodetemplateService.deleteNodetemplateByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.solution.web.controller.behaviour;
|
||||
|
||||
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.system.domain.Templateparameterdef;
|
||||
import com.solution.system.service.ITemplateparameterdefService;
|
||||
import com.solution.common.utils.poi.ExcelUtil;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 模板参数定义Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/system/templateparameterdef")
|
||||
public class TemplateparameterdefController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ITemplateparameterdefService templateparameterdefService;
|
||||
|
||||
/**
|
||||
* 查询模板参数定义列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Templateparameterdef templateparameterdef)
|
||||
{
|
||||
startPage();
|
||||
List<Templateparameterdef> list = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板参数定义列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:export')")
|
||||
@Log(title = "模板参数定义", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Templateparameterdef templateparameterdef)
|
||||
{
|
||||
List<Templateparameterdef> list = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
|
||||
ExcelUtil<Templateparameterdef> util = new ExcelUtil<Templateparameterdef>(Templateparameterdef.class);
|
||||
util.exportExcel(response, list, "模板参数定义数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模板参数定义详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(templateparameterdefService.selectTemplateparameterdefById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模板参数定义
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:add')")
|
||||
@Log(title = "模板参数定义", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Templateparameterdef templateparameterdef)
|
||||
{
|
||||
return toAjax(templateparameterdefService.insertTemplateparameterdef(templateparameterdef));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模板参数定义
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:edit')")
|
||||
@Log(title = "模板参数定义", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Templateparameterdef templateparameterdef)
|
||||
{
|
||||
return toAjax(templateparameterdefService.updateTemplateparameterdef(templateparameterdef));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板参数定义
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:templateparameterdef:remove')")
|
||||
@Log(title = "模板参数定义", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(templateparameterdefService.deleteTemplateparameterdefByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package com.solution.web.controller.behaviour;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.solution.common.core.domain.R;
|
||||
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.NodeparameterVO;
|
||||
import com.solution.web.controller.behaviour.vo.NodetemplateVO;
|
||||
import com.solution.web.controller.behaviour.vo.TreenodeinstanceVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
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.system.domain.Treenodeinstance;
|
||||
import com.solution.system.service.ITreenodeinstanceService;
|
||||
import com.solution.common.utils.poi.ExcelUtil;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 行为树实例节点Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Api("行为树实例节点管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/treenodeinstance")
|
||||
public class TreenodeinstanceController extends BaseController {
|
||||
@Autowired
|
||||
private ITreenodeinstanceService treenodeinstanceService;
|
||||
@Autowired
|
||||
private INodeparameterService nodeparameterService;
|
||||
|
||||
@Autowired
|
||||
private ITemplateparameterdefService templateparameterdefService;
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Treenodeinstance treenodeinstance) {
|
||||
startPage();
|
||||
List<Treenodeinstance> list = treenodeinstanceService.selectTreenodeinstanceList(treenodeinstance);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出行为树实例节点列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:export')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Treenodeinstance treenodeinstance) {
|
||||
List<Treenodeinstance> list = treenodeinstanceService.selectTreenodeinstanceList(treenodeinstance);
|
||||
ExcelUtil<Treenodeinstance> util = new ExcelUtil<Treenodeinstance>(Treenodeinstance.class);
|
||||
util.exportExcel(response, list, "行为树实例节点数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取行为树实例节点详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(treenodeinstanceService.selectTreenodeinstanceById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("行为树实例节点详情展示")
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:query')")
|
||||
@GetMapping(value = "/getInfo")
|
||||
public R<TreenodeinstanceVO> getInfoParams(@PathVariable("id") Long id) {
|
||||
TreenodeinstanceVO treenodeinstanceVO = new TreenodeinstanceVO();
|
||||
Treenodeinstance treenodeinstance = treenodeinstanceService.selectTreenodeinstanceById(id);
|
||||
BeanUtils.copyProperties(treenodeinstance, treenodeinstanceVO);
|
||||
|
||||
|
||||
Templateparameterdef templateparameterdef = new Templateparameterdef();
|
||||
templateparameterdef.setTemplateId(treenodeinstance.getTemplateId());
|
||||
List<Templateparameterdef> templateparameterdefs = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
|
||||
if (CollectionUtils.isEmpty(templateparameterdefs)) {
|
||||
return R.ok(treenodeinstanceVO);
|
||||
}
|
||||
List<NodeparameterVO> nodeparameterVOList = new ArrayList<>();
|
||||
treenodeinstanceVO.setNodeparameterVOList(nodeparameterVOList);
|
||||
Nodeparameter nodeparameter = new Nodeparameter();
|
||||
nodeparameter.setNodeInstanceId(id);
|
||||
List<Nodeparameter> nodeparameters = nodeparameterService.selectNodeparameterList(nodeparameter);
|
||||
Map<Long, Nodeparameter> nodeParameterMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(nodeparameters)) {
|
||||
nodeParameterMap.putAll(nodeparameters.stream()
|
||||
.collect(Collectors.toMap(
|
||||
Nodeparameter::getParamDefId,
|
||||
Function.identity(), (existing, replacement) -> existing
|
||||
)));
|
||||
|
||||
}
|
||||
templateparameterdefs.forEach(t -> {
|
||||
NodeparameterVO vo = new NodeparameterVO();
|
||||
vo.setDescription(t.getDescription());
|
||||
vo.setParamKey(t.getParamKey());
|
||||
vo.setDataType(t.getDataType());
|
||||
vo.setDefaultValue(t.getDefaultValue());
|
||||
vo.setParamDefId(t.getId());
|
||||
vo.setNodeInstanceId(id);
|
||||
if (nodeParameterMap.containsKey(t.getId())) {
|
||||
Nodeparameter nodeparameter1 = nodeParameterMap.get(t.getId());
|
||||
vo.setId(nodeparameter1.getId());
|
||||
vo.setValue(nodeparameter1.getValue());
|
||||
}
|
||||
nodeparameterVOList.add(vo);
|
||||
});
|
||||
return R.ok(treenodeinstanceVO);
|
||||
}
|
||||
|
||||
@ApiOperation("行为树实例节点保存或者跟新")
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:add')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/saveOrUpdate")
|
||||
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(treenodeinstance.getId());
|
||||
}
|
||||
templateparameterdefs.forEach(t -> {
|
||||
Nodeparameter nodeparameter = new Nodeparameter();
|
||||
nodeparameter.setNodeInstanceId(treenodeinstance.getId());
|
||||
nodeparameter.setParamDefId(t.getId());
|
||||
nodeparameter.setValue(t.getDefaultValue());
|
||||
nodeparameterService.insertNodeparameter(nodeparameter);
|
||||
});
|
||||
}
|
||||
treenodeinstanceService.updateTreenodeinstance(treenodeinstance);
|
||||
return R.ok(treenodeinstance.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增行为树实例节点
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:add')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Treenodeinstance treenodeinstance) {
|
||||
|
||||
return toAjax(treenodeinstanceService.insertTreenodeinstance(treenodeinstance));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行为树实例节点
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:edit')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Treenodeinstance treenodeinstance) {
|
||||
return toAjax(treenodeinstanceService.updateTreenodeinstance(treenodeinstance));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除行为树实例节点
|
||||
*/
|
||||
@ApiOperation("删除行为树实例节点")
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:remove')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public R<Integer> remove(@PathVariable Long id) {
|
||||
Nodeparameter nodeparameter = new Nodeparameter();
|
||||
nodeparameter.setNodeInstanceId(id);
|
||||
List<Nodeparameter> nodeparameters = nodeparameterService.selectNodeparameterList(nodeparameter);
|
||||
if (!CollectionUtils.isEmpty(nodeparameters)) {
|
||||
List<Long> ids = nodeparameters.stream()
|
||||
.map(Nodeparameter::getId)
|
||||
.collect(Collectors.toList());
|
||||
Long[] idsArray = ids.toArray(new Long[0]);
|
||||
nodeparameterService.deleteNodeparameterByIds(idsArray);
|
||||
}
|
||||
return R.ok(treenodeinstanceService.deleteTreenodeinstanceById(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.solution.web.controller.behaviour.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
public class BehaviortreeVO {
|
||||
|
||||
private Long id;
|
||||
/** 行为树名称 */
|
||||
@ApiModelProperty(name = "行为树名称")
|
||||
private String name;
|
||||
|
||||
/** 行为树描述 */
|
||||
@ApiModelProperty(name = "行为树描述")
|
||||
private String description;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "英文名称")
|
||||
private String englishName;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
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 String getEnglishName() {
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public void setEnglishName(String englishName) {
|
||||
this.englishName = englishName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.solution.web.controller.behaviour.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "NodeparameterVO", description = "节点参数vo")
|
||||
public class NodeparameterVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/** 关联到哪个节点实例 (外键: TreeInstanceNode.id) */
|
||||
@ApiModelProperty("节点实例id")
|
||||
private Long nodeInstanceId;
|
||||
|
||||
/** 关联到哪个参数定义 (外键: TemplateParameterDef.id) */
|
||||
@ApiModelProperty("模板参数定义表id")
|
||||
private Long paramDefId;
|
||||
|
||||
/** 节点实例设置的具体参数值 (覆盖模板默认值) */
|
||||
@ApiModelProperty("节点实例设置的具体参数值 (覆盖模板默认值)")
|
||||
private String value;
|
||||
|
||||
@ApiModelProperty("参数键名, 例如: target_name, speed")
|
||||
private String paramKey;
|
||||
|
||||
/** 参数数据类型, 例如: "float", "int", "string", "bool" */
|
||||
@ApiModelProperty("参数数据类型, 例如: float, int, string, bool")
|
||||
private String dataType;
|
||||
|
||||
/** 默认值 */
|
||||
@ApiModelProperty("默认值")
|
||||
private String defaultValue;
|
||||
|
||||
@ApiModelProperty("参数名称描述")
|
||||
private String description;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getNodeInstanceId() {
|
||||
return nodeInstanceId;
|
||||
}
|
||||
|
||||
public void setNodeInstanceId(Long nodeInstanceId) {
|
||||
this.nodeInstanceId = nodeInstanceId;
|
||||
}
|
||||
|
||||
public Long getParamDefId() {
|
||||
return paramDefId;
|
||||
}
|
||||
|
||||
public void setParamDefId(Long paramDefId) {
|
||||
this.paramDefId = paramDefId;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getParamKey() {
|
||||
return paramKey;
|
||||
}
|
||||
|
||||
public void setParamKey(String paramKey) {
|
||||
this.paramKey = paramKey;
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.solution.web.controller.behaviour.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "NodetemplateDTO", description = "节点模板dto")
|
||||
public class NodetemplateDTO {
|
||||
private Long id;
|
||||
|
||||
/** 模板名称, 例如: "MoveToTarget", "IsTargetVisible" */
|
||||
@ApiModelProperty("模板名称, 例如: MoveToTarget, IsTargetVisible")
|
||||
private String name;
|
||||
|
||||
/** 对应的逻辑执行代码/脚本/函数名 */
|
||||
@ApiModelProperty("对应的逻辑执行代码/脚本/函数名")
|
||||
private String logicHandler;
|
||||
|
||||
/** 模板描述 */
|
||||
@ApiModelProperty("模板描述")
|
||||
private String description;
|
||||
|
||||
/** afsim 中转换的节点名 */
|
||||
@ApiModelProperty("afsim 中转换的节点名")
|
||||
private String englishName;
|
||||
|
||||
private String templateType;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getLogicHandler() {
|
||||
return logicHandler;
|
||||
}
|
||||
|
||||
public void setLogicHandler(String logicHandler) {
|
||||
this.logicHandler = logicHandler;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getEnglishName() {
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public void setEnglishName(String englishName) {
|
||||
this.englishName = englishName;
|
||||
}
|
||||
|
||||
public String getTemplateType() {
|
||||
return templateType;
|
||||
}
|
||||
|
||||
public void setTemplateType(String templateType) {
|
||||
this.templateType = templateType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.solution.web.controller.behaviour.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "NodetemplateVO", description = "节点模板vo")
|
||||
public class NodetemplateVO {
|
||||
/** 模版类型,节点模版或者条件判断,例如“node”,precondition“ */
|
||||
@ApiModelProperty("模版类型,节点模版或者条件判断,例如“node”,precondition“")
|
||||
private String templateType;
|
||||
|
||||
@ApiModelProperty("节点模板数据")
|
||||
private List<NodetemplateDTO> dtoList;
|
||||
|
||||
public String getTemplateType() {
|
||||
return templateType;
|
||||
}
|
||||
|
||||
public void setTemplateType(String templateType) {
|
||||
this.templateType = templateType;
|
||||
}
|
||||
|
||||
public List<NodetemplateDTO> getDtoList() {
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
public void setDtoList(List<NodetemplateDTO> dtoList) {
|
||||
this.dtoList = dtoList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.solution.web.controller.behaviour.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "TreenodeinstanceVO", description = "节点vo")
|
||||
public class TreenodeinstanceVO {
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("行为树id")
|
||||
private Long treeId;
|
||||
|
||||
/** 引用哪个节点模板 (外键: NodeTemplate.id) */
|
||||
@ApiModelProperty("节点模板id")
|
||||
private Long templateId;
|
||||
|
||||
/** 节点的显示名称 (可能与模板名称不同, 用于区分实例) */
|
||||
@ApiModelProperty("节点的显示名称")
|
||||
private String instanceName;
|
||||
|
||||
/** 判断当前节点是否为根节点,默认情况下是非根节点 */
|
||||
@ApiModelProperty("判断当前节点是否为根节点,默认情况下是非根节点")
|
||||
private Long isRoot;
|
||||
@ApiModelProperty("节点介绍")
|
||||
private String desciption;
|
||||
|
||||
@ApiModelProperty("节点变量结合")
|
||||
private List<NodeparameterVO> nodeparameterVOList;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getTreeId() {
|
||||
return treeId;
|
||||
}
|
||||
|
||||
public void setTreeId(Long treeId) {
|
||||
this.treeId = treeId;
|
||||
}
|
||||
|
||||
public Long getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public void setTemplateId(Long templateId) {
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
return instanceName;
|
||||
}
|
||||
|
||||
public void setInstanceName(String instanceName) {
|
||||
this.instanceName = instanceName;
|
||||
}
|
||||
|
||||
public Long getIsRoot() {
|
||||
return isRoot;
|
||||
}
|
||||
|
||||
public void setIsRoot(Long isRoot) {
|
||||
this.isRoot = isRoot;
|
||||
}
|
||||
|
||||
public String getDesciption() {
|
||||
return desciption;
|
||||
}
|
||||
|
||||
public void setDesciption(String desciption) {
|
||||
this.desciption = desciption;
|
||||
}
|
||||
|
||||
public List<NodeparameterVO> getNodeparameterVOList() {
|
||||
return nodeparameterVOList;
|
||||
}
|
||||
|
||||
public void setNodeparameterVOList(List<NodeparameterVO> nodeparameterVOList) {
|
||||
this.nodeparameterVOList = nodeparameterVOList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
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.FireRuleExecuteDTO;
|
||||
import com.solution.rule.domain.simplerulepojo.Task;
|
||||
import com.solution.rule.domain.ultimately.dto.FireRuleInputDTO;
|
||||
import com.solution.rule.service.FireRuleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
|
||||
@Api("火力规则")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/firerule")
|
||||
public class FireRuleController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private FireRuleService ruleService;
|
||||
|
||||
|
||||
/**
|
||||
* 开始执行规则匹配
|
||||
* @param fireRuleExecuteDTO 敌方参数
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/start")
|
||||
@ApiOperation("开始执行规则匹配")
|
||||
public AjaxResult execute(@RequestBody FireRuleExecuteDTO fireRuleExecuteDTO){
|
||||
return success(ruleService.execute(fireRuleExecuteDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有武器平台和组件
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/weapon")
|
||||
@ApiOperation("获取所有武器平台和组件")
|
||||
public AjaxResult getPlatformComponentNames(){
|
||||
return success(ruleService.getPlatformComponentNames());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通信组件的所有平台和组件
|
||||
* @param scenarioId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/comm")
|
||||
@ApiOperation("获取通信组件的所有平台和组件")
|
||||
public AjaxResult getCommPlatformComponentNames(Integer scenarioId){
|
||||
return success(ruleService.getCommPlatformComponentNames(scenarioId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据场景id获取所有平台及其组件
|
||||
* @param scenarioId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/platforms/{scenarioId}")
|
||||
public AjaxResult platformsScenarioId(@PathVariable Integer scenarioId){
|
||||
return success(ruleService.findPlatformComponents(scenarioId));
|
||||
}
|
||||
|
||||
@GetMapping("/platforms")
|
||||
public AjaxResult platforms(){
|
||||
return success(ruleService.findAllPlatformComponents());
|
||||
}
|
||||
|
||||
@GetMapping("/platforms/basic")
|
||||
public AjaxResult platformsBasic(){
|
||||
return success(ruleService.findAllBasicPlatformComponents());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据平台id获取平台下所有组件
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/component/{platformId}")
|
||||
@ApiOperation("根据平台id获取平台下所有组件")
|
||||
public AjaxResult getComponents(@PathVariable Integer platformId){
|
||||
return success(ruleService.getComponents(platformId));
|
||||
}
|
||||
|
||||
|
||||
/* @PostMapping("/rule")
|
||||
@ApiOperation("开始执行规则匹配")
|
||||
public AjaxResult execute(@RequestBody Task task){
|
||||
return success(ruleService.executeTask(task));
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* 开始执行规则匹配
|
||||
* @param task 敌方参数
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/rule")
|
||||
@ApiOperation("开始执行规则匹配")
|
||||
public AjaxResult rule(@RequestBody FireRuleInputDTO task){
|
||||
return success(ruleService.rule(task));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.solution.web.controller.rule;
|
||||
|
||||
import com.solution.common.annotation.Log;
|
||||
import com.solution.common.core.controller.BaseController;
|
||||
import com.solution.common.core.domain.AjaxResult;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
import com.solution.common.enums.BusinessType;
|
||||
import com.solution.rule.domain.Rule;
|
||||
import com.solution.rule.domain.config.RuleConfig;
|
||||
import com.solution.rule.domain.config.RuleConfigQuery;
|
||||
import com.solution.rule.domain.config.RuleParamMeta;
|
||||
import com.solution.rule.service.IRuleService;
|
||||
import com.solution.rule.service.IRuleConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api("红蓝对抗规则管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/rule")
|
||||
public class RuleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IRuleService ruleService;
|
||||
@Autowired
|
||||
private IRuleConfigService ruleConfigService;
|
||||
|
||||
/*@PreAuthorize("@ss.hasPermi('system:rule:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询规则列表")
|
||||
public TableDataInfo list(Rule rule) {
|
||||
startPage();
|
||||
List<Rule> list = ruleService.selectRuleList(rule);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:query')")
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation("获取规则详情")
|
||||
public AjaxResult getInfo(@PathVariable Integer id) {
|
||||
return success(ruleService.selectRuleById(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:add')")
|
||||
@Log(title = "规则管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增规则")
|
||||
public AjaxResult add(@RequestBody Rule rule) {
|
||||
return toAjax(ruleService.insertRule(rule));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:edit')")
|
||||
@Log(title = "规则管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改规则")
|
||||
public AjaxResult edit(@RequestBody Rule rule) {
|
||||
return toAjax(ruleService.updateRule(rule));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:remove')")
|
||||
@Log(title = "规则管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除规则")
|
||||
public AjaxResult remove(@PathVariable Integer[] ids) {
|
||||
return toAjax(ruleService.deleteRuleByIds(ids));
|
||||
}*/
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:list')")
|
||||
@GetMapping("/config/list")
|
||||
@ApiOperation("查询规则聚合列表")
|
||||
public TableDataInfo configList(RuleConfigQuery query) {
|
||||
startPage();
|
||||
return getDataTable(ruleConfigService.selectRuleConfigList(query));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:query')")
|
||||
@GetMapping("/config/{ruleCode}")
|
||||
@ApiOperation("查询规则聚合详情")
|
||||
public AjaxResult configInfo(@PathVariable String ruleCode) {
|
||||
return success(ruleConfigService.selectRuleConfigByCode(ruleCode));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:add')")
|
||||
@Log(title = "规则聚合管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/config")
|
||||
@ApiOperation("新增规则聚合")
|
||||
public AjaxResult addConfig(@RequestBody RuleConfig ruleConfig) {
|
||||
return toAjax(ruleConfigService.insertRuleConfig(ruleConfig));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:edit')")
|
||||
@Log(title = "规则聚合管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/config")
|
||||
@ApiOperation("修改规则聚合")
|
||||
public AjaxResult editConfig(@RequestBody RuleConfig ruleConfig) {
|
||||
return toAjax(ruleConfigService.updateRuleConfig(ruleConfig));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:remove')")
|
||||
@Log(title = "规则聚合管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/config/{ruleCodes}")
|
||||
@ApiOperation("删除规则聚合")
|
||||
public AjaxResult removeConfig(@PathVariable String[] ruleCodes) {
|
||||
return toAjax(ruleConfigService.deleteRuleConfigByCodes(ruleCodes));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:query')")
|
||||
@GetMapping("/config/dict/{dictType}")
|
||||
@ApiOperation("按类型查询规则字典")
|
||||
public AjaxResult dict(@PathVariable String dictType) {
|
||||
return success(ruleConfigService.selectDictByType(dictType));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:rule:query')")
|
||||
@GetMapping("/config/param-meta")
|
||||
@ApiOperation("查询参数元数据")
|
||||
public AjaxResult paramMeta() {
|
||||
List<RuleParamMeta> metas = ruleConfigService.selectParamMetaList();
|
||||
return success(metas);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.solution.web.controller.scene;
|
||||
|
||||
import com.solution.common.annotation.Log;
|
||||
import com.solution.common.core.controller.BaseController;
|
||||
import com.solution.common.core.domain.AjaxResult;
|
||||
import com.solution.common.core.page.TableDataInfo;
|
||||
import com.solution.common.enums.BusinessType;
|
||||
import com.solution.scene.domain.AfsimScenario;
|
||||
import com.solution.scene.domain.AfsimScenarioForm;
|
||||
import com.solution.scene.service.SceneService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 场景管理
|
||||
*/
|
||||
@Api("场景管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/scene")
|
||||
public class SceneController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SceneService sceneService;
|
||||
|
||||
/**
|
||||
* 保存场景配置
|
||||
*/
|
||||
@ApiOperation("保存场景配置")
|
||||
@PostMapping("/saveSceneConfig")
|
||||
@Log(title = "行为树主", businessType = BusinessType.INSERT)
|
||||
public AjaxResult saveSceneConfig(@RequestBody AfsimScenario afsimScenario)
|
||||
{
|
||||
return toAjax(sceneService.saveOrUpdate(afsimScenario));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取场景列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获取场景列表")
|
||||
public TableDataInfo list(){
|
||||
startPage();
|
||||
List<AfsimScenario> list = sceneService.selectSceneList();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(sceneService.findOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据场景id获取场景下所有行为树
|
||||
*/
|
||||
@GetMapping("/getAllTree/{id}")
|
||||
@ApiOperation("根据场景id获取场景下所有行为树")
|
||||
public AjaxResult getAllTree(@PathVariable Integer id){
|
||||
return success(sceneService.getAllTree(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据场景id获取场景下所有关系
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getAllRelation/{id}")
|
||||
@ApiOperation("根据场景id获取场景下所有关系")
|
||||
public AjaxResult getAllRelation(@PathVariable Integer id){
|
||||
return success(sceneService.getAllRelation(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
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 cn.hutool.core.util.ObjectUtil;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.solution.common.constant.ExceptionConstants;
|
||||
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 org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
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;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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) {
|
||||
//代码丢失 原:libertyspy 改:MHW
|
||||
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<>();
|
||||
Map<String,GraphNode> nodesMap = new HashMap<>();
|
||||
if (graph.hasNodes()) {
|
||||
Long index = 0L;
|
||||
for (GraphNode node : graph.getNodes()) {
|
||||
nodesMap.put(node.getKey(), node);
|
||||
|
||||
Treenodeinstance instance = createNodeInstance(behaviortree, node);
|
||||
treenodeinstanceService.insertTreenodeinstance(instance);
|
||||
instanceKeyMap.put(node.getKey(), instance);
|
||||
|
||||
if (node.hasParameters()) {
|
||||
if (node.isMultiable()) {
|
||||
List<Nodeparameter> nodeparameters = createMultiableNodeparameter(behaviortree, node, instance);
|
||||
for (Nodeparameter nodeparameter : nodeparameters) {
|
||||
nodeparameterService.insertNodeparameter(nodeparameter);
|
||||
}
|
||||
} else {
|
||||
// 插入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, nodesMap, instanceKeyMap, nodeKeyIndexMap);
|
||||
nodeconnectionService.insertNodeconnection(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Nodeconnection createConnection(Behaviortree behaviortree, GraphEdge edge,
|
||||
Map<String,GraphNode> nodesMap,
|
||||
Map<String, Treenodeinstance> instanceKeyMap,
|
||||
Map<String, Long> nodeKeyIndexMap) {
|
||||
Nodeconnection connection = new Nodeconnection();
|
||||
Long orderIndex = 0L;
|
||||
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 != nodesMap.get(edge.getTarget().getCell())) {
|
||||
orderIndex = nodesMap.get(edge.getTarget().getCell()).getOrder();
|
||||
}
|
||||
if(null == orderIndex){
|
||||
orderIndex = 0L;
|
||||
}
|
||||
// if (null != nodeKeyIndexMap.get(edge.getSource().getCell())) {
|
||||
// connection.setOrderIndex(nodeKeyIndexMap.get(edge.getSource().getCell()));
|
||||
// }
|
||||
connection.setOrderIndex(orderIndex);
|
||||
return connection;
|
||||
}
|
||||
|
||||
private List<Nodeparameter> createMultiableNodeparameter(Behaviortree behaviortree, GraphNode node,
|
||||
Treenodeinstance instance) {
|
||||
|
||||
List<Nodeparameter> nodeparameters = new ArrayList<>();
|
||||
|
||||
Map<Long, List<String>> idValues = new HashMap<>();
|
||||
List<String> tmpValues = null;
|
||||
Map<Long, List<Templateparameterdef>> mappedValues = new HashMap<>();
|
||||
List<Templateparameterdef> tmpDefs = null;
|
||||
|
||||
for (Templateparameterdef parameter : node.getParameters()) {
|
||||
tmpDefs = mappedValues.get(parameter.getId() );
|
||||
if (null == tmpDefs) {
|
||||
tmpDefs = new ArrayList<>();
|
||||
}
|
||||
tmpDefs.add(parameter);
|
||||
mappedValues.put(parameter.getId(), tmpDefs);
|
||||
|
||||
tmpValues = idValues.get(parameter.getId() );
|
||||
if (null == tmpValues) {
|
||||
tmpValues = new ArrayList<>();
|
||||
}
|
||||
tmpValues.add(parameter.getDefaultValue());
|
||||
idValues.put(parameter.getId(), tmpValues);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
for (Long id : idValues.keySet()) {
|
||||
tmpValues = idValues.get(id);
|
||||
Nodeparameter nodeparameter = new Nodeparameter();
|
||||
nodeparameter.setTreeId(behaviortree.getId());
|
||||
nodeparameter.setNodeInstanceId(instance.getId());
|
||||
nodeparameter.setParamDefId(id);
|
||||
nodeparameter.setValue(StringUtils.collectionToCommaDelimitedString(tmpValues));
|
||||
nodeparameter.setGroupIndex(index);
|
||||
nodeparameters.add(nodeparameter);
|
||||
index++;
|
||||
}
|
||||
return nodeparameters;
|
||||
}
|
||||
|
||||
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());
|
||||
nodeparameter.setGroupIndex(parameter.getGroupIndex());
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 复制行为树
|
||||
* @param behaviortree
|
||||
* @return
|
||||
*/
|
||||
public int copy(Behaviortree behaviortree) {
|
||||
if(ObjectUtil.isEmpty(behaviortree)){
|
||||
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
||||
}
|
||||
String name = behaviortree.getName();
|
||||
String newName = name + "_" + behaviortree.getId();
|
||||
|
||||
String englishName = behaviortree.getEnglishName();
|
||||
String newEnglishName = englishName + "_" + behaviortree.getId();
|
||||
behaviortree.setEnglishName(newEnglishName);
|
||||
behaviortree.setName(newName);
|
||||
//不做前置判断,必走数据库count
|
||||
//获取行为树重复名称个数
|
||||
Integer num = behaviortreeService.getCountName(newName);
|
||||
if(num > 0){
|
||||
Integer count = num + 1;
|
||||
behaviortree.setName(newName + count);
|
||||
behaviortree.setEnglishName(newEnglishName + count);
|
||||
}
|
||||
return this.create(behaviortree);
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class SwaggerConfig
|
||||
// 用ApiInfoBuilder进行定制
|
||||
return new ApiInfoBuilder()
|
||||
// 设置标题
|
||||
.title("标题:若依管理系统_接口文档")
|
||||
.title("标题:自动化管理系统_接口文档")
|
||||
// 描述
|
||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||
// 作者信息
|
||||
|
||||
@@ -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,162 @@
|
||||
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 Long order;
|
||||
|
||||
private String key;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private String category;
|
||||
|
||||
private boolean multiable;
|
||||
|
||||
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 boolean isMultiable() {
|
||||
return multiable;
|
||||
}
|
||||
|
||||
public void setMultiable(boolean multiable) {
|
||||
this.multiable = multiable;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public Long getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(Long order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# Docker / docker-compose 环境:与 application.yml 的 druid 配置叠加使用
|
||||
# 启动:-Dspring.profiles.active=druid,docker
|
||||
spring:
|
||||
devtools:
|
||||
restart:
|
||||
enabled: false
|
||||
redis:
|
||||
host: ${REDIS_HOST:redis}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
database: ${REDIS_DB:0}
|
||||
datasource:
|
||||
druid:
|
||||
master:
|
||||
url: jdbc:mysql://${MYSQL_HOST:mysql}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:autosolution_db}?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
|
||||
username: ${MYSQL_USER:root}
|
||||
password: ${MYSQL_PASSWORD:root}
|
||||
|
||||
server:
|
||||
port: ${SERVER_PORT:8080}
|
||||
|
||||
solution:
|
||||
profile: ${SOLUTION_UPLOAD_PATH:/app/uploadPath}
|
||||
@@ -6,9 +6,9 @@ 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://127.0.0.1:3306/autosolution_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
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:
|
||||
|
||||
28
auto-solution-algo/pom.xml
Normal file
28
auto-solution-algo/pom.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>solution</artifactId>
|
||||
<groupId>com.solution</groupId>
|
||||
<version>3.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>solution-algo</artifactId>
|
||||
|
||||
<description>
|
||||
algo模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
28
auto-solution-behaviour/pom.xml
Normal file
28
auto-solution-behaviour/pom.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>solution</artifactId>
|
||||
<groupId>com.solution</groupId>
|
||||
<version>3.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>solution-behaviour</artifactId>
|
||||
|
||||
<description>
|
||||
behaviour模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.solution.system.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;
|
||||
|
||||
/**
|
||||
* 行为树主对象 behaviortree
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public class Behaviortree extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 行为树ID (主键) */
|
||||
private Long id;
|
||||
|
||||
/** 行为树名称 */
|
||||
@Excel(name = "行为树名称")
|
||||
private String name;
|
||||
|
||||
/** 行为树描述 */
|
||||
@Excel(name = "行为树描述")
|
||||
private String description;
|
||||
|
||||
/** 创建时间 */
|
||||
@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;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String englishName;
|
||||
|
||||
/** 储存行为树的节点关系图 */
|
||||
@Excel(name = "储存行为树的节点关系图")
|
||||
private String xmlContent;
|
||||
|
||||
@Excel(name = "平台ID")
|
||||
private Integer platformId;
|
||||
|
||||
@Excel(name = "场景ID")
|
||||
private Integer scenarioId;
|
||||
|
||||
public Integer getScenarioId() {
|
||||
return scenarioId;
|
||||
}
|
||||
|
||||
public void setScenarioId(Integer scenarioId) {
|
||||
this.scenarioId = scenarioId;
|
||||
}
|
||||
|
||||
public Integer getPlatformId() {
|
||||
return platformId;
|
||||
}
|
||||
|
||||
public void setPlatformId(Integer platformId) {
|
||||
this.platformId = platformId;
|
||||
}
|
||||
|
||||
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 setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void setEnglishName(String englishName)
|
||||
{
|
||||
this.englishName = englishName;
|
||||
}
|
||||
|
||||
public String getEnglishName()
|
||||
{
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public void setXmlContent(String xmlContent)
|
||||
{
|
||||
this.xmlContent = xmlContent;
|
||||
}
|
||||
|
||||
public String getXmlContent()
|
||||
{
|
||||
return xmlContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Behaviortree{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", createdAt=" + createdAt +
|
||||
", updatedAt=" + updatedAt +
|
||||
", englishName='" + englishName + '\'' +
|
||||
", xmlContent='" + xmlContent + '\'' +
|
||||
", platformId=" + platformId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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.io.Serializable;
|
||||
|
||||
public class HbNodeCommand implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String command;
|
||||
|
||||
private String chineseName;
|
||||
|
||||
private String description;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCommand() {
|
||||
return command;
|
||||
}
|
||||
|
||||
public void setCommand(String command) {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public String getChineseName() {
|
||||
return chineseName;
|
||||
}
|
||||
|
||||
public void setChineseName(String chineseName) {
|
||||
this.chineseName = chineseName;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.solution.system.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;
|
||||
|
||||
/**
|
||||
* 节点连接对象 nodeconnection
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public class Nodeconnection extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 连接ID (主键) */
|
||||
private Long id;
|
||||
|
||||
private Long treeId;
|
||||
|
||||
/** 父节点 (外键: TreeInstanceNode.id) */
|
||||
@Excel(name = "父节点 (外键: TreeInstanceNode.id)")
|
||||
private Long parentNodeId;
|
||||
|
||||
/** 子节点 (外键: TreeInstanceNode.id) */
|
||||
@Excel(name = "子节点 (外键: TreeInstanceNode.id)")
|
||||
private Long childNodeId;
|
||||
|
||||
/** 子节点在父节点下的执行顺序 (对于 Sequence/Selector 等很重要) */
|
||||
@Excel(name = "子节点在父节点下的执行顺序 (对于 Sequence/Selector 等很重要)")
|
||||
private Long orderIndex;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getTreeId() {
|
||||
return treeId;
|
||||
}
|
||||
|
||||
public void setTreeId(Long treeId) {
|
||||
this.treeId = treeId;
|
||||
}
|
||||
|
||||
public void setParentNodeId(Long parentNodeId)
|
||||
{
|
||||
this.parentNodeId = parentNodeId;
|
||||
}
|
||||
|
||||
public Long getParentNodeId()
|
||||
{
|
||||
return parentNodeId;
|
||||
}
|
||||
|
||||
public void setChildNodeId(Long childNodeId)
|
||||
{
|
||||
this.childNodeId = childNodeId;
|
||||
}
|
||||
|
||||
public Long getChildNodeId()
|
||||
{
|
||||
return childNodeId;
|
||||
}
|
||||
|
||||
public void setOrderIndex(Long orderIndex)
|
||||
{
|
||||
this.orderIndex = orderIndex;
|
||||
}
|
||||
|
||||
public Long getOrderIndex()
|
||||
{
|
||||
return orderIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("parentNodeId", getParentNodeId())
|
||||
.append("childNodeId", getChildNodeId())
|
||||
.append("orderIndex", getOrderIndex())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.solution.system.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;
|
||||
|
||||
/**
|
||||
* 节点参数对象 nodeparameter
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public class Nodeparameter extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 节点参数ID (主键) */
|
||||
private Long id;
|
||||
|
||||
private Long treeId;
|
||||
|
||||
/** 关联到哪个节点实例 (外键: TreeInstanceNode.id) */
|
||||
@Excel(name = "关联到哪个节点实例 (外键: TreeInstanceNode.id)")
|
||||
private Long nodeInstanceId;
|
||||
|
||||
/** 关联到哪个参数定义 (外键: TemplateParameterDef.id) */
|
||||
@Excel(name = "关联到哪个参数定义 (外键: TemplateParameterDef.id)")
|
||||
private Long paramDefId;
|
||||
|
||||
/** 节点实例设置的具体参数值 (覆盖模板默认值) */
|
||||
@Excel(name = "节点实例设置的具体参数值 (覆盖模板默认值)")
|
||||
private String value;
|
||||
|
||||
private int groupIndex;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getTreeId() {
|
||||
return treeId;
|
||||
}
|
||||
|
||||
public void setTreeId(Long treeId) {
|
||||
this.treeId = treeId;
|
||||
}
|
||||
|
||||
public void setNodeInstanceId(Long nodeInstanceId)
|
||||
{
|
||||
this.nodeInstanceId = nodeInstanceId;
|
||||
}
|
||||
|
||||
public Long getNodeInstanceId()
|
||||
{
|
||||
return nodeInstanceId;
|
||||
}
|
||||
|
||||
public void setParamDefId(Long paramDefId)
|
||||
{
|
||||
this.paramDefId = paramDefId;
|
||||
}
|
||||
|
||||
public Long getParamDefId()
|
||||
{
|
||||
return paramDefId;
|
||||
}
|
||||
|
||||
public void setValue(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public int getGroupIndex() {
|
||||
return groupIndex;
|
||||
}
|
||||
|
||||
public void setGroupIndex(int groupIndex) {
|
||||
this.groupIndex = groupIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("nodeInstanceId", getNodeInstanceId())
|
||||
.append("paramDefId", getParamDefId())
|
||||
.append("value", getValue())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.solution.system.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;
|
||||
|
||||
/**
|
||||
* 节点模板对象 nodetemplate
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public class Nodetemplate extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 节点模板ID (主键) */
|
||||
private Long id;
|
||||
|
||||
/** 节点类型: "Selector", "Sequence", "Action", "Condition", "Decorator" 等 */
|
||||
@Excel(name = "节点类型: Selector, Sequence, Action, Condition, Decorator等")
|
||||
private String type;
|
||||
|
||||
/** 模板名称, 例如: "MoveToTarget", "IsTargetVisible" */
|
||||
@Excel(name = "模板名称, 例如: MoveToTarget, IsTargetVisible")
|
||||
private String name;
|
||||
|
||||
/** 对应的逻辑执行代码/脚本/函数名 */
|
||||
@Excel(name = "对应的逻辑执行代码/脚本/函数名")
|
||||
private String logicHandler;
|
||||
|
||||
/** 模板描述 */
|
||||
@Excel(name = "模板描述")
|
||||
private String description;
|
||||
|
||||
/** afsim 中转换的节点名 */
|
||||
@Excel(name = "afsim 中转换的节点名")
|
||||
private String englishName;
|
||||
|
||||
/** 模版类型,节点模版或者条件判断,例如“node”,precondition“ */
|
||||
@Excel(name = "模版类型,节点模版或者条件判断,例如“node”,precondition“")
|
||||
private String templateType;
|
||||
|
||||
private boolean multiable;
|
||||
|
||||
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;
|
||||
this.multiable = template.multiable;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setLogicHandler(String logicHandler)
|
||||
{
|
||||
this.logicHandler = logicHandler;
|
||||
}
|
||||
|
||||
public String getLogicHandler()
|
||||
{
|
||||
return logicHandler;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setEnglishName(String englishName)
|
||||
{
|
||||
this.englishName = englishName;
|
||||
}
|
||||
|
||||
public String getEnglishName()
|
||||
{
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public void setTemplateType(String templateType)
|
||||
{
|
||||
this.templateType = templateType;
|
||||
}
|
||||
|
||||
public String getTemplateType()
|
||||
{
|
||||
return templateType;
|
||||
}
|
||||
|
||||
public boolean isMultiable() {
|
||||
return multiable;
|
||||
}
|
||||
|
||||
public void setMultiable(boolean multiable) {
|
||||
this.multiable = multiable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("type", getType())
|
||||
.append("name", getName())
|
||||
.append("logicHandler", getLogicHandler())
|
||||
.append("description", getDescription())
|
||||
.append("englishName", getEnglishName())
|
||||
.append("templateType", getTemplateType())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.solution.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 收集数据用来生成总指挥官
|
||||
*/
|
||||
@Data
|
||||
public class PlatformChiefCommander {
|
||||
|
||||
/**
|
||||
* Primary Key 主键ID(自增)
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* Create Time 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private Integer time;
|
||||
|
||||
/**
|
||||
* 指令
|
||||
*/
|
||||
private String command;
|
||||
|
||||
/**
|
||||
* 下属指挥官
|
||||
*/
|
||||
private String subordinateCommander;
|
||||
|
||||
/**
|
||||
* 场景ID
|
||||
*/
|
||||
private Integer scenarioId;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.solution.system.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 平台表
|
||||
*/
|
||||
@Data
|
||||
public class PlatformTree {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 平台名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 平台出现在想定上的想定id
|
||||
*/
|
||||
private Integer scenarioId;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.solution.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 平台视图对象 platform
|
||||
*/
|
||||
@Data
|
||||
public class PlatformVO
|
||||
{
|
||||
/** 主键 */
|
||||
private Integer id;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 描述 */
|
||||
private String description;
|
||||
|
||||
/** 平台出现在想定上的想定id */
|
||||
private Integer scenarioId;
|
||||
|
||||
/** 经度 */
|
||||
private String longitude;
|
||||
|
||||
/** 纬度 */
|
||||
private String latitude;
|
||||
|
||||
/** 平台类型 */
|
||||
private String platformType;
|
||||
|
||||
/** 海拔 */
|
||||
private Float altitude;
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.solution.system.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;
|
||||
|
||||
/**
|
||||
* 模板参数定义对象 templateparameterdef
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public class Templateparameterdef extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 参数定义ID (主键) */
|
||||
private Long id;
|
||||
|
||||
/** 关联到哪个节点模板 (外键: NodeTemplate.id) */
|
||||
@Excel(name = "关联到哪个节点模板 (外键: NodeTemplate.id)")
|
||||
private Long templateId;
|
||||
|
||||
/** 参数键名, 例如: "target_name", "speed" */
|
||||
@Excel(name = "参数键名, 例如: target_name, speed")
|
||||
private String paramKey;
|
||||
|
||||
/** 参数数据类型, 例如: "float", "int", "string", "bool" */
|
||||
@Excel(name = "参数数据类型, 例如: float, int, string, bool")
|
||||
private String dataType;
|
||||
|
||||
/** 默认值 */
|
||||
@Excel(name = "默认值")
|
||||
private String defaultValue;
|
||||
|
||||
/** 参数描述 */
|
||||
@Excel(name = "参数描述")
|
||||
private String description;
|
||||
|
||||
/** 判断参数模版是节点的参数模版还是条件的参数模版 */
|
||||
@Excel(name = "判断参数模版是节点的参数模版还是条件的参数模版")
|
||||
private String templateType;
|
||||
|
||||
private int groupIndex;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setTemplateId(Long templateId)
|
||||
{
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public Long getTemplateId()
|
||||
{
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public void setParamKey(String paramKey)
|
||||
{
|
||||
this.paramKey = paramKey;
|
||||
}
|
||||
|
||||
public String getParamKey()
|
||||
{
|
||||
return paramKey;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType)
|
||||
{
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getDataType()
|
||||
{
|
||||
return dataType;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void setTemplateType(String templateType)
|
||||
{
|
||||
this.templateType = templateType;
|
||||
}
|
||||
|
||||
public String getTemplateType()
|
||||
{
|
||||
return templateType;
|
||||
}
|
||||
|
||||
public int getGroupIndex() {
|
||||
return groupIndex;
|
||||
}
|
||||
|
||||
public void setGroupIndex(int groupIndex) {
|
||||
this.groupIndex = groupIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("templateId", getTemplateId())
|
||||
.append("paramKey", getParamKey())
|
||||
.append("dataType", getDataType())
|
||||
.append("defaultValue", getDefaultValue())
|
||||
.append("description", getDescription())
|
||||
.append("templateType", getTemplateType())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.solution.system.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;
|
||||
|
||||
/**
|
||||
* 行为树实例节点对象 treenodeinstance
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public class Treenodeinstance extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 节点实例ID (主键) */
|
||||
private Long id;
|
||||
|
||||
/** 属于哪棵行为树 (外键: BehaviorTree.id) */
|
||||
@Excel(name = "属于哪棵行为树 (外键: BehaviorTree.id)")
|
||||
private Long treeId;
|
||||
|
||||
/** 引用哪个节点模板 (外键: NodeTemplate.id) */
|
||||
@Excel(name = "引用哪个节点模板 (外键: NodeTemplate.id)")
|
||||
private Long templateId;
|
||||
|
||||
/** 节点的显示名称 (可能与模板名称不同, 用于区分实例) */
|
||||
@Excel(name = "节点的显示名称 (可能与模板名称不同, 用于区分实例)")
|
||||
private String instanceName;
|
||||
|
||||
/** 判断当前节点是否为根节点,默认情况下是非根节点 */
|
||||
@Excel(name = "判断当前节点是否为根节点,默认情况下是非根节点")
|
||||
private Long isRoot;
|
||||
|
||||
/** 节点执行的判断条件对应的模版id */
|
||||
@Excel(name = "节点执行的判断条件对应的模版id")
|
||||
private Long preconditionTempleteId;
|
||||
|
||||
@Excel(name = "节点介绍")
|
||||
private String desciption;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String uuid;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setTreeId(Long treeId)
|
||||
{
|
||||
this.treeId = treeId;
|
||||
}
|
||||
|
||||
public Long getTreeId()
|
||||
{
|
||||
return treeId;
|
||||
}
|
||||
|
||||
public void setTemplateId(Long templateId)
|
||||
{
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public Long getTemplateId()
|
||||
{
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public void setInstanceName(String instanceName)
|
||||
{
|
||||
this.instanceName = instanceName;
|
||||
}
|
||||
|
||||
public String getInstanceName()
|
||||
{
|
||||
return instanceName;
|
||||
}
|
||||
|
||||
public void setIsRoot(Long isRoot)
|
||||
{
|
||||
this.isRoot = isRoot;
|
||||
}
|
||||
|
||||
public Long getIsRoot()
|
||||
{
|
||||
return isRoot;
|
||||
}
|
||||
|
||||
public void setPreconditionTempleteId(Long preconditionTempleteId)
|
||||
{
|
||||
this.preconditionTempleteId = preconditionTempleteId;
|
||||
}
|
||||
|
||||
public Long getPreconditionTempleteId()
|
||||
{
|
||||
return preconditionTempleteId;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getUuid()
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getDesciption() {
|
||||
return desciption;
|
||||
}
|
||||
|
||||
public void setDesciption(String desciption) {
|
||||
this.desciption = desciption;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("treeId", getTreeId())
|
||||
.append("templateId", getTemplateId())
|
||||
.append("instanceName", getInstanceName())
|
||||
.append("isRoot", getIsRoot())
|
||||
.append("preconditionTempleteId", getPreconditionTempleteId())
|
||||
.append("uuid", getUuid())
|
||||
.append("desciption", getDesciption())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.solution.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.solution.system.domain.Behaviortree;
|
||||
import com.solution.system.domain.PlatformChiefCommander;
|
||||
|
||||
/**
|
||||
* 行为树主Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface BehaviortreeMapper
|
||||
{
|
||||
|
||||
Behaviortree findOneByPlatformId(Integer platformId);
|
||||
|
||||
/**
|
||||
* 查询行为树主
|
||||
*
|
||||
* @param id 行为树主主键
|
||||
* @return 行为树主
|
||||
*/
|
||||
public Behaviortree selectBehaviortreeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询行为树主列表
|
||||
*
|
||||
* @param behaviortree 行为树主
|
||||
* @return 行为树主集合
|
||||
*/
|
||||
public List<Behaviortree> selectBehaviortreeList(Behaviortree behaviortree);
|
||||
|
||||
/**
|
||||
* 新增行为树主
|
||||
*
|
||||
* @param behaviortree 行为树主
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBehaviortree(Behaviortree behaviortree);
|
||||
|
||||
/**
|
||||
* 修改行为树主
|
||||
*
|
||||
* @param behaviortree 行为树主
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBehaviortree(Behaviortree behaviortree);
|
||||
|
||||
/**
|
||||
* 删除行为树主
|
||||
*
|
||||
* @param id 行为树主主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBehaviortreeById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除行为树主
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBehaviortreeByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据场景id获取总指挥的行为树的原数据
|
||||
* @param scenarioId
|
||||
* @return
|
||||
*/
|
||||
List<PlatformChiefCommander> getCommander(Integer scenarioId);
|
||||
|
||||
/**
|
||||
* 获取行为树重复名称个数
|
||||
* @param newName
|
||||
* @return
|
||||
*/
|
||||
Integer getCountName(String newName);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.solution.system.mapper;
|
||||
/*
|
||||
* 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.HbNodeCommand;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HbNodeCommandMapper {
|
||||
|
||||
List<HbNodeCommand> findAll();
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.solution.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Nodeconnection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 节点连接Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface NodeconnectionMapper
|
||||
{
|
||||
void deleteByTreeId(@Param("treeId") Long treeId);
|
||||
|
||||
/**
|
||||
* 查询节点连接
|
||||
*
|
||||
* @param id 节点连接主键
|
||||
* @return 节点连接
|
||||
*/
|
||||
public Nodeconnection selectNodeconnectionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询节点连接列表
|
||||
*
|
||||
* @param nodeconnection 节点连接
|
||||
* @return 节点连接集合
|
||||
*/
|
||||
public List<Nodeconnection> selectNodeconnectionList(Nodeconnection nodeconnection);
|
||||
|
||||
/**
|
||||
* 新增节点连接
|
||||
*
|
||||
* @param nodeconnection 节点连接
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNodeconnection(Nodeconnection nodeconnection);
|
||||
|
||||
/**
|
||||
* 修改节点连接
|
||||
*
|
||||
* @param nodeconnection 节点连接
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNodeconnection(Nodeconnection nodeconnection);
|
||||
|
||||
/**
|
||||
* 删除节点连接
|
||||
*
|
||||
* @param id 节点连接主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodeconnectionById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除节点连接
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodeconnectionByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.solution.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Nodeparameter;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 节点参数Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface NodeparameterMapper
|
||||
{
|
||||
void deleteByTreeId(@Param("treeId") Long treeId);
|
||||
|
||||
/**
|
||||
* 查询节点参数
|
||||
*
|
||||
* @param id 节点参数主键
|
||||
* @return 节点参数
|
||||
*/
|
||||
public Nodeparameter selectNodeparameterById(Long id);
|
||||
|
||||
/**
|
||||
* 查询节点参数列表
|
||||
*
|
||||
* @param nodeparameter 节点参数
|
||||
* @return 节点参数集合
|
||||
*/
|
||||
public List<Nodeparameter> selectNodeparameterList(Nodeparameter nodeparameter);
|
||||
|
||||
/**
|
||||
* 新增节点参数
|
||||
*
|
||||
* @param nodeparameter 节点参数
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNodeparameter(Nodeparameter nodeparameter);
|
||||
|
||||
/**
|
||||
* 修改节点参数
|
||||
*
|
||||
* @param nodeparameter 节点参数
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNodeparameter(Nodeparameter nodeparameter);
|
||||
|
||||
/**
|
||||
* 删除节点参数
|
||||
*
|
||||
* @param id 节点参数主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodeparameterById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除节点参数
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodeparameterByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.solution.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Nodetemplate;
|
||||
|
||||
/**
|
||||
* 节点模板Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface NodetemplateMapper
|
||||
{
|
||||
/**
|
||||
* 查询节点模板
|
||||
*
|
||||
* @param id 节点模板主键
|
||||
* @return 节点模板
|
||||
*/
|
||||
public Nodetemplate selectNodetemplateById(Long id);
|
||||
|
||||
/**
|
||||
* 查询节点模板列表
|
||||
*
|
||||
* @param nodetemplate 节点模板
|
||||
* @return 节点模板集合
|
||||
*/
|
||||
public List<Nodetemplate> selectNodetemplateList(Nodetemplate nodetemplate);
|
||||
|
||||
/**
|
||||
* 新增节点模板
|
||||
*
|
||||
* @param nodetemplate 节点模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNodetemplate(Nodetemplate nodetemplate);
|
||||
|
||||
/**
|
||||
* 修改节点模板
|
||||
*
|
||||
* @param nodetemplate 节点模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNodetemplate(Nodetemplate nodetemplate);
|
||||
|
||||
/**
|
||||
* 删除节点模板
|
||||
*
|
||||
* @param id 节点模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodetemplateById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除节点模板
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodetemplateByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.solution.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PlatformCommunicationMapper {
|
||||
|
||||
/**
|
||||
* 根据平台name获取平台下属英文名
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
List<String> getUnderlingBytreeId(String name);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.solution.system.mapper;
|
||||
|
||||
import com.solution.system.domain.PlatformTree;
|
||||
import com.solution.system.domain.PlatformVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PlatformMapper {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据下属平台英文名获取中文名返回
|
||||
* @param underlingEnglishName
|
||||
* @return
|
||||
*/
|
||||
List<String> selectPlatformChineseName(@Param("underlingEnglishName") List<String> underlingEnglishName);
|
||||
|
||||
/**
|
||||
* 根据平台id获取平台实体
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
PlatformTree getPlatformById(Integer platformId);
|
||||
|
||||
/**
|
||||
* 根据平台英文名查询该平台实体
|
||||
* @param underlingEnglishName
|
||||
* @return
|
||||
*/
|
||||
List<PlatformVO> getPlatformByEnglishName(@Param("underlingEnglishName") List<String> underlingEnglishName);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.solution.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Templateparameterdef;
|
||||
|
||||
/**
|
||||
* 模板参数定义Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface TemplateparameterdefMapper
|
||||
{
|
||||
/**
|
||||
* 查询模板参数定义
|
||||
*
|
||||
* @param id 模板参数定义主键
|
||||
* @return 模板参数定义
|
||||
*/
|
||||
public Templateparameterdef selectTemplateparameterdefById(Long id);
|
||||
|
||||
/**
|
||||
* 查询模板参数定义列表
|
||||
*
|
||||
* @param templateparameterdef 模板参数定义
|
||||
* @return 模板参数定义集合
|
||||
*/
|
||||
public List<Templateparameterdef> selectTemplateparameterdefList(Templateparameterdef templateparameterdef);
|
||||
|
||||
/**
|
||||
* 新增模板参数定义
|
||||
*
|
||||
* @param templateparameterdef 模板参数定义
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTemplateparameterdef(Templateparameterdef templateparameterdef);
|
||||
|
||||
/**
|
||||
* 修改模板参数定义
|
||||
*
|
||||
* @param templateparameterdef 模板参数定义
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTemplateparameterdef(Templateparameterdef templateparameterdef);
|
||||
|
||||
/**
|
||||
* 删除模板参数定义
|
||||
*
|
||||
* @param id 模板参数定义主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTemplateparameterdefById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除模板参数定义
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTemplateparameterdefByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.solution.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Treenodeinstance;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 行为树实例节点Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface TreenodeinstanceMapper
|
||||
{
|
||||
void deleteByTreeId(@Param(value = "treeId") Long treeId);
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点
|
||||
*
|
||||
* @param id 行为树实例节点主键
|
||||
* @return 行为树实例节点
|
||||
*/
|
||||
public Treenodeinstance selectTreenodeinstanceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点列表
|
||||
*
|
||||
* @param treenodeinstance 行为树实例节点
|
||||
* @return 行为树实例节点集合
|
||||
*/
|
||||
public List<Treenodeinstance> selectTreenodeinstanceList(Treenodeinstance treenodeinstance);
|
||||
|
||||
/**
|
||||
* 新增行为树实例节点
|
||||
*
|
||||
* @param treenodeinstance 行为树实例节点
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTreenodeinstance(Treenodeinstance treenodeinstance);
|
||||
|
||||
/**
|
||||
* 修改行为树实例节点
|
||||
*
|
||||
* @param treenodeinstance 行为树实例节点
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTreenodeinstance(Treenodeinstance treenodeinstance);
|
||||
|
||||
/**
|
||||
* 删除行为树实例节点
|
||||
*
|
||||
* @param id 行为树实例节点主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTreenodeinstanceById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除行为树实例节点
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTreenodeinstanceByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.solution.system.service;
|
||||
/*
|
||||
* 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.HbNodeCommand;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HbNodeCommandService {
|
||||
|
||||
List<HbNodeCommand> findAll();
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.solution.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.solution.system.domain.Behaviortree;
|
||||
import com.solution.system.domain.PlatformChiefCommander;
|
||||
import com.solution.system.domain.PlatformVO;
|
||||
|
||||
/**
|
||||
* 行为树主Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface IBehaviortreeService
|
||||
{
|
||||
|
||||
Behaviortree findOneByPlatformId(Integer platformId);
|
||||
|
||||
/**
|
||||
* 查询行为树主
|
||||
*
|
||||
* @param id 行为树主主键
|
||||
* @return 行为树主
|
||||
*/
|
||||
public Behaviortree selectBehaviortreeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询行为树主列表
|
||||
*
|
||||
* @param behaviortree 行为树主
|
||||
* @return 行为树主集合
|
||||
*/
|
||||
public List<Behaviortree> selectBehaviortreeList(Behaviortree behaviortree);
|
||||
|
||||
/**
|
||||
* 新增行为树主
|
||||
*
|
||||
* @param behaviortree 行为树主
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBehaviortree(Behaviortree behaviortree);
|
||||
|
||||
/**
|
||||
* 修改行为树主
|
||||
*
|
||||
* @param behaviortree 行为树主
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBehaviortree(Behaviortree behaviortree);
|
||||
|
||||
/**
|
||||
* 批量删除行为树主
|
||||
*
|
||||
* @param ids 需要删除的行为树主主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBehaviortreeByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除行为树主信息
|
||||
*
|
||||
* @param id 行为树主主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBehaviortreeById(Long id);
|
||||
|
||||
/**
|
||||
* 根据平台id获取该行为树的下属
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
List<PlatformVO> getUnderling(Integer platformId);
|
||||
|
||||
/**
|
||||
* 根据场景id获取总指挥的行为树的原数据
|
||||
* @param scenarioId
|
||||
* @return
|
||||
*/
|
||||
List<PlatformChiefCommander> getCommander(Integer scenarioId);
|
||||
|
||||
/**
|
||||
* 获取行为树重复名称个数
|
||||
* @param newName
|
||||
* @return
|
||||
*/
|
||||
Integer getCountName(String newName);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.solution.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Nodeconnection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 节点连接Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface INodeconnectionService
|
||||
{
|
||||
|
||||
void deleteByTreeId(@Param("treeId") Long treeId);
|
||||
|
||||
/**
|
||||
* 查询节点连接
|
||||
*
|
||||
* @param id 节点连接主键
|
||||
* @return 节点连接
|
||||
*/
|
||||
public Nodeconnection selectNodeconnectionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询节点连接列表
|
||||
*
|
||||
* @param nodeconnection 节点连接
|
||||
* @return 节点连接集合
|
||||
*/
|
||||
public List<Nodeconnection> selectNodeconnectionList(Nodeconnection nodeconnection);
|
||||
|
||||
/**
|
||||
* 新增节点连接
|
||||
*
|
||||
* @param nodeconnection 节点连接
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNodeconnection(Nodeconnection nodeconnection);
|
||||
|
||||
/**
|
||||
* 修改节点连接
|
||||
*
|
||||
* @param nodeconnection 节点连接
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNodeconnection(Nodeconnection nodeconnection);
|
||||
|
||||
/**
|
||||
* 批量删除节点连接
|
||||
*
|
||||
* @param ids 需要删除的节点连接主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodeconnectionByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除节点连接信息
|
||||
*
|
||||
* @param id 节点连接主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodeconnectionById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.solution.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Nodeparameter;
|
||||
|
||||
/**
|
||||
* 节点参数Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface INodeparameterService
|
||||
{
|
||||
|
||||
void deleteByTreeId(Long treeId);
|
||||
|
||||
/**
|
||||
* 查询节点参数
|
||||
*
|
||||
* @param id 节点参数主键
|
||||
* @return 节点参数
|
||||
*/
|
||||
public Nodeparameter selectNodeparameterById(Long id);
|
||||
|
||||
/**
|
||||
* 查询节点参数列表
|
||||
*
|
||||
* @param nodeparameter 节点参数
|
||||
* @return 节点参数集合
|
||||
*/
|
||||
public List<Nodeparameter> selectNodeparameterList(Nodeparameter nodeparameter);
|
||||
|
||||
/**
|
||||
* 新增节点参数
|
||||
*
|
||||
* @param nodeparameter 节点参数
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNodeparameter(Nodeparameter nodeparameter);
|
||||
|
||||
/**
|
||||
* 修改节点参数
|
||||
*
|
||||
* @param nodeparameter 节点参数
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNodeparameter(Nodeparameter nodeparameter);
|
||||
|
||||
/**
|
||||
* 批量删除节点参数
|
||||
*
|
||||
* @param ids 需要删除的节点参数主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodeparameterByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除节点参数信息
|
||||
*
|
||||
* @param id 节点参数主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodeparameterById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.solution.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Nodetemplate;
|
||||
|
||||
/**
|
||||
* 节点模板Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface INodetemplateService
|
||||
{
|
||||
/**
|
||||
* 查询节点模板
|
||||
*
|
||||
* @param id 节点模板主键
|
||||
* @return 节点模板
|
||||
*/
|
||||
public Nodetemplate selectNodetemplateById(Long id);
|
||||
|
||||
/**
|
||||
* 查询节点模板列表
|
||||
*
|
||||
* @param nodetemplate 节点模板
|
||||
* @return 节点模板集合
|
||||
*/
|
||||
public List<Nodetemplate> selectNodetemplateList(Nodetemplate nodetemplate);
|
||||
|
||||
/**
|
||||
* 新增节点模板
|
||||
*
|
||||
* @param nodetemplate 节点模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNodetemplate(Nodetemplate nodetemplate);
|
||||
|
||||
/**
|
||||
* 修改节点模板
|
||||
*
|
||||
* @param nodetemplate 节点模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNodetemplate(Nodetemplate nodetemplate);
|
||||
|
||||
/**
|
||||
* 批量删除节点模板
|
||||
*
|
||||
* @param ids 需要删除的节点模板主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodetemplateByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除节点模板信息
|
||||
*
|
||||
* @param id 节点模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNodetemplateById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.solution.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Templateparameterdef;
|
||||
|
||||
/**
|
||||
* 模板参数定义Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface ITemplateparameterdefService
|
||||
{
|
||||
/**
|
||||
* 查询模板参数定义
|
||||
*
|
||||
* @param id 模板参数定义主键
|
||||
* @return 模板参数定义
|
||||
*/
|
||||
public Templateparameterdef selectTemplateparameterdefById(Long id);
|
||||
|
||||
/**
|
||||
* 查询模板参数定义列表
|
||||
*
|
||||
* @param templateparameterdef 模板参数定义
|
||||
* @return 模板参数定义集合
|
||||
*/
|
||||
public List<Templateparameterdef> selectTemplateparameterdefList(Templateparameterdef templateparameterdef);
|
||||
|
||||
/**
|
||||
* 新增模板参数定义
|
||||
*
|
||||
* @param templateparameterdef 模板参数定义
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTemplateparameterdef(Templateparameterdef templateparameterdef);
|
||||
|
||||
/**
|
||||
* 修改模板参数定义
|
||||
*
|
||||
* @param templateparameterdef 模板参数定义
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTemplateparameterdef(Templateparameterdef templateparameterdef);
|
||||
|
||||
/**
|
||||
* 批量删除模板参数定义
|
||||
*
|
||||
* @param ids 需要删除的模板参数定义主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTemplateparameterdefByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除模板参数定义信息
|
||||
*
|
||||
* @param id 模板参数定义主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTemplateparameterdefById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.solution.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.solution.system.domain.Treenodeinstance;
|
||||
|
||||
/**
|
||||
* 行为树实例节点Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface ITreenodeinstanceService
|
||||
{
|
||||
|
||||
void deleteByTreeId(Long treeId);
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点
|
||||
*
|
||||
* @param id 行为树实例节点主键
|
||||
* @return 行为树实例节点
|
||||
*/
|
||||
public Treenodeinstance selectTreenodeinstanceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点列表
|
||||
*
|
||||
* @param treenodeinstance 行为树实例节点
|
||||
* @return 行为树实例节点集合
|
||||
*/
|
||||
public List<Treenodeinstance> selectTreenodeinstanceList(Treenodeinstance treenodeinstance);
|
||||
|
||||
/**
|
||||
* 新增行为树实例节点
|
||||
*
|
||||
* @param treenodeinstance 行为树实例节点
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTreenodeinstance(Treenodeinstance treenodeinstance);
|
||||
|
||||
/**
|
||||
* 修改行为树实例节点
|
||||
*
|
||||
* @param treenodeinstance 行为树实例节点
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTreenodeinstance(Treenodeinstance treenodeinstance);
|
||||
|
||||
/**
|
||||
* 批量删除行为树实例节点
|
||||
*
|
||||
* @param ids 需要删除的行为树实例节点主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTreenodeinstanceByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除行为树实例节点信息
|
||||
*
|
||||
* @param id 行为树实例节点主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTreenodeinstanceById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.solution.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.solution.common.constant.ExceptionConstants;
|
||||
import com.solution.system.domain.PlatformChiefCommander;
|
||||
import com.solution.system.domain.PlatformTree;
|
||||
import com.solution.system.domain.PlatformVO;
|
||||
import com.solution.system.mapper.PlatformCommunicationMapper;
|
||||
import com.solution.system.mapper.PlatformMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.solution.system.mapper.BehaviortreeMapper;
|
||||
import com.solution.system.domain.Behaviortree;
|
||||
import com.solution.system.service.IBehaviortreeService;
|
||||
|
||||
/**
|
||||
* 行为树主Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
public class BehaviortreeServiceImpl implements IBehaviortreeService
|
||||
{
|
||||
@Autowired
|
||||
private BehaviortreeMapper behaviortreeMapper;
|
||||
|
||||
@Autowired
|
||||
private PlatformCommunicationMapper platformCommunicationMapper;
|
||||
|
||||
@Autowired
|
||||
private PlatformMapper platformMapper;
|
||||
|
||||
@Override
|
||||
public Behaviortree findOneByPlatformId(Integer platformId)
|
||||
{
|
||||
return behaviortreeMapper.findOneByPlatformId(platformId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询行为树主
|
||||
*
|
||||
* @param id 行为树主主键
|
||||
* @return 行为树主
|
||||
*/
|
||||
@Override
|
||||
public Behaviortree selectBehaviortreeById(Long id)
|
||||
{
|
||||
return behaviortreeMapper.selectBehaviortreeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询行为树主列表
|
||||
*
|
||||
* @param behaviortree 行为树主
|
||||
* @return 行为树主
|
||||
*/
|
||||
@Override
|
||||
public List<Behaviortree> selectBehaviortreeList(Behaviortree behaviortree)
|
||||
{
|
||||
return behaviortreeMapper.selectBehaviortreeList(behaviortree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增行为树主
|
||||
*
|
||||
* @param behaviortree 行为树主
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBehaviortree(Behaviortree behaviortree)
|
||||
{
|
||||
return behaviortreeMapper.insertBehaviortree(behaviortree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行为树主
|
||||
*
|
||||
* @param behaviortree 行为树主
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBehaviortree(Behaviortree behaviortree)
|
||||
{
|
||||
return behaviortreeMapper.updateBehaviortree(behaviortree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除行为树主
|
||||
*
|
||||
* @param ids 需要删除的行为树主主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBehaviortreeByIds(Long[] ids)
|
||||
{
|
||||
return behaviortreeMapper.deleteBehaviortreeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除行为树主信息
|
||||
*
|
||||
* @param id 行为树主主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBehaviortreeById(Long id)
|
||||
{
|
||||
return behaviortreeMapper.deleteBehaviortreeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据平台id获取该行为树的下属
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PlatformVO> getUnderling(Integer platformId) {
|
||||
if(null == platformId){
|
||||
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
||||
}
|
||||
//根据平台id获取平台实体
|
||||
PlatformTree platform = platformMapper.getPlatformById(platformId);
|
||||
//根据平台name获取平台下属英文名
|
||||
List<String> underlingEnglishName = platformCommunicationMapper.getUnderlingBytreeId(platform.getName());
|
||||
if(CollUtil.isEmpty(underlingEnglishName)){
|
||||
throw new RuntimeException("该平台暂无下属");
|
||||
}
|
||||
//根据平台英文名查询该平台实体
|
||||
List<PlatformVO> resultList = platformMapper.getPlatformByEnglishName(underlingEnglishName);
|
||||
if(CollUtil.isEmpty(resultList)){
|
||||
throw new RuntimeException("无法根据平台英文名获取平台实体");
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据场景id获取总指挥的行为树的原数据
|
||||
* @param scenarioId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PlatformChiefCommander> getCommander(Integer scenarioId) {
|
||||
return behaviortreeMapper.getCommander(scenarioId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取行为树重复名称个数
|
||||
* @param newName
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer getCountName(String newName) {
|
||||
return behaviortreeMapper.getCountName(newName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.solution.system.service.impl;
|
||||
/*
|
||||
* 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.HbNodeCommand;
|
||||
import com.solution.system.mapper.HbNodeCommandMapper;
|
||||
import com.solution.system.service.HbNodeCommandService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class HbNodeCommandServiceImpl implements HbNodeCommandService {
|
||||
|
||||
private final HbNodeCommandMapper hbNodeCommandMapper;
|
||||
|
||||
public HbNodeCommandServiceImpl(HbNodeCommandMapper hbNodeCommandMapper) {
|
||||
this.hbNodeCommandMapper = hbNodeCommandMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HbNodeCommand> findAll() {
|
||||
return hbNodeCommandMapper.findAll();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.solution.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.solution.system.mapper.NodeconnectionMapper;
|
||||
import com.solution.system.domain.Nodeconnection;
|
||||
import com.solution.system.service.INodeconnectionService;
|
||||
|
||||
/**
|
||||
* 节点连接Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
public class NodeconnectionServiceImpl implements INodeconnectionService
|
||||
{
|
||||
@Autowired
|
||||
private NodeconnectionMapper nodeconnectionMapper;
|
||||
|
||||
@Override
|
||||
public void deleteByTreeId(Long treeId) {
|
||||
nodeconnectionMapper.deleteByTreeId(treeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点连接
|
||||
*
|
||||
* @param id 节点连接主键
|
||||
* @return 节点连接
|
||||
*/
|
||||
@Override
|
||||
public Nodeconnection selectNodeconnectionById(Long id)
|
||||
{
|
||||
return nodeconnectionMapper.selectNodeconnectionById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点连接列表
|
||||
*
|
||||
* @param nodeconnection 节点连接
|
||||
* @return 节点连接
|
||||
*/
|
||||
@Override
|
||||
public List<Nodeconnection> selectNodeconnectionList(Nodeconnection nodeconnection)
|
||||
{
|
||||
return nodeconnectionMapper.selectNodeconnectionList(nodeconnection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增节点连接
|
||||
*
|
||||
* @param nodeconnection 节点连接
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertNodeconnection(Nodeconnection nodeconnection)
|
||||
{
|
||||
return nodeconnectionMapper.insertNodeconnection(nodeconnection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改节点连接
|
||||
*
|
||||
* @param nodeconnection 节点连接
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateNodeconnection(Nodeconnection nodeconnection)
|
||||
{
|
||||
return nodeconnectionMapper.updateNodeconnection(nodeconnection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除节点连接
|
||||
*
|
||||
* @param ids 需要删除的节点连接主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNodeconnectionByIds(Long[] ids)
|
||||
{
|
||||
return nodeconnectionMapper.deleteNodeconnectionByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除节点连接信息
|
||||
*
|
||||
* @param id 节点连接主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNodeconnectionById(Long id)
|
||||
{
|
||||
return nodeconnectionMapper.deleteNodeconnectionById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.solution.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.solution.system.mapper.NodeparameterMapper;
|
||||
import com.solution.system.domain.Nodeparameter;
|
||||
import com.solution.system.service.INodeparameterService;
|
||||
|
||||
/**
|
||||
* 节点参数Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
public class NodeparameterServiceImpl implements INodeparameterService
|
||||
{
|
||||
@Autowired
|
||||
private NodeparameterMapper nodeparameterMapper;
|
||||
|
||||
@Override
|
||||
public void deleteByTreeId(Long treeId) {
|
||||
nodeparameterMapper.deleteByTreeId(treeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点参数
|
||||
*
|
||||
* @param id 节点参数主键
|
||||
* @return 节点参数
|
||||
*/
|
||||
@Override
|
||||
public Nodeparameter selectNodeparameterById(Long id)
|
||||
{
|
||||
return nodeparameterMapper.selectNodeparameterById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点参数列表
|
||||
*
|
||||
* @param nodeparameter 节点参数
|
||||
* @return 节点参数
|
||||
*/
|
||||
@Override
|
||||
public List<Nodeparameter> selectNodeparameterList(Nodeparameter nodeparameter)
|
||||
{
|
||||
return nodeparameterMapper.selectNodeparameterList(nodeparameter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增节点参数
|
||||
*
|
||||
* @param nodeparameter 节点参数
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertNodeparameter(Nodeparameter nodeparameter)
|
||||
{
|
||||
return nodeparameterMapper.insertNodeparameter(nodeparameter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改节点参数
|
||||
*
|
||||
* @param nodeparameter 节点参数
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateNodeparameter(Nodeparameter nodeparameter)
|
||||
{
|
||||
return nodeparameterMapper.updateNodeparameter(nodeparameter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除节点参数
|
||||
*
|
||||
* @param ids 需要删除的节点参数主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNodeparameterByIds(Long[] ids)
|
||||
{
|
||||
return nodeparameterMapper.deleteNodeparameterByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除节点参数信息
|
||||
*
|
||||
* @param id 节点参数主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNodeparameterById(Long id)
|
||||
{
|
||||
return nodeparameterMapper.deleteNodeparameterById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.solution.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.solution.system.mapper.NodetemplateMapper;
|
||||
import com.solution.system.domain.Nodetemplate;
|
||||
import com.solution.system.service.INodetemplateService;
|
||||
|
||||
/**
|
||||
* 节点模板Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
public class NodetemplateServiceImpl implements INodetemplateService
|
||||
{
|
||||
@Autowired
|
||||
private NodetemplateMapper nodetemplateMapper;
|
||||
|
||||
/**
|
||||
* 查询节点模板
|
||||
*
|
||||
* @param id 节点模板主键
|
||||
* @return 节点模板
|
||||
*/
|
||||
@Override
|
||||
public Nodetemplate selectNodetemplateById(Long id)
|
||||
{
|
||||
return nodetemplateMapper.selectNodetemplateById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点模板列表
|
||||
*
|
||||
* @param nodetemplate 节点模板
|
||||
* @return 节点模板
|
||||
*/
|
||||
@Override
|
||||
public List<Nodetemplate> selectNodetemplateList(Nodetemplate nodetemplate)
|
||||
{
|
||||
return nodetemplateMapper.selectNodetemplateList(nodetemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增节点模板
|
||||
*
|
||||
* @param nodetemplate 节点模板
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertNodetemplate(Nodetemplate nodetemplate)
|
||||
{
|
||||
return nodetemplateMapper.insertNodetemplate(nodetemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改节点模板
|
||||
*
|
||||
* @param nodetemplate 节点模板
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateNodetemplate(Nodetemplate nodetemplate)
|
||||
{
|
||||
return nodetemplateMapper.updateNodetemplate(nodetemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除节点模板
|
||||
*
|
||||
* @param ids 需要删除的节点模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNodetemplateByIds(Long[] ids)
|
||||
{
|
||||
return nodetemplateMapper.deleteNodetemplateByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除节点模板信息
|
||||
*
|
||||
* @param id 节点模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNodetemplateById(Long id)
|
||||
{
|
||||
return nodetemplateMapper.deleteNodetemplateById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.solution.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.solution.system.mapper.TemplateparameterdefMapper;
|
||||
import com.solution.system.domain.Templateparameterdef;
|
||||
import com.solution.system.service.ITemplateparameterdefService;
|
||||
|
||||
/**
|
||||
* 模板参数定义Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
public class TemplateparameterdefServiceImpl implements ITemplateparameterdefService
|
||||
{
|
||||
@Autowired
|
||||
private TemplateparameterdefMapper templateparameterdefMapper;
|
||||
|
||||
/**
|
||||
* 查询模板参数定义
|
||||
*
|
||||
* @param id 模板参数定义主键
|
||||
* @return 模板参数定义
|
||||
*/
|
||||
@Override
|
||||
public Templateparameterdef selectTemplateparameterdefById(Long id)
|
||||
{
|
||||
return templateparameterdefMapper.selectTemplateparameterdefById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询模板参数定义列表
|
||||
*
|
||||
* @param templateparameterdef 模板参数定义
|
||||
* @return 模板参数定义
|
||||
*/
|
||||
@Override
|
||||
public List<Templateparameterdef> selectTemplateparameterdefList(Templateparameterdef templateparameterdef)
|
||||
{
|
||||
return templateparameterdefMapper.selectTemplateparameterdefList(templateparameterdef);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模板参数定义
|
||||
*
|
||||
* @param templateparameterdef 模板参数定义
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTemplateparameterdef(Templateparameterdef templateparameterdef)
|
||||
{
|
||||
return templateparameterdefMapper.insertTemplateparameterdef(templateparameterdef);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模板参数定义
|
||||
*
|
||||
* @param templateparameterdef 模板参数定义
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTemplateparameterdef(Templateparameterdef templateparameterdef)
|
||||
{
|
||||
return templateparameterdefMapper.updateTemplateparameterdef(templateparameterdef);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除模板参数定义
|
||||
*
|
||||
* @param ids 需要删除的模板参数定义主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTemplateparameterdefByIds(Long[] ids)
|
||||
{
|
||||
return templateparameterdefMapper.deleteTemplateparameterdefByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板参数定义信息
|
||||
*
|
||||
* @param id 模板参数定义主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTemplateparameterdefById(Long id)
|
||||
{
|
||||
return templateparameterdefMapper.deleteTemplateparameterdefById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.solution.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.solution.system.mapper.TreenodeinstanceMapper;
|
||||
import com.solution.system.domain.Treenodeinstance;
|
||||
import com.solution.system.service.ITreenodeinstanceService;
|
||||
|
||||
/**
|
||||
* 行为树实例节点Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
public class TreenodeinstanceServiceImpl implements ITreenodeinstanceService
|
||||
{
|
||||
@Autowired
|
||||
private TreenodeinstanceMapper treenodeinstanceMapper;
|
||||
|
||||
@Override
|
||||
public void deleteByTreeId(Long treeId) {
|
||||
treenodeinstanceMapper.deleteByTreeId(treeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点
|
||||
*
|
||||
* @param id 行为树实例节点主键
|
||||
* @return 行为树实例节点
|
||||
*/
|
||||
@Override
|
||||
public Treenodeinstance selectTreenodeinstanceById(Long id)
|
||||
{
|
||||
return treenodeinstanceMapper.selectTreenodeinstanceById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点列表
|
||||
*
|
||||
* @param treenodeinstance 行为树实例节点
|
||||
* @return 行为树实例节点
|
||||
*/
|
||||
@Override
|
||||
public List<Treenodeinstance> selectTreenodeinstanceList(Treenodeinstance treenodeinstance)
|
||||
{
|
||||
return treenodeinstanceMapper.selectTreenodeinstanceList(treenodeinstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增行为树实例节点
|
||||
*
|
||||
* @param treenodeinstance 行为树实例节点
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTreenodeinstance(Treenodeinstance treenodeinstance)
|
||||
{
|
||||
return treenodeinstanceMapper.insertTreenodeinstance(treenodeinstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行为树实例节点
|
||||
*
|
||||
* @param treenodeinstance 行为树实例节点
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTreenodeinstance(Treenodeinstance treenodeinstance)
|
||||
{
|
||||
return treenodeinstanceMapper.updateTreenodeinstance(treenodeinstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除行为树实例节点
|
||||
*
|
||||
* @param ids 需要删除的行为树实例节点主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTreenodeinstanceByIds(Long[] ids)
|
||||
{
|
||||
return treenodeinstanceMapper.deleteTreenodeinstanceByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除行为树实例节点信息
|
||||
*
|
||||
* @param id 行为树实例节点主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTreenodeinstanceById(Long id)
|
||||
{
|
||||
return treenodeinstanceMapper.deleteTreenodeinstanceById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?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.system.mapper.BehaviortreeMapper">
|
||||
|
||||
<resultMap type="Behaviortree" id="BehaviortreeResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="description" column="description" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="updatedAt" column="updated_at" />
|
||||
<result property="englishName" column="english_name"/>
|
||||
<result property="xmlContent" column="xml_content" />
|
||||
<result property="platformId" column="platform_id" />
|
||||
<result property="scenarioId" column="scenario_id" />
|
||||
</resultMap>
|
||||
|
||||
<select id="findOneByPlatformId" resultMap="BehaviortreeResult">
|
||||
select * from behaviortree
|
||||
where platform_id=#{platformId}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<sql id="selectBehaviortreeVo">
|
||||
select id, name, description, created_at, updated_at, english_name, xml_content, platform_id, scenario_id from behaviortree
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectBehaviortreeList" parameterType="Behaviortree" resultMap="BehaviortreeResult">
|
||||
<include refid="selectBehaviortreeVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="createdAt != null "> and created_at = #{createdAt}</if>
|
||||
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
|
||||
<if test="englishName != null and englishName != ''"> and english_name like concat('%', #{englishName}, '%')</if>
|
||||
<if test="xmlContent != null and xmlContent != ''"> and xml_content = #{xmlContent}</if>
|
||||
<if test="xmlContent != null and xmlContent != ''"> and xml_content = #{xmlContent}</if>
|
||||
<if test="platformId != null">platform_id = #{platformId}</if>
|
||||
<if test="scenarioId != null">scenario_id = #{scenarioId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBehaviortreeById" parameterType="Long" resultMap="BehaviortreeResult">
|
||||
select id, name, description, created_at, updated_at, english_name,graph, xml_content ,platform_id, scenario_id from behaviortree
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="getCommander" resultType="com.solution.system.domain.PlatformChiefCommander"
|
||||
parameterType="java.lang.Integer">
|
||||
SELECT id,
|
||||
create_time AS createTime,
|
||||
name,time,command,
|
||||
subordinate_commander AS subordinateCommander,
|
||||
scenario_id AS scenarioId
|
||||
FROM platform_chief_commander
|
||||
WHERE scenario_id = #{scenarioId}
|
||||
</select>
|
||||
<select id="getCountName" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
SELECT count(*)
|
||||
FROM behaviortree
|
||||
WHERE name = #{name}
|
||||
</select>
|
||||
|
||||
<insert id="insertBehaviortree" parameterType="Behaviortree" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into behaviortree
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="createdAt != null">created_at,</if>
|
||||
<if test="updatedAt != null">updated_at,</if>
|
||||
<if test="englishName != null and englishName != ''">english_name,</if>
|
||||
<if test="xmlContent != null">xml_content,</if>
|
||||
<if test="platformId != null">platform_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="createdAt != null">#{createdAt},</if>
|
||||
<if test="updatedAt != null">#{updatedAt},</if>
|
||||
<if test="englishName != null and englishName != ''">#{englishName},</if>
|
||||
<if test="xmlContent != null">#{xmlContent},</if>
|
||||
<if test="platformId != null">#{platformId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insert" parameterType="com.solution.scene.domain.AfsimScenario">
|
||||
INSERT INTO afsim_scenario (name, description, scenario_path, communication_graph)
|
||||
VALUES (#{name}, #{description}, #{scenarioPath}, #{communicationGraph})
|
||||
</insert>
|
||||
|
||||
<update id="updateBehaviortree" parameterType="Behaviortree">
|
||||
update behaviortree
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||
<if test="englishName != null and englishName != ''">english_name = #{englishName},</if>
|
||||
<if test="xmlContent != null">xml_content = #{xmlContent},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBehaviortreeById" parameterType="Long">
|
||||
delete from behaviortree where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBehaviortreeByIds" parameterType="String">
|
||||
delete from behaviortree where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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.system.mapper.HbNodeCommandMapper">
|
||||
|
||||
<resultMap type="com.solution.system.domain.HbNodeCommand" id="HbNodeCommandMapperMap">
|
||||
<result property="id" column="id"/>
|
||||
<result property="command" column="command"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="chineseName" column="chinese_name"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findAll" resultMap="HbNodeCommandMapperMap">
|
||||
select *
|
||||
from bh_node_command
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,75 @@
|
||||
<?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.system.mapper.NodeconnectionMapper">
|
||||
|
||||
<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, 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>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectNodeconnectionById" parameterType="Long" resultMap="NodeconnectionResult">
|
||||
<include refid="selectNodeconnectionVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<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>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<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>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteNodeconnectionById" parameterType="Long">
|
||||
delete from nodeconnection where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteNodeconnectionByIds" parameterType="String">
|
||||
delete from nodeconnection where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?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.system.mapper.NodeparameterMapper">
|
||||
|
||||
<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" />
|
||||
<result property="groupIndex" column="group_index" />
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteByTreeId">
|
||||
delete from nodeparameter where tree_id=#{treeId}
|
||||
</delete>
|
||||
|
||||
<sql id="selectNodeparameterVo">
|
||||
select id, treeId, node_instance_id, param_def_id,`value`, group_index from nodeparameter
|
||||
</sql>
|
||||
|
||||
<select id="selectNodeparameterList" parameterType="Nodeparameter" resultMap="NodeparameterResult">
|
||||
<include refid="selectNodeparameterVo"/>
|
||||
<where>
|
||||
<if test="nodeInstanceId != null "> and node_instance_id = #{nodeInstanceId}</if>
|
||||
<if test="paramDefId != null "> and param_def_id = #{paramDefId}</if>
|
||||
<if test="value != null and value != ''"> and value = #{value}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectNodeparameterById" parameterType="Long" resultMap="NodeparameterResult">
|
||||
<include refid="selectNodeparameterVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<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>
|
||||
group_index
|
||||
</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>
|
||||
#{groupIndex}
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<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>
|
||||
group_index=#{groupIndex}
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteNodeparameterById" parameterType="Long">
|
||||
delete from nodeparameter where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteNodeparameterByIds" parameterType="String">
|
||||
delete from nodeparameter where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?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.system.mapper.NodetemplateMapper">
|
||||
|
||||
<resultMap type="Nodetemplate" id="NodetemplateResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="type" column="type" />
|
||||
<result property="name" column="name" />
|
||||
<result property="logicHandler" column="logic_handler" />
|
||||
<result property="description" column="description" />
|
||||
<result property="englishName" column="english_name" />
|
||||
<result property="templateType" column="templete_type" />
|
||||
<result property="multiable" column="is_multiable" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectNodetemplateVo">
|
||||
select id, type, name, logic_handler, description, english_name, templete_type, is_multiable from nodetemplate
|
||||
</sql>
|
||||
|
||||
<select id="selectNodetemplateList" parameterType="Nodetemplate" resultMap="NodetemplateResult">
|
||||
<include refid="selectNodetemplateVo"/>
|
||||
<where>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<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="templateType != null and templateType != ''"> and templete_type = #{templateType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectNodetemplateById" parameterType="Long" resultMap="NodetemplateResult">
|
||||
<include refid="selectNodetemplateVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertNodetemplate" parameterType="Nodetemplate" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into nodetemplate
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="logicHandler != null">logic_handler,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="englishName != null">english_name,</if>
|
||||
<if test="templateType != null and templateType != ''">templete_type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="logicHandler != null">#{logicHandler},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="englishName != null">#{englishName},</if>
|
||||
<if test="templateType != null and templateType != ''">#{templateType},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateNodetemplate" parameterType="Nodetemplate">
|
||||
update nodetemplate
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<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="templateType != null and templateType != ''">templete_type = #{templateType},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteNodetemplateById" parameterType="Long">
|
||||
delete from nodetemplate where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteNodetemplateByIds" parameterType="String">
|
||||
delete from nodetemplate where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?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.system.mapper.PlatformCommunicationMapper">
|
||||
|
||||
|
||||
<select id="getUnderlingBytreeId" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
SELECT subordinate_platform
|
||||
FROM platform_communication
|
||||
WHERE command_platform = #{name}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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.system.mapper.PlatformMapper">
|
||||
|
||||
|
||||
|
||||
<select id="selectPlatformChineseName" resultType="java.lang.String"
|
||||
parameterType="java.util.List">
|
||||
SELECT description
|
||||
FROM platform
|
||||
WHERE name IN
|
||||
<foreach item="item" collection="underlingEnglishName" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getPlatformById" resultType="com.solution.system.domain.PlatformTree"
|
||||
parameterType="java.lang.Integer">
|
||||
SELECT id, name, description, scenario_id AS scenarioId
|
||||
FROM platform
|
||||
WHERE id = #{platformId}
|
||||
</select>
|
||||
<select id="getPlatformByEnglishName" resultType="com.solution.system.domain.PlatformVO">
|
||||
SELECT id,name,description,
|
||||
scenario_id AS scenarioId,
|
||||
longitude,latitude,
|
||||
platform_type AS platformType,
|
||||
altitude
|
||||
FROM platform
|
||||
WHERE name IN
|
||||
<foreach item="item" collection="underlingEnglishName" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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.system.mapper.TemplateparameterdefMapper">
|
||||
|
||||
<resultMap type="Templateparameterdef" id="TemplateparameterdefResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="paramKey" column="param_key" />
|
||||
<result property="dataType" column="data_type" />
|
||||
<result property="defaultValue" column="default_value" />
|
||||
<result property="description" column="description" />
|
||||
<result property="templateType" column="template_type" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTemplateparameterdefVo">
|
||||
select id, template_id, param_key, data_type, default_value, description, template_type from templateparameterdef
|
||||
</sql>
|
||||
|
||||
<select id="selectTemplateparameterdefList" parameterType="templateparameterdef" resultMap="TemplateparameterdefResult">
|
||||
<include refid="selectTemplateparameterdefVo"/>
|
||||
<where>
|
||||
<if test="templateId != null "> and template_id = #{templateId}</if>
|
||||
<if test="paramKey != null and paramKey != ''"> and param_key = #{paramKey}</if>
|
||||
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
|
||||
<if test="defaultValue != null and defaultValue != ''"> and default_value = #{defaultValue}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="templateType != null and templateType != ''"> and template_type = #{templateType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTemplateparameterdefById" parameterType="Long" resultMap="TemplateparameterdefResult">
|
||||
<include refid="selectTemplateparameterdefVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertTemplateparameterdef" parameterType="Templateparameterdef" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into templateparameterdef
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="paramKey != null and paramKey != ''">param_key,</if>
|
||||
<if test="dataType != null and dataType != ''">data_type,</if>
|
||||
<if test="defaultValue != null and defaultValue != ''">default_value,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="templateType != null and templateType != ''">template_type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="paramKey != null and paramKey != ''">#{paramKey},</if>
|
||||
<if test="dataType != null and dataType != ''">#{dataType},</if>
|
||||
<if test="defaultValue != null and defaultValue != ''">#{defaultValue},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="templateType != null and templateType != ''">#{templateType},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTemplateparameterdef" parameterType="Templateparameterdef">
|
||||
update templateparameterdef
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="paramKey != null and paramKey != ''">param_key = #{paramKey},</if>
|
||||
<if test="dataType != null and dataType != ''">data_type = #{dataType},</if>
|
||||
<if test="defaultValue != null and defaultValue != ''">default_value = #{defaultValue},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="templateType != null and templateType != ''">template_type = #{templateType},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTemplateparameterdefById" parameterType="Long">
|
||||
delete from templateparameterdef where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTemplateparameterdefByIds" parameterType="String">
|
||||
delete from templateparameterdef where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?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.system.mapper.TreenodeinstanceMapper">
|
||||
|
||||
<resultMap type="Treenodeinstance" id="TreenodeinstanceResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="treeId" column="tree_id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="instanceName" column="instance_name" />
|
||||
<result property="isRoot" column="is_root" />
|
||||
<result property="preconditionTempleteId" column="precondition_templete_id" />
|
||||
<result property="uuid" column="uuid" />
|
||||
<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>
|
||||
|
||||
<select id="selectTreenodeinstanceList" parameterType="Treenodeinstance" resultMap="TreenodeinstanceResult">
|
||||
<include refid="selectTreenodeinstanceVo"/>
|
||||
<where>
|
||||
<if test="treeId != null "> and tree_id = #{treeId}</if>
|
||||
<if test="templateId != null "> and template_id = #{templateId}</if>
|
||||
<if test="instanceName != null and instanceName != ''"> and instance_name like concat('%', #{instanceName}, '%')</if>
|
||||
<if test="isRoot != null "> and is_root = #{isRoot}</if>
|
||||
<if test="preconditionTempleteId != null "> and precondition_templete_id = #{preconditionTempleteId}</if>
|
||||
<if test="uuid != null and uuid != ''"> and uuid = #{uuid}</if>
|
||||
<if test="desciption != null and desciption != ''"> and desciption = #{desciption}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTreenodeinstanceById" parameterType="Long" resultMap="TreenodeinstanceResult">
|
||||
<include refid="selectTreenodeinstanceVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertTreenodeinstance" parameterType="Treenodeinstance" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into treenodeinstance
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="treeId != null">tree_id,</if>
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="instanceName != null">instance_name,</if>
|
||||
<if test="isRoot != null">is_root,</if>
|
||||
<if test="preconditionTempleteId != null">precondition_templete_id,</if>
|
||||
<if test="uuid != null">uuid,</if>
|
||||
<if test="desciption != null">desciption,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="treeId != null">#{treeId},</if>
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="instanceName != null">#{instanceName},</if>
|
||||
<if test="isRoot != null">#{isRoot},</if>
|
||||
<if test="preconditionTempleteId != null">#{preconditionTempleteId},</if>
|
||||
<if test="uuid != null">#{uuid},</if>
|
||||
<if test="desciption != null">#{desciption},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTreenodeinstance" parameterType="Treenodeinstance">
|
||||
update treenodeinstance
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="treeId != null">tree_id = #{treeId},</if>
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="instanceName != null">instance_name = #{instanceName},</if>
|
||||
<if test="isRoot != null">is_root = #{isRoot},</if>
|
||||
<if test="preconditionTempleteId != null">precondition_templete_id = #{preconditionTempleteId},</if>
|
||||
<if test="uuid != null">uuid = #{uuid},</if>
|
||||
<if test="desciption != null">desciption = #{desciption},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTreenodeinstanceById" parameterType="Long">
|
||||
delete from treenodeinstance where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTreenodeinstanceByIds" parameterType="String">
|
||||
delete from treenodeinstance where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -113,6 +113,18 @@
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.34</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.25</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,18 @@
|
||||
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 组件";
|
||||
|
||||
public static final String SCENE_CONFIG_NOT_NULL = "场景配置不能为空";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.solution.common.constant;
|
||||
|
||||
|
||||
public class PlatformAndModuleConstants {
|
||||
|
||||
public static final String RED_NEBO_M_1 = "red_nebo_m_1";
|
||||
|
||||
public static final String RED_NEBO_M_2 = "red_nebo_m_2";
|
||||
|
||||
public static final String RED_TANK_1 = "red_tank_1";
|
||||
}
|
||||
@@ -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);
|
||||
// 用户验证
|
||||
|
||||
82
auto-solution-rule/pom.xml
Normal file
82
auto-solution-rule/pom.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>solution</artifactId>
|
||||
<groupId>com.solution</groupId>
|
||||
<version>3.9.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>solution-rule</artifactId>
|
||||
|
||||
<description>
|
||||
rule模块
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<!-- Drools 版本,建议使用稳定版,如 7.74.1.Final 或 8.x 系列 -->
|
||||
<drools.version>7.74.1.Final</drools.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 1. Drools 核心引擎 -->
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-core</artifactId>
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-templates</artifactId>
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 2. KIE API(Drools 属于 KIE 项目的一部分,此依赖提供核心 API) -->
|
||||
<dependency>
|
||||
<groupId>org.kie</groupId>
|
||||
<artifactId>kie-api</artifactId>
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 3. 规则编译器(用于编译 .drl 等规则文件) -->
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-compiler</artifactId>
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 4. Spring 整合(如果需要和 Spring/Spring Boot 深度整合) -->
|
||||
<dependency>
|
||||
<groupId>org.kie</groupId>
|
||||
<artifactId>kie-spring</artifactId>
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 流式解析工具-->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.15.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.solution.rule.config;
|
||||
|
||||
import org.kie.api.KieBase;
|
||||
import org.kie.api.KieServices;
|
||||
import org.kie.api.builder.KieBuilder;
|
||||
import org.kie.api.builder.KieFileSystem;
|
||||
import org.kie.api.builder.KieRepository;
|
||||
import org.kie.api.builder.Message;
|
||||
import org.kie.api.runtime.KieContainer;
|
||||
import org.kie.api.runtime.KieSession;
|
||||
import org.kie.internal.io.ResourceFactory;
|
||||
import org.kie.spring.KModuleBeanFactoryPostProcessor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Configuration
|
||||
public class DroolsConfig {
|
||||
|
||||
private static final String RULE_PATH = "classpath*:rules/**/*.drl";
|
||||
|
||||
private final KieServices kieServices = KieServices.Factory.get();
|
||||
|
||||
/**
|
||||
* 加载规则文件
|
||||
*/
|
||||
@Bean
|
||||
public KieFileSystem kieFileSystem() throws IOException {
|
||||
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
|
||||
|
||||
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
Resource[] resources = resolver.getResources(RULE_PATH);
|
||||
|
||||
for (Resource resource : resources) {
|
||||
kieFileSystem.write(
|
||||
ResourceFactory.newInputStreamResource(resource.getInputStream())
|
||||
.setSourcePath("rules/" + resource.getFilename())
|
||||
);
|
||||
}
|
||||
|
||||
return kieFileSystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 KieContainer
|
||||
*/
|
||||
@Bean
|
||||
public KieContainer kieContainer(KieFileSystem kieFileSystem) {
|
||||
|
||||
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
|
||||
kieBuilder.buildAll();
|
||||
|
||||
// 检查错误
|
||||
if (kieBuilder.getResults().hasMessages(Message.Level.ERROR)) {
|
||||
throw new RuntimeException("Drools规则编译错误:\n" +
|
||||
kieBuilder.getResults().toString());
|
||||
}
|
||||
|
||||
KieRepository repository = kieServices.getRepository();
|
||||
|
||||
return kieServices.newKieContainer(repository.getDefaultReleaseId());
|
||||
}
|
||||
|
||||
/**
|
||||
* KieBase
|
||||
*/
|
||||
@Bean
|
||||
public KieBase kieBase(KieContainer kieContainer) {
|
||||
return kieContainer.getKieBase();
|
||||
}
|
||||
|
||||
/**
|
||||
* KieSession(推荐加)
|
||||
*/
|
||||
@Bean
|
||||
public KieSession kieSession(KieContainer kieContainer) {
|
||||
return kieContainer.newKieSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* 必须是 static
|
||||
*/
|
||||
@Bean
|
||||
public static KModuleBeanFactoryPostProcessor kiePostProcessor() {
|
||||
return new KModuleBeanFactoryPostProcessor();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.solution.rule.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 装备匹配规则默认参数,与 {@code resources/rules/rule.drl} 中 {@code buildParam} 键保持一致。
|
||||
*/
|
||||
public final class FireRuleMatchDefaultParams {
|
||||
|
||||
private FireRuleMatchDefaultParams() {
|
||||
}
|
||||
|
||||
public static Map<String, Object> defaults() {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("weight", 1);
|
||||
param.put("minSelectedScore", 1);
|
||||
param.put("tankScore", 1);
|
||||
param.put("airScore", 2);
|
||||
param.put("groundScore", 1);
|
||||
param.put("missileScore", 1);
|
||||
param.put("airTaskScore", 10);
|
||||
param.put("bluePlatformKeywords_air", "F-16,J-10,F-35");
|
||||
param.put("redPreferredWhenBlueAir", "防空,导弹,无人机,直升机,空空");
|
||||
param.put("redPreferredWhenGround", "远火,榴弹,炮,火箭");
|
||||
param.put("airTaskKeywords", "空中,制空,拦截,空战");
|
||||
param.put("groundTaskKeywords", "地面,突击,登陆");
|
||||
param.put("tankKeywords", "坦克,装甲");
|
||||
param.put("missileKeywords", "导弹,火箭弹,巡航");
|
||||
param.put("tieBreak", "equipmentId");
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.solution.rule.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;
|
||||
import java.util.List;
|
||||
|
||||
public class BasicPlatform implements Serializable {
|
||||
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.solution.rule.domain;
|
||||
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FireRuleExecuteDTO {
|
||||
|
||||
@ApiModelProperty("场景类型")
|
||||
private Integer sceneType;
|
||||
|
||||
@ApiModelProperty("武器模型数据")
|
||||
private List<WeaponModelDTO> weaponModelDTOs;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.solution.rule.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.List;
|
||||
|
||||
public class Platform extends BasicPlatform {
|
||||
|
||||
private List<PlatformComponent> components;
|
||||
|
||||
public List<PlatformComponent> getComponents() {
|
||||
return components;
|
||||
}
|
||||
|
||||
public void setComponents(List<PlatformComponent> components) {
|
||||
this.components = components;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.solution.rule.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 平台挂载的组件实体类
|
||||
* 对应表 platform_component
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "平台组件对象", description = "平台所挂载的武器、雷达、通信等组件")
|
||||
public class PlatformComponent {
|
||||
|
||||
@ApiModelProperty(value = "组件ID,主键自增")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "组件名称(具体型号)")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "组件类型:weapon(武器)、radar(雷达)、comm(通信)")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "组件描述信息")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(value = "所属平台ID,关联platform表")
|
||||
private Integer platformId;
|
||||
|
||||
@ApiModelProperty(value = "组件数量")
|
||||
private Long num;
|
||||
|
||||
@ApiModelProperty(value = "平台参数(List<String>)")
|
||||
private List<String> platformParams;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.solution.rule.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ApiModel("红蓝对抗规则")
|
||||
public class Rule {
|
||||
@ApiModelProperty("规则ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("规则名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("场景类型:0-防御,1-空降,null表示通用")
|
||||
private Integer sceneType;
|
||||
|
||||
@ApiModelProperty("触发条件(JSON格式)")
|
||||
private String conditions;
|
||||
|
||||
@ApiModelProperty("响应动作(JSON格式)")
|
||||
private String actions;
|
||||
|
||||
@ApiModelProperty("优先级(数值越小优先级越高)")
|
||||
private Integer priority;
|
||||
|
||||
@ApiModelProperty("是否启用(0禁用,1启用)")
|
||||
private Boolean enabled;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createdTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updatedTime;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.solution.rule.domain;
|
||||
|
||||
import com.solution.rule.domain.dto.WeaponModelDTO;
|
||||
import com.solution.rule.domain.vo.ComponentCountVO;
|
||||
import com.solution.rule.domain.vo.PlatformWeaponAggregateVO;
|
||||
import com.solution.rule.domain.vo.WeaponModelVO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class RuleParam {
|
||||
|
||||
private List<PlatformWeaponAggregateVO> resultWeapons;
|
||||
|
||||
private WeaponModelVO weaponModelVO;
|
||||
|
||||
private List<WeaponModelDTO> weaponModelDTOList;
|
||||
|
||||
private List<ComponentCountVO> databaseWeapons;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.solution.rule.domain.config;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("规则聚合对象")
|
||||
public class RuleConfig {
|
||||
|
||||
@ApiModelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("规则编码")
|
||||
private String ruleCode;
|
||||
|
||||
@ApiModelProperty("规则名称")
|
||||
private String ruleName;
|
||||
|
||||
@ApiModelProperty("层级编码(task/action/platform)")
|
||||
private String levelCode;
|
||||
|
||||
@ApiModelProperty("种类编码(select/assign/deploy/config/mode/spacetime/relation/limit)")
|
||||
private String kindCode;
|
||||
|
||||
@ApiModelProperty("模块编码(equipment/target/position/track/group)")
|
||||
private String moduleCode;
|
||||
|
||||
@ApiModelProperty("优先级(数字越小越先执行)")
|
||||
private Integer priorityNo;
|
||||
|
||||
@ApiModelProperty("条件表达式")
|
||||
private String conditionExpr;
|
||||
|
||||
@ApiModelProperty("动作表达式")
|
||||
private String actionExpr;
|
||||
|
||||
@ApiModelProperty("版本号")
|
||||
private Integer versionNo;
|
||||
|
||||
@ApiModelProperty("是否启用(1是0否)")
|
||||
private Integer enabled;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createdAt;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updatedAt;
|
||||
|
||||
@ApiModelProperty("参数列表")
|
||||
private List<RuleConfigParam> params;
|
||||
|
||||
@ApiModelProperty("适用任务类型编码列表")
|
||||
private List<String> taskTypes;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user