182 Commits

Author SHA1 Message Date
MHW
5c83b561cc 逻辑修改 2026-04-13 17:58:01 +08:00
bb45ff557b 新增根据行为树ID获取下属平台的接口 2026-04-13 17:33:28 +08:00
254401d8f1 支持根据行为树加载下属平台并优化属性面板显示 2026-04-13 17:26:50 +08:00
d8c238a9bb Merge remote-tracking branch 'origin/master' 2026-04-13 17:15:51 +08:00
MHW
aefc2c688e 逻辑修改 2026-04-13 17:13:34 +08:00
MHW
5f1ba38c6b 逻辑修改 2026-04-13 17:10:52 +08:00
MHW
e57f0f19d5 根据场景id显示所有行为树 2026-04-13 17:02:08 +08:00
79364b951d 修复类型导入缺失及Props类型断言格式 2026-04-13 16:41:11 +08:00
1270bd7d02 Merge remote-tracking branch 'origin/master' 2026-04-13 16:40:51 +08:00
MHW
b424774f3b 实体重复修改bug修复 2026-04-13 16:34:05 +08:00
MHW
766425bae5 实体重复修改 2026-04-13 16:31:56 +08:00
MHW
0e6b6d9f45 查询行为树所属平台的下属 2026-04-13 16:16:24 +08:00
50c1cc5bf2 修复行为树复制参数传递错误 2026-04-13 15:33:46 +08:00
7c71a38f68 添加前端行为树复制接口 2026-04-13 15:24:59 +08:00
3946bc561a 添加行为树复制功能 2026-04-13 14:25:50 +08:00
5179ab785c Merge commit '5276a6b16fdf0e345bd0a952abc998c1bf4e3725' 2026-04-13 14:22:14 +08:00
MHW
5276a6b16f 复制行为树 2026-04-13 14:19:18 +08:00
c0da7bd0d9 画布动态尺寸 2026-04-13 12:22:30 +08:00
MHW
dafd7115a8 Merge branch 'refs/heads/develop' 2026-04-13 10:39:47 +08:00
MHW
1061020791 复制行为树 2026-04-13 10:39:37 +08:00
MHW
045117011b docker-compose 2026-04-11 13:46:02 +08:00
MHW
8a0dfb1ab8 sql改 2026-04-09 16:10:15 +08:00
MHW
08030c77c2 sql改 2026-04-09 16:06:40 +08:00
MHW
230116bdd7 sql 2026-04-09 15:40:49 +08:00
MHW
a65d296421 sql 2026-04-09 15:36:28 +08:00
MHW
78e5833514 docker 2026-04-09 15:13:10 +08:00
MHW
6add28fdfb 火力规则:装备匹配规则实现,目标规则实现,阵位规则、航迹规则【初版】 2026-04-09 10:22:53 +08:00
MHW
2fafd931cc 火力规则:装备匹配规则实现,目标规则实现,阵位规则简单实现(需要细化) 2026-04-07 17:04:13 +08:00
MHW
72f4caf555 火力规则:装备匹配规则实现 2026-04-07 14:41:46 +08:00
MHW
866fd215f2 火力规则:java静态方法实现规则 2026-04-07 11:23:27 +08:00
MHW
3e871e2dbd 火力规则:java代码层面设计 2026-04-07 10:02:31 +08:00
MHW
094dcf857d Merge remote-tracking branch 'origin/master' 2026-04-04 07:08:25 +08:00
MHW
50a369c722 火力规则:最终版json实体解析定义 2026-04-04 07:07:20 +08:00
libertyspy
b97f9aa32b UPDATE: VERSION-20260401 2026-04-01 11:32:53 +08:00
MHW
11e25fd0de Merge branch 'refs/heads/behaviortree-save' 2026-03-31 15:40:10 +08:00
MHW
eb57d2d228 行为树:新增行为树添加平台id 2026-03-31 15:39:58 +08:00
MHW
bcb0ca03b1 Merge remote-tracking branch 'origin/master' 2026-03-31 15:32:37 +08:00
MHW
7610076760 Merge branch 'refs/heads/develop' 2026-03-31 15:32:06 +08:00
MHW
e52aaa1680 火力规则:添加武器命中率因素 2026-03-31 15:31:50 +08:00
libertyspy
fecfb8d39c UPDATE: VERSION-20260331 2026-03-31 14:36:21 +08:00
libertyspy
150966824e UPDATE: VERSION-20260331 2026-03-31 14:33:09 +08:00
libertyspy
a4d9e8d8eb UPDATE: VERSION-20260331 2026-03-31 14:33:02 +08:00
libertyspy
a0d8f555f9 UPDATE: VERSION-20260331 2026-03-31 14:32:54 +08:00
libertyspy
705021b391 UPDATE: VERSION-20260331 2026-03-31 11:14:29 +08:00
libertyspy
889cc02631 UPDATE: VERSION-20260331 2026-03-31 11:11:02 +08:00
libertyspy
cc1e003bc4 UPDATE: VERSION-20260331 2026-03-31 11:10:43 +08:00
MHW
eeed692ba6 火力规则:组件匹配修改(注释修改) 2026-03-30 16:50:38 +08:00
MHW
b3563a05d6 Merge branch 'refs/heads/develop'
# Conflicts:
#	auto-solution-rule/src/main/resources/rules/README.md
2026-03-30 16:46:49 +08:00
MHW
a7c19fb7e7 火力规则:组件匹配修改 2026-03-30 16:44:55 +08:00
MHW
36809d4033 Merge branch 'refs/heads/develop'
# Conflicts:
#	auto-solution-rule/src/main/resources/rules/README.md
2026-03-30 16:43:45 +08:00
MHW
1dba7584cd 火力规则:组件匹配修改 2026-03-30 16:43:24 +08:00
MHW
35d2766442 火力规则:规则文件注释补充 2026-03-30 11:12:19 +08:00
MHW
ce832fb16d 火力规则:代码冲突解决,readme文件补充 2026-03-27 20:37:45 +08:00
MHW
e9503358d3 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	auto-solution-rule/src/main/java/com/solution/rule/service/FireRuleService.java
#	modeler/src/style.less
2026-03-27 17:58:40 +08:00
MHW
3b3370c440 Merge branch 'refs/heads/develop'
# Conflicts:
#	auto-solution-rule/src/main/java/com/solution/rule/service/FireRuleService.java
#	modeler/src/style.less
2026-03-27 17:56:55 +08:00
MHW
d8719c30c6 火力规则:装备类型规则、目标规则实现、阵位规则、航迹规则 2026-03-27 17:54:48 +08:00
MHW
9ff0e50bba 火力规则:装备类型规则、目标规则实现 2026-03-27 16:56:07 +08:00
libertyspy
2838938cfa UPDATE: VERSION-20260327 2026-03-27 14:02:18 +08:00
MHW
c4cc3cc30b 火力规则打击规则实现 2026-03-27 11:35:17 +08:00
libertyspy
d1f720f691 UPDATE: VERSION-20260327 2026-03-27 10:54:44 +08:00
libertyspy
cb1019b7d7 UPDATE: VERSION-20260327 2026-03-27 10:35:23 +08:00
MHW
18827cfbe7 火力规则打击规则实现 2026-03-27 10:27:04 +08:00
MHW
3fe32e4ac3 develop: 临时保存修改 2026-03-27 10:20:45 +08:00
libertyspy
168ced6b27 UPDATE: VERSION-20260327 2026-03-27 10:03:25 +08:00
libertyspy
499734efe8 UPDATE: VERSION-20260327 2026-03-27 10:03:16 +08:00
libertyspy
27c8fc13c6 UPDATE: VERSION-20260327 2026-03-27 10:03:07 +08:00
libertyspy
505092bcf4 UPDATE: VERSION-20260327 2026-03-27 10:02:59 +08:00
libertyspy
41ba11dc9b UPDATE: VERSION-20260327 2026-03-27 09:33:46 +08:00
libertyspy
158512cd12 UPDATE: VERSION-20260326 2026-03-27 00:08:48 +08:00
libertyspy
3a3ab0c9c6 UPDATE: VERSION-20260326 2026-03-27 00:05:50 +08:00
libertyspy
b08c74260d UPDATE: VERSION-20260326 2026-03-27 00:05:04 +08:00
libertyspy
02e9ca26a1 UPDATE: VERSION-20260326 2026-03-26 23:59:15 +08:00
libertyspy
8958ecd6dc UPDATE: VERSION-20260326 2026-03-26 23:36:47 +08:00
libertyspy
6656479327 UPDATE: VERSION-20260326 2026-03-26 22:05:31 +08:00
libertyspy
18ccf490e4 UPDATE: VERSION-20260326 2026-03-26 21:45:31 +08:00
MHW
4a0602ce4e Merge branch 'refs/heads/develop' 2026-03-17 21:22:30 +08:00
MHW
8844830afc 修复lombok导致打包冲突 2026-03-17 21:21:48 +08:00
MHW
bcc450141e 保存场景关系 2026-03-17 11:08:30 +08:00
MHW
25e6ac1cbe Merge branch 'refs/heads/develop' 2026-03-17 11:07:52 +08:00
MHW
8b2f4dab89 保存场景关系 2026-03-17 11:07:35 +08:00
MHW
4f60d68c4f Merge remote-tracking branch 'origin/master' 2026-03-17 10:49:52 +08:00
MHW
b63ad360d0 新增通信关系 2026-03-17 10:49:21 +08:00
libertyspy
c724a7acf7 UPDATE: VERSION-20260317 2026-03-17 10:21:00 +08:00
libertyspy
185e490560 UPDATE: VERSION-20260317 2026-03-17 10:06:55 +08:00
libertyspy
d13359c803 UPDATE: VERSION-20260317 2026-03-17 00:36:54 +08:00
libertyspy
65ea1cfd6b UPDATE: VERSION-20260317 2026-03-17 00:36:46 +08:00
libertyspy
4455d38a61 UPDATE: VERSION-20260317 2026-03-17 00:36:40 +08:00
libertyspy
6dd4392f0c UPDATE: VERSION-20260317 2026-03-17 00:36:16 +08:00
libertyspy
974f403784 UPDATE: VERSION-20260316 2026-03-16 22:43:12 +08:00
libertyspy
82bbfb83ca UPDATE: VERSION-20260316 2026-03-16 15:49:43 +08:00
libertyspy
fc7b5e6c63 Merge remote-tracking branch 'origin/master' 2026-03-16 15:48:53 +08:00
libertyspy
8dc867acb6 UPDATE: VERSION-20260316 2026-03-16 15:48:33 +08:00
libertyspy
c17197d6e5 UPDATE: VERSION-20260316 2026-03-16 15:48:23 +08:00
76022cf09a 修改xml 中的sql 解决,报错问题 2026-03-16 11:24:32 +08:00
MHW
4ff5bf500c Merge remote-tracking branch 'origin/master' 2026-03-16 10:47:48 +08:00
MHW
be417189e0 Merge branch 'refs/heads/develop' 2026-03-16 10:47:38 +08:00
MHW
a88d74ea1d 26-03-16-10:46 FireRuleMapper.xml文件名更正 2026-03-16 10:47:06 +08:00
libertyspy
c2bfb43d41 UPDATE: VERSION-20260315 2026-03-15 20:28:06 +08:00
libertyspy
c5d81a4c52 UPDATE: VERSION-20260315 2026-03-15 20:24:50 +08:00
libertyspy
6d76cb8d5e UPDATE: VERSION-20260315 2026-03-15 20:21:07 +08:00
libertyspy
b97837ec6a UPDATE: VERSION-20260315 2026-03-15 20:20:56 +08:00
libertyspy
f2e81c6e5c UPDATE: VERSION-20260315 2026-03-15 19:32:20 +08:00
libertyspy
83a38c6db8 UPDATE: VERSION-20260315 2026-03-15 16:36:07 +08:00
libertyspy
22e71a24d3 UPDATE: VERSION-20260315 2026-03-15 16:15:23 +08:00
libertyspy
6019738aca UPDATE: VERSION-20260314 2026-03-15 16:05:41 +08:00
MHW
7847dbc89f 26-03-15-09:53 火力规则模块:获取通信组件的所有平台和组件 增加返回平台description字段 2026-03-15 09:54:20 +08:00
MHW
cc01c9ece8 Merge remote-tracking branch 'origin/master' 2026-03-15 09:33:09 +08:00
MHW
8f29e230d0 Merge branch 'refs/heads/develop' 2026-03-15 09:32:14 +08:00
MHW
711d7bf3da 26-03-15-09:31 场景模块:分页查询所有场景,保存场景 2026-03-15 09:31:45 +08:00
libertyspy
29e17773af UPDATE: VERSION-20260314 2026-03-14 22:35:40 +08:00
libertyspy
db97d8a026 UPDATE: VERSION-20260314 2026-03-14 22:35:31 +08:00
libertyspy
2e55254412 UPDATE: VERSION-20260314 2026-03-14 22:35:21 +08:00
libertyspy
1504c3fc1b UPDATE: VERSION-20260314 2026-03-14 21:37:18 +08:00
libertyspy
0cf4c9b47e UPDATE: VERSION-20260314 2026-03-14 21:37:07 +08:00
libertyspy
fa0c93044c Merge remote-tracking branch 'origin/master' 2026-03-14 20:55:23 +08:00
libertyspy
33a77428db UPDATE: VERSION-20260314 2026-03-14 20:55:15 +08:00
MHW
26a89a66d1 Merge branch 'refs/heads/develop' 2026-03-14 20:47:07 +08:00
MHW
f72105134f 26-03-14-20:46 通过平台id获取平台下所有组件 2026-03-14 20:46:49 +08:00
libertyspy
2198e108a4 UPDATE: VERSION-20260314 2026-03-14 18:08:20 +08:00
libertyspy
fe94cec559 Merge remote-tracking branch 'origin/master' 2026-03-14 17:57:05 +08:00
MHW
af3a97175a Merge branch 'refs/heads/develop' 2026-03-14 14:31:12 +08:00
MHW
c1c67e826b 26-03-14-14:30 规则CRUD 2026-03-14 14:30:52 +08:00
MHW
8a946c4c84 Merge branch 'refs/heads/develop' 2026-03-14 11:18:23 +08:00
MHW
d9a55d0c95 26-03-14-11:17:行为树-保存场景配置 2026-03-14 11:17:55 +08:00
libertyspy
7b578f5d63 UPDATE: VERSION-20260313 2026-03-13 17:05:08 +08:00
MHW
dde470c9da 26-03-13-14:36:火力规则简单实现-删除重复模块 2026-03-13 14:52:29 +08:00
MHW
91adb9517e Merge remote-tracking branch 'origin/master'
# Conflicts:
#	auto-solution-admin/src/main/java/com/solution/web/controller/rule/RuleController.java
#	auto-solution-common/src/main/java/com/solution/common/constant/PlatformAndModuleConstants.java
#	pom.xml
2026-03-13 14:41:41 +08:00
MHW
99c100f2ac 26-03-13-14:36:火力规则简单实现 2026-03-13 14:36:31 +08:00
libertyspy
a2f2cbb185 UPDATE: VERSION-20260313 2026-03-13 10:51:19 +08:00
libertyspy
d96941ea9b UPDATE: VERSION-20260313 2026-03-13 10:45:46 +08:00
libertyspy
5a7b57d603 UPDATE: VERSION-20260313 2026-03-13 10:42:39 +08:00
libertyspy
27f8810401 Initial commit 2026-03-13 10:41:43 +08:00
libertyspy
4980ba2da4 Initial commit 2026-03-13 10:40:44 +08:00
libertyspy
3a086e9405 Initial commit 2026-03-13 10:15:14 +08:00
f2f8892276 Merge branch 'develop' 2026-03-12 16:04:39 +08:00
152a7b59af Merge branch 'liangyun' into develop 2026-03-12 16:04:30 +08:00
MHW
956d3f69ea 火力规则:返回平台以及组件 2026-03-12 16:01:04 +08:00
6fb020355b 配置前端动作分类 2026-03-12 10:16:56 +08:00
libertyspy
8b3fe9b548 UPDATE: fk 2026-02-09 21:05:07 +08:00
libertyspy
db30244cd1 Initial commit 2026-02-09 21:03:57 +08:00
libertyspy
c9bc62fb8c Initial commit 2026-02-09 20:10:24 +08:00
libertyspy
9d54395c29 Initial commit 2026-02-09 20:05:56 +08:00
libertyspy
35fd1c8937 Initial commit 2026-02-09 19:53:17 +08:00
libertyspy
579d0f2bd8 Initial commit 2026-02-09 15:35:20 +08:00
libertyspy
7f8abf2ff2 Initial commit 2026-02-09 15:26:21 +08:00
libertyspy
f1bcd3812d Initial commit 2026-02-09 15:06:04 +08:00
libertyspy
d3fda27bb0 Initial commit 2026-02-09 15:04:34 +08:00
libertyspy
538a43f597 Merge remote-tracking branch 'origin/master' 2026-02-09 14:53:43 +08:00
libertyspy
fcab8585c5 UPDATE: fk 2026-02-09 14:53:05 +08:00
libertyspy
0ffc42ab69 UPDATE: fk 2026-02-09 14:52:56 +08:00
libertyspy
46bead08a0 UPDATE: fk 2026-02-09 14:52:46 +08:00
zouju
e07b11ef95 修改部分规则代码 2026-02-09 11:15:26 +08:00
libertyspy
a78781782e Initial commit 2026-02-08 22:32:50 +08:00
libertyspy
0b55384442 Initial commit 2026-02-08 22:31:13 +08:00
libertyspy
43837901f3 Initial commit 2026-02-08 22:30:08 +08:00
libertyspy
8898cd2e6f Initial commit 2026-02-08 22:28:52 +08:00
libertyspy
f34274ea35 Initial commit 2026-02-08 22:16:22 +08:00
libertyspy
5ffdb5e508 Initial commit 2026-02-08 22:09:28 +08:00
libertyspy
a5a3c93135 UPDATE: fk 2026-02-08 21:50:56 +08:00
libertyspy
af697e9304 UPDATE: fk 2026-02-08 21:50:33 +08:00
libertyspy
e7abfca9f7 Initial commit 2026-02-08 21:36:39 +08:00
libertyspy
1058d666a0 Initial commit 2026-02-08 20:57:07 +08:00
libertyspy
58d36a3d6d Initial commit 2026-02-08 20:41:49 +08:00
libertyspy
b544391b5c Initial commit 2026-02-08 20:27:40 +08:00
libertyspy
e12c3c0302 UPDATE: fk 2026-02-08 20:14:46 +08:00
libertyspy
d8c429d000 UPDATE: fk 2026-02-08 20:14:07 +08:00
libertyspy
7909ea8acb UPDATE: fk 2026-02-08 18:51:18 +08:00
libertyspy
444c31612d Merge remote-tracking branch 'origin/master' 2026-02-08 18:50:38 +08:00
libertyspy
a3e34424d8 UPDATE: fk 2026-02-08 18:48:21 +08:00
libertyspy
76065ed5c4 Initial commit 2026-02-08 18:43:42 +08:00
libertyspy
70de3c68a8 Initial commit 2026-02-08 18:41:38 +08:00
libertyspy
3bb9178399 Initial commit 2026-02-08 18:05:48 +08:00
libertyspy
82fcedfa97 Initial commit 2026-02-08 17:57:40 +08:00
libertyspy
294e5d687e Initial commit 2026-02-08 17:11:03 +08:00
libertyspy
a246c88341 Initial commit 2026-02-08 16:44:50 +08:00
libertyspy
c9d5c38b52 Initial commit 2026-02-08 16:01:21 +08:00
libertyspy
9ded6b757c Initial commit 2026-02-08 15:59:14 +08:00
libertyspy
015030d650 Initial commit 2026-02-08 15:38:50 +08:00
libertyspy
b67f493678 UPDATE: fk 2026-02-08 15:38:32 +08:00
e3be036bd3 fix(behaviour): 修复行为树实例节点保存方法返回值类型
- 将返回类型从 Integer 改为 Long 以匹配实际数据类型
- 调整新增逻辑中的返回值,直接返回节点实例ID而不是插入操作的结果
- 统一更新逻辑的返回值处理方式
- 移动服务层调用顺序以确保正确的业务逻辑执行
2026-02-08 11:23:57 +08:00
0daa1c19cf Merge remote-tracking branch 'origin/master' 2026-02-07 19:37:10 +08:00
zouju
a440094138 修改部分规则模块删除无用前端 新增前端界面 2026-02-06 17:22:22 +08:00
766 changed files with 56088 additions and 26112 deletions

9
.dockerignore Normal file
View File

@@ -0,0 +1,9 @@
**/target/
**/.git/
**/.idea/
**/*.iml
**/.vscode/
**/node_modules/
**/*.log
**/.DS_Store
**/uploadPath/

15
.env.example Normal file
View 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

6
.gitignore vendored
View File

@@ -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

114
DEPLOY_OFFLINE.md Normal file
View 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
View 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"]

View File

@@ -70,6 +70,17 @@
<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>

View File

@@ -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));
}
}

View File

@@ -1,104 +0,0 @@
package com.solution.web.controller.algo;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.solution.common.annotation.Log;
import com.solution.common.core.controller.BaseController;
import com.solution.common.core.domain.AjaxResult;
import com.solution.common.enums.BusinessType;
import com.solution.algo.domain.SysAlgoConfig;
import com.solution.algo.service.ISysAlgoConfigService;
import com.solution.common.utils.poi.ExcelUtil;
import com.solution.common.core.page.TableDataInfo;
/**
* 动态规则配置Controller
*
* @author zouju
* @date 2026-02-05
*/
@RestController
@RequestMapping("/algo/algo")
public class SysAlgoConfigController extends BaseController
{
@Autowired
private ISysAlgoConfigService sysAlgoConfigService;
/**
* 查询动态规则配置列表
*/
@PreAuthorize("@ss.hasPermi('algo:algo:list')")
@GetMapping("/list")
public TableDataInfo list(SysAlgoConfig sysAlgoConfig)
{
startPage();
List<SysAlgoConfig> list = sysAlgoConfigService.selectSysAlgoConfigList(sysAlgoConfig);
return getDataTable(list);
}
/**
* 导出动态规则配置列表
*/
@PreAuthorize("@ss.hasPermi('algo:algo:export')")
@Log(title = "动态规则配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysAlgoConfig sysAlgoConfig)
{
List<SysAlgoConfig> list = sysAlgoConfigService.selectSysAlgoConfigList(sysAlgoConfig);
ExcelUtil<SysAlgoConfig> util = new ExcelUtil<SysAlgoConfig>(SysAlgoConfig.class);
util.exportExcel(response, list, "动态规则配置数据");
}
/**
* 获取动态规则配置详细信息
*/
@PreAuthorize("@ss.hasPermi('algo:algo:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sysAlgoConfigService.selectSysAlgoConfigById(id));
}
/**
* 新增动态规则配置
*/
@PreAuthorize("@ss.hasPermi('algo:algo:add')")
@Log(title = "动态规则配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysAlgoConfig sysAlgoConfig)
{
return toAjax(sysAlgoConfigService.insertSysAlgoConfig(sysAlgoConfig));
}
/**
* 修改动态规则配置
*/
@PreAuthorize("@ss.hasPermi('algo:algo:edit')")
@Log(title = "动态规则配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysAlgoConfig sysAlgoConfig)
{
return toAjax(sysAlgoConfigService.updateSysAlgoConfig(sysAlgoConfig));
}
/**
* 删除动态规则配置
*/
@PreAuthorize("@ss.hasPermi('algo:algo:remove')")
@Log(title = "动态规则配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysAlgoConfigService.deleteSysAlgoConfigByIds(ids));
}
}

View File

@@ -3,6 +3,7 @@ package com.solution.web.controller.behaviour;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.solution.web.core.BehaviortreeProcessor;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -32,12 +33,21 @@ import com.solution.common.core.page.TableDataInfo;
*/
@Api("行为树管理")
@RestController
@RequestMapping("/system/behaviortree")
@RequestMapping("/api/system/behaviortree")
public class BehaviortreeController extends BaseController
{
@Autowired
private IBehaviortreeService behaviortreeService;
@Autowired
private BehaviortreeProcessor behaviortreeProcessor;
@GetMapping(value = "/platform/{id}")
public AjaxResult fromPlatform(@PathVariable("id") Integer id)
{
return success(behaviortreeService.findOneByPlatformId(id));
}
/**
* 查询行为树主列表
*/
@@ -84,7 +94,20 @@ public class BehaviortreeController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody Behaviortree behaviortree)
{
return toAjax(behaviortreeService.insertBehaviortree(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));
}
/**
@@ -96,7 +119,7 @@ public class BehaviortreeController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody Behaviortree behaviortree)
{
return toAjax(behaviortreeService.updateBehaviortree(behaviortree));
return toAjax(behaviortreeProcessor.update(behaviortree));
}
/**
@@ -110,4 +133,19 @@ public class BehaviortreeController extends BaseController
{
return toAjax(behaviortreeService.deleteBehaviortreeByIds(ids));
}
/**
* 根据行为树id获取该行为树的下属
* @param treeId
* @return
*/
@ApiOperation("根据行为树id获取该行为树的下属")
@PreAuthorize("@ss.hasPermi('system:behaviortree:query')")
@GetMapping("/underling/{treeId}")
public AjaxResult getUnderling(@PathVariable Integer treeId)
{
return success(behaviortreeService.getUnderling(treeId));
}
}

View File

@@ -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());
}
}

View File

@@ -32,7 +32,7 @@ import com.solution.common.core.page.TableDataInfo;
*/
@Api("节点连接管理")
@RestController
@RequestMapping("/system/nodeconnection")
@RequestMapping("/api/system/nodeconnection")
public class NodeconnectionController extends BaseController
{
@Autowired

View File

@@ -32,7 +32,7 @@ import com.solution.common.core.page.TableDataInfo;
*/
@Api("节点参数管理")
@RestController
@RequestMapping("/system/nodeparameter")
@RequestMapping("/api/system/nodeparameter")
public class NodeparameterController extends BaseController
{
@Autowired

View File

@@ -7,6 +7,11 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.solution.common.core.domain.R;
import com.solution.system.domain.NodeTemplateEntity;
import com.solution.system.domain.Nodeparameter;
import com.solution.system.domain.Templateparameterdef;
import com.solution.system.service.INodeparameterService;
import com.solution.system.service.ITemplateparameterdefService;
import com.solution.web.controller.behaviour.vo.NodetemplateDTO;
import com.solution.web.controller.behaviour.vo.NodetemplateVO;
import io.swagger.annotations.Api;
@@ -14,6 +19,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@@ -39,11 +45,17 @@ import com.solution.common.core.page.TableDataInfo;
*/
@Api("节点模板管理")
@RestController
@RequestMapping("/system/nodetemplate")
@RequestMapping("/api/system/nodetemplate")
public class NodetemplateController extends BaseController {
@Autowired
private INodetemplateService nodetemplateService;
@Autowired
private INodeparameterService nodeparameterService;
@Autowired
private ITemplateparameterdefService templateparameterdefService;
/**
* 查询节点模板列表
*/
@@ -55,10 +67,29 @@ public class NodetemplateController extends BaseController {
return getDataTable(list);
}
@ApiOperation("节点模板列表")
@PreAuthorize("@ss.hasPermi('system:nodetemplate:all')")
@GetMapping("/all")
public R<List<NodeTemplateEntity>> all() {
Nodetemplate nodetemplate = new Nodetemplate();
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
if (CollectionUtils.isEmpty(list)) {
return R.ok(null);
}
List<NodeTemplateEntity> entities = new ArrayList<>();
for (Nodetemplate template : list) {
Templateparameterdef def = new Templateparameterdef();
def.setTemplateId(template.getId());
List<Templateparameterdef> parameters = templateparameterdefService.selectTemplateparameterdefList(def);
entities.add(new NodeTemplateEntity(template, parameters));
}
return R.ok(entities);
}
@ApiOperation("节点模板列表")
@PreAuthorize("@ss.hasPermi('system:nodetemplate:list')")
@GetMapping("/listAll")
public R<List<NodetemplateVO>> listAll() {
public R<List<Nodetemplate>> listAll() {
Nodetemplate nodetemplate = new Nodetemplate();
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
if (CollectionUtils.isEmpty(list)) {
@@ -72,18 +103,19 @@ public class NodetemplateController extends BaseController {
dto.setDescription(template.getDescription());
dto.setEnglishName(template.getEnglishName());
dto.setLogicHandler(template.getLogicHandler());
dto.setTemplateType(template.getTemplateType());
return dto;
})
.collect(Collectors.groupingBy(NodetemplateDTO::getTempleteType));
.collect(Collectors.groupingBy(NodetemplateDTO::getTemplateType));
List<NodetemplateVO> vos = new ArrayList<>();
groupedByTemplateType.forEach((key, value) -> {
// 处理逻辑
NodetemplateVO vo = new NodetemplateVO();
vo.setTempleteType(key);
vo.setTemplateType(key);
vo.setDtoList(value);
vos.add(vo);
});
return R.ok(vos);
return R.ok(list);
}
/**

View File

@@ -28,7 +28,7 @@ import com.solution.common.core.page.TableDataInfo;
* @date 2026-02-05
*/
@RestController
@RequestMapping("/system/templateparameterdef")
@RequestMapping("/api/system/templateparameterdef")
public class TemplateparameterdefController extends BaseController
{
@Autowired

View File

@@ -48,7 +48,7 @@ import com.solution.common.core.page.TableDataInfo;
*/
@Api("行为树实例节点管理")
@RestController
@RequestMapping("/system/treenodeinstance")
@RequestMapping("/api/system/treenodeinstance")
public class TreenodeinstanceController extends BaseController {
@Autowired
private ITreenodeinstanceService treenodeinstanceService;
@@ -141,14 +141,15 @@ public class TreenodeinstanceController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:add')")
@Log(title = "行为树实例节点", businessType = BusinessType.INSERT)
@PostMapping("/saveOrUpdate")
public R<Integer> saveOrUpdate(@RequestBody Treenodeinstance treenodeinstance) {
public R<Long> saveOrUpdate(@RequestBody Treenodeinstance treenodeinstance) {
if (null == treenodeinstance.getId()) {
//新增
treenodeinstanceService.insertTreenodeinstance(treenodeinstance);
Templateparameterdef templateparameterdef = new Templateparameterdef();
templateparameterdef.setTemplateId(treenodeinstance.getTemplateId());
List<Templateparameterdef> templateparameterdefs = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
if (CollectionUtils.isEmpty(templateparameterdefs)) {
return R.ok(treenodeinstanceService.insertTreenodeinstance(treenodeinstance));
return R.ok(treenodeinstance.getId());
}
templateparameterdefs.forEach(t -> {
Nodeparameter nodeparameter = new Nodeparameter();
@@ -158,7 +159,8 @@ public class TreenodeinstanceController extends BaseController {
nodeparameterService.insertNodeparameter(nodeparameter);
});
}
return R.ok(treenodeinstanceService.updateTreenodeinstance(treenodeinstance));
treenodeinstanceService.updateTreenodeinstance(treenodeinstance);
return R.ok(treenodeinstance.getId());
}
/**

View File

@@ -23,7 +23,7 @@ public class NodetemplateDTO {
@ApiModelProperty("afsim 中转换的节点名")
private String englishName;
private String templeteType;
private String templateType;
public Long getId() {
return id;
@@ -65,11 +65,11 @@ public class NodetemplateDTO {
this.englishName = englishName;
}
public String getTempleteType() {
return templeteType;
public String getTemplateType() {
return templateType;
}
public void setTempleteType(String templeteType) {
this.templeteType = templeteType;
public void setTemplateType(String templateType) {
this.templateType = templateType;
}
}

View File

@@ -9,17 +9,17 @@ import java.util.List;
public class NodetemplateVO {
/** 模版类型节点模版或者条件判断例如“node”precondition“ */
@ApiModelProperty("模版类型节点模版或者条件判断例如“node”precondition“")
private String templeteType;
private String templateType;
@ApiModelProperty("节点模板数据")
private List<NodetemplateDTO> dtoList;
public String getTempleteType() {
return templeteType;
public String getTemplateType() {
return templateType;
}
public void setTempleteType(String templeteType) {
this.templeteType = templeteType;
public void setTemplateType(String templateType) {
this.templateType = templateType;
}
public List<NodetemplateDTO> getDtoList() {

View File

@@ -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));
}
}

View File

@@ -0,0 +1,65 @@
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.service.IRuleService;
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;
@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));
}
}

View File

@@ -0,0 +1,67 @@
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));
}
}

View File

@@ -0,0 +1,249 @@
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);
return this.create(behaviortree);
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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}

View File

@@ -6,9 +6,11 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.166.71:3306/behaviortreedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.166.71:3306/behaviortreedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3306/autosolution_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
# password: 123456
password: 1234
# 从库数据源
slave:
# 从数据源开关/默认关闭

View File

@@ -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:

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View File

@@ -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;
}
}

View File

@@ -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();
}
}

View File

@@ -1,176 +0,0 @@
package com.solution.algo.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.solution.common.annotation.Excel;
import com.solution.common.core.domain.BaseEntity;
/**
* 动态规则配置对象 sys_algo_config
*
* @author zouju
* @date 2026-02-05
*/
public class SysAlgoConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 算法唯一标识(Type),用于接口路由 */
@Excel(name = "算法唯一标识(Type),用于接口路由")
private String algoType;
/** 算法名称,后台展示用 */
@Excel(name = "算法名称,后台展示用")
private String algoName;
/** 执行引擎类型: GROOVY, PYTHON, JS, LUA等 */
@Excel(name = "执行引擎类型: GROOVY, PYTHON, JS, LUA等")
private String engineType;
/** 参数定义模型(JSON Schema),用于自动校验入参 */
@Excel(name = "参数定义模型(JSON Schema),用于自动校验入参")
private String inputSchema;
/** 算法脚本代码或规则表达式 */
@Excel(name = "算法脚本代码或规则表达式")
private String scriptContent;
/** 算法描述 */
@Excel(name = "算法描述")
private String description;
/** 状态: 1-启用, 0-禁用 */
@Excel(name = "状态: 1-启用, 0-禁用")
private Long status;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setAlgoType(String algoType)
{
this.algoType = algoType;
}
public String getAlgoType()
{
return algoType;
}
public void setAlgoName(String algoName)
{
this.algoName = algoName;
}
public String getAlgoName()
{
return algoName;
}
public void setEngineType(String engineType)
{
this.engineType = engineType;
}
public String getEngineType()
{
return engineType;
}
public void setInputSchema(String inputSchema)
{
this.inputSchema = inputSchema;
}
public String getInputSchema()
{
return inputSchema;
}
public void setScriptContent(String scriptContent)
{
this.scriptContent = scriptContent;
}
public String getScriptContent()
{
return scriptContent;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("algoType", getAlgoType())
.append("algoName", getAlgoName())
.append("engineType", getEngineType())
.append("inputSchema", getInputSchema())
.append("scriptContent", getScriptContent())
.append("description", getDescription())
.append("status", getStatus())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
}
}

View File

@@ -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);
}

View File

@@ -1,61 +0,0 @@
package com.solution.algo.mapper;
import java.util.List;
import com.solution.algo.domain.SysAlgoConfig;
/**
* 动态规则配置Mapper接口
*
* @author zouju
* @date 2026-02-05
*/
public interface SysAlgoConfigMapper
{
/**
* 查询动态规则配置
*
* @param id 动态规则配置主键
* @return 动态规则配置
*/
public SysAlgoConfig selectSysAlgoConfigById(Long id);
/**
* 查询动态规则配置列表
*
* @param sysAlgoConfig 动态规则配置
* @return 动态规则配置集合
*/
public List<SysAlgoConfig> selectSysAlgoConfigList(SysAlgoConfig sysAlgoConfig);
/**
* 新增动态规则配置
*
* @param sysAlgoConfig 动态规则配置
* @return 结果
*/
public int insertSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
/**
* 修改动态规则配置
*
* @param sysAlgoConfig 动态规则配置
* @return 结果
*/
public int updateSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
/**
* 删除动态规则配置
*
* @param id 动态规则配置主键
* @return 结果
*/
public int deleteSysAlgoConfigById(Long id);
/**
* 批量删除动态规则配置
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSysAlgoConfigByIds(Long[] ids);
}

View File

@@ -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);
}

View File

@@ -1,61 +0,0 @@
package com.solution.algo.service;
import java.util.List;
import com.solution.algo.domain.SysAlgoConfig;
/**
* 动态规则配置Service接口
*
* @author zouju
* @date 2026-02-05
*/
public interface ISysAlgoConfigService
{
/**
* 查询动态规则配置
*
* @param id 动态规则配置主键
* @return 动态规则配置
*/
public SysAlgoConfig selectSysAlgoConfigById(Long id);
/**
* 查询动态规则配置列表
*
* @param sysAlgoConfig 动态规则配置
* @return 动态规则配置集合
*/
public List<SysAlgoConfig> selectSysAlgoConfigList(SysAlgoConfig sysAlgoConfig);
/**
* 新增动态规则配置
*
* @param sysAlgoConfig 动态规则配置
* @return 结果
*/
public int insertSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
/**
* 修改动态规则配置
*
* @param sysAlgoConfig 动态规则配置
* @return 结果
*/
public int updateSysAlgoConfig(SysAlgoConfig sysAlgoConfig);
/**
* 批量删除动态规则配置
*
* @param ids 需要删除的动态规则配置主键集合
* @return 结果
*/
public int deleteSysAlgoConfigByIds(Long[] ids);
/**
* 删除动态规则配置信息
*
* @param id 动态规则配置主键
* @return 结果
*/
public int deleteSysAlgoConfigById(Long id);
}

View File

@@ -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);
}
}
}
}

View File

@@ -1,93 +0,0 @@
package com.solution.algo.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.solution.algo.mapper.SysAlgoConfigMapper;
import com.solution.algo.domain.SysAlgoConfig;
import com.solution.algo.service.ISysAlgoConfigService;
/**
* 动态规则配置Service业务层处理
*
* @author zouju
* @date 2026-02-05
*/
@Service
public class SysAlgoConfigServiceImpl implements ISysAlgoConfigService
{
@Autowired
private SysAlgoConfigMapper sysAlgoConfigMapper;
/**
* 查询动态规则配置
*
* @param id 动态规则配置主键
* @return 动态规则配置
*/
@Override
public SysAlgoConfig selectSysAlgoConfigById(Long id)
{
return sysAlgoConfigMapper.selectSysAlgoConfigById(id);
}
/**
* 查询动态规则配置列表
*
* @param sysAlgoConfig 动态规则配置
* @return 动态规则配置
*/
@Override
public List<SysAlgoConfig> selectSysAlgoConfigList(SysAlgoConfig sysAlgoConfig)
{
return sysAlgoConfigMapper.selectSysAlgoConfigList(sysAlgoConfig);
}
/**
* 新增动态规则配置
*
* @param sysAlgoConfig 动态规则配置
* @return 结果
*/
@Override
public int insertSysAlgoConfig(SysAlgoConfig sysAlgoConfig)
{
return sysAlgoConfigMapper.insertSysAlgoConfig(sysAlgoConfig);
}
/**
* 修改动态规则配置
*
* @param sysAlgoConfig 动态规则配置
* @return 结果
*/
@Override
public int updateSysAlgoConfig(SysAlgoConfig sysAlgoConfig)
{
return sysAlgoConfigMapper.updateSysAlgoConfig(sysAlgoConfig);
}
/**
* 批量删除动态规则配置
*
* @param ids 需要删除的动态规则配置主键
* @return 结果
*/
@Override
public int deleteSysAlgoConfigByIds(Long[] ids)
{
return sysAlgoConfigMapper.deleteSysAlgoConfigByIds(ids);
}
/**
* 删除动态规则配置信息
*
* @param id 动态规则配置主键
* @return 结果
*/
@Override
public int deleteSysAlgoConfigById(Long id)
{
return sysAlgoConfigMapper.deleteSysAlgoConfigById(id);
}
}

View File

@@ -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>

View File

@@ -1,96 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.solution.algo.mapper.SysAlgoConfigMapper">
<resultMap type="SysAlgoConfig" id="SysAlgoConfigResult">
<result property="id" column="id" />
<result property="algoType" column="algo_type" />
<result property="algoName" column="algo_name" />
<result property="engineType" column="engine_type" />
<result property="inputSchema" column="input_schema" />
<result property="scriptContent" column="script_content" />
<result property="description" column="description" />
<result property="status" column="status" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectSysAlgoConfigVo">
select id, algo_type, algo_name, engine_type, input_schema, script_content, description, status, created_at, updated_at from sys_algo_config
</sql>
<select id="selectSysAlgoConfigList" parameterType="SysAlgoConfig" resultMap="SysAlgoConfigResult">
<include refid="selectSysAlgoConfigVo"/>
<where>
<if test="algoType != null and algoType != ''"> and algo_type = #{algoType}</if>
<if test="algoName != null and algoName != ''"> and algo_name like concat('%', #{algoName}, '%')</if>
<if test="engineType != null and engineType != ''"> and engine_type = #{engineType}</if>
<if test="inputSchema != null and inputSchema != ''"> and input_schema = #{inputSchema}</if>
<if test="scriptContent != null and scriptContent != ''"> and script_content = #{scriptContent}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="status != null "> and status = #{status}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
</where>
</select>
<select id="selectSysAlgoConfigById" parameterType="Long" resultMap="SysAlgoConfigResult">
<include refid="selectSysAlgoConfigVo"/>
where id = #{id}
</select>
<insert id="insertSysAlgoConfig" parameterType="SysAlgoConfig" useGeneratedKeys="true" keyProperty="id">
insert into sys_algo_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="algoType != null and algoType != ''">algo_type,</if>
<if test="algoName != null and algoName != ''">algo_name,</if>
<if test="engineType != null and engineType != ''">engine_type,</if>
<if test="inputSchema != null">input_schema,</if>
<if test="scriptContent != null">script_content,</if>
<if test="description != null">description,</if>
<if test="status != null">status,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="algoType != null and algoType != ''">#{algoType},</if>
<if test="algoName != null and algoName != ''">#{algoName},</if>
<if test="engineType != null and engineType != ''">#{engineType},</if>
<if test="inputSchema != null">#{inputSchema},</if>
<if test="scriptContent != null">#{scriptContent},</if>
<if test="description != null">#{description},</if>
<if test="status != null">#{status},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
</trim>
</insert>
<update id="updateSysAlgoConfig" parameterType="SysAlgoConfig">
update sys_algo_config
<trim prefix="SET" suffixOverrides=",">
<if test="algoType != null and algoType != ''">algo_type = #{algoType},</if>
<if test="algoName != null and algoName != ''">algo_name = #{algoName},</if>
<if test="engineType != null and engineType != ''">engine_type = #{engineType},</if>
<if test="inputSchema != null">input_schema = #{inputSchema},</if>
<if test="scriptContent != null">script_content = #{scriptContent},</if>
<if test="description != null">description = #{description},</if>
<if test="status != null">status = #{status},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysAlgoConfigById" parameterType="Long">
delete from sys_algo_config where id = #{id}
</delete>
<delete id="deleteSysAlgoConfigByIds" parameterType="String">
delete from sys_algo_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -46,7 +46,29 @@ public class Behaviortree extends BaseEntity
@Excel(name = "储存行为树的节点关系图")
private String xmlContent;
public void setId(Long id)
@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;
}
@@ -118,14 +140,15 @@ public class Behaviortree extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("description", getDescription())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.append("englishName", getEnglishName())
.append("xmlContent", getXmlContent())
.toString();
return "Behaviortree{" +
"id=" + id +
", name='" + name + '\'' +
", description='" + description + '\'' +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
", englishName='" + englishName + '\'' +
", xmlContent='" + xmlContent + '\'' +
", platformId=" + platformId +
'}';
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -18,6 +18,8 @@ public class Nodeconnection extends BaseEntity
/** 连接ID (主键) */
private Long id;
private Long treeId;
/** 父节点 (外键: TreeInstanceNode.id) */
@Excel(name = "父节点 (外键: TreeInstanceNode.id)")
private Long parentNodeId;
@@ -40,7 +42,15 @@ public class Nodeconnection extends BaseEntity
return id;
}
public void setParentNodeId(Long parentNodeId)
public Long getTreeId() {
return treeId;
}
public void setTreeId(Long treeId) {
this.treeId = treeId;
}
public void setParentNodeId(Long parentNodeId)
{
this.parentNodeId = parentNodeId;
}

View File

@@ -18,6 +18,8 @@ public class Nodeparameter extends BaseEntity
/** 节点参数ID (主键) */
private Long id;
private Long treeId;
/** 关联到哪个节点实例 (外键: TreeInstanceNode.id) */
@Excel(name = "关联到哪个节点实例 (外键: TreeInstanceNode.id)")
private Long nodeInstanceId;
@@ -30,6 +32,8 @@ public class Nodeparameter extends BaseEntity
@Excel(name = "节点实例设置的具体参数值 (覆盖模板默认值)")
private String value;
private int groupIndex;
public void setId(Long id)
{
this.id = id;
@@ -40,7 +44,15 @@ public class Nodeparameter extends BaseEntity
return id;
}
public void setNodeInstanceId(Long nodeInstanceId)
public Long getTreeId() {
return treeId;
}
public void setTreeId(Long treeId) {
this.treeId = treeId;
}
public void setNodeInstanceId(Long nodeInstanceId)
{
this.nodeInstanceId = nodeInstanceId;
}
@@ -70,6 +82,14 @@ public class Nodeparameter extends BaseEntity
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)

View File

@@ -40,9 +40,25 @@ public class Nodetemplate extends BaseEntity
/** 模版类型节点模版或者条件判断例如“node”precondition“ */
@Excel(name = "模版类型节点模版或者条件判断例如“node”precondition“")
private String templeteType;
private String templateType;
public void setId(Long id)
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;
}
@@ -102,14 +118,22 @@ public class Nodetemplate extends BaseEntity
return englishName;
}
public void setTempleteType(String templeteType)
public void setTemplateType(String templateType)
{
this.templeteType = templeteType;
this.templateType = templateType;
}
public String getTempleteType()
public String getTemplateType()
{
return templeteType;
return templateType;
}
public boolean isMultiable() {
return multiable;
}
public void setMultiable(boolean multiable) {
this.multiable = multiable;
}
@Override
@@ -121,7 +145,7 @@ public class Nodetemplate extends BaseEntity
.append("logicHandler", getLogicHandler())
.append("description", getDescription())
.append("englishName", getEnglishName())
.append("templeteType", getTempleteType())
.append("templateType", getTemplateType())
.toString();
}
}

View File

@@ -0,0 +1,40 @@
package com.solution.system.domain;
import lombok.Data;
/**
* 平台通信关系表
*/
@Data
public class PlatformCommunication {
/**
* 主键ID
*/
private Integer id;
/**
* 指挥平台名称/ID
*/
private String commandPlatform;
/**
* 下属平台名称/ID
*/
private String subordinatePlatform;
/**
* 指挥通信方式/内容
*/
private String commandComm;
/**
* 下属通信方式/内容
*/
private String subordinateComm;
/**
* 想定ID
*/
private Integer scenaryId;
}

View File

@@ -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;
}

View File

@@ -42,6 +42,8 @@ public class Templateparameterdef extends BaseEntity
@Excel(name = "判断参数模版是节点的参数模版还是条件的参数模版")
private String templateType;
private int groupIndex;
public void setId(Long id)
{
this.id = id;
@@ -112,6 +114,14 @@ public class Templateparameterdef extends BaseEntity
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)

View File

@@ -1,6 +1,7 @@
package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Behaviortree;
/**
@@ -11,6 +12,9 @@ import com.solution.system.domain.Behaviortree;
*/
public interface BehaviortreeMapper
{
Behaviortree findOneByPlatformId(Integer platformId);
/**
* 查询行为树主
*

View File

@@ -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();
}

View File

@@ -2,6 +2,7 @@ package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Nodeconnection;
import org.apache.ibatis.annotations.Param;
/**
* 节点连接Mapper接口
@@ -11,6 +12,8 @@ import com.solution.system.domain.Nodeconnection;
*/
public interface NodeconnectionMapper
{
void deleteByTreeId(@Param("treeId") Long treeId);
/**
* 查询节点连接
*

View File

@@ -2,6 +2,7 @@ package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Nodeparameter;
import org.apache.ibatis.annotations.Param;
/**
* 节点参数Mapper接口
@@ -11,6 +12,8 @@ import com.solution.system.domain.Nodeparameter;
*/
public interface NodeparameterMapper
{
void deleteByTreeId(@Param("treeId") Long treeId);
/**
* 查询节点参数
*

View File

@@ -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);
}

View File

@@ -0,0 +1,24 @@
package com.solution.system.mapper;
import com.solution.system.domain.PlatformTree;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface PlatformMapper {
/**
* 根据行为树id获取行为树所属平台
* @param id
* @return
*/
PlatformTree getPlatformByTreeId(Integer id);
/**
* 根据下属平台英文名获取中文名返回
* @param underlingEnglishName
* @return
*/
List<String> selectPlatformChineseName(List<String> underlingEnglishName);
}

View File

@@ -2,6 +2,7 @@ package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Treenodeinstance;
import org.apache.ibatis.annotations.Param;
/**
* 行为树实例节点Mapper接口
@@ -11,6 +12,8 @@ import com.solution.system.domain.Treenodeinstance;
*/
public interface TreenodeinstanceMapper
{
void deleteByTreeId(@Param(value = "treeId") Long treeId);
/**
* 查询行为树实例节点
*

View File

@@ -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();
}

View File

@@ -1,6 +1,7 @@
package com.solution.system.service;
import java.util.List;
import com.solution.system.domain.Behaviortree;
/**
@@ -11,6 +12,9 @@ import com.solution.system.domain.Behaviortree;
*/
public interface IBehaviortreeService
{
Behaviortree findOneByPlatformId(Integer platformId);
/**
* 查询行为树主
*
@@ -58,4 +62,11 @@ public interface IBehaviortreeService
* @return 结果
*/
public int deleteBehaviortreeById(Long id);
/**
* 根据行为树id获取该行为树的下属
* @param treeId
* @return
*/
List<String> getUnderling(Integer treeId);
}

View File

@@ -2,6 +2,7 @@ package com.solution.system.service;
import java.util.List;
import com.solution.system.domain.Nodeconnection;
import org.apache.ibatis.annotations.Param;
/**
* 节点连接Service接口
@@ -11,6 +12,9 @@ import com.solution.system.domain.Nodeconnection;
*/
public interface INodeconnectionService
{
void deleteByTreeId(@Param("treeId") Long treeId);
/**
* 查询节点连接
*

View File

@@ -11,6 +11,9 @@ import com.solution.system.domain.Nodeparameter;
*/
public interface INodeparameterService
{
void deleteByTreeId(Long treeId);
/**
* 查询节点参数
*

View File

@@ -11,6 +11,9 @@ import com.solution.system.domain.Treenodeinstance;
*/
public interface ITreenodeinstanceService
{
void deleteByTreeId(Long treeId);
/**
* 查询行为树实例节点
*

View File

@@ -1,6 +1,13 @@
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.PlatformTree;
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;
@@ -19,6 +26,18 @@ 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);
}
/**
* 查询行为树主
*
@@ -90,4 +109,30 @@ public class BehaviortreeServiceImpl implements IBehaviortreeService
{
return behaviortreeMapper.deleteBehaviortreeById(id);
}
/**
* 根据行为树id获取该行为树的下属
* @param treeId
* @return
*/
@Override
public List<String> getUnderling(Integer treeId) {
if(null == treeId){
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
}
Behaviortree behaviortree = behaviortreeMapper.selectBehaviortreeById(Long.valueOf(treeId));
if(ObjectUtil.isEmpty(behaviortree) || null == behaviortree.getId()){
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
}
//根据行为树id获取行为树所属平台
PlatformTree platform = platformMapper.getPlatformByTreeId(behaviortree.getPlatformId());
//根据平台name获取平台下属英文名
List<String> underlingEnglishName = platformCommunicationMapper.getUnderlingBytreeId(platform.getName());
//根据下属平台英文名获取中文名返回
List<String> underlingChineseName = platformMapper.selectPlatformChineseName(underlingEnglishName);
if(CollUtil.isEmpty(underlingChineseName)){
throw new RuntimeException("该平台暂无下属");
}
return underlingChineseName;
}
}

View File

@@ -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();
}
}

View File

@@ -19,6 +19,11 @@ public class NodeconnectionServiceImpl implements INodeconnectionService
@Autowired
private NodeconnectionMapper nodeconnectionMapper;
@Override
public void deleteByTreeId(Long treeId) {
nodeconnectionMapper.deleteByTreeId(treeId);
}
/**
* 查询节点连接
*

View File

@@ -19,6 +19,11 @@ public class NodeparameterServiceImpl implements INodeparameterService
@Autowired
private NodeparameterMapper nodeparameterMapper;
@Override
public void deleteByTreeId(Long treeId) {
nodeparameterMapper.deleteByTreeId(treeId);
}
/**
* 查询节点参数
*

View File

@@ -19,6 +19,11 @@ public class TreenodeinstanceServiceImpl implements ITreenodeinstanceService
@Autowired
private TreenodeinstanceMapper treenodeinstanceMapper;
@Override
public void deleteByTreeId(Long treeId) {
treenodeinstanceMapper.deleteByTreeId(treeId);
}
/**
* 查询行为树实例节点
*

View File

@@ -5,15 +5,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="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 from behaviortree
</sql>
@@ -31,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectBehaviortreeById" parameterType="Long" resultMap="BehaviortreeResult">
<include refid="selectBehaviortreeVo"/>
select id, name, description, created_at, updated_at, english_name,graph, xml_content ,platform_id, scenario_id from behaviortree
where id = #{id}
</select>
@@ -44,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>
@@ -52,9 +61,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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=",">

View File

@@ -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>

View File

@@ -6,18 +6,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="Nodeconnection" id="NodeconnectionResult">
<result property="id" column="id" />
<result property="treeId" column="tree_id" />
<result property="parentNodeId" column="parent_node_id" />
<result property="childNodeId" column="child_node_id" />
<result property="orderIndex" column="order_index" />
</resultMap>
<delete id="deleteByTreeId">
delete from nodeconnection where tree_id=#{treeId}
</delete>
<sql id="selectNodeconnectionVo">
select id, parent_node_id, child_node_id, order_index from nodeconnection
select id, tree_id, parent_node_id, child_node_id, order_index from nodeconnection
</sql>
<select id="selectNodeconnectionList" parameterType="Nodeconnection" resultMap="NodeconnectionResult">
<include refid="selectNodeconnectionVo"/>
<where>
<where>
<if test="treeId != null "> and tree_id = #{treeId}</if>
<if test="parentNodeId != null "> and parent_node_id = #{parentNodeId}</if>
<if test="childNodeId != null "> and child_node_id = #{childNodeId}</if>
<if test="orderIndex != null "> and order_index = #{orderIndex}</if>
@@ -32,11 +38,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertNodeconnection" parameterType="Nodeconnection" useGeneratedKeys="true" keyProperty="id">
insert into nodeconnection
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="treeId != null">tree_id,</if>
<if test="parentNodeId != null">parent_node_id,</if>
<if test="childNodeId != null">child_node_id,</if>
<if test="orderIndex != null">order_index,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="treeId != null">#{treeId},</if>
<if test="parentNodeId != null">#{parentNodeId},</if>
<if test="childNodeId != null">#{childNodeId},</if>
<if test="orderIndex != null">#{orderIndex},</if>
@@ -46,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateNodeconnection" parameterType="Nodeconnection">
update nodeconnection
<trim prefix="SET" suffixOverrides=",">
<if test="treeId != null">tree_id = #{treeId},</if>
<if test="parentNodeId != null">parent_node_id = #{parentNodeId},</if>
<if test="childNodeId != null">child_node_id = #{childNodeId},</if>
<if test="orderIndex != null">order_index = #{orderIndex},</if>

View File

@@ -6,13 +6,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="Nodeparameter" id="NodeparameterResult">
<result property="id" column="id" />
<result property="treeId" column="tree_id" />
<result property="nodeInstanceId" column="node_instance_id" />
<result property="paramDefId" column="param_def_id" />
<result property="value" column="value" />
<result property="groupIndex" column="group_index" />
</resultMap>
<delete id="deleteByTreeId">
delete from nodeparameter where tree_id=#{treeId}
</delete>
<sql id="selectNodeparameterVo">
select id, node_instance_id, param_def_id, value from nodeparameter
select id, treeId, node_instance_id, param_def_id,`value`, group_index from nodeparameter
</sql>
<select id="selectNodeparameterList" parameterType="Nodeparameter" resultMap="NodeparameterResult">
@@ -32,23 +38,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertNodeparameter" parameterType="Nodeparameter" useGeneratedKeys="true" keyProperty="id">
insert into nodeparameter
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="treeId != null">tree_id,</if>
<if test="nodeInstanceId != null">node_instance_id,</if>
<if test="paramDefId != null">param_def_id,</if>
<if test="value != null">value,</if>
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>

View File

@@ -11,11 +11,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="logicHandler" column="logic_handler" />
<result property="description" column="description" />
<result property="englishName" column="english_name" />
<result property="templeteType" column="templete_type" />
<result property="templateType" column="templete_type" />
<result property="multiable" column="is_multiable" />
</resultMap>
<sql id="selectNodetemplateVo">
select id, type, name, logic_handler, description, english_name, templete_type from nodetemplate
select id, type, name, logic_handler, description, english_name, templete_type, is_multiable from nodetemplate
</sql>
<select id="selectNodetemplateList" parameterType="Nodetemplate" resultMap="NodetemplateResult">
@@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="logicHandler != null and logicHandler != ''"> and logic_handler = #{logicHandler}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="englishName != null and englishName != ''"> and english_name like concat('%', #{englishName}, '%')</if>
<if test="templeteType != null and templeteType != ''"> and templete_type = #{templeteType}</if>
<if test="templateType != null and templateType != ''"> and templete_type = #{templateType}</if>
</where>
</select>
@@ -43,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="logicHandler != null">logic_handler,</if>
<if test="description != null">description,</if>
<if test="englishName != null">english_name,</if>
<if test="templeteType != null and templeteType != ''">templete_type,</if>
<if test="templateType != null and templateType != ''">templete_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null and type != ''">#{type},</if>
@@ -51,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="logicHandler != null">#{logicHandler},</if>
<if test="description != null">#{description},</if>
<if test="englishName != null">#{englishName},</if>
<if test="templeteType != null and templeteType != ''">#{templeteType},</if>
<if test="templateType != null and templateType != ''">#{templateType},</if>
</trim>
</insert>
@@ -63,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="logicHandler != null">logic_handler = #{logicHandler},</if>
<if test="description != null">description = #{description},</if>
<if test="englishName != null">english_name = #{englishName},</if>
<if test="templeteType != null and templeteType != ''">templete_type = #{templeteType},</if>
<if test="templateType != null and templateType != ''">templete_type = #{templateType},</if>
</trim>
where id = #{id}
</update>

View File

@@ -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.Integer">
SELECT subordinate_platform
FROM platform_communication
WHERE subordinate_platform = #{name}
</select>
</mapper>

View File

@@ -0,0 +1,23 @@
<?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="getPlatformByTreeId" resultType="com.solution.system.domain.PlatformTree"
parameterType="java.lang.Integer">
SELECT id , name , description, scenario_id
FROM platform
WHERE id = #{id}
</select>
<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>
</mapper>

View File

@@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, template_id, param_key, data_type, default_value, description, template_type from templateparameterdef
</sql>
<select id="selectTemplateparameterdefList" parameterType="Templateparameterdef" resultMap="TemplateparameterdefResult">
<select id="selectTemplateparameterdefList" parameterType="templateparameterdef" resultMap="TemplateparameterdefResult">
<include refid="selectTemplateparameterdefVo"/>
<where>
<if test="templateId != null "> and template_id = #{templateId}</if>

View File

@@ -15,6 +15,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="desciption" column="desciption" />
</resultMap>
<delete id="deleteByTreeId">
delete from treenodeinstance where tree_id=#{treeId}
</delete>
<sql id="selectTreenodeinstanceVo">
select id, tree_id, template_id, instance_name, is_root, precondition_templete_id, uuid,desciption from treenodeinstance
</sql>

View File

@@ -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>

View File

@@ -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 = "场景配置不能为空";
}

View File

@@ -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";
}

View File

@@ -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);
// 用户验证

View 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 APIDrools 属于 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>

View File

@@ -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();
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -0,0 +1,18 @@
package com.solution.rule.domain.dto;
import lombok.Data;
import java.util.List;
@Data
public class ComponentJsonDTO {
//组件类型
private String type;
//组件名称
private String name;
//组件参数列表
private List<PlatformJsonDTO> parameters;
}

View File

@@ -0,0 +1,18 @@
package com.solution.rule.domain.dto;
import lombok.Data;
@Data
public class ComponentParamJsonDTO {
// 参数名称
private String name;
private String def;
// 参数值
private String value;
// 参数单位
private String unit;
}

View File

@@ -0,0 +1,21 @@
package com.solution.rule.domain.dto;
import lombok.Data;
import java.util.List;
@Data
public class PlatformJsonDTO {
// 装备ID
private String id;
// 装备名称
private String name;
// 平台类型 (Platform_type)
private String type;
// 子组件列表(武器、传感器、通信等)
private List<ComponentJsonDTO> components;
}

View File

@@ -0,0 +1,25 @@
package com.solution.rule.domain.dto;
import lombok.Data;
import javax.sound.midi.Track;
import java.util.List;
@Data
public class TaskJsonDTO {
//任务id
private Long attackId;
//任务名称
private String name;
//任务类型
private String dataType;
//任务下的平台
private List<PlatformJsonDTO> platforms;
//任务轨迹
private List<Track> tracks;
}

View File

@@ -0,0 +1,18 @@
package com.solution.rule.domain.dto;
import lombok.Data;
import java.util.List;
@Data
public class TrackJsonDTO {
// 轨迹ID
private String id;
// 轨迹名称
private String name;
// 轨迹点列表
private List<TrackPointJsonDTO> points;
}

View File

@@ -0,0 +1,25 @@
package com.solution.rule.domain.dto;
public class TrackPointJsonDTO {
// 轨迹点索引
private int index;
// 经度
private double longitude;
// 纬度
private double latitude;
// 高度(米)
private double height;
// 速度(米/秒)
private double speed;
// 航向角(度)
private double heading;
// 时间点(秒)
private double time;
}

View File

@@ -0,0 +1,26 @@
package com.solution.rule.domain.dto;
import com.solution.rule.domain.PlatformComponent;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class WeaponModelDTO {
@ApiModelProperty("平台id")
private Integer id;
@ApiModelProperty("平台名称")
private String name;
@ApiModelProperty("平台描述")
private String description;
@ApiModelProperty("平台组件")
private List<PlatformComponent> components;
@ApiModelProperty("平台参数List<String>")
private List<String> platformParams;
}

View File

@@ -0,0 +1,52 @@
package com.solution.rule.domain.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.solution.common.utils.sign.Md5Utils;
import lombok.Data;
import java.util.List;
/**
* 单个属性的定义
*/
@Data
public class Attribute {
//uuid
@JsonProperty("_uuid")
private String uuid;
/** 属性数据类型float、int、string、bool、enum */
private String attDataType;
/** 属性定义(英文标识) */
private String attDef;
/** 属性默认值 */
private String attDefaultValue;
/** 属性详细信息 */
private Object attDetail;
/** 属性说明(中文描述) */
private String attExplain;
/** 属性ID */
private String attId;
/** 属性名称(中文) */
private String attName;
/** 属性取值范围(格式:最小值|最大值) */
private String attRange;
/** 属性单位 */
private String attUnit;
/** 是否为内置属性 */
private boolean builtIn;
/** 枚举信息 */
private String enumInfo;
/** 是否为关键属性 */
private boolean isKey;
/** 是否为公共属性 */
private boolean isPublic;
/** 是否可搜索 */
private boolean isSearch;
/** 是否为文本域 */
private boolean isTextarea;
/** 模型信息(可以是对象或数组,此处定义为具体对象) */
private List<ModelInfo> mdlInfo;
/** 是否只读0-可编辑1-只读) */
private int readOnly;
}

View File

@@ -0,0 +1,18 @@
package com.solution.rule.domain.request;
import lombok.Data;
/**
* 字典项实体
*/
@Data
public class DictItem {
/** 编码 */
private String code;
/** 说明 */
private String explain;
/** 名称 */
private String name;
/** 唯一标识符 */
private String uuid;
}

View File

@@ -0,0 +1,10 @@
package com.solution.rule.domain.request;
import lombok.Data;
@Data
public class Equipments {
}

Some files were not shown because too many files have changed in this diff Show More