Compare commits
27 Commits
2fafd931cc
...
test-platf
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c83b561cc | |||
| bb45ff557b | |||
| 254401d8f1 | |||
| d8c238a9bb | |||
| aefc2c688e | |||
| 5f1ba38c6b | |||
| e57f0f19d5 | |||
| 79364b951d | |||
| 1270bd7d02 | |||
| b424774f3b | |||
| 766425bae5 | |||
| 0e6b6d9f45 | |||
| 50c1cc5bf2 | |||
| 7c71a38f68 | |||
| 3946bc561a | |||
| 5179ab785c | |||
| 5276a6b16f | |||
| c0da7bd0d9 | |||
| dafd7115a8 | |||
| 1061020791 | |||
| 045117011b | |||
| 8a0dfb1ab8 | |||
| 08030c77c2 | |||
| 230116bdd7 | |||
| a65d296421 | |||
| 78e5833514 | |||
| 6add28fdfb |
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@@ -0,0 +1,9 @@
|
||||
**/target/
|
||||
**/.git/
|
||||
**/.idea/
|
||||
**/*.iml
|
||||
**/.vscode/
|
||||
**/node_modules/
|
||||
**/*.log
|
||||
**/.DS_Store
|
||||
**/uploadPath/
|
||||
15
.env.example
Normal file
15
.env.example
Normal file
@@ -0,0 +1,15 @@
|
||||
# 复制为 .env 后 docker compose 会自动加载
|
||||
# copy .env.example .env
|
||||
|
||||
MYSQL_ROOT_PASSWORD=root
|
||||
MYSQL_DATABASE=autosolution_db
|
||||
MYSQL_PORT=3307
|
||||
|
||||
REDIS_PASSWORD=123456
|
||||
REDIS_PORT=6379
|
||||
|
||||
APP_PORT=1777
|
||||
APP_IMAGE_TAG=latest
|
||||
|
||||
# JVM 可选
|
||||
# JAVA_OPTS=-Xms512m -Xmx1024m
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -38,6 +38,10 @@ dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
######################################################################
|
||||
# Docker / local secrets
|
||||
.env
|
||||
|
||||
######################################################################
|
||||
# Others
|
||||
*.log
|
||||
|
||||
114
DEPLOY_OFFLINE.md
Normal file
114
DEPLOY_OFFLINE.md
Normal file
@@ -0,0 +1,114 @@
|
||||
# Docker 离线部署说明(方式 A)
|
||||
|
||||
执行 `docker compose up -d` 即可启动。
|
||||
|
||||
## 1. 交付清单
|
||||
|
||||
请将以下内容放在同一目录(示例:`app/`):
|
||||
|
||||
- `docker-compose.yml`
|
||||
- `.env`(或将 `.env.example` 复制为 `.env` 后修改)
|
||||
- `bundle-images.tar`(包含 `auto-solution-admin`、`mysql:8.0`、`redis:7-alpine`)
|
||||
- `docker/mysql/init/01-ruoyi-table.sql`
|
||||
- `docker/mysql/init/02-ruoyi-extra.sql`
|
||||
- `docker/mysql/init/03-data.sql`
|
||||
|
||||
目录示例:
|
||||
|
||||
```text
|
||||
app/
|
||||
├─ docker-compose.yml
|
||||
├─ .env
|
||||
├─ bundle-images.tar
|
||||
└─ docker/
|
||||
└─ mysql/
|
||||
└─ init/
|
||||
├─ 00-create-db.sql
|
||||
├─ 03-data.sql
|
||||
```
|
||||
|
||||
## 2. 首次部署
|
||||
|
||||
在 `app` 目录执行:
|
||||
|
||||
```bash
|
||||
docker load -i bundle-images.tar
|
||||
docker compose down -v
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
说明:
|
||||
|
||||
- `down -v` 会删除旧数据卷,确保 MySQL 首次初始化时执行 `docker/mysql/init` 下的 SQL。
|
||||
- SQL 执行顺序按文件名字典序,务必保持 `01 -> 02 -> 03`。
|
||||
|
||||
## 3. 启动验证
|
||||
|
||||
```bash
|
||||
docker ps
|
||||
docker inspect autosolution-mysql --format '{{.State.Health.Status}}'
|
||||
docker logs --tail 100 autosolution-mysql
|
||||
docker logs --tail 100 autosolution-app
|
||||
```
|
||||
|
||||
期望结果:
|
||||
|
||||
- `autosolution-mysql` 状态为 `healthy`
|
||||
- `autosolution-app` 状态为 `Up`
|
||||
|
||||
## 4. 访问地址
|
||||
|
||||
- 后端默认端口:`1777`
|
||||
- 访问地址:`http://<服务器IP>:1777`
|
||||
|
||||
## 5. 常见问题
|
||||
|
||||
### 5.1 `Table 'autosolution_db.sys_config' doesn't exist`
|
||||
|
||||
原因:初始化 SQL 未执行或执行失败。
|
||||
|
||||
处理:
|
||||
|
||||
1. 确认 `docker/mysql/init` 下 SQL 文件存在且顺序正确
|
||||
2. 执行:
|
||||
|
||||
```bash
|
||||
docker compose down -v
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
3. 查看 MySQL 日志定位 SQL 报错:
|
||||
|
||||
```bash
|
||||
docker logs --tail 300 autosolution-mysql
|
||||
```
|
||||
|
||||
### 5.2 `dependency failed to start: container autosolution-mysql is unhealthy`
|
||||
|
||||
原因:MySQL 未通过健康检查(通常是 SQL 未执行完成或报错)。
|
||||
|
||||
处理:
|
||||
|
||||
```bash
|
||||
docker logs --tail 300 autosolution-mysql
|
||||
```
|
||||
|
||||
根据日志修复 SQL 后重新 `down -v` 再启动。
|
||||
|
||||
## 6. 版本升级
|
||||
|
||||
替换新的 `bundle-images.tar`(及必要 SQL)后执行:
|
||||
|
||||
```bash
|
||||
docker load -i bundle-images.tar
|
||||
docker compose down
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
如果本次升级包含库初始化变更并要求重建,请改用:
|
||||
|
||||
```bash
|
||||
docker compose down -v
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
18
Dockerfile
Normal file
18
Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
# 运行已打包的 JAR(不依赖源码目录)
|
||||
# 要求构建上下文中存在 solution-admin.jar
|
||||
# 构建:docker build -t auto-solution-admin:latest .
|
||||
|
||||
FROM eclipse-temurin:11-jre-jammy
|
||||
LABEL org.opencontainers.image.title="auto-solution-admin"
|
||||
|
||||
WORKDIR /app
|
||||
RUN mkdir -p /app/uploadPath
|
||||
|
||||
COPY solution-admin.jar /app/app.jar
|
||||
|
||||
ENV TZ=Asia/Shanghai \
|
||||
JAVA_OPTS="-Xms512m -Xmx1024m"
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app/app.jar --spring.profiles.active=druid,docker"]
|
||||
@@ -97,6 +97,19 @@ public class BehaviortreeController extends BaseController
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行为树主
|
||||
*/
|
||||
@@ -121,4 +134,18 @@ 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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -55,4 +55,13 @@ public class SceneController extends BaseController {
|
||||
{
|
||||
return success(sceneService.findOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据场景id获取场景下所有行为树
|
||||
*/
|
||||
@GetMapping("/getAllTree/{id}")
|
||||
@ApiOperation("根据场景id获取场景下所有行为树")
|
||||
public AjaxResult getAllTree(@PathVariable Integer id){
|
||||
return success(sceneService.getAllTree(id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@ package com.solution.web.core;
|
||||
* 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;
|
||||
@@ -20,6 +22,7 @@ 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;
|
||||
@@ -56,6 +59,7 @@ public class BehaviortreeProcessor {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int update(Behaviortree behaviortree) {
|
||||
int result = behaviortreeService.updateBehaviortree(behaviortree);
|
||||
|
||||
@@ -74,7 +78,7 @@ public class BehaviortreeProcessor {
|
||||
}
|
||||
|
||||
private void processGraph(Behaviortree behaviortree) {
|
||||
|
||||
//代码丢失 原:libertyspy 改:MHW
|
||||
Graph graph = null;
|
||||
try {
|
||||
graph = objectMapper.readValue(behaviortree.getXmlContent(), Graph.class);
|
||||
@@ -223,4 +227,23 @@ public class BehaviortreeProcessor {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 复制行为树
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
@@ -49,6 +49,17 @@ public class Behaviortree extends BaseEntity
|
||||
@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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.solution.system.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 平台表
|
||||
*/
|
||||
@Data
|
||||
public class PlatformTree {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 平台名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 平台出现在想定上的想定id
|
||||
*/
|
||||
private Integer scenarioId;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.solution.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PlatformCommunicationMapper {
|
||||
|
||||
/**
|
||||
* 根据平台name获取平台下属英文名
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
List<String> getUnderlingBytreeId(String name);
|
||||
}
|
||||
@@ -0,0 +1,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);
|
||||
}
|
||||
@@ -62,4 +62,11 @@ public interface IBehaviortreeService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBehaviortreeById(Long id);
|
||||
|
||||
/**
|
||||
* 根据行为树id获取该行为树的下属
|
||||
* @param treeId
|
||||
* @return
|
||||
*/
|
||||
List<String> getUnderling(Integer treeId);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,12 @@ 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;
|
||||
@@ -22,6 +26,12 @@ public class BehaviortreeServiceImpl implements IBehaviortreeService
|
||||
@Autowired
|
||||
private BehaviortreeMapper behaviortreeMapper;
|
||||
|
||||
@Autowired
|
||||
private PlatformCommunicationMapper platformCommunicationMapper;
|
||||
|
||||
@Autowired
|
||||
private PlatformMapper platformMapper;
|
||||
|
||||
@Override
|
||||
public Behaviortree findOneByPlatformId(Integer platformId)
|
||||
{
|
||||
@@ -99,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,15 @@ 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">
|
||||
@@ -37,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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -45,6 +45,8 @@ public class FireRuleExecuteTargetItemVO {
|
||||
|
||||
private String cruiseRouteId;
|
||||
|
||||
private String moveRouteId;
|
||||
|
||||
private List<FireRuleCruiseRouteOffsetItemVO> cruiseRouteOffset;
|
||||
|
||||
private String fireType;
|
||||
|
||||
@@ -1,42 +1,45 @@
|
||||
package com.solution.rule.domain.ultimately.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 火力规则输出根文档(与 {@code 火力规则输出.json} 字段一一对应)。
|
||||
*/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FireRuleOutputVO {
|
||||
|
||||
/**
|
||||
* 来源场景文件名
|
||||
*/
|
||||
private String sourceFile;
|
||||
|
||||
/**
|
||||
* 火力规则任务列表(可含防区等输出字段)
|
||||
*/
|
||||
private List<FireRuleTaskInputVO> fireRuleInputs;
|
||||
|
||||
/**
|
||||
* 场景任务节点列表
|
||||
*/
|
||||
@JsonProperty("Tasks")
|
||||
private List<FireRuleSceneTaskNodeVO> tasks;
|
||||
@JsonProperty("TrackParam")
|
||||
private FireRuleTrackParamVO trackParam;
|
||||
|
||||
/**
|
||||
* 编组列表
|
||||
*/
|
||||
@JsonProperty("Groups")
|
||||
private List<FireRuleSceneGroupNodeVO> groups;
|
||||
@JsonIgnore
|
||||
public List<FireRuleSceneGroupNodeVO> getGroups() {
|
||||
return trackParam == null ? null : trackParam.getGroups();
|
||||
}
|
||||
|
||||
/**
|
||||
* 红方装备列表
|
||||
*/
|
||||
private List<FireRuleRedWeaponEquipmentVO> redWeapons;
|
||||
@JsonIgnore
|
||||
public void setGroups(List<FireRuleSceneGroupNodeVO> groups) {
|
||||
if (trackParam == null) {
|
||||
trackParam = new FireRuleTrackParamVO();
|
||||
}
|
||||
trackParam.setGroups(groups);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public List<FireRuleRedWeaponEquipmentVO> getRedWeapons() {
|
||||
return trackParam == null ? null : trackParam.getRedWeapons();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public void setRedWeapons(List<FireRuleRedWeaponEquipmentVO> redWeapons) {
|
||||
if (trackParam == null) {
|
||||
trackParam = new FireRuleTrackParamVO();
|
||||
}
|
||||
trackParam.setRedWeapons(redWeapons);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,6 @@ import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 火力规则输出中 redWeapons 数组的单项(红方装备/平台)
|
||||
*/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FireRuleRedWeaponEquipmentVO {
|
||||
@@ -23,15 +20,10 @@ public class FireRuleRedWeaponEquipmentVO {
|
||||
private String platformType;
|
||||
|
||||
private Boolean isStrikeTarget;
|
||||
|
||||
private Boolean isReconTarget;
|
||||
|
||||
private Boolean isInterferenceTarget;
|
||||
|
||||
private Boolean isDefendImportantPlace;
|
||||
//命中率
|
||||
private Double successTargetRad;
|
||||
|
||||
private String groupType;
|
||||
|
||||
@JsonProperty("EquipmentID")
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.solution.rule.domain.ultimately.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FireRuleRouteTrackPointVO {
|
||||
private String index;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private String height;
|
||||
private String speed;
|
||||
private String psia;
|
||||
private Integer time;
|
||||
private String active;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.solution.rule.domain.ultimately.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FireRuleTrackParamVO {
|
||||
|
||||
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||
|
||||
private Map<String, FireRuleTrackRouteVO> routeMap = new LinkedHashMap<>();
|
||||
|
||||
@JsonProperty("Groups")
|
||||
private List<FireRuleSceneGroupNodeVO> groups;
|
||||
|
||||
@JsonProperty("redWeapons")
|
||||
private List<FireRuleRedWeaponEquipmentVO> redWeapons;
|
||||
|
||||
@JsonAnySetter
|
||||
public void putRoute(String key, JsonNode value) {
|
||||
if ("Groups".equals(key) || "redWeapons".equals(key) || value == null) {
|
||||
return;
|
||||
}
|
||||
routeMap.put(key, MAPPER.convertValue(value, FireRuleTrackRouteVO.class));
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, FireRuleTrackRouteVO> getRouteMap() {
|
||||
return routeMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.solution.rule.domain.ultimately.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FireRuleTrackRouteVO {
|
||||
private String name;
|
||||
@JsonProperty("StartTime")
|
||||
private Integer startTime;
|
||||
@JsonProperty("EndTime")
|
||||
private Integer endTime;
|
||||
@JsonProperty("TrackType")
|
||||
private String trackType;
|
||||
@JsonProperty("HeightType")
|
||||
private String heightType;
|
||||
private String seaType;
|
||||
@JsonProperty("TrackPoints")
|
||||
private List<FireRuleRouteTrackPointVO> trackPoints;
|
||||
@JsonProperty("Color")
|
||||
private String color;
|
||||
@JsonProperty("PointCount")
|
||||
private Integer pointCount;
|
||||
}
|
||||
@@ -18,14 +18,23 @@ import com.solution.rule.domain.ultimately.vo.FireRuleRedSubComponentsVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleRedWeaponEquipmentVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleRedPlatformSlotVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleRedWeaponSlotVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleOutputVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleRouteTrackPointVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleSceneGroupNodeVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleSceneTaskNodeVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleSceneTaskPayloadVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleTrackParamVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleTrackRouteVO;
|
||||
import com.solution.rule.domain.ultimately.vo.FireRuleWingmanDataVO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -170,6 +179,634 @@ public final class FireRuleRedWeaponOutputFillHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 航迹规则:按蓝方 trackPoints 生成 {@link FireRuleTrackParamVO#routeMap} 条目(JSON 顶层 key=航迹 id),
|
||||
* 并将同一 id 写入对应红方任务 {@code execute[0].targetList[*].moveRouteId}。多蓝方任务循环时 merge,不覆盖已有 id。
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static void fillTrackParamAndBindMoveRoute(FireRuleOutputVO out, FireRuleTaskInputDTO blueTask, Map params) {
|
||||
if (out == null || blueTask == null || out.getTasks() == null || out.getTasks().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ensureTrackParam(out);
|
||||
List<FireRuleSceneTaskNodeVO> tasks = out.getTasks();
|
||||
List<FireRuleRedWeaponEquipmentVO> reds = out.getRedWeapons();
|
||||
if (reds == null) {
|
||||
reds = Collections.emptyList();
|
||||
}
|
||||
List<Coord> warPoly = toWarZonePolygon(blueTask.getWarZoneLocation());
|
||||
Coord blueAnchor = computeBlueAnchor(blueTask);
|
||||
Coord clampAnchor = resolveClampAnchor(blueAnchor, warPoly);
|
||||
boolean zoneClamp = Boolean.parseBoolean(String.valueOf(params.getOrDefault("enableTrackWarZoneClamp", true)));
|
||||
|
||||
String dirMode = str(params, "trackPointDirectionMode", "head2next");
|
||||
double fallbackBrg = readDouble(params, "trackFallbackBearingDeg", readDouble(params, "fallbackBearingDeg", 0d));
|
||||
double mainBearing = computeTrackBearingDeg(blueTask, dirMode, fallbackBrg);
|
||||
|
||||
String algo = str(params, "trackRouteAlgorithm", "followBlue");
|
||||
String nameSuffix = str(params, "trackRouteNameSuffix", "航迹");
|
||||
String groundType = str(params, "trackGroundTrackType", "routeLineGround");
|
||||
String blueIdSeg = sanitizeRouteIdSegment(nz(blueTask.getId()));
|
||||
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
FireRuleSceneTaskNodeVO node = tasks.get(i);
|
||||
if (node == null) {
|
||||
continue;
|
||||
}
|
||||
FireRuleRedWeaponEquipmentVO red = i < reds.size() ? reds.get(i) : null;
|
||||
List<TrackNode> nodes = extractSortedBlueTrackNodes(blueTask);
|
||||
if (nodes.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
List<TrackNode> transformed = applyTrackRouteAlgorithm(nodes, algo, params, mainBearing, i);
|
||||
int extraMax = readInt(params, "trackExtraNodesMax", 0);
|
||||
if (extraMax > 0) {
|
||||
transformed = injectExtraTrackNodes(transformed, extraMax);
|
||||
}
|
||||
if (zoneClamp && warPoly.size() >= 3) {
|
||||
transformed = clampTrackNodesToWarZone(transformed, warPoly, clampAnchor);
|
||||
}
|
||||
boolean air = resolveAirTrack(blueTask, red, params);
|
||||
String routeName = nz(node.getDrawName()) + nameSuffix;
|
||||
String routeId = buildUniqueRouteId(out.getTrackParam().getRouteMap(), blueIdSeg, sanitizeRouteIdSegment(nz(node.getId())), i);
|
||||
|
||||
FireRuleTrackRouteVO route = buildTrackRouteVo(transformed, routeName, air, groundType);
|
||||
out.getTrackParam().getRouteMap().put(routeId, route);
|
||||
bindMoveRouteIdToFirstExecute(node, routeId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编组规则:按红方装备列表分组,写入 {@link FireRuleTrackParamVO#getGroups}(JSON 键 Groups),
|
||||
* groupType=addGroup,drawName=领队装备名+后缀;僚机 wingmanData 中 name 为红方 equipmentId。
|
||||
* 多蓝方任务循环时与航迹一致:在已有 Groups 上追加,且 group id 与已有项冲突时自动加后缀。
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static void fillTrackParamGroups(FireRuleOutputVO out, FireRuleTaskInputDTO blueTask, Map params) {
|
||||
if (out == null || blueTask == null) {
|
||||
return;
|
||||
}
|
||||
boolean enabled = Boolean.parseBoolean(String.valueOf(params.getOrDefault("groupRuleEnabled", true)));
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
List<FireRuleRedWeaponEquipmentVO> reds = out.getRedWeapons();
|
||||
if (reds == null || reds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ensureTrackParam(out);
|
||||
|
||||
String dirMode = str(params, "trackPointDirectionMode", "head2next");
|
||||
double fallbackBrg = readDouble(params, "trackFallbackBearingDeg", readDouble(params, "fallbackBearingDeg", 0d));
|
||||
double mainBearing = computeTrackBearingDeg(blueTask, dirMode, fallbackBrg);
|
||||
|
||||
String mode = str(params, "groupFormationMode", "onePerRed");
|
||||
int clusterSize = readInt(params, "groupClusterSize", 3);
|
||||
if (clusterSize < 1) {
|
||||
clusterSize = 1;
|
||||
}
|
||||
int minWing = readInt(params, "groupMinMembersForWingman", 2);
|
||||
|
||||
List<List<FireRuleRedWeaponEquipmentVO>> buckets = splitRedsIntoGroups(reds, mode, clusterSize);
|
||||
List<FireRuleSceneGroupNodeVO> batch = new ArrayList<>();
|
||||
String blueSeg = sanitizeRouteIdSegment(nz(blueTask.getId()));
|
||||
int gidx = 0;
|
||||
for (List<FireRuleRedWeaponEquipmentVO> bucket : buckets) {
|
||||
if (bucket == null || bucket.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
FireRuleRedWeaponEquipmentVO leader = pickGroupLeader(bucket, params);
|
||||
if (leader == null) {
|
||||
continue;
|
||||
}
|
||||
FireRuleSceneGroupNodeVO node = new FireRuleSceneGroupNodeVO();
|
||||
String baseId = "group_" + blueSeg + "_" + gidx;
|
||||
node.setId(ensureUniqueGroupId(out.getTrackParam(), baseId));
|
||||
String suffix = str(params, "groupDrawNameSuffix", "编组");
|
||||
boolean withIndex = Boolean.parseBoolean(String.valueOf(params.getOrDefault("groupDrawNameWithIndex", false)));
|
||||
String drawName = nz(leader.getName()) + suffix;
|
||||
if (withIndex) {
|
||||
drawName += (gidx + 1);
|
||||
}
|
||||
node.setDrawName(drawName);
|
||||
node.setGroupType("addGroup");
|
||||
node.setName("addGroup");
|
||||
node.setLeader(nz(leader.getEquipmentId()));
|
||||
node.setSort(System.currentTimeMillis() + gidx);
|
||||
node.setWingmanData(buildWingmanData(bucket, leader, mainBearing, params, minWing));
|
||||
batch.add(node);
|
||||
gidx++;
|
||||
}
|
||||
mergeGroupsIntoTrackParam(out.getTrackParam(), batch);
|
||||
}
|
||||
|
||||
private static List<List<FireRuleRedWeaponEquipmentVO>> splitRedsIntoGroups(
|
||||
List<FireRuleRedWeaponEquipmentVO> reds, String mode, int clusterSize) {
|
||||
List<FireRuleRedWeaponEquipmentVO> clean = new ArrayList<>();
|
||||
for (FireRuleRedWeaponEquipmentVO r : reds) {
|
||||
if (r != null) {
|
||||
clean.add(r);
|
||||
}
|
||||
}
|
||||
List<List<FireRuleRedWeaponEquipmentVO>> out = new ArrayList<>();
|
||||
if (clean.isEmpty()) {
|
||||
return out;
|
||||
}
|
||||
if ("singleGroup".equalsIgnoreCase(mode)) {
|
||||
out.add(clean);
|
||||
return out;
|
||||
}
|
||||
if ("clusterByCount".equalsIgnoreCase(mode)) {
|
||||
for (int i = 0; i < clean.size(); i += clusterSize) {
|
||||
int end = Math.min(i + clusterSize, clean.size());
|
||||
out.add(new ArrayList<>(clean.subList(i, end)));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
for (FireRuleRedWeaponEquipmentVO r : clean) {
|
||||
out.add(Collections.singletonList(r));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private static FireRuleRedWeaponEquipmentVO pickGroupLeader(List<FireRuleRedWeaponEquipmentVO> bucket, Map params) {
|
||||
if (bucket == null || bucket.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
String mode = str(params, "groupLeaderPickMode", "byHitRateThenId");
|
||||
FireRuleRedWeaponEquipmentVO best = bucket.get(0);
|
||||
for (int i = 1; i < bucket.size(); i++) {
|
||||
FireRuleRedWeaponEquipmentVO cur = bucket.get(i);
|
||||
if ("byId".equalsIgnoreCase(mode)) {
|
||||
if (compareEquipmentId(cur, best) < 0) {
|
||||
best = cur;
|
||||
}
|
||||
} else {
|
||||
if (isBetterLeaderByHitRateThenId(cur, best)) {
|
||||
best = cur;
|
||||
}
|
||||
}
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
private static boolean isBetterLeaderByHitRateThenId(FireRuleRedWeaponEquipmentVO cand, FireRuleRedWeaponEquipmentVO inc) {
|
||||
double rc = leaderRad(cand);
|
||||
double ri = leaderRad(inc);
|
||||
int c = Double.compare(rc, ri);
|
||||
if (c > 0) {
|
||||
return true;
|
||||
}
|
||||
if (c < 0) {
|
||||
return false;
|
||||
}
|
||||
return compareEquipmentId(cand, inc) < 0;
|
||||
}
|
||||
|
||||
private static double leaderRad(FireRuleRedWeaponEquipmentVO w) {
|
||||
if (w == null || w.getSuccessTargetRad() == null) {
|
||||
return -1d;
|
||||
}
|
||||
return w.getSuccessTargetRad().doubleValue();
|
||||
}
|
||||
|
||||
private static int compareEquipmentId(FireRuleRedWeaponEquipmentVO a, FireRuleRedWeaponEquipmentVO b) {
|
||||
String sa = a != null ? nz(a.getEquipmentId()) : "";
|
||||
String sb = b != null ? nz(b.getEquipmentId()) : "";
|
||||
return sa.compareTo(sb);
|
||||
}
|
||||
|
||||
private static List<FireRuleWingmanDataVO> buildWingmanData(
|
||||
List<FireRuleRedWeaponEquipmentVO> bucket,
|
||||
FireRuleRedWeaponEquipmentVO leader,
|
||||
double mainBearing,
|
||||
Map params,
|
||||
int minMembersForWingman) {
|
||||
if (bucket == null || leader == null || bucket.size() < minMembersForWingman) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
double distBase = readDouble(params, "wingmanDistanceBaseMeters", 100);
|
||||
double distStep = readDouble(params, "wingmanDistanceStepMeters", 50);
|
||||
double angBase = readDouble(params, "wingmanAngleBaseDeg", 50);
|
||||
double angStep = readDouble(params, "wingmanAngleStepDeg", 15);
|
||||
double altBase = readDouble(params, "wingmanAltBaseMeters", 40);
|
||||
double altScale = readDouble(params, "wingmanAltScale", 1.0);
|
||||
|
||||
List<FireRuleWingmanDataVO> list = new ArrayList<>();
|
||||
int wmIdx = 0;
|
||||
for (FireRuleRedWeaponEquipmentVO r : bucket) {
|
||||
if (r == null || r == leader) {
|
||||
continue;
|
||||
}
|
||||
FireRuleWingmanDataVO w = new FireRuleWingmanDataVO();
|
||||
w.setKey(wmIdx);
|
||||
w.setName(nz(r.getEquipmentId()));
|
||||
w.setDistance((int) Math.round(distBase + wmIdx * distStep));
|
||||
double deg = normDeg(mainBearing + angBase + wmIdx * angStep);
|
||||
w.setAngle(String.format(Locale.US, "%.1f", deg));
|
||||
Double lh = extractFirstPlatformHeight(leader);
|
||||
Double wh = extractFirstPlatformHeight(r);
|
||||
double delta = 0d;
|
||||
if (lh != null && wh != null) {
|
||||
delta = wh - lh;
|
||||
}
|
||||
w.setAlt((int) Math.round(altBase + altScale * delta));
|
||||
list.add(w);
|
||||
wmIdx++;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static Double extractFirstPlatformHeight(FireRuleRedWeaponEquipmentVO red) {
|
||||
if (red == null || red.getSubComponents() == null || red.getSubComponents().getPlatform() == null) {
|
||||
return null;
|
||||
}
|
||||
for (FireRuleRedPlatformSlotVO pl : red.getSubComponents().getPlatform()) {
|
||||
if (pl == null || pl.getPositions() == null || pl.getPositions().size() < 3) {
|
||||
continue;
|
||||
}
|
||||
return pl.getPositions().get(2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static double normDeg(double deg) {
|
||||
double a = deg % 360d;
|
||||
if (a < 0) {
|
||||
a += 360d;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
private static String ensureUniqueGroupId(FireRuleTrackParamVO tp, String baseId) {
|
||||
Set<String> seen = new HashSet<>();
|
||||
if (tp.getGroups() != null) {
|
||||
for (FireRuleSceneGroupNodeVO g : tp.getGroups()) {
|
||||
if (g != null && !isBlank(g.getId())) {
|
||||
seen.add(g.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!seen.contains(baseId)) {
|
||||
return baseId;
|
||||
}
|
||||
int k = 1;
|
||||
while (seen.contains(baseId + "_" + k)) {
|
||||
k++;
|
||||
}
|
||||
return baseId + "_" + k;
|
||||
}
|
||||
|
||||
private static void mergeGroupsIntoTrackParam(FireRuleTrackParamVO tp, List<FireRuleSceneGroupNodeVO> batch) {
|
||||
if (tp == null || batch == null || batch.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<FireRuleSceneGroupNodeVO> cur = tp.getGroups();
|
||||
if (cur == null) {
|
||||
cur = new ArrayList<>();
|
||||
} else {
|
||||
cur = new ArrayList<>(cur);
|
||||
}
|
||||
cur.addAll(batch);
|
||||
tp.setGroups(cur);
|
||||
}
|
||||
|
||||
private static void ensureTrackParam(FireRuleOutputVO out) {
|
||||
if (out.getTrackParam() == null) {
|
||||
out.setTrackParam(new FireRuleTrackParamVO());
|
||||
}
|
||||
}
|
||||
|
||||
private static String buildUniqueRouteId(Map<String, FireRuleTrackRouteVO> existing, String blueSeg, String nodeSeg, int index) {
|
||||
String base = "route_" + blueSeg + "_" + nodeSeg + "_" + index;
|
||||
if (existing == null || !existing.containsKey(base)) {
|
||||
return base;
|
||||
}
|
||||
int k = 1;
|
||||
while (existing.containsKey(base + "_" + k)) {
|
||||
k++;
|
||||
}
|
||||
return base + "_" + k;
|
||||
}
|
||||
|
||||
private static void bindMoveRouteIdToFirstExecute(FireRuleSceneTaskNodeVO node, String routeId) {
|
||||
if (node == null || isBlank(routeId)) {
|
||||
return;
|
||||
}
|
||||
FireRuleSceneTaskPayloadVO payload = node.getTask();
|
||||
if (payload == null || payload.getExecute() == null || payload.getExecute().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
FireRuleExecuteBlockVO block = payload.getExecute().get(0);
|
||||
if (block == null || block.getTargetList() == null) {
|
||||
return;
|
||||
}
|
||||
for (FireRuleExecuteTargetItemVO item : block.getTargetList()) {
|
||||
if (item != null) {
|
||||
item.setMoveRouteId(routeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static FireRuleTrackRouteVO buildTrackRouteVo(List<TrackNode> nodes, String name, boolean air, String groundType) {
|
||||
FireRuleTrackRouteVO vo = new FireRuleTrackRouteVO();
|
||||
vo.setName(name);
|
||||
vo.setStartTime(null);
|
||||
vo.setEndTime(null);
|
||||
vo.setTrackType(air ? "routeLineAir" : groundType);
|
||||
vo.setHeightType("msl");
|
||||
vo.setSeaType("seaLevel");
|
||||
List<FireRuleRouteTrackPointVO> pts = new ArrayList<>(nodes.size());
|
||||
for (int j = 0; j < nodes.size(); j++) {
|
||||
TrackNode tn = nodes.get(j);
|
||||
FireRuleRouteTrackPointVO p = new FireRuleRouteTrackPointVO();
|
||||
p.setIndex(String.valueOf(j + 1));
|
||||
p.setLongitude(formatCoordNumber(tn.coord.lon));
|
||||
p.setLatitude(formatCoordNumber(tn.coord.lat));
|
||||
p.setHeight(tn.coord.height != null ? formatCoordNumber(tn.coord.height) : "0");
|
||||
p.setSpeed(tn.speed != null ? formatCoordNumber(tn.speed) : null);
|
||||
pts.add(p);
|
||||
}
|
||||
vo.setTrackPoints(pts);
|
||||
vo.setPointCount(pts.size());
|
||||
return vo;
|
||||
}
|
||||
|
||||
private static String formatCoordNumber(double v) {
|
||||
return String.valueOf(v);
|
||||
}
|
||||
|
||||
private static boolean resolveAirTrack(FireRuleTaskInputDTO blue, FireRuleRedWeaponEquipmentVO red, Map params) {
|
||||
String dt = blue != null ? nz(blue.getDataType()) : "";
|
||||
if (csvContainsAny(str(params, "trackAirDataTypeCsv", ""), dt, false)) {
|
||||
return true;
|
||||
}
|
||||
String blob = nz(blue != null ? blue.getDrawName() : "");
|
||||
if (red != null) {
|
||||
blob += " " + nz(red.getName()) + " " + nz(red.getPlatformType());
|
||||
}
|
||||
return csvContainsAny(str(params, "trackAirKeywordsCsv", ""), blob, false);
|
||||
}
|
||||
|
||||
private static boolean csvContainsAny(String csv, String text, boolean tokenAsEquals) {
|
||||
if (isBlank(csv) || text == null) {
|
||||
return false;
|
||||
}
|
||||
String t = text.toLowerCase();
|
||||
for (String part : csv.split(",")) {
|
||||
String k = part.trim();
|
||||
if (k.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (tokenAsEquals) {
|
||||
if (t.equalsIgnoreCase(k)) {
|
||||
return true;
|
||||
}
|
||||
} else if (text.contains(k) || t.contains(k.toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String sanitizeRouteIdSegment(String raw) {
|
||||
if (raw == null || raw.isEmpty()) {
|
||||
return "x";
|
||||
}
|
||||
String s = raw.replaceAll("[^a-zA-Z0-9_-]", "_");
|
||||
return s.isEmpty() ? "x" : s;
|
||||
}
|
||||
|
||||
private static class TrackNode {
|
||||
Coord coord;
|
||||
Double speed;
|
||||
TrackNode(Coord coord, Double speed) {
|
||||
this.coord = coord;
|
||||
this.speed = speed;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<TrackNode> extractSortedBlueTrackNodes(FireRuleTaskInputDTO blueTask) {
|
||||
List<TrackNode> list = new ArrayList<>();
|
||||
if (blueTask == null || blueTask.getTrackPoints() == null) {
|
||||
return list;
|
||||
}
|
||||
List<FireRuleTrackPointDTO> pts = new ArrayList<>(blueTask.getTrackPoints());
|
||||
pts.sort((a, b) -> {
|
||||
int ia = a != null && a.getIndex() != null ? a.getIndex() : 0;
|
||||
int ib = b != null && b.getIndex() != null ? b.getIndex() : 0;
|
||||
return Integer.compare(ia, ib);
|
||||
});
|
||||
for (FireRuleTrackPointDTO p : pts) {
|
||||
if (p == null || p.getLongitude() == null || p.getLatitude() == null) {
|
||||
continue;
|
||||
}
|
||||
list.add(new TrackNode(new Coord(p.getLongitude(), p.getLatitude(), p.getHeight()), p.getSpeed()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<TrackNode> applyTrackRouteAlgorithm(List<TrackNode> nodes, String algo, Map params, double mainBearing, int taskIndex) {
|
||||
if (nodes == null || nodes.isEmpty()) {
|
||||
return nodes;
|
||||
}
|
||||
String a = algo == null ? "followBlue" : algo.trim();
|
||||
if ("shortestPath".equalsIgnoreCase(a)) {
|
||||
return applyShortestPath(nodes, params);
|
||||
}
|
||||
if ("flank".equalsIgnoreCase(a)) {
|
||||
return applyFlank(nodes, params, taskIndex);
|
||||
}
|
||||
if ("jam".equalsIgnoreCase(a)) {
|
||||
return applyJam(nodes, params, mainBearing);
|
||||
}
|
||||
return copyTrackNodes(nodes);
|
||||
}
|
||||
|
||||
private static List<TrackNode> copyTrackNodes(List<TrackNode> nodes) {
|
||||
List<TrackNode> out = new ArrayList<>(nodes.size());
|
||||
for (TrackNode n : nodes) {
|
||||
out.add(new TrackNode(new Coord(n.coord.lon, n.coord.lat, n.coord.height), n.speed));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private static List<TrackNode> applyShortestPath(List<TrackNode> nodes, Map params) {
|
||||
int segN = readInt(params, "trackShortPathSegments", 3);
|
||||
if (segN < 1) {
|
||||
segN = 1;
|
||||
}
|
||||
List<TrackNode> out = new ArrayList<>();
|
||||
for (int i = 0; i < nodes.size(); i++) {
|
||||
if (i == 0) {
|
||||
out.add(copyNode(nodes.get(i)));
|
||||
continue;
|
||||
}
|
||||
Coord a = nodes.get(i - 1).coord;
|
||||
Coord b = nodes.get(i).coord;
|
||||
Double spPrev = nodes.get(i - 1).speed;
|
||||
Double spNext = nodes.get(i).speed;
|
||||
for (int s = 1; s < segN; s++) {
|
||||
double t = (double) s / (double) segN;
|
||||
double lon = a.lon + (b.lon - a.lon) * t;
|
||||
double lat = a.lat + (b.lat - a.lat) * t;
|
||||
Double h = null;
|
||||
if (a.height != null && b.height != null) {
|
||||
h = a.height + (b.height - a.height) * t;
|
||||
} else if (b.height != null) {
|
||||
h = b.height;
|
||||
} else {
|
||||
h = a.height;
|
||||
}
|
||||
Double spd = null;
|
||||
if (spPrev != null && spNext != null) {
|
||||
spd = spPrev + (spNext - spPrev) * t;
|
||||
} else if (spNext != null) {
|
||||
spd = spNext;
|
||||
} else {
|
||||
spd = spPrev;
|
||||
}
|
||||
out.add(new TrackNode(new Coord(lon, lat, h), spd));
|
||||
}
|
||||
out.add(copyNode(nodes.get(i)));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private static TrackNode copyNode(TrackNode n) {
|
||||
return new TrackNode(new Coord(n.coord.lon, n.coord.lat, n.coord.height), n.speed);
|
||||
}
|
||||
|
||||
private static List<TrackNode> applyFlank(List<TrackNode> nodes, Map params, int taskIndex) {
|
||||
double offsetM = readDouble(params, "trackFlankOffsetMeters", 800d);
|
||||
String sideMode = str(params, "trackFlankSideMode", "alternate");
|
||||
List<TrackNode> out = new ArrayList<>(nodes.size());
|
||||
for (int i = 0; i < nodes.size(); i++) {
|
||||
Coord c = nodes.get(i).coord;
|
||||
double brg;
|
||||
if (i < nodes.size() - 1) {
|
||||
Coord nxt = nodes.get(i + 1).coord;
|
||||
brg = bearingDeg(c.lon, c.lat, nxt.lon, nxt.lat);
|
||||
} else if (i > 0) {
|
||||
Coord prev = nodes.get(i - 1).coord;
|
||||
brg = bearingDeg(prev.lon, prev.lat, c.lon, c.lat);
|
||||
} else {
|
||||
brg = 0d;
|
||||
}
|
||||
int sign = flankSign(sideMode, i, taskIndex);
|
||||
Coord moved = moveByMeters(c, sign * offsetM, brg + 90d);
|
||||
out.add(new TrackNode(moved, nodes.get(i).speed));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private static int flankSign(String mode, int pointIndex, int taskIndex) {
|
||||
if ("left".equalsIgnoreCase(mode)) {
|
||||
return 1;
|
||||
}
|
||||
if ("right".equalsIgnoreCase(mode)) {
|
||||
return -1;
|
||||
}
|
||||
return (pointIndex + taskIndex) % 2 == 0 ? 1 : -1;
|
||||
}
|
||||
|
||||
private static List<TrackNode> applyJam(List<TrackNode> nodes, Map params, double mainBearing) {
|
||||
double wobble = readDouble(params, "trackJamWobbleMeters", 400d);
|
||||
double periods = readDouble(params, "trackJamSegments", 4d);
|
||||
if (periods < 0.5d) {
|
||||
periods = 0.5d;
|
||||
}
|
||||
int n = nodes.size();
|
||||
List<TrackNode> out = new ArrayList<>(n);
|
||||
for (int i = 0; i < n; i++) {
|
||||
double frac = n <= 1 ? 0d : (double) i / (double) (n - 1);
|
||||
double lateral = wobble * Math.sin(2d * Math.PI * periods * frac);
|
||||
Coord c = moveByMeters(nodes.get(i).coord, lateral, mainBearing + 90d);
|
||||
out.add(new TrackNode(c, nodes.get(i).speed));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private static List<TrackNode> injectExtraTrackNodes(List<TrackNode> nodes, int extraMax) {
|
||||
if (nodes == null || nodes.size() < 2 || extraMax <= 0) {
|
||||
return nodes;
|
||||
}
|
||||
int segs = nodes.size() - 1;
|
||||
List<Integer> perSeg = new ArrayList<>(Collections.nCopies(segs, 0));
|
||||
int base = extraMax / segs;
|
||||
int rem = extraMax % segs;
|
||||
for (int s = 0; s < segs; s++) {
|
||||
perSeg.set(s, base + (s < rem ? 1 : 0));
|
||||
}
|
||||
List<TrackNode> out = new ArrayList<>();
|
||||
for (int i = 0; i < nodes.size(); i++) {
|
||||
out.add(copyNode(nodes.get(i)));
|
||||
if (i >= nodes.size() - 1) {
|
||||
break;
|
||||
}
|
||||
int ins = perSeg.get(i);
|
||||
Coord a = nodes.get(i).coord;
|
||||
Coord b = nodes.get(i + 1).coord;
|
||||
Double sa = nodes.get(i).speed;
|
||||
Double sb = nodes.get(i + 1).speed;
|
||||
for (int k = 1; k <= ins; k++) {
|
||||
double t = (double) k / (double) (ins + 1);
|
||||
double lon = a.lon + (b.lon - a.lon) * t;
|
||||
double lat = a.lat + (b.lat - a.lat) * t;
|
||||
Double h = null;
|
||||
if (a.height != null && b.height != null) {
|
||||
h = a.height + (b.height - a.height) * t;
|
||||
} else if (b.height != null) {
|
||||
h = b.height;
|
||||
} else {
|
||||
h = a.height;
|
||||
}
|
||||
Double spd = null;
|
||||
if (sa != null && sb != null) {
|
||||
spd = sa + (sb - sa) * t;
|
||||
} else if (sb != null) {
|
||||
spd = sb;
|
||||
} else {
|
||||
spd = sa;
|
||||
}
|
||||
out.add(new TrackNode(new Coord(lon, lat, h), spd));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private static List<TrackNode> clampTrackNodesToWarZone(List<TrackNode> nodes, List<Coord> poly, Coord anchor) {
|
||||
List<TrackNode> out = new ArrayList<>(nodes.size());
|
||||
for (TrackNode n : nodes) {
|
||||
Coord c = n.coord;
|
||||
if (!isPointInPolygon(c, poly)) {
|
||||
c = projectInsidePolygon(c, anchor, poly);
|
||||
}
|
||||
out.add(new TrackNode(c, n.speed));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private static Coord resolveClampAnchor(Coord blueAnchor, List<Coord> poly) {
|
||||
if (poly.size() >= 3) {
|
||||
if (blueAnchor != null && isPointInPolygon(blueAnchor, poly)) {
|
||||
return blueAnchor;
|
||||
}
|
||||
return polygonCentroid(poly);
|
||||
}
|
||||
return blueAnchor != null ? blueAnchor : new Coord(0d, 0d, null);
|
||||
}
|
||||
|
||||
private static Coord polygonCentroid(List<Coord> poly) {
|
||||
double sx = 0, sy = 0;
|
||||
for (Coord c : poly) {
|
||||
sx += c.lon;
|
||||
sy += c.lat;
|
||||
}
|
||||
int n = poly.size();
|
||||
return new Coord(sx / n, sy / n, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 目标分配:为每个红方 Tasks 节点写入 task.execute[0].targetList[*].targetId。\n
|
||||
* targetId 来源:当前蓝方任务 {@link FireRuleTaskInputDTO#getTaskWeapons()} 下每条武器的 equipmentId。\n
|
||||
|
||||
@@ -225,6 +225,42 @@ public final class RuleFunction {
|
||||
FireRuleRedWeaponOutputFillHelper.fillPlatformPositions(out.getRedWeapons(), fact.getTask(), p);
|
||||
}
|
||||
|
||||
/**
|
||||
* 航迹规则:根据蓝方 trackPoints 与作战区生成 TrackParam 航迹,并绑定 execute.targetList.moveRouteId。
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static void trackRoute(DroolsFact fact, Map globalParams) {
|
||||
if (fact == null || fact.getTask() == null || fact.getFireRuleOutputVO() == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> p = castParams(globalParams);
|
||||
boolean enabled = Boolean.parseBoolean(String.valueOf(p.getOrDefault("trackRuleEnabled", true)));
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
FireRuleOutputVO out = fact.getFireRuleOutputVO();
|
||||
if (out.getTasks() == null || out.getTasks().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
FireRuleRedWeaponOutputFillHelper.fillTrackParamAndBindMoveRoute(out, fact.getTask(), p);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编组规则:填充 {@link com.solution.rule.domain.ultimately.vo.FireRuleTrackParamVO#getGroups}(groupType=addGroup)与僚机 wingmanData。
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static void groupFormation(DroolsFact fact, Map globalParams) {
|
||||
if (fact == null || fact.getTask() == null || fact.getFireRuleOutputVO() == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> p = castParams(globalParams);
|
||||
boolean enabled = Boolean.parseBoolean(String.valueOf(p.getOrDefault("groupRuleEnabled", true)));
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
FireRuleRedWeaponOutputFillHelper.fillTrackParamGroups(fact.getFireRuleOutputVO(), fact.getTask(), p);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static Map<String, Object> castParams(Map raw) {
|
||||
return raw == null ? new java.util.HashMap<>() : (Map<String, Object>) raw;
|
||||
|
||||
392
auto-solution-rule/src/main/resources/json/new火力规则输出.json
Normal file
392
auto-solution-rule/src/main/resources/json/new火力规则输出.json
Normal file
@@ -0,0 +1,392 @@
|
||||
{
|
||||
"sourceFile": "区域防空31111_2026-04-02 15_29_03.json",
|
||||
"fireRuleInputs": [
|
||||
{
|
||||
"taskWeapons": [
|
||||
{
|
||||
"equipmentId": "40b341f6-d60a-4a29-b84d-2973a3065124",
|
||||
"name": "导弹",
|
||||
"supportType": "2001",
|
||||
"components": [
|
||||
{
|
||||
"deviceId": "81c7e7da-cb7b-4435-bba3-1648e946d2b2",
|
||||
"deviceName": "导弹机动组件",
|
||||
"componentParams": [
|
||||
{
|
||||
"uuid": "b47f34c2-3cba-4be3-a1d5-be0a986dff6f",
|
||||
"attDefaultValue": "",
|
||||
"attExplain": "",
|
||||
"number": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"deviceId": "4cf26cd0-bd5b-4d4c-a2eb-bca6184be5a1",
|
||||
"deviceName": "导弹平台",
|
||||
"componentParams": [
|
||||
{
|
||||
"uuid": "32beea38-ffc2-445a-9687-e9bdb087727f",
|
||||
"attDefaultValue": "",
|
||||
"attExplain": "",
|
||||
"number": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"coordinate": {
|
||||
"longitude": 124.74107151788,
|
||||
"latitude": 26.74143394432,
|
||||
"height": -498.06469972014
|
||||
},
|
||||
"number": 10,
|
||||
"targetId": "0c058874-0c12-4902-8fd0-2cde015965e1"
|
||||
}
|
||||
],
|
||||
"targetId": "0c058874-0c12-4902-8fd0-2cde015965e1",
|
||||
"warZoneLocation": [
|
||||
{
|
||||
"longitude": 122.18971775079,
|
||||
"latitude": 28.64177652916,
|
||||
"height": -99.95248993318
|
||||
},
|
||||
{
|
||||
"longitude": 127.22874089381,
|
||||
"latitude": 28.54075963352,
|
||||
"height": -1063.0224849918
|
||||
},
|
||||
{
|
||||
"longitude": 127.99831970891,
|
||||
"latitude": 23.81306022325,
|
||||
"height": -5900.62524601637
|
||||
},
|
||||
{
|
||||
"longitude": 120.14866648107,
|
||||
"latitude": 23.90272134296,
|
||||
"height": -22.17614107099
|
||||
}
|
||||
],
|
||||
"defZoneLocation": []
|
||||
}
|
||||
],
|
||||
"TrackParam": {
|
||||
"routeLine_220e5b3c-270d-4006-87f0-a0ab4b22deda": {
|
||||
"name": "F-22航线1",
|
||||
"StartTime": 0,
|
||||
"EndTime": 1657,
|
||||
"TrackType": "routeLineAir",
|
||||
"HeightType": "msl",
|
||||
"seaType": "seaLevel",
|
||||
"TrackPoints": [
|
||||
{
|
||||
"index": "1",
|
||||
"longitude": "124.69258218394617",
|
||||
"latitude": "27.801527639000142",
|
||||
"height": "6000",
|
||||
"speed": "600",
|
||||
"psia": "0",
|
||||
"time": 0,
|
||||
"active": "null"
|
||||
},
|
||||
{
|
||||
"index": "2",
|
||||
"longitude": "122.9223606765063",
|
||||
"latitude": "27.585793910609084",
|
||||
"height": "6000",
|
||||
"speed": "600",
|
||||
"psia": "0",
|
||||
"time": 0,
|
||||
"active": "null"
|
||||
},
|
||||
{
|
||||
"index": "3",
|
||||
"longitude": "121.59995205693548",
|
||||
"latitude": "27.41556157737817",
|
||||
"height": "6000",
|
||||
"speed": "600",
|
||||
"psia": "0",
|
||||
"time": 0,
|
||||
"active": "null"
|
||||
},
|
||||
{
|
||||
"index": "4",
|
||||
"longitude": "121.00161216798338",
|
||||
"latitude": "27.07354384591234",
|
||||
"height": "6000",
|
||||
"speed": "600",
|
||||
"psia": "0",
|
||||
"time": 0,
|
||||
"active": "null"
|
||||
},
|
||||
{
|
||||
"index": "5",
|
||||
"longitude": "121.0190476615353",
|
||||
"latitude": "26.599336790536423",
|
||||
"height": "6000",
|
||||
"speed": "600",
|
||||
"psia": "0",
|
||||
"time": 0,
|
||||
"active": "null"
|
||||
},
|
||||
{
|
||||
"index": "6",
|
||||
"longitude": "121.67869100949231",
|
||||
"latitude": "26.183061747705537",
|
||||
"height": "6000",
|
||||
"speed": "600",
|
||||
"psia": "0",
|
||||
"time": 0,
|
||||
"active": "null"
|
||||
},
|
||||
{
|
||||
"index": "7",
|
||||
"longitude": "123.7900051477299",
|
||||
"latitude": "25.733670416880216",
|
||||
"height": "6000",
|
||||
"speed": "600",
|
||||
"psia": "0",
|
||||
"time": 0,
|
||||
"active": "null"
|
||||
},
|
||||
{
|
||||
"index": "8",
|
||||
"longitude": "125.47545066085917",
|
||||
"latitude": "26.136857380879235",
|
||||
"height": "6000",
|
||||
"speed": "600",
|
||||
"psia": "0",
|
||||
"time": 0,
|
||||
"active": "null"
|
||||
}
|
||||
],
|
||||
"Color": "rgb(4,161,246)",
|
||||
"PointCount": 8
|
||||
},
|
||||
"Groups": [
|
||||
{
|
||||
"allAngle": 0,
|
||||
"drawName": "J15编组1",
|
||||
"editPermission": [],
|
||||
"groupType": "addGroup",
|
||||
"id": "5dea9ff7-5e45-4f8e-a67f-3ff4187c39ed",
|
||||
"idKey": "id",
|
||||
"isSelected": false,
|
||||
"isShow": false,
|
||||
"leader": "7a16c098-ceec-4c4d-8a24-8f44976a90ca",
|
||||
"name": "addGroup",
|
||||
"parentId": "56a96b1b-14a8-4daf-a2d0-47c7faa4b831_batFormation",
|
||||
"permission": [
|
||||
"14bc8ff9-3c93-4218-b01a-e144add196f9"
|
||||
],
|
||||
"show": false,
|
||||
"sort": 1774271497726,
|
||||
"wingmanData": [
|
||||
{
|
||||
"alt": 40,
|
||||
"angle": "50",
|
||||
"distance": 100,
|
||||
"key": 0,
|
||||
"name": "9aa9e5aa-9273-4c27-88e1-e582ff561685"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"redWeapons": [
|
||||
{
|
||||
"SupportType": "car",
|
||||
"TroopsDetail": {},
|
||||
"Platform_type": "HQ-9发射车",
|
||||
"isStrikeTarget": false,
|
||||
"isReconTarget": false,
|
||||
"isInterferenceTarget": false,
|
||||
"isDefendImportantPlace": false,
|
||||
"groupType": "equipment",
|
||||
"EquipmentID": "b3c6de29-2b27-4500-a9ce-95d0bebc5cb9",
|
||||
"Name": "HQ-9发射车--5",
|
||||
"OwnerForceSide": "56a96b1b-14a8-4daf-a2d0-47c7faa4b831",
|
||||
"PlatID": "56a96b1b-14a8-4daf-a2d0-47c7faa4b831_equipmentPlane",
|
||||
"SubComponents": {
|
||||
"communication": [
|
||||
{
|
||||
"ObjectHandle": "3ed86636-a33a-41ac-aff2-0627eb1f9b28",
|
||||
"arithmetic": {
|
||||
"id": "66cd29fdce08f520f1d9bf0e",
|
||||
"name": "短波电台"
|
||||
},
|
||||
"device": {
|
||||
"id": "5e0e5b064f1fae2ee9fa1000",
|
||||
"name": "3MHZ通信电台",
|
||||
"refId": "5e0e5b064f1fae2ee9fa1000"
|
||||
},
|
||||
"deviceId": "0b700ca6-290e-422a-b4e3-73b222809938",
|
||||
"deviceName": "3MHZ通信电台",
|
||||
"employLabel": false,
|
||||
"facilityName": "3MHZ通信电台",
|
||||
"soleId": "3ed86636-a33a-41ac-aff2-0627eb1f9b28",
|
||||
"twiceModified": {},
|
||||
"zLists": [],
|
||||
"ParentPlat": "04a96dbc-837a-48be-8c04-e4f53586c47e"
|
||||
}
|
||||
],
|
||||
"motorized_assembly": [
|
||||
{
|
||||
"ObjectHandle": "83ea5d33-90f4-4fd8-9121-eced6c7a44ea",
|
||||
"arithmetic": {},
|
||||
"device": {},
|
||||
"deviceId": "55915bc4-c825-43c4-93eb-6a76ab345e42",
|
||||
"deviceName": "",
|
||||
"soleId": "83ea5d33-90f4-4fd8-9121-eced6c7a44ea",
|
||||
"ParentPlat": "04a96dbc-837a-48be-8c04-e4f53586c47e"
|
||||
}
|
||||
],
|
||||
"platform": [
|
||||
{
|
||||
"ObjectHandle": "04a96dbc-837a-48be-8c04-e4f53586c47e",
|
||||
"arithmetic": {
|
||||
"id": "68876d0fd41989f086e905b8",
|
||||
"name": "通用发射车算法"
|
||||
},
|
||||
"device": {
|
||||
"id": "68876d2dd41989f086e905b9",
|
||||
"name": "发射车平台",
|
||||
"refId": "68876d2dd41989f086e905b9"
|
||||
},
|
||||
"deviceId": "164c75ec-6db5-48f9-8285-a7e726fd2a11",
|
||||
"deviceName": "发射车平台",
|
||||
"employLabel": false,
|
||||
"facilityName": "发射车平台",
|
||||
"soleId": "87905d6b-857a-4c5a-a922-5e2d191588d4",
|
||||
"twiceModified": {},
|
||||
"zLists": [],
|
||||
"TrackParamId": "",
|
||||
"positions": [
|
||||
119.28585462691,
|
||||
25.67974332623,
|
||||
34.28352933882
|
||||
]
|
||||
}
|
||||
],
|
||||
"weapon": [
|
||||
{
|
||||
"ObjectHandle": "4e575d4d-2f36-436b-9939-0b96cde96b89",
|
||||
"arithmetic": {
|
||||
"id": "669dd6356bc286bd64e5d66c",
|
||||
"name": "发射架算法"
|
||||
},
|
||||
"codedQueue": "weapon.launcher",
|
||||
"configuration": {
|
||||
"classifyName": "导弹平台",
|
||||
"isMount": 1,
|
||||
"mountedWeapon": {
|
||||
"_id": "68f681794ddde62a52c7e569",
|
||||
"name": "HQ-9"
|
||||
},
|
||||
"number": 4
|
||||
},
|
||||
"device": {
|
||||
"id": "67ff279dafa7ea5aaa3a1236",
|
||||
"name": "通用发射架",
|
||||
"refId": "b9665788-9437-40fb-8a24-eff3d4d3b529"
|
||||
},
|
||||
"deviceId": "4e910ccf-d937-4a93-9b68-116167eda202",
|
||||
"deviceName": "通用发射架",
|
||||
"employLabel": false,
|
||||
"facilityName": "通用发射架",
|
||||
"serialNumber": "launcher",
|
||||
"soleId": "4e575d4d-2f36-436b-9939-0b96cde96b89",
|
||||
"twiceModified": {
|
||||
"launcherType": "sam"
|
||||
},
|
||||
"zLists": [],
|
||||
"ParentPlat": "04a96dbc-837a-48be-8c04-e4f53586c47e"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Tasks": [
|
||||
{
|
||||
"color": "rgb(220,39,39)",
|
||||
"dataType": "taskPlane",
|
||||
"drawName": "HQ-9发射车--3打击任务",
|
||||
"groupType": "tasks",
|
||||
"id": "41d3c5ce-3fda-4dee-a38f-fd3ae7e15e69",
|
||||
"idKey": "id",
|
||||
"isSelected": false,
|
||||
"name": "HQ-9发射车--3打击任务",
|
||||
"parentId": "56a96b1b-14a8-4daf-a2d0-47c7faa4b831_taskPlane",
|
||||
"permission": [
|
||||
"14bc8ff9-3c93-4218-b01a-e144add196f9",
|
||||
"56a96b1b-14a8-4daf-a2d0-47c7faa4b831"
|
||||
],
|
||||
"show": true,
|
||||
"side": "红方",
|
||||
"sort": 1774271151846,
|
||||
"task": {
|
||||
"at_time": "180",
|
||||
"attackId": "267c5d87-bf36-42f2-b0a8-09c608d94b62",
|
||||
"color": "rgb(220,39,39)",
|
||||
"departureAirport": "",
|
||||
"execute": [
|
||||
{
|
||||
"targetList": [
|
||||
{
|
||||
"ID": "fbddc49c-f7b0-4d07-8000-1b5a2633c461",
|
||||
"arrayPositionId": 4,
|
||||
"arrayPositionIdBak": "",
|
||||
"at_time": {
|
||||
"timeUp": true,
|
||||
"value": 180
|
||||
},
|
||||
"attackType": "",
|
||||
"boost": "",
|
||||
"bootTime": "",
|
||||
"companion": "",
|
||||
"cruiseRouteId": "routeLine_f01be820-33ca-4843-8354-3f93a9986fe3",
|
||||
"cruiseRouteOffset": [
|
||||
{
|
||||
"UpOrDown": true,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"BeforeOrAfter": true,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"LeftOrRight": true,
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
"moveRouteId": "routeLine_de092f0b-d8a3-4382-8e46-398efae3649c",
|
||||
"fireType": "absolute",
|
||||
"strategy": [],
|
||||
"targetId": "dd20d7d9-7ce8-4531-aa0c-0b2056e7fbcd",
|
||||
"times_interval": 1,
|
||||
"weaponId": "HQ-9",
|
||||
"weaponRelease": "",
|
||||
"weaponType": "",
|
||||
"weaponUseCount": 3
|
||||
}
|
||||
],
|
||||
"type": "assault"
|
||||
}
|
||||
],
|
||||
"landAirport": "",
|
||||
"missionList": [
|
||||
{
|
||||
"label": "HQ-9(4)",
|
||||
"launcherType": "sam",
|
||||
"number": 4,
|
||||
"value": "HQ-9"
|
||||
}
|
||||
],
|
||||
"name": "HQ-9发射车--3打击任务",
|
||||
"side": "红方",
|
||||
"sideId": "56a96b1b-14a8-4daf-a2d0-47c7faa4b831",
|
||||
"speed": 600,
|
||||
"type": "assault",
|
||||
"weaponId": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import java.util.Map;
|
||||
import static com.solution.rule.utils.RuleFunction.equipmentRule;
|
||||
import static com.solution.rule.utils.RuleFunction.target;
|
||||
import static com.solution.rule.utils.RuleFunction.position;
|
||||
import static com.solution.rule.utils.RuleFunction.trackRoute;
|
||||
import static com.solution.rule.utils.RuleFunction.groupFormation;
|
||||
|
||||
|
||||
global java.util.Map globalParams;
|
||||
@@ -147,6 +149,57 @@ function Map buildParam(){
|
||||
// minInterPlatformDistanceMeters:平台最小间距(米)下限,用于抑制平台点位过度重叠。
|
||||
param.put("minInterPlatformDistanceMeters", 80);
|
||||
|
||||
// ===================== 航迹规则参数(写入 TrackParam 动态 key + execute.targetList.moveRouteId) =====================
|
||||
// trackRuleEnabled:是否启用航迹生成与 moveRouteId 绑定。
|
||||
param.put("trackRuleEnabled", true);
|
||||
// trackRouteAlgorithm:航迹变形算法。followBlue(默认) / shortestPath / flank / jam
|
||||
param.put("trackRouteAlgorithm", "followBlue");
|
||||
// trackRouteNameSuffix:航迹名称 = 红方任务 drawName + 此后缀(默认「航迹」→ 如 xxx打击任务航迹)
|
||||
param.put("trackRouteNameSuffix", "航迹");
|
||||
// trackAirDataTypeCsv:蓝方 dataType 命中任一子串(忽略大小写)则 TrackType=routeLineAir
|
||||
param.put("trackAirDataTypeCsv", "taskPlane,air,plane,flight");
|
||||
// trackAirKeywordsCsv:蓝方 drawName 或红方 name/platformType 命中任一子串则视为飞行航迹
|
||||
param.put("trackAirKeywordsCsv", "机,飞,空,J-,F-,无人机,直升机");
|
||||
// trackGroundTrackType:非飞行类时 TrackType 取值(可先占位,后续再接地面路网)
|
||||
param.put("trackGroundTrackType", "routeLineGround");
|
||||
// 航迹侧向算法复用上方「阵位规则」中的 trackPointDirectionMode(head2next / tail2prev);缺省回退见 trackFallbackBearingDeg
|
||||
param.put("trackFallbackBearingDeg", 0);
|
||||
// enableTrackWarZoneClamp:航迹点是否约束在 warZoneLocation 多边形内
|
||||
param.put("enableTrackWarZoneClamp", true);
|
||||
// trackExtraNodesMax:在蓝方航迹点基础上最多额外插入的点数(0=与蓝方点数持平;>0 时在中段均匀插值)
|
||||
param.put("trackExtraNodesMax", 0);
|
||||
// shortestPath:相邻两点间直线插值分段数(>=1),越大折线越平滑(非真实路网最短路径)
|
||||
param.put("trackShortPathSegments", 3);
|
||||
// flank:侧向偏移距离(米);trackFlankSideMode:alternate / left / right
|
||||
param.put("trackFlankOffsetMeters", 800);
|
||||
param.put("trackFlankSideMode", "alternate");
|
||||
// jam:正弦扰动振幅(米)、沿航迹起伏周期数(越大摆动越密)
|
||||
param.put("trackJamWobbleMeters", 400);
|
||||
param.put("trackJamSegments", 4);
|
||||
|
||||
// ===================== 编组规则参数(写入 TrackParam.Groups + wingmanData) =====================
|
||||
// groupRuleEnabled:是否生成编组节点。
|
||||
param.put("groupRuleEnabled", true);
|
||||
// groupDrawNameSuffix:drawName = 领队装备 Name + 此后缀(默认「编组」)
|
||||
param.put("groupDrawNameSuffix", "编组");
|
||||
// groupDrawNameWithIndex:是否在 drawName 末尾追加序号(避免多组同名),如 J15编组1
|
||||
param.put("groupDrawNameWithIndex", false);
|
||||
// groupFormationMode:onePerRed(每件红装一组) / clusterByCount(按固定人数分组) / singleGroup(全部一组)
|
||||
param.put("groupFormationMode", "onePerRed");
|
||||
// groupClusterSize:clusterByCount 模式下每组人数上限(>=1)
|
||||
param.put("groupClusterSize", 3);
|
||||
// groupLeaderPickMode:byHitRateThenId(命中率高优先,平手 equipmentId 小) / byId(equipmentId 字典序最小)
|
||||
param.put("groupLeaderPickMode", "byHitRateThenId");
|
||||
// groupMinMembersForWingman:组内人数达到该值才生成 wingmanData(否则仅 leader 壳,僚机列表为空)
|
||||
param.put("groupMinMembersForWingman", 2);
|
||||
// wingman 几何参数(相对蓝方主航向 mainBearing 叠加)
|
||||
param.put("wingmanDistanceBaseMeters", 100);
|
||||
param.put("wingmanDistanceStepMeters", 50);
|
||||
param.put("wingmanAngleBaseDeg", 50);
|
||||
param.put("wingmanAngleStepDeg", 15);
|
||||
param.put("wingmanAltBaseMeters", 40);
|
||||
param.put("wingmanAltScale", 1.0);
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
@@ -179,3 +232,23 @@ then
|
||||
globalParams.putAll(buildParam());
|
||||
position($fact, globalParams);
|
||||
end
|
||||
|
||||
rule "航迹匹配"
|
||||
salience 70
|
||||
when
|
||||
$fact : DroolsFact(task != null)
|
||||
then
|
||||
// 显式航迹规则:填充 TrackParam 下各航迹 id,并绑定 execute[0].targetList[*].moveRouteId
|
||||
globalParams.putAll(buildParam());
|
||||
trackRoute($fact, globalParams);
|
||||
end
|
||||
|
||||
rule "编组匹配"
|
||||
salience 60
|
||||
when
|
||||
$fact : DroolsFact(task != null)
|
||||
then
|
||||
// 显式编组规则:填充 TrackParam.Groups(groupType=addGroup)与 wingmanData
|
||||
globalParams.putAll(buildParam());
|
||||
groupFormation($fact, globalParams);
|
||||
end
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-behaviour</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -2,6 +2,7 @@ package com.solution.scene.mapper;
|
||||
|
||||
import com.solution.scene.domain.AfsimScenario;
|
||||
import com.solution.scene.domain.AfsimScenarioForm;
|
||||
import com.solution.system.domain.Behaviortree;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -26,4 +27,11 @@ public interface SceneMapper {
|
||||
List<AfsimScenario> selectSceneList();
|
||||
|
||||
AfsimScenario findOneById(Long id);
|
||||
|
||||
/**
|
||||
* 根据场景id获取场景下所有行为树
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Behaviortree> selectAllTreeBySceneId(Integer id);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.solution.scene.service;
|
||||
|
||||
import com.solution.scene.domain.AfsimScenario;
|
||||
import com.solution.scene.domain.AfsimScenarioForm;
|
||||
import com.solution.system.domain.Behaviortree;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,4 +26,11 @@ public interface SceneService {
|
||||
List<AfsimScenario> selectSceneList();
|
||||
|
||||
AfsimScenario findOneById(Long id);
|
||||
|
||||
/**
|
||||
* 根据场景id获取场景下所有行为树
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Behaviortree> getAllTree(Integer id);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.solution.scene.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.solution.common.constant.ExceptionConstants;
|
||||
import com.solution.scene.domain.AfsimScenario;
|
||||
import com.solution.scene.domain.AfsimScenarioForm;
|
||||
import com.solution.scene.mapper.PlatFormCommunicationMapper;
|
||||
import com.solution.scene.mapper.SceneMapper;
|
||||
import com.solution.scene.service.SceneService;
|
||||
import com.solution.system.domain.Behaviortree;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -70,4 +73,21 @@ public class SceneServiceImpl implements SceneService {
|
||||
return sceneMapper.findOneById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据场景id获取场景下所有行为树
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Behaviortree> getAllTree(Integer id) {
|
||||
if(null == id || id <= 0){
|
||||
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
||||
}
|
||||
List<Behaviortree> allTree = sceneMapper.selectAllTreeBySceneId(id);
|
||||
if(CollUtil.isEmpty(allTree)){
|
||||
throw new RuntimeException("该场景下不存在行为树");
|
||||
}
|
||||
return allTree;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectSceneList" resultMap="SceneMap">
|
||||
SELECT id, name, description, scenario_path, communication_graph FROM afsim_scenario
|
||||
</select>
|
||||
<select id="selectAllTreeBySceneId" resultType="com.solution.system.domain.Behaviortree"
|
||||
parameterType="java.lang.Integer">
|
||||
SELECT id, name, description, created_at, updated_at, english_name, graph,xml_content,platform_id,scenario_id
|
||||
FROM behaviortree
|
||||
WHERE scenario_id=#{id}
|
||||
</select>
|
||||
|
||||
<insert id="update" parameterType="com.solution.scene.domain.AfsimScenario">
|
||||
update afsim_scenario
|
||||
|
||||
4
auto-solution-system/Dockerfile
Normal file
4
auto-solution-system/Dockerfile
Normal file
@@ -0,0 +1,4 @@
|
||||
# 已废弃:请在仓库根目录使用 Dockerfile 与 docker-compose.yml 构建镜像。
|
||||
# Deprecated — use the Dockerfile at the repository root.
|
||||
FROM alpine:3.19
|
||||
RUN echo "ERROR: build from repo root (../Dockerfile). See docker/README.md" >&2 && exit 1
|
||||
98
docker-compose.yml
Normal file
98
docker-compose.yml
Normal file
@@ -0,0 +1,98 @@
|
||||
# 若依后端 + MySQL 8 + Redis 7
|
||||
# 使用:1) 将 SQL 放入 docker/mysql/init/(见该目录 README)
|
||||
# 2) 复制 .env.example 为 .env 并按需修改密码
|
||||
# 3) docker compose up -d --build
|
||||
#
|
||||
# 应用访问:http://localhost:1777(容器内 8080 映射到宿主机 1777)
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: autosolution-mysql-preloaded:latest
|
||||
container_name: autosolution-mysql
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-autosolution_db}
|
||||
TZ: Asia/Shanghai
|
||||
command:
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_unicode_ci
|
||||
- --default-authentication-plugin=mysql_native_password
|
||||
ports:
|
||||
- "${MYSQL_PORT:-3307}:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- ./docker/mysql/init:/docker-entrypoint-initdb.d:ro
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD-SHELL",
|
||||
"mysql -h 127.0.0.1 -uroot -p$MYSQL_ROOT_PASSWORD -Nse 'SELECT 1 FROM information_schema.tables WHERE table_schema=\"$MYSQL_DATABASE\" AND table_name=\"sys_config\" LIMIT 1' | grep -q 1",
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 40s
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: autosolution-redis
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
command:
|
||||
- |
|
||||
if [ -n "$$REDIS_PASSWORD" ]; then
|
||||
exec redis-server --appendonly yes --requirepass "$$REDIS_PASSWORD"
|
||||
else
|
||||
exec redis-server --appendonly yes
|
||||
fi
|
||||
ports:
|
||||
- "${REDIS_PORT:-6379}:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD-SHELL",
|
||||
'if [ -n "$$REDIS_PASSWORD" ]; then redis-cli -a "$$REDIS_PASSWORD" ping | grep -q PONG; else redis-cli ping | grep -q PONG; fi',
|
||||
]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
app:
|
||||
# 运行已构建好的应用镜像(推荐:在有网络的机器上 docker build,然后 docker save/load 到 CentOS)
|
||||
# 如需在本机从 Dockerfile 构建,请在另一份 compose 文件中加入 build 配置,或临时手动 docker build。
|
||||
image: auto-solution-admin:${APP_IMAGE_TAG:-latest}
|
||||
container_name: autosolution-app
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: "3306"
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-autosolution_db}
|
||||
MYSQL_USER: root
|
||||
MYSQL_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: "6379"
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
|
||||
REDIS_DB: "0"
|
||||
SERVER_PORT: "8080"
|
||||
SOLUTION_UPLOAD_PATH: /app/uploadPath
|
||||
TZ: Asia/Shanghai
|
||||
JAVA_OPTS: ${JAVA_OPTS:--Xms512m -Xmx1024m}
|
||||
ports:
|
||||
- "${APP_PORT:-1777}:8080"
|
||||
volumes:
|
||||
- app_upload:/app/uploadPath
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
redis_data:
|
||||
app_upload:
|
||||
52
docker/README.md
Normal file
52
docker/README.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# Docker 部署说明
|
||||
|
||||
## 前置条件
|
||||
|
||||
- 安装 [Docker Desktop](https://www.docker.com/products/docker-desktop/)(Windows 需开启 WSL2)。
|
||||
- 项目根目录:`auto-solution`(与 `Dockerfile`、`docker-compose.yml` 同级)。
|
||||
|
||||
## 快速开始
|
||||
|
||||
1. **准备数据库脚本**(首次必做)
|
||||
将 SQL 放到 `docker/mysql/init/`,详见 [mysql/init/README.md](mysql/init/README.md)。
|
||||
|
||||
2. **环境变量(可选)**
|
||||
|
||||
```bash
|
||||
copy .env.example .env
|
||||
```
|
||||
|
||||
按需修改 `MYSQL_ROOT_PASSWORD`、`REDIS_PASSWORD` 等;若 Redis 设密码,需在 `.env` 中填写 `REDIS_PASSWORD`,并与应用一致。
|
||||
|
||||
3. **构建并启动**
|
||||
|
||||
```bash
|
||||
docker compose build
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
4. **访问**
|
||||
|
||||
- 后端:<http://localhost:1777>(默认映射,可在 `.env` 改 `APP_PORT`)
|
||||
- MySQL:宿主机端口默认 `3307`(避免与本机 3306 冲突)
|
||||
- Redis:宿主机端口默认 `6379`(与容器内端口一致,可通过 `.env` 中 `REDIS_PORT` 修改)
|
||||
|
||||
## 仅构建应用镜像
|
||||
|
||||
```bash
|
||||
docker build -t auto-solution-admin:latest .
|
||||
```
|
||||
|
||||
## 配置说明
|
||||
|
||||
- 容器内使用 Spring 配置:`druid` + `docker`,见 `auto-solution-admin/src/main/resources/application-docker.yml`。
|
||||
- 数据源与 Redis 主机名在 Compose 中为 `mysql`、`redis`,勿改服务名除非同步改配置。
|
||||
|
||||
## 上传文件
|
||||
|
||||
附件目录使用数据卷 `app_upload`,持久化在 Docker volume `autosolution_app_upload`(名称前缀随项目目录可能略有不同)。
|
||||
|
||||
## 常见问题
|
||||
|
||||
- **应用连不上库**:确认 MySQL 健康检查已通过;`init` SQL 是否已执行(空库首次启动才会执行)。
|
||||
- **Redis 认证失败**:本仓库 `application.yml` 里开发环境 Redis 带密码;Compose 中 Redis 默认无密码。若需密码,在 `.env` 设置 `REDIS_PASSWORD`,并确保与 `application-docker.yml` 中 `REDIS_PASSWORD` 环境变量一致(已支持 `${REDIS_PASSWORD}`)。
|
||||
0
docker/mysql/init/.gitkeep
Normal file
0
docker/mysql/init/.gitkeep
Normal file
2
docker/mysql/init/00-create-db.sql
Normal file
2
docker/mysql/init/00-create-db.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
CREATE DATABASE IF NOT EXISTS autosolution_db DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
USE autosolution_db;
|
||||
704
docker/mysql/init/01-ruoyi-extra.sql.sql
Normal file
704
docker/mysql/init/01-ruoyi-extra.sql.sql
Normal file
@@ -0,0 +1,704 @@
|
||||
-- ----------------------------
|
||||
-- 1、部门表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_dept;
|
||||
create table sys_dept (
|
||||
dept_id bigint(20) not null auto_increment comment '部门id',
|
||||
parent_id bigint(20) default 0 comment '父部门id',
|
||||
ancestors varchar(50) default '' comment '祖级列表',
|
||||
dept_name varchar(30) default '' comment '部门名称',
|
||||
order_num int(4) default 0 comment '显示顺序',
|
||||
leader varchar(20) default null comment '负责人',
|
||||
phone varchar(11) default null comment '联系电话',
|
||||
email varchar(50) default null comment '邮箱',
|
||||
status char(1) default '0' comment '部门状态(0正常 1停用)',
|
||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
primary key (dept_id)
|
||||
) engine=innodb auto_increment=200 comment = '部门表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-部门表数据
|
||||
-- ----------------------------
|
||||
insert into sys_dept values(100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
||||
insert into sys_dept values(101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
||||
insert into sys_dept values(102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
||||
insert into sys_dept values(103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
||||
insert into sys_dept values(104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
||||
insert into sys_dept values(105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
||||
insert into sys_dept values(106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
||||
insert into sys_dept values(107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
||||
insert into sys_dept values(108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
||||
insert into sys_dept values(109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 2、用户信息表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_user;
|
||||
create table sys_user (
|
||||
user_id bigint(20) not null auto_increment comment '用户ID',
|
||||
dept_id bigint(20) default null comment '部门ID',
|
||||
user_name varchar(30) not null comment '用户账号',
|
||||
nick_name varchar(30) not null comment '用户昵称',
|
||||
user_type varchar(2) default '00' comment '用户类型(00系统用户)',
|
||||
email varchar(50) default '' comment '用户邮箱',
|
||||
phonenumber varchar(11) default '' comment '手机号码',
|
||||
sex char(1) default '0' comment '用户性别(0男 1女 2未知)',
|
||||
avatar varchar(100) default '' comment '头像地址',
|
||||
password varchar(100) default '' comment '密码',
|
||||
status char(1) default '0' comment '账号状态(0正常 1停用)',
|
||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||
login_ip varchar(128) default '' comment '最后登录IP',
|
||||
login_date datetime comment '最后登录时间',
|
||||
pwd_update_date datetime comment '密码最后更新时间',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(500) default null comment '备注',
|
||||
primary key (user_id)
|
||||
) engine=innodb auto_increment=100 comment = '用户信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-用户信息表数据
|
||||
-- ----------------------------
|
||||
insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), sysdate(), 'admin', sysdate(), '', null, '管理员');
|
||||
insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), sysdate(), 'admin', sysdate(), '', null, '测试员');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 3、岗位信息表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_post;
|
||||
create table sys_post
|
||||
(
|
||||
post_id bigint(20) not null auto_increment comment '岗位ID',
|
||||
post_code varchar(64) not null comment '岗位编码',
|
||||
post_name varchar(50) not null comment '岗位名称',
|
||||
post_sort int(4) not null comment '显示顺序',
|
||||
status char(1) not null comment '状态(0正常 1停用)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(500) default null comment '备注',
|
||||
primary key (post_id)
|
||||
) engine=innodb comment = '岗位信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-岗位信息表数据
|
||||
-- ----------------------------
|
||||
insert into sys_post values(1, 'ceo', '董事长', 1, '0', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_post values(2, 'se', '项目经理', 2, '0', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_post values(3, 'hr', '人力资源', 3, '0', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_post values(4, 'user', '普通员工', 4, '0', 'admin', sysdate(), '', null, '');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 4、角色信息表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_role;
|
||||
create table sys_role (
|
||||
role_id bigint(20) not null auto_increment comment '角色ID',
|
||||
role_name varchar(30) not null comment '角色名称',
|
||||
role_key varchar(100) not null comment '角色权限字符串',
|
||||
role_sort int(4) not null comment '显示顺序',
|
||||
data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)',
|
||||
menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示',
|
||||
dept_check_strictly tinyint(1) default 1 comment '部门树选择项是否关联显示',
|
||||
status char(1) not null comment '角色状态(0正常 1停用)',
|
||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(500) default null comment '备注',
|
||||
primary key (role_id)
|
||||
) engine=innodb auto_increment=100 comment = '角色信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-角色信息表数据
|
||||
-- ----------------------------
|
||||
insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate(), '', null, '超级管理员');
|
||||
insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 5、菜单权限表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_menu;
|
||||
create table sys_menu (
|
||||
menu_id bigint(20) not null auto_increment comment '菜单ID',
|
||||
menu_name varchar(50) not null comment '菜单名称',
|
||||
parent_id bigint(20) default 0 comment '父菜单ID',
|
||||
order_num int(4) default 0 comment '显示顺序',
|
||||
path varchar(200) default '' comment '路由地址',
|
||||
component varchar(255) default null comment '组件路径',
|
||||
query varchar(255) default null comment '路由参数',
|
||||
route_name varchar(50) default '' comment '路由名称',
|
||||
is_frame int(1) default 1 comment '是否为外链(0是 1否)',
|
||||
is_cache int(1) default 0 comment '是否缓存(0缓存 1不缓存)',
|
||||
menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)',
|
||||
visible char(1) default 0 comment '菜单状态(0显示 1隐藏)',
|
||||
status char(1) default 0 comment '菜单状态(0正常 1停用)',
|
||||
perms varchar(100) default null comment '权限标识',
|
||||
icon varchar(100) default '#' comment '菜单图标',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(500) default '' comment '备注',
|
||||
primary key (menu_id)
|
||||
) engine=innodb auto_increment=2000 comment = '菜单权限表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-菜单信息表数据
|
||||
-- ----------------------------
|
||||
-- 一级菜单
|
||||
insert into sys_menu values('1', '系统管理', '0', '1', 'system', null, '', '', 1, 0, 'M', '0', '0', '', 'system', 'admin', sysdate(), '', null, '系统管理目录');
|
||||
insert into sys_menu values('2', '系统监控', '0', '2', 'monitor', null, '', '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', sysdate(), '', null, '系统监控目录');
|
||||
insert into sys_menu values('3', '系统工具', '0', '3', 'tool', null, '', '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', sysdate(), '', null, '系统工具目录');
|
||||
insert into sys_menu values('4', '若依官网', '0', '4', 'http://ruoyi.vip', null, '', '', 0, 0, 'M', '0', '0', '', 'guide', 'admin', sysdate(), '', null, '若依官网地址');
|
||||
-- 二级菜单
|
||||
insert into sys_menu values('100', '用户管理', '1', '1', 'user', 'system/user/index', '', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', sysdate(), '', null, '用户管理菜单');
|
||||
insert into sys_menu values('101', '角色管理', '1', '2', 'role', 'system/role/index', '', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', sysdate(), '', null, '角色管理菜单');
|
||||
insert into sys_menu values('102', '菜单管理', '1', '3', 'menu', 'system/menu/index', '', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', sysdate(), '', null, '菜单管理菜单');
|
||||
insert into sys_menu values('103', '部门管理', '1', '4', 'dept', 'system/dept/index', '', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', sysdate(), '', null, '部门管理菜单');
|
||||
insert into sys_menu values('104', '岗位管理', '1', '5', 'post', 'system/post/index', '', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', sysdate(), '', null, '岗位管理菜单');
|
||||
insert into sys_menu values('105', '字典管理', '1', '6', 'dict', 'system/dict/index', '', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', sysdate(), '', null, '字典管理菜单');
|
||||
insert into sys_menu values('106', '参数设置', '1', '7', 'config', 'system/config/index', '', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', sysdate(), '', null, '参数设置菜单');
|
||||
insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '通知公告菜单');
|
||||
insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单');
|
||||
insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单');
|
||||
insert into sys_menu values('110', '定时任务', '2', '2', 'job', 'monitor/job/index', '', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单');
|
||||
insert into sys_menu values('111', '数据监控', '2', '3', 'druid', 'monitor/druid/index', '', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate(), '', null, '数据监控菜单');
|
||||
insert into sys_menu values('112', '服务监控', '2', '4', 'server', 'monitor/server/index', '', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单');
|
||||
insert into sys_menu values('113', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', sysdate(), '', null, '缓存监控菜单');
|
||||
insert into sys_menu values('114', '缓存列表', '2', '6', 'cacheList', 'monitor/cache/list', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis-list', 'admin', sysdate(), '', null, '缓存列表菜单');
|
||||
insert into sys_menu values('115', '表单构建', '3', '1', 'build', 'tool/build/index', '', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单');
|
||||
insert into sys_menu values('116', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单');
|
||||
insert into sys_menu values('117', '系统接口', '3', '3', 'swagger', 'tool/swagger/index', '', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单');
|
||||
-- 三级菜单
|
||||
insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'monitor/operlog/index', '', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单');
|
||||
insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'monitor/logininfor/index', '', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单');
|
||||
-- 用户管理按钮
|
||||
insert into sys_menu values('1000', '用户查询', '100', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1001', '用户新增', '100', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1002', '用户修改', '100', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1003', '用户删除', '100', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1004', '用户导出', '100', '5', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1005', '用户导入', '100', '6', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1006', '重置密码', '100', '7', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 角色管理按钮
|
||||
insert into sys_menu values('1007', '角色查询', '101', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1008', '角色新增', '101', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1009', '角色修改', '101', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1010', '角色删除', '101', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1011', '角色导出', '101', '5', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 菜单管理按钮
|
||||
insert into sys_menu values('1012', '菜单查询', '102', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1013', '菜单新增', '102', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1014', '菜单修改', '102', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1015', '菜单删除', '102', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 部门管理按钮
|
||||
insert into sys_menu values('1016', '部门查询', '103', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1017', '部门新增', '103', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1018', '部门修改', '103', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1019', '部门删除', '103', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 岗位管理按钮
|
||||
insert into sys_menu values('1020', '岗位查询', '104', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1021', '岗位新增', '104', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1022', '岗位修改', '104', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1023', '岗位删除', '104', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1024', '岗位导出', '104', '5', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 字典管理按钮
|
||||
insert into sys_menu values('1025', '字典查询', '105', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1026', '字典新增', '105', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1027', '字典修改', '105', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1028', '字典删除', '105', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1029', '字典导出', '105', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 参数设置按钮
|
||||
insert into sys_menu values('1030', '参数查询', '106', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1031', '参数新增', '106', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1032', '参数修改', '106', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1033', '参数删除', '106', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1034', '参数导出', '106', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 通知公告按钮
|
||||
insert into sys_menu values('1035', '公告查询', '107', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1036', '公告新增', '107', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1037', '公告修改', '107', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1038', '公告删除', '107', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 操作日志按钮
|
||||
insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1041', '日志导出', '500', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 登录日志按钮
|
||||
insert into sys_menu values('1042', '登录查询', '501', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1043', '登录删除', '501', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1044', '日志导出', '501', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1045', '账户解锁', '501', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 在线用户按钮
|
||||
insert into sys_menu values('1046', '在线查询', '109', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1047', '批量强退', '109', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1048', '单条强退', '109', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 定时任务按钮
|
||||
insert into sys_menu values('1049', '任务查询', '110', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1050', '任务新增', '110', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1051', '任务修改', '110', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1052', '任务删除', '110', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1053', '状态修改', '110', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1054', '任务导出', '110', '6', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', sysdate(), '', null, '');
|
||||
-- 代码生成按钮
|
||||
insert into sys_menu values('1055', '生成查询', '116', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1056', '生成修改', '116', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1057', '生成删除', '116', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1058', '导入代码', '116', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1059', '预览代码', '116', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_menu values('1060', '生成代码', '116', '6', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 6、用户和角色关联表 用户N-1角色
|
||||
-- ----------------------------
|
||||
drop table if exists sys_user_role;
|
||||
create table sys_user_role (
|
||||
user_id bigint(20) not null comment '用户ID',
|
||||
role_id bigint(20) not null comment '角色ID',
|
||||
primary key(user_id, role_id)
|
||||
) engine=innodb comment = '用户和角色关联表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-用户和角色关联表数据
|
||||
-- ----------------------------
|
||||
insert into sys_user_role values ('1', '1');
|
||||
insert into sys_user_role values ('2', '2');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 7、角色和菜单关联表 角色1-N菜单
|
||||
-- ----------------------------
|
||||
drop table if exists sys_role_menu;
|
||||
create table sys_role_menu (
|
||||
role_id bigint(20) not null comment '角色ID',
|
||||
menu_id bigint(20) not null comment '菜单ID',
|
||||
primary key(role_id, menu_id)
|
||||
) engine=innodb comment = '角色和菜单关联表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-角色和菜单关联表数据
|
||||
-- ----------------------------
|
||||
insert into sys_role_menu values ('2', '1');
|
||||
insert into sys_role_menu values ('2', '2');
|
||||
insert into sys_role_menu values ('2', '3');
|
||||
insert into sys_role_menu values ('2', '4');
|
||||
insert into sys_role_menu values ('2', '100');
|
||||
insert into sys_role_menu values ('2', '101');
|
||||
insert into sys_role_menu values ('2', '102');
|
||||
insert into sys_role_menu values ('2', '103');
|
||||
insert into sys_role_menu values ('2', '104');
|
||||
insert into sys_role_menu values ('2', '105');
|
||||
insert into sys_role_menu values ('2', '106');
|
||||
insert into sys_role_menu values ('2', '107');
|
||||
insert into sys_role_menu values ('2', '108');
|
||||
insert into sys_role_menu values ('2', '109');
|
||||
insert into sys_role_menu values ('2', '110');
|
||||
insert into sys_role_menu values ('2', '111');
|
||||
insert into sys_role_menu values ('2', '112');
|
||||
insert into sys_role_menu values ('2', '113');
|
||||
insert into sys_role_menu values ('2', '114');
|
||||
insert into sys_role_menu values ('2', '115');
|
||||
insert into sys_role_menu values ('2', '116');
|
||||
insert into sys_role_menu values ('2', '117');
|
||||
insert into sys_role_menu values ('2', '500');
|
||||
insert into sys_role_menu values ('2', '501');
|
||||
insert into sys_role_menu values ('2', '1000');
|
||||
insert into sys_role_menu values ('2', '1001');
|
||||
insert into sys_role_menu values ('2', '1002');
|
||||
insert into sys_role_menu values ('2', '1003');
|
||||
insert into sys_role_menu values ('2', '1004');
|
||||
insert into sys_role_menu values ('2', '1005');
|
||||
insert into sys_role_menu values ('2', '1006');
|
||||
insert into sys_role_menu values ('2', '1007');
|
||||
insert into sys_role_menu values ('2', '1008');
|
||||
insert into sys_role_menu values ('2', '1009');
|
||||
insert into sys_role_menu values ('2', '1010');
|
||||
insert into sys_role_menu values ('2', '1011');
|
||||
insert into sys_role_menu values ('2', '1012');
|
||||
insert into sys_role_menu values ('2', '1013');
|
||||
insert into sys_role_menu values ('2', '1014');
|
||||
insert into sys_role_menu values ('2', '1015');
|
||||
insert into sys_role_menu values ('2', '1016');
|
||||
insert into sys_role_menu values ('2', '1017');
|
||||
insert into sys_role_menu values ('2', '1018');
|
||||
insert into sys_role_menu values ('2', '1019');
|
||||
insert into sys_role_menu values ('2', '1020');
|
||||
insert into sys_role_menu values ('2', '1021');
|
||||
insert into sys_role_menu values ('2', '1022');
|
||||
insert into sys_role_menu values ('2', '1023');
|
||||
insert into sys_role_menu values ('2', '1024');
|
||||
insert into sys_role_menu values ('2', '1025');
|
||||
insert into sys_role_menu values ('2', '1026');
|
||||
insert into sys_role_menu values ('2', '1027');
|
||||
insert into sys_role_menu values ('2', '1028');
|
||||
insert into sys_role_menu values ('2', '1029');
|
||||
insert into sys_role_menu values ('2', '1030');
|
||||
insert into sys_role_menu values ('2', '1031');
|
||||
insert into sys_role_menu values ('2', '1032');
|
||||
insert into sys_role_menu values ('2', '1033');
|
||||
insert into sys_role_menu values ('2', '1034');
|
||||
insert into sys_role_menu values ('2', '1035');
|
||||
insert into sys_role_menu values ('2', '1036');
|
||||
insert into sys_role_menu values ('2', '1037');
|
||||
insert into sys_role_menu values ('2', '1038');
|
||||
insert into sys_role_menu values ('2', '1039');
|
||||
insert into sys_role_menu values ('2', '1040');
|
||||
insert into sys_role_menu values ('2', '1041');
|
||||
insert into sys_role_menu values ('2', '1042');
|
||||
insert into sys_role_menu values ('2', '1043');
|
||||
insert into sys_role_menu values ('2', '1044');
|
||||
insert into sys_role_menu values ('2', '1045');
|
||||
insert into sys_role_menu values ('2', '1046');
|
||||
insert into sys_role_menu values ('2', '1047');
|
||||
insert into sys_role_menu values ('2', '1048');
|
||||
insert into sys_role_menu values ('2', '1049');
|
||||
insert into sys_role_menu values ('2', '1050');
|
||||
insert into sys_role_menu values ('2', '1051');
|
||||
insert into sys_role_menu values ('2', '1052');
|
||||
insert into sys_role_menu values ('2', '1053');
|
||||
insert into sys_role_menu values ('2', '1054');
|
||||
insert into sys_role_menu values ('2', '1055');
|
||||
insert into sys_role_menu values ('2', '1056');
|
||||
insert into sys_role_menu values ('2', '1057');
|
||||
insert into sys_role_menu values ('2', '1058');
|
||||
insert into sys_role_menu values ('2', '1059');
|
||||
insert into sys_role_menu values ('2', '1060');
|
||||
|
||||
-- ----------------------------
|
||||
-- 8、角色和部门关联表 角色1-N部门
|
||||
-- ----------------------------
|
||||
drop table if exists sys_role_dept;
|
||||
create table sys_role_dept (
|
||||
role_id bigint(20) not null comment '角色ID',
|
||||
dept_id bigint(20) not null comment '部门ID',
|
||||
primary key(role_id, dept_id)
|
||||
) engine=innodb comment = '角色和部门关联表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-角色和部门关联表数据
|
||||
-- ----------------------------
|
||||
insert into sys_role_dept values ('2', '100');
|
||||
insert into sys_role_dept values ('2', '101');
|
||||
insert into sys_role_dept values ('2', '105');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 9、用户与岗位关联表 用户1-N岗位
|
||||
-- ----------------------------
|
||||
drop table if exists sys_user_post;
|
||||
create table sys_user_post
|
||||
(
|
||||
user_id bigint(20) not null comment '用户ID',
|
||||
post_id bigint(20) not null comment '岗位ID',
|
||||
primary key (user_id, post_id)
|
||||
) engine=innodb comment = '用户与岗位关联表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-用户与岗位关联表数据
|
||||
-- ----------------------------
|
||||
insert into sys_user_post values ('1', '1');
|
||||
insert into sys_user_post values ('2', '2');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 10、操作日志记录
|
||||
-- ----------------------------
|
||||
drop table if exists sys_oper_log;
|
||||
create table sys_oper_log (
|
||||
oper_id bigint(20) not null auto_increment comment '日志主键',
|
||||
title varchar(50) default '' comment '模块标题',
|
||||
business_type int(2) default 0 comment '业务类型(0其它 1新增 2修改 3删除)',
|
||||
method varchar(200) default '' comment '方法名称',
|
||||
request_method varchar(10) default '' comment '请求方式',
|
||||
operator_type int(1) default 0 comment '操作类别(0其它 1后台用户 2手机端用户)',
|
||||
oper_name varchar(50) default '' comment '操作人员',
|
||||
dept_name varchar(50) default '' comment '部门名称',
|
||||
oper_url varchar(255) default '' comment '请求URL',
|
||||
oper_ip varchar(128) default '' comment '主机地址',
|
||||
oper_location varchar(255) default '' comment '操作地点',
|
||||
oper_param varchar(2000) default '' comment '请求参数',
|
||||
json_result varchar(2000) default '' comment '返回参数',
|
||||
status int(1) default 0 comment '操作状态(0正常 1异常)',
|
||||
error_msg varchar(2000) default '' comment '错误消息',
|
||||
oper_time datetime comment '操作时间',
|
||||
cost_time bigint(20) default 0 comment '消耗时间',
|
||||
primary key (oper_id),
|
||||
key idx_sys_oper_log_bt (business_type),
|
||||
key idx_sys_oper_log_s (status),
|
||||
key idx_sys_oper_log_ot (oper_time)
|
||||
) engine=innodb auto_increment=100 comment = '操作日志记录';
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 11、字典类型表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_dict_type;
|
||||
create table sys_dict_type
|
||||
(
|
||||
dict_id bigint(20) not null auto_increment comment '字典主键',
|
||||
dict_name varchar(100) default '' comment '字典名称',
|
||||
dict_type varchar(100) default '' comment '字典类型',
|
||||
status char(1) default '0' comment '状态(0正常 1停用)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(500) default null comment '备注',
|
||||
primary key (dict_id),
|
||||
unique (dict_type)
|
||||
) engine=innodb auto_increment=100 comment = '字典类型表';
|
||||
|
||||
insert into sys_dict_type values(1, '用户性别', 'sys_user_sex', '0', 'admin', sysdate(), '', null, '用户性别列表');
|
||||
insert into sys_dict_type values(2, '菜单状态', 'sys_show_hide', '0', 'admin', sysdate(), '', null, '菜单状态列表');
|
||||
insert into sys_dict_type values(3, '系统开关', 'sys_normal_disable', '0', 'admin', sysdate(), '', null, '系统开关列表');
|
||||
insert into sys_dict_type values(4, '任务状态', 'sys_job_status', '0', 'admin', sysdate(), '', null, '任务状态列表');
|
||||
insert into sys_dict_type values(5, '任务分组', 'sys_job_group', '0', 'admin', sysdate(), '', null, '任务分组列表');
|
||||
insert into sys_dict_type values(6, '系统是否', 'sys_yes_no', '0', 'admin', sysdate(), '', null, '系统是否列表');
|
||||
insert into sys_dict_type values(7, '通知类型', 'sys_notice_type', '0', 'admin', sysdate(), '', null, '通知类型列表');
|
||||
insert into sys_dict_type values(8, '通知状态', 'sys_notice_status', '0', 'admin', sysdate(), '', null, '通知状态列表');
|
||||
insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', sysdate(), '', null, '操作类型列表');
|
||||
insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', sysdate(), '', null, '登录状态列表');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 12、字典数据表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_dict_data;
|
||||
create table sys_dict_data
|
||||
(
|
||||
dict_code bigint(20) not null auto_increment comment '字典编码',
|
||||
dict_sort int(4) default 0 comment '字典排序',
|
||||
dict_label varchar(100) default '' comment '字典标签',
|
||||
dict_value varchar(100) default '' comment '字典键值',
|
||||
dict_type varchar(100) default '' comment '字典类型',
|
||||
css_class varchar(100) default null comment '样式属性(其他样式扩展)',
|
||||
list_class varchar(100) default null comment '表格回显样式',
|
||||
is_default char(1) default 'N' comment '是否默认(Y是 N否)',
|
||||
status char(1) default '0' comment '状态(0正常 1停用)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(500) default null comment '备注',
|
||||
primary key (dict_code)
|
||||
) engine=innodb auto_increment=100 comment = '字典数据表';
|
||||
|
||||
insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', sysdate(), '', null, '性别男');
|
||||
insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别女');
|
||||
insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别未知');
|
||||
insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '显示菜单');
|
||||
insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '隐藏菜单');
|
||||
insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态');
|
||||
insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
|
||||
insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态');
|
||||
insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
|
||||
insert into sys_dict_data values(10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', sysdate(), '', null, '默认分组');
|
||||
insert into sys_dict_data values(11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', sysdate(), '', null, '系统分组');
|
||||
insert into sys_dict_data values(12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '系统默认是');
|
||||
insert into sys_dict_data values(13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '系统默认否');
|
||||
insert into sys_dict_data values(14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', sysdate(), '', null, '通知');
|
||||
insert into sys_dict_data values(15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', sysdate(), '', null, '公告');
|
||||
insert into sys_dict_data values(16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态');
|
||||
insert into sys_dict_data values(17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '关闭状态');
|
||||
insert into sys_dict_data values(18, 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '其他操作');
|
||||
insert into sys_dict_data values(19, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '新增操作');
|
||||
insert into sys_dict_data values(20, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '修改操作');
|
||||
insert into sys_dict_data values(21, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '删除操作');
|
||||
insert into sys_dict_data values(22, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '授权操作');
|
||||
insert into sys_dict_data values(23, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导出操作');
|
||||
insert into sys_dict_data values(24, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导入操作');
|
||||
insert into sys_dict_data values(25, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '强退操作');
|
||||
insert into sys_dict_data values(26, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '生成操作');
|
||||
insert into sys_dict_data values(27, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '清空操作');
|
||||
insert into sys_dict_data values(28, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '正常状态');
|
||||
insert into sys_dict_data values(29, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 13、参数配置表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_config;
|
||||
create table sys_config (
|
||||
config_id int(5) not null auto_increment comment '参数主键',
|
||||
config_name varchar(100) default '' comment '参数名称',
|
||||
config_key varchar(100) default '' comment '参数键名',
|
||||
config_value varchar(500) default '' comment '参数键值',
|
||||
config_type char(1) default 'N' comment '系统内置(Y是 N否)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(500) default null comment '备注',
|
||||
primary key (config_id)
|
||||
) engine=innodb auto_increment=100 comment = '参数配置表';
|
||||
|
||||
insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', sysdate(), '', null, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow' );
|
||||
insert into sys_config values(2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', sysdate(), '', null, '初始化密码 123456' );
|
||||
insert into sys_config values(3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', sysdate(), '', null, '深色主题theme-dark,浅色主题theme-light' );
|
||||
insert into sys_config values(4, '账号自助-验证码开关', 'sys.account.captchaEnabled', 'true', 'Y', 'admin', sysdate(), '', null, '是否开启验证码功能(true开启,false关闭)');
|
||||
insert into sys_config values(5, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', sysdate(), '', null, '是否开启注册用户功能(true开启,false关闭)');
|
||||
insert into sys_config values(6, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y', 'admin', sysdate(), '', null, '设置登录IP黑名单限制,多个匹配项以;分隔,支持匹配(*通配、网段)');
|
||||
insert into sys_config values(7, '用户管理-初始密码修改策略', 'sys.account.initPasswordModify', '1', 'Y', 'admin', sysdate(), '', null, '0:初始密码修改策略关闭,没有任何提示,1:提醒用户,如果未修改初始密码,则在登录时就会提醒修改密码对话框');
|
||||
insert into sys_config values(8, '用户管理-账号密码更新周期', 'sys.account.passwordValidateDays', '0', 'Y', 'admin', sysdate(), '', null, '密码更新周期(填写数字,数据初始化值为0不限制,若修改必须为大于0小于365的正整数),如果超过这个周期登录系统时,则在登录时就会提醒修改密码对话框');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 14、系统访问记录
|
||||
-- ----------------------------
|
||||
drop table if exists sys_logininfor;
|
||||
create table sys_logininfor (
|
||||
info_id bigint(20) not null auto_increment comment '访问ID',
|
||||
user_name varchar(50) default '' comment '用户账号',
|
||||
ipaddr varchar(128) default '' comment '登录IP地址',
|
||||
login_location varchar(255) default '' comment '登录地点',
|
||||
browser varchar(50) default '' comment '浏览器类型',
|
||||
os varchar(50) default '' comment '操作系统',
|
||||
status char(1) default '0' comment '登录状态(0成功 1失败)',
|
||||
msg varchar(255) default '' comment '提示消息',
|
||||
login_time datetime comment '访问时间',
|
||||
primary key (info_id),
|
||||
key idx_sys_logininfor_s (status),
|
||||
key idx_sys_logininfor_lt (login_time)
|
||||
) engine=innodb auto_increment=100 comment = '系统访问记录';
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 15、定时任务调度表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_job;
|
||||
create table sys_job (
|
||||
job_id bigint(20) not null auto_increment comment '任务ID',
|
||||
job_name varchar(64) default '' comment '任务名称',
|
||||
job_group varchar(64) default 'DEFAULT' comment '任务组名',
|
||||
invoke_target varchar(500) not null comment '调用目标字符串',
|
||||
cron_expression varchar(255) default '' comment 'cron执行表达式',
|
||||
misfire_policy varchar(20) default '3' comment '计划执行错误策略(1立即执行 2执行一次 3放弃执行)',
|
||||
concurrent char(1) default '1' comment '是否并发执行(0允许 1禁止)',
|
||||
status char(1) default '0' comment '状态(0正常 1暂停)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(500) default '' comment '备注信息',
|
||||
primary key (job_id, job_name, job_group)
|
||||
) engine=innodb auto_increment=100 comment = '定时任务调度表';
|
||||
|
||||
insert into sys_job values(1, '系统默认(无参)', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_job values(2, '系统默认(有参)', 'DEFAULT', 'ryTask.ryParams(\'ry\')', '0/15 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, '');
|
||||
insert into sys_job values(3, '系统默认(多参)', 'DEFAULT', 'ryTask.ryMultipleParams(\'ry\', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, '');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 16、定时任务调度日志表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_job_log;
|
||||
create table sys_job_log (
|
||||
job_log_id bigint(20) not null auto_increment comment '任务日志ID',
|
||||
job_name varchar(64) not null comment '任务名称',
|
||||
job_group varchar(64) not null comment '任务组名',
|
||||
invoke_target varchar(500) not null comment '调用目标字符串',
|
||||
job_message varchar(500) comment '日志信息',
|
||||
status char(1) default '0' comment '执行状态(0正常 1失败)',
|
||||
exception_info varchar(2000) default '' comment '异常信息',
|
||||
create_time datetime comment '创建时间',
|
||||
primary key (job_log_id)
|
||||
) engine=innodb comment = '定时任务调度日志表';
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 17、通知公告表
|
||||
-- ----------------------------
|
||||
drop table if exists sys_notice;
|
||||
create table sys_notice (
|
||||
notice_id int(4) not null auto_increment comment '公告ID',
|
||||
notice_title varchar(50) not null comment '公告标题',
|
||||
notice_type char(1) not null comment '公告类型(1通知 2公告)',
|
||||
notice_content longblob default null comment '公告内容',
|
||||
status char(1) default '0' comment '公告状态(0正常 1关闭)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(255) default null comment '备注',
|
||||
primary key (notice_id)
|
||||
) engine=innodb auto_increment=10 comment = '通知公告表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 初始化-公告信息表数据
|
||||
-- ----------------------------
|
||||
insert into sys_notice values('1', '温馨提醒:2018-07-01 若依新版本发布啦', '2', '新版本内容', '0', 'admin', sysdate(), '', null, '管理员');
|
||||
insert into sys_notice values('2', '维护通知:2018-07-01 若依系统凌晨维护', '1', '维护内容', '0', 'admin', sysdate(), '', null, '管理员');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 18、代码生成业务表
|
||||
-- ----------------------------
|
||||
drop table if exists gen_table;
|
||||
create table gen_table (
|
||||
table_id bigint(20) not null auto_increment comment '编号',
|
||||
table_name varchar(200) default '' comment '表名称',
|
||||
table_comment varchar(500) default '' comment '表描述',
|
||||
sub_table_name varchar(64) default null comment '关联子表的表名',
|
||||
sub_table_fk_name varchar(64) default null comment '子表关联的外键名',
|
||||
class_name varchar(100) default '' comment '实体类名称',
|
||||
tpl_category varchar(200) default 'crud' comment '使用的模板(crud单表操作 tree树表操作)',
|
||||
tpl_web_type varchar(30) default '' comment '前端模板类型(element-ui模版 element-plus模版)',
|
||||
package_name varchar(100) comment '生成包路径',
|
||||
module_name varchar(30) comment '生成模块名',
|
||||
business_name varchar(30) comment '生成业务名',
|
||||
function_name varchar(50) comment '生成功能名',
|
||||
function_author varchar(50) comment '生成功能作者',
|
||||
gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)',
|
||||
gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
|
||||
options varchar(1000) comment '其它生成选项',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(500) default null comment '备注',
|
||||
primary key (table_id)
|
||||
) engine=innodb auto_increment=1 comment = '代码生成业务表';
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 19、代码生成业务表字段
|
||||
-- ----------------------------
|
||||
drop table if exists gen_table_column;
|
||||
create table gen_table_column (
|
||||
column_id bigint(20) not null auto_increment comment '编号',
|
||||
table_id bigint(20) comment '归属表编号',
|
||||
column_name varchar(200) comment '列名称',
|
||||
column_comment varchar(500) comment '列描述',
|
||||
column_type varchar(100) comment '列类型',
|
||||
java_type varchar(500) comment 'JAVA类型',
|
||||
java_field varchar(200) comment 'JAVA字段名',
|
||||
is_pk char(1) comment '是否主键(1是)',
|
||||
is_increment char(1) comment '是否自增(1是)',
|
||||
is_required char(1) comment '是否必填(1是)',
|
||||
is_insert char(1) comment '是否为插入字段(1是)',
|
||||
is_edit char(1) comment '是否编辑字段(1是)',
|
||||
is_list char(1) comment '是否列表字段(1是)',
|
||||
is_query char(1) comment '是否查询字段(1是)',
|
||||
query_type varchar(200) default 'EQ' comment '查询方式(等于、不等于、大于、小于、范围)',
|
||||
html_type varchar(200) comment '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)',
|
||||
dict_type varchar(200) default '' comment '字典类型',
|
||||
sort int comment '排序',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
primary key (column_id)
|
||||
) engine=innodb auto_increment=1 comment = '代码生成业务表字段';
|
||||
174
docker/mysql/init/02-ruoyi-table.sql.sql
Normal file
174
docker/mysql/init/02-ruoyi-table.sql.sql
Normal file
@@ -0,0 +1,174 @@
|
||||
DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS;
|
||||
DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE;
|
||||
DROP TABLE IF EXISTS QRTZ_LOCKS;
|
||||
DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_JOB_DETAILS;
|
||||
DROP TABLE IF EXISTS QRTZ_CALENDARS;
|
||||
|
||||
-- ----------------------------
|
||||
-- 1、存储每一个已配置的 jobDetail 的详细信息
|
||||
-- ----------------------------
|
||||
create table QRTZ_JOB_DETAILS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
job_name varchar(200) not null comment '任务名称',
|
||||
job_group varchar(200) not null comment '任务组名',
|
||||
description varchar(250) null comment '相关介绍',
|
||||
job_class_name varchar(250) not null comment '执行任务类名称',
|
||||
is_durable varchar(1) not null comment '是否持久化',
|
||||
is_nonconcurrent varchar(1) not null comment '是否并发',
|
||||
is_update_data varchar(1) not null comment '是否更新数据',
|
||||
requests_recovery varchar(1) not null comment '是否接受恢复执行',
|
||||
job_data blob null comment '存放持久化job对象',
|
||||
primary key (sched_name, job_name, job_group)
|
||||
) engine=innodb comment = '任务详细信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 2、 存储已配置的 Trigger 的信息
|
||||
-- ----------------------------
|
||||
create table QRTZ_TRIGGERS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
trigger_name varchar(200) not null comment '触发器的名字',
|
||||
trigger_group varchar(200) not null comment '触发器所属组的名字',
|
||||
job_name varchar(200) not null comment 'qrtz_job_details表job_name的外键',
|
||||
job_group varchar(200) not null comment 'qrtz_job_details表job_group的外键',
|
||||
description varchar(250) null comment '相关介绍',
|
||||
next_fire_time bigint(13) null comment '上一次触发时间(毫秒)',
|
||||
prev_fire_time bigint(13) null comment '下一次触发时间(默认为-1表示不触发)',
|
||||
priority integer null comment '优先级',
|
||||
trigger_state varchar(16) not null comment '触发器状态',
|
||||
trigger_type varchar(8) not null comment '触发器的类型',
|
||||
start_time bigint(13) not null comment '开始时间',
|
||||
end_time bigint(13) null comment '结束时间',
|
||||
calendar_name varchar(200) null comment '日程表名称',
|
||||
misfire_instr smallint(2) null comment '补偿执行的策略',
|
||||
job_data blob null comment '存放持久化job对象',
|
||||
primary key (sched_name, trigger_name, trigger_group),
|
||||
foreign key (sched_name, job_name, job_group) references QRTZ_JOB_DETAILS(sched_name, job_name, job_group)
|
||||
) engine=innodb comment = '触发器详细信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 3、 存储简单的 Trigger,包括重复次数,间隔,以及已触发的次数
|
||||
-- ----------------------------
|
||||
create table QRTZ_SIMPLE_TRIGGERS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
||||
repeat_count bigint(7) not null comment '重复的次数统计',
|
||||
repeat_interval bigint(12) not null comment '重复的间隔时间',
|
||||
times_triggered bigint(10) not null comment '已经触发的次数',
|
||||
primary key (sched_name, trigger_name, trigger_group),
|
||||
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
||||
) engine=innodb comment = '简单触发器的信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 4、 存储 Cron Trigger,包括 Cron 表达式和时区信息
|
||||
-- ----------------------------
|
||||
create table QRTZ_CRON_TRIGGERS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
||||
cron_expression varchar(200) not null comment 'cron表达式',
|
||||
time_zone_id varchar(80) comment '时区',
|
||||
primary key (sched_name, trigger_name, trigger_group),
|
||||
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
||||
) engine=innodb comment = 'Cron类型的触发器表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 5、 Trigger 作为 Blob 类型存储(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型,JobStore 并不知道如何存储实例的时候)
|
||||
-- ----------------------------
|
||||
create table QRTZ_BLOB_TRIGGERS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
||||
blob_data blob null comment '存放持久化Trigger对象',
|
||||
primary key (sched_name, trigger_name, trigger_group),
|
||||
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
||||
) engine=innodb comment = 'Blob类型的触发器表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 6、 以 Blob 类型存储存放日历信息, quartz可配置一个日历来指定一个时间范围
|
||||
-- ----------------------------
|
||||
create table QRTZ_CALENDARS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
calendar_name varchar(200) not null comment '日历名称',
|
||||
calendar blob not null comment '存放持久化calendar对象',
|
||||
primary key (sched_name, calendar_name)
|
||||
) engine=innodb comment = '日历信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 7、 存储已暂停的 Trigger 组的信息
|
||||
-- ----------------------------
|
||||
create table QRTZ_PAUSED_TRIGGER_GRPS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
||||
primary key (sched_name, trigger_group)
|
||||
) engine=innodb comment = '暂停的触发器表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 8、 存储与已触发的 Trigger 相关的状态信息,以及相联 Job 的执行信息
|
||||
-- ----------------------------
|
||||
create table QRTZ_FIRED_TRIGGERS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
entry_id varchar(95) not null comment '调度器实例id',
|
||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
||||
instance_name varchar(200) not null comment '调度器实例名',
|
||||
fired_time bigint(13) not null comment '触发的时间',
|
||||
sched_time bigint(13) not null comment '定时器制定的时间',
|
||||
priority integer not null comment '优先级',
|
||||
state varchar(16) not null comment '状态',
|
||||
job_name varchar(200) null comment '任务名称',
|
||||
job_group varchar(200) null comment '任务组名',
|
||||
is_nonconcurrent varchar(1) null comment '是否并发',
|
||||
requests_recovery varchar(1) null comment '是否接受恢复执行',
|
||||
primary key (sched_name, entry_id)
|
||||
) engine=innodb comment = '已触发的触发器表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 9、 存储少量的有关 Scheduler 的状态信息,假如是用于集群中,可以看到其他的 Scheduler 实例
|
||||
-- ----------------------------
|
||||
create table QRTZ_SCHEDULER_STATE (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
instance_name varchar(200) not null comment '实例名称',
|
||||
last_checkin_time bigint(13) not null comment '上次检查时间',
|
||||
checkin_interval bigint(13) not null comment '检查间隔时间',
|
||||
primary key (sched_name, instance_name)
|
||||
) engine=innodb comment = '调度器状态表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 10、 存储程序的悲观锁的信息(假如使用了悲观锁)
|
||||
-- ----------------------------
|
||||
create table QRTZ_LOCKS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
lock_name varchar(40) not null comment '悲观锁名称',
|
||||
primary key (sched_name, lock_name)
|
||||
) engine=innodb comment = '存储的悲观锁信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- 11、 Quartz集群实现同步机制的行锁表
|
||||
-- ----------------------------
|
||||
create table QRTZ_SIMPROP_TRIGGERS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
||||
str_prop_1 varchar(512) null comment 'String类型的trigger的第一个参数',
|
||||
str_prop_2 varchar(512) null comment 'String类型的trigger的第二个参数',
|
||||
str_prop_3 varchar(512) null comment 'String类型的trigger的第三个参数',
|
||||
int_prop_1 int null comment 'int类型的trigger的第一个参数',
|
||||
int_prop_2 int null comment 'int类型的trigger的第二个参数',
|
||||
long_prop_1 bigint null comment 'long类型的trigger的第一个参数',
|
||||
long_prop_2 bigint null comment 'long类型的trigger的第二个参数',
|
||||
dec_prop_1 numeric(13,4) null comment 'decimal类型的trigger的第一个参数',
|
||||
dec_prop_2 numeric(13,4) null comment 'decimal类型的trigger的第二个参数',
|
||||
bool_prop_1 varchar(1) null comment 'Boolean类型的trigger的第一个参数',
|
||||
bool_prop_2 varchar(1) null comment 'Boolean类型的trigger的第二个参数',
|
||||
primary key (sched_name, trigger_name, trigger_group),
|
||||
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
||||
) engine=innodb comment = '同步机制的行锁表';
|
||||
|
||||
commit;
|
||||
1413
docker/mysql/init/03-data.sql.sql
Normal file
1413
docker/mysql/init/03-data.sql.sql
Normal file
File diff suppressed because one or more lines are too long
30
docker/mysql/init/README.md
Normal file
30
docker/mysql/init/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# MySQL 首次初始化 SQL
|
||||
|
||||
MySQL 官方镜像会在**数据目录为空**时,按文件名顺序执行本目录下:
|
||||
|
||||
- `*.sql`
|
||||
- `*.sql.gz`
|
||||
- `*.sh`
|
||||
|
||||
## 你需要做的事
|
||||
|
||||
1. 从本机现有库导出(示例):
|
||||
|
||||
```bash
|
||||
mysqldump -uroot -p --databases autosolution_db --single-transaction --quick > docker/mysql/init/01-autosolution_db.sql
|
||||
```
|
||||
|
||||
2. 或放入若依官方 `ry_*.sql` 与 Quartz 等脚本,**按依赖顺序**命名前缀(如 `01-`、`02-`)。
|
||||
|
||||
3. 若容器/卷里已经有数据,这些脚本**不会再次执行**。需要重新初始化时:
|
||||
|
||||
```bash
|
||||
docker compose down -v
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
注意:`-v` 会删除 `mysql_data` 卷,请确认无重要数据。
|
||||
|
||||
## 字符集
|
||||
|
||||
`docker-compose.yml` 中 MySQL 已配置 `utf8mb4`,导入脚本建议同为 UTF-8。
|
||||
@@ -28,6 +28,10 @@ export const findOneTreeByPlatformId = (platformId: number): Promise<BehaviorTre
|
||||
return req.get(`/system/behaviortree/platform/${platformId}`);
|
||||
};
|
||||
|
||||
export const findSubPlatforms = (treeId: number): Promise<BehaviorTreeDetailsResponse> => {
|
||||
return req.get(`/system/behaviortree/underling/${treeId}`);
|
||||
};
|
||||
|
||||
export const findOneTreeById = (id: number): Promise<BehaviorTreeDetailsResponse> => {
|
||||
return req.get(`/system/behaviortree/${id}`);
|
||||
};
|
||||
@@ -40,6 +44,10 @@ export const updateTree = (rt: Partial<BehaviorTree>): Promise<BasicResponse> =>
|
||||
return req.postJson(`/system/behaviortree`, rt);
|
||||
};
|
||||
|
||||
export const copyTree = (rt: Partial<BehaviorTree>): Promise<BasicResponse> => {
|
||||
return req.postJson(`/system/behaviortree/copy`, rt);
|
||||
};
|
||||
|
||||
export const createTree = (rt: Partial<BehaviorTree>): Promise<BasicResponse> => {
|
||||
return req.putJson(`/system/behaviortree`, rt);
|
||||
};
|
||||
|
||||
@@ -43,10 +43,11 @@
|
||||
<Properties
|
||||
v-if="graph"
|
||||
:platforms="platforms"
|
||||
:sub-platforms="subPlatforms"
|
||||
:nodeCommands="nodeCommands"
|
||||
:element="selectedNodeTaskElement"
|
||||
:graph="graph as any"
|
||||
:node="selectedModelNode as any"
|
||||
:graph="(graph as any)"
|
||||
:node="(selectedModelNode as any)"
|
||||
:tree="currentBehaviorTree"
|
||||
:tree-editing="currentTreeEditing"
|
||||
@update-element="handleUpdateElement" />
|
||||
@@ -74,8 +75,8 @@ import { createGraphTaskElementFromTemplate } from './utils';
|
||||
import { createGraphTaskElement, createLineOptions, type GraphContainer, type GraphTaskElement, hasElements, hasRootElementNode, resolveGraph, useGraphCanvas } from '../graph';
|
||||
import { registerNodeElement } from './register';
|
||||
import { findAllBasicPlatforms, findAllNodeCommands } from '../api';
|
||||
import type { Platform } from '../types';
|
||||
import { createTree, findOneTreeById, findOneTreeByPlatformId, updateTree } from './api';
|
||||
import type { NodeCommand, Platform } from '../types';
|
||||
import { createTree, findOneTreeById, findOneTreeByPlatformId, updateTree, findSubPlatforms } from './api';
|
||||
import TressCard from './trees-card.vue';
|
||||
import NodesCard from './nodes-card.vue';
|
||||
|
||||
@@ -112,6 +113,7 @@ export default defineComponent({
|
||||
const changed = ref<boolean>(false);
|
||||
const treesCardRef = ref<InstanceType<typeof TressCard> | null>(null);
|
||||
const platforms = ref<Platform[]>([]);
|
||||
const subPlatforms = ref<Platform[]>([]);
|
||||
const nodeCommands = ref<NodeCommand[]>([])
|
||||
const currentScenarioId = ref<number | null>(null);
|
||||
const currentPlatformId = ref<number | null>(null);
|
||||
@@ -153,6 +155,27 @@ export default defineComponent({
|
||||
loadNodeCommands();
|
||||
}
|
||||
|
||||
// 加载下属平台
|
||||
const loadSubPlatforms = (treeId: number) => {
|
||||
console.log(treeId);
|
||||
|
||||
if (!treeId || treeId <= 0) {
|
||||
subPlatforms.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
findSubPlatforms(treeId).then(r => {
|
||||
if (r.data && Array.isArray(r.data)) {
|
||||
subPlatforms.value = r.data as Platform[];
|
||||
} else {
|
||||
subPlatforms.value = [];
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('加载下属平台失败:', err);
|
||||
subPlatforms.value = [];
|
||||
});
|
||||
};
|
||||
|
||||
// 处理拖动开始
|
||||
const handleDragStart = (nm: NodeDragTemplate) => {
|
||||
draggedNodeData.value = nm;
|
||||
@@ -267,6 +290,10 @@ export default defineComponent({
|
||||
graph: nodeGraph,
|
||||
};
|
||||
currentTreeEditing.value = true;
|
||||
|
||||
// 加载下属平台
|
||||
loadSubPlatforms(r.data.id);
|
||||
|
||||
nextTick(() => {
|
||||
initGraph();
|
||||
});
|
||||
@@ -343,6 +370,7 @@ export default defineComponent({
|
||||
};
|
||||
selectedModelNode.value = null;
|
||||
selectedNodeTaskElement.value = null;
|
||||
subPlatforms.value = []; // 重置下属平台
|
||||
|
||||
nextTick(() => {
|
||||
initGraph();
|
||||
@@ -487,6 +515,7 @@ export default defineComponent({
|
||||
nodeCommands,
|
||||
currentScenarioId,
|
||||
platforms,
|
||||
subPlatforms,
|
||||
treesCardRef,
|
||||
handleCreateTree,
|
||||
currentTreeEditing,
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
size="small"
|
||||
type="editable-card"
|
||||
@edit="onEditParameterTab">
|
||||
<a-tab-pane v-for="(grouped,index) in groupedParameters" :key="index" :tab="`平台 ${index + 1}`" :closable="true">
|
||||
<a-tab-pane v-for="(grouped,index) in groupedParameters" :key="index" :tab="getPlatformTabName(index)" :closable="true">
|
||||
<a-form-item v-for="setting in grouped" :label="setting.description">
|
||||
<a-input-number v-if="setting.dataType === 'double'"
|
||||
v-model:value="setting.defaultValue"
|
||||
@@ -109,7 +109,7 @@
|
||||
<a-select :placeholder="`请选择${setting.description}`"
|
||||
allow-clear
|
||||
v-else-if="setting.paramKey === 'platforms'" v-model:value="setting.defaultValue">
|
||||
<a-select-option v-for="pl in platforms" :value="pl.name">{{pl.description}}</a-select-option>
|
||||
<a-select-option v-for="pl in getAvailablePlatforms()" :value="pl.name">{{pl.description}}</a-select-option>
|
||||
</a-select>
|
||||
<a-select :placeholder="`请选择${setting.description}`"
|
||||
allow-clear
|
||||
@@ -194,11 +194,13 @@ export default defineComponent({
|
||||
node: { type: [Object, null] as PropType<Node<NodeProperties> | null | undefined>, required: false },
|
||||
graph: { type: [Object, null] as PropType<Graph | null | undefined>, required: true },
|
||||
platforms: { type: Array as PropType<Platform[]>, required: true },
|
||||
subPlatforms: { type: Array as PropType<Platform[]>, required: false, default: () => [] },
|
||||
nodeCommands: { type: Array as PropType<NodeCommand[]>, required: true },
|
||||
},
|
||||
emits: ['update-element', 'update-tree'],
|
||||
setup(props, { emit }) {
|
||||
const platforms = ref<Platform[]>(props.platforms ?? []);
|
||||
const subPlatforms = ref<Platform[]>(props.subPlatforms ?? []);
|
||||
const nodeCommands = ref<NodeCommand[]>(props.nodeCommands ?? []);
|
||||
|
||||
const activeTopTabsKey = ref<string>('1');
|
||||
@@ -299,6 +301,41 @@ export default defineComponent({
|
||||
multiableParameters.value = multiable === true && groupedParameters.value.length > 0;
|
||||
};
|
||||
|
||||
// 获取平台Tab显示名称
|
||||
const getPlatformTabName = (index: number): string => {
|
||||
if (!currentTree.value?.platformId) {
|
||||
return `平台 ${index + 1}`;
|
||||
}
|
||||
|
||||
// 查找当前行为树绑定的平台
|
||||
const currentPlatform = platforms.value.find(p => p.id === currentTree.value?.platformId);
|
||||
if (!currentPlatform) {
|
||||
return `平台 ${index + 1}`;
|
||||
}
|
||||
|
||||
// 如果有多个分组,显示平台名称和索引
|
||||
if (groupedParameters.value.length > 1) {
|
||||
return `${currentPlatform.name || '未知平台'}-${index + 1}`;
|
||||
}
|
||||
|
||||
return currentPlatform.name || '平台';
|
||||
};
|
||||
|
||||
// 获取可用的平台列表(包括当前平台和其下属平台)
|
||||
const getAvailablePlatforms = (): Platform[] => {
|
||||
if (!currentTree.value?.platformId) {
|
||||
return platforms.value;
|
||||
}
|
||||
|
||||
// 如果有下属平台,返回下属平台列表
|
||||
if (subPlatforms.value && subPlatforms.value.length > 0) {
|
||||
return subPlatforms.value;
|
||||
}
|
||||
|
||||
// 否则返回所有平台
|
||||
return platforms.value;
|
||||
};
|
||||
|
||||
|
||||
const resolveNode = (n?: Node | null | undefined) => {
|
||||
groupedParametersActiveTab.value = 0;
|
||||
@@ -389,6 +426,7 @@ export default defineComponent({
|
||||
|
||||
watch(() => props.nodeCommands, (n: NodeCommand[] | null | undefined) => nodeCommands.value = n ?? [], { deep: true, immediate: true });
|
||||
watch(() => props.platforms, (n: Platform[] | null | undefined) => platforms.value = n ?? [], { deep: true, immediate: true });
|
||||
watch(() => props.subPlatforms, (n: Platform[] | null | undefined) => subPlatforms.value = n ?? [], { deep: true, immediate: true });
|
||||
|
||||
onMounted(() => load());
|
||||
|
||||
@@ -400,6 +438,8 @@ export default defineComponent({
|
||||
multiableParameters,
|
||||
onEditParameterTab,
|
||||
groupedParameters,
|
||||
getPlatformTabName,
|
||||
getAvailablePlatforms,
|
||||
actionSpaceColumns,
|
||||
activeTopTabsKey,
|
||||
activeBottomTabsKey,
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
</a-tooltip>
|
||||
<a-flex class="ks-tree-actions">
|
||||
<!-- <span style="margin-right: 10px"><EditFilled /></span>-->
|
||||
<a-popconfirm
|
||||
title="确定复制?"
|
||||
@confirm="()=> handleCopy(item)"
|
||||
>
|
||||
<span class="ks-tree-action ks-tree-action-copy" @click.stop style="margin-right: 10px"><CopyOutlined /></span>
|
||||
</a-popconfirm>
|
||||
<a-popconfirm
|
||||
title="确定删除?"
|
||||
@confirm="()=> handleDelete(item)"
|
||||
@@ -51,15 +57,16 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, ref } from 'vue';
|
||||
import { CheckOutlined, DeleteOutlined, EditFilled, PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { CheckOutlined, CopyOutlined, DeleteOutlined, EditFilled, PlusOutlined } from '@ant-design/icons-vue';
|
||||
import type { BehaviorTree, BehaviorTreeRequest } from './tree';
|
||||
import { deleteOneTreeById, findTreesByQuery } from './api';
|
||||
import { copyTree, deleteOneTreeById, findTreesByQuery } from './api';
|
||||
import { substring } from '@/utils/strings';
|
||||
|
||||
export default defineComponent({
|
||||
emits: ['select-tree', 'create-tree'],
|
||||
components: {
|
||||
CheckOutlined,
|
||||
CopyOutlined,
|
||||
PlusOutlined,
|
||||
DeleteOutlined,
|
||||
EditFilled,
|
||||
@@ -95,6 +102,14 @@ export default defineComponent({
|
||||
});
|
||||
};
|
||||
|
||||
const handleCopy = (item: BehaviorTree) => {
|
||||
copyTree(item).then(r => {
|
||||
if (r.code === 200) {
|
||||
loadTress();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '名称',
|
||||
@@ -133,6 +148,7 @@ export default defineComponent({
|
||||
handleSelect,
|
||||
handleChange,
|
||||
handleDelete,
|
||||
handleCopy,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -104,6 +104,7 @@ export const createGraphConnectingAttributes = (): Partial<Connecting> => {
|
||||
export const createGraphCanvas = (container: HTMLDivElement, readonly: boolean = false): Graph => {
|
||||
const graph = new Graph({
|
||||
container: container,
|
||||
autoResize: true,
|
||||
grid: {
|
||||
size: 20,
|
||||
visible: true,
|
||||
|
||||
Reference in New Issue
Block a user