Compare commits
No commits in common. "feature/unified-resource-center" and "dev" have entirely different histories.
feature/un
...
dev
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@ -1 +0,0 @@
|
|||||||
custom: http://doc.ruoyi.vip/ruoyi-vue/other/donate.html
|
|
||||||
12
.gitignore
vendored
12
.gitignore
vendored
@ -46,7 +46,11 @@ nbdist/
|
|||||||
!*/build/*.html
|
!*/build/*.html
|
||||||
!*/build/*.xml
|
!*/build/*.xml
|
||||||
|
|
||||||
# Local verification tests
|
bin/
|
||||||
/cmvr-iot-test/src/test/java/com/cmvr/test/flow/runtime/operator/edge/EdgeAgvOperateServiceTest.java
|
ry.bat
|
||||||
/cmvr-iot-test/src/test/java/com/cmvr/test/flow/runtime/operator/edge/EdgeArmOperateServiceTest.java
|
ry.sh
|
||||||
/cmvr-iot-test/src/test/java/com/cmvr/test/vision/math/VisionCalibrationMathTest.java
|
run.sh
|
||||||
|
package.bat
|
||||||
|
sql/quartz.sql
|
||||||
|
|
||||||
|
**/application-local.yml
|
||||||
|
|||||||
26
DirectoryV3.xml
Normal file
26
DirectoryV3.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<trees>
|
||||||
|
<tree path="/cmvr-iot-system" title="系统模块"/>
|
||||||
|
<tree path="/cmvr-iot-admin" title="后台服务"/>
|
||||||
|
<tree path="/cmvr-iot-common" title="工具类"/>
|
||||||
|
<tree path="/cmvr-iot-framework" title="框架核心组件"/>
|
||||||
|
<tree path="/cmvr-iot-generator" title="代码生成"/>
|
||||||
|
<tree path="/cmvr-iot-quartz" title="定时任务"/>
|
||||||
|
<tree path="/cmvr-iot-common/src/main/java/com/cmvr/common/annotation" title="自定义注解"/>
|
||||||
|
<tree path="/cmvr-iot-common/src/main/java/com/cmvr/common/config" title="全局配置"/>
|
||||||
|
<tree path="/cmvr-iot-common/src/main/java/com/cmvr/common/constant" title="通用常量"/>
|
||||||
|
<tree path="/cmvr-iot-common/src/main/java/com/cmvr/common/core" title="核心控制"/>
|
||||||
|
<tree path="/cmvr-iot-common/src/main/java/com/cmvr/common/enums" title="通用枚举"/>
|
||||||
|
<tree path="/cmvr-iot-common/src/main/java/com/cmvr/common/exception" title="通用异常"/>
|
||||||
|
<tree path="/cmvr-iot-common/src/main/java/com/cmvr/common/filter" title="过滤器处理"/>
|
||||||
|
<tree path="/cmvr-iot-common/src/main/java/com/cmvr/common/utils" title="通用类处理"/>
|
||||||
|
<tree path="/cmvr-iot-common/src/main/java/com/cmvr/common/xss" title="自定义xss校验注解"/>
|
||||||
|
<tree path="/cmvr-iot-framework/src/main/java/com/cmvr/framework/aspectj" title="注解实现"/>
|
||||||
|
<tree path="/cmvr-iot-framework/src/main/java/com/cmvr/framework/config" title="系统配置"/>
|
||||||
|
<tree path="/cmvr-iot-framework/src/main/java/com/cmvr/framework/datasource" title="数据权限"/>
|
||||||
|
<tree path="/cmvr-iot-framework/src/main/java/com/cmvr/framework/interceptor" title="拦截器"/>
|
||||||
|
<tree path="/cmvr-iot-framework/src/main/java/com/cmvr/framework/manager" title="异步处理"/>
|
||||||
|
<tree path="/cmvr-iot-framework/src/main/java/com/cmvr/framework/security" title="权限控制"/>
|
||||||
|
<tree path="/cmvr-iot-framework/src/main/java/com/cmvr/framework/web" title="前端控制"/>
|
||||||
|
<tree path="/cmvr-iot-device" title="设备管理"/>
|
||||||
|
</trees>
|
||||||
50
Dockerfile
Normal file
50
Dockerfile
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# ====================== 构建阶段 ======================
|
||||||
|
FROM maven:3.9.9-eclipse-temurin-8 AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 缓存pom
|
||||||
|
COPY pom.xml .
|
||||||
|
COPY cmvr-iot-admin/pom.xml cmvr-iot-admin/
|
||||||
|
COPY cmvr-iot-framework/pom.xml cmvr-iot-framework/
|
||||||
|
COPY cmvr-iot-system/pom.xml cmvr-iot-system/
|
||||||
|
COPY cmvr-iot-quartz/pom.xml cmvr-iot-quartz/
|
||||||
|
COPY cmvr-iot-generator/pom.xml cmvr-iot-generator/
|
||||||
|
COPY cmvr-iot-common/pom.xml cmvr-iot-common/
|
||||||
|
COPY cmvr-iot-device/pom.xml cmvr-iot-device/
|
||||||
|
COPY cmvr-iot-test/pom.xml cmvr-iot-test/
|
||||||
|
COPY cmvr-iot-api/pom.xml cmvr-iot-api/
|
||||||
|
COPY cmvr-iot-vi/pom.xml cmvr-iot-vi/
|
||||||
|
COPY cmvr-iot-ti/pom.xml cmvr-iot-ti/
|
||||||
|
COPY cmvr-iot-evaluation/pom.xml cmvr-iot-evaluation/
|
||||||
|
COPY cmvr-iot-api/cmvr-iot-llm/pom.xml cmvr-iot-api/cmvr-iot-llm/
|
||||||
|
COPY cmvr-iot-api/cmvr-iot-edge/pom.xml cmvr-iot-api/cmvr-iot-edge/
|
||||||
|
COPY cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-client/pom.xml cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-client/
|
||||||
|
COPY cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib/pom.xml cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib/
|
||||||
|
|
||||||
|
RUN mvn dependency:go-offline -B --no-transfer-progress
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN mvn clean package -DskipTests -pl cmvr-iot-admin -am --no-transfer-progress
|
||||||
|
|
||||||
|
# ====================== 运行阶段 ======================
|
||||||
|
FROM openjdk:8-jdk-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# -------------------------- 【唯一正确写法】 --------------------------
|
||||||
|
# 1. 先把所有jar复制进来
|
||||||
|
COPY --from=builder /app/cmvr-iot-admin/target/*.jar ./
|
||||||
|
|
||||||
|
# 2. 自动删除不能运行的小jar(只保留可执行jar)
|
||||||
|
RUN find . -name "*.jar" -type f -size -20000k -delete
|
||||||
|
|
||||||
|
# 3. 重命名为app.jar
|
||||||
|
RUN mv *.jar app.jar
|
||||||
|
|
||||||
|
ENTRYPOINT ["java", "-jar", \
|
||||||
|
"-Dspring.profiles.active=dev", \
|
||||||
|
"-Djava.security.egd=file:/dev/./urandom", \
|
||||||
|
"-XX:+UseG1GC", \
|
||||||
|
"-Xms512m", "-Xmx1024m", \
|
||||||
|
"app.jar"]
|
||||||
43
Jenkinsfile
vendored
Normal file
43
Jenkinsfile
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
sh 'mvn clean install -Dmaven.test.skip=true'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy') {
|
||||||
|
parallel {
|
||||||
|
stage('Deploy to DEV') {
|
||||||
|
steps {
|
||||||
|
sh './ry.sh start dev'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Deploy to TEST') {
|
||||||
|
steps {
|
||||||
|
sh './ry.sh start test'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Deploy to PROD') {
|
||||||
|
steps {
|
||||||
|
sh './ry.sh start prod'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
archiveArtifacts artifacts: '**/*.jar', allowEmptyArchive: true
|
||||||
|
}
|
||||||
|
success {
|
||||||
|
echo 'Pipeline completed successfully.'
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo 'Pipeline failed.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
311
README.md
311
README.md
@ -1,156 +1,249 @@
|
|||||||
# CMVR IoT 物联网平台
|
# cmvr-iot
|
||||||
|
|
||||||
CMVR IoT 是招商车研机器人及智能设备管理平台。本项目以 RuoYi-Vue 3.9.2 为基础升级到 Spring Boot 4,保留原有 REST、前端和 gRPC 对外接口,并将 QUIC Gateway 集成到主应用进程中。
|
cmvr-iot 是一个基于 Java 8 和 Spring Boot 2.5 的多模块后端工程,提供设备管理、边缘机器人控制、测试编排、巡检、TTS、AIMA、VI/TI 等业务能力。工程入口在 `cmvr-iot-admin`,其余模块按业务和基础能力拆分。
|
||||||
|
|
||||||
Java 包名、Maven 坐标统一使用 `com.cmvr`。旧项目 `cmvr-iot` 仅作为迁移来源,不参与本项目构建。
|
|
||||||
|
|
||||||
## 主要功能
|
|
||||||
|
|
||||||
- 系统管理:用户、角色、部门、菜单、字典、参数、日志和通知。
|
|
||||||
- 机器人设备:以边缘端上报的永久 `robotId` 作为唯一业务身份,自动同步机器人地址、在线状态和设备清单。
|
|
||||||
- 测试业务:任务配置、任务编排、任务实例、检测项、语音唤醒、Flowise 和 AI 评估。
|
|
||||||
- 智能巡检:机器人、地图、点位、任务、执行实例、巡检结果和告警。
|
|
||||||
- 智能座舱:语音交互、触控交互、TTS、语料库和车机操作配置。
|
|
||||||
- 专项业务:爱玛电动车测试、评价指标库和大模型服务。
|
|
||||||
- 边缘控制:通过 gRPC 调用 AGV、相机、机械臂、灵巧手、机器人头部、麦克风和扬声器。
|
|
||||||
- QUIC 接入:节点注册、心跳、设备快照、媒体 DATAGRAM 和 gRPC 地址同步。
|
|
||||||
- 平台能力:Quartz 定时任务、代码生成、WebSocket、MinIO 文件服务和 Knife4j 接口文档。
|
|
||||||
|
|
||||||
## 技术栈
|
## 技术栈
|
||||||
|
|
||||||
| 组件 | 版本或实现 |
|
- Java 8
|
||||||
| --- | --- |
|
- Spring Boot 2.5.15
|
||||||
| Java | 17 |
|
- Spring Security
|
||||||
| Spring Boot | 4.0.6 |
|
- MyBatis Plus / MyBatis Plus Join
|
||||||
| Spring Security | JWT 认证 |
|
- MySQL / Redis
|
||||||
| MyBatis | MyBatis-Plus 3.5.17、MPJ 1.5.9 |
|
- Druid
|
||||||
| 数据库 | MySQL |
|
- Quartz
|
||||||
| 缓存 | Redis |
|
- Knife4j / Swagger
|
||||||
| RPC | gRPC 1.58.0、Protobuf 3.25.5 |
|
- gRPC Java 1.58.0
|
||||||
| QUIC | Netty QUIC 4.2.16.Final |
|
- Protobuf / protoc-maven-plugin
|
||||||
| API 文档 | Springdoc 3.0.3、Knife4j 4.5.0 |
|
- MinIO
|
||||||
| 前端 | Vue 3.4、Element Plus 2.9、Vite 5.3 |
|
|
||||||
|
|
||||||
## 工程结构
|
## 模块说明
|
||||||
|
|
||||||
| 模块 | 说明 |
|
| 模块 | 说明 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `cmvr-iot-admin` | Spring Boot 启动入口、REST 控制器和运行配置 |
|
| `cmvr-iot-admin` | Web 启动模块,包含 REST Controller、启动类和运行配置 |
|
||||||
| `cmvr-iot-framework` | 安全、Web、MyBatis、WebSocket 等框架配置 |
|
| `cmvr-iot-framework` | Web、安全、配置、通用框架能力 |
|
||||||
| `cmvr-iot-common` | 公共模型、注解、异常和工具类 |
|
| `cmvr-iot-common` | 公共工具、通用响应、基础常量和通用能力 |
|
||||||
| `cmvr-iot-system` | 用户、角色、菜单、字典、参数和通用分组 |
|
| `cmvr-iot-system` | 系统管理、用户、角色、菜单、字典等基础业务 |
|
||||||
| `cmvr-iot-quartz` | Quartz 任务调度和任务日志 |
|
| `cmvr-iot-quartz` | 定时任务模块 |
|
||||||
| `cmvr-iot-generator` | 代码生成 |
|
| `cmvr-iot-generator` | 代码生成模块 |
|
||||||
| `cmvr-iot-device` | 设备协议模型、机器人配置和巡检告警监听 |
|
| `cmvr-iot-device` | 设备领域模型与设备相关能力 |
|
||||||
| `cmvr-iot-test` | 测试任务、流程、检测项和执行实例 |
|
| `cmvr-iot-test` | 测试任务、编排、执行实例等业务 |
|
||||||
| `cmvr-iot-vi` | 语音交互业务 |
|
| `cmvr-iot-vi` | VI 相关业务 |
|
||||||
| `cmvr-iot-ti` | 触控交互业务 |
|
| `cmvr-iot-ti` | TI 相关业务 |
|
||||||
| `cmvr-iot-evaluation` | 评价指标业务 |
|
| `cmvr-iot-evaluation` | 评测相关业务 |
|
||||||
| `cmvr-iot-inspection` | 智能巡检业务 |
|
| `cmvr-iot-inspection` | 巡检机器人、地图、任务、告警等业务 |
|
||||||
| `cmvr-iot-aima` | 爱玛电动车专项业务 |
|
| `cmvr-iot-aima` | AIMA 相关业务 |
|
||||||
| `cmvr-iot-tts` | TTS 任务和车载语料 |
|
| `cmvr-iot-tts` | TTS 语音合成相关业务 |
|
||||||
| `cmvr-iot-api` | 边缘服务和大模型 API 聚合模块 |
|
| `cmvr-iot-api` | API 聚合模块 |
|
||||||
| `cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib` | 原有 gRPC 协议及生成代码 |
|
| `cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib` | gRPC proto 与生成代码模块 |
|
||||||
| `cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-client` | 原有机器人 gRPC 客户端 |
|
| `cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-client` | 边缘设备 gRPC 客户端、设备控制服务和请求 VO |
|
||||||
| `cmvr-iot-quic-contract` | QUIC 控制、节点事件和媒体数据协议 |
|
|
||||||
| `cmvr-iot-quic` | 与主应用同进程运行的 QUIC Gateway |
|
|
||||||
| `cmvr-iot-ui-lxl-dev-worktree` | Vue 3 管理控制台(同级独立前端仓库) |
|
|
||||||
|
|
||||||
## 环境准备
|
## 目录结构
|
||||||
|
|
||||||
- JDK 17
|
```text
|
||||||
- Maven 3.6.3 或更高版本
|
cmvr-iot
|
||||||
- MySQL 5.7/8.0
|
├── cmvr-iot-admin # Spring Boot 启动模块
|
||||||
|
├── cmvr-iot-common # 公共模块
|
||||||
|
├── cmvr-iot-framework # 框架模块
|
||||||
|
├── cmvr-iot-system # 系统管理模块
|
||||||
|
├── cmvr-iot-device # 设备模块
|
||||||
|
├── cmvr-iot-test # 测试业务模块
|
||||||
|
├── cmvr-iot-api
|
||||||
|
│ └── cmvr-iot-edge
|
||||||
|
│ ├── cmvr-iot-grpc-lib # proto 与 gRPC 生成代码
|
||||||
|
│ └── cmvr-iot-grpc-client # gRPC 客户端与边缘控制服务
|
||||||
|
├── sql # 增量 SQL
|
||||||
|
├── Dockerfile
|
||||||
|
├── Jenkinsfile
|
||||||
|
└── pom.xml # Maven 父工程
|
||||||
|
```
|
||||||
|
|
||||||
|
## 环境要求
|
||||||
|
|
||||||
|
- JDK 1.8
|
||||||
|
- Maven 3.6+
|
||||||
|
- MySQL 5.7+/8.x
|
||||||
- Redis
|
- Redis
|
||||||
- Node.js 18/20 LTS 和 pnpm 9
|
- 可访问的 gRPC 机器人/边缘终端服务
|
||||||
- MinIO,仅使用文件、语料或媒体存储功能时需要
|
- 可选:MinIO、外部大模型/TTS/评测服务
|
||||||
|
|
||||||
默认激活 `test` profile,后端端口为 `13080`。运行前检查以下配置:
|
注意:`application-*.yml` 中包含环境相关地址、账号和密钥配置。实际部署或本地开发时,应使用本机配置、环境变量或配置中心覆盖,不要直接复用生产/测试环境敏感配置。
|
||||||
|
|
||||||
- `cmvr-iot-admin/src/main/resources/application-test.yml`:MySQL、Redis、MinIO、gRPC 和第三方服务。
|
## 配置文件
|
||||||
- `cmvr-iot-admin/src/main/resources/application.yml`:上传目录、JWT、MyBatis、Knife4j 和 QUIC。
|
|
||||||
- 不要把生产密码、访问密钥或 TLS 私钥提交到仓库。
|
|
||||||
|
|
||||||
## 数据库初始化
|
主配置文件位于:
|
||||||
|
|
||||||
新数据库以 `sql/ry_20260417.sql` 为基础脚本。按实际启用模块检查并执行以下补充脚本:
|
```text
|
||||||
|
cmvr-iot-admin/src/main/resources/application.yml
|
||||||
|
```
|
||||||
|
|
||||||
- `sql/quartz.sql`:Quartz 表结构。
|
环境配置文件位于:
|
||||||
- `sql/aima_module.sql`:爱玛业务。
|
|
||||||
- `sql/inspection_module.sql`、`inspection_result.sql`、`inspection_detection_alert.sql`:巡检业务。
|
|
||||||
- `sql/tts_corpus_module.sql`:TTS 和语料业务。
|
|
||||||
- `sql/robot_quic_identity_migration.sql`:机器人 QUIC 身份、运行状态和设备快照表。
|
|
||||||
- `sql/robot_id_only_migration.sql`:移除巡检机器人和任务实例中的历史终端 ID 字段。
|
|
||||||
|
|
||||||
补充脚本可能面向不同历史库版本。已有数据库升级前应先备份,并确认字段或索引尚未存在。
|
```text
|
||||||
|
cmvr-iot-admin/src/main/resources/application-dev.yml
|
||||||
|
cmvr-iot-admin/src/main/resources/application-test.yml
|
||||||
|
cmvr-iot-admin/src/main/resources/application-prod.yml
|
||||||
|
```
|
||||||
|
|
||||||
## 后端运行
|
当前 `application.yml` 默认激活:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
spring:
|
||||||
|
profiles:
|
||||||
|
active: test
|
||||||
|
```
|
||||||
|
|
||||||
|
如需切换环境,可以修改 `spring.profiles.active`,或启动时指定:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
java -jar cmvr-iot-admin-dev.jar --spring.profiles.active=dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## 构建
|
||||||
|
|
||||||
在项目根目录执行:
|
在项目根目录执行:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mvn clean package -DskipTests
|
mvn clean package -DskipTests
|
||||||
java -jar cmvr-iot-admin/target/cmvr-iot-admin.jar
|
|
||||||
```
|
```
|
||||||
|
|
||||||
也可以在 IDEA 中直接运行:
|
只编译启动模块及其依赖:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mvn -pl cmvr-iot-admin -am compile -DskipTests
|
||||||
|
```
|
||||||
|
|
||||||
|
只重新生成并编译 gRPC 代码:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mvn -pl cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib -am compile -DskipTests
|
||||||
|
```
|
||||||
|
|
||||||
|
## 启动
|
||||||
|
|
||||||
|
启动类:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
com.cmvr.CmvrIotApplication
|
cmvr-iot-admin/src/main/java/com/cmvr/CmvrIotApplication.java
|
||||||
```
|
```
|
||||||
|
|
||||||
DevTools 自动重启已关闭。修改代码后需要完整停止并重新启动应用,避免 MPJ 保留已经关闭的 Spring 上下文。
|
IDE 中直接运行 `CmvrIotApplication` 即可。
|
||||||
|
|
||||||
常用地址:
|
打包后运行:
|
||||||
|
|
||||||
- 后端 API:`http://localhost:13080`
|
|
||||||
- Knife4j 文档:`http://localhost:13080/doc.html`
|
|
||||||
- OpenAPI JSON:`http://localhost:13080/v3/api-docs/00-all`
|
|
||||||
|
|
||||||
Knife4j 只展示带原有 `@ApiOperation` 注解的正式接口,并沿用中文 `@Api(tags=...)` 业务分类。
|
|
||||||
|
|
||||||
## 前端运行
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ../cmvr-iot-ui-lxl-dev-worktree
|
java -jar cmvr-iot-admin/target/cmvr-iot-admin-dev.jar --spring.profiles.active=dev
|
||||||
pnpm install
|
|
||||||
pnpm dev
|
|
||||||
```
|
```
|
||||||
|
|
||||||
默认开发端口为 `80`。`.env.development` 中的 `VITE_API_URL` 必须与后端地址一致;本项目后端默认是 `http://localhost:13080`。更多说明见 [ruoyi-ui/README.md](ruoyi-ui/README.md)。
|
默认开发端口以当前 profile 配置为准,例如 `application-dev.yml` 中为:
|
||||||
|
|
||||||
## gRPC 与 QUIC
|
```yaml
|
||||||
|
server:
|
||||||
|
port: 13080
|
||||||
|
```
|
||||||
|
|
||||||
原有机器人 gRPC 客户端与 proto 均保留,但业务调用只传永久 `robotId`。平台根据 `iot_robot.robot_id` 查找 QUIC 最近同步的 `ip_address` 和 `port`,不再使用终端 ID 或终端配置解析 gRPC 地址。
|
## 接口文档
|
||||||
|
|
||||||
边缘端通过 QUIC 上报设备快照后,平台按 `robotId + deviceId` 写入 `iot_device`。前端选择机器人后只展示该机器人当前在线且启用的设备;单一匹配设备会自动选中并锁定。
|
项目集成 Knife4j / Swagger。服务启动后可访问:
|
||||||
|
|
||||||
QUIC 不是独立服务,`cmvr-iot-quic` 已作为 `cmvr-iot-admin` 的运行时依赖。启用时主应用同时启动:
|
```text
|
||||||
|
http://localhost:13080/doc.html
|
||||||
|
```
|
||||||
|
|
||||||
- QUIC:默认 `0.0.0.0:4433/udp`
|
如果端口或上下文路径被 profile 覆盖,请以实际配置为准。
|
||||||
- 节点和媒体事件:通过 Spring 单例 `NodeEventBroker` 在进程内直接分发,不占用内部端口
|
|
||||||
|
|
||||||
设置 `cmvr.quic.enabled=true` 前必须配置有效的 TLS 证书和私钥,否则应用会拒绝启动。详细配置见 [cmvr-iot-quic/README.md](cmvr-iot-quic/README.md)。
|
## 数据库脚本
|
||||||
|
|
||||||
## 构建与验证
|
增量脚本位于:
|
||||||
|
|
||||||
|
```text
|
||||||
|
sql/
|
||||||
|
```
|
||||||
|
|
||||||
|
当前包含:
|
||||||
|
|
||||||
|
- `aima_module.sql`
|
||||||
|
- `inspection_module.sql`
|
||||||
|
- `tts_corpus_module.sql`
|
||||||
|
|
||||||
|
初始化数据库时,需要结合目标环境的基础库结构和增量脚本执行。
|
||||||
|
|
||||||
|
## gRPC 与边缘设备
|
||||||
|
|
||||||
|
边缘设备相关代码集中在:
|
||||||
|
|
||||||
|
```text
|
||||||
|
cmvr-iot-api/cmvr-iot-edge/
|
||||||
|
```
|
||||||
|
|
||||||
|
proto 文件位于:
|
||||||
|
|
||||||
|
```text
|
||||||
|
cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib/src/main/proto/
|
||||||
|
```
|
||||||
|
|
||||||
|
gRPC 客户端服务位于:
|
||||||
|
|
||||||
|
```text
|
||||||
|
cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-client/src/main/java/com/cmvr/edge/client/
|
||||||
|
```
|
||||||
|
|
||||||
|
边缘控制器位于:
|
||||||
|
|
||||||
|
```text
|
||||||
|
cmvr-iot-admin/src/main/java/com/cmvr/web/controller/api/
|
||||||
|
```
|
||||||
|
|
||||||
|
新增或修改 proto 后,执行 Maven compile 会触发 `protoc-maven-plugin` 生成 Java 和 gRPC Stub 代码。业务代码应复用现有 gRPC 客户端管理工具获取 Stub,避免在业务层重复创建底层 `ManagedChannel`。
|
||||||
|
|
||||||
|
## 实时语音对讲
|
||||||
|
|
||||||
|
当前实时语音对讲链路为:
|
||||||
|
|
||||||
|
```text
|
||||||
|
浏览器 WebSocket Binary PCM <-> Java 后端 <-> gRPC 双向流 <-> 机器人终端
|
||||||
|
```
|
||||||
|
|
||||||
|
约定音频格式:
|
||||||
|
|
||||||
|
- PCM_S16LE
|
||||||
|
- 48000 Hz
|
||||||
|
- 单声道
|
||||||
|
- 16 bit
|
||||||
|
- 10 ms 一帧
|
||||||
|
- 960 bytes/帧
|
||||||
|
|
||||||
|
相关文件:
|
||||||
|
|
||||||
|
- WebSocket 控制器:`cmvr-iot-admin/src/main/java/com/cmvr/web/controller/api/WebRtcSignalingController.java`
|
||||||
|
- 业务会话管理:`cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-client/src/main/java/com/cmvr/edge/client/service/AudioService.java`
|
||||||
|
- gRPC 音频适配:`cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-client/src/main/java/com/cmvr/edge/client/adapter/RobotAudioGrpcAdapter.java`
|
||||||
|
- proto:`cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib/src/main/proto/cmvr/api/robot_audio.proto`
|
||||||
|
|
||||||
|
说明:历史 WebRTC 相关类可能仍保留在源码中,但当前浏览器音频传输链路使用 WebSocket 二进制 PCM。
|
||||||
|
|
||||||
|
## 开发约定
|
||||||
|
|
||||||
|
- Controller 层只做参数接收、基础校验和响应封装。
|
||||||
|
- POST 控制类接口优先使用单个 `@RequestBody VO` 承载完整请求参数。
|
||||||
|
- GET 查询类接口可以使用 query 参数绑定 VO。
|
||||||
|
- 不建议在同一个接口中同时声明通用 VO 和零散业务参数。
|
||||||
|
- gRPC 调用统一通过现有客户端管理类获取 Stub。
|
||||||
|
- proto 修改后必须重新编译并确认生成代码已更新。
|
||||||
|
- 不要提交本地日志、崩溃 dump、临时音频文件和包含真实密钥的配置。
|
||||||
|
|
||||||
|
## 常用命令
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 运行测试
|
# 编译全部模块
|
||||||
mvn test
|
mvn clean compile -DskipTests
|
||||||
|
|
||||||
# 构建全部后端模块
|
# 编译启动模块及依赖
|
||||||
|
mvn -pl cmvr-iot-admin -am compile -DskipTests
|
||||||
|
|
||||||
|
# 打包
|
||||||
mvn clean package -DskipTests
|
mvn clean package -DskipTests
|
||||||
|
|
||||||
# 构建前端生产包
|
# 运行指定 profile
|
||||||
cd ../cmvr-iot-ui-lxl-dev-worktree
|
java -jar cmvr-iot-admin/target/cmvr-iot-admin-dev.jar --spring.profiles.active=dev
|
||||||
pnpm build:prod
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Windows 下也可以使用 `bin/package.bat`、`bin/run.bat` 和 `bin/clean.bat`。
|
|
||||||
|
|
||||||
## 排查提示
|
|
||||||
|
|
||||||
- `ApplicationContext ... has been closed already`:彻底停止旧 Java 进程后重新启动,不要使用 DevTools 热重启。
|
|
||||||
- 找不到机器人或机器人离线:确认资源中心已登记相同的永久 `robotId`,并检查 QUIC 注册日志、`iot_robot` 的地址和连接状态。
|
|
||||||
- QUIC 启动失败:检查证书、私钥、ALPN、UDP 端口占用和 native library 对应的操作系统架构。
|
|
||||||
- 数据库提示缺少字段:确认基础脚本版本及对应模块迁移脚本已经执行。
|
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
@echo off
|
|
||||||
echo.
|
|
||||||
echo [信息] 清理工程target生成路径。
|
|
||||||
echo.
|
|
||||||
|
|
||||||
%~d0
|
|
||||||
cd %~dp0
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
call mvn clean
|
|
||||||
|
|
||||||
pause
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
@echo off
|
|
||||||
echo.
|
|
||||||
echo [信息] 打包Web工程,生成war/jar包文件。
|
|
||||||
echo.
|
|
||||||
|
|
||||||
%~d0
|
|
||||||
cd %~dp0
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
call mvn clean package -Dmaven.test.skip=true
|
|
||||||
|
|
||||||
pause
|
|
||||||
14
bin/run.bat
14
bin/run.bat
@ -1,14 +0,0 @@
|
|||||||
@echo off
|
|
||||||
echo.
|
|
||||||
echo [<5B><>Ϣ] ʹ<><CAB9>Jar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Web<65><62><EFBFBD>̡<EFBFBD>
|
|
||||||
echo.
|
|
||||||
|
|
||||||
cd %~dp0
|
|
||||||
cd ../cmvr-iot-admin/target
|
|
||||||
|
|
||||||
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
|
||||||
|
|
||||||
java -jar %JAVA_OPTS% cmvr-iot-admin.jar
|
|
||||||
|
|
||||||
cd bin
|
|
||||||
pause
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal
|
|
||||||
|
|
||||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0update-grpc-protos.ps1" %*
|
|
||||||
set "exitCode=%ERRORLEVEL%"
|
|
||||||
|
|
||||||
if not "%exitCode%"=="0" (
|
|
||||||
echo.
|
|
||||||
echo CMVR-ES proto update failed.
|
|
||||||
)
|
|
||||||
|
|
||||||
exit /b %exitCode%
|
|
||||||
@ -1,194 +0,0 @@
|
|||||||
param(
|
|
||||||
[string]$Revision,
|
|
||||||
[switch]$Force,
|
|
||||||
[switch]$SkipBuild
|
|
||||||
)
|
|
||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
|
||||||
Set-StrictMode -Version Latest
|
|
||||||
|
|
||||||
function Invoke-CommandChecked {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Executable,
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string[]]$Arguments
|
|
||||||
)
|
|
||||||
|
|
||||||
& $Executable @Arguments
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
throw "$Executable failed with exit code $LASTEXITCODE."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Get-PomProperty {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$PomText,
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Name
|
|
||||||
)
|
|
||||||
|
|
||||||
$escapedName = [Regex]::Escape($Name)
|
|
||||||
$match = [Regex]::Match($PomText, "<$escapedName>([^<]+)</$escapedName>")
|
|
||||||
if (-not $match.Success) {
|
|
||||||
throw "Cannot find Maven property '$Name'."
|
|
||||||
}
|
|
||||||
|
|
||||||
return $match.Groups[1].Value.Trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
function Sync-ProtoDirectory {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Source,
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Destination
|
|
||||||
)
|
|
||||||
|
|
||||||
if (-not (Test-Path -LiteralPath $Source -PathType Container)) {
|
|
||||||
throw "Upstream proto directory does not exist: $Source"
|
|
||||||
}
|
|
||||||
|
|
||||||
New-Item -ItemType Directory -Path $Destination -Force | Out-Null
|
|
||||||
|
|
||||||
$sourceFiles = @{}
|
|
||||||
foreach ($sourceFile in Get-ChildItem -LiteralPath $Source -Filter '*.proto' -File -Recurse) {
|
|
||||||
$relativePath = $sourceFile.FullName.Substring($Source.Length).TrimStart('\', '/')
|
|
||||||
$sourceFiles[$relativePath] = $true
|
|
||||||
|
|
||||||
$destinationFile = Join-Path $Destination $relativePath
|
|
||||||
$destinationDirectory = Split-Path -Parent $destinationFile
|
|
||||||
New-Item -ItemType Directory -Path $destinationDirectory -Force | Out-Null
|
|
||||||
Copy-Item -LiteralPath $sourceFile.FullName -Destination $destinationFile -Force
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($destinationFile in Get-ChildItem -LiteralPath $Destination -Filter '*.proto' -File -Recurse) {
|
|
||||||
$relativePath = $destinationFile.FullName.Substring($Destination.Length).TrimStart('\', '/')
|
|
||||||
if (-not $sourceFiles.ContainsKey($relativePath)) {
|
|
||||||
Remove-Item -LiteralPath $destinationFile.FullName -Force
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
|
||||||
throw 'Git was not found on PATH.'
|
|
||||||
}
|
|
||||||
|
|
||||||
$rootDirectory = Split-Path -Parent $PSScriptRoot
|
|
||||||
$moduleRelativePath = 'cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib'
|
|
||||||
$moduleDirectory = Join-Path $rootDirectory $moduleRelativePath
|
|
||||||
$pomPath = Join-Path $moduleDirectory 'pom.xml'
|
|
||||||
$protoRelativePath = "$moduleRelativePath/src/main/proto/cmvr"
|
|
||||||
$protoDirectory = Join-Path $rootDirectory $protoRelativePath
|
|
||||||
$checkoutDirectory = Join-Path $moduleDirectory 'target/cmvr-es'
|
|
||||||
|
|
||||||
$pomText = [IO.File]::ReadAllText($pomPath)
|
|
||||||
$repository = Get-PomProperty -PomText $pomText -Name 'cmvr.es.repository'
|
|
||||||
$branch = Get-PomProperty -PomText $pomText -Name 'cmvr.es.proto.branch'
|
|
||||||
|
|
||||||
$localProtoChanges = @(& git -C $rootDirectory status --porcelain -- $protoRelativePath)
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
throw 'Unable to inspect local proto changes.'
|
|
||||||
}
|
|
||||||
if ($localProtoChanges.Count -gt 0 -and -not $Force) {
|
|
||||||
throw "Local proto files have uncommitted changes. Commit/stash them first, or rerun with -Force.`n$($localProtoChanges -join "`n")"
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([string]::IsNullOrWhiteSpace($Revision)) {
|
|
||||||
Write-Host "Looking up the latest '$branch' revision..."
|
|
||||||
$remoteLine = @(& git ls-remote $repository "refs/heads/$branch")
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
throw 'Unable to read the upstream branch. Check the network and Git credentials.'
|
|
||||||
}
|
|
||||||
if ($remoteLine.Count -ne 1) {
|
|
||||||
throw "Upstream branch '$branch' was not found or was ambiguous."
|
|
||||||
}
|
|
||||||
$Revision = ($remoteLine[0] -split '\s+')[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($Revision -notmatch '^[0-9a-fA-F]{40}$') {
|
|
||||||
throw "Revision must be a full 40-character Git commit SHA: $Revision"
|
|
||||||
}
|
|
||||||
$Revision = $Revision.ToLowerInvariant()
|
|
||||||
|
|
||||||
$checkoutParent = Split-Path -Parent $checkoutDirectory
|
|
||||||
New-Item -ItemType Directory -Path $checkoutParent -Force | Out-Null
|
|
||||||
|
|
||||||
if (Test-Path -LiteralPath (Join-Path $checkoutDirectory '.git') -PathType Container) {
|
|
||||||
Write-Host 'Refreshing the existing upstream checkout...'
|
|
||||||
Invoke-CommandChecked git @('-C', $checkoutDirectory, 'remote', 'set-url', 'origin', $repository)
|
|
||||||
Invoke-CommandChecked git @('-C', $checkoutDirectory, 'fetch', '--filter=blob:none', 'origin', $branch)
|
|
||||||
} else {
|
|
||||||
if (Test-Path -LiteralPath $checkoutDirectory) {
|
|
||||||
$expectedPath = [IO.Path]::GetFullPath($checkoutDirectory).TrimEnd('\')
|
|
||||||
$actualPath = (Resolve-Path -LiteralPath $checkoutDirectory).Path.TrimEnd('\')
|
|
||||||
if ($actualPath -ne $expectedPath -or (Split-Path -Parent $actualPath) -ne [IO.Path]::GetFullPath($checkoutParent).TrimEnd('\')) {
|
|
||||||
throw "Refusing to replace unexpected checkout path: $actualPath"
|
|
||||||
}
|
|
||||||
Remove-Item -LiteralPath $checkoutDirectory -Recurse -Force
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host 'Cloning the upstream proto repository...'
|
|
||||||
Invoke-CommandChecked git @(
|
|
||||||
'clone', '--filter=blob:none', '--sparse', '--single-branch',
|
|
||||||
'--branch', $branch, $repository, $checkoutDirectory
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Invoke-CommandChecked git @(
|
|
||||||
'-C', $checkoutDirectory, 'sparse-checkout', 'set',
|
|
||||||
'protos/cmvr/api', 'protos/cmvr/msgs', 'protos/cmvr/common'
|
|
||||||
)
|
|
||||||
Invoke-CommandChecked git @('-C', $checkoutDirectory, 'checkout', '--detach', $Revision)
|
|
||||||
|
|
||||||
$actualRevision = (& git -C $checkoutDirectory rev-parse HEAD).Trim()
|
|
||||||
if ($LASTEXITCODE -ne 0 -or $actualRevision -ne $Revision) {
|
|
||||||
throw "Expected revision $Revision, but checked out $actualRevision."
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Syncing proto files from revision $Revision..."
|
|
||||||
foreach ($group in @('api', 'msgs', 'common')) {
|
|
||||||
Sync-ProtoDirectory `
|
|
||||||
-Source (Join-Path $checkoutDirectory "protos/cmvr/$group") `
|
|
||||||
-Destination (Join-Path $protoDirectory $group)
|
|
||||||
}
|
|
||||||
|
|
||||||
$revisionPattern = '(<cmvr\.es\.proto\.revision>)[^<]+(</cmvr\.es\.proto\.revision>)'
|
|
||||||
$revisionRegex = [Regex]::new($revisionPattern)
|
|
||||||
$updatedPomText = $revisionRegex.Replace($pomText, "`${1}$Revision`${2}", 1)
|
|
||||||
if ($updatedPomText -eq $pomText -and (Get-PomProperty -PomText $pomText -Name 'cmvr.es.proto.revision') -ne $Revision) {
|
|
||||||
throw 'Unable to update cmvr.es.proto.revision in pom.xml.'
|
|
||||||
}
|
|
||||||
if ($updatedPomText -ne $pomText) {
|
|
||||||
[IO.File]::WriteAllText($pomPath, $updatedPomText, [Text.UTF8Encoding]::new($false))
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host ''
|
|
||||||
Write-Host 'Updated files:'
|
|
||||||
& git -C $rootDirectory status --short -- $protoRelativePath "$moduleRelativePath/pom.xml"
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
throw 'Unable to show the update summary.'
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not $SkipBuild) {
|
|
||||||
if (-not (Get-Command mvn -ErrorAction SilentlyContinue)) {
|
|
||||||
throw 'Maven was not found on PATH. Proto files were updated, but the verification build was not run.'
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host ''
|
|
||||||
Write-Host 'Running the gRPC verification build...'
|
|
||||||
Push-Location $rootDirectory
|
|
||||||
try {
|
|
||||||
Invoke-CommandChecked mvn @(
|
|
||||||
'-pl', 'cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-client',
|
|
||||||
'-am', 'clean', 'package', '-DskipTests'
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host ''
|
|
||||||
Write-Host "CMVR-ES proto update completed: $Revision"
|
|
||||||
Write-Host 'Review and commit the proto files and pom.xml together.'
|
|
||||||
@ -1,169 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -Eeuo pipefail
|
|
||||||
|
|
||||||
revision=""
|
|
||||||
force=false
|
|
||||||
skip_build=false
|
|
||||||
|
|
||||||
while (($# > 0)); do
|
|
||||||
case "$1" in
|
|
||||||
--revision)
|
|
||||||
if (($# < 2)); then
|
|
||||||
echo "--revision requires a full Git commit SHA." >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
revision="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
--force)
|
|
||||||
force=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--skip-build)
|
|
||||||
skip_build=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown argument: $1" >&2
|
|
||||||
exit 2
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
command -v git >/dev/null 2>&1 || {
|
|
||||||
echo "Git was not found on PATH." >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
script_directory="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
|
|
||||||
root_directory="$(cd -- "$script_directory/.." && pwd -P)"
|
|
||||||
module_relative_path="cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib"
|
|
||||||
module_directory="$root_directory/$module_relative_path"
|
|
||||||
pom_path="$module_directory/pom.xml"
|
|
||||||
proto_relative_path="$module_relative_path/src/main/proto/cmvr"
|
|
||||||
proto_directory="$root_directory/$proto_relative_path"
|
|
||||||
checkout_directory="$module_directory/target/cmvr-es"
|
|
||||||
|
|
||||||
read_pom_property() {
|
|
||||||
local name="$1"
|
|
||||||
local escaped_name="${name//./\\.}"
|
|
||||||
local value
|
|
||||||
value="$(sed -n "s:.*<$escaped_name>\([^<]*\)</$escaped_name>.*:\1:p" "$pom_path" | head -n 1)"
|
|
||||||
if [[ -z "$value" ]]; then
|
|
||||||
echo "Cannot find Maven property '$name'." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
printf '%s' "$value"
|
|
||||||
}
|
|
||||||
|
|
||||||
repository="$(read_pom_property 'cmvr.es.repository')"
|
|
||||||
branch="$(read_pom_property 'cmvr.es.proto.branch')"
|
|
||||||
|
|
||||||
local_proto_changes="$(git -C "$root_directory" status --porcelain -- "$proto_relative_path")"
|
|
||||||
if [[ -n "$local_proto_changes" && "$force" != true ]]; then
|
|
||||||
echo "Local proto files have uncommitted changes:" >&2
|
|
||||||
echo "$local_proto_changes" >&2
|
|
||||||
echo "Commit/stash them first, or rerun with --force." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$revision" ]]; then
|
|
||||||
echo "Looking up the latest '$branch' revision..."
|
|
||||||
remote_line="$(git ls-remote "$repository" "refs/heads/$branch")"
|
|
||||||
if [[ -z "$remote_line" || "$remote_line" == *$'\n'* ]]; then
|
|
||||||
echo "Upstream branch '$branch' was not found or was ambiguous." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
revision="${remote_line%%[[:space:]]*}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
revision="${revision,,}"
|
|
||||||
if [[ ! "$revision" =~ ^[0-9a-f]{40}$ ]]; then
|
|
||||||
echo "Revision must be a full 40-character Git commit SHA: $revision" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p -- "$(dirname -- "$checkout_directory")"
|
|
||||||
if [[ -d "$checkout_directory/.git" ]]; then
|
|
||||||
echo "Refreshing the existing upstream checkout..."
|
|
||||||
git -C "$checkout_directory" remote set-url origin "$repository"
|
|
||||||
git -C "$checkout_directory" fetch --filter=blob:none origin "$branch"
|
|
||||||
else
|
|
||||||
if [[ -e "$checkout_directory" ]]; then
|
|
||||||
checkout_parent="$(cd -- "$(dirname -- "$checkout_directory")" && pwd -P)"
|
|
||||||
expected_parent="$(cd -- "$module_directory/target" && pwd -P)"
|
|
||||||
if [[ "$checkout_parent" != "$expected_parent" || "$(basename -- "$checkout_directory")" != "cmvr-es" ]]; then
|
|
||||||
echo "Refusing to replace unexpected checkout path: $checkout_directory" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
rm -rf -- "$checkout_directory"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Cloning the upstream proto repository..."
|
|
||||||
git clone --filter=blob:none --sparse --single-branch \
|
|
||||||
--branch "$branch" "$repository" "$checkout_directory"
|
|
||||||
fi
|
|
||||||
|
|
||||||
git -C "$checkout_directory" sparse-checkout set \
|
|
||||||
protos/cmvr/api protos/cmvr/msgs protos/cmvr/common
|
|
||||||
git -C "$checkout_directory" checkout --detach "$revision"
|
|
||||||
|
|
||||||
actual_revision="$(git -C "$checkout_directory" rev-parse HEAD)"
|
|
||||||
if [[ "$actual_revision" != "$revision" ]]; then
|
|
||||||
echo "Expected revision $revision, but checked out $actual_revision." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Syncing proto files from revision $revision..."
|
|
||||||
for group in api msgs common; do
|
|
||||||
source_directory="$checkout_directory/protos/cmvr/$group"
|
|
||||||
destination_directory="$proto_directory/$group"
|
|
||||||
if [[ ! -d "$source_directory" ]]; then
|
|
||||||
echo "Upstream proto directory does not exist: $source_directory" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p -- "$destination_directory"
|
|
||||||
find "$destination_directory" -type f -name '*.proto' -delete
|
|
||||||
while IFS= read -r -d '' source_file; do
|
|
||||||
relative_path="${source_file#"$source_directory/"}"
|
|
||||||
destination_file="$destination_directory/$relative_path"
|
|
||||||
mkdir -p -- "$(dirname -- "$destination_file")"
|
|
||||||
cp -- "$source_file" "$destination_file"
|
|
||||||
done < <(find "$source_directory" -type f -name '*.proto' -print0)
|
|
||||||
done
|
|
||||||
|
|
||||||
sed -i \
|
|
||||||
"s#<cmvr\.es\.proto\.revision>[^<]*</cmvr\.es\.proto\.revision>#<cmvr.es.proto.revision>$revision</cmvr.es.proto.revision>#" \
|
|
||||||
"$pom_path"
|
|
||||||
|
|
||||||
updated_revision="$(read_pom_property 'cmvr.es.proto.revision')"
|
|
||||||
if [[ "$updated_revision" != "$revision" ]]; then
|
|
||||||
echo "Unable to update cmvr.es.proto.revision in pom.xml." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Updated files:"
|
|
||||||
git -C "$root_directory" status --short -- \
|
|
||||||
"$proto_relative_path" "$module_relative_path/pom.xml"
|
|
||||||
|
|
||||||
if [[ "$skip_build" != true ]]; then
|
|
||||||
command -v mvn >/dev/null 2>&1 || {
|
|
||||||
echo "Maven was not found on PATH. Proto files were updated, but the verification build was not run." >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Running the gRPC verification build..."
|
|
||||||
(
|
|
||||||
cd -- "$root_directory"
|
|
||||||
mvn -pl cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-client \
|
|
||||||
-am clean package -DskipTests
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "CMVR-ES proto update completed: $revision"
|
|
||||||
echo "Review and commit the proto files and pom.xml together."
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIEKzCCApOgAwIBAgIUTtZCyKM8INYxZKkfwbKdpHKLjn4wDQYJKoZIhvcNAQEL
|
|
||||||
BQAwHTEbMBkGA1UEAwwSQ01WUiBRVUlDIExvY2FsIENBMB4XDTI2MDcyNDA2NDQy
|
|
||||||
MFoXDTM2MDcyMTA2NDQyMFowHTEbMBkGA1UEAwwSQ01WUiBRVUlDIExvY2FsIENB
|
|
||||||
MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAmq2rHldOobaemqNfWggS
|
|
||||||
OVj3inKy6AYjfgtcXUfKs48DDbpZ9gyEd/YPJXA8C2jGPXpxzgnc7a4UCUVQZ8ah
|
|
||||||
ddoJtFcC+Q6BgjeMVqUdUubu5Y9HpkfU3lvnp4KhzvOeFnkKtrCzYIPa2nK3zLc7
|
|
||||||
uCiuLlB+91KQSRXPFbc6N7H/EAfGmUHIwlZGysAkRN7b2TAoR4C7E96JLVtuUQsS
|
|
||||||
VtlEGpunSfuefFzeeZCMS6avLbB+a8Q6yUzLt6pqnheNsDB+jCCXodlJs5XS1AOB
|
|
||||||
W2GOpGFMj7dLoTD+eBIlAlrhWFcwKjzFmtp6LGl/Jy0O+E99X4TL72oNSOdTrO2O
|
|
||||||
iavXABz9IvWR2BrAyo5AKlTJqO6tmZw77iVti8jYi+HsXIVGQKMYwvv5k0jdHeIZ
|
|
||||||
FaDToUbFPP/zj0m8ZraMy+8eNAhScnx6Zs56fcncBuDti6pT+zKisjV1rH/sFvZY
|
|
||||||
wO1UvJlOEbvXrfYLPp58Aqe/toG2nV45a2Q4+x6AETV1AgMBAAGjYzBhMB0GA1Ud
|
|
||||||
DgQWBBRdHz+g2vVmqghDZi2kEHtZfoyHZzAfBgNVHSMEGDAWgBRdHz+g2vVmqghD
|
|
||||||
Zi2kEHtZfoyHZzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkq
|
|
||||||
hkiG9w0BAQsFAAOCAYEASuEoMFiVcg4iTMxO2kshFTJ6LIrqqGXBn+1j+yQ1ennG
|
|
||||||
mqPMo5fBOe/Kp3YWCnREQWu0+EEPEC9qWgIDOIm3v7ch4mZiW31GUOqae6bjprBe
|
|
||||||
er7ySElKGZ5GefKAq++we19A6WHnNxtNAT9BE1VSKUmkxEsnIkuwd+QMmQ9eaIRm
|
|
||||||
8RvzshWdUcyiBJg07sI3rPzPD/YpnfcYlAa2a0+oXJ3o3zlhdbs2S+9fIl+Y/zFN
|
|
||||||
wBaUV6ZNk0RFzOCA+jUq2jU5Y1pODcot3Mp2jCHzp4uTFyVqsoqc5USRB2TUILCP
|
|
||||||
acSbEjD9GnKaNU4miTcftnC85fnBAiZ5btZkXIs72ij+J3VW7QnbcFQG8bElngoR
|
|
||||||
mWizh6ByPQrsvyT0evJjdjpuOzILsVTAn64m0cYpnlR4g5orcEkIJHv4DzMhpXc2
|
|
||||||
CvpcWwk2vJrUuws/LGxDATTAcqtIUIxAkxffqUsdB/6j8fdykNCvXFwNh/uPcawd
|
|
||||||
4kzh6dr+RFzHSMQ6oN16
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
-----BEGIN PRIVATE KEY-----
|
|
||||||
MIIG/wIBADANBgkqhkiG9w0BAQEFAASCBukwggblAgEAAoIBgQCaraseV06htp6a
|
|
||||||
o19aCBI5WPeKcrLoBiN+C1xdR8qzjwMNuln2DIR39g8lcDwLaMY9enHOCdztrhQJ
|
|
||||||
RVBnxqF12gm0VwL5DoGCN4xWpR1S5u7lj0emR9TeW+engqHO854WeQq2sLNgg9ra
|
|
||||||
crfMtzu4KK4uUH73UpBJFc8Vtzo3sf8QB8aZQcjCVkbKwCRE3tvZMChHgLsT3okt
|
|
||||||
W25RCxJW2UQam6dJ+558XN55kIxLpq8tsH5rxDrJTMu3qmqeF42wMH6MIJeh2Umz
|
|
||||||
ldLUA4FbYY6kYUyPt0uhMP54EiUCWuFYVzAqPMWa2nosaX8nLQ74T31fhMvvag1I
|
|
||||||
51Os7Y6Jq9cAHP0i9ZHYGsDKjkAqVMmo7q2ZnDvuJW2LyNiL4exchUZAoxjC+/mT
|
|
||||||
SN0d4hkVoNOhRsU8//OPSbxmtozL7x40CFJyfHpmznp9ydwG4O2LqlP7MqKyNXWs
|
|
||||||
f+wW9ljA7VS8mU4Ru9et9gs+nnwCp7+2gbadXjlrZDj7HoARNXUCAwEAAQKCAYAi
|
|
||||||
e49/pNqWghoTItM9xLldWAhdcMsSH1Y3wgweDoRxqbL2U0I9cFZy0OPZBo+YQowZ
|
|
||||||
RgwLcRbz1MBKPc3aSMWTep95uQEkaVe1YjFS2p3yLqH5AstoFjDuPmJjLWPpuVVX
|
|
||||||
sLXS+wsOO+7lDriLdpjlagpEsHTRqbIZXPeM4YtkwbV5SyZ64ZfCPU4sYo/jW6R6
|
|
||||||
43nDUP9Dw3Nk7XJnNlbpDigY33T4sRPIqUJ+qtsf/WGlx6gzWax6Vni+8gqxQlIe
|
|
||||||
80XG6dHCM3UGFEdGF64PB2FuprsPWBSSau7L7I/gagiIuQbhs9VYXOanz1MQizMU
|
|
||||||
ZdK8cqmG/bpP+uY4VQLJ5Lxu87boEllGFHBOYTCjWq0zatzGMt1/DeggLnjgfC90
|
|
||||||
5kOzlxl403j+4K8nqiHoKpAbOatwTxFz1up6XSecsarE1RKsCq8sIH+FjjCfO1Db
|
|
||||||
hBfv2a7/XemdcxHtl9Q/EOSDaAFOUQfFMDAc3rCH7/vonTzaaZq5ucWmjlBsv2EC
|
|
||||||
gcEAz+cH+3x09pXVOnM7zlWrGAQk69Fj/0BGs7g3GFf8ZvI/kkbez+9J1QGItxj+
|
|
||||||
7Dm4Ay0kgxYi3DxFWbPLHTbFpVg2CyL08IQZSXJzokwz2V/HTd1a+OgzgB/dBNDc
|
|
||||||
V+XnxJI89+SI3VhOQZJG625l//lhHWCy2u0ULE7ZlK3ao95L86bSXQHI4dZ2nWXl
|
|
||||||
0f4ISJmm4qkEJAY+DkQeF3UZLumd1NRxy0LBdbYVM/wZIN+sGsRdQqQ9f+ik6+aX
|
|
||||||
YrjhAoHBAL52dJzIPIN1Z/Y9qxUrVLPE7K8Mm8KLaFIl/ztl3TFqaUvErHi66nx3
|
|
||||||
MTwEnrQIBI31OKxB6Or2JLxYMvDTSVRV1K2tY53+K6Q8giWU4x3zFc/svyl35gkd
|
|
||||||
U1bLdfxXqKMLrvlmVWj6/RMoH7vd/aTcidYVvwOZgtL+6RahS4LfZ9qXAyREFAJa
|
|
||||||
VSI0HW5LLiOBLTegztT1CBVe7xb78bWFMiUkxre4XsLZYwFPzXzVPh6HloDcACDL
|
|
||||||
FPwLrfJrFQKBwQCvGDl90UzEnF4v0vsshLQLDvp1bS1VvTGOjPhB1WBq510o+e0P
|
|
||||||
nM1Gyvr0keWo19elPTDCAjOr3kreCHFpEkcVQRyK9o7pvad6Vx0SNDF6wpKdfm7u
|
|
||||||
sMknAC7prmnU0XkH8c3NTTkDiiqmSObXw2u+UK48ysL3ZLIXuvS+pkk8t6yp8Pa8
|
|
||||||
hBNGOJQ/baFH4TXixx1pScWF/YfoBfB9+w4Rl4loxN9tu7QpSgfDd29GY3qUNIsC
|
|
||||||
5EYzYqD7WIJpD6ECgcEAkdIfdenYas14yw5r7ck/EGO00lDU8B3LwRlWUCOtNihC
|
|
||||||
dcAeTFDPNnwLNehTmYKJ+iXFPh04Nqw9c/YTCk651dfg/RfDLTNsNlIdUqirOkLi
|
|
||||||
cE7SDO2/MTtCkzEzI//5HNvVGx0+RyHioMgXg75yc8ZlwYLku9zMTL7dtnXHWmux
|
|
||||||
F6qGvT1iFGsUwxsjbU4iBQzhkbWMpX70sWf9pZs/c7qGqel+OyrtYkENi/ONYAXj
|
|
||||||
iXxFvmKxtmnFpzNJ+lABAoHBAJjs8jfEXJnJP80t93Bxg6NmfKhxUEm4ovcIeR8U
|
|
||||||
lEfb8Ind1ICrBWGVGOAkirTFZgFAAlEjne+lT1FYgf19oC+XbxFdl/e02M8KfflS
|
|
||||||
01+0/t6lEpefiU0dfW0dWtXOPaAVvpNgMkeMgBzB2Yz7ZNUrMypfCGk289qveWxB
|
|
||||||
8UbO+QLjTI+cFvPsmR95Eti/nAjd2fXGeqbR+z+DdQnz4BvXLSCQCw4on2+T+mpw
|
|
||||||
BprrEQmcdeZA8LE1zgcKtkZR1w==
|
|
||||||
-----END PRIVATE KEY-----
|
|
||||||
@ -1 +0,0 @@
|
|||||||
2C945D70B02014891B6E09D57E377CEFB6D18498
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIDuzCCAiOgAwIBAgIULJRdcLAgFIkbbgnVfjd877bRhJgwDQYJKoZIhvcNAQEL
|
|
||||||
BQAwHTEbMBkGA1UEAwwSQ01WUiBRVUlDIExvY2FsIENBMB4XDTI2MDcyNDA2NDQz
|
|
||||||
NloXDTI4MTAyNjA2NDQzNlowGDEWMBQGA1UEAwwNMTkyLjE2OC4wLjIyMjCCASIw
|
|
||||||
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKdM3i1FYFKqNWJzhfhsD9nRUAuK
|
|
||||||
pzilz5uqCKAt8lKYYC9WnLHOYdiEjcHGnGr02yd6sWFH/LBbxNhzx8M7h4S4izuO
|
|
||||||
bhSlG1EIhkMiojzVD1e3P7YzXdEoVxTCfmMgBZQJG63GNOfzRawFYtEeGv7ndFVw
|
|
||||||
kitCYlyTza5KlBNlWpiNOPmmx4dLTdGLUk8a5TUm0zJ+b/LyzVsWUtr9sxKmKeG8
|
|
||||||
0/77AeiL0hQE3xUt5QROTZjRTVhNHowv410dFMJyIfY4sab8ndc4SIwE9PCKg068
|
|
||||||
4705vbFInBS3eTvQur5VLSZLPatnXGKzCXjci1lIQX2p/QIqADMGFWIN9OECAwEA
|
|
||||||
AaN4MHYwDwYDVR0RBAgwBocEwKgA3jAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0lBAww
|
|
||||||
CgYIKwYBBQUHAwEwHQYDVR0OBBYEFLmoEtsglxm3mXh4l8OF31bt2ZhnMB8GA1Ud
|
|
||||||
IwQYMBaAFF0fP6Da9WaqCENmLaQQe1l+jIdnMA0GCSqGSIb3DQEBCwUAA4IBgQAR
|
|
||||||
eK1mD9rJkzHe4OusimQfcuDQW+0J32e4T/34RHlW+lIj7botFaElXIzO9S80tDwq
|
|
||||||
4d4ozNPKysqgJN9hv/BBMzJpZLwP2XozPaGLTNl1jRTCc9UhFUPrUeu0LbpQGBfC
|
|
||||||
6Ghq42V94zPAw4lnMujnkq8botk21hclbJORQ9kblXP31IdWCgiKSFLy1NTBmQmc
|
|
||||||
IxmR+SldMWYrWGWv/0I85AeMu6HR3+NKHmzDblm1HUHFekyC1f7sypNG+D1r8ab2
|
|
||||||
GSijoCMKHSEOm81Vl/j5bgWQygnnIOhsLOUf2DZO6jC+VZmTKpMEJNHgwk23WBlu
|
|
||||||
FYz/X9p5z9ZucL8aBxegj7G1fI5Ik2O05+LLeqJMfspAm6ZcnRDxCVZWQ+K/dAle
|
|
||||||
fz+gTASzhHTsjEBeiX46LP0L2PVyBiPvNtD66e52LoM5ZigechZq91niLO+ipWdh
|
|
||||||
xq7ryJzmaAEQKPuYaoswriWzJam07ywX9yupGHzBA6vVgGy0jPAsnGCuZXTfDyA=
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE REQUEST-----
|
|
||||||
MIICpDCCAYwCAQAwGDEWMBQGA1UEAwwNMTkyLjE2OC4wLjIyMjCCASIwDQYJKoZI
|
|
||||||
hvcNAQEBBQADggEPADCCAQoCggEBAKdM3i1FYFKqNWJzhfhsD9nRUAuKpzilz5uq
|
|
||||||
CKAt8lKYYC9WnLHOYdiEjcHGnGr02yd6sWFH/LBbxNhzx8M7h4S4izuObhSlG1EI
|
|
||||||
hkMiojzVD1e3P7YzXdEoVxTCfmMgBZQJG63GNOfzRawFYtEeGv7ndFVwkitCYlyT
|
|
||||||
za5KlBNlWpiNOPmmx4dLTdGLUk8a5TUm0zJ+b/LyzVsWUtr9sxKmKeG80/77AeiL
|
|
||||||
0hQE3xUt5QROTZjRTVhNHowv410dFMJyIfY4sab8ndc4SIwE9PCKg0684705vbFI
|
|
||||||
nBS3eTvQur5VLSZLPatnXGKzCXjci1lIQX2p/QIqADMGFWIN9OECAwEAAaBHMEUG
|
|
||||||
CSqGSIb3DQEJDjE4MDYwDwYDVR0RBAgwBocEwKgA3jAOBgNVHQ8BAf8EBAMCBaAw
|
|
||||||
EwYDVR0lBAwwCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggEBAGIcLeCE344z
|
|
||||||
PENI1/oONVHBzMMt5VN0P8jbkJOFgZ3a6AUhfqAmDNBr+8SBym+cX2Y9Q2BsaWAu
|
|
||||||
TKOBN+fs+fh5/NqF0hTNvmXzp89NFK5SlsTjoC21HJvK1HTNuNW8drOxNfWgFW3/
|
|
||||||
gSCutcsWS9hVtYrV2FHQzOvVXvXKfmuTkZE8g92P3BCkvRm+ORxI0QfVS81/Ibnv
|
|
||||||
Yl+t/o2QCphdP+1OWzU6+Pccqi2xCyIc6jqCmh0b01zg265PTTOfICO6WQNtYcOn
|
|
||||||
308avDDpTneGl5vWRVdmmiXPqkc+dCesoguIEDUlerFpDKKY81P2GTpfjki93K7Z
|
|
||||||
2DJPs4P1cU0=
|
|
||||||
-----END CERTIFICATE REQUEST-----
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
-----BEGIN PRIVATE KEY-----
|
|
||||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCnTN4tRWBSqjVi
|
|
||||||
c4X4bA/Z0VALiqc4pc+bqgigLfJSmGAvVpyxzmHYhI3Bxpxq9NsnerFhR/ywW8TY
|
|
||||||
c8fDO4eEuIs7jm4UpRtRCIZDIqI81Q9Xtz+2M13RKFcUwn5jIAWUCRutxjTn80Ws
|
|
||||||
BWLRHhr+53RVcJIrQmJck82uSpQTZVqYjTj5pseHS03Ri1JPGuU1JtMyfm/y8s1b
|
|
||||||
FlLa/bMSpinhvNP++wHoi9IUBN8VLeUETk2Y0U1YTR6ML+NdHRTCciH2OLGm/J3X
|
|
||||||
OEiMBPTwioNOvOO9Ob2xSJwUt3k70Lq+VS0mSz2rZ1xiswl43ItZSEF9qf0CKgAz
|
|
||||||
BhViDfThAgMBAAECggEAC3+johwrdIcNFAMRZUuFE+EYZbCuEV1JHX90aBD8X5uo
|
|
||||||
Obyz2J8xF6z1osjEMbA6W1ZqGF/2oMbv6robc+JUrEU0UZ+2lm3qKJnDw5u+55wz
|
|
||||||
uaFHTF4vr6tcf9llzymRZJUzLTCLLJmKc3orymhtrdEp7GDoNPezM753Y6gt0P7Z
|
|
||||||
AzePK3d7YmEAcRkIDVtqQXyma4CPziItJrcF4Lumww6PxRzqYNb6jB8wsmf0B91U
|
|
||||||
iTtnJQoJfkOGTl5OyPp2s7A+qXqToIqAbIlzcF1Q7i0kohmhZHHIB8Qdk9O8IGb6
|
|
||||||
kZuLbTIdIhTG2vyi8nqz+oMh6D+AJBy+GTLlK0LWCQKBgQDVIrGu9J76R7D3npRy
|
|
||||||
3okc6mVHo2InZaOeai4ZAe/CFVPcHecq7+bx06MxTqge0XYJd5UbO8qfRL5mRc8g
|
|
||||||
JwjUrnCzGvJHFavc3Xs221JgWAaNQ0+PtBKCLHQwbmu8V3NZHXcjyonMuQ2g2oOm
|
|
||||||
TYY7Adedci0SgSFlUy9TjifH6QKBgQDI8lcoojzmYkj0O8oO3dr01XbAEl5pxjyB
|
|
||||||
IsEpal6J8gdbbj8vzdWaGoHs/IoLPtwWbQGx7gUJfYtKp/DORw0WDFJmqrm/PGfh
|
|
||||||
RrLKasjp3GC06BU3GmnoKZxQM8PzY0ELWZsQM0fa+ROC1vMrNcHx5nZvcBwrkKXu
|
|
||||||
CEw2G4miOQKBgDMcUsfF2anjL0jyOl8hhnfsrcT0JUGVWhtPEybkE/7S5n1OnnTp
|
|
||||||
etRbEDNuzVo2mLvEdXlGaVywO4iDDRyEv9Vgz53jxF3PkJsyca3CAosgENInZhjr
|
|
||||||
8dRNnL9Qe3166ypfqoZmt4zkg6QjQpbK2HmmA3K6QpzBYqTNwfeji16hAoGBAKO3
|
|
||||||
pkFp5TpC63NpXxe7s4/0dxrIHHoLU/JWcZAfpMS5Fztr2DlHd3dlj2OY4ZOF9GSl
|
|
||||||
DVN9PEdeLOV3bJ9zjfrfsScKg+mF+pC1PCfk1qqKrZPW3qoVcCIB/OPvOQAMZssr
|
|
||||||
h0Wssid69WWNYXNcChbfELF8Yscvw7Dqu8T9rKYpAoGAByn1Vfu95lAxQ36fxXnk
|
|
||||||
3CC9FkGcdfKGTqkFZHJWiJqaLL6eAbCwO38kywYZLANoSz03Qu3MmD0Gt0wyeP6I
|
|
||||||
a3o0goisV8s5W9q1P1i1K73xlbAPf54QsqoPNuXR8n67I9IzzL7EkPJiUsHuqNHW
|
|
||||||
Ffn4lzHEAxaTksNIaC6oIlo=
|
|
||||||
-----END PRIVATE KEY-----
|
|
||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>cmvr-iot</artifactId>
|
<artifactId>cmvr-iot</artifactId>
|
||||||
<groupId>com.cmvr</groupId>
|
<groupId>com.cmvr</groupId>
|
||||||
<version>3.9.2</version>
|
<version>3.8.9</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -24,20 +24,16 @@
|
|||||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- spring-doc -->
|
<!-- Mysql驱动包 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springdoc</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
|
||||||
<artifactId>knife4j-openapi3-ui</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Mysql驱动包 -->
|
<!-- 测试管理-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>com.cmvr</groupId>
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>cmvr-iot-test</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 核心模块-->
|
<!-- 核心模块-->
|
||||||
@ -58,76 +54,73 @@
|
|||||||
<artifactId>cmvr-iot-generator</artifactId>
|
<artifactId>cmvr-iot-generator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<!-- 设备管理-->
|
||||||
<groupId>com.cmvr</groupId>
|
|
||||||
<artifactId>cmvr-iot-test</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cmvr</groupId>
|
<groupId>com.cmvr</groupId>
|
||||||
<artifactId>cmvr-iot-device</artifactId>
|
<artifactId>cmvr-iot-device</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 语音交互-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cmvr</groupId>
|
<groupId>com.cmvr</groupId>
|
||||||
<artifactId>cmvr-iot-vi</artifactId>
|
<artifactId>cmvr-iot-vi</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 触控交互-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cmvr</groupId>
|
<groupId>com.cmvr</groupId>
|
||||||
<artifactId>cmvr-iot-ti</artifactId>
|
<artifactId>cmvr-iot-ti</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- AI评估-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cmvr</groupId>
|
<groupId>com.cmvr</groupId>
|
||||||
<artifactId>cmvr-iot-evaluation</artifactId>
|
<artifactId>cmvr-iot-evaluation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 智能巡检-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cmvr</groupId>
|
<groupId>com.cmvr</groupId>
|
||||||
<artifactId>cmvr-iot-inspection</artifactId>
|
<artifactId>cmvr-iot-inspection</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 爱玛电动车测试-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cmvr</groupId>
|
<groupId>com.cmvr</groupId>
|
||||||
<artifactId>cmvr-iot-aima</artifactId>
|
<artifactId>cmvr-iot-aima</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.cmvr</groupId>
|
<!-- 智能座舱语音语料采集-->
|
||||||
<artifactId>cmvr-iot-resource</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cmvr</groupId>
|
<groupId>com.cmvr</groupId>
|
||||||
<artifactId>cmvr-iot-tts</artifactId>
|
<artifactId>cmvr-iot-tts</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.cmvr</groupId>
|
|
||||||
<artifactId>cmvr-iot-quic</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<env>dev</env>
|
||||||
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<!-- Spring Boot Maven 插件 -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>2.5.15</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<addResources>true</addResources>
|
<mainClass>com.cmvr.CmvrIotApplication</mainClass>
|
||||||
|
<fork>true</fork> <!-- 如果没有该配置, devtools 不会生效 -->
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>repackage</goal>
|
<goal>repackage</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<finalName>${project.artifactId}-${spring.profiles.active}</finalName>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
|
||||||
<version>3.1.0</version>
|
|
||||||
<configuration>
|
|
||||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
|
||||||
<warName>${project.artifactId}</warName>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
<finalName>${project.artifactId}</finalName>
|
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
package com.cmvr;
|
package com.cmvr;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -11,13 +12,13 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||||||
* @author cmvr-iot
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
|
@MapperScan("com.cmvr.**.mapper")
|
||||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||||
public class CmvrIotApplication
|
public class CmvrIotApplication
|
||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
// MPJ keeps its Spring context in a static holder that is not refreshed by DevTools.
|
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||||
System.setProperty("spring.devtools.restart.enabled", "false");
|
|
||||||
SpringApplication.run(CmvrIotApplication.class, args);
|
SpringApplication.run(CmvrIotApplication.class, args);
|
||||||
System.out.println("招商车研物联网平台启动成功");
|
System.out.println("招商车研物联网平台启动成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,77 +0,0 @@
|
|||||||
package com.cmvr.web.config;
|
|
||||||
|
|
||||||
import com.cmvr.aima.domain.AimaTaskInstance;
|
|
||||||
import com.cmvr.aima.enums.AimaTaskStatusEnum;
|
|
||||||
import com.cmvr.aima.service.IAimaTaskInstanceService;
|
|
||||||
import com.cmvr.inspection.domain.InspectionTaskInstance;
|
|
||||||
import com.cmvr.inspection.service.IInspectionTaskInstanceService;
|
|
||||||
import com.cmvr.test.enums.TaskStatusEnum;
|
|
||||||
import com.cmvr.test.flow.control.FlowControlService;
|
|
||||||
import com.cmvr.test.model.domain.TeTaskInst;
|
|
||||||
import com.cmvr.test.service.ITeTaskInstService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
|
||||||
import org.springframework.context.event.EventListener;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class FlowTaskStartupRecovery {
|
|
||||||
|
|
||||||
private final ITeTaskInstService taskInstService;
|
|
||||||
private final FlowControlService flowControlService;
|
|
||||||
private final IAimaTaskInstanceService aimaTaskInstanceService;
|
|
||||||
private final IInspectionTaskInstanceService inspectionTaskInstanceService;
|
|
||||||
private final Date processStartedAt = new Date();
|
|
||||||
|
|
||||||
@EventListener(ApplicationReadyEvent.class)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void stopOrphanedTasks() {
|
|
||||||
List<String> orphanedInstIds = taskInstService.lambdaQuery()
|
|
||||||
.in(TeTaskInst::getStatus,
|
|
||||||
String.valueOf(TaskStatusEnum.RUNNING.getCode()),
|
|
||||||
String.valueOf(TaskStatusEnum.PAUSED.getCode()))
|
|
||||||
.lt(TeTaskInst::getCreateTime, processStartedAt)
|
|
||||||
.list()
|
|
||||||
.stream()
|
|
||||||
.map(TeTaskInst::getId)
|
|
||||||
.toList();
|
|
||||||
if (orphanedInstIds.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Date now = new Date();
|
|
||||||
for (String instId : orphanedInstIds) {
|
|
||||||
flowControlService.stopOrphaned(instId);
|
|
||||||
}
|
|
||||||
|
|
||||||
aimaTaskInstanceService.lambdaUpdate()
|
|
||||||
.in(AimaTaskInstance::getTaskInsId, orphanedInstIds)
|
|
||||||
.in(AimaTaskInstance::getStatus,
|
|
||||||
AimaTaskStatusEnum.RUNNING.getCode(), AimaTaskStatusEnum.PAUSED.getCode())
|
|
||||||
.set(AimaTaskInstance::getStatus, AimaTaskStatusEnum.STOPPED.getCode())
|
|
||||||
.set(AimaTaskInstance::getEndTime, now)
|
|
||||||
.set(AimaTaskInstance::getUpdateTime, now)
|
|
||||||
.update();
|
|
||||||
|
|
||||||
inspectionTaskInstanceService.lambdaUpdate()
|
|
||||||
.in(InspectionTaskInstance::getTaskInsId, orphanedInstIds)
|
|
||||||
.in(InspectionTaskInstance::getStatus,
|
|
||||||
com.cmvr.inspection.enums.TaskStatusEnum.RUNNING.getCode(),
|
|
||||||
com.cmvr.inspection.enums.TaskStatusEnum.PAUSED.getCode())
|
|
||||||
.set(InspectionTaskInstance::getStatus,
|
|
||||||
com.cmvr.inspection.enums.TaskStatusEnum.STOPPED.getCode())
|
|
||||||
.set(InspectionTaskInstance::getEndTime, now)
|
|
||||||
.set(InspectionTaskInstance::getUpdateTime, now)
|
|
||||||
.update();
|
|
||||||
|
|
||||||
log.warn("应用启动时自动终止遗留流程任务: count={}", orphanedInstIds.size());
|
|
||||||
log.debug("应用启动时自动终止遗留流程任务明细: instIds={}", orphanedInstIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.aima;
|
package com.cmvr.web.controller.aima;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.aima;
|
package com.cmvr.web.controller.aima;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.aima;
|
package com.cmvr.web.controller.aima;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -58,14 +58,6 @@ public class AimaTaskController extends BaseController {
|
|||||||
return toAjax(aimaTaskService.insertAimaTask(aimaTask));
|
return toAjax(aimaTaskService.insertAimaTask(aimaTask));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("复制爱玛任务")
|
|
||||||
@PreAuthorize("@ss.hasPermi('aima:task:add')")
|
|
||||||
@Log(title = "爱玛任务管理", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping("/copy/{id}")
|
|
||||||
public AjaxResult copy(@PathVariable String id) {
|
|
||||||
return success(aimaTaskService.copyAimaTask(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("修改任务")
|
@ApiOperation("修改任务")
|
||||||
@PreAuthorize("@ss.hasPermi('aima:task:edit')")
|
@PreAuthorize("@ss.hasPermi('aima:task:edit')")
|
||||||
@Log(title = "任务管理", businessType = BusinessType.UPDATE)
|
@Log(title = "任务管理", businessType = BusinessType.UPDATE)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.aima;
|
package com.cmvr.web.controller.aima;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -14,7 +14,6 @@ import com.cmvr.common.enums.BusinessType;
|
|||||||
import com.cmvr.aima.domain.AimaTaskInstance;
|
import com.cmvr.aima.domain.AimaTaskInstance;
|
||||||
import com.cmvr.aima.domain.dto.AimaTaskInstanceQuery;
|
import com.cmvr.aima.domain.dto.AimaTaskInstanceQuery;
|
||||||
import com.cmvr.aima.domain.vo.AimaTaskInstanceVo;
|
import com.cmvr.aima.domain.vo.AimaTaskInstanceVo;
|
||||||
import com.cmvr.aima.domain.vo.AimaTaskStartVO;
|
|
||||||
import com.cmvr.aima.service.IAimaTaskInstanceService;
|
import com.cmvr.aima.service.IAimaTaskInstanceService;
|
||||||
import com.cmvr.common.utils.poi.ExcelUtil;
|
import com.cmvr.common.utils.poi.ExcelUtil;
|
||||||
import com.cmvr.common.core.page.TableDataInfo;
|
import com.cmvr.common.core.page.TableDataInfo;
|
||||||
@ -83,17 +82,8 @@ public class AimaTaskInstanceController extends BaseController {
|
|||||||
@PreAuthorize("@ss.hasPermi('aima:taskinstance:edit')")
|
@PreAuthorize("@ss.hasPermi('aima:taskinstance:edit')")
|
||||||
@Log(title = "任务执行实例", businessType = BusinessType.UPDATE)
|
@Log(title = "任务执行实例", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/start/{id}")
|
@PutMapping("/start/{id}")
|
||||||
public AjaxResult start(@PathVariable("id") String id,
|
public AjaxResult start(@PathVariable("id") String id) {
|
||||||
@RequestBody(required = false) AimaTaskStartVO startVO) {
|
return toAjax(aimaTaskInstanceService.startInstance(id));
|
||||||
return toAjax(aimaTaskInstanceService.startInstance(id, startVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("再次执行已完成或失败的爱玛任务")
|
|
||||||
@PreAuthorize("@ss.hasPermi('aima:taskinstance:edit')")
|
|
||||||
@Log(title = "任务执行实例", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping("/rerun/{id}")
|
|
||||||
public AjaxResult rerun(@PathVariable("id") String id) {
|
|
||||||
return success(aimaTaskInstanceService.rerunInstance(id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.aima;
|
package com.cmvr.web.controller.aima;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -58,14 +58,6 @@ public class AimaTestCaseController extends BaseController {
|
|||||||
return toAjax(aimaTestCaseService.insertAimaTestCase(aimaTestCase));
|
return toAjax(aimaTestCaseService.insertAimaTestCase(aimaTestCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("复制测试用例")
|
|
||||||
@PreAuthorize("@ss.hasPermi('aima:testcase:add')")
|
|
||||||
@Log(title = "测试用例管理", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping("/copy/{id}")
|
|
||||||
public AjaxResult copy(@PathVariable String id) {
|
|
||||||
return success(aimaTestCaseService.copyAimaTestCase(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("修改测试用例")
|
@ApiOperation("修改测试用例")
|
||||||
@PreAuthorize("@ss.hasPermi('aima:testcase:edit')")
|
@PreAuthorize("@ss.hasPermi('aima:testcase:edit')")
|
||||||
@Log(title = "测试用例管理", businessType = BusinessType.UPDATE)
|
@Log(title = "测试用例管理", businessType = BusinessType.UPDATE)
|
||||||
|
|||||||
@ -1,19 +1,12 @@
|
|||||||
package com.cmvr.web.controller.aima;
|
package com.cmvr.web.controller.aima;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.cmvr.llm.analysis.AudioAnalysisCorrectionRequest;
|
|
||||||
import com.cmvr.llm.analysis.AudioAnalysisCorrectionSupport;
|
|
||||||
import com.cmvr.llm.analysis.MediaAnalysisClient;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
||||||
import com.cmvr.common.annotation.Log;
|
import com.cmvr.common.annotation.Log;
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
@ -30,13 +23,6 @@ public class AimaTestLogController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IAimaTestLogService aimaTestLogService;
|
private IAimaTestLogService aimaTestLogService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MediaAnalysisClient mediaAnalysisClient;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
@Qualifier("mediaAnalysisTaskExecutor")
|
|
||||||
private ThreadPoolTaskExecutor mediaAnalysisTaskExecutor;
|
|
||||||
|
|
||||||
@ApiOperation("查询测试日志列表")
|
@ApiOperation("查询测试日志列表")
|
||||||
@PreAuthorize("@ss.hasPermi('aima:testlog:list')")
|
@PreAuthorize("@ss.hasPermi('aima:testlog:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ -79,84 +65,6 @@ public class AimaTestLogController extends BaseController {
|
|||||||
return toAjax(aimaTestLogService.updateAimaTestLog(aimaTestLog));
|
return toAjax(aimaTestLogService.updateAimaTestLog(aimaTestLog));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Correct an Aima audio result and submit the stored audio as a training sample.
|
|
||||||
*/
|
|
||||||
@ApiOperation("爱玛声音分析人工改判并重新训练")
|
|
||||||
@PreAuthorize("@ss.hasPermi('aima:testlog:edit')")
|
|
||||||
@Log(title = "声音分析人工改判", businessType = BusinessType.UPDATE)
|
|
||||||
@PostMapping("/audio-correction/{id}")
|
|
||||||
public AjaxResult correctAudio(@PathVariable("id") String id,
|
|
||||||
@jakarta.validation.Valid @RequestBody AudioAnalysisCorrectionRequest correction) {
|
|
||||||
AimaTestLog log = aimaTestLogService.selectAimaTestLogById(id);
|
|
||||||
if (log == null) {
|
|
||||||
return AjaxResult.error("爱玛日志不存在");
|
|
||||||
}
|
|
||||||
JSONObject output = AudioAnalysisCorrectionSupport.parse(log.getActualResult());
|
|
||||||
String mediaUrl = StringUtils.defaultIfBlank(correction.getMediaUrl(),
|
|
||||||
AudioAnalysisCorrectionSupport.mediaUrl(output, null));
|
|
||||||
String profileCode = StringUtils.defaultIfBlank(correction.getProfileCode(),
|
|
||||||
AudioAnalysisCorrectionSupport.profileCode(output, null));
|
|
||||||
if (StringUtils.isBlank(mediaUrl) || StringUtils.isBlank(profileCode)) {
|
|
||||||
return AjaxResult.error("日志缺少音频地址或分析档案");
|
|
||||||
}
|
|
||||||
String requestId = "aima-audio-correction-" + id + "-" + java.util.UUID.randomUUID();
|
|
||||||
JSONObject trainingRequest = AudioAnalysisCorrectionSupport.trainingRequest(
|
|
||||||
requestId, profileCode, mediaUrl, correction);
|
|
||||||
trainingRequest.put("context", new JSONObject()
|
|
||||||
.fluentPut("source", "AIMA_TEST_LOG")
|
|
||||||
.fluentPut("logId", id)
|
|
||||||
.fluentPut("taskInstanceId", log.getTaskInstanceId())
|
|
||||||
.fluentPut("taskId", log.getTaskId())
|
|
||||||
.fluentPut("testCaseId", log.getTestCaseId()));
|
|
||||||
AudioAnalysisCorrectionSupport.apply(output, correction, "RUNNING", null, null);
|
|
||||||
output.getJSONObject("manualCorrection").put("trainingRequestId", requestId);
|
|
||||||
log.setActualResult(output.toJSONString());
|
|
||||||
log.setTestStatus(Boolean.TRUE.equals(output.getBoolean("passed")) ? "1" : "2");
|
|
||||||
log.setLogContent(StringUtils.defaultIfBlank(log.getLogContent(), "") + "(声音分析已人工改判,训练已提交)");
|
|
||||||
aimaTestLogService.updateAimaTestLog(log);
|
|
||||||
try {
|
|
||||||
mediaAnalysisTaskExecutor.execute(() -> trainAimaAudio(id, requestId, trainingRequest));
|
|
||||||
} catch (RuntimeException exception) {
|
|
||||||
updateAimaTraining(id, requestId, "FAILED", null, exception.getMessage());
|
|
||||||
}
|
|
||||||
return AjaxResult.success(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void trainAimaAudio(String logId, String requestId, JSONObject trainingRequest) {
|
|
||||||
try {
|
|
||||||
JSONObject training = mediaAnalysisClient.addAudioReference(trainingRequest);
|
|
||||||
updateAimaTraining(logId, requestId, "SUCCEEDED", training, null);
|
|
||||||
} catch (Exception exception) {
|
|
||||||
updateAimaTraining(logId, requestId, "FAILED", null, exception.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateAimaTraining(String logId, String requestId, String status,
|
|
||||||
JSONObject training, String error) {
|
|
||||||
AimaTestLog current = aimaTestLogService.selectAimaTestLogById(logId);
|
|
||||||
if (current == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JSONObject output = AudioAnalysisCorrectionSupport.parse(current.getActualResult());
|
|
||||||
JSONObject correction = output.getJSONObject("manualCorrection");
|
|
||||||
if (correction == null || !requestId.equals(correction.getString("trainingRequestId"))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
correction.put("trainingStatus", status);
|
|
||||||
if (training != null) {
|
|
||||||
correction.put("training", training);
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(error)) {
|
|
||||||
correction.put("trainingError", error);
|
|
||||||
}
|
|
||||||
current.setActualResult(output.toJSONString());
|
|
||||||
current.setTestStatus(Boolean.TRUE.equals(output.getBoolean("passed")) ? "1" : "2");
|
|
||||||
current.setLogContent(StringUtils.defaultIfBlank(current.getLogContent(), "")
|
|
||||||
+ "(训练" + ("SUCCEEDED".equals(status) ? "完成" : "失败") + ")");
|
|
||||||
aimaTestLogService.updateAimaTestLog(current);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("删除测试日志")
|
@ApiOperation("删除测试日志")
|
||||||
@PreAuthorize("@ss.hasPermi('aima:testlog:remove')")
|
@PreAuthorize("@ss.hasPermi('aima:testlog:remove')")
|
||||||
@Log(title = "测试日志管理", businessType = BusinessType.DELETE)
|
@Log(title = "测试日志管理", businessType = BusinessType.DELETE)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.aima;
|
package com.cmvr.web.controller.aima;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.cmvr.web.controller.api;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cmvr.device.domain.DeDeviceRegistration;
|
||||||
|
import com.cmvr.device.service.IDeDeviceRegistrationService;
|
||||||
|
import com.cmvr.edge.client.service.EdgeSystemService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Api(tags = "边缘--设备信息获取")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/deviceList")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DeviceListController {
|
||||||
|
|
||||||
|
private final EdgeSystemService systemService;
|
||||||
|
private final IDeDeviceRegistrationService registrationService;
|
||||||
|
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:profile:list')")
|
||||||
|
@GetMapping("/addList")
|
||||||
|
@ApiOperation("同步设备信息列表")
|
||||||
|
public int addDeviceList(@RequestParam String terminalId){
|
||||||
|
|
||||||
|
List<DeDeviceRegistration> list = systemService.deviceList(terminalId);
|
||||||
|
|
||||||
|
return registrationService.addDeviceList(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -6,22 +6,18 @@ import com.cmvr.edge.client.model.EdgeCommonVO;
|
|||||||
import com.cmvr.edge.client.model.agv.EdgeAgvMapNameVO;
|
import com.cmvr.edge.client.model.agv.EdgeAgvMapNameVO;
|
||||||
import com.cmvr.edge.client.model.agv.EdgeAgvNavigateToPoseVO;
|
import com.cmvr.edge.client.model.agv.EdgeAgvNavigateToPoseVO;
|
||||||
import com.cmvr.edge.client.model.agv.EdgeAgvNavigateToStationVO;
|
import com.cmvr.edge.client.model.agv.EdgeAgvNavigateToStationVO;
|
||||||
import com.cmvr.edge.client.model.agv.EdgeAgvRelocalizeVO;
|
|
||||||
import com.cmvr.edge.client.model.agv.EdgeAgvStartMappingVO;
|
import com.cmvr.edge.client.model.agv.EdgeAgvStartMappingVO;
|
||||||
import com.cmvr.edge.client.model.agv.EdgeAgvUploadMapVO;
|
import com.cmvr.edge.client.model.agv.EdgeAgvUploadMapVO;
|
||||||
import com.cmvr.edge.client.model.agv.EdgeAgvVelocityVO;
|
import com.cmvr.edge.client.model.agv.EdgeAgvVelocityVO;
|
||||||
import com.cmvr.edge.client.model.agv.EdgeAgvTranslateVO;
|
|
||||||
import com.cmvr.edge.client.service.EdgeAgvService;
|
import com.cmvr.edge.client.service.EdgeAgvService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -52,12 +48,7 @@ public class EdgeAgvController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("获取AGV运行时状态")
|
@ApiOperation("获取AGV运行时状态")
|
||||||
@GetMapping("/getRuntimeState")
|
@GetMapping("/getRuntimeState")
|
||||||
public AjaxResult getRuntimeState(
|
public AjaxResult getRuntimeState(@Validated EdgeCommonVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true)
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true)
|
|
||||||
@RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO vo = commonVo(robotId, deviceId);
|
|
||||||
Agv.AgvRuntimeState state = edgeAgvService.getRuntimeState(vo);
|
Agv.AgvRuntimeState state = edgeAgvService.getRuntimeState(vo);
|
||||||
return AjaxResult.ok(toRuntimeStateMap(state));
|
return AjaxResult.ok(toRuntimeStateMap(state));
|
||||||
}
|
}
|
||||||
@ -67,12 +58,7 @@ public class EdgeAgvController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("获取导航状态")
|
@ApiOperation("获取导航状态")
|
||||||
@GetMapping("/getNavigationStatus")
|
@GetMapping("/getNavigationStatus")
|
||||||
public AjaxResult getNavigationStatus(
|
public AjaxResult getNavigationStatus(@Validated EdgeCommonVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true)
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true)
|
|
||||||
@RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO vo = commonVo(robotId, deviceId);
|
|
||||||
Agv.AgvNavigationStatus status = edgeAgvService.getNavigationStatus(vo);
|
Agv.AgvNavigationStatus status = edgeAgvService.getNavigationStatus(vo);
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("state", status.getState());
|
resultMap.put("state", status.getState());
|
||||||
@ -102,40 +88,6 @@ public class EdgeAgvController {
|
|||||||
return AjaxResult.ok();
|
return AjaxResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 在当前活动地图中重新设置 AGV 定位位姿。
|
|
||||||
*/
|
|
||||||
@ApiOperation("AGV重定位")
|
|
||||||
@PostMapping("/relocalize")
|
|
||||||
public AjaxResult relocalize(@RequestBody @Validated EdgeAgvRelocalizeVO vo) {
|
|
||||||
Agv.AgvPose2d pose = Agv.AgvPose2d.newBuilder()
|
|
||||||
.setX(vo.getX())
|
|
||||||
.setY(vo.getY())
|
|
||||||
.setTheta(vo.getTheta())
|
|
||||||
.build();
|
|
||||||
edgeAgvService.relocalize(vo, pose);
|
|
||||||
return AjaxResult.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("固定距离平移")
|
|
||||||
@PostMapping("/translate")
|
|
||||||
public AjaxResult translate(@RequestBody @Validated EdgeAgvTranslateVO vo) {
|
|
||||||
Agv.AgvTranslationMode mode = vo.getMode() == null
|
|
||||||
? Agv.AgvTranslationMode.AGV_TRANSLATION_MODE_ODOMETRY
|
|
||||||
: Agv.AgvTranslationMode.forNumber(vo.getMode());
|
|
||||||
if (mode == null) {
|
|
||||||
return AjaxResult.error("距离参考模式不合法,允许值:0=里程,1=定位");
|
|
||||||
}
|
|
||||||
Agv.AgvTranslation translation = Agv.AgvTranslation.newBuilder()
|
|
||||||
.setDistance(vo.getDistance())
|
|
||||||
.setVx(vo.getVx())
|
|
||||||
.setVy(vo.getVy())
|
|
||||||
.setMode(mode)
|
|
||||||
.build();
|
|
||||||
edgeAgvService.translate(vo, translation);
|
|
||||||
return AjaxResult.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导航到指定坐标。
|
* 导航到指定坐标。
|
||||||
*/
|
*/
|
||||||
@ -147,7 +99,7 @@ public class EdgeAgvController {
|
|||||||
.setY(vo.getY())
|
.setY(vo.getY())
|
||||||
.setTheta(vo.getTheta())
|
.setTheta(vo.getTheta())
|
||||||
.build();
|
.build();
|
||||||
edgeAgvService.navigateToPose(vo, pose, navigationOptions(vo.getBlockedTimeoutMs()));
|
edgeAgvService.navigateToPose(vo, pose);
|
||||||
return AjaxResult.ok();
|
return AjaxResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +109,7 @@ public class EdgeAgvController {
|
|||||||
@ApiOperation("导航到站点")
|
@ApiOperation("导航到站点")
|
||||||
@PostMapping("/navigateToStation")
|
@PostMapping("/navigateToStation")
|
||||||
public AjaxResult navigateToStation(@RequestBody @Validated EdgeAgvNavigateToStationVO vo) {
|
public AjaxResult navigateToStation(@RequestBody @Validated EdgeAgvNavigateToStationVO vo) {
|
||||||
edgeAgvService.navigateToStation(vo, vo.getStationId(), navigationOptions(vo.getBlockedTimeoutMs()));
|
edgeAgvService.navigateToStation(vo, vo.getStationId());
|
||||||
return AjaxResult.ok();
|
return AjaxResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,12 +173,7 @@ public class EdgeAgvController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("列出所有地图")
|
@ApiOperation("列出所有地图")
|
||||||
@GetMapping("/listMaps")
|
@GetMapping("/listMaps")
|
||||||
public AjaxResult listMaps(
|
public AjaxResult listMaps(@Validated EdgeCommonVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true)
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true)
|
|
||||||
@RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO vo = commonVo(robotId, deviceId);
|
|
||||||
List<String> maps = edgeAgvService.listMaps(vo);
|
List<String> maps = edgeAgvService.listMaps(vo);
|
||||||
return AjaxResult.ok(maps);
|
return AjaxResult.ok(maps);
|
||||||
}
|
}
|
||||||
@ -236,12 +183,7 @@ public class EdgeAgvController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("列出所有站点")
|
@ApiOperation("列出所有站点")
|
||||||
@GetMapping("/listStations")
|
@GetMapping("/listStations")
|
||||||
public AjaxResult listStations(
|
public AjaxResult listStations(@Validated EdgeCommonVO vo) {
|
||||||
@ApiParam(value = "机器人永久ID", required = true)
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true)
|
|
||||||
@RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO vo = commonVo(robotId, deviceId);
|
|
||||||
List<Agv.AgvStation> stations = edgeAgvService.listStations(vo);
|
List<Agv.AgvStation> stations = edgeAgvService.listStations(vo);
|
||||||
List<Map<String, Object>> stationList = new ArrayList<>();
|
List<Map<String, Object>> stationList = new ArrayList<>();
|
||||||
for (Agv.AgvStation station : stations) {
|
for (Agv.AgvStation station : stations) {
|
||||||
@ -275,17 +217,7 @@ public class EdgeAgvController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("下载地图")
|
@ApiOperation("下载地图")
|
||||||
@GetMapping("/downloadMap")
|
@GetMapping("/downloadMap")
|
||||||
public AjaxResult downloadMap(
|
public AjaxResult downloadMap(@Validated EdgeAgvMapNameVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true)
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true)
|
|
||||||
@RequestParam("deviceId") String deviceId,
|
|
||||||
@ApiParam(value = "地图名称", required = true)
|
|
||||||
@RequestParam("mapName") String mapName) {
|
|
||||||
EdgeAgvMapNameVO vo = new EdgeAgvMapNameVO();
|
|
||||||
vo.setRobotId(robotId);
|
|
||||||
vo.setDeviceId(deviceId);
|
|
||||||
vo.setMapName(mapName);
|
|
||||||
String content = edgeAgvService.downloadMap(vo, vo.getMapName());
|
String content = edgeAgvService.downloadMap(vo, vo.getMapName());
|
||||||
return AjaxResult.ok(content);
|
return AjaxResult.ok(content);
|
||||||
}
|
}
|
||||||
@ -320,22 +252,6 @@ public class EdgeAgvController {
|
|||||||
/**
|
/**
|
||||||
* 将 protobuf 运行时状态转换为前端友好的 Map,避免直接暴露 protobuf 对象结构。
|
* 将 protobuf 运行时状态转换为前端友好的 Map,避免直接暴露 protobuf 对象结构。
|
||||||
*/
|
*/
|
||||||
private EdgeCommonVO commonVo(String robotId, String deviceId) {
|
|
||||||
EdgeCommonVO vo = new EdgeCommonVO();
|
|
||||||
vo.setRobotId(robotId);
|
|
||||||
vo.setDeviceId(deviceId);
|
|
||||||
return vo;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Agv.AgvMotionOptions navigationOptions(Integer blockedTimeoutMs) {
|
|
||||||
int timeout = blockedTimeoutMs == null
|
|
||||||
? EdgeAgvService.DEFAULT_BLOCKED_TIMEOUT_MS : blockedTimeoutMs;
|
|
||||||
return Agv.AgvMotionOptions.newBuilder()
|
|
||||||
.setAsynchronous(false)
|
|
||||||
.setBlockedTimeoutMs(timeout)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, Object> toRuntimeStateMap(Agv.AgvRuntimeState state) {
|
private Map<String, Object> toRuntimeStateMap(Agv.AgvRuntimeState state) {
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("timestamp", state.getTimestamp());
|
resultMap.put("timestamp", state.getTimestamp());
|
||||||
|
|||||||
@ -4,18 +4,15 @@ import cmvr.api.ArmCommand;
|
|||||||
import com.cmvr.common.core.domain.AjaxResult;
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||||
import com.cmvr.edge.client.model.arm.*;
|
import com.cmvr.edge.client.model.arm.*;
|
||||||
import com.cmvr.edge.client.model.system.EdgeSystemJsonCommandVO;
|
|
||||||
import com.cmvr.edge.client.service.EdgeArmService;
|
import com.cmvr.edge.client.service.EdgeArmService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,20 +31,14 @@ public class EdgeArmController {
|
|||||||
|
|
||||||
@ApiOperation("关闭力矩")
|
@ApiOperation("关闭力矩")
|
||||||
@GetMapping("/torqueOff")
|
@GetMapping("/torqueOff")
|
||||||
public AjaxResult torqueOff(
|
public AjaxResult torqueOff(EdgeCommonVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO vo = commonVo(robotId, deviceId);
|
|
||||||
edgeArmService.torqueOff(vo);
|
edgeArmService.torqueOff(vo);
|
||||||
return AjaxResult.ok();
|
return AjaxResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("开启力矩")
|
@ApiOperation("开启力矩")
|
||||||
@GetMapping("/torqueOn")
|
@GetMapping("/torqueOn")
|
||||||
public AjaxResult torqueOn(
|
public AjaxResult torqueOn(EdgeCommonVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO vo = commonVo(robotId, deviceId);
|
|
||||||
edgeArmService.torqueOn(vo);
|
edgeArmService.torqueOn(vo);
|
||||||
return AjaxResult.ok();
|
return AjaxResult.ok();
|
||||||
}
|
}
|
||||||
@ -57,50 +48,11 @@ public class EdgeArmController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("清除故障")
|
@ApiOperation("清除故障")
|
||||||
@GetMapping("/clearFault")
|
@GetMapping("/clearFault")
|
||||||
public AjaxResult clearFault(
|
public AjaxResult clearFault(EdgeCommonVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO vo = commonVo(robotId, deviceId);
|
|
||||||
edgeArmService.clearFault(vo);
|
edgeArmService.clearFault(vo);
|
||||||
return AjaxResult.ok();
|
return AjaxResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("执行机械臂厂商扩展JSON指令")
|
|
||||||
@PostMapping("/executeJsonCommand")
|
|
||||||
public AjaxResult executeJsonCommand(@RequestBody @Validated EdgeSystemJsonCommandVO request) {
|
|
||||||
return AjaxResult.ok(com.alibaba.fastjson2.JSON.toJSONString(
|
|
||||||
edgeArmService.executeJsonCommand(request)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("读取机械臂控制柜数字输入")
|
|
||||||
@GetMapping("/cabinet/digitalInput")
|
|
||||||
public AjaxResult getCabinetDigitalInput(
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@RequestParam("deviceId") String deviceId,
|
|
||||||
@RequestParam("index") int index) {
|
|
||||||
return AjaxResult.ok(edgeArmService.getCabinetDigitalInput(commonVo(robotId, deviceId), index));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("读取机械臂控制柜数字输出")
|
|
||||||
@GetMapping("/cabinet/digitalOutput")
|
|
||||||
public AjaxResult getCabinetDigitalOutput(
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@RequestParam("deviceId") String deviceId,
|
|
||||||
@RequestParam("index") int index) {
|
|
||||||
return AjaxResult.ok(edgeArmService.getCabinetDigitalOutput(commonVo(robotId, deviceId), index));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("设置机械臂控制柜数字输出")
|
|
||||||
@PostMapping("/cabinet/digitalOutput")
|
|
||||||
public AjaxResult setCabinetDigitalOutput(
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@RequestParam("deviceId") String deviceId,
|
|
||||||
@RequestParam("index") int index,
|
|
||||||
@RequestParam("value") boolean value) {
|
|
||||||
return AjaxResult.ok(edgeArmService.setCabinetDigitalOutput(
|
|
||||||
commonVo(robotId, deviceId), index, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("关节空间运动")
|
@ApiOperation("关节空间运动")
|
||||||
@PostMapping("/moveJ")
|
@PostMapping("/moveJ")
|
||||||
public AjaxResult moveJ(@RequestBody EdgeArmMoveJVO moveJVO) {
|
public AjaxResult moveJ(@RequestBody EdgeArmMoveJVO moveJVO) {
|
||||||
@ -174,20 +126,14 @@ public class EdgeArmController {
|
|||||||
|
|
||||||
@ApiOperation("停止运动")
|
@ApiOperation("停止运动")
|
||||||
@GetMapping("/stopMotion")
|
@GetMapping("/stopMotion")
|
||||||
public AjaxResult stopMotion(
|
public AjaxResult stopMotion(EdgeCommonVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO vo = commonVo(robotId, deviceId);
|
|
||||||
edgeArmService.stopMotion(vo);
|
edgeArmService.stopMotion(vo);
|
||||||
return AjaxResult.ok();
|
return AjaxResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取关节状态")
|
@ApiOperation("获取关节状态")
|
||||||
@GetMapping("/getJointState")
|
@GetMapping("/getJointState")
|
||||||
public AjaxResult getJointState(
|
public AjaxResult getJointState(EdgeCommonVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO vo = commonVo(robotId, deviceId);
|
|
||||||
ArmCommand.JointResponse result = edgeArmService.getJointState(vo);
|
ArmCommand.JointResponse result = edgeArmService.getJointState(vo);
|
||||||
ArmCommand.JointState state = result.getState();
|
ArmCommand.JointState state = result.getState();
|
||||||
|
|
||||||
@ -204,12 +150,7 @@ public class EdgeArmController {
|
|||||||
|
|
||||||
@ApiOperation("获取末端位姿")
|
@ApiOperation("获取末端位姿")
|
||||||
@GetMapping("/getPose")
|
@GetMapping("/getPose")
|
||||||
public AjaxResult getPose(
|
public AjaxResult getPose(@Validated EdgeArmPoseQueryVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId,
|
|
||||||
@ApiParam("基座连杆名称") @RequestParam(value = "baseLink", required = false) String baseLink,
|
|
||||||
@ApiParam("末端执行器连杆名称") @RequestParam(value = "eeLink", required = false) String eeLink) {
|
|
||||||
EdgeArmPoseQueryVO vo = poseQueryVo(robotId, deviceId, baseLink, eeLink);
|
|
||||||
ArmCommand.GetPose.Response result = edgeArmService.getPose(vo, vo.getBaseLink(), vo.getEeLink());
|
ArmCommand.GetPose.Response result = edgeArmService.getPose(vo, vo.getBaseLink(), vo.getEeLink());
|
||||||
ArmCommand.CartesianPose pose = result.getPose();
|
ArmCommand.CartesianPose pose = result.getPose();
|
||||||
|
|
||||||
@ -227,26 +168,14 @@ public class EdgeArmController {
|
|||||||
|
|
||||||
@ApiOperation("标定零点")
|
@ApiOperation("标定零点")
|
||||||
@GetMapping("/calibrateZeroQ")
|
@GetMapping("/calibrateZeroQ")
|
||||||
public AjaxResult calibrateZeroQ(
|
public AjaxResult calibrateZeroQ(@Validated EdgeArmCalibrateZeroQVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId,
|
|
||||||
@ApiParam(value = "关节名称", required = true) @RequestParam("jointName") String jointName) {
|
|
||||||
EdgeArmCalibrateZeroQVO vo = new EdgeArmCalibrateZeroQVO();
|
|
||||||
vo.setRobotId(robotId);
|
|
||||||
vo.setDeviceId(deviceId);
|
|
||||||
vo.setJointName(jointName);
|
|
||||||
edgeArmService.calibrateZeroQ(vo, vo.getJointName());
|
edgeArmService.calibrateZeroQ(vo, vo.getJointName());
|
||||||
return AjaxResult.ok();
|
return AjaxResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取位姿矩阵")
|
@ApiOperation("获取位姿矩阵")
|
||||||
@GetMapping("/getPoseMatrix")
|
@GetMapping("/getPoseMatrix")
|
||||||
public AjaxResult getPoseMatrix(
|
public AjaxResult getPoseMatrix(@Validated EdgeArmPoseQueryVO vo) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId,
|
|
||||||
@ApiParam("基座连杆名称") @RequestParam(value = "baseLink", required = false) String baseLink,
|
|
||||||
@ApiParam("末端执行器连杆名称") @RequestParam(value = "eeLink", required = false) String eeLink) {
|
|
||||||
EdgeArmPoseQueryVO vo = poseQueryVo(robotId, deviceId, baseLink, eeLink);
|
|
||||||
ArmCommand.GetPoseMatrix.Response result = edgeArmService.getPoseMatrix(vo, vo.getBaseLink(), vo.getEeLink());
|
ArmCommand.GetPoseMatrix.Response result = edgeArmService.getPoseMatrix(vo, vo.getBaseLink(), vo.getEeLink());
|
||||||
// 将TransformMatrix4x4转换为Map
|
// 将TransformMatrix4x4转换为Map
|
||||||
ArmCommand.TransformMatrix4x4 matrix = result.getMatrix();
|
ArmCommand.TransformMatrix4x4 matrix = result.getMatrix();
|
||||||
@ -300,20 +229,4 @@ public class EdgeArmController {
|
|||||||
matrixMap.put("m33", matrix.getM33());
|
matrixMap.put("m33", matrix.getM33());
|
||||||
return AjaxResult.ok(matrixMap);
|
return AjaxResult.ok(matrixMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EdgeCommonVO commonVo(String robotId, String deviceId) {
|
|
||||||
EdgeCommonVO vo = new EdgeCommonVO();
|
|
||||||
vo.setRobotId(robotId);
|
|
||||||
vo.setDeviceId(deviceId);
|
|
||||||
return vo;
|
|
||||||
}
|
|
||||||
|
|
||||||
private EdgeArmPoseQueryVO poseQueryVo(String robotId, String deviceId, String baseLink, String eeLink) {
|
|
||||||
EdgeArmPoseQueryVO vo = new EdgeArmPoseQueryVO();
|
|
||||||
vo.setRobotId(robotId);
|
|
||||||
vo.setDeviceId(deviceId);
|
|
||||||
vo.setBaseLink(baseLink);
|
|
||||||
vo.setEeLink(eeLink);
|
|
||||||
return vo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,62 +0,0 @@
|
|||||||
package com.cmvr.web.controller.api;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
|
||||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopHeartbeatVO;
|
|
||||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopOpenVO;
|
|
||||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopSetpointVO;
|
|
||||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopStopVO;
|
|
||||||
import com.cmvr.edge.client.service.EdgeArmTeleopService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@Api(tags = "Edge - Arm teleoperation")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/edge/armTeleop")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class EdgeArmTeleopController extends BaseController {
|
|
||||||
|
|
||||||
private final EdgeArmTeleopService edgeArmTeleopService;
|
|
||||||
|
|
||||||
@ApiOperation("Open an arm teleoperation session")
|
|
||||||
@PostMapping("/open")
|
|
||||||
public AjaxResult open(@RequestBody EdgeArmTeleopOpenVO request) {
|
|
||||||
return success(edgeArmTeleopService.open(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Send an arm joint setpoint")
|
|
||||||
@PostMapping("/setpoint")
|
|
||||||
public AjaxResult setpoint(@RequestBody EdgeArmTeleopSetpointVO request) {
|
|
||||||
edgeArmTeleopService.sendSetpoint(request);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Send a teleoperation heartbeat")
|
|
||||||
@PostMapping("/heartbeat")
|
|
||||||
public AjaxResult heartbeat(@RequestBody EdgeArmTeleopHeartbeatVO request) {
|
|
||||||
edgeArmTeleopService.heartbeat(request);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Get the latest teleoperation state")
|
|
||||||
@GetMapping("/status")
|
|
||||||
public AjaxResult status(@RequestParam("sessionId") String sessionId) {
|
|
||||||
Object status = edgeArmTeleopService.getStatus(sessionId);
|
|
||||||
return success(status == null ? null : JSON.toJSONString(status));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Stop an arm teleoperation session")
|
|
||||||
@PostMapping("/stop")
|
|
||||||
public AjaxResult stop(@RequestBody EdgeArmTeleopStopVO request) {
|
|
||||||
edgeArmTeleopService.stop(request);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,24 +4,13 @@ import com.alibaba.fastjson2.JSON;
|
|||||||
import com.cmvr.common.core.controller.BaseController;
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||||
import com.cmvr.edge.client.model.camera.EdgeCameraPtzVO;
|
|
||||||
import com.cmvr.edge.client.service.EdgeCameraService;
|
import com.cmvr.edge.client.service.EdgeCameraService;
|
||||||
import com.cmvr.web.service.CameraStreamTicketService;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.CacheControl;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
|
||||||
|
|
||||||
@Api(tags = "边缘--相机")
|
@Api(tags = "边缘--相机")
|
||||||
@RestController
|
@RestController
|
||||||
@ -30,127 +19,46 @@ import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBo
|
|||||||
public class EdgeCameraController extends BaseController {
|
public class EdgeCameraController extends BaseController {
|
||||||
|
|
||||||
private final EdgeCameraService edgeCameraService;
|
private final EdgeCameraService edgeCameraService;
|
||||||
private final CameraStreamTicketService cameraStreamTicketService;
|
|
||||||
|
|
||||||
@ApiOperation("获取相机状态")
|
@ApiOperation("获取相机状态")
|
||||||
@GetMapping("/status")
|
@GetMapping("/status")
|
||||||
public AjaxResult status(
|
public AjaxResult status(EdgeCommonVO edgeCommonVO) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO edgeCommonVO = commonVo(robotId, deviceId);
|
|
||||||
return success(JSON.toJSONString(edgeCameraService.status(edgeCommonVO)));
|
return success(JSON.toJSONString(edgeCameraService.status(edgeCommonVO)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("开启相机")
|
@ApiOperation("开启相机")
|
||||||
@GetMapping("/start")
|
@GetMapping("/start")
|
||||||
public AjaxResult start(
|
public AjaxResult start(EdgeCommonVO edgeCommonVO) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO edgeCommonVO = commonVo(robotId, deviceId);
|
|
||||||
return success(edgeCameraService.start(edgeCommonVO));
|
return success(edgeCameraService.start(edgeCommonVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("关闭相机")
|
@ApiOperation("关闭相机")
|
||||||
@GetMapping("/stop")
|
@GetMapping("/stop")
|
||||||
public AjaxResult stop(
|
public AjaxResult stop(EdgeCommonVO edgeCommonVO) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO edgeCommonVO = commonVo(robotId, deviceId);
|
|
||||||
return success(edgeCameraService.stop(edgeCommonVO));
|
return success(edgeCameraService.stop(edgeCommonVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取图片")
|
@ApiOperation("获取图片")
|
||||||
@GetMapping("/getRGBImage")
|
@GetMapping("/getRGBImage")
|
||||||
public AjaxResult getRGBImage(
|
public AjaxResult getRGBImage(EdgeCommonVO edgeCommonVO) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO edgeCommonVO = commonVo(robotId, deviceId);
|
|
||||||
return success(edgeCameraService.getRGBImage(edgeCommonVO));
|
return success(edgeCameraService.getRGBImage(edgeCommonVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("Get one depth image")
|
|
||||||
@GetMapping("/getDepthImage")
|
|
||||||
public AjaxResult getDepthImage(
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@RequestParam("deviceId") String deviceId) {
|
|
||||||
return success(edgeCameraService.getDepthImage(commonVo(robotId, deviceId)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Control camera PTZ")
|
|
||||||
@PostMapping("/controlPtz")
|
|
||||||
public AjaxResult controlPtz(@RequestBody EdgeCameraPtzVO request) {
|
|
||||||
return success(edgeCameraService.controlPtz(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Get a short-lived RGB video stream URL")
|
|
||||||
@GetMapping("/rgb-stream-url")
|
|
||||||
public AjaxResult rgbStreamUrl(
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@RequestParam("deviceId") String deviceId) {
|
|
||||||
String ticket = cameraStreamTicketService.issue(robotId, deviceId);
|
|
||||||
return success((Object) ("/api/edge/camera/rgb-stream?ticket=" + ticket));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("RGB fragmented MP4 live stream")
|
|
||||||
@GetMapping(value = "/rgb-stream", produces = "video/mp4")
|
|
||||||
public ResponseEntity<StreamingResponseBody> rgbStream(@RequestParam("ticket") String ticket) {
|
|
||||||
CameraStreamTicketService.StreamTarget target = cameraStreamTicketService.consume(ticket);
|
|
||||||
if (target == null) {
|
|
||||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
|
|
||||||
}
|
|
||||||
return videoStreamResponse(target.robotId(), target.deviceId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Public RGB fragmented MP4 live stream")
|
|
||||||
@GetMapping(value = "/rgb-stream/public", produces = "video/mp4")
|
|
||||||
public ResponseEntity<StreamingResponseBody> publicRgbStream(
|
|
||||||
@RequestParam("robotId") String robotId,
|
|
||||||
@RequestParam("deviceId") String deviceId) {
|
|
||||||
return videoStreamResponse(robotId, deviceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ResponseEntity<StreamingResponseBody> videoStreamResponse(String robotId, String deviceId) {
|
|
||||||
StreamingResponseBody body = outputStream -> edgeCameraService.writeRGBVideoStream(
|
|
||||||
robotId, deviceId, outputStream);
|
|
||||||
return ResponseEntity.ok()
|
|
||||||
.contentType(MediaType.parseMediaType("video/mp4"))
|
|
||||||
.cacheControl(CacheControl.noStore())
|
|
||||||
.header("X-Accel-Buffering", "no")
|
|
||||||
.header("X-Content-Type-Options", "nosniff")
|
|
||||||
.body(body);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("开始录制视频")
|
@ApiOperation("开始录制视频")
|
||||||
@GetMapping("/startRecording")
|
@GetMapping("/startRecording")
|
||||||
public AjaxResult startRecording(
|
public AjaxResult startRecording(EdgeCommonVO edgeCommonVO) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO edgeCommonVO = commonVo(robotId, deviceId);
|
|
||||||
return success(edgeCameraService.startRecording(edgeCommonVO));
|
return success(edgeCameraService.startRecording(edgeCommonVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("停止录制视频")
|
@ApiOperation("停止录制视频")
|
||||||
@GetMapping("/stopRecording")
|
@GetMapping("/stopRecording")
|
||||||
public AjaxResult stopRecording(
|
public AjaxResult stopRecording(EdgeCommonVO edgeCommonVO) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO edgeCommonVO = commonVo(robotId, deviceId);
|
|
||||||
return success(edgeCameraService.stopRecording(edgeCommonVO));
|
return success(edgeCameraService.stopRecording(edgeCommonVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取图片和视频")
|
@ApiOperation("获取图片和视频")
|
||||||
@GetMapping("/getRGBDImages")
|
@GetMapping("/getRGBDImages")
|
||||||
public AjaxResult getRGBDImages(
|
public AjaxResult getRGBDImages(EdgeCommonVO edgeCommonVO) {
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam("robotId") String robotId,
|
|
||||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
|
||||||
EdgeCommonVO edgeCommonVO = commonVo(robotId, deviceId);
|
|
||||||
return success(edgeCameraService.getRGBDImages(edgeCommonVO));
|
return success(edgeCameraService.getRGBDImages(edgeCommonVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
private EdgeCommonVO commonVo(String robotId, String deviceId) {
|
|
||||||
EdgeCommonVO vo = new EdgeCommonVO();
|
|
||||||
vo.setRobotId(robotId);
|
|
||||||
vo.setDeviceId(deviceId);
|
|
||||||
return vo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,9 +25,9 @@ public class EdgeDexHandController extends BaseController {
|
|||||||
@GetMapping("/status")
|
@GetMapping("/status")
|
||||||
public AjaxResult status(
|
public AjaxResult status(
|
||||||
@RequestParam("deviceId") String deviceId,
|
@RequestParam("deviceId") String deviceId,
|
||||||
@RequestParam("robotId") String robotId
|
@RequestParam("terminalId") String terminalId
|
||||||
) {
|
) {
|
||||||
return success(JSON.parseObject(JSON.toJSONString(edgeDexHandService.getStatus(robotId, deviceId)), Map.class));
|
return success(JSON.parseObject(JSON.toJSONString(edgeDexHandService.getStatus(terminalId, deviceId)), Map.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -35,11 +35,11 @@ public class EdgeDexHandController extends BaseController {
|
|||||||
@GetMapping("/angle")
|
@GetMapping("/angle")
|
||||||
public AjaxResult setAngle(
|
public AjaxResult setAngle(
|
||||||
@RequestParam("deviceId") String deviceId,
|
@RequestParam("deviceId") String deviceId,
|
||||||
@RequestParam("robotId") String robotId,
|
@RequestParam("terminalId") String terminalId,
|
||||||
@RequestParam("id") int id,
|
@RequestParam("id") int id,
|
||||||
@RequestParam("value") float value
|
@RequestParam("value") float value
|
||||||
) {
|
) {
|
||||||
edgeDexHandService.setDexHandAngle(robotId, deviceId, id, value);
|
edgeDexHandService.setDexHandAngle(terminalId, deviceId, id, value);
|
||||||
return success("ok");
|
return success("ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,8 +48,8 @@ public class EdgeDexHandController extends BaseController {
|
|||||||
@GetMapping("/sensor")
|
@GetMapping("/sensor")
|
||||||
public AjaxResult sensor(
|
public AjaxResult sensor(
|
||||||
@RequestParam("deviceId") String deviceId,
|
@RequestParam("deviceId") String deviceId,
|
||||||
@RequestParam("robotId") String robotId
|
@RequestParam("terminalId") String terminalId
|
||||||
) {
|
) {
|
||||||
return success(JSON.parseObject(edgeDexHandService.getSensorData(robotId, deviceId), Map.class));
|
return success(JSON.parseObject(edgeDexHandService.getSensorData(terminalId, deviceId), Map.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,9 +25,9 @@ public class EdgeMicrophoneController {
|
|||||||
@ApiOperation("获取麦克风状态")
|
@ApiOperation("获取麦克风状态")
|
||||||
@PreAuthorize("@ss.hasPermi('system:microphone:query')")
|
@PreAuthorize("@ss.hasPermi('system:microphone:query')")
|
||||||
@GetMapping("/status")
|
@GetMapping("/status")
|
||||||
public AjaxResult getStatus(@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam String robotId, @ApiParam (value = "设备ID", required = true) @RequestParam String deviceId) {
|
public AjaxResult getStatus(@ApiParam(value = "终端设备ID", required = true) @RequestParam String terminalId, @ApiParam (value = "设备ID", required = true) @RequestParam String deviceId) {
|
||||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||||
edgeCommonVO.setRobotId(robotId);
|
edgeCommonVO.setTerminalId(terminalId);
|
||||||
edgeCommonVO.setDeviceId(deviceId);
|
edgeCommonVO.setDeviceId(deviceId);
|
||||||
return AjaxResult.success(microphoneService.getStatus(edgeCommonVO));
|
return AjaxResult.success(microphoneService.getStatus(edgeCommonVO));
|
||||||
}
|
}
|
||||||
@ -44,7 +44,8 @@ public class EdgeMicrophoneController {
|
|||||||
@PreAuthorize("@ss.hasPermi('system:microphone:stop')")
|
@PreAuthorize("@ss.hasPermi('system:microphone:stop')")
|
||||||
@PostMapping("/stop")
|
@PostMapping("/stop")
|
||||||
public AjaxResult stopRecord(@RequestBody EdgeCommonVO edgeCommonVO) {
|
public AjaxResult stopRecord(@RequestBody EdgeCommonVO edgeCommonVO) {
|
||||||
return AjaxResult.success(microphoneService.stopRecord(edgeCommonVO));
|
microphoneService.stopRecord(edgeCommonVO);
|
||||||
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("暂停录音")
|
@ApiOperation("暂停录音")
|
||||||
@ -74,9 +75,9 @@ public class EdgeMicrophoneController {
|
|||||||
@ApiOperation("获取音量")
|
@ApiOperation("获取音量")
|
||||||
@PreAuthorize("@ss.hasPermi('system:microphone:volume')")
|
@PreAuthorize("@ss.hasPermi('system:microphone:volume')")
|
||||||
@GetMapping("/volume")
|
@GetMapping("/volume")
|
||||||
public AjaxResult getVolume(@ApiParam(value = "机器人永久唯一ID", required = true) @RequestParam String robotId, @ApiParam (value = "设备ID", required = true) @RequestParam String deviceId) {
|
public AjaxResult getVolume(@ApiParam(value = "终端设备ID", required = true) @RequestParam String terminalId, @ApiParam (value = "设备ID", required = true) @RequestParam String deviceId) {
|
||||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||||
edgeCommonVO.setRobotId(robotId);
|
edgeCommonVO.setTerminalId(terminalId);
|
||||||
edgeCommonVO.setDeviceId(deviceId);
|
edgeCommonVO.setDeviceId(deviceId);
|
||||||
return AjaxResult.success(microphoneService.getVolume(edgeCommonVO));
|
return AjaxResult.success(microphoneService.getVolume(edgeCommonVO));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,114 +0,0 @@
|
|||||||
package com.cmvr.web.controller.api;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
|
||||||
import com.cmvr.edge.client.model.motor.EdgeMotorCyclicOpenVO;
|
|
||||||
import com.cmvr.edge.client.model.motor.EdgeMotorCyclicSetpointVO;
|
|
||||||
import com.cmvr.edge.client.model.motor.EdgeMotorEnabledVO;
|
|
||||||
import com.cmvr.edge.client.model.motor.EdgeMotorMotionVO;
|
|
||||||
import com.cmvr.edge.client.model.motor.EdgeMotorTargetVO;
|
|
||||||
import com.cmvr.edge.client.service.EdgeMotorService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@Api(tags = "Edge - Motor")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/edge/motor")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class EdgeMotorController extends BaseController {
|
|
||||||
|
|
||||||
private final EdgeMotorService edgeMotorService;
|
|
||||||
|
|
||||||
@ApiOperation("Set the current motor position as zero")
|
|
||||||
@PostMapping("/setZero")
|
|
||||||
public AjaxResult setZero(@RequestBody EdgeMotorTargetVO request) {
|
|
||||||
return protobuf(edgeMotorService.setZero(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Move motor to zero")
|
|
||||||
@PostMapping("/moveToZero")
|
|
||||||
public AjaxResult moveToZero(@RequestBody EdgeMotorMotionVO request) {
|
|
||||||
return protobuf(edgeMotorService.moveToZero(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Execute profile position control")
|
|
||||||
@PostMapping("/profilePosition")
|
|
||||||
public AjaxResult profilePosition(@RequestBody EdgeMotorMotionVO request) {
|
|
||||||
return protobuf(edgeMotorService.profilePosition(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Execute profile velocity control")
|
|
||||||
@PostMapping("/profileVelocity")
|
|
||||||
public AjaxResult profileVelocity(@RequestBody EdgeMotorMotionVO request) {
|
|
||||||
return protobuf(edgeMotorService.profileVelocity(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Emergency stop a motor")
|
|
||||||
@PostMapping("/emergencyStop")
|
|
||||||
public AjaxResult emergencyStop(@RequestBody EdgeMotorTargetVO request) {
|
|
||||||
return protobuf(edgeMotorService.emergencyStop(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Get motor status")
|
|
||||||
@PostMapping("/status")
|
|
||||||
public AjaxResult status(@RequestBody EdgeMotorTargetVO request) {
|
|
||||||
return protobuf(edgeMotorService.getStatus(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Enable or disable a motor")
|
|
||||||
@PostMapping("/enabled")
|
|
||||||
public AjaxResult enabled(@RequestBody EdgeMotorEnabledVO request) {
|
|
||||||
return protobuf(edgeMotorService.setEnabled(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Open cyclic position stream")
|
|
||||||
@PostMapping("/cyclicPosition/open")
|
|
||||||
public AjaxResult openCyclicPosition(@RequestBody EdgeMotorCyclicOpenVO request) {
|
|
||||||
return success(edgeMotorService.openCyclicPosition(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Send cyclic position setpoint")
|
|
||||||
@PostMapping("/cyclicPosition/setpoint")
|
|
||||||
public AjaxResult cyclicPosition(@RequestBody EdgeMotorCyclicSetpointVO request) {
|
|
||||||
edgeMotorService.sendCyclicPosition(request);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Open cyclic velocity stream")
|
|
||||||
@PostMapping("/cyclicVelocity/open")
|
|
||||||
public AjaxResult openCyclicVelocity(@RequestBody EdgeMotorCyclicOpenVO request) {
|
|
||||||
return success(edgeMotorService.openCyclicVelocity(request));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Send cyclic velocity setpoint")
|
|
||||||
@PostMapping("/cyclicVelocity/setpoint")
|
|
||||||
public AjaxResult cyclicVelocity(@RequestBody EdgeMotorCyclicSetpointVO request) {
|
|
||||||
edgeMotorService.sendCyclicVelocity(request);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Get the latest cyclic stream response")
|
|
||||||
@GetMapping("/stream/status")
|
|
||||||
public AjaxResult streamStatus(@RequestParam("sessionId") String sessionId) {
|
|
||||||
return protobuf(edgeMotorService.getStreamStatus(sessionId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Close a cyclic stream")
|
|
||||||
@PostMapping("/stream/close")
|
|
||||||
public AjaxResult closeStream(@RequestParam("sessionId") String sessionId) {
|
|
||||||
edgeMotorService.closeStream(sessionId);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
private AjaxResult protobuf(Object value) {
|
|
||||||
return success(value == null ? null : JSON.toJSONString(value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -33,13 +33,13 @@ public class EdgeSpeakerController {
|
|||||||
@PreAuthorize("@ss.hasPermi('system:speaker:query')")
|
@PreAuthorize("@ss.hasPermi('system:speaker:query')")
|
||||||
@GetMapping("/status")
|
@GetMapping("/status")
|
||||||
public AjaxResult getStatus(
|
public AjaxResult getStatus(
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true)
|
@ApiParam(value = "终端设备ID", required = true)
|
||||||
@RequestParam String robotId,
|
@RequestParam String terminalId,
|
||||||
@ApiParam(value = "设备ID", required = true)
|
@ApiParam(value = "设备ID", required = true)
|
||||||
@RequestParam String deviceId) {
|
@RequestParam String deviceId) {
|
||||||
try {
|
try {
|
||||||
// 获取扬声器状态
|
// 获取扬声器状态
|
||||||
SpeakerCommand.GetSpeakerStateCommand.Feedback feedback = speakerService.getStatus(robotId, deviceId);
|
SpeakerCommand.GetSpeakerStateCommand.Feedback feedback = speakerService.getStatus(terminalId, deviceId);
|
||||||
SpeakerCommand.SpeakerState state = feedback.getState();
|
SpeakerCommand.SpeakerState state = feedback.getState();
|
||||||
|
|
||||||
// 构建返回结果
|
// 构建返回结果
|
||||||
@ -73,7 +73,7 @@ public class EdgeSpeakerController {
|
|||||||
@PreAuthorize("@ss.hasPermi('system:speaker:play')")
|
@PreAuthorize("@ss.hasPermi('system:speaker:play')")
|
||||||
@PostMapping("/play")
|
@PostMapping("/play")
|
||||||
public AjaxResult playAudio(@RequestBody EdgeSpeakerPlayAudioVO edgeSpeakerPlayAudioVO) {
|
public AjaxResult playAudio(@RequestBody EdgeSpeakerPlayAudioVO edgeSpeakerPlayAudioVO) {
|
||||||
speakerService.playAudio(edgeSpeakerPlayAudioVO.getRobotId(), edgeSpeakerPlayAudioVO.getDeviceId(), edgeSpeakerPlayAudioVO.getAudioPath());
|
speakerService.playAudio(edgeSpeakerPlayAudioVO.getTerminalId(), edgeSpeakerPlayAudioVO.getDeviceId(), edgeSpeakerPlayAudioVO.getAudioPath());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public class EdgeSpeakerController {
|
|||||||
@PreAuthorize("@ss.hasPermi('system:speaker:stop')")
|
@PreAuthorize("@ss.hasPermi('system:speaker:stop')")
|
||||||
@PostMapping("/stop")
|
@PostMapping("/stop")
|
||||||
public AjaxResult stopPlayback(@RequestBody EdgeCommonVO edgeCommonVO) {
|
public AjaxResult stopPlayback(@RequestBody EdgeCommonVO edgeCommonVO) {
|
||||||
speakerService.stopPlayback(edgeCommonVO.getRobotId(), edgeCommonVO.getDeviceId());
|
speakerService.stopPlayback(edgeCommonVO.getTerminalId(), edgeCommonVO.getDeviceId());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ public class EdgeSpeakerController {
|
|||||||
@PreAuthorize("@ss.hasPermi('system:speaker:pause')")
|
@PreAuthorize("@ss.hasPermi('system:speaker:pause')")
|
||||||
@PostMapping("/pause")
|
@PostMapping("/pause")
|
||||||
public AjaxResult pausePlayback(@RequestBody EdgeCommonVO edgeCommonVO) {
|
public AjaxResult pausePlayback(@RequestBody EdgeCommonVO edgeCommonVO) {
|
||||||
speakerService.pausePlayback(edgeCommonVO.getRobotId(), edgeCommonVO.getDeviceId());
|
speakerService.pausePlayback(edgeCommonVO.getTerminalId(), edgeCommonVO.getDeviceId());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ public class EdgeSpeakerController {
|
|||||||
@PreAuthorize("@ss.hasPermi('system:speaker:resume')")
|
@PreAuthorize("@ss.hasPermi('system:speaker:resume')")
|
||||||
@PostMapping("/resume")
|
@PostMapping("/resume")
|
||||||
public AjaxResult resumePlayback(@RequestBody EdgeCommonVO edgeCommonVO) {
|
public AjaxResult resumePlayback(@RequestBody EdgeCommonVO edgeCommonVO) {
|
||||||
speakerService.resumePlayback(edgeCommonVO.getRobotId(), edgeCommonVO.getDeviceId());
|
speakerService.resumePlayback(edgeCommonVO.getTerminalId(), edgeCommonVO.getDeviceId());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ public class EdgeSpeakerController {
|
|||||||
@PreAuthorize("@ss.hasPermi('system:speaker:volume')")
|
@PreAuthorize("@ss.hasPermi('system:speaker:volume')")
|
||||||
@PostMapping("/volume")
|
@PostMapping("/volume")
|
||||||
public AjaxResult setVolume(@RequestBody EdgeMicrophoneVolumeVO edgeMicrophoneVolumeVO) {
|
public AjaxResult setVolume(@RequestBody EdgeMicrophoneVolumeVO edgeMicrophoneVolumeVO) {
|
||||||
speakerService.setVolume(edgeMicrophoneVolumeVO.getRobotId(), edgeMicrophoneVolumeVO.getDeviceId(), edgeMicrophoneVolumeVO.getVolume());
|
speakerService.setVolume(edgeMicrophoneVolumeVO.getTerminalId(), edgeMicrophoneVolumeVO.getDeviceId(), edgeMicrophoneVolumeVO.getVolume());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,11 +128,11 @@ public class EdgeSpeakerController {
|
|||||||
@PreAuthorize("@ss.hasPermi('system:speaker:volume')")
|
@PreAuthorize("@ss.hasPermi('system:speaker:volume')")
|
||||||
@GetMapping("/volume")
|
@GetMapping("/volume")
|
||||||
public AjaxResult getVolume(
|
public AjaxResult getVolume(
|
||||||
@ApiParam(value = "机器人永久唯一ID", required = true)
|
@ApiParam(value = "终端设备ID", required = true)
|
||||||
@RequestParam String robotId,
|
@RequestParam String terminalId,
|
||||||
@ApiParam(value = "设备ID", required = true)
|
@ApiParam(value = "设备ID", required = true)
|
||||||
@RequestParam String deviceId) {
|
@RequestParam String deviceId) {
|
||||||
return AjaxResult.success(speakerService.getVolume(robotId, deviceId));
|
return AjaxResult.success(speakerService.getVolume(terminalId, deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取所有音频")
|
@ApiOperation("获取所有音频")
|
||||||
|
|||||||
@ -1,23 +1,14 @@
|
|||||||
package com.cmvr.web.controller.api;
|
package com.cmvr.web.controller.api;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
import com.cmvr.edge.client.model.system.EdgeSystemJsonCommandVO;
|
|
||||||
import com.cmvr.edge.client.model.system.EdgeSystemUpdateParamsVO;
|
|
||||||
import com.cmvr.edge.client.model.system.EdgeActionQueueVO;
|
|
||||||
import com.cmvr.edge.client.model.system.EdgeSafetyRecoveryVO;
|
|
||||||
import com.cmvr.edge.client.service.EdgeSystemService;
|
import com.cmvr.edge.client.service.EdgeSystemService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
|
|
||||||
@Api(tags = "边缘--系统功能")
|
@Api(tags = "边缘--系统功能")
|
||||||
@RestController
|
@RestController
|
||||||
@ -27,63 +18,9 @@ public class EdgeSystemController extends BaseController {
|
|||||||
|
|
||||||
private final EdgeSystemService edgeSystemService;
|
private final EdgeSystemService edgeSystemService;
|
||||||
|
|
||||||
@ApiOperation("Get edge system information")
|
|
||||||
@GetMapping("/info")
|
|
||||||
public AjaxResult info(@RequestParam("robotId") String robotId) {
|
|
||||||
return success(JSON.toJSONString(edgeSystemService.getSystemInfo(robotId)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Get edge system runtime status")
|
|
||||||
@GetMapping("/status")
|
|
||||||
public AjaxResult status(@RequestParam("robotId") String robotId) {
|
|
||||||
return success(JSON.toJSONString(edgeSystemService.getSystemStatus(robotId)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Update edge device parameters")
|
|
||||||
@PostMapping("/params")
|
|
||||||
public AjaxResult updateParams(@RequestBody EdgeSystemUpdateParamsVO request) {
|
|
||||||
return success(JSON.toJSONString(edgeSystemService.updateParams(request)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Execute a JSON device command")
|
|
||||||
@PostMapping("/executeJsonCommand")
|
|
||||||
public AjaxResult executeJsonCommand(@RequestBody EdgeSystemJsonCommandVO request) {
|
|
||||||
return success(JSON.toJSONString(edgeSystemService.executeJsonCommand(request)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Execute an edge-local serial action queue")
|
|
||||||
@PostMapping("/actionQueue")
|
|
||||||
public AjaxResult executeActionQueue(@RequestBody EdgeActionQueueVO request) {
|
|
||||||
return success(JSON.toJSONString(edgeSystemService.executeActionQueue(request)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Get edge safety state")
|
|
||||||
@GetMapping("/safetyState")
|
|
||||||
public AjaxResult safetyState(@RequestParam("robotId") String robotId) {
|
|
||||||
return success(JSON.toJSONString(edgeSystemService.getSafetyState(robotId)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("Restore edge operational state")
|
|
||||||
@PostMapping("/restoreOperationalState")
|
|
||||||
public AjaxResult restoreOperationalState(@RequestBody @Validated EdgeSafetyRecoveryVO request) {
|
|
||||||
return success(JSON.toJSONString(edgeSystemService.restoreOperationalState(
|
|
||||||
request.getRobotId(), request.getReason(), request.getTimeoutMs())));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use /restoreOperationalState.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@ApiOperation("[Deprecated] Clear recoverable edge safety errors")
|
|
||||||
@PostMapping("/recoverSafetyState")
|
|
||||||
public AjaxResult recoverSafetyState(@RequestBody @Validated EdgeSafetyRecoveryVO request) {
|
|
||||||
return success(JSON.toJSONString(edgeSystemService.recoverSafetyState(
|
|
||||||
request.getRobotId(), request.getReason(), request.getTimeoutMs())));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("停止所有设备")
|
@ApiOperation("停止所有设备")
|
||||||
@GetMapping("/stopAll")
|
@GetMapping("/stopAll")
|
||||||
public AjaxResult stopAll(@RequestParam("robotId") String robotId) {
|
public AjaxResult stopAll(String terminalId) {
|
||||||
return AjaxResult.ok(edgeSystemService.stopAll(robotId));
|
return AjaxResult.ok(edgeSystemService.stopAll(terminalId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
package com.cmvr.web.controller.api;
|
package com.cmvr.web.controller.api;
|
||||||
|
|
||||||
import com.cmvr.edge.client.service.AudioService;
|
import com.cmvr.edge.client.service.AudioService;
|
||||||
import tools.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import tools.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|||||||
@ -3,9 +3,9 @@ package com.cmvr.web.controller.common;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import jakarta.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.FastByteArrayOutputStream;
|
import org.springframework.util.FastByteArrayOutputStream;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -23,7 +23,7 @@ import com.cmvr.system.service.ISysConfigService;
|
|||||||
/**
|
/**
|
||||||
* 验证码操作处理
|
* 验证码操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class CaptchaController
|
public class CaptchaController
|
||||||
|
|||||||
@ -1,54 +1,49 @@
|
|||||||
package com.cmvr.web.controller.common;
|
package com.cmvr.web.controller.common;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.cmvr.common.config.CmvrIotConfig;
|
||||||
import java.util.List;
|
import com.cmvr.common.constant.Constants;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import com.cmvr.common.utils.StringUtils;
|
||||||
|
import com.cmvr.common.utils.file.FileUploadUtils;
|
||||||
|
import com.cmvr.common.utils.file.FileUtils;
|
||||||
|
import com.cmvr.framework.config.ServerConfig;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.cmvr.common.config.CmvrIotConfig;
|
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
|
||||||
import com.cmvr.common.utils.StringUtils;
|
|
||||||
import com.cmvr.common.utils.file.FileUploadUtils;
|
|
||||||
import com.cmvr.common.utils.file.FileUtils;
|
|
||||||
import com.cmvr.framework.config.ServerConfig;
|
|
||||||
|
|
||||||
/**
|
import javax.servlet.http.HttpServletRequest;
|
||||||
* 通用请求处理
|
import javax.servlet.http.HttpServletResponse;
|
||||||
*
|
import java.util.ArrayList;
|
||||||
* @author ruoyi
|
import java.util.List;
|
||||||
*/
|
|
||||||
|
@Api(tags = "通用请求处理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/common")
|
@RequestMapping("/common")
|
||||||
public class CommonController
|
@RequiredArgsConstructor
|
||||||
{
|
public class CommonController {
|
||||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||||
|
|
||||||
@Autowired
|
private final ServerConfig serverConfig;
|
||||||
private ServerConfig serverConfig;
|
|
||||||
|
|
||||||
private static final String FILE_DELIMITER = ",";
|
private static final String FILE_DELIMETER = ",";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用下载请求
|
* 通用下载请求
|
||||||
*
|
*
|
||||||
* @param fileName 文件名称
|
* @param fileName 文件名称
|
||||||
* @param delete 是否删除
|
* @param delete 是否删除
|
||||||
*/
|
*/
|
||||||
@GetMapping("/download")
|
@GetMapping("/download")
|
||||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
|
||||||
{
|
try {
|
||||||
try
|
if (!FileUtils.checkAllowDownload(fileName)) {
|
||||||
{
|
|
||||||
if (!FileUtils.checkAllowDownload(fileName))
|
|
||||||
{
|
|
||||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||||
}
|
}
|
||||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||||
@ -57,13 +52,10 @@ public class CommonController
|
|||||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||||
if (delete)
|
if (delete) {
|
||||||
{
|
|
||||||
FileUtils.deleteFile(filePath);
|
FileUtils.deleteFile(filePath);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
log.error("下载文件失败", e);
|
log.error("下载文件失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,10 +64,8 @@ public class CommonController
|
|||||||
* 通用上传请求(单个)
|
* 通用上传请求(单个)
|
||||||
*/
|
*/
|
||||||
@PostMapping("/upload")
|
@PostMapping("/upload")
|
||||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath = CmvrIotConfig.getUploadPath();
|
String filePath = CmvrIotConfig.getUploadPath();
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
@ -87,9 +77,7 @@ public class CommonController
|
|||||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||||
ajax.put("originalFilename", file.getOriginalFilename());
|
ajax.put("originalFilename", file.getOriginalFilename());
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return AjaxResult.error(e.getMessage());
|
return AjaxResult.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,18 +86,15 @@ public class CommonController
|
|||||||
* 通用上传请求(多个)
|
* 通用上传请求(多个)
|
||||||
*/
|
*/
|
||||||
@PostMapping("/uploads")
|
@PostMapping("/uploads")
|
||||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath = CmvrIotConfig.getUploadPath();
|
String filePath = CmvrIotConfig.getUploadPath();
|
||||||
List<String> urls = new ArrayList<String>();
|
List<String> urls = new ArrayList<String>();
|
||||||
List<String> fileNames = new ArrayList<String>();
|
List<String> fileNames = new ArrayList<String>();
|
||||||
List<String> newFileNames = new ArrayList<String>();
|
List<String> newFileNames = new ArrayList<String>();
|
||||||
List<String> originalFilenames = new ArrayList<String>();
|
List<String> originalFilenames = new ArrayList<String>();
|
||||||
for (MultipartFile file : files)
|
for (MultipartFile file : files) {
|
||||||
{
|
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
String fileName = FileUploadUtils.upload(filePath, file);
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
String url = serverConfig.getUrl() + fileName;
|
String url = serverConfig.getUrl() + fileName;
|
||||||
@ -119,14 +104,12 @@ public class CommonController
|
|||||||
originalFilenames.add(file.getOriginalFilename());
|
originalFilenames.add(file.getOriginalFilename());
|
||||||
}
|
}
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("urls", StringUtils.join(urls, FILE_DELIMITER));
|
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||||
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMITER));
|
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMITER));
|
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||||
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMITER));
|
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return AjaxResult.error(e.getMessage());
|
return AjaxResult.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,26 +119,21 @@ public class CommonController
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/download/resource")
|
@GetMapping("/download/resource")
|
||||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||||
throws Exception
|
throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
if (!FileUtils.checkAllowDownload(resource)) {
|
||||||
{
|
|
||||||
if (!FileUtils.checkAllowDownload(resource))
|
|
||||||
{
|
|
||||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||||
}
|
}
|
||||||
// 本地资源路径
|
// 本地资源路径
|
||||||
String localPath = CmvrIotConfig.getProfile();
|
String localPath = CmvrIotConfig.getProfile();
|
||||||
// 数据库资源地址
|
// 数据库资源地址
|
||||||
String downloadPath = localPath + FileUtils.stripPrefix(resource);
|
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||||
// 下载名称
|
// 下载名称
|
||||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
log.error("下载文件失败", e);
|
log.error("下载文件失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,115 @@
|
|||||||
|
package com.cmvr.web.controller.device;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.cmvr.device.domain.vo.ProfileVo;
|
||||||
|
import com.cmvr.device.domain.vo.TeMechanicalArmVo;
|
||||||
|
import com.cmvr.edge.client.service.EdgeSystemService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.cmvr.common.annotation.Log;
|
||||||
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
|
import com.cmvr.common.enums.BusinessType;
|
||||||
|
import com.cmvr.device.domain.DeDeviceProfile;
|
||||||
|
import com.cmvr.device.service.IDeDeviceProfileService;
|
||||||
|
import com.cmvr.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备配置信息Controller
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
* @date 2025-05-09
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/device/profile")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "设备--配置信息")
|
||||||
|
public class DeDeviceProfileController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
private final IDeDeviceProfileService deDeviceProfileService;
|
||||||
|
|
||||||
|
private final EdgeSystemService systemService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备配置信息列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:profile:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation("查询设备信息列表")
|
||||||
|
public TableDataInfo list(DeDeviceProfile deDeviceProfile)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ProfileVo> list = deDeviceProfileService.selectDeDeviceProfileList(deDeviceProfile);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取设备详细配置信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:profile:query')")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@ApiOperation("根据设备id获取当前设备配置信息")
|
||||||
|
public AjaxResult getInfo(@PathVariable String id)
|
||||||
|
{
|
||||||
|
return success(deDeviceProfileService.selectDeDeviceProfileById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id和备注获取设备详细配置信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:profile:query')")
|
||||||
|
@GetMapping("/parameterInfo")
|
||||||
|
@ApiOperation("根据设备id获取当前设备配置信息")
|
||||||
|
public AjaxResult getParameterInfo(@RequestParam String id, @RequestParam String remark)
|
||||||
|
{
|
||||||
|
return success(deDeviceProfileService.selectProfileByIdAndRemark(id,remark));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备配置信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:profile:add')")
|
||||||
|
@Log(title = "设备配置信息", businessType = BusinessType.INSERT)
|
||||||
|
@ApiOperation("新增设备信息")
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody List<DeDeviceProfile> deDeviceProfiles)
|
||||||
|
{
|
||||||
|
|
||||||
|
return toAjax(deDeviceProfileService.insertDeDeviceProfile(deDeviceProfiles));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备配置信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:profile:edit')")
|
||||||
|
@Log(title = "设备配置信息", businessType = BusinessType.UPDATE)
|
||||||
|
@ApiOperation("修改设备信息")
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody List<DeDeviceProfile> deDeviceProfiles)
|
||||||
|
{
|
||||||
|
return toAjax(deDeviceProfileService.updateDeDeviceProfile(deDeviceProfiles));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备配置信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:profile:remove')")
|
||||||
|
@Log(title = "设备配置信息", businessType = BusinessType.DELETE)
|
||||||
|
@ApiOperation("删除设备配置信息")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(deDeviceProfileService.deleteDeDeviceProfileByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,122 @@
|
|||||||
|
package com.cmvr.web.controller.device;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.cmvr.edge.client.service.EdgeSystemService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.cmvr.common.annotation.Log;
|
||||||
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
|
import com.cmvr.common.enums.BusinessType;
|
||||||
|
import com.cmvr.device.domain.DeDeviceRegistration;
|
||||||
|
import com.cmvr.device.service.IDeDeviceRegistrationService;
|
||||||
|
import com.cmvr.common.utils.poi.ExcelUtil;
|
||||||
|
import com.cmvr.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备注册Controller
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
* @date 2025-05-08
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/device/register")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "设备--注册")
|
||||||
|
public class DeDeviceRegistrationController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IDeDeviceRegistrationService deDeviceRegistrationService;
|
||||||
|
|
||||||
|
private final EdgeSystemService systemService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备注册列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询设备注册列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:register:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(DeDeviceRegistration deDeviceRegistration)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<DeDeviceRegistration> list = deDeviceRegistrationService.selectDeDeviceRegistrationList(deDeviceRegistration);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备注册列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出设备注册列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:register:export')")
|
||||||
|
@Log(title = "设备注册", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, DeDeviceRegistration deDeviceRegistration)
|
||||||
|
{
|
||||||
|
List<DeDeviceRegistration> list = deDeviceRegistrationService.selectDeDeviceRegistrationList(deDeviceRegistration);
|
||||||
|
ExcelUtil<DeDeviceRegistration> util = new ExcelUtil<DeDeviceRegistration>(DeDeviceRegistration.class);
|
||||||
|
util.exportExcel(response, list, "设备注册数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备注册详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取设备注册详细信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:register:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(deDeviceRegistrationService.selectDeDeviceRegistrationById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备注册
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增设备注册")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:register:add')")
|
||||||
|
@Log(title = "设备注册", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody DeDeviceRegistration deDeviceRegistration)
|
||||||
|
{
|
||||||
|
return toAjax(deDeviceRegistrationService.insertDeDeviceRegistration(deDeviceRegistration));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备注册
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改设备注册")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:register:edit')")
|
||||||
|
@Log(title = "设备注册", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody DeDeviceRegistration deDeviceRegistration)
|
||||||
|
{
|
||||||
|
return toAjax(deDeviceRegistrationService.updateDeDeviceRegistration(deDeviceRegistration));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备注册
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除设备注册")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:register:remove')")
|
||||||
|
@Log(title = "设备注册", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(deDeviceRegistrationService.deleteDeDeviceRegistrationByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,102 @@
|
|||||||
|
package com.cmvr.web.controller.device;
|
||||||
|
|
||||||
|
import com.cmvr.common.annotation.Log;
|
||||||
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
|
import com.cmvr.common.core.page.TableDataInfo;
|
||||||
|
import com.cmvr.common.enums.BusinessType;
|
||||||
|
import com.cmvr.common.utils.poi.ExcelUtil;
|
||||||
|
import com.cmvr.device.domain.DeDeviceTerminalConfig;
|
||||||
|
import com.cmvr.device.service.IDeDeviceTerminalConfigService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备终端配置Controller
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
* @date 2025-05-08
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/device/terminal")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "设备--终端配置")
|
||||||
|
public class DeDeviceTerminalConfigController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IDeDeviceTerminalConfigService deDeviceTerminalConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备终端配置列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询设备终端配置列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:terminal:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(DeDeviceTerminalConfig deDeviceTerminalConfig) {
|
||||||
|
startPage();
|
||||||
|
List<DeDeviceTerminalConfig> list = deDeviceTerminalConfigService.selectDeDeviceTerminalConfigList(deDeviceTerminalConfig);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备终端配置列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出设备终端配置列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:terminal:export')")
|
||||||
|
@Log(title = "设备终端配置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, DeDeviceTerminalConfig deDeviceTerminalConfig) {
|
||||||
|
List<DeDeviceTerminalConfig> list = deDeviceTerminalConfigService.selectDeDeviceTerminalConfigList(deDeviceTerminalConfig);
|
||||||
|
ExcelUtil<DeDeviceTerminalConfig> util = new ExcelUtil<DeDeviceTerminalConfig>(DeDeviceTerminalConfig.class);
|
||||||
|
util.exportExcel(response, list, "设备终端配置数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备终端配置详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取设备终端配置详细信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:terminal:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||||
|
return success(deDeviceTerminalConfigService.selectDeDeviceTerminalConfigById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备终端配置
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增设备终端配置")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:terminal:add')")
|
||||||
|
@Log(title = "设备终端配置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody DeDeviceTerminalConfig deDeviceTerminalConfig) {
|
||||||
|
return toAjax(deDeviceTerminalConfigService.insertDeDeviceTerminalConfig(deDeviceTerminalConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备终端配置
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改设备终端数据")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:terminal:edit')")
|
||||||
|
@Log(title = "设备终端配置", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody DeDeviceTerminalConfig deDeviceTerminalConfig) {
|
||||||
|
return toAjax(deDeviceTerminalConfigService.updateDeDeviceTerminalConfig(deDeviceTerminalConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备终端配置
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除设备终端配置")
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:terminal:remove')")
|
||||||
|
@Log(title = "设备终端配置", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids) {
|
||||||
|
return toAjax(deDeviceTerminalConfigService.deleteDeDeviceTerminalConfigByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
package com.cmvr.web.controller.device;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.cmvr.common.annotation.Log;
|
||||||
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
|
import com.cmvr.common.enums.BusinessType;
|
||||||
|
import com.cmvr.common.utils.poi.ExcelUtil;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.cmvr.device.domain.DeRobotConfig;
|
||||||
|
import com.cmvr.device.service.IDeRobotConfigService;
|
||||||
|
|
||||||
|
import static com.cmvr.common.core.domain.AjaxResult.success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机器人配置Controller
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
* @date 2025-09-09
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/device/robot")
|
||||||
|
public class DeRobotConfigController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IDeRobotConfigService deRobotConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询机器人配置列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:robot:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(DeRobotConfig deRobotConfig)
|
||||||
|
{
|
||||||
|
List<DeRobotConfig> list = deRobotConfigService.selectDeRobotConfigList(deRobotConfig);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出机器人配置列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:robot:export')")
|
||||||
|
@Log(title = "机器人配置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, DeRobotConfig deRobotConfig)
|
||||||
|
{
|
||||||
|
List<DeRobotConfig> list = deRobotConfigService.selectDeRobotConfigList(deRobotConfig);
|
||||||
|
ExcelUtil<DeRobotConfig> util = new ExcelUtil<DeRobotConfig>(DeRobotConfig.class);
|
||||||
|
util.exportExcel(response, list, "机器人配置数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机器人配置详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:robot:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(deRobotConfigService.selectDeRobotConfigById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增机器人配置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:robot:add')")
|
||||||
|
@Log(title = "机器人配置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody DeRobotConfig deRobotConfig)
|
||||||
|
{
|
||||||
|
return toAjax(deRobotConfigService.insertDeRobotConfig(deRobotConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改机器人配置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:robot:edit')")
|
||||||
|
@Log(title = "机器人配置", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody DeRobotConfig deRobotConfig)
|
||||||
|
{
|
||||||
|
return toAjax(deRobotConfigService.updateDeRobotConfig(deRobotConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除机器人配置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('device:robot:remove')")
|
||||||
|
@Log(title = "机器人配置", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(deRobotConfigService.deleteDeRobotConfigByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,7 +11,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
@Api(tags = "评价管理--指标库")
|
@Api(tags = "评价管理--指标库")
|
||||||
@RestController
|
@RestController
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.inspection;
|
package com.cmvr.web.controller.inspection;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import com.cmvr.inspection.domain.dto.alert.AlertEnvelope;
|
|||||||
import com.cmvr.inspection.exception.DetectionAlertBadRequestException;
|
import com.cmvr.inspection.exception.DetectionAlertBadRequestException;
|
||||||
import com.cmvr.inspection.service.IInspectionDetectionAlertService;
|
import com.cmvr.inspection.service.IInspectionDetectionAlertService;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import tools.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -18,8 +18,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import jakarta.servlet.ServletInputStream;
|
import javax.servlet.ServletInputStream;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|||||||
@ -0,0 +1,114 @@
|
|||||||
|
package com.cmvr.web.controller.inspection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.cmvr.common.annotation.Log;
|
||||||
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
|
import com.cmvr.common.enums.BusinessType;
|
||||||
|
import com.cmvr.inspection.domain.InspectionMap;
|
||||||
|
import com.cmvr.inspection.domain.vo.InspectionMapVo;
|
||||||
|
import com.cmvr.inspection.service.IInspectionMapService;
|
||||||
|
import com.cmvr.common.utils.poi.ExcelUtil;
|
||||||
|
import com.cmvr.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 巡检地图Controller
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
* @since 2026-05-29
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/inspection/map")
|
||||||
|
@Api(tags = "智能巡检--地图管理")
|
||||||
|
public class InspectionMapController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IInspectionMapService inspectionMapService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询巡检地图列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询巡检地图列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:map:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(InspectionMap inspectionMap)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<InspectionMapVo> list = inspectionMapService.selectInspectionMapList(inspectionMap);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出巡检地图列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出巡检地图列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:map:export')")
|
||||||
|
@Log(title = "巡检地图", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, InspectionMap inspectionMap)
|
||||||
|
{
|
||||||
|
List<InspectionMapVo> list = inspectionMapService.selectInspectionMapList(inspectionMap);
|
||||||
|
ExcelUtil<InspectionMapVo> util = new ExcelUtil<>(InspectionMapVo.class);
|
||||||
|
util.exportExcel(response, list, "巡检地图数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取巡检地图详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取巡检地图详细信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:map:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(inspectionMapService.selectInspectionMapById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增巡检地图
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增巡检地图")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:map:add')")
|
||||||
|
@Log(title = "巡检地图", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody InspectionMap inspectionMap)
|
||||||
|
{
|
||||||
|
return toAjax(inspectionMapService.insertInspectionMap(inspectionMap));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改巡检地图
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改巡检地图")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:map:edit')")
|
||||||
|
@Log(title = "巡检地图", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody InspectionMap inspectionMap)
|
||||||
|
{
|
||||||
|
return toAjax(inspectionMapService.updateInspectionMap(inspectionMap));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除巡检地图
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除巡检地图")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:map:remove')")
|
||||||
|
@Log(title = "巡检地图", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(inspectionMapService.deleteInspectionMapByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,241 @@
|
|||||||
|
package com.cmvr.web.controller.inspection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import cmvr.msgs.Agv;
|
||||||
|
import com.cmvr.inspection.domain.vo.InspectionRobotVo;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.cmvr.common.annotation.Log;
|
||||||
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
|
import com.cmvr.common.enums.BusinessType;
|
||||||
|
import com.cmvr.inspection.domain.InspectionRobot;
|
||||||
|
import com.cmvr.inspection.service.IInspectionRobotService;
|
||||||
|
import com.cmvr.common.utils.poi.ExcelUtil;
|
||||||
|
import com.cmvr.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 巡检机器人Controller
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
* @since 2026-05-29
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/inspection/robot")
|
||||||
|
@Api(tags = "智能巡检--机器人管理")
|
||||||
|
public class InspectionRobotController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IInspectionRobotService inspectionRobotService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询巡检机器人列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询巡检机器人列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(InspectionRobot inspectionRobot)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<InspectionRobotVo> list = inspectionRobotService.selectInspectionRobotList(inspectionRobot);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出巡检机器人列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出巡检机器人列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:export')")
|
||||||
|
@Log(title = "巡检机器人", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, InspectionRobot inspectionRobot)
|
||||||
|
{
|
||||||
|
List<InspectionRobotVo> list = inspectionRobotService.selectInspectionRobotList(inspectionRobot);
|
||||||
|
ExcelUtil<InspectionRobotVo> util = new ExcelUtil<>(InspectionRobotVo.class);
|
||||||
|
util.exportExcel(response, list, "巡检机器人数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取巡检机器人详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取巡检机器人详细信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(inspectionRobotService.selectInspectionRobotById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增巡检机器人
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增巡检机器人")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:add')")
|
||||||
|
@Log(title = "巡检机器人", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody InspectionRobot inspectionRobot)
|
||||||
|
{
|
||||||
|
return toAjax(inspectionRobotService.insertInspectionRobot(inspectionRobot));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改巡检机器人
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改巡检机器人")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:edit')")
|
||||||
|
@Log(title = "巡检机器人", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody InspectionRobot inspectionRobot)
|
||||||
|
{
|
||||||
|
return toAjax(inspectionRobotService.updateInspectionRobot(inspectionRobot));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除巡检机器人
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除巡检机器人")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:remove')")
|
||||||
|
@Log(title = "巡检机器人", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(inspectionRobotService.deleteInspectionRobotByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机器人地图列表(从AGV获取)
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取机器人地图列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:query')")
|
||||||
|
@GetMapping("/{robotId}/maps")
|
||||||
|
public AjaxResult getRobotMapList(@PathVariable String robotId)
|
||||||
|
{
|
||||||
|
List<String> robotMapList = inspectionRobotService.getRobotMapList(robotId);
|
||||||
|
return success(robotMapList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定机器人地图
|
||||||
|
*/
|
||||||
|
@ApiOperation("绑定机器人地图")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:edit')")
|
||||||
|
@Log(title = "绑定机器人地图", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/{robotId}/bind-map/{mapId}")
|
||||||
|
public AjaxResult bindRobotMap(@PathVariable String robotId,
|
||||||
|
@PathVariable String mapId)
|
||||||
|
{
|
||||||
|
return toAjax(inspectionRobotService.bindRobotMap(robotId, mapId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从机器人下载地图
|
||||||
|
*/
|
||||||
|
@ApiOperation("从机器人下载地图")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:add')")
|
||||||
|
@Log(title = "从机器人下载地图", businessType = BusinessType.INSERT)
|
||||||
|
@GetMapping("/{robotId}/download-map")
|
||||||
|
public AjaxResult downloadMapFromRobot(
|
||||||
|
@PathVariable @ApiParam("机器人ID") String robotId,
|
||||||
|
@RequestParam(value = "mapName") @ApiParam("地图名称") String mapName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Object mapId = inspectionRobotService.downloadMapFromRobot(robotId, mapName);
|
||||||
|
return success(mapId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传地图(从源机器人下载到目标机器人)
|
||||||
|
*/
|
||||||
|
@ApiOperation("上传地图到机器人")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:edit')")
|
||||||
|
@Log(title = "上传地图到机器人", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/{robotId}/upload-map-from-source")
|
||||||
|
public AjaxResult uploadMapFromSource(@PathVariable String robotId)
|
||||||
|
{
|
||||||
|
String result = inspectionRobotService.uploadMapFromSource(robotId);
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步机器人状态
|
||||||
|
*/
|
||||||
|
@ApiOperation("同步机器人状态")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:edit')")
|
||||||
|
@Log(title = "同步机器人状态", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/{robotId}/sync-status")
|
||||||
|
public AjaxResult syncRobotStatus(@PathVariable String robotId)
|
||||||
|
{
|
||||||
|
return success(inspectionRobotService.syncRobotStatus(robotId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机器人实时位置
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取机器人实时位置")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:query')")
|
||||||
|
@GetMapping("/{robotId}/location")
|
||||||
|
public AjaxResult getRobotRealtimeLocation(@PathVariable String robotId)
|
||||||
|
{
|
||||||
|
Agv.AgvPose2d location = inspectionRobotService.getRobotRealtimeLocation(robotId);
|
||||||
|
return success(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导航到指定位置(坐标)
|
||||||
|
*/
|
||||||
|
@ApiOperation("导航到指定位置")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:edit')")
|
||||||
|
@Log(title = "导航到指定位置", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/{robotId}/navigate-to-position")
|
||||||
|
public AjaxResult navigateToPosition(
|
||||||
|
@PathVariable @ApiParam("机器人ID") String robotId,
|
||||||
|
@RequestParam @ApiParam("X坐标(米)") Double x,
|
||||||
|
@RequestParam @ApiParam("Y坐标(米)") Double y,
|
||||||
|
@RequestParam(required = false) @ApiParam("朝向角(弧度)") Double theta
|
||||||
|
)
|
||||||
|
{
|
||||||
|
inspectionRobotService.navigateToPosition(
|
||||||
|
robotId, x, y, theta
|
||||||
|
);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始建图
|
||||||
|
*/
|
||||||
|
@ApiOperation("开始建图")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:edit')")
|
||||||
|
@Log(title = "开始建图", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/{robotId}/start-mapping")
|
||||||
|
public AjaxResult startMapping(
|
||||||
|
@PathVariable @ApiParam("机器人ID") String robotId,
|
||||||
|
@RequestParam @ApiParam("建图维度(0:未指定 1:2D 2:3D 3:2D+3D)") int dimension,
|
||||||
|
@RequestParam(required = false) @ApiParam("地图名称(可选)") String mapName,
|
||||||
|
@RequestParam(defaultValue = "true") @ApiParam("是否实时建图") boolean realTime
|
||||||
|
)
|
||||||
|
{
|
||||||
|
String sessionId = inspectionRobotService.startMapping(robotId, dimension, mapName, realTime);
|
||||||
|
java.util.Map<String, Object> result = new java.util.HashMap<>();
|
||||||
|
result.put("sessionId", sessionId);
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止建图
|
||||||
|
*/
|
||||||
|
@ApiOperation("停止建图")
|
||||||
|
@PreAuthorize("@ss.hasPermi('inspection:robot:edit')")
|
||||||
|
@Log(title = "停止建图", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/{robotId}/stop-mapping")
|
||||||
|
public AjaxResult stopMapping(@PathVariable @ApiParam("机器人ID") String robotId)
|
||||||
|
{
|
||||||
|
inspectionRobotService.stopMapping(robotId);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.inspection;
|
package com.cmvr.web.controller.inspection;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -89,15 +89,6 @@ public class InspectionTaskController extends BaseController
|
|||||||
return toAjax(inspectionTaskService.insertInspectionTask(inspectionTask));
|
return toAjax(inspectionTaskService.insertInspectionTask(inspectionTask));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("复制巡检任务")
|
|
||||||
@PreAuthorize("@ss.hasPermi('inspection:task:add')")
|
|
||||||
@Log(title = "巡检任务", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping("/copy/{id}")
|
|
||||||
public AjaxResult copy(@PathVariable String id)
|
|
||||||
{
|
|
||||||
return success(inspectionTaskService.copyInspectionTask(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改巡检任务
|
* 修改巡检任务
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.inspection;
|
package com.cmvr.web.controller.inspection;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.cmvr.inspection.domain.dto.InspectionTaskInstanceQuery;
|
import com.cmvr.inspection.domain.dto.InspectionTaskInstanceQuery;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -21,7 +21,6 @@ import com.cmvr.common.core.controller.BaseController;
|
|||||||
import com.cmvr.common.core.domain.AjaxResult;
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
import com.cmvr.common.enums.BusinessType;
|
import com.cmvr.common.enums.BusinessType;
|
||||||
import com.cmvr.inspection.domain.InspectionTaskInstance;
|
import com.cmvr.inspection.domain.InspectionTaskInstance;
|
||||||
import com.cmvr.inspection.domain.vo.InspectionTaskStartVO;
|
|
||||||
import com.cmvr.inspection.domain.vo.InspectionTaskInstanceVo;
|
import com.cmvr.inspection.domain.vo.InspectionTaskInstanceVo;
|
||||||
import com.cmvr.inspection.service.IInspectionTaskInstanceService;
|
import com.cmvr.inspection.service.IInspectionTaskInstanceService;
|
||||||
import com.cmvr.common.utils.poi.ExcelUtil;
|
import com.cmvr.common.utils.poi.ExcelUtil;
|
||||||
@ -122,19 +121,9 @@ public class InspectionTaskInstanceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('inspection:taskInstance:edit')")
|
@PreAuthorize("@ss.hasPermi('inspection:taskInstance:edit')")
|
||||||
@Log(title = "巡检任务执行实例", businessType = BusinessType.UPDATE)
|
@Log(title = "巡检任务执行实例", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/start/{id}")
|
@PutMapping("/start/{id}")
|
||||||
public AjaxResult start(@PathVariable("id") String id,
|
public AjaxResult start(@PathVariable("id") String id)
|
||||||
@RequestBody(required = false) InspectionTaskStartVO startVO)
|
|
||||||
{
|
{
|
||||||
return toAjax(inspectionTaskInstanceService.startInstance(id, startVO));
|
return toAjax(inspectionTaskInstanceService.startInstance(id));
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("再次执行已完成或失败的巡检任务")
|
|
||||||
@PreAuthorize("@ss.hasPermi('inspection:taskInstance:edit')")
|
|
||||||
@Log(title = "巡检任务执行实例", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping("/rerun/{id}")
|
|
||||||
public AjaxResult rerun(@PathVariable("id") String id)
|
|
||||||
{
|
|
||||||
return success(inspectionTaskInstanceService.rerunInstance(id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.inspection;
|
package com.cmvr.web.controller.inspection;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -88,15 +88,6 @@ public class InspectionWaypointController extends BaseController
|
|||||||
return toAjax(inspectionWaypointService.insertInspectionWaypoint(inspectionWaypoint));
|
return toAjax(inspectionWaypointService.insertInspectionWaypoint(inspectionWaypoint));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("复制巡检点位")
|
|
||||||
@PreAuthorize("@ss.hasPermi('inspection:waypoint:add')")
|
|
||||||
@Log(title = "巡检点位", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping("/copy/{id}")
|
|
||||||
public AjaxResult copy(@PathVariable String id)
|
|
||||||
{
|
|
||||||
return success(inspectionWaypointService.copyInspectionWaypoint(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改巡检点位
|
* 修改巡检点位
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import com.cmvr.system.domain.SysCache;
|
|||||||
/**
|
/**
|
||||||
* 缓存监控
|
* 缓存监控
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/cache")
|
@RequestMapping("/monitor/cache")
|
||||||
@ -45,7 +45,6 @@ public class CacheController
|
|||||||
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
|
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public AjaxResult getInfo() throws Exception
|
public AjaxResult getInfo() throws Exception
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import com.cmvr.framework.web.domain.Server;
|
|||||||
/**
|
/**
|
||||||
* 服务器监控
|
* 服务器监控
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/server")
|
@RequestMapping("/monitor/server")
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.monitor;
|
package com.cmvr.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
@ -23,7 +23,7 @@ import com.cmvr.system.service.ISysLogininforService;
|
|||||||
/**
|
/**
|
||||||
* 系统访问记录
|
* 系统访问记录
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/logininfor")
|
@RequestMapping("/monitor/logininfor")
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.monitor;
|
package com.cmvr.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
@ -22,7 +22,7 @@ import com.cmvr.system.service.ISysOperLogService;
|
|||||||
/**
|
/**
|
||||||
* 操作日志记录
|
* 操作日志记录
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/operlog")
|
@RequestMapping("/monitor/operlog")
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import com.cmvr.system.service.ISysUserOnlineService;
|
|||||||
/**
|
/**
|
||||||
* 在线用户监控
|
* 在线用户监控
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/monitor/online")
|
@RequestMapping("/monitor/online")
|
||||||
|
|||||||
@ -1,52 +0,0 @@
|
|||||||
package com.cmvr.web.controller.resource;
|
|
||||||
|
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
|
||||||
import com.cmvr.common.core.page.TableDataInfo;
|
|
||||||
import com.cmvr.resource.domain.ResourceDevice;
|
|
||||||
import com.cmvr.resource.service.ResourceDeviceService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/resource/devices")
|
|
||||||
@Api(tags = "资源中心-设备管理")
|
|
||||||
public class ResourceDeviceController extends BaseController {
|
|
||||||
private final ResourceDeviceService deviceService;
|
|
||||||
|
|
||||||
public ResourceDeviceController(ResourceDeviceService deviceService) {
|
|
||||||
this.deviceService = deviceService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
@ApiOperation("查询设备列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:device:list')")
|
|
||||||
public TableDataInfo list(ResourceDevice query,
|
|
||||||
@RequestParam(defaultValue = "true") boolean onlineOnly) {
|
|
||||||
startPage();
|
|
||||||
return getDataTable(deviceService.list(query, onlineOnly));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
@ApiOperation("查询设备详情")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:device:list')")
|
|
||||||
public AjaxResult get(@PathVariable String id) {
|
|
||||||
return success(deviceService.get(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
@ApiOperation("修改设备名称、用途和启用状态")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:device:edit')")
|
|
||||||
public AjaxResult update(@PathVariable String id, @RequestBody ResourceDevice device) {
|
|
||||||
device.setId(id);
|
|
||||||
return toAjax(deviceService.updateBusinessConfig(device));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
package com.cmvr.web.controller.resource;
|
|
||||||
|
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
|
||||||
import com.cmvr.common.core.page.TableDataInfo;
|
|
||||||
import com.cmvr.resource.domain.ResourceMap;
|
|
||||||
import com.cmvr.resource.service.ResourceMapService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/resource/maps")
|
|
||||||
@Api(tags = "资源中心-地图管理")
|
|
||||||
public class ResourceMapController extends BaseController {
|
|
||||||
private final ResourceMapService mapService;
|
|
||||||
|
|
||||||
public ResourceMapController(ResourceMapService mapService) {
|
|
||||||
this.mapService = mapService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
@ApiOperation("查询地图列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:list')")
|
|
||||||
public TableDataInfo list(ResourceMap query) {
|
|
||||||
startPage();
|
|
||||||
return getDataTable(mapService.list(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/robot/{robotId}")
|
|
||||||
@ApiOperation("查询机器人可用地图")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:list')")
|
|
||||||
public AjaxResult listByRobot(@PathVariable String robotId) {
|
|
||||||
return success(mapService.listByRobotId(robotId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
@ApiOperation("查询地图详情")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:query')")
|
|
||||||
public AjaxResult get(@PathVariable String id) {
|
|
||||||
return success(mapService.get(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping
|
|
||||||
@ApiOperation("新增地图")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:add')")
|
|
||||||
public AjaxResult create(@RequestBody ResourceMap map) {
|
|
||||||
return toAjax(mapService.create(map));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping
|
|
||||||
@ApiOperation("修改地图")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:edit')")
|
|
||||||
public AjaxResult update(@RequestBody ResourceMap map) {
|
|
||||||
return toAjax(mapService.update(map));
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
@ApiOperation("删除地图")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:remove')")
|
|
||||||
public AjaxResult remove(@PathVariable String[] ids) {
|
|
||||||
return toAjax(mapService.remove(Arrays.asList(ids)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,188 +0,0 @@
|
|||||||
package com.cmvr.web.controller.resource;
|
|
||||||
|
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
|
||||||
import com.cmvr.common.core.page.TableDataInfo;
|
|
||||||
import com.cmvr.resource.domain.ResourceRobot;
|
|
||||||
import com.cmvr.resource.service.ResourceRobotService;
|
|
||||||
import com.cmvr.resource.service.ResourceRobotMapService;
|
|
||||||
import com.cmvr.resource.service.ResourceRobotControlService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/resource/robots")
|
|
||||||
@Api(tags = "资源中心-机器人管理")
|
|
||||||
public class ResourceRobotController extends BaseController {
|
|
||||||
private final ResourceRobotService resourceRobotService;
|
|
||||||
private final ResourceRobotMapService robotMapService;
|
|
||||||
private final ResourceRobotControlService controlService;
|
|
||||||
|
|
||||||
public ResourceRobotController(ResourceRobotService resourceRobotService,
|
|
||||||
ResourceRobotMapService robotMapService,
|
|
||||||
ResourceRobotControlService controlService) {
|
|
||||||
this.resourceRobotService = resourceRobotService;
|
|
||||||
this.robotMapService = robotMapService;
|
|
||||||
this.controlService = controlService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
@ApiOperation("查询机器人列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:list')")
|
|
||||||
public TableDataInfo list(ResourceRobot query) {
|
|
||||||
startPage();
|
|
||||||
return getDataTable(resourceRobotService.list(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{robotId}")
|
|
||||||
@ApiOperation("根据永久机器人ID查询机器人")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:query')")
|
|
||||||
public AjaxResult get(@PathVariable String robotId) {
|
|
||||||
ResourceRobot robot = resourceRobotService.getByRobotId(robotId);
|
|
||||||
return robot == null ? error("机器人不存在:" + robotId) : success(robot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{robotId}/devices")
|
|
||||||
@ApiOperation("查询机器人设备")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:device:list')")
|
|
||||||
public AjaxResult devices(@PathVariable String robotId,
|
|
||||||
@RequestParam(required = false) Integer deviceKind,
|
|
||||||
@RequestParam(defaultValue = "true") @ApiParam("是否只返回在线且启用的设备") boolean onlineOnly) {
|
|
||||||
return success(resourceRobotService.listDevices(robotId, deviceKind, onlineOnly));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/id/{id}")
|
|
||||||
@ApiOperation("根据数据主键查询机器人")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:query')")
|
|
||||||
public AjaxResult getById(@PathVariable String id) {
|
|
||||||
return success(resourceRobotService.getById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/id/{id}/devices")
|
|
||||||
@ApiOperation("根据机器人数据主键查询设备")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:device:list')")
|
|
||||||
public AjaxResult devicesById(@PathVariable String id,
|
|
||||||
@RequestParam(required = false) Integer deviceKind,
|
|
||||||
@RequestParam(defaultValue = "false") boolean onlineOnly) {
|
|
||||||
return success(resourceRobotService.listDevicesByRobotRecord(id, deviceKind, onlineOnly));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping
|
|
||||||
@ApiOperation("登记机器人")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:add')")
|
|
||||||
public AjaxResult create(@RequestBody ResourceRobot robot) {
|
|
||||||
return toAjax(resourceRobotService.create(robot));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping
|
|
||||||
@ApiOperation("修改机器人")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:edit')")
|
|
||||||
public AjaxResult update(@RequestBody ResourceRobot robot) {
|
|
||||||
return toAjax(resourceRobotService.update(robot));
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
@ApiOperation("归档机器人")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:remove')")
|
|
||||||
public AjaxResult archive(@PathVariable String[] ids) {
|
|
||||||
return toAjax(resourceRobotService.archive(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{robotId}/maps")
|
|
||||||
@ApiOperation("查询机器人绑定的地图")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:list')")
|
|
||||||
public AjaxResult maps(@PathVariable String robotId) {
|
|
||||||
return success(robotMapService.listMaps(robotId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/{robotId}/maps/{mapId}")
|
|
||||||
@ApiOperation("绑定机器人地图")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:edit')")
|
|
||||||
public AjaxResult bindMap(@PathVariable String robotId, @PathVariable String mapId,
|
|
||||||
@RequestParam(defaultValue = "false") boolean makeDefault) {
|
|
||||||
return toAjax(robotMapService.bind(robotId, mapId, makeDefault));
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/{robotId}/maps/{mapId}")
|
|
||||||
@ApiOperation("解除机器人地图绑定")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:edit')")
|
|
||||||
public AjaxResult unbindMap(@PathVariable String robotId, @PathVariable String mapId) {
|
|
||||||
return toAjax(robotMapService.unbind(robotId, mapId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{robotRef}/remote-maps")
|
|
||||||
@ApiOperation("查询边缘机器人地图列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:list')")
|
|
||||||
public AjaxResult remoteMaps(@PathVariable String robotRef) {
|
|
||||||
return success(controlService.listRemoteMaps(robotRef));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{robotRef}/download-map")
|
|
||||||
@ApiOperation("下载边缘机器人地图")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:add')")
|
|
||||||
public AjaxResult downloadMap(@PathVariable String robotRef, @RequestParam String mapName) {
|
|
||||||
return success(controlService.downloadMap(robotRef, mapName));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/{robotRef}/upload-active-map")
|
|
||||||
@ApiOperation("上传当前地图到边缘机器人")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:edit')")
|
|
||||||
public AjaxResult uploadActiveMap(@PathVariable String robotRef) {
|
|
||||||
return success(controlService.uploadActiveMap(robotRef));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/{robotRef}/sync-runtime")
|
|
||||||
@ApiOperation("同步机器人实时状态")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:edit')")
|
|
||||||
public AjaxResult syncRuntime(@PathVariable String robotRef) {
|
|
||||||
return success(controlService.syncRuntimeState(robotRef));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{robotRef}/location")
|
|
||||||
@ApiOperation("查询机器人实时位置")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:query')")
|
|
||||||
public AjaxResult location(@PathVariable String robotRef) {
|
|
||||||
return success(controlService.getRealtimeLocation(robotRef));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/{robotRef}/navigate-to-position")
|
|
||||||
@ApiOperation("控制机器人导航到坐标")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:robot:edit')")
|
|
||||||
public AjaxResult navigateToPosition(@PathVariable String robotRef,
|
|
||||||
@RequestParam Double x,
|
|
||||||
@RequestParam Double y,
|
|
||||||
@RequestParam(required = false) Double theta) {
|
|
||||||
controlService.navigateToPosition(robotRef, x, y, theta);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/{robotRef}/start-mapping")
|
|
||||||
@ApiOperation("控制机器人开始建图")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:add')")
|
|
||||||
public AjaxResult startMapping(@PathVariable String robotRef,
|
|
||||||
@RequestParam int dimension,
|
|
||||||
@RequestParam(required = false) String mapName,
|
|
||||||
@RequestParam(defaultValue = "true") boolean realTime) {
|
|
||||||
return success(java.util.Map.of("sessionId",
|
|
||||||
controlService.startMapping(robotRef, dimension, mapName, realTime)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/{robotRef}/stop-mapping")
|
|
||||||
@ApiOperation("控制机器人结束建图")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:map:edit')")
|
|
||||||
public AjaxResult stopMapping(@PathVariable String robotRef) {
|
|
||||||
controlService.stopMapping(robotRef);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
package com.cmvr.web.controller.resource;
|
|
||||||
|
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
|
||||||
import com.cmvr.common.core.page.TableDataInfo;
|
|
||||||
import com.cmvr.resource.domain.ResourceTerminal;
|
|
||||||
import com.cmvr.resource.service.ResourceTerminalService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/resource/terminals")
|
|
||||||
@Api(tags = "资源中心-边缘终端")
|
|
||||||
public class ResourceTerminalController extends BaseController {
|
|
||||||
private final ResourceTerminalService terminalService;
|
|
||||||
|
|
||||||
public ResourceTerminalController(ResourceTerminalService terminalService) {
|
|
||||||
this.terminalService = terminalService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
@ApiOperation("查询边缘终端列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:terminal:list')")
|
|
||||||
public TableDataInfo list(ResourceTerminal query) {
|
|
||||||
startPage();
|
|
||||||
return getDataTable(terminalService.list(query));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
@ApiOperation("查询边缘终端详情")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:terminal:list')")
|
|
||||||
public AjaxResult get(@PathVariable String id) { return success(terminalService.get(id)); }
|
|
||||||
|
|
||||||
@PostMapping
|
|
||||||
@ApiOperation("新增边缘终端")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:terminal:add')")
|
|
||||||
public AjaxResult create(@RequestBody ResourceTerminal terminal) {
|
|
||||||
return toAjax(terminalService.create(terminal));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping
|
|
||||||
@ApiOperation("修改边缘终端")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:terminal:edit')")
|
|
||||||
public AjaxResult update(@RequestBody ResourceTerminal terminal) {
|
|
||||||
return toAjax(terminalService.update(terminal));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{id}/robots")
|
|
||||||
@ApiOperation("查询边缘终端关联的机器人")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:terminal:list')")
|
|
||||||
public AjaxResult robots(@PathVariable String id) { return success(terminalService.listRobotIds(id)); }
|
|
||||||
|
|
||||||
@PutMapping("/{id}/robots")
|
|
||||||
@ApiOperation("更新边缘终端关联的机器人")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:terminal:edit')")
|
|
||||||
public AjaxResult replaceRobots(@PathVariable String id, @RequestBody List<String> robotIds) {
|
|
||||||
terminalService.replaceRobots(id, robotIds);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
@ApiOperation("删除边缘终端")
|
|
||||||
@PreAuthorize("@ss.hasPermi('resource:terminal:remove')")
|
|
||||||
public AjaxResult remove(@PathVariable String[] ids) { return toAjax(terminalService.remove(ids)); }
|
|
||||||
}
|
|
||||||
@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RequestPart;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Api(tags = "演示--智能座舱")
|
@Api(tags = "演示--智能座舱")
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.system;
|
package com.cmvr.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -25,7 +25,7 @@ import com.cmvr.system.service.ISysConfigService;
|
|||||||
/**
|
/**
|
||||||
* 参数配置 信息操作处理
|
* 参数配置 信息操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/config")
|
@RequestMapping("/system/config")
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.cmvr.web.controller.system;
|
package com.cmvr.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -26,7 +25,7 @@ import com.cmvr.system.service.ISysDeptService;
|
|||||||
/**
|
/**
|
||||||
* 部门信息
|
* 部门信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/dept")
|
@RequestMapping("/system/dept")
|
||||||
@ -111,20 +110,6 @@ public class SysDeptController extends BaseController
|
|||||||
return toAjax(deptService.updateDept(dept));
|
return toAjax(deptService.updateDept(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存部门排序
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
|
||||||
@Log(title = "保存部门排序", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping("/updateSort")
|
|
||||||
public AjaxResult updateSort(@RequestBody Map<String, String> params)
|
|
||||||
{
|
|
||||||
String[] deptIds = params.get("deptIds").split(",");
|
|
||||||
String[] orderNums = params.get("orderNums").split(",");
|
|
||||||
deptService.updateDeptSort(deptIds, orderNums);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除部门
|
* 删除部门
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.cmvr.web.controller.system;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -28,7 +28,7 @@ import com.cmvr.system.service.ISysDictTypeService;
|
|||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/dict/data")
|
@RequestMapping("/system/dict/data")
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.system;
|
package com.cmvr.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -25,7 +25,7 @@ import com.cmvr.system.service.ISysDictTypeService;
|
|||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/dict/type")
|
@RequestMapping("/system/dict/type")
|
||||||
|
|||||||
@ -1,32 +1,22 @@
|
|||||||
package com.cmvr.web.controller.system;
|
package com.cmvr.web.controller.system;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.cmvr.common.config.CmvrIotConfig;
|
import com.cmvr.common.config.CmvrIotConfig;
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
|
||||||
import com.cmvr.common.core.domain.entity.SysUser;
|
|
||||||
import com.cmvr.common.utils.SecurityUtils;
|
|
||||||
import com.cmvr.common.utils.StringUtils;
|
import com.cmvr.common.utils.StringUtils;
|
||||||
import com.cmvr.system.service.ISysUserService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页
|
* 首页
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class SysIndexController
|
public class SysIndexController
|
||||||
{
|
{
|
||||||
/** 系统基础配置 */
|
/** 系统基础配置 */
|
||||||
@Autowired
|
@Autowired
|
||||||
private CmvrIotConfig ruoyiConfig;
|
private CmvrIotConfig cmvrIotConfig;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysUserService userService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 访问首页,提示语
|
* 访问首页,提示语
|
||||||
@ -34,31 +24,6 @@ public class SysIndexController
|
|||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
public String index()
|
public String index()
|
||||||
{
|
{
|
||||||
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
|
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", cmvrIotConfig.getName(), cmvrIotConfig.getVersion());
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解锁屏幕
|
|
||||||
*/
|
|
||||||
@PostMapping("/unlockscreen")
|
|
||||||
public AjaxResult unlockScreen(@RequestBody Map<String, String> body)
|
|
||||||
{
|
|
||||||
String password = body.get("password");
|
|
||||||
if (StringUtils.isEmpty(password))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("密码不能为空");
|
|
||||||
}
|
|
||||||
String username = SecurityUtils.getUsername();
|
|
||||||
SysUser user = userService.selectUserByUserName(username);
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
return AjaxResult.error("服务器超时,请重新登录");
|
|
||||||
}
|
|
||||||
if (!SecurityUtils.matchesPassword(password, user.getPassword()))
|
|
||||||
{
|
|
||||||
return AjaxResult.error("密码错误,请重新输入");
|
|
||||||
}
|
|
||||||
|
|
||||||
return AjaxResult.success("解锁成功");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
package com.cmvr.web.controller.system;
|
package com.cmvr.web.controller.system;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@ -14,21 +16,18 @@ import com.cmvr.common.core.domain.entity.SysMenu;
|
|||||||
import com.cmvr.common.core.domain.entity.SysUser;
|
import com.cmvr.common.core.domain.entity.SysUser;
|
||||||
import com.cmvr.common.core.domain.model.LoginBody;
|
import com.cmvr.common.core.domain.model.LoginBody;
|
||||||
import com.cmvr.common.core.domain.model.LoginUser;
|
import com.cmvr.common.core.domain.model.LoginUser;
|
||||||
import com.cmvr.common.core.text.Convert;
|
|
||||||
import com.cmvr.common.utils.DateUtils;
|
|
||||||
import com.cmvr.common.utils.SecurityUtils;
|
import com.cmvr.common.utils.SecurityUtils;
|
||||||
import com.cmvr.common.utils.StringUtils;
|
|
||||||
import com.cmvr.framework.web.service.SysLoginService;
|
import com.cmvr.framework.web.service.SysLoginService;
|
||||||
import com.cmvr.framework.web.service.SysPermissionService;
|
import com.cmvr.framework.web.service.SysPermissionService;
|
||||||
import com.cmvr.framework.web.service.TokenService;
|
import com.cmvr.framework.web.service.TokenService;
|
||||||
import com.cmvr.system.service.ISysConfigService;
|
|
||||||
import com.cmvr.system.service.ISysMenuService;
|
import com.cmvr.system.service.ISysMenuService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录验证
|
* 登录验证
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
|
@Api(tags = "通用--登录验证")
|
||||||
@RestController
|
@RestController
|
||||||
public class SysLoginController
|
public class SysLoginController
|
||||||
{
|
{
|
||||||
@ -44,15 +43,13 @@ public class SysLoginController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysConfigService configService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录方法
|
* 登录方法
|
||||||
*
|
*
|
||||||
* @param loginBody 登录信息
|
* @param loginBody 登录信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("登录")
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
public AjaxResult login(@RequestBody LoginBody loginBody)
|
||||||
{
|
{
|
||||||
@ -87,9 +84,6 @@ public class SysLoginController
|
|||||||
ajax.put("user", user);
|
ajax.put("user", user);
|
||||||
ajax.put("roles", roles);
|
ajax.put("roles", roles);
|
||||||
ajax.put("permissions", permissions);
|
ajax.put("permissions", permissions);
|
||||||
ajax.put("pwdChrtype", getSysAccountChrtype());
|
|
||||||
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
|
||||||
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,34 +99,4 @@ public class SysLoginController
|
|||||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||||
return AjaxResult.success(menuService.buildMenus(menus));
|
return AjaxResult.success(menuService.buildMenus(menus));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户密码自定义配置规则
|
|
||||||
public String getSysAccountChrtype()
|
|
||||||
{
|
|
||||||
return Convert.toStr(configService.selectConfigByKey("sys.account.chrtype"), "0");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查初始密码是否提醒修改
|
|
||||||
public boolean initPasswordIsModify(Date pwdUpdateDate)
|
|
||||||
{
|
|
||||||
Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify"));
|
|
||||||
return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查密码是否过期
|
|
||||||
public boolean passwordIsExpiration(Date pwdUpdateDate)
|
|
||||||
{
|
|
||||||
Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays"));
|
|
||||||
if (passwordValidateDays != null && passwordValidateDays > 0)
|
|
||||||
{
|
|
||||||
if (StringUtils.isNull(pwdUpdateDate))
|
|
||||||
{
|
|
||||||
// 如果从未修改过初始密码,直接提醒过期
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Date nowDate = DateUtils.getNowDate();
|
|
||||||
return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.cmvr.web.controller.system;
|
package com.cmvr.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -25,7 +24,7 @@ import com.cmvr.system.service.ISysMenuService;
|
|||||||
/**
|
/**
|
||||||
* 菜单信息
|
* 菜单信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/menu")
|
@RequestMapping("/system/menu")
|
||||||
@ -94,10 +93,6 @@ public class SysMenuController extends BaseController
|
|||||||
{
|
{
|
||||||
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
}
|
}
|
||||||
else if (!menuService.checkRouteConfigUnique(menu))
|
|
||||||
{
|
|
||||||
return error("新增菜单'" + menu.getMenuName() + "'失败,路由名称或地址已存在");
|
|
||||||
}
|
|
||||||
menu.setCreateBy(getUsername());
|
menu.setCreateBy(getUsername());
|
||||||
return toAjax(menuService.insertMenu(menu));
|
return toAjax(menuService.insertMenu(menu));
|
||||||
}
|
}
|
||||||
@ -122,28 +117,10 @@ public class SysMenuController extends BaseController
|
|||||||
{
|
{
|
||||||
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||||
}
|
}
|
||||||
else if (!menuService.checkRouteConfigUnique(menu))
|
|
||||||
{
|
|
||||||
return error("修改菜单'" + menu.getMenuName() + "'失败,路由名称或地址已存在");
|
|
||||||
}
|
|
||||||
menu.setUpdateBy(getUsername());
|
menu.setUpdateBy(getUsername());
|
||||||
return toAjax(menuService.updateMenu(menu));
|
return toAjax(menuService.updateMenu(menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存菜单排序
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
|
||||||
@Log(title = "保存菜单排序", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping("/updateSort")
|
|
||||||
public AjaxResult updateSort(@RequestBody Map<String, String> params)
|
|
||||||
{
|
|
||||||
String[] menuIds = params.get("menuIds").split(",");
|
|
||||||
String[] orderNums = params.get("orderNums").split(",");
|
|
||||||
menuService.updateMenuSort(menuIds, orderNums);
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除菜单
|
* 删除菜单
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.cmvr.common.annotation.Log;
|
import com.cmvr.common.annotation.Log;
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
@ -19,11 +18,12 @@ import com.cmvr.common.core.domain.AjaxResult;
|
|||||||
import com.cmvr.common.core.page.TableDataInfo;
|
import com.cmvr.common.core.page.TableDataInfo;
|
||||||
import com.cmvr.common.enums.BusinessType;
|
import com.cmvr.common.enums.BusinessType;
|
||||||
import com.cmvr.system.domain.SysNotice;
|
import com.cmvr.system.domain.SysNotice;
|
||||||
import com.cmvr.system.domain.SysNoticeRead;
|
|
||||||
import com.cmvr.system.service.ISysNoticeService;
|
import com.cmvr.system.service.ISysNoticeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告信息操作处理。
|
* 公告 信息操作处理
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/notice")
|
@RequestMapping("/system/notice")
|
||||||
@ -32,6 +32,9 @@ public class SysNoticeController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysNoticeService noticeService;
|
private ISysNoticeService noticeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取通知公告列表
|
||||||
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysNotice notice)
|
public TableDataInfo list(SysNotice notice)
|
||||||
@ -41,37 +44,9 @@ public class SysNoticeController extends BaseController
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/listTop")
|
/**
|
||||||
public AjaxResult listTop()
|
* 根据通知公告编号获取详细信息
|
||||||
{
|
*/
|
||||||
Long userId = getUserId();
|
|
||||||
AjaxResult result = success(noticeService.selectNoticeTop(userId));
|
|
||||||
result.put("unreadCount", noticeService.countUnreadNotice(userId));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/markRead")
|
|
||||||
public AjaxResult markRead(@RequestParam Long noticeId)
|
|
||||||
{
|
|
||||||
noticeService.markNoticeRead(noticeId, getUserId());
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/markReadAll")
|
|
||||||
public AjaxResult markReadAll(@RequestParam Long[] ids)
|
|
||||||
{
|
|
||||||
noticeService.markNoticeReadAll(ids, getUserId());
|
|
||||||
return success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
|
||||||
@GetMapping("/readUsers/list")
|
|
||||||
public TableDataInfo readUsers(SysNoticeRead noticeRead)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
return getDataTable(noticeService.selectNoticeReadUsers(noticeRead));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||||
@GetMapping(value = "/{noticeId}")
|
@GetMapping(value = "/{noticeId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||||
@ -79,6 +54,9 @@ public class SysNoticeController extends BaseController
|
|||||||
return success(noticeService.selectNoticeById(noticeId));
|
return success(noticeService.selectNoticeById(noticeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增通知公告
|
||||||
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ -88,6 +66,9 @@ public class SysNoticeController extends BaseController
|
|||||||
return toAjax(noticeService.insertNotice(notice));
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改通知公告
|
||||||
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ -97,6 +78,9 @@ public class SysNoticeController extends BaseController
|
|||||||
return toAjax(noticeService.updateNotice(notice));
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除通知公告
|
||||||
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{noticeIds}")
|
@DeleteMapping("/{noticeIds}")
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.system;
|
package com.cmvr.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -25,7 +25,7 @@ import com.cmvr.system.service.ISysPostService;
|
|||||||
/**
|
/**
|
||||||
* 岗位信息操作处理
|
* 岗位信息操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/post")
|
@RequestMapping("/system/post")
|
||||||
|
|||||||
@ -17,11 +17,9 @@ import com.cmvr.common.core.domain.AjaxResult;
|
|||||||
import com.cmvr.common.core.domain.entity.SysUser;
|
import com.cmvr.common.core.domain.entity.SysUser;
|
||||||
import com.cmvr.common.core.domain.model.LoginUser;
|
import com.cmvr.common.core.domain.model.LoginUser;
|
||||||
import com.cmvr.common.enums.BusinessType;
|
import com.cmvr.common.enums.BusinessType;
|
||||||
import com.cmvr.common.utils.DateUtils;
|
|
||||||
import com.cmvr.common.utils.SecurityUtils;
|
import com.cmvr.common.utils.SecurityUtils;
|
||||||
import com.cmvr.common.utils.StringUtils;
|
import com.cmvr.common.utils.StringUtils;
|
||||||
import com.cmvr.common.utils.file.FileUploadUtils;
|
import com.cmvr.common.utils.file.FileUploadUtils;
|
||||||
import com.cmvr.common.utils.file.FileUtils;
|
|
||||||
import com.cmvr.common.utils.file.MimeTypeUtils;
|
import com.cmvr.common.utils.file.MimeTypeUtils;
|
||||||
import com.cmvr.framework.web.service.TokenService;
|
import com.cmvr.framework.web.service.TokenService;
|
||||||
import com.cmvr.system.service.ISysUserService;
|
import com.cmvr.system.service.ISysUserService;
|
||||||
@ -29,7 +27,7 @@ import com.cmvr.system.service.ISysUserService;
|
|||||||
/**
|
/**
|
||||||
* 个人信息 业务处理
|
* 个人信息 业务处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/user/profile")
|
@RequestMapping("/system/user/profile")
|
||||||
@ -95,9 +93,8 @@ public class SysProfileController extends BaseController
|
|||||||
String oldPassword = params.get("oldPassword");
|
String oldPassword = params.get("oldPassword");
|
||||||
String newPassword = params.get("newPassword");
|
String newPassword = params.get("newPassword");
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
Long userId = loginUser.getUserId();
|
String userName = loginUser.getUsername();
|
||||||
SysUser user = userService.selectUserById(userId);
|
String password = loginUser.getPassword();
|
||||||
String password = user.getPassword();
|
|
||||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||||
{
|
{
|
||||||
return error("修改密码失败,旧密码错误");
|
return error("修改密码失败,旧密码错误");
|
||||||
@ -107,10 +104,9 @@ public class SysProfileController extends BaseController
|
|||||||
return error("新密码不能与旧密码相同");
|
return error("新密码不能与旧密码相同");
|
||||||
}
|
}
|
||||||
newPassword = SecurityUtils.encryptPassword(newPassword);
|
newPassword = SecurityUtils.encryptPassword(newPassword);
|
||||||
if (userService.resetUserPwd(userId, newPassword) > 0)
|
if (userService.resetUserPwd(userName, newPassword) > 0)
|
||||||
{
|
{
|
||||||
// 更新缓存用户密码&密码最后更新时间
|
// 更新缓存用户密码
|
||||||
loginUser.getUser().setPwdUpdateDate(DateUtils.getNowDate());
|
|
||||||
loginUser.getUser().setPassword(newPassword);
|
loginUser.getUser().setPassword(newPassword);
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
return success();
|
return success();
|
||||||
@ -128,14 +124,9 @@ public class SysProfileController extends BaseController
|
|||||||
if (!file.isEmpty())
|
if (!file.isEmpty())
|
||||||
{
|
{
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
String avatar = FileUploadUtils.upload(CmvrIotConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION, true);
|
String avatar = FileUploadUtils.upload(CmvrIotConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||||
if (userService.updateUserAvatar(loginUser.getUserId(), avatar))
|
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
||||||
{
|
{
|
||||||
String oldAvatar = loginUser.getUser().getAvatar();
|
|
||||||
if (StringUtils.isNotEmpty(oldAvatar))
|
|
||||||
{
|
|
||||||
FileUtils.deleteFile(CmvrIotConfig.getProfile() + FileUtils.stripPrefix(oldAvatar));
|
|
||||||
}
|
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("imgUrl", avatar);
|
ajax.put("imgUrl", avatar);
|
||||||
// 更新缓存用户头像
|
// 更新缓存用户头像
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import com.cmvr.system.service.ISysConfigService;
|
|||||||
/**
|
/**
|
||||||
* 注册验证
|
* 注册验证
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class SysRegisterController extends BaseController
|
public class SysRegisterController extends BaseController
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.cmvr.web.controller.system;
|
package com.cmvr.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -19,8 +19,10 @@ import com.cmvr.common.core.domain.AjaxResult;
|
|||||||
import com.cmvr.common.core.domain.entity.SysDept;
|
import com.cmvr.common.core.domain.entity.SysDept;
|
||||||
import com.cmvr.common.core.domain.entity.SysRole;
|
import com.cmvr.common.core.domain.entity.SysRole;
|
||||||
import com.cmvr.common.core.domain.entity.SysUser;
|
import com.cmvr.common.core.domain.entity.SysUser;
|
||||||
|
import com.cmvr.common.core.domain.model.LoginUser;
|
||||||
import com.cmvr.common.core.page.TableDataInfo;
|
import com.cmvr.common.core.page.TableDataInfo;
|
||||||
import com.cmvr.common.enums.BusinessType;
|
import com.cmvr.common.enums.BusinessType;
|
||||||
|
import com.cmvr.common.utils.StringUtils;
|
||||||
import com.cmvr.common.utils.poi.ExcelUtil;
|
import com.cmvr.common.utils.poi.ExcelUtil;
|
||||||
import com.cmvr.framework.web.service.SysPermissionService;
|
import com.cmvr.framework.web.service.SysPermissionService;
|
||||||
import com.cmvr.framework.web.service.TokenService;
|
import com.cmvr.framework.web.service.TokenService;
|
||||||
@ -32,7 +34,7 @@ import com.cmvr.system.service.ISysUserService;
|
|||||||
/**
|
/**
|
||||||
* 角色信息
|
* 角色信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/role")
|
@RequestMapping("/system/role")
|
||||||
@ -126,8 +128,14 @@ public class SysRoleController extends BaseController
|
|||||||
|
|
||||||
if (roleService.updateRole(role) > 0)
|
if (roleService.updateRole(role) > 0)
|
||||||
{
|
{
|
||||||
// 刷新所有持有该角色的在线用户权限
|
// 更新缓存用户权限
|
||||||
tokenService.refreshPermissionByRoleId(role.getRoleId(), permissionService);
|
LoginUser loginUser = getLoginUser();
|
||||||
|
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
||||||
|
{
|
||||||
|
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||||
|
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
}
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.cmvr.web.controller.system;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -35,7 +35,7 @@ import com.cmvr.system.service.ISysUserService;
|
|||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author cmvr-iot
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/user")
|
@RequestMapping("/system/user")
|
||||||
@ -111,7 +111,7 @@ public class SysUserController extends BaseController
|
|||||||
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
List<SysRole> roles = roleService.selectRoleAll();
|
List<SysRole> roles = roleService.selectRoleAll();
|
||||||
ajax.put("roles", SecurityUtils.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
ajax.put("posts", postService.selectPostAll());
|
ajax.put("posts", postService.selectPostAll());
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ public class SysUserController extends BaseController
|
|||||||
SysUser user = userService.selectUserById(userId);
|
SysUser user = userService.selectUserById(userId);
|
||||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
ajax.put("user", user);
|
ajax.put("user", user);
|
||||||
ajax.put("roles", SecurityUtils.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Api(tags = "测试--检测项配置")
|
@Api(tags = "测试--检测项配置")
|
||||||
@ -60,14 +60,6 @@ public class TeDetectionItemController extends BaseController {
|
|||||||
return toAjax(rows);
|
return toAjax(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("复制检测项配置")
|
|
||||||
@PreAuthorize("@ss.hasPermi('test:detect:add')")
|
|
||||||
@Log(title = "检测项配置", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping("/copy/{id}")
|
|
||||||
public AjaxResult copy(@PathVariable String id) {
|
|
||||||
return success(teDetectionItemService.copyTeDetectionItem(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("修改检测项配置")
|
@ApiOperation("修改检测项配置")
|
||||||
@PreAuthorize("@ss.hasPermi('test:detect:edit')")
|
@PreAuthorize("@ss.hasPermi('test:detect:edit')")
|
||||||
@Log(title = "检测项配置", businessType = BusinessType.UPDATE)
|
@Log(title = "检测项配置", businessType = BusinessType.UPDATE)
|
||||||
|
|||||||
@ -2,37 +2,26 @@ package com.cmvr.web.controller.test;
|
|||||||
|
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.cmvr.common.annotation.Anonymous;
|
import com.cmvr.common.annotation.Anonymous;
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
import com.cmvr.llm.service.LLMAiAgentPlatformService;
|
import com.cmvr.llm.service.LLMAiAgentPlatformService;
|
||||||
import com.cmvr.llm.analysis.AudioAnalysisCorrectionRequest;
|
|
||||||
import com.cmvr.llm.analysis.AudioAnalysisCorrectionSupport;
|
|
||||||
import com.cmvr.llm.analysis.MediaAnalysisClient;
|
|
||||||
import com.cmvr.test.flow.context.TaskContextManager;
|
import com.cmvr.test.flow.context.TaskContextManager;
|
||||||
import com.cmvr.test.flow.control.FlowControlService;
|
import com.cmvr.test.flow.control.FlowControlService;
|
||||||
import com.cmvr.test.flow.runtime.engine.FlowTaskRuntimeService;
|
import com.cmvr.test.flow.runtime.engine.FlowTaskRuntimeService;
|
||||||
import com.cmvr.test.flow.runtime.subflow.FlowSubFlowDefinitionService;
|
|
||||||
import com.cmvr.test.flow.runtime.operator.edge.ti.TiTouchOperateService;
|
import com.cmvr.test.flow.runtime.operator.edge.ti.TiTouchOperateService;
|
||||||
|
import com.cmvr.test.model.domain.TeDetectionItem;
|
||||||
import com.cmvr.test.model.vo.FlowActionRequestVO;
|
import com.cmvr.test.model.vo.FlowActionRequestVO;
|
||||||
import com.cmvr.test.constant.LLMChatConstants;
|
|
||||||
import com.cmvr.test.model.vo.TeDetectItemDeployFlowVO;
|
|
||||||
import com.cmvr.test.model.vo.TeFlowPublishVO;
|
|
||||||
import com.cmvr.test.model.vo.TeFlowVersionActionVO;
|
|
||||||
import com.cmvr.test.model.vo.TeFlowViewVO;
|
import com.cmvr.test.model.vo.TeFlowViewVO;
|
||||||
import com.cmvr.test.model.vo.TeTaskExecuteNormalVO;
|
import com.cmvr.test.model.vo.TeTaskExecuteNormalVO;
|
||||||
import com.cmvr.test.model.vo.TeTaskExecuteTrailVO;
|
import com.cmvr.test.model.vo.TeTaskExecuteTrailVO;
|
||||||
import com.cmvr.test.model.domain.TeNodeInst;
|
|
||||||
import com.cmvr.test.service.FlowActionExecutorService;
|
import com.cmvr.test.service.FlowActionExecutorService;
|
||||||
import com.cmvr.test.service.ITeDetectionItemService;
|
import com.cmvr.test.service.ITeDetectionItemService;
|
||||||
import com.cmvr.test.service.ITeDetectionItemVersionService;
|
|
||||||
import com.cmvr.test.service.ITeNodeInstService;
|
import com.cmvr.test.service.ITeNodeInstService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@ -40,16 +29,11 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
||||||
|
|
||||||
import jakarta.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
import jakarta.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.CancellationException;
|
import java.util.concurrent.CancellationException;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@ -78,8 +62,6 @@ public class TeFlowController extends BaseController {
|
|||||||
private static final String AI_AGENT_API_KEY = "d9etum54shheenol3apg";
|
private static final String AI_AGENT_API_KEY = "d9etum54shheenol3apg";
|
||||||
|
|
||||||
private final ITeDetectionItemService teDetectionItemService;
|
private final ITeDetectionItemService teDetectionItemService;
|
||||||
private final ITeDetectionItemVersionService detectionItemVersionService;
|
|
||||||
private final FlowSubFlowDefinitionService subFlowDefinitionService;
|
|
||||||
private final ITeNodeInstService nodeInstService;
|
private final ITeNodeInstService nodeInstService;
|
||||||
private final FlowTaskRuntimeService flowTaskRuntimeService;
|
private final FlowTaskRuntimeService flowTaskRuntimeService;
|
||||||
private final TaskContextManager taskContextManager;
|
private final TaskContextManager taskContextManager;
|
||||||
@ -87,9 +69,6 @@ public class TeFlowController extends BaseController {
|
|||||||
private final FlowActionExecutorService flowActionExecutorService;
|
private final FlowActionExecutorService flowActionExecutorService;
|
||||||
private final TiTouchOperateService tiTouchOperateService;
|
private final TiTouchOperateService tiTouchOperateService;
|
||||||
private final LLMAiAgentPlatformService llmAiAgentPlatformService;
|
private final LLMAiAgentPlatformService llmAiAgentPlatformService;
|
||||||
private final MediaAnalysisClient mediaAnalysisClient;
|
|
||||||
@Qualifier("mediaAnalysisTaskExecutor")
|
|
||||||
private final ThreadPoolTaskExecutor mediaAnalysisTaskExecutor;
|
|
||||||
private final List<String> taskInstIdList = new ArrayList<>();
|
private final List<String> taskInstIdList = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,62 +85,10 @@ public class TeFlowController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
private volatile Future<JSONObject> currentAiAgentFuture;
|
private volatile Future<JSONObject> currentAiAgentFuture;
|
||||||
|
|
||||||
/** 闲聊接口使用独立任务,避免影响原商道智能体接口。 */
|
|
||||||
private final ExecutorService chatExecutor = Executors.newSingleThreadExecutor(runnable -> {
|
|
||||||
Thread thread = new Thread(runnable, "flow-llm-chat-query");
|
|
||||||
thread.setDaemon(true);
|
|
||||||
return thread;
|
|
||||||
});
|
|
||||||
|
|
||||||
private volatile Future<String> currentChatFuture;
|
|
||||||
|
|
||||||
@Value("${CMVR_CHAT_TTS_STOP_URL:http://192.168.0.148:8080/tts/stop}")
|
|
||||||
private String chatTtsStopUrl;
|
|
||||||
|
|
||||||
@ApiOperation("流程发布")
|
@ApiOperation("流程发布")
|
||||||
@PostMapping("/publish")
|
@PostMapping("/publish")
|
||||||
public AjaxResult publish(@Valid @RequestBody TeFlowPublishVO request) {
|
public AjaxResult publish(@RequestBody TeDetectionItem detectionItem) {
|
||||||
return success(detectionItemVersionService.publish(request, getUsername()));
|
return toAjax(teDetectionItemService.publish(detectionItem.getId()));
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("保存工作流草稿")
|
|
||||||
@PutMapping("/draft")
|
|
||||||
public AjaxResult saveDraft(@Valid @RequestBody TeDetectItemDeployFlowVO request) {
|
|
||||||
return success(teDetectionItemService.saveDraft(request, getUsername()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("查询工作流发布记录")
|
|
||||||
@GetMapping("/versions/{itemId}")
|
|
||||||
public AjaxResult versions(@PathVariable String itemId) {
|
|
||||||
return success(detectionItemVersionService.listVersions(itemId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("查询当前项目可用的已发布子流程")
|
|
||||||
@GetMapping("/subflows")
|
|
||||||
public AjaxResult subFlows(@RequestParam String currentItemId) {
|
|
||||||
return success(subFlowDefinitionService.listOptions(currentItemId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("查看工作流发布版本")
|
|
||||||
@GetMapping("/version/{versionId}")
|
|
||||||
public AjaxResult version(@PathVariable String versionId) {
|
|
||||||
return success(detectionItemVersionService.getVersion(versionId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("将发布版本恢复为草稿")
|
|
||||||
@PostMapping("/version/{versionId}/restore-draft")
|
|
||||||
public AjaxResult restoreDraft(@PathVariable String versionId,
|
|
||||||
@RequestBody(required = false) TeFlowVersionActionVO request) {
|
|
||||||
Integer revision = request == null ? null : request.getDraftRevision();
|
|
||||||
return success(detectionItemVersionService.restoreDraft(versionId, revision, getUsername()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("回退到指定发布版本")
|
|
||||||
@PostMapping("/version/{versionId}/rollback")
|
|
||||||
public AjaxResult rollback(@PathVariable String versionId,
|
|
||||||
@RequestBody(required = false) TeFlowVersionActionVO request) {
|
|
||||||
String note = request == null ? null : request.getPublishNote();
|
|
||||||
return success(detectionItemVersionService.rollback(versionId, note, getUsername()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("演示任务执行入口")
|
@ApiOperation("演示任务执行入口")
|
||||||
@ -200,85 +127,6 @@ public class TeFlowController extends BaseController {
|
|||||||
return AjaxResult.success(nodeInstService.view(flowViewVO));
|
return AjaxResult.success(nodeInstService.view(flowViewVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Correct a trial audio result and submit the confirmed sample for retraining.
|
|
||||||
* The media URL and profile are read from the persisted node log by default.
|
|
||||||
*/
|
|
||||||
@ApiOperation("试运行声音分析人工改判并重新训练")
|
|
||||||
@PreAuthorize("@ss.hasPermi('test:config:execute')")
|
|
||||||
@PostMapping("/audio-correction/{nodeInstId}")
|
|
||||||
public AjaxResult correctTrialAudio(@PathVariable Long nodeInstId,
|
|
||||||
@Valid @RequestBody AudioAnalysisCorrectionRequest correction) {
|
|
||||||
TeNodeInst node = nodeInstService.getById(nodeInstId);
|
|
||||||
if (node == null) {
|
|
||||||
return AjaxResult.error("试运行日志不存在");
|
|
||||||
}
|
|
||||||
if (!"AUDIO_EVENT_CLASSIFY".equalsIgnoreCase(node.getAction())) {
|
|
||||||
return AjaxResult.error("该日志不是声音分析节点");
|
|
||||||
}
|
|
||||||
JSONObject output = AudioAnalysisCorrectionSupport.parse(node.getParamsOut());
|
|
||||||
JSONObject input = AudioAnalysisCorrectionSupport.parse(node.getParamsIn());
|
|
||||||
String mediaUrl = StringUtils.defaultIfBlank(correction.getMediaUrl(),
|
|
||||||
AudioAnalysisCorrectionSupport.mediaUrl(output, input));
|
|
||||||
String profileCode = StringUtils.defaultIfBlank(correction.getProfileCode(),
|
|
||||||
AudioAnalysisCorrectionSupport.profileCode(output, input));
|
|
||||||
if (StringUtils.isBlank(mediaUrl) || StringUtils.isBlank(profileCode)) {
|
|
||||||
return AjaxResult.error("日志缺少音频地址或分析档案");
|
|
||||||
}
|
|
||||||
String requestId = "trial-audio-correction-" + nodeInstId + "-" + UUID.randomUUID();
|
|
||||||
JSONObject trainingRequest = AudioAnalysisCorrectionSupport.trainingRequest(
|
|
||||||
requestId, profileCode, mediaUrl, correction);
|
|
||||||
trainingRequest.put("context", new JSONObject()
|
|
||||||
.fluentPut("source", "TRIAL_NODE_LOG")
|
|
||||||
.fluentPut("nodeInstId", nodeInstId)
|
|
||||||
.fluentPut("instId", node.getInstId())
|
|
||||||
.fluentPut("nodeId", node.getNodeId()));
|
|
||||||
AudioAnalysisCorrectionSupport.apply(output, correction, "RUNNING", null, null);
|
|
||||||
output.getJSONObject("manualCorrection").put("trainingRequestId", requestId);
|
|
||||||
node.setParamsOut(output.toJSONString());
|
|
||||||
node.setMessage("声音分析已人工改判,训练任务已提交");
|
|
||||||
nodeInstService.updateById(node);
|
|
||||||
try {
|
|
||||||
mediaAnalysisTaskExecutor.execute(() -> trainTrialAudio(
|
|
||||||
nodeInstId, requestId, trainingRequest));
|
|
||||||
} catch (RuntimeException exception) {
|
|
||||||
updateTrialTraining(nodeInstId, requestId, "FAILED", null, exception.getMessage());
|
|
||||||
}
|
|
||||||
return AjaxResult.success(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void trainTrialAudio(Long nodeInstId, String requestId, JSONObject trainingRequest) {
|
|
||||||
try {
|
|
||||||
JSONObject training = mediaAnalysisClient.addAudioReference(trainingRequest);
|
|
||||||
updateTrialTraining(nodeInstId, requestId, "SUCCEEDED", training, null);
|
|
||||||
} catch (Exception exception) {
|
|
||||||
updateTrialTraining(nodeInstId, requestId, "FAILED", null, exception.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateTrialTraining(Long nodeInstId, String requestId, String status,
|
|
||||||
JSONObject training, String error) {
|
|
||||||
TeNodeInst current = nodeInstService.getById(nodeInstId);
|
|
||||||
if (current == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JSONObject output = AudioAnalysisCorrectionSupport.parse(current.getParamsOut());
|
|
||||||
JSONObject correction = output.getJSONObject("manualCorrection");
|
|
||||||
if (correction == null || !requestId.equals(correction.getString("trainingRequestId"))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
correction.put("trainingStatus", status);
|
|
||||||
if (training != null) {
|
|
||||||
correction.put("training", training);
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(error)) {
|
|
||||||
correction.put("trainingError", error);
|
|
||||||
}
|
|
||||||
current.setParamsOut(output.toJSONString());
|
|
||||||
current.setMessage("声音分析已人工改判,训练" + ("SUCCEEDED".equals(status) ? "完成" : "失败"));
|
|
||||||
nodeInstService.updateById(current);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("清理终端")
|
@ApiOperation("清理终端")
|
||||||
@GetMapping("/clear")
|
@GetMapping("/clear")
|
||||||
public AjaxResult clear() {
|
public AjaxResult clear() {
|
||||||
@ -309,9 +157,7 @@ public class TeFlowController extends BaseController {
|
|||||||
|
|
||||||
@PostMapping("/action")
|
@PostMapping("/action")
|
||||||
@ApiOperation(value = "单个节点执行",
|
@ApiOperation(value = "单个节点执行",
|
||||||
notes = "设备通用指令action=DEVICE_EXECUTE_JSON_COMMAND,payload需要robotId、deviceId、requestJson;"
|
notes = "巡检仪表节点action=INSPECTION_METER_RECOGNIZE,payload使用InspectionMeterRecognizeConfigVO;"
|
||||||
+ "巡检仪表节点action=INSPECTION_METER_RECOGNIZE,payload使用InspectionMeterRecognizeConfigVO;"
|
|
||||||
+ "点位语料节点action=INSPECTION_WAYPOINT_CORPUS,payload需要detectItemId、type;"
|
|
||||||
+ "人工判断节点action=INSPECTION_MANUAL_REVIEW_CREATE,payload使用InspectionManualReviewConfigVO。"
|
+ "人工判断节点action=INSPECTION_MANUAL_REVIEW_CREATE,payload使用InspectionManualReviewConfigVO。"
|
||||||
+ "该接口用于试调节点,不会生成正式巡检任务结果")
|
+ "该接口用于试调节点,不会生成正式巡检任务结果")
|
||||||
public AjaxResult actionExecute(
|
public AjaxResult actionExecute(
|
||||||
@ -382,56 +228,6 @@ public class TeFlowController extends BaseController {
|
|||||||
return AjaxResult.ok("ok");
|
return AjaxResult.ok("ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 调用工作流闲聊组件。模型响应由组件流式接收,开启 TTS 后按句即时播放,
|
|
||||||
* HTTP 接口在组件完成后返回完整文本。
|
|
||||||
*/
|
|
||||||
@GetMapping("/llm/chat/query")
|
|
||||||
@ApiOperation("调用闲聊组件")
|
|
||||||
public AjaxResult queryChat(String text,
|
|
||||||
@RequestParam(defaultValue = "true") boolean invokeTts) {
|
|
||||||
if (StringUtils.isBlank(text)) {
|
|
||||||
return AjaxResult.error("text不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
stopCurrentChatFuture(true);
|
|
||||||
JSONObject payload = new JSONObject();
|
|
||||||
payload.put("text", text.trim());
|
|
||||||
payload.put("promptMode", "CUSTOM");
|
|
||||||
payload.put("prompt", LLMChatConstants.DEFAULT_SYSTEM_PROMPT);
|
|
||||||
payload.put("invokeTts", invokeTts);
|
|
||||||
|
|
||||||
FlowActionRequestVO request = new FlowActionRequestVO();
|
|
||||||
request.setAction("LLM_CHAT");
|
|
||||||
request.setPayload(payload);
|
|
||||||
|
|
||||||
Future<String> future = chatExecutor.submit(() -> flowActionExecutorService.actionExecute(request));
|
|
||||||
currentChatFuture = future;
|
|
||||||
try {
|
|
||||||
return AjaxResult.ok(com.alibaba.fastjson2.JSON.parseObject(future.get()));
|
|
||||||
} catch (CancellationException e) {
|
|
||||||
return AjaxResult.error("闲聊调用已停止");
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
future.cancel(true);
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
return AjaxResult.error("闲聊调用被中断");
|
|
||||||
} catch (ExecutionException e) {
|
|
||||||
Throwable cause = e.getCause() == null ? e : e.getCause();
|
|
||||||
return AjaxResult.error("闲聊调用失败:" + cause.getMessage());
|
|
||||||
} finally {
|
|
||||||
if (currentChatFuture == future) {
|
|
||||||
currentChatFuture = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/llm/chat/stop")
|
|
||||||
@ApiOperation("停止闲聊组件和TTS")
|
|
||||||
public AjaxResult stopChat() {
|
|
||||||
stopCurrentChatFuture(true);
|
|
||||||
return AjaxResult.ok("ok");
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/testrun")
|
@GetMapping("/testrun")
|
||||||
@ApiOperation("测试接口")
|
@ApiOperation("测试接口")
|
||||||
public AjaxResult testrun(@RequestParam("imageUrl") String imageUrl,
|
public AjaxResult testrun(@RequestParam("imageUrl") String imageUrl,
|
||||||
@ -455,27 +251,6 @@ public class TeFlowController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopCurrentChatFuture(boolean stopTts) {
|
|
||||||
Future<String> future = currentChatFuture;
|
|
||||||
if (future != null && !future.isDone()) {
|
|
||||||
future.cancel(true);
|
|
||||||
}
|
|
||||||
currentChatFuture = null;
|
|
||||||
if (stopTts) {
|
|
||||||
stopChatTts();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String stopChatTts() {
|
|
||||||
try (HttpResponse response = HttpRequest.post(chatTtsStopUrl)
|
|
||||||
.timeout(3000)
|
|
||||||
.execute()) {
|
|
||||||
return response.body();
|
|
||||||
} catch (Exception e) {
|
|
||||||
return "调用闲聊TTS停止接口失败:" + e.getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用本地 TTS 停止接口。
|
* 调用本地 TTS 停止接口。
|
||||||
*/
|
*/
|
||||||
@ -495,8 +270,6 @@ public class TeFlowController extends BaseController {
|
|||||||
@PreDestroy
|
@PreDestroy
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
stopCurrentAiAgentFuture(true);
|
stopCurrentAiAgentFuture(true);
|
||||||
stopCurrentChatFuture(true);
|
|
||||||
aiAgentExecutor.shutdownNow();
|
aiAgentExecutor.shutdownNow();
|
||||||
chatExecutor.shutdownNow();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,6 @@ import com.google.gson.JsonObject;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@ -51,9 +50,8 @@ public class TeFlowiseController extends BaseController {
|
|||||||
.put("test", request.getQuestion());
|
.put("test", request.getQuestion());
|
||||||
runParams.put("5bb26d52e1861c6936f3c3149eaf17e8", runParams1);
|
runParams.put("5bb26d52e1861c6936f3c3149eaf17e8", runParams1);
|
||||||
TeTaskExecuteNormalVO taskExecuteNormalVO = TeTaskExecuteNormalVO.builder()
|
TeTaskExecuteNormalVO taskExecuteNormalVO = TeTaskExecuteNormalVO.builder()
|
||||||
.taskId(StringUtils.defaultIfBlank(request.getTaskId(), "b6ab5ffff783d9b25d0dc34f13be222d"))
|
.taskId("b6ab5ffff783d9b25d0dc34f13be222d")
|
||||||
.robotId(StringUtils.defaultIfBlank(request.getRobotId(), "4ed1246c465b97975f96c9ef8371a3bd"))
|
.terminalId("4ed1246c465b97975f96c9ef8371a3bd")
|
||||||
.runtimeAssignments(request.getRuntimeAssignments())
|
|
||||||
.runParams(JSONObject.from(runParams)).build();
|
.runParams(JSONObject.from(runParams)).build();
|
||||||
if (!taskInstIdList.isEmpty()) {
|
if (!taskInstIdList.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -48,14 +48,6 @@ public class TeTaskConfigInfoController extends BaseController {
|
|||||||
return toAjax(teTaskConfigInfoService.insertTeTaskConfigInfo(teTaskConfigInfo));
|
return toAjax(teTaskConfigInfoService.insertTeTaskConfigInfo(teTaskConfigInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("复制任务配置")
|
|
||||||
@PreAuthorize("@ss.hasPermi('test:config:add')")
|
|
||||||
@Log(title = "任务配置", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping("/copy/{id}")
|
|
||||||
public AjaxResult copy(@PathVariable String id) {
|
|
||||||
return success(teTaskConfigInfoService.copyTeTaskConfigInfo(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("修改任务配置信息")
|
@ApiOperation("修改任务配置信息")
|
||||||
@PreAuthorize("@ss.hasPermi('test:config:edit')")
|
@PreAuthorize("@ss.hasPermi('test:config:edit')")
|
||||||
@Log(title = "任务配置信息", businessType = BusinessType.UPDATE)
|
@Log(title = "任务配置信息", businessType = BusinessType.UPDATE)
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import com.cmvr.test.model.domain.TeNodeInst;
|
|||||||
import com.cmvr.test.model.vo.TeQueryTaskInstVO;
|
import com.cmvr.test.model.vo.TeQueryTaskInstVO;
|
||||||
import com.cmvr.test.model.vo.TeTaskInstVO;
|
import com.cmvr.test.model.vo.TeTaskInstVO;
|
||||||
import com.cmvr.test.service.ITeTaskInstService;
|
import com.cmvr.test.service.ITeTaskInstService;
|
||||||
import com.cmvr.test.flow.runtime.engine.FlowTaskRuntimeService;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -15,9 +14,6 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -28,7 +24,6 @@ import java.util.List;
|
|||||||
public class TeTaskInstController extends BaseController {
|
public class TeTaskInstController extends BaseController {
|
||||||
|
|
||||||
private final ITeTaskInstService teTaskInstService;
|
private final ITeTaskInstService teTaskInstService;
|
||||||
private final FlowTaskRuntimeService flowTaskRuntimeService;
|
|
||||||
|
|
||||||
@ApiOperation("查询任务实例列表")
|
@ApiOperation("查询任务实例列表")
|
||||||
@PreAuthorize("@ss.hasPermi('test:inst:list')")
|
@PreAuthorize("@ss.hasPermi('test:inst:list')")
|
||||||
@ -47,11 +42,4 @@ public class TeTaskInstController extends BaseController {
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("再次执行已完成或失败的任务实例")
|
|
||||||
@PreAuthorize("@ss.hasPermi('test:config:execute')")
|
|
||||||
@PostMapping("/rerun/{id}")
|
|
||||||
public AjaxResult rerun(@PathVariable("id") String id) {
|
|
||||||
return success(flowTaskRuntimeService.rerunTask(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -14,8 +14,8 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Api(tags = "测试--任务编排")
|
@Api(tags = "测试--任务编排")
|
||||||
@ -33,6 +33,7 @@ class TeTaskOrchestrationController extends BaseController {
|
|||||||
@NotEmpty(message = "任务ID不能为空")
|
@NotEmpty(message = "任务ID不能为空")
|
||||||
@RequestParam("taskId") String taskId
|
@RequestParam("taskId") String taskId
|
||||||
) {
|
) {
|
||||||
|
startPage();
|
||||||
List<TeQueryTaskOrchestraItemVO> list = teTaskOrchestrationService.queryByTaskId(taskId);
|
List<TeQueryTaskOrchestraItemVO> list = teTaskOrchestrationService.queryByTaskId(taskId);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,133 +0,0 @@
|
|||||||
package com.cmvr.web.controller.test;
|
|
||||||
|
|
||||||
import com.cmvr.common.core.controller.BaseController;
|
|
||||||
import com.cmvr.common.core.domain.AjaxResult;
|
|
||||||
import com.cmvr.test.vision.domain.VisionCalibrationProfile;
|
|
||||||
import com.cmvr.test.vision.model.VisionCalibrationRequests;
|
|
||||||
import com.cmvr.test.vision.service.VisionCalibrationProfileService;
|
|
||||||
import com.cmvr.test.vision.service.VisionCalibrationRecordService;
|
|
||||||
import com.cmvr.test.vision.service.VisionCalibrationSessionService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@Api(tags = "视觉标定管理")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/vision/calibration")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class VisionCalibrationController extends BaseController {
|
|
||||||
private final VisionCalibrationProfileService profileService;
|
|
||||||
private final VisionCalibrationRecordService recordService;
|
|
||||||
private final VisionCalibrationSessionService sessionService;
|
|
||||||
|
|
||||||
@ApiOperation("查询标定方案")
|
|
||||||
@GetMapping("/profiles")
|
|
||||||
public AjaxResult profiles(@RequestParam(required = false) String profileType,
|
|
||||||
@RequestParam(required = false) String robotId,
|
|
||||||
@RequestParam(required = false) String keyword) {
|
|
||||||
return AjaxResult.ok(profileService.list(profileType, robotId, keyword));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("查询标定方案详情")
|
|
||||||
@GetMapping("/profiles/{id}")
|
|
||||||
public AjaxResult profile(@PathVariable String id) {
|
|
||||||
return AjaxResult.ok(profileService.require(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取当前启用的手眼标定")
|
|
||||||
@GetMapping("/profiles/active/hand-eye")
|
|
||||||
public AjaxResult activeHandEye(String robotId, String armDeviceId, String cameraDeviceId) {
|
|
||||||
return AjaxResult.ok(profileService.activeHandEye(robotId, armDeviceId, cameraDeviceId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取当前启用的工具TCP")
|
|
||||||
@GetMapping("/profiles/active/tool")
|
|
||||||
public AjaxResult activeTool(String robotId, String armDeviceId, String toolCode) {
|
|
||||||
return AjaxResult.ok(profileService.activeTool(robotId, armDeviceId, toolCode));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("保存六自由度人工修正")
|
|
||||||
@PutMapping("/profiles/{id}/correction")
|
|
||||||
public AjaxResult correction(@PathVariable String id,
|
|
||||||
@RequestBody VisionCalibrationRequests.Correction request) {
|
|
||||||
return AjaxResult.ok(profileService.updateCorrection(id, request, getUsername()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("启用已验证方案")
|
|
||||||
@PutMapping("/profiles/{id}/activate")
|
|
||||||
public AjaxResult activate(@PathVariable String id,
|
|
||||||
@RequestBody(required = false) VisionCalibrationRequests.Activate request) {
|
|
||||||
boolean forced = request != null && Boolean.TRUE.equals(request.getForced());
|
|
||||||
return AjaxResult.ok(profileService.activate(id, forced, getUsername()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("将方案标记为失效")
|
|
||||||
@DeleteMapping("/profiles/{id}")
|
|
||||||
public AjaxResult invalidate(@PathVariable String id) {
|
|
||||||
profileService.invalidate(id, getUsername());
|
|
||||||
return AjaxResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("查询标定执行记录")
|
|
||||||
@GetMapping("/records")
|
|
||||||
public AjaxResult records() {
|
|
||||||
return AjaxResult.ok(recordService.list());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("开始全自动手眼标定")
|
|
||||||
@PostMapping("/sessions/hand-eye")
|
|
||||||
public AjaxResult startHandEye(@RequestBody VisionCalibrationRequests.HandEyeStart request) {
|
|
||||||
return AjaxResult.ok(sessionService.startHandEye(request, getUsername()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("开始工具TCP标定")
|
|
||||||
@PostMapping("/sessions/tool")
|
|
||||||
public AjaxResult startTool(@RequestBody VisionCalibrationRequests.ToolStart request) {
|
|
||||||
return AjaxResult.ok(sessionService.startTool(request, getUsername()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("记录工具定点旋转姿态")
|
|
||||||
@PostMapping("/sessions/{id}/tool/pivot")
|
|
||||||
public AjaxResult recordToolPivot(@PathVariable String id) {
|
|
||||||
return AjaxResult.ok(sessionService.recordToolPivot(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("记录工具安全方向并完成求解")
|
|
||||||
@PostMapping("/sessions/{id}/tool/direction")
|
|
||||||
public AjaxResult finishTool(@PathVariable String id) {
|
|
||||||
return AjaxResult.ok(sessionService.recordToolDirectionAndFinish(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("开始人工修正后的快速验证")
|
|
||||||
@PostMapping("/profiles/{id}/verify")
|
|
||||||
public AjaxResult verify(@PathVariable String id) {
|
|
||||||
return AjaxResult.ok(sessionService.startVerification(id, getUsername()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("标定会话心跳")
|
|
||||||
@PostMapping("/sessions/{id}/heartbeat")
|
|
||||||
public AjaxResult heartbeat(@PathVariable String id) {
|
|
||||||
return AjaxResult.ok(sessionService.heartbeat(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("查询标定会话")
|
|
||||||
@GetMapping("/sessions/{id}")
|
|
||||||
public AjaxResult session(@PathVariable String id) {
|
|
||||||
return AjaxResult.ok(sessionService.status(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("停止标定会话并停止机械臂")
|
|
||||||
@PostMapping("/sessions/{id}/stop")
|
|
||||||
public AjaxResult stop(@PathVariable String id) {
|
|
||||||
return AjaxResult.ok(sessionService.stop(id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -73,12 +73,6 @@ public class TiProjectController extends BaseController {
|
|||||||
return AjaxResult.ok(tiProjectService.queryExecuteRunParams(projectId));
|
return AjaxResult.ok(tiProjectService.queryExecuteRunParams(projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("检查触控项目、录像和工作流是否具备执行条件")
|
|
||||||
@GetMapping("/readiness/{projectId}")
|
|
||||||
public AjaxResult readiness(@PathVariable("projectId") String projectId) {
|
|
||||||
return AjaxResult.ok(tiProjectService.checkExecutionReadiness(projectId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("执行项目")
|
@ApiOperation("执行项目")
|
||||||
@PostMapping("/execute")
|
@PostMapping("/execute")
|
||||||
public AjaxResult execute(@RequestBody TeTaskExecuteProjectVO taskExecuteProjectVO) {
|
public AjaxResult execute(@RequestBody TeTaskExecuteProjectVO taskExecuteProjectVO) {
|
||||||
@ -91,10 +85,16 @@ public class TiProjectController extends BaseController {
|
|||||||
return AjaxResult.ok(tiProjectService.queryExecuteInstId(projectId));
|
return AjaxResult.ok(tiProjectService.queryExecuteInstId(projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("临时执行项目评估")
|
||||||
|
@PostMapping("/evaluation")
|
||||||
|
public AjaxResult evaluation(@RequestBody List<Long> funcIds) {
|
||||||
|
tiProjectService.executeTiEvaluation(funcIds);
|
||||||
|
return AjaxResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("评估查询")
|
@ApiOperation("评估查询")
|
||||||
@GetMapping("/evaluation/{projectId}")
|
@GetMapping("/evaluation/{projectId}")
|
||||||
public AjaxResult queryEvaluation(@PathVariable("projectId") String projectId,
|
public AjaxResult queryEvaluation(@PathVariable("projectId") String projectId) {
|
||||||
@RequestParam(value = "instId", required = false) String instId) {
|
return AjaxResult.ok(tiProjectService.queryEvaluation(projectId));
|
||||||
return AjaxResult.ok(tiProjectService.queryEvaluation(projectId, instId));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -79,11 +78,4 @@ public class TiVehicleUiController extends BaseController {
|
|||||||
public AjaxResult findNextClickToFunction(Long vehicleConfigId, String currentUi, String clickFunction) {
|
public AjaxResult findNextClickToFunction(Long vehicleConfigId, String currentUi, String clickFunction) {
|
||||||
return AjaxResult.success(exTiVehicleFunctionService.findNextClickToFunction(vehicleConfigId, currentUi, clickFunction));
|
return AjaxResult.success(exTiVehicleFunctionService.findNextClickToFunction(vehicleConfigId, currentUi, clickFunction));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询界面路径拓扑")
|
|
||||||
@PreAuthorize("@ss.hasPermi('ti:ui:list')")
|
|
||||||
@GetMapping("/topology")
|
|
||||||
public AjaxResult topology(@RequestParam Long vehicleConfigId) {
|
|
||||||
return AjaxResult.success(exTiVehicleFunctionService.getTopology(vehicleConfigId));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,219 +0,0 @@
|
|||||||
package com.cmvr.web.core.config;
|
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import io.swagger.v3.core.converter.AnnotatedType;
|
|
||||||
import io.swagger.v3.oas.models.Components;
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
|
||||||
import io.swagger.v3.oas.models.Operation;
|
|
||||||
import io.swagger.v3.oas.models.info.Info;
|
|
||||||
import io.swagger.v3.oas.models.media.Schema;
|
|
||||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
|
||||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
|
||||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
|
||||||
import java.lang.annotation.Annotation;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.springdoc.core.models.GroupedOpenApi;
|
|
||||||
import org.springdoc.core.customizers.OpenApiCustomizer;
|
|
||||||
import org.springdoc.core.customizers.OperationCustomizer;
|
|
||||||
import org.springdoc.core.customizers.PropertyCustomizer;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.core.MethodParameter;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.method.HandlerMethod;
|
|
||||||
|
|
||||||
/** OpenAPI metadata, authorization and business-domain groups. */
|
|
||||||
@Configuration
|
|
||||||
public class OpenApiConfig
|
|
||||||
{
|
|
||||||
private static final String AUTHORIZATION = "Authorization";
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public OpenAPI cmvrOpenApi()
|
|
||||||
{
|
|
||||||
SecurityScheme bearerAuth = new SecurityScheme()
|
|
||||||
.type(SecurityScheme.Type.HTTP)
|
|
||||||
.scheme("bearer")
|
|
||||||
.bearerFormat("JWT");
|
|
||||||
return new OpenAPI()
|
|
||||||
.info(new Info()
|
|
||||||
.title("CMVR IoT API")
|
|
||||||
.description("招商车研物联网平台接口文档")
|
|
||||||
.version("1.0.0"))
|
|
||||||
.components(new Components().addSecuritySchemes(AUTHORIZATION, bearerAuth))
|
|
||||||
.addSecurityItem(new SecurityRequirement().addList(AUTHORIZATION));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public GroupedOpenApi allApi()
|
|
||||||
{
|
|
||||||
return group("00-all", "全部接口", "/**");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public GroupedOpenApi resourceCenterApi()
|
|
||||||
{
|
|
||||||
return GroupedOpenApi.builder()
|
|
||||||
.group("10-resource-center")
|
|
||||||
.displayName("资源中心")
|
|
||||||
.pathsToMatch("/resource/**")
|
|
||||||
.addOperationCustomizer(legacySwaggerOperationCustomizer())
|
|
||||||
.addOpenApiCustomizer(legacyTagOrderCustomizer())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private GroupedOpenApi group(String id, String displayName, String... paths)
|
|
||||||
{
|
|
||||||
return GroupedOpenApi.builder()
|
|
||||||
.group(id)
|
|
||||||
.displayName(displayName)
|
|
||||||
.pathsToMatch(paths)
|
|
||||||
// Keep the same visibility rule as the legacy Swagger Docket.
|
|
||||||
.addOpenApiMethodFilter(method -> method.isAnnotationPresent(ApiOperation.class))
|
|
||||||
.addOperationCustomizer(legacySwaggerOperationCustomizer())
|
|
||||||
.addOpenApiCustomizer(legacyTagOrderCustomizer())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private OpenApiCustomizer legacyTagOrderCustomizer()
|
|
||||||
{
|
|
||||||
return openApi -> {
|
|
||||||
Set<String> tagNames = new TreeSet<>();
|
|
||||||
if (openApi.getPaths() != null)
|
|
||||||
{
|
|
||||||
openApi.getPaths().values().forEach(pathItem -> pathItem.readOperations().forEach(operation -> {
|
|
||||||
if (operation.getTags() != null)
|
|
||||||
{
|
|
||||||
tagNames.addAll(operation.getTags());
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
openApi.setTags(tagNames.stream()
|
|
||||||
.map(name -> new io.swagger.v3.oas.models.tags.Tag().name(name))
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public OperationCustomizer legacySwaggerOperationCustomizer()
|
|
||||||
{
|
|
||||||
return this::customizeLegacyOperation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public PropertyCustomizer legacySwaggerPropertyCustomizer()
|
|
||||||
{
|
|
||||||
return (schema, annotatedType) -> {
|
|
||||||
ApiModelProperty property = findAnnotation(annotatedType, ApiModelProperty.class);
|
|
||||||
if (property != null)
|
|
||||||
{
|
|
||||||
if (StringUtils.hasText(property.value()))
|
|
||||||
{
|
|
||||||
schema.setDescription(property.value());
|
|
||||||
}
|
|
||||||
if (StringUtils.hasText(property.example()))
|
|
||||||
{
|
|
||||||
schema.setExample(property.example());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return schema;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private Operation customizeLegacyOperation(Operation operation, HandlerMethod handlerMethod)
|
|
||||||
{
|
|
||||||
Api api = handlerMethod.getBeanType().getAnnotation(Api.class);
|
|
||||||
if (api != null)
|
|
||||||
{
|
|
||||||
List<String> tags = Arrays.stream(api.tags())
|
|
||||||
.filter(StringUtils::hasText)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (tags.isEmpty() && StringUtils.hasText(api.value()))
|
|
||||||
{
|
|
||||||
tags.add(api.value());
|
|
||||||
}
|
|
||||||
if (!tags.isEmpty())
|
|
||||||
{
|
|
||||||
operation.setTags(tags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ApiOperation apiOperation = handlerMethod.getMethodAnnotation(ApiOperation.class);
|
|
||||||
if (apiOperation != null)
|
|
||||||
{
|
|
||||||
if (StringUtils.hasText(apiOperation.value()))
|
|
||||||
{
|
|
||||||
operation.setSummary(apiOperation.value());
|
|
||||||
}
|
|
||||||
if (StringUtils.hasText(apiOperation.notes()))
|
|
||||||
{
|
|
||||||
operation.setDescription(apiOperation.notes());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
applyLegacyParameterDescriptions(operation, handlerMethod);
|
|
||||||
return operation;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applyLegacyParameterDescriptions(Operation operation, HandlerMethod handlerMethod)
|
|
||||||
{
|
|
||||||
if (operation.getParameters() == null || operation.getParameters().isEmpty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<Parameter> parameters = operation.getParameters();
|
|
||||||
int fallbackIndex = 0;
|
|
||||||
for (MethodParameter methodParameter : handlerMethod.getMethodParameters())
|
|
||||||
{
|
|
||||||
ApiParam apiParam = methodParameter.getParameterAnnotation(ApiParam.class);
|
|
||||||
if (apiParam == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String parameterName = StringUtils.hasText(apiParam.name())
|
|
||||||
? apiParam.name() : methodParameter.getParameterName();
|
|
||||||
Parameter parameter = parameters.stream()
|
|
||||||
.filter(item -> parameterName != null && parameterName.equals(item.getName()))
|
|
||||||
.findFirst()
|
|
||||||
.orElse(fallbackIndex < parameters.size() ? parameters.get(fallbackIndex++) : null);
|
|
||||||
if (parameter != null)
|
|
||||||
{
|
|
||||||
if (StringUtils.hasText(apiParam.value()))
|
|
||||||
{
|
|
||||||
parameter.setDescription(apiParam.value());
|
|
||||||
}
|
|
||||||
if (apiParam.required())
|
|
||||||
{
|
|
||||||
parameter.setRequired(true);
|
|
||||||
}
|
|
||||||
if (StringUtils.hasText(apiParam.example()))
|
|
||||||
{
|
|
||||||
parameter.setExample(apiParam.example());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private <A extends Annotation> A findAnnotation(AnnotatedType annotatedType, Class<A> annotationType)
|
|
||||||
{
|
|
||||||
Annotation[] annotations = annotatedType.getCtxAnnotations();
|
|
||||||
if (annotations == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (Annotation annotation : annotations)
|
|
||||||
{
|
|
||||||
if (annotationType.isInstance(annotation))
|
|
||||||
{
|
|
||||||
return annotationType.cast(annotation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,140 @@
|
|||||||
|
package com.cmvr.web.core.config;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import com.cmvr.common.config.CmvrIotConfig;
|
||||||
|
import com.cmvr.test.model.vo.inspection.InspectionAlarmRuleVO;
|
||||||
|
import com.cmvr.test.model.vo.inspection.InspectionManualReviewConfigVO;
|
||||||
|
import com.cmvr.test.model.vo.inspection.InspectionMediaVO;
|
||||||
|
import com.cmvr.test.model.vo.inspection.InspectionMeterRecognizeConfigVO;
|
||||||
|
import com.fasterxml.classmate.TypeResolver;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
import springfox.documentation.service.ApiInfo;
|
||||||
|
import springfox.documentation.service.ApiKey;
|
||||||
|
import springfox.documentation.service.AuthorizationScope;
|
||||||
|
import springfox.documentation.service.Contact;
|
||||||
|
import springfox.documentation.service.SecurityReference;
|
||||||
|
import springfox.documentation.service.SecurityScheme;
|
||||||
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Swagger2的接口配置
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class SwaggerConfig
|
||||||
|
{
|
||||||
|
/** 系统基础配置 */
|
||||||
|
@Autowired
|
||||||
|
private CmvrIotConfig cmvrIotConfig;
|
||||||
|
|
||||||
|
/** 用于将动态工作流payload对应的参数模型显式加入Swagger文档。 */
|
||||||
|
@Autowired
|
||||||
|
private TypeResolver typeResolver;
|
||||||
|
|
||||||
|
/** 是否开启swagger */
|
||||||
|
@Value("${swagger.enabled}")
|
||||||
|
private boolean enabled;
|
||||||
|
|
||||||
|
/** 设置请求的统一前缀 */
|
||||||
|
@Value("${swagger.pathMapping}")
|
||||||
|
private String pathMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建API
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Docket createRestApi()
|
||||||
|
{
|
||||||
|
return new Docket(DocumentationType.OAS_30)
|
||||||
|
// 是否启用Swagger
|
||||||
|
.enable(enabled)
|
||||||
|
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||||
|
.apiInfo(apiInfo())
|
||||||
|
// 设置哪些接口暴露给Swagger展示
|
||||||
|
.select()
|
||||||
|
// 扫描所有有注解的api,用这种方式更灵活
|
||||||
|
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||||
|
// 扫描指定包中的swagger注解
|
||||||
|
// .apis(RequestHandlerSelectors.basePackage("com.cmvr.project.tool.swagger"))
|
||||||
|
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||||
|
.paths(PathSelectors.any())
|
||||||
|
.build()
|
||||||
|
// 工作流单节点接口使用JSONObject作为payload,需显式注册巡检节点参数模型。
|
||||||
|
.additionalModels(
|
||||||
|
typeResolver.resolve(InspectionMeterRecognizeConfigVO.class),
|
||||||
|
typeResolver.resolve(InspectionAlarmRuleVO.class),
|
||||||
|
typeResolver.resolve(InspectionManualReviewConfigVO.class),
|
||||||
|
typeResolver.resolve(InspectionMediaVO.class))
|
||||||
|
/* 设置安全模式,swagger可以设置访问token */
|
||||||
|
.securitySchemes(securitySchemes())
|
||||||
|
.securityContexts(securityContexts())
|
||||||
|
.pathMapping(pathMapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||||
|
*/
|
||||||
|
private List<SecurityScheme> securitySchemes()
|
||||||
|
{
|
||||||
|
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||||
|
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
||||||
|
return apiKeyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全上下文
|
||||||
|
*/
|
||||||
|
private List<SecurityContext> securityContexts()
|
||||||
|
{
|
||||||
|
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||||
|
securityContexts.add(
|
||||||
|
SecurityContext.builder()
|
||||||
|
.securityReferences(defaultAuth())
|
||||||
|
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||||
|
.build());
|
||||||
|
return securityContexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认的安全上引用
|
||||||
|
*/
|
||||||
|
private List<SecurityReference> defaultAuth()
|
||||||
|
{
|
||||||
|
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||||
|
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||||
|
authorizationScopes[0] = authorizationScope;
|
||||||
|
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||||
|
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||||
|
return securityReferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加摘要信息
|
||||||
|
*/
|
||||||
|
private ApiInfo apiInfo()
|
||||||
|
{
|
||||||
|
// 用ApiInfoBuilder进行定制
|
||||||
|
return new ApiInfoBuilder()
|
||||||
|
// 设置标题
|
||||||
|
.title("标题:招商车研物联网平台管理系统_接口文档")
|
||||||
|
// 描述
|
||||||
|
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||||
|
// 作者信息
|
||||||
|
.contact(new Contact(cmvrIotConfig.getName(), null, null))
|
||||||
|
// 版本
|
||||||
|
.version("版本号:" + cmvrIotConfig.getVersion())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,38 +0,0 @@
|
|||||||
package com.cmvr.web.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class CameraStreamTicketService {
|
|
||||||
|
|
||||||
private static final long TICKET_LIFETIME_MILLIS = Duration.ofSeconds(30).toMillis();
|
|
||||||
private final Map<String, StreamTarget> tickets = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
public String issue(String robotId, String deviceId) {
|
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
tickets.entrySet().removeIf(entry -> entry.getValue().expiresAt() < now);
|
|
||||||
String ticket = UUID.randomUUID().toString().replace("-", "");
|
|
||||||
tickets.put(ticket, new StreamTarget(robotId, deviceId, now + TICKET_LIFETIME_MILLIS));
|
|
||||||
return ticket;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StreamTarget consume(String ticket) {
|
|
||||||
if (ticket == null || ticket.isBlank()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
StreamTarget target = tickets.get(ticket);
|
|
||||||
if (target == null || target.expiresAt() < System.currentTimeMillis()) {
|
|
||||||
tickets.remove(ticket);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
public record StreamTarget(String robotId, String deviceId, long expiresAt) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,148 +0,0 @@
|
|||||||
server:
|
|
||||||
# 服务器的HTTP端口,默认为8080
|
|
||||||
port: 14080
|
|
||||||
# 数据源配置
|
|
||||||
spring:
|
|
||||||
datasource:
|
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
|
||||||
druid:
|
|
||||||
# 主库数据源
|
|
||||||
master:
|
|
||||||
url: jdbc:mysql://192.168.28.10:3306/${CMVR_DB_NAME:aima}?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
|
||||||
username: root
|
|
||||||
password: cmvr2468
|
|
||||||
# 从库数据源
|
|
||||||
slave:
|
|
||||||
# 从数据源开关/默认关闭
|
|
||||||
enabled: false
|
|
||||||
url:
|
|
||||||
username:
|
|
||||||
password:
|
|
||||||
# 初始连接数
|
|
||||||
initialSize: 5
|
|
||||||
# 最小连接池数量
|
|
||||||
minIdle: 10
|
|
||||||
# 最大连接池数量
|
|
||||||
maxActive: 20
|
|
||||||
# 配置获取连接等待超时的时间
|
|
||||||
maxWait: 60000
|
|
||||||
# 配置连接超时时间
|
|
||||||
connectTimeout: 30000
|
|
||||||
# 配置网络超时时间
|
|
||||||
socketTimeout: 60000
|
|
||||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
|
||||||
timeBetweenEvictionRunsMillis: 60000
|
|
||||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
|
||||||
minEvictableIdleTimeMillis: 300000
|
|
||||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
|
||||||
maxEvictableIdleTimeMillis: 900000
|
|
||||||
# 配置检测连接是否有效
|
|
||||||
validationQuery: SELECT 1 FROM DUAL
|
|
||||||
testWhileIdle: true
|
|
||||||
testOnBorrow: false
|
|
||||||
testOnReturn: false
|
|
||||||
webStatFilter:
|
|
||||||
enabled: true
|
|
||||||
statViewServlet:
|
|
||||||
enabled: true
|
|
||||||
# 设置白名单,不填则允许所有访问
|
|
||||||
allow:
|
|
||||||
url-pattern: /druid/*
|
|
||||||
# 控制台管理用户名和密码
|
|
||||||
login-username: cmvr-iot
|
|
||||||
login-password: 123456
|
|
||||||
filter:
|
|
||||||
stat:
|
|
||||||
enabled: true
|
|
||||||
# 慢SQL记录
|
|
||||||
log-slow-sql: true
|
|
||||||
slow-sql-millis: 1000
|
|
||||||
merge-sql: true
|
|
||||||
wall:
|
|
||||||
config:
|
|
||||||
multi-statement-allow: true
|
|
||||||
# 服务模块
|
|
||||||
devtools:
|
|
||||||
restart:
|
|
||||||
# 热部署开关
|
|
||||||
enabled: true
|
|
||||||
# redis 配置
|
|
||||||
data.redis:
|
|
||||||
# 地址
|
|
||||||
host: 192.168.28.10
|
|
||||||
# 端口,默认为6379
|
|
||||||
port: 6379
|
|
||||||
# 数据库索引
|
|
||||||
database: ${CMVR_REDIS_DATABASE:12}
|
|
||||||
# 密码
|
|
||||||
password: cmvr2468
|
|
||||||
# 连接超时时间
|
|
||||||
timeout: 10s
|
|
||||||
lettuce:
|
|
||||||
pool:
|
|
||||||
# 连接池:中的最小空闲连接
|
|
||||||
min-idle: 0
|
|
||||||
# 连接池中的最大空闲连接
|
|
||||||
max-idle: 8
|
|
||||||
# 连接池的最大数据库连接数
|
|
||||||
max-active: 8
|
|
||||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
|
||||||
max-wait: -1ms
|
|
||||||
|
|
||||||
# Minio配置
|
|
||||||
minio:
|
|
||||||
url: http://192.168.28.10:9000
|
|
||||||
accessKey: AKICMVR
|
|
||||||
secretKey: wJalrXUtnFEMI
|
|
||||||
bucketName: cmvr-iot
|
|
||||||
|
|
||||||
# gRPC 客户端设置
|
|
||||||
grpc:
|
|
||||||
client:
|
|
||||||
grpc-server: # 自定义服务名
|
|
||||||
address: 'static://10.148.108.100:50051' # 调用 gRPC 的地址
|
|
||||||
# address: 'static://10.148.108.100:50051' # 调用 gRPC 的地址
|
|
||||||
enableKeepAlive: true
|
|
||||||
keepAliveWithoutCalls: true
|
|
||||||
negotiationType: plaintext # 明文传输
|
|
||||||
|
|
||||||
api:
|
|
||||||
app-id: d0epfibvo3em6c4iul40
|
|
||||||
app-key: d0eqt1kqek3vg7g4ofi0
|
|
||||||
work-flow-url: https://aiagentplatform.cmft.com/api/proxy/api/v1/run_app_workflow
|
|
||||||
query-result-url: https://aiagentplatform.cmft.com/api/proxy/api/v1/query_run_app_process
|
|
||||||
bge-vl: http://192.168.1.8:5000/search_similar
|
|
||||||
generate_advanced_audio: http://192.168.0.102:9003/generate_advanced_audio
|
|
||||||
# 智能体应用id和秘钥
|
|
||||||
# ActionEnum 的枚举作为 key
|
|
||||||
agents:
|
|
||||||
INTENT_RECOGNITION: # 意图识别
|
|
||||||
app-id: d5dn5ibp9adhq1b34lig
|
|
||||||
app-key: d6j5bcellh49on5tasvg
|
|
||||||
TI_TOUCH_COORDINATES: # 获取触控二维坐标
|
|
||||||
app-id: d1ebtabnjkflk4gmhikg
|
|
||||||
app-key: d5thge2cktmipk78h82g
|
|
||||||
evaluation: http://192.168.0.8:8000/analyze
|
|
||||||
current-page: http://192.168.0.222:5000/search_similar
|
|
||||||
|
|
||||||
flowise:
|
|
||||||
tts: 192.168.0.222:8080/tts/
|
|
||||||
start: http://192.168.0.108:3000/api/v1/prediction/f99329e9-b33d-437d-90ed-69eaa8a05418
|
|
||||||
abort: http://192.168.0.108:3000/api/v1/chatmessage/abort/f99329e9-b33d-437d-90ed-69eaa8a05418/
|
|
||||||
query: http://192.168.0.108:3000/api/v1/executions/
|
|
||||||
api-key: pg61JW6W_GXyqmqSoURJ4mlSRrCMRzGLBJli_w3BFkg
|
|
||||||
|
|
||||||
media-analysis:
|
|
||||||
base-url: ${MEDIA_ANALYSIS_BASE_URL:http://192.168.28.10:14080}
|
|
||||||
api-key: ${MEDIA_ANALYSIS_API_KEY:cmvr-analysis-2026-c65ec181d5ab4a49aef34e6fd1be6704}
|
|
||||||
connect-timeout-ms: 5000
|
|
||||||
read-timeout-ms: 600000
|
|
||||||
|
|
||||||
# Isolate the resource-center development instance from the currently running robot gateway.
|
|
||||||
#cmvr:
|
|
||||||
# resource:
|
|
||||||
# robot-state:
|
|
||||||
# enabled: false
|
|
||||||
# quic:
|
|
||||||
# enabled: false
|
|
||||||
@ -1,148 +0,0 @@
|
|||||||
server:
|
|
||||||
# 服务器的HTTP端口,默认为8080
|
|
||||||
port: 14080
|
|
||||||
# 数据源配置
|
|
||||||
spring:
|
|
||||||
datasource:
|
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
|
||||||
druid:
|
|
||||||
# 主库数据源
|
|
||||||
master:
|
|
||||||
url: jdbc:mysql://192.168.28.10:3306/${CMVR_DB_NAME:changan}?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
|
||||||
username: root
|
|
||||||
password: cmvr2468
|
|
||||||
# 从库数据源
|
|
||||||
slave:
|
|
||||||
# 从数据源开关/默认关闭
|
|
||||||
enabled: false
|
|
||||||
url:
|
|
||||||
username:
|
|
||||||
password:
|
|
||||||
# 初始连接数
|
|
||||||
initialSize: 5
|
|
||||||
# 最小连接池数量
|
|
||||||
minIdle: 10
|
|
||||||
# 最大连接池数量
|
|
||||||
maxActive: 20
|
|
||||||
# 配置获取连接等待超时的时间
|
|
||||||
maxWait: 60000
|
|
||||||
# 配置连接超时时间
|
|
||||||
connectTimeout: 30000
|
|
||||||
# 配置网络超时时间
|
|
||||||
socketTimeout: 60000
|
|
||||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
|
||||||
timeBetweenEvictionRunsMillis: 60000
|
|
||||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
|
||||||
minEvictableIdleTimeMillis: 300000
|
|
||||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
|
||||||
maxEvictableIdleTimeMillis: 900000
|
|
||||||
# 配置检测连接是否有效
|
|
||||||
validationQuery: SELECT 1 FROM DUAL
|
|
||||||
testWhileIdle: true
|
|
||||||
testOnBorrow: false
|
|
||||||
testOnReturn: false
|
|
||||||
webStatFilter:
|
|
||||||
enabled: true
|
|
||||||
statViewServlet:
|
|
||||||
enabled: true
|
|
||||||
# 设置白名单,不填则允许所有访问
|
|
||||||
allow:
|
|
||||||
url-pattern: /druid/*
|
|
||||||
# 控制台管理用户名和密码
|
|
||||||
login-username: cmvr-iot
|
|
||||||
login-password: 123456
|
|
||||||
filter:
|
|
||||||
stat:
|
|
||||||
enabled: true
|
|
||||||
# 慢SQL记录
|
|
||||||
log-slow-sql: true
|
|
||||||
slow-sql-millis: 1000
|
|
||||||
merge-sql: true
|
|
||||||
wall:
|
|
||||||
config:
|
|
||||||
multi-statement-allow: true
|
|
||||||
# 服务模块
|
|
||||||
devtools:
|
|
||||||
restart:
|
|
||||||
# 热部署开关
|
|
||||||
enabled: true
|
|
||||||
# redis 配置
|
|
||||||
data.redis:
|
|
||||||
# 地址
|
|
||||||
host: 192.168.28.10
|
|
||||||
# 端口,默认为6379
|
|
||||||
port: 6379
|
|
||||||
# 数据库索引
|
|
||||||
database: ${CMVR_REDIS_DATABASE:11}
|
|
||||||
# 密码
|
|
||||||
password: cmvr2468
|
|
||||||
# 连接超时时间
|
|
||||||
timeout: 10s
|
|
||||||
lettuce:
|
|
||||||
pool:
|
|
||||||
# 连接池:中的最小空闲连接
|
|
||||||
min-idle: 0
|
|
||||||
# 连接池中的最大空闲连接
|
|
||||||
max-idle: 8
|
|
||||||
# 连接池的最大数据库连接数
|
|
||||||
max-active: 8
|
|
||||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
|
||||||
max-wait: -1ms
|
|
||||||
|
|
||||||
# Minio配置
|
|
||||||
minio:
|
|
||||||
url: http://192.168.28.10:9000
|
|
||||||
accessKey: AKICMVR
|
|
||||||
secretKey: wJalrXUtnFEMI
|
|
||||||
bucketName: cmvr-iot
|
|
||||||
|
|
||||||
# gRPC 客户端设置
|
|
||||||
grpc:
|
|
||||||
client:
|
|
||||||
grpc-server: # 自定义服务名
|
|
||||||
address: 'static://10.148.108.100:50051' # 调用 gRPC 的地址
|
|
||||||
# address: 'static://10.148.108.100:50051' # 调用 gRPC 的地址
|
|
||||||
enableKeepAlive: true
|
|
||||||
keepAliveWithoutCalls: true
|
|
||||||
negotiationType: plaintext # 明文传输
|
|
||||||
|
|
||||||
api:
|
|
||||||
app-id: d0epfibvo3em6c4iul40
|
|
||||||
app-key: d0eqt1kqek3vg7g4ofi0
|
|
||||||
work-flow-url: https://aiagentplatform.cmft.com/api/proxy/api/v1/run_app_workflow
|
|
||||||
query-result-url: https://aiagentplatform.cmft.com/api/proxy/api/v1/query_run_app_process
|
|
||||||
bge-vl: http://192.168.1.8:5000/search_similar
|
|
||||||
generate_advanced_audio: http://192.168.0.102:9003/generate_advanced_audio
|
|
||||||
# 智能体应用id和秘钥
|
|
||||||
# ActionEnum 的枚举作为 key
|
|
||||||
agents:
|
|
||||||
INTENT_RECOGNITION: # 意图识别
|
|
||||||
app-id: d5dn5ibp9adhq1b34lig
|
|
||||||
app-key: d6j5bcellh49on5tasvg
|
|
||||||
TI_TOUCH_COORDINATES: # 获取触控二维坐标
|
|
||||||
app-id: d1ebtabnjkflk4gmhikg
|
|
||||||
app-key: d5thge2cktmipk78h82g
|
|
||||||
evaluation: http://192.168.0.8:8000/analyze
|
|
||||||
current-page: http://192.168.0.222:5000/search_similar
|
|
||||||
|
|
||||||
flowise:
|
|
||||||
tts: 192.168.0.222:8080/tts/
|
|
||||||
start: http://192.168.0.108:3000/api/v1/prediction/f99329e9-b33d-437d-90ed-69eaa8a05418
|
|
||||||
abort: http://192.168.0.108:3000/api/v1/chatmessage/abort/f99329e9-b33d-437d-90ed-69eaa8a05418/
|
|
||||||
query: http://192.168.0.108:3000/api/v1/executions/
|
|
||||||
api-key: pg61JW6W_GXyqmqSoURJ4mlSRrCMRzGLBJli_w3BFkg
|
|
||||||
|
|
||||||
media-analysis:
|
|
||||||
base-url: ${MEDIA_ANALYSIS_BASE_URL:http://192.168.28.10:14080}
|
|
||||||
api-key: ${MEDIA_ANALYSIS_API_KEY:cmvr-analysis-2026-c65ec181d5ab4a49aef34e6fd1be6704}
|
|
||||||
connect-timeout-ms: 5000
|
|
||||||
read-timeout-ms: 600000
|
|
||||||
|
|
||||||
# Isolate the resource-center development instance from the currently running robot gateway.
|
|
||||||
#cmvr:
|
|
||||||
# resource:
|
|
||||||
# robot-state:
|
|
||||||
# enabled: true
|
|
||||||
# quic:
|
|
||||||
# enabled: true
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
server:
|
server:
|
||||||
# 服务器的HTTP端口,默认为8080
|
# 服务器的HTTP端口,默认为8080
|
||||||
port: 14080
|
port: 13080
|
||||||
# 数据源配置
|
# 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
@ -9,7 +9,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://192.168.28.10:3306/${CMVR_DB_NAME:cmvr-iot-resource-dev}?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://192.168.28.10:3306/cmvr-iot-dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: cmvr2468
|
password: cmvr2468
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
@ -68,13 +68,13 @@ spring:
|
|||||||
# 热部署开关
|
# 热部署开关
|
||||||
enabled: true
|
enabled: true
|
||||||
# redis 配置
|
# redis 配置
|
||||||
data.redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 192.168.28.10
|
host: 192.168.28.10
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: ${CMVR_REDIS_DATABASE:1}
|
database: 0
|
||||||
# 密码
|
# 密码
|
||||||
password: cmvr2468
|
password: cmvr2468
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
@ -133,16 +133,7 @@ flowise:
|
|||||||
query: http://192.168.0.108:3000/api/v1/executions/
|
query: http://192.168.0.108:3000/api/v1/executions/
|
||||||
api-key: pg61JW6W_GXyqmqSoURJ4mlSRrCMRzGLBJli_w3BFkg
|
api-key: pg61JW6W_GXyqmqSoURJ4mlSRrCMRzGLBJli_w3BFkg
|
||||||
|
|
||||||
media-analysis:
|
# TTS外部接口配置
|
||||||
base-url: ${MEDIA_ANALYSIS_BASE_URL:http://192.168.28.10:14080}
|
tts:
|
||||||
api-key: ${MEDIA_ANALYSIS_API_KEY:}
|
external-api:
|
||||||
connect-timeout-ms: 5000
|
url: http://192.168.0.102:9003/generate_advanced_audio
|
||||||
read-timeout-ms: 600000
|
|
||||||
|
|
||||||
# Isolate the resource-center development instance from the currently running robot gateway.
|
|
||||||
cmvr:
|
|
||||||
resource:
|
|
||||||
robot-state:
|
|
||||||
enabled: false
|
|
||||||
quic:
|
|
||||||
enabled: false
|
|
||||||
@ -68,7 +68,7 @@ spring:
|
|||||||
# 热部署开关
|
# 热部署开关
|
||||||
enabled: true
|
enabled: true
|
||||||
# redis 配置
|
# redis 配置
|
||||||
data.redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 192.168.0.100
|
host: 192.168.0.100
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
|
|||||||
@ -1,61 +0,0 @@
|
|||||||
# 数据源配置
|
|
||||||
spring:
|
|
||||||
datasource:
|
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
|
||||||
druid:
|
|
||||||
# 主库数据源
|
|
||||||
master:
|
|
||||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
|
||||||
username: root
|
|
||||||
password: password
|
|
||||||
# 从库数据源
|
|
||||||
slave:
|
|
||||||
# 从数据源开关/默认关闭
|
|
||||||
enabled: false
|
|
||||||
url:
|
|
||||||
username:
|
|
||||||
password:
|
|
||||||
# 初始连接数
|
|
||||||
initialSize: 5
|
|
||||||
# 最小连接池数量
|
|
||||||
minIdle: 10
|
|
||||||
# 最大连接池数量
|
|
||||||
maxActive: 20
|
|
||||||
# 配置获取连接等待超时的时间
|
|
||||||
maxWait: 60000
|
|
||||||
# 配置连接超时时间
|
|
||||||
connectTimeout: 30000
|
|
||||||
# 配置网络超时时间
|
|
||||||
socketTimeout: 60000
|
|
||||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
|
||||||
timeBetweenEvictionRunsMillis: 60000
|
|
||||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
|
||||||
minEvictableIdleTimeMillis: 300000
|
|
||||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
|
||||||
maxEvictableIdleTimeMillis: 900000
|
|
||||||
# 配置检测连接是否有效
|
|
||||||
validationQuery: SELECT 1 FROM DUAL
|
|
||||||
testWhileIdle: true
|
|
||||||
testOnBorrow: false
|
|
||||||
testOnReturn: false
|
|
||||||
webStatFilter:
|
|
||||||
enabled: true
|
|
||||||
statViewServlet:
|
|
||||||
enabled: true
|
|
||||||
# 设置白名单,不填则允许所有访问
|
|
||||||
allow:
|
|
||||||
url-pattern: /druid/*
|
|
||||||
# 控制台管理用户名和密码
|
|
||||||
login-username: ruoyi
|
|
||||||
login-password: 123456
|
|
||||||
filter:
|
|
||||||
stat:
|
|
||||||
enabled: true
|
|
||||||
# 慢SQL记录
|
|
||||||
log-slow-sql: true
|
|
||||||
slow-sql-millis: 1000
|
|
||||||
merge-sql: true
|
|
||||||
wall:
|
|
||||||
config:
|
|
||||||
multi-statement-allow: true
|
|
||||||
@ -68,7 +68,7 @@ spring:
|
|||||||
# 热部署开关
|
# 热部署开关
|
||||||
enabled: true
|
enabled: true
|
||||||
# redis 配置
|
# redis 配置
|
||||||
data.redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 192.168.28.10
|
host: 192.168.28.10
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
@ -132,9 +132,3 @@ flowise:
|
|||||||
abort: http://192.168.0.108:3000/api/v1/chatmessage/abort/f99329e9-b33d-437d-90ed-69eaa8a05418/
|
abort: http://192.168.0.108:3000/api/v1/chatmessage/abort/f99329e9-b33d-437d-90ed-69eaa8a05418/
|
||||||
query: http://192.168.0.108:3000/api/v1/executions/
|
query: http://192.168.0.108:3000/api/v1/executions/
|
||||||
api-key: pg61JW6W_GXyqmqSoURJ4mlSRrCMRzGLBJli_w3BFkg
|
api-key: pg61JW6W_GXyqmqSoURJ4mlSRrCMRzGLBJli_w3BFkg
|
||||||
|
|
||||||
media-analysis:
|
|
||||||
base-url: ${MEDIA_ANALYSIS_BASE_URL:http://192.168.28.10:14080}
|
|
||||||
api-key: ${MEDIA_ANALYSIS_API_KEY:}
|
|
||||||
connect-timeout-ms: 5000
|
|
||||||
read-timeout-ms: 600000
|
|
||||||
|
|||||||
@ -68,7 +68,7 @@ spring:
|
|||||||
# 热部署开关
|
# 热部署开关
|
||||||
enabled: true
|
enabled: true
|
||||||
# redis 配置
|
# redis 配置
|
||||||
data.redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: redis
|
host: redis
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
server:
|
server:
|
||||||
# 服务器的HTTP端口,默认为8080
|
# 服务器的HTTP端口,默认为8080
|
||||||
port: 14080
|
port: 13080
|
||||||
# 数据源配置
|
# 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
@ -9,7 +9,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://192.168.28.10:3306/${CMVR_DB_NAME:cmvr-iot-resource-dev}?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://192.168.28.10:3306/cmvr-iot-dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: cmvr2468
|
password: cmvr2468
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
@ -68,13 +68,13 @@ spring:
|
|||||||
# 热部署开关
|
# 热部署开关
|
||||||
enabled: true
|
enabled: true
|
||||||
# redis 配置
|
# redis 配置
|
||||||
data.redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 192.168.28.10
|
host: 192.168.28.10
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: ${CMVR_REDIS_DATABASE:1}
|
database: 0
|
||||||
# 密码
|
# 密码
|
||||||
password: cmvr2468
|
password: cmvr2468
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
@ -132,17 +132,3 @@ flowise:
|
|||||||
abort: http://192.168.0.108:3000/api/v1/chatmessage/abort/f99329e9-b33d-437d-90ed-69eaa8a05418/
|
abort: http://192.168.0.108:3000/api/v1/chatmessage/abort/f99329e9-b33d-437d-90ed-69eaa8a05418/
|
||||||
query: http://192.168.0.108:3000/api/v1/executions/
|
query: http://192.168.0.108:3000/api/v1/executions/
|
||||||
api-key: pg61JW6W_GXyqmqSoURJ4mlSRrCMRzGLBJli_w3BFkg
|
api-key: pg61JW6W_GXyqmqSoURJ4mlSRrCMRzGLBJli_w3BFkg
|
||||||
|
|
||||||
media-analysis:
|
|
||||||
base-url: ${MEDIA_ANALYSIS_BASE_URL:http://192.168.28.10:14080}
|
|
||||||
api-key: ${MEDIA_ANALYSIS_API_KEY:cmvr-analysis-2026-c65ec181d5ab4a49aef34e6fd1be6704}
|
|
||||||
connect-timeout-ms: 5000
|
|
||||||
read-timeout-ms: 600000
|
|
||||||
|
|
||||||
# Isolate the resource-center development instance from the currently running robot gateway.
|
|
||||||
#cmvr:
|
|
||||||
# resource:
|
|
||||||
# robot-state:
|
|
||||||
# enabled: false
|
|
||||||
# quic:
|
|
||||||
# enabled: false
|
|
||||||
|
|||||||
@ -48,13 +48,6 @@ user:
|
|||||||
|
|
||||||
# Spring配置
|
# Spring配置
|
||||||
spring:
|
spring:
|
||||||
jackson:
|
|
||||||
date-format: "yyyy-MM-dd HH:mm:ss"
|
|
||||||
time-zone: Asia/Shanghai
|
|
||||||
sql:
|
|
||||||
init:
|
|
||||||
mode: always
|
|
||||||
schema-locations: classpath:db/notice-schema.sql
|
|
||||||
# 资源信息
|
# 资源信息
|
||||||
messages:
|
messages:
|
||||||
# 国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
@ -106,15 +99,13 @@ swagger:
|
|||||||
# 请求前缀
|
# 请求前缀
|
||||||
pathMapping: /
|
pathMapping: /
|
||||||
knife4j:
|
knife4j:
|
||||||
# 生产环境可开启屏蔽文档资源
|
# 开启屏蔽文档资源
|
||||||
production: false
|
production: false
|
||||||
# 是否开启Knife4j增强界面
|
# 是否开启Knife4j(swagger 增强版)
|
||||||
enable: true
|
enable: true
|
||||||
setting:
|
setting:
|
||||||
language: zh-CN
|
language: zh-CN
|
||||||
enableRequestCache: true
|
enableRequestCache: true
|
||||||
enableSwaggerModels: true
|
|
||||||
swaggerModelName: 数据模型
|
|
||||||
|
|
||||||
# 防止XSS攻击
|
# 防止XSS攻击
|
||||||
xss:
|
xss:
|
||||||
@ -125,43 +116,4 @@ xss:
|
|||||||
# 匹配链接
|
# 匹配链接
|
||||||
urlPatterns: /system/*,/monitor/*,/tool/*,/device/*,/test/*,/api/*
|
urlPatterns: /system/*,/monitor/*,/tool/*,/device/*,/test/*,/api/*
|
||||||
|
|
||||||
# Integrated QUIC gateway and in-process node synchronization.
|
|
||||||
cmvr:
|
|
||||||
resource:
|
|
||||||
robot-state:
|
|
||||||
enabled: true
|
|
||||||
initial-delay-ms: 3000
|
|
||||||
refresh-ms: 1000
|
|
||||||
heartbeat-check-ms: 5000
|
|
||||||
heartbeat-timeout-ms: ${CMVR_ROBOT_HEARTBEAT_TIMEOUT_MS:${cmvr.quic.heartbeat-timeout-ms:15000}}
|
|
||||||
# Comma-separated IDs for pure logical workflows. These IDs bypass QUIC online checks.
|
|
||||||
virtual-robot-ids: CN-CMVR-MBLRV1-TEST-20260821-001
|
|
||||||
quic:
|
|
||||||
enabled: true
|
|
||||||
bind-host: 0.0.0.0
|
|
||||||
port: 4433
|
|
||||||
grpc-host-source: observed-source
|
|
||||||
alpn: cmvr-quic-edge/1
|
|
||||||
allowed-node-ids: ""
|
|
||||||
tls:
|
|
||||||
certificate: "certs/quic-gateway.crt"
|
|
||||||
private-key: "certs/quic-gateway.key"
|
|
||||||
require-client-certificate: false
|
|
||||||
client-ca: ""
|
|
||||||
heartbeat-interval-ms: 5000
|
|
||||||
heartbeat-timeout-ms: 15000
|
|
||||||
idle-timeout-ms: 30000
|
|
||||||
maximum-control-frame-bytes: 1048576
|
|
||||||
datagram-queue-length: 1024
|
|
||||||
maximum-frame-bytes: 8388608
|
|
||||||
maximum-reassembly-bytes: 67108864
|
|
||||||
maximum-reassembly-frames: 256
|
|
||||||
reassembly-timeout-ms: 2000
|
|
||||||
media-subscriber-queue-capacity: 64
|
|
||||||
|
|
||||||
springdoc:
|
|
||||||
api-docs:
|
|
||||||
path: /v3/api-docs
|
|
||||||
swagger-ui:
|
|
||||||
enabled: true
|
|
||||||
path: /swagger-ui.html
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user