Merge branch 'master' of http://101.43.238.71:3000/zouju/auto-solution
This commit is contained in:
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
|
||||
```
|
||||
|
||||
@@ -134,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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.solution.system.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 平台表
|
||||
*/
|
||||
@Data
|
||||
public class Platform {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 平台名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 平台出现在想定上的想定id
|
||||
*/
|
||||
private Integer scenarioId;
|
||||
}
|
||||
@@ -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,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.Platform;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PlatformMapper {
|
||||
|
||||
/**
|
||||
* 根据行为树id获取行为树所属平台
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Platform getPlatformByTreeId(Long 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.Platform;
|
||||
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获取行为树所属平台
|
||||
Platform platform = platformMapper.getPlatformByTreeId(behaviortree.getId());
|
||||
//根据平台name获取平台下属英文名
|
||||
List<String> underlingEnglishName = platformCommunicationMapper.getUnderlingBytreeId(platform.getName());
|
||||
//根据下属平台英文名获取中文名返回
|
||||
List<String> underlingChineseName = platformMapper.selectPlatformChineseName(underlingEnglishName);
|
||||
if(CollUtil.isEmpty(underlingChineseName)){
|
||||
throw new RuntimeException("该平台暂无下属");
|
||||
}
|
||||
return underlingChineseName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Platform"
|
||||
parameterType="java.lang.Long">
|
||||
SELECT id , name , description, scenario_id
|
||||
FROM platform
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
<select id="selectPlatformChineseName" resultType="java.lang.String"
|
||||
parameterType="java.util.List<java.lang.String>">
|
||||
SELECT description
|
||||
FROM platform
|
||||
WHERE name IN
|
||||
<foreach item="item" collection="underlingEnglishName" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -103,7 +103,7 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
const handleCopy = (item: BehaviorTree) => {
|
||||
copyTree({ id: item.id }).then(r => {
|
||||
copyTree(item).then(r => {
|
||||
if (r.code === 200) {
|
||||
loadTress();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user