Compare commits
112 Commits
dev_202510
...
59307d612c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59307d612c | ||
|
|
48800adccd | ||
| 2933b1961e | |||
| 7be8216a5a | |||
| c74505b8c3 | |||
| 8ac012f49c | |||
| 068ca75caf | |||
| 6248147389 | |||
| 01f18f87ba | |||
| 9917e46c29 | |||
| 54cd851245 | |||
| 8b13d4cd92 | |||
| 46175c7295 | |||
| d72f637be3 | |||
| 6da50d70d0 | |||
| eec3fc663b | |||
| 29bdb9ddbb | |||
| 86e0935353 | |||
| 4c2cb4f0e5 | |||
| 3442591d2b | |||
| 4928c71b19 | |||
| 5cd5353f97 | |||
| 73ab200daf | |||
| 4298fcb402 | |||
| 37c0ac035e | |||
| 977ca260da | |||
| 4808960491 | |||
| 74d8c66a6e | |||
| fca95e1203 | |||
| b7d3e07d16 | |||
| 35ac70e82d | |||
| 632b37d5bd | |||
| 75ed266532 | |||
| 884459e91a | |||
| 5acb3a34e0 | |||
| 9dc9bff8b1 | |||
| b44214f74a | |||
| 78ff89ba0d | |||
| 8bbb3ac38f | |||
| 983f8cb429 | |||
| 0d9ae593c6 | |||
| 07e8151736 | |||
| ad5ca8c545 | |||
| 95e7b752e3 | |||
| 3ea2777c94 | |||
| 1db7b3f6a1 | |||
| 03c5226a6a | |||
| 7bd3d54d97 | |||
| 61371a4a76 | |||
| 6606438862 | |||
| c9332b85db | |||
| 74d19bb9d6 | |||
| 57f97a490a | |||
| 746e5051cf | |||
| f27b57ec8b | |||
| 5e0773a59f | |||
| 70ea5f4dd4 | |||
| 31ea86d90c | |||
| 73dda8b648 | |||
| 80a60e37af | |||
| 71885c8796 | |||
| bfbb94481f | |||
| 3dcf9ca3ef | |||
| 2b92f29a17 | |||
| 3dbfff5f41 | |||
| f04385a306 | |||
| 44f817eced | |||
| 0f2cc6a33c | |||
| 0d1127f25e | |||
| bb7b4035fc | |||
| c3b3ed3681 | |||
| 3fe027661b | |||
| 74034ed26a | |||
| ad98033faa | |||
| bd8f47d9ae | |||
| c975c205df | |||
| 3ead596483 | |||
| 882df50f75 | |||
| 13da68b90d | |||
| 5f8bc1af55 | |||
| 1391239193 | |||
| fe93d9fac0 | |||
| 6ed65f89b5 | |||
| 9ff5b98b05 | |||
| 461c390cf7 | |||
| 1b9c9e9b86 | |||
| be30f31990 | |||
| ac4d7d8176 | |||
| 54997d4e3d | |||
| 7bbb1be2a2 | |||
| 19312e7a6f | |||
| 727dd254f0 | |||
| 2942fdabfe | |||
| 5ea30d6f85 | |||
| e6ae7d60e3 | |||
| cca1847fbf | |||
| 10a317bed6 | |||
| a3bf673440 | |||
| 30c4ec612a | |||
| 486455af81 | |||
| b6cdbba20a | |||
| bc77cd244b | |||
| 5306431417 | |||
| 53287f0a1d | |||
| efbe2a3def | |||
| a1cbb9fdf0 | |||
| a84e8b9fe6 | |||
| 98052c0ce7 | |||
| 3780b9d2ab | |||
| bd43d35074 | |||
| 085cd485ad | |||
| 9007c7de57 |
@@ -1,211 +0,0 @@
|
||||
# Gitea Actions 工作流配置说明
|
||||
|
||||
本项目配置了两个 Gitea Actions 工作流,用于自动化构建、测试和部署。
|
||||
|
||||
## 工作流列表
|
||||
|
||||
### 1. ci.yml - 持续集成
|
||||
**触发时机:**
|
||||
- 推送代码到 `main` 或 `master` 分支
|
||||
- 创建 Pull Request
|
||||
|
||||
**执行内容:**
|
||||
- 自动检出代码
|
||||
- 配置 Java 8 环境
|
||||
- 使用 Gradle 构建项目
|
||||
- 运行单元测试
|
||||
- 上传构建产物(JAR 包)
|
||||
- 上传测试报告
|
||||
|
||||
**查看结果:**
|
||||
构建完成后,可以在 Gitea 仓库的 "Actions" 标签页查看运行结果和下载构建产物。
|
||||
|
||||
---
|
||||
|
||||
### 2. deploy.yml - 自动部署
|
||||
**触发时机:**
|
||||
- 推送代码到 `main` 或 `master` 分支
|
||||
- 手动触发(在 Gitea Actions 页面点击 "Run workflow")
|
||||
|
||||
**执行内容:**
|
||||
- 构建项目
|
||||
- 通过 SCP 将 JAR 包上传到服务器
|
||||
- 通过 SSH 重启应用
|
||||
|
||||
**配置步骤:**
|
||||
|
||||
#### 第一步:在 Gitea 中配置 Secrets
|
||||
进入仓库 → Settings → Secrets,添加以下密钥:
|
||||
|
||||
| 密钥名称 | 说明 | 示例 |
|
||||
|---------|------|------|
|
||||
| `SERVER_HOST` | 服务器 IP 地址 | `120.24.204.180` |
|
||||
| `SERVER_PORT` | SSH 端口 | `22` |
|
||||
| `SERVER_USER` | SSH 用户名 | `root` 或 `ubuntu` |
|
||||
| `SERVER_SSH_KEY` | SSH 私钥内容 | 完整的私钥文件内容 |
|
||||
| `DEPLOY_PATH` | 部署目录路径 | `/opt/corewing` |
|
||||
|
||||
#### 第二步:生成 SSH 密钥对(如果还没有)
|
||||
```bash
|
||||
# 在本地生成密钥对
|
||||
ssh-keygen -t rsa -b 4096 -C "gitea-deploy" -f ~/.ssh/gitea_deploy
|
||||
|
||||
# 查看公钥
|
||||
cat ~/.ssh/gitea_deploy.pub
|
||||
|
||||
# 查看私钥(复制到 Gitea Secrets 中)
|
||||
cat ~/.ssh/gitea_deploy
|
||||
```
|
||||
|
||||
#### 第三步:配置服务器
|
||||
```bash
|
||||
# 1. SSH 登录到服务器
|
||||
ssh user@your-server
|
||||
|
||||
# 2. 创建部署目录
|
||||
sudo mkdir -p /opt/corewing
|
||||
sudo chown $USER:$USER /opt/corewing
|
||||
|
||||
# 3. 添加公钥到 authorized_keys
|
||||
echo "your-public-key-content" >> ~/.ssh/authorized_keys
|
||||
chmod 600 ~/.ssh/authorized_keys
|
||||
|
||||
# 4. 安装 Java(如果未安装)
|
||||
sudo apt update
|
||||
sudo apt install openjdk-8-jdk -y
|
||||
java -version
|
||||
```
|
||||
|
||||
#### 第四步:测试部署
|
||||
推送代码到 main 分支,或在 Gitea Actions 页面手动触发 deploy 工作流。
|
||||
|
||||
---
|
||||
|
||||
## 启用 Gitea Actions
|
||||
|
||||
### Gitea 服务器端配置
|
||||
|
||||
如果你的 Gitea 实例还未启用 Actions,需要管理员配置:
|
||||
|
||||
1. **修改 Gitea 配置文件** (`app.ini`):
|
||||
```ini
|
||||
[actions]
|
||||
ENABLED = true
|
||||
DEFAULT_ACTIONS_URL = https://gitea.com
|
||||
```
|
||||
|
||||
2. **安装 Gitea Act Runner**:
|
||||
```bash
|
||||
# 下载 Act Runner
|
||||
wget https://dl.gitea.com/act_runner/0.2.6/act_runner-0.2.6-linux-amd64
|
||||
chmod +x act_runner-0.2.6-linux-amd64
|
||||
mv act_runner-0.2.6-linux-amd64 /usr/local/bin/act_runner
|
||||
|
||||
# 注册 Runner
|
||||
act_runner register --no-interactive --instance http://120.24.204.180:3000 --token YOUR_RUNNER_TOKEN
|
||||
|
||||
# 启动 Runner
|
||||
act_runner daemon
|
||||
```
|
||||
|
||||
3. **获取 Runner Token**:
|
||||
- 登录 Gitea 管理后台
|
||||
- 进入 Site Administration → Actions → Runners
|
||||
- 点击 "Create new Runner" 获取 Token
|
||||
|
||||
---
|
||||
|
||||
## 自定义工作流
|
||||
|
||||
### 修改触发条件
|
||||
可以根据需要修改工作流的触发条件:
|
||||
|
||||
```yaml
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ] # 监听多个分支
|
||||
tags:
|
||||
- 'v*' # 监听标签
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # 定时执行(每天午夜)
|
||||
```
|
||||
|
||||
### 添加环境变量
|
||||
在工作流中使用环境变量:
|
||||
|
||||
```yaml
|
||||
env:
|
||||
JAVA_VERSION: '8'
|
||||
SPRING_PROFILES_ACTIVE: 'prod'
|
||||
|
||||
steps:
|
||||
- name: 运行应用
|
||||
run: java -jar -Dspring.profiles.active=${{ env.SPRING_PROFILES_ACTIVE }} app.jar
|
||||
```
|
||||
|
||||
### 添加通知
|
||||
可以添加构建成功/失败通知:
|
||||
|
||||
```yaml
|
||||
- name: 发送通知
|
||||
if: failure()
|
||||
run: |
|
||||
curl -X POST "https://your-notification-webhook" \
|
||||
-d "构建失败: ${{ github.repository }}"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 1. 工作流未触发?
|
||||
- 检查 Gitea Actions 是否启用
|
||||
- 检查 Act Runner 是否正常运行
|
||||
- 确认触发条件是否匹配
|
||||
|
||||
### 2. 构建失败?
|
||||
- 查看 Actions 日志获取详细错误信息
|
||||
- 检查 Java 版本是否正确
|
||||
- 确认依赖是否能正常下载
|
||||
|
||||
### 3. 部署失败?
|
||||
- 检查 Secrets 配置是否正确
|
||||
- 测试 SSH 连接是否正常
|
||||
- 检查服务器目录权限
|
||||
|
||||
### 4. 如何查看日志?
|
||||
- Gitea 仓库 → Actions 标签页
|
||||
- 点击具体的工作流运行记录
|
||||
- 展开各个步骤查看详细日志
|
||||
|
||||
---
|
||||
|
||||
## 最佳实践
|
||||
|
||||
1. **分支策略**:
|
||||
- `main` 分支自动部署到生产环境
|
||||
- `develop` 分支自动部署到测试环境
|
||||
- Pull Request 只执行构建和测试
|
||||
|
||||
2. **安全性**:
|
||||
- 不要在代码中硬编码密码和密钥
|
||||
- 使用 Secrets 管理敏感信息
|
||||
- 定期轮换 SSH 密钥
|
||||
|
||||
3. **性能优化**:
|
||||
- 启用 Gradle 缓存加快构建速度
|
||||
- 使用 `build -x test` 跳过测试快速构建
|
||||
- 合理设置产物保留时间
|
||||
|
||||
4. **监控**:
|
||||
- 定期检查工作流运行状态
|
||||
- 设置构建失败通知
|
||||
- 保存构建日志便于问题排查
|
||||
|
||||
---
|
||||
|
||||
## 更多资源
|
||||
|
||||
- [Gitea Actions 官方文档](https://docs.gitea.io/en-us/actions/)
|
||||
- [GitHub Actions 语法参考](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions)(Gitea Actions 兼容 GitHub Actions 语法)
|
||||
- [Act Runner 项目](https://gitea.com/gitea/act_runner)
|
||||
@@ -1,55 +0,0 @@
|
||||
name: CI Build and Test
|
||||
|
||||
# 触发条件:推送到 main 分支或创建 Pull Request
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# 1. 检出代码
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# 2. 设置 Java 环境
|
||||
- name: 设置 Java 8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'temurin'
|
||||
cache: 'gradle'
|
||||
|
||||
# 3. 赋予 Gradle wrapper 执行权限
|
||||
- name: 赋予 Gradle wrapper 执行权限
|
||||
run: chmod +x gradlew
|
||||
|
||||
# 4. 构建项目(跳过测试)
|
||||
- name: 使用 Gradle 构建项目
|
||||
run: ./gradlew build -x test
|
||||
|
||||
# 5. 运行测试
|
||||
- name: 运行测试
|
||||
run: ./gradlew test
|
||||
|
||||
# 6. 上传构建产物(JAR 文件)
|
||||
- name: 上传 JAR 包
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success()
|
||||
with:
|
||||
name: corewing-app
|
||||
path: build/libs/*.jar
|
||||
retention-days: 7
|
||||
|
||||
# 7. 上传测试报告
|
||||
- name: 上传测试报告
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: test-reports
|
||||
path: build/reports/tests/
|
||||
retention-days: 7
|
||||
@@ -1,80 +0,0 @@
|
||||
name: Deploy to Server
|
||||
|
||||
# 触发条件:手动触发或推送到 main 分支
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
workflow_dispatch: # 允许手动触发
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# 1. 检出代码
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# 2. 设置 Java 环境
|
||||
- name: 设置 Java 8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'temurin'
|
||||
cache: 'gradle'
|
||||
|
||||
# 3. 赋予 Gradle wrapper 执行权限
|
||||
- name: 赋予 Gradle wrapper 执行权限
|
||||
run: chmod +x gradlew
|
||||
|
||||
# 4. 构建项目
|
||||
- name: 构建项目
|
||||
run: ./gradlew build -x test
|
||||
|
||||
# 5. 打包 JAR 文件
|
||||
- name: 获取 JAR 文件名
|
||||
id: jar
|
||||
run: echo "jar_file=$(ls build/libs/*.jar | head -n 1)" >> $GITHUB_OUTPUT
|
||||
|
||||
# 6. 部署到服务器(使用 SCP)
|
||||
# 需要在 Gitea 仓库设置中配置以下 Secrets:
|
||||
# - SERVER_HOST: 服务器地址
|
||||
# - SERVER_PORT: SSH 端口(默认 22)
|
||||
# - SERVER_USER: SSH 用户名
|
||||
# - SERVER_SSH_KEY: SSH 私钥
|
||||
# - DEPLOY_PATH: 部署路径(如 /opt/corewing)
|
||||
- name: 部署到服务器
|
||||
uses: appleboy/scp-action@master
|
||||
with:
|
||||
host: ${{ secrets.SERVER_HOST }}
|
||||
username: ${{ secrets.SERVER_USER }}
|
||||
key: ${{ secrets.SERVER_SSH_KEY }}
|
||||
port: ${{ secrets.SERVER_PORT }}
|
||||
source: "build/libs/*.jar"
|
||||
target: ${{ secrets.DEPLOY_PATH }}
|
||||
strip_components: 2
|
||||
|
||||
# 7. 重启应用(通过 SSH 执行命令)
|
||||
- name: 重启应用
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SERVER_HOST }}
|
||||
username: ${{ secrets.SERVER_USER }}
|
||||
key: ${{ secrets.SERVER_SSH_KEY }}
|
||||
port: ${{ secrets.SERVER_PORT }}
|
||||
script: |
|
||||
cd ${{ secrets.DEPLOY_PATH }}
|
||||
# 停止旧进程
|
||||
pkill -f corewing || true
|
||||
# 等待进程完全停止
|
||||
sleep 3
|
||||
# 启动新进程
|
||||
nohup java -jar *.jar > app.log 2>&1 &
|
||||
# 检查启动状态
|
||||
sleep 5
|
||||
if pgrep -f corewing > /dev/null; then
|
||||
echo "应用启动成功"
|
||||
else
|
||||
echo "应用启动失败"
|
||||
exit 1
|
||||
fi
|
||||
@@ -36,12 +36,14 @@ dependencies {
|
||||
implementation 'cn.dev33:sa-token-spring-boot-starter:1.44.0' // 权限认证
|
||||
implementation 'com.alibaba:druid-spring-boot-starter:1.2.27' // 数据库连接池
|
||||
implementation 'org.lionsoul:ip2region:2.7.0' // IP 归属地
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' // mongodb
|
||||
compileOnly 'org.projectlombok:lombok' // Lombok
|
||||
developmentOnly 'org.springframework.boot:spring-boot-devtools' // 热重载
|
||||
runtimeOnly 'com.mysql:mysql-connector-j' // MySQL 驱动
|
||||
annotationProcessor 'org.projectlombok:lombok' // Lombok 注解处理
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test' // 测试框架
|
||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' // thymeleaf模版引擎
|
||||
implementation 'com.aliyun.oss:aliyun-sdk-oss:3.18.1' // OSS SDK
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
|
||||
@@ -54,6 +54,13 @@ public class Result<T> implements Serializable {
|
||||
return new Result<>(200, I18nUtil.getMessage("common.success"), data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回(自定义消息)
|
||||
*/
|
||||
public static <T> Result<T> success(String message) {
|
||||
return new Result<>(200, message, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回(自定义消息和数据)
|
||||
*/
|
||||
@@ -81,4 +88,27 @@ public class Result<T> implements Serializable {
|
||||
public static <T> Result<T> error(Integer code, String message) {
|
||||
return new Result<>(code, message, null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态返回信息结果
|
||||
*/
|
||||
public static <T> Result<T> isBool(boolean flag) {
|
||||
return flag ? Result.success() : Result.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态返回信息结果(自定义成功消息)
|
||||
*/
|
||||
public static <T> Result<T> isBoolAsMsg(boolean flag, String successMsg) {
|
||||
return flag ? Result.success(successMsg) : Result.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态返回信息结果(自定义消息)
|
||||
*/
|
||||
public static <T> Result<T> isBoolAsMsg(boolean flag, String successMsg, String errorMsg) {
|
||||
return flag ? Result.success(successMsg) : Result.error(errorMsg);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
37
src/main/java/com/corewing/app/common/base/BaseEntity.java
Normal file
37
src/main/java/com/corewing/app/common/base/BaseEntity.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.corewing.app.common.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class BaseEntity {
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
23
src/main/java/com/corewing/app/common/page/PageContext.java
Normal file
23
src/main/java/com/corewing/app/common/page/PageContext.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.corewing.app.common.page;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
public class PageContext {
|
||||
private static final ThreadLocal<Page<?>> PAGE_HOLDER = new ThreadLocal<>();
|
||||
|
||||
// 设置分页对象
|
||||
public static void setPage(Page<?> page) {
|
||||
PAGE_HOLDER.set(page);
|
||||
}
|
||||
|
||||
// 泛型方法:获取指定类型的分页对象(消除警告)
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Page<T> getPage(Class<T> clazz) {
|
||||
return (Page<T>) PAGE_HOLDER.get();
|
||||
}
|
||||
|
||||
// 清除线程变量
|
||||
public static void clear() {
|
||||
PAGE_HOLDER.remove();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.corewing.app.common.page;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class PageInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
// 默认分页参数
|
||||
int pageNum = 1;
|
||||
int pageSize = 10;
|
||||
|
||||
// 从请求参数中获取分页信息
|
||||
String current = request.getParameter("current");
|
||||
String size = request.getParameter("size");
|
||||
|
||||
// 解析页码
|
||||
if (current != null && !current.isEmpty()) {
|
||||
try {
|
||||
pageNum = Integer.parseInt(current);
|
||||
if (pageNum < 1) pageNum = 1; // 页码不能小于1
|
||||
} catch (NumberFormatException e) {
|
||||
// 非法参数使用默认值
|
||||
}
|
||||
}
|
||||
|
||||
// 解析每页条数
|
||||
if (size != null && !size.isEmpty()) {
|
||||
try {
|
||||
pageSize = Integer.parseInt(size);
|
||||
if (pageSize < 1) pageSize = 10; // 每页条数不能小于1
|
||||
if (pageSize > 100) pageSize = 100; // 限制最大条数
|
||||
} catch (NumberFormatException e) {
|
||||
// 非法参数使用默认值
|
||||
}
|
||||
}
|
||||
|
||||
// 创建 MyBatis-Plus 的 Page 对象并存储到 ThreadLocal
|
||||
Page<?> page = new Page<>(pageNum, pageSize);
|
||||
PageContext.setPage(page);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
// 清除ThreadLocal中的数据,防止内存泄漏
|
||||
PageContext.clear();
|
||||
}
|
||||
}
|
||||
39
src/main/java/com/corewing/app/config/CorsConfig.java
Normal file
39
src/main/java/com/corewing/app/config/CorsConfig.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.corewing.app.config;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration // 标记为配置类
|
||||
public class CorsConfig implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
* 配置跨域过滤器,优先级高于所有拦截器
|
||||
*/
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
// 1. 配置跨域参数
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// 允许的前端域名(根据实际环境修改)
|
||||
config.addAllowedOriginPattern("*");
|
||||
// 允许携带 Cookie(前后端都需要开启)
|
||||
config.setAllowCredentials(true);
|
||||
// 允许的请求方法(包含预检请求 OPTIONS)
|
||||
config.addAllowedMethod("*");
|
||||
// 允许的请求头(* 表示所有)
|
||||
config.addAllowedHeader("*");
|
||||
// 预检请求缓存时间(1小时,减少重复验证)
|
||||
config.setMaxAge(3600L);
|
||||
|
||||
// 2. 配置路径匹配规则(对所有接口生效)
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
|
||||
// 3. 返回过滤器(优先级最高)
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.corewing.app.config;
|
||||
|
||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.corewing.app.common.page.PageInterceptor;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@@ -17,27 +18,37 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
||||
*/
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 分页参数拦截
|
||||
registry.addInterceptor(new PageInterceptor());
|
||||
// 注册 Sa-Token 拦截器,校验规则为 StpUtil.checkLogin() 登录校验。
|
||||
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
|
||||
// 拦截所有路由
|
||||
.addPathPatterns("/**")
|
||||
// 排除登录、注册、发送验证码接口
|
||||
.excludePathPatterns("/user/login", "/user/register", "/user/sendCode")
|
||||
// 排除登录、注册、发送验证码, 忘记密码接口
|
||||
.excludePathPatterns("/user/login", "/user/register", "/user/sendCode", "/user/forgetPassword", "/user/codeLogin")
|
||||
// 排除后台管理登录接口
|
||||
.excludePathPatterns("/sys/user/login")
|
||||
// 排除反馈接口(支持匿名提交)
|
||||
.excludePathPatterns("/feedback", "/feedback/**")
|
||||
// 排除教程接口(支持匿名查询)
|
||||
.excludePathPatterns("/tutorial", "/tutorial/**")
|
||||
// 排除隐私政策接口(支持匿名查询)
|
||||
.excludePathPatterns("/privacy_policy", "/privacy_policy/**")
|
||||
// 排除固件查询接口(不需要登录)
|
||||
.excludePathPatterns("/firmware/**")
|
||||
// 排除系统登录页(不需要登录)
|
||||
// .excludePathPatterns("/loading.html", "/admin/login.html")
|
||||
// 排除静态资源
|
||||
.excludePathPatterns("/", "/loading.html", "/admin/login.html", "/*.css", "/*.js", "/*.ico", "/static/**")
|
||||
.excludePathPatterns("/", "/*.css", "/*.js", "/*.ico", "/static/**", "/assets/**")
|
||||
// 排除后台管理静态资源
|
||||
.excludePathPatterns("/admin/**")
|
||||
// .excludePathPatterns("/admin/**")
|
||||
// 排除 Druid 监控
|
||||
.excludePathPatterns("/druid/**")
|
||||
// 排除错误页面
|
||||
.excludePathPatterns("/error", "/error/**");
|
||||
.excludePathPatterns("/error", "/error/**")
|
||||
// 排除校验更新接口
|
||||
.excludePathPatterns("app_version", "/app_version/checkUpdate")
|
||||
// 排除咨询接口
|
||||
.excludePathPatterns("/contactMsg", "/contactMsg/**");
|
||||
}
|
||||
}
|
||||
|
||||
19
src/main/java/com/corewing/app/dto/api/CodeLoginRequest.java
Normal file
19
src/main/java/com/corewing/app/dto/api/CodeLoginRequest.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 验证码登录请求对象
|
||||
*/
|
||||
@Data
|
||||
public class CodeLoginRequest {
|
||||
|
||||
@NotBlank(message = "手机号或邮箱不能为空")
|
||||
private String account;
|
||||
|
||||
@NotBlank(message = "验证码不能为空")
|
||||
private String verificationCode;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.dto;
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.dto;
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class ForgetPasswordRequest {
|
||||
|
||||
@NotBlank(message = "手机号或邮箱不能为空")
|
||||
private String account;
|
||||
|
||||
@NotBlank(message = "验证码不能为空")
|
||||
private String verificationCode;
|
||||
|
||||
@NotBlank(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.dto;
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
13
src/main/java/com/corewing/app/dto/api/LogoffRequest.java
Normal file
13
src/main/java/com/corewing/app/dto/api/LogoffRequest.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class LogoffRequest {
|
||||
|
||||
@NotBlank(message = "验证码不能为空")
|
||||
private String code;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.dto;
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
4
src/main/java/com/corewing/app/dto/SendCodeRequest.java → src/main/java/com/corewing/app/dto/api/SendCodeRequest.java
Normal file → Executable file
4
src/main/java/com/corewing/app/dto/SendCodeRequest.java → src/main/java/com/corewing/app/dto/api/SendCodeRequest.java
Normal file → Executable file
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.dto;
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class SendCodeRequest {
|
||||
private String account;
|
||||
|
||||
/**
|
||||
* 验证码类型:register-注册, login-登录, reset-重置密码
|
||||
* 验证码类型:register-注册, login-登录, reset-重置密码, forget-忘记密码,logoff-注销
|
||||
*/
|
||||
@NotBlank(message = "验证码类型不能为空")
|
||||
private String type;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.dto;
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
47
src/main/java/com/corewing/app/dto/api/TrajectoryData.java
Normal file
47
src/main/java/com/corewing/app/dto/api/TrajectoryData.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TrajectoryData {
|
||||
private Long id;
|
||||
private Long session_id;
|
||||
private Long timestamp;
|
||||
|
||||
// 基础遥测数据
|
||||
private Long rc;
|
||||
private Long gps;
|
||||
private Long gps_status;
|
||||
private double voltage;
|
||||
private double cell_voltage;
|
||||
private Long consumption;
|
||||
private double current;
|
||||
private double speed;
|
||||
private double air_speed;
|
||||
private double v_speed;
|
||||
private double altitude;
|
||||
private double distance;
|
||||
private double range;
|
||||
private Long throttle;
|
||||
private Long wind_direction;
|
||||
private double wind_speed;
|
||||
private Long heading;
|
||||
private double roll;
|
||||
private double pitch;
|
||||
private double yaw;
|
||||
|
||||
// 扩展数据
|
||||
private double compass_heading;
|
||||
private double drone_lat;
|
||||
private double drone_lon;
|
||||
private double home_lat;
|
||||
private double home_lon;
|
||||
private String map_type;
|
||||
private Boolean show_trajectory;
|
||||
private String flight_mode;
|
||||
private Long vehicle_type;
|
||||
private Long autopilot_type;
|
||||
private Boolean is_armed;
|
||||
|
||||
private String sync_id;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TutorialListRequest {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.dto;
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.dto;
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.corewing.app.dto.api;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class uploadReplaySessionRequest {
|
||||
|
||||
private Long id;
|
||||
private String name;
|
||||
private String description;
|
||||
private Long start_time;
|
||||
private Long end_time;
|
||||
private Long duration; // 持续时间(秒)
|
||||
private Long data_count; // 数据点数量
|
||||
private Date created_at;
|
||||
private Date updated_at;
|
||||
private String sync_id;
|
||||
List<TrajectoryData> trajectoryDataList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.corewing.app.dto.biz.appVersion;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class CheckVersionRequest {
|
||||
|
||||
@NotBlank(message = "版本不能为空")
|
||||
private String localVersion;
|
||||
|
||||
@NotBlank(message = "构建版本不能为空")
|
||||
private int localBuildNumber;
|
||||
|
||||
@NotBlank(message = "类型不能为空")
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.corewing.app.dto.biz.feedback;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FeedbackBatchDeleteRequest {
|
||||
|
||||
private List<Long> ids;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.corewing.app.dto.biz.feedback;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FeedbackBatchStatusRequest {
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.corewing.app.dto.biz.firmware;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FirmwareBatchDeleteRequest {
|
||||
private List<Long> ids;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.corewing.app.dto.biz.privacyPolicy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PrivacyPolicyBatchDeleteRequest {
|
||||
|
||||
private List<Long> ids;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.corewing.app.dto.biz.tutorial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BatchTutorialDeleteRequest {
|
||||
private List<Long> ids;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.corewing.app.dto.biz.tutorial;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CategoryBatchDeleteRequest {
|
||||
private List<Long> ids;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.corewing.app.dto.biz.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BizUserBatchDeleteRequest {
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.corewing.app.dto.biz.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BizUserIdRequest {
|
||||
private long id;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.corewing.app.dto.biz.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BizUserStatusRequest {
|
||||
private List<Long> ids;
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.corewing.app.dto.biz.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ResetPasswordRequest {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 新密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.corewing.app.dto.sys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysResetPasswordRequest {
|
||||
private Long userId;
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.corewing.app.dto.sys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysUserIdRequest {
|
||||
private Long id;
|
||||
}
|
||||
38
src/main/java/com/corewing/app/entity/AppVersion.java
Normal file
38
src/main/java/com/corewing/app/entity/AppVersion.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.corewing.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* app版本控制
|
||||
*/
|
||||
@Data
|
||||
@TableName("app_version")
|
||||
public class AppVersion {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String version;
|
||||
|
||||
private int versionNumber;
|
||||
|
||||
private int buildNumber;
|
||||
|
||||
private String updateContent;
|
||||
|
||||
private String downloadUrl;
|
||||
|
||||
private String type;
|
||||
|
||||
private Integer status;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
52
src/main/java/com/corewing/app/entity/ContactMsg.java
Normal file
52
src/main/java/com/corewing/app/entity/ContactMsg.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.corewing.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.corewing.app.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
/**
|
||||
* 联系消息
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("app_contact_msg")
|
||||
public class ContactMsg extends BaseEntity {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 咨询人
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 咨询类型
|
||||
*/
|
||||
private int category;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
private String contact;
|
||||
|
||||
/**
|
||||
* 咨询内容
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 咨询状态
|
||||
*/
|
||||
private int status;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -66,4 +66,34 @@ public class Feedback implements Serializable {
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String username;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String statusName;
|
||||
|
||||
public String getStatusName() {
|
||||
switch (status) {
|
||||
case 0:
|
||||
return "待处理";
|
||||
case 1:
|
||||
return "处理中";
|
||||
case 2:
|
||||
return "已完成";
|
||||
case 3:
|
||||
return "已关闭";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
62
src/main/java/com/corewing/app/entity/FeedbackLog.java
Normal file
62
src/main/java/com/corewing/app/entity/FeedbackLog.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.corewing.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 反馈日志
|
||||
*/
|
||||
@Data
|
||||
@TableName("app_feedback_log")
|
||||
public class FeedbackLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 反馈用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* oss地址
|
||||
*/
|
||||
private String ossPath;
|
||||
|
||||
/**
|
||||
* 日志文件大小
|
||||
*/
|
||||
private Long logSize;
|
||||
|
||||
/**
|
||||
* 反馈日志内容
|
||||
*/
|
||||
private String logContent;
|
||||
|
||||
/**
|
||||
* 日志文件名称
|
||||
*/
|
||||
private String logName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -61,4 +61,20 @@ public class Firmware implements Serializable {
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String firmwareTypeName;
|
||||
|
||||
public String getFirmwareTypeName() {
|
||||
switch (firmwareType) {
|
||||
case 1:
|
||||
return "调参固件";
|
||||
case 2:
|
||||
return "AP固件";
|
||||
case 3:
|
||||
return "INAV固件";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,21 @@ public class ParamsCenter implements Serializable {
|
||||
*/
|
||||
private Integer downloadCount;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private String auditStatus;
|
||||
|
||||
/**
|
||||
* 失败原因
|
||||
*/
|
||||
private String auditErrorMsg;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
48
src/main/java/com/corewing/app/entity/PrivacyPolicy.java
Normal file
48
src/main/java/com/corewing/app/entity/PrivacyPolicy.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.corewing.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.corewing.app.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 隐私政策实体
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("app_privacy_policy")
|
||||
public class PrivacyPolicy extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 隐私政策id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 隐私政策名称
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 隐私政策内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
private Integer visible;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private Integer category;
|
||||
}
|
||||
80
src/main/java/com/corewing/app/entity/ReplaySession.java
Normal file
80
src/main/java/com/corewing/app/entity/ReplaySession.java
Normal file
@@ -0,0 +1,80 @@
|
||||
package com.corewing.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.corewing.app.dto.api.TrajectoryData;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("app_replay_session")
|
||||
public class ReplaySession {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String syncId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* oss地址
|
||||
*/
|
||||
private String ossPath;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 开始时间戳
|
||||
*/
|
||||
private Long startTime;
|
||||
|
||||
/**
|
||||
* 结束时间戳
|
||||
*/
|
||||
private Long endTime;
|
||||
|
||||
/**
|
||||
* 持续时间
|
||||
*/
|
||||
private Long duration;
|
||||
|
||||
/**
|
||||
* 数据点
|
||||
*/
|
||||
private Long dataCount;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updatedAt;
|
||||
|
||||
/**
|
||||
* 轨迹数据点
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
List<TrajectoryData> trajectoryDataList;
|
||||
}
|
||||
57
src/main/java/com/corewing/app/entity/SysMenu.java
Normal file
57
src/main/java/com/corewing/app/entity/SysMenu.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.corewing.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.corewing.app.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("sys_menu")
|
||||
public class SysMenu extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 菜单id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 菜单地址
|
||||
*/
|
||||
private String menuUrl;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
private String menuIcon;
|
||||
|
||||
/**
|
||||
* 菜单分类
|
||||
*/
|
||||
private String menuCategory;
|
||||
|
||||
/**
|
||||
* 是否隐藏
|
||||
*/
|
||||
private boolean visible;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private int sort;
|
||||
|
||||
|
||||
|
||||
}
|
||||
31
src/main/java/com/corewing/app/entity/SysOption.java
Normal file
31
src/main/java/com/corewing/app/entity/SysOption.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.corewing.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.corewing.app.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("sys_option")
|
||||
public class SysOption extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 键名
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 键值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.corewing.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -39,6 +38,11 @@ public class Tutorial implements Serializable {
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 知识库地址
|
||||
*/
|
||||
private String knowledgeUrl;
|
||||
|
||||
/**
|
||||
* 查看次数
|
||||
*/
|
||||
@@ -62,12 +66,23 @@ public class Tutorial implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 教程分类id
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Long categoryId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String categoryName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.corewing.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 教程分类
|
||||
@@ -65,11 +65,19 @@ public class TutorialCategory implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
public static final String typeCategory = "category";
|
||||
public static final String typeTag = "tag";
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Tutorial> tutorials;
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ public class User implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
|
||||
@@ -50,10 +50,10 @@ public class GlobalExceptionHandler {
|
||||
* 处理其他异常
|
||||
*/
|
||||
@ExceptionHandler(Exception.class)
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
// @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public Result<String> handleException(Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error(HttpStatus.INTERNAL_SERVER_ERROR.value(),
|
||||
I18nUtil.getMessage("error.server.internal", e.getMessage()));
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.corewing.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.corewing.app.entity.AppVersion;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AppVersionMapper extends BaseMapper<AppVersion> {
|
||||
}
|
||||
10
src/main/java/com/corewing/app/mapper/ContactMsgMapper.java
Normal file
10
src/main/java/com/corewing/app/mapper/ContactMsgMapper.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.corewing.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.corewing.app.entity.ContactMsg;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ContactMsgMapper extends BaseMapper<ContactMsg> {
|
||||
|
||||
}
|
||||
10
src/main/java/com/corewing/app/mapper/FeedbackLogMapper.java
Normal file
10
src/main/java/com/corewing/app/mapper/FeedbackLogMapper.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.corewing.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.corewing.app.entity.FeedbackLog;
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FeedbackLogMapper extends BaseMapper<FeedbackLog> {
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.corewing.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.corewing.app.entity.Feedback;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 问题反馈 Mapper 接口
|
||||
@@ -10,4 +12,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface FeedbackMapper extends BaseMapper<Feedback> {
|
||||
|
||||
Page<Feedback> page(Page<Feedback> page, @Param("feedback") Feedback feedback);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.corewing.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.corewing.app.entity.PrivacyPolicy;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface PrivacyPolicyMapper extends BaseMapper<PrivacyPolicy> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.corewing.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.corewing.app.entity.ReplaySession;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ReplaySessionMapper extends BaseMapper<ReplaySession> {
|
||||
}
|
||||
9
src/main/java/com/corewing/app/mapper/SysMenuMapper.java
Normal file
9
src/main/java/com/corewing/app/mapper/SysMenuMapper.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.corewing.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.corewing.app.entity.SysMenu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.corewing.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.corewing.app.entity.SysOption;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysOptionMapper extends BaseMapper<SysOption> {
|
||||
}
|
||||
@@ -13,5 +13,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface TutorialMapper extends BaseMapper<Tutorial> {
|
||||
|
||||
Page<Tutorial> pageList(Page<Tutorial> page, @Param("categoryId") int categoryId, @Param("tutorialTitle") String tutorialTitle, @Param("lang") String lang);
|
||||
Page<Tutorial> pageList(Page<Tutorial> page, @Param("categoryId") Long categoryId, @Param("tutorialTitle") String tutorialTitle, @Param("lang") String lang);
|
||||
|
||||
Page<Tutorial> page(Page<Tutorial> page, @Param("tutorial") Tutorial tutorial);
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.corewing.app.modules.admin;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class SysMainController {
|
||||
|
||||
@GetMapping({"/", "/index.html"})
|
||||
public String loading() {
|
||||
return "/admin/loading";
|
||||
}
|
||||
|
||||
@GetMapping("/admin/login.html")
|
||||
public String login() {
|
||||
return "/admin/login";
|
||||
}
|
||||
|
||||
@GetMapping("/admin/index.html")
|
||||
public String adminIndex() {
|
||||
return "/admin/index";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.corewing.app.modules.admin.biz;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.biz.feedback.FeedbackBatchDeleteRequest;
|
||||
import com.corewing.app.dto.biz.feedback.FeedbackBatchStatusRequest;
|
||||
import com.corewing.app.entity.Feedback;
|
||||
import com.corewing.app.service.FeedbackService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户反馈
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/biz/feedback")
|
||||
public class BizFeedBackController {
|
||||
|
||||
@Resource
|
||||
private FeedbackService feedbackService;
|
||||
|
||||
/**
|
||||
* 反馈管理首页
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
public String index() {
|
||||
return "admin/biz/feedback/index";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询反馈数据分页
|
||||
* @param feedback
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ResponseBody
|
||||
public Result<Page<Feedback>> page(Feedback feedback) {
|
||||
return Result.success(feedbackService.page(feedback));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增反馈
|
||||
* @param feedback
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public Result<String> save(@RequestBody Feedback feedback) {
|
||||
return Result.isBool(feedbackService.save(feedback));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑反馈
|
||||
* @param feedback
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
public Result<String> update(@RequestBody Feedback feedback) {
|
||||
return Result.isBool(feedbackService.updateById(feedback));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除反馈
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
@ResponseBody
|
||||
public Result<String> delete(Long id) {
|
||||
return Result.isBool(feedbackService.removeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除反馈
|
||||
* @param feedbackBatchDeleteRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/batchDelete")
|
||||
@ResponseBody
|
||||
public Result<String> batchDelete(@RequestBody FeedbackBatchDeleteRequest feedbackBatchDeleteRequest) {
|
||||
return Result.isBool(feedbackService.removeBatchByIds(feedbackBatchDeleteRequest.getIds()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更改状态
|
||||
* @param feedbackBatchStatusRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/batchStatus")
|
||||
@ResponseBody
|
||||
public Result<String> batchStatus(@RequestBody FeedbackBatchStatusRequest feedbackBatchStatusRequest) {
|
||||
return Result.isBool(feedbackService.batchStatus(feedbackBatchStatusRequest));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.corewing.app.modules.admin.biz;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.biz.firmware.FirmwareBatchDeleteRequest;
|
||||
import com.corewing.app.entity.Firmware;
|
||||
import com.corewing.app.service.FirmwareService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 固件管理
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/biz/firmware")
|
||||
public class BizFirmwareController {
|
||||
|
||||
@Resource
|
||||
private FirmwareService firmwareService;
|
||||
|
||||
|
||||
/**
|
||||
* 固件管理首页
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
public String index() {
|
||||
return "admin/biz/firmware/index";
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param firmware
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ResponseBody
|
||||
public Result<Page<Firmware>> page(Firmware firmware) {
|
||||
return Result.success(firmwareService.page(firmware));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param firmware
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public Result<String> save(@RequestBody Firmware firmware) {
|
||||
return Result.isBool(firmwareService.save(firmware));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param firmware
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
public Result<String> update(@RequestBody Firmware firmware) {
|
||||
return Result.isBool(firmwareService.updateById(firmware));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
@ResponseBody
|
||||
public Result<Firmware> delete(Long id) {
|
||||
return Result.isBool(firmwareService.removeData(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param firmwareBatchDeleteRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/batchDelete")
|
||||
@ResponseBody
|
||||
public Result<Firmware> batchDelete(@RequestBody FirmwareBatchDeleteRequest firmwareBatchDeleteRequest) {
|
||||
return Result.isBool(firmwareService.removeBatchByIds(firmwareBatchDeleteRequest.getIds()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传固件
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/uploadFile")
|
||||
@ResponseBody
|
||||
public Result<String> uploadFile(MultipartFile file, Long id) {
|
||||
return Result.isBool(firmwareService.uploadFile(file, id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.corewing.app.modules.admin.biz;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.biz.privacyPolicy.PrivacyPolicyBatchDeleteRequest;
|
||||
import com.corewing.app.entity.PrivacyPolicy;
|
||||
import com.corewing.app.service.PrivacyPolicyService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 隐私政策
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/biz/privacy_policy")
|
||||
public class BizPrivacyPolicyController {
|
||||
|
||||
@Resource
|
||||
private PrivacyPolicyService privacyPolicyService;
|
||||
|
||||
@GetMapping("/index")
|
||||
public String index() {
|
||||
return "admin/biz/privacyPolicy/index";
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ResponseBody
|
||||
public Result<Page<PrivacyPolicy>> page(PrivacyPolicy privacyPolicy) {
|
||||
return Result.success(privacyPolicyService.page(privacyPolicy));
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public Result<String> save(@RequestBody PrivacyPolicy privacyPolicy) {
|
||||
return Result.isBool(privacyPolicyService.save(privacyPolicy));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
public Result<String> update(@RequestBody PrivacyPolicy privacyPolicy) {
|
||||
return Result.isBool(privacyPolicyService.updateById(privacyPolicy));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ResponseBody
|
||||
public Result<String> delete(Long id) {
|
||||
return Result.isBool(privacyPolicyService.removeById(id));
|
||||
}
|
||||
|
||||
@PostMapping("/batchDelete")
|
||||
@ResponseBody
|
||||
public Result<String> batchDelete(@RequestBody PrivacyPolicyBatchDeleteRequest privacyPolicyBatchDeleteRequest) {
|
||||
return Result.isBool(privacyPolicyService.removeBatchByIds(privacyPolicyBatchDeleteRequest.getIds()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.corewing.app.modules.admin.biz;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.biz.tutorial.CategoryBatchDeleteRequest;
|
||||
import com.corewing.app.entity.Tutorial;
|
||||
import com.corewing.app.entity.TutorialCategory;
|
||||
import com.corewing.app.service.TutorialCategoryService;
|
||||
import com.corewing.app.service.TutorialService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 教程指南
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/biz/tutorial")
|
||||
public class BizTutorialController {
|
||||
|
||||
@Resource
|
||||
private TutorialCategoryService tutorialCategoryService;
|
||||
|
||||
@Resource
|
||||
private TutorialService tutorialService;
|
||||
|
||||
|
||||
/**
|
||||
* 教程分页
|
||||
* @param tutorial
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ResponseBody
|
||||
public Result<Page<Tutorial>> page(Tutorial tutorial) {
|
||||
return Result.success(tutorialService.page(tutorial));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增教程
|
||||
* @param tutorial
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public Result<String> save(@RequestBody Tutorial tutorial) {
|
||||
return Result.isBool(tutorialService.save(tutorial));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新教程
|
||||
* @param tutorial
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
public Result<String> update(@RequestBody Tutorial tutorial) {
|
||||
return Result.isBool(tutorialService.update(tutorial));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除教程
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
@ResponseBody
|
||||
public Result<String> delete(Long id) {
|
||||
return Result.isBool(tutorialService.remove(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 教程管理首页
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
public String index() {
|
||||
return "admin/biz/tutorial/index";
|
||||
}
|
||||
|
||||
/**
|
||||
* 教程分类分页
|
||||
* @param tutorialCategory
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/category/page")
|
||||
@ResponseBody
|
||||
public Result<Page<TutorialCategory>> categoryPage(TutorialCategory tutorialCategory) {
|
||||
return Result.success(tutorialCategoryService.page(tutorialCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增教程分类
|
||||
* @param tutorialCategory
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/category/save")
|
||||
@ResponseBody
|
||||
public Result<String> saveCategory(@RequestBody TutorialCategory tutorialCategory) {
|
||||
tutorialCategory.setType(TutorialCategory.typeCategory);
|
||||
return Result.isBool(tutorialCategoryService.save(tutorialCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新教程分类
|
||||
* @param tutorialCategory
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/category/update")
|
||||
@ResponseBody
|
||||
public Result<String> updateCategory(@RequestBody TutorialCategory tutorialCategory) {
|
||||
return Result.isBool(tutorialCategoryService.updateById(tutorialCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除教程分类
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/category/delete")
|
||||
@ResponseBody
|
||||
public Result<String> deleteCategory(Long id) {
|
||||
return Result.isBool(tutorialCategoryService.removeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除教程分类
|
||||
* @param categoryBatchDeleteRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/category/batchDelete")
|
||||
@ResponseBody
|
||||
public Result<String> batchDeleteCategory(@RequestBody CategoryBatchDeleteRequest categoryBatchDeleteRequest) {
|
||||
return Result.isBool(tutorialCategoryService.removeBatchByIds(categoryBatchDeleteRequest.getIds()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.corewing.app.modules.admin.biz;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.biz.user.BizUserBatchDeleteRequest;
|
||||
import com.corewing.app.dto.biz.user.BizUserIdRequest;
|
||||
import com.corewing.app.dto.biz.user.BizUserStatusRequest;
|
||||
import com.corewing.app.dto.biz.user.ResetPasswordRequest;
|
||||
import com.corewing.app.entity.User;
|
||||
import com.corewing.app.service.UserService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/biz/user")
|
||||
public class BizUserController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 跳转到用户管理页面
|
||||
* @return 页面名称
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
public String index() {
|
||||
return "admin/biz/user/index";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页信息
|
||||
* @param user 用户搜索对象
|
||||
* @return 用户信息集合
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ResponseBody
|
||||
public Result<Page<User>> page(User user) {
|
||||
Page<User> sysUserPage = userService.page(user);
|
||||
return Result.success(sysUserPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param resetPasswordRequest 修改密码DTO
|
||||
* @return 成功 or 失败
|
||||
*/
|
||||
@PutMapping("/resetPassword")
|
||||
@ResponseBody
|
||||
public Result<String> resetPassword(@RequestBody ResetPasswordRequest resetPasswordRequest) {
|
||||
boolean flag = userService.resetPassword(resetPasswordRequest);
|
||||
return Result.isBoolAsMsg(flag, "修改密码成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public Result<String> save(@RequestBody User user) {
|
||||
return Result.isBool(userService.save(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
public Result<String> update(@RequestBody User user) {
|
||||
return Result.isBool(userService.update(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 单删用户
|
||||
* @param bizUserIdRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
@ResponseBody
|
||||
public Result<String> delete(@RequestBody BizUserIdRequest bizUserIdRequest) {
|
||||
return Result.isBool(userService.removeById(bizUserIdRequest.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/batchDelete")
|
||||
@ResponseBody
|
||||
public Result<String> batchDelete(@RequestBody BizUserBatchDeleteRequest bizUserBatchDeleteRequest) {
|
||||
return Result.isBool(userService.removeByIds(bizUserBatchDeleteRequest.getIds()));
|
||||
}
|
||||
|
||||
@PostMapping("/batchStatus")
|
||||
@ResponseBody
|
||||
public Result<String> batchStatus(@RequestBody BizUserStatusRequest bizUserStatusRequests) {
|
||||
return Result.isBool(userService.batchStatus(bizUserStatusRequests));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.corewing.app.modules.admin.sys;
|
||||
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.service.FirmwareService;
|
||||
import com.corewing.app.service.SysUserService;
|
||||
import com.corewing.app.service.UserService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class SysMainController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private FirmwareService firmwareService;
|
||||
|
||||
/**
|
||||
* 加载页
|
||||
* @return
|
||||
*/
|
||||
@GetMapping({"/", "/index.html"})
|
||||
public String loading() {
|
||||
return "admin/loading";
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录页
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/admin/login.html")
|
||||
public String login() {
|
||||
return "admin/login";
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台首页
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/admin/index.html")
|
||||
public String adminIndex() {
|
||||
return "admin/main";
|
||||
}
|
||||
|
||||
/**
|
||||
* 仪表盘
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/admin/dashboard")
|
||||
public String dashboard() {
|
||||
return "admin/dashboard";
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/main/statistics")
|
||||
@ResponseBody
|
||||
public Result<Map<String, Object>> statistics() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("userCount", userService.count ());
|
||||
result.put("firmwareCount", firmwareService.count());
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.corewing.app.modules.admin.sys;
|
||||
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.entity.SysMenu;
|
||||
import com.corewing.app.service.SysMenuService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/sys/menu")
|
||||
public class SysMenuController {
|
||||
|
||||
@Resource
|
||||
private SysMenuService sysMenuService;
|
||||
|
||||
@GetMapping("/initSysMenu")
|
||||
@ResponseBody
|
||||
public Result<List<SysMenu>> initSysMenu() {
|
||||
List<SysMenu> sysMenus = sysMenuService.initSysMenu();
|
||||
return Result.success(sysMenus);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.corewing.app.modules.admin.sys;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* 系统设置
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/sys/setting")
|
||||
public class SysSettingController {
|
||||
|
||||
@GetMapping
|
||||
public String index() {
|
||||
return "admin/sys/setting";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
package com.corewing.app.modules.admin;
|
||||
package com.corewing.app.modules.admin.sys;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.SysLoginRequest;
|
||||
import com.corewing.app.dto.api.SysLoginRequest;
|
||||
import com.corewing.app.dto.sys.SysResetPasswordRequest;
|
||||
import com.corewing.app.dto.sys.SysUserIdRequest;
|
||||
import com.corewing.app.entity.SysUser;
|
||||
import com.corewing.app.service.SysUserService;
|
||||
import com.corewing.app.util.I18nUtil;
|
||||
import com.corewing.app.util.IpUtil;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -16,7 +20,7 @@ import java.util.Map;
|
||||
/**
|
||||
* 后台管理用户 Controller
|
||||
*/
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/sys/user")
|
||||
public class SysUserController {
|
||||
|
||||
@@ -26,13 +30,49 @@ public class SysUserController {
|
||||
this.sysUserService = sysUserService;
|
||||
}
|
||||
|
||||
@GetMapping("/index")
|
||||
public String index() {
|
||||
return "admin/sys/user/index";
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ResponseBody
|
||||
public Result<Page<SysUser>> page(SysUser sysUser) {
|
||||
Page<SysUser> sysUserPage = sysUserService.page(sysUser);
|
||||
return Result.success(sysUserPage);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
public Result<String> update(@RequestBody SysUser sysUser) {
|
||||
return Result.isBool(sysUserService.update(sysUser));
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public Result<String> save(@RequestBody SysUser sysUser) {
|
||||
return Result.isBool(sysUserService.save(sysUser));
|
||||
}
|
||||
|
||||
@PutMapping("/resetPassword")
|
||||
@ResponseBody
|
||||
public Result<String> resetPassword(@RequestBody SysResetPasswordRequest sysResetPasswordRequest) {
|
||||
return Result.isBool(sysUserService.resetPassword(sysResetPasswordRequest));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ResponseBody
|
||||
public Result<String> delete(@RequestBody SysUserIdRequest sysUserIdRequest) {
|
||||
return Result.isBool(sysUserService.removeById(sysUserIdRequest.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台管理登录
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
@ResponseBody
|
||||
public Result<Map<String, Object>> login(@RequestBody SysLoginRequest request, HttpServletRequest httpRequest) {
|
||||
try {
|
||||
// 获取登录IP
|
||||
String loginIp = IpUtil.getClientIp(httpRequest);
|
||||
|
||||
// 执行登录
|
||||
@@ -57,6 +97,7 @@ public class SysUserController {
|
||||
* 后台管理登出
|
||||
*/
|
||||
@PostMapping("/logout")
|
||||
@ResponseBody
|
||||
public Result<String> logout() {
|
||||
StpUtil.logout();
|
||||
return Result.success(I18nUtil.getMessage("user.logout.success"));
|
||||
@@ -66,6 +107,7 @@ public class SysUserController {
|
||||
* 获取当前登录用户信息
|
||||
*/
|
||||
@GetMapping("/info")
|
||||
@ResponseBody
|
||||
public Result<SysUser> getUserInfo() {
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
SysUser user = sysUserService.getById(userId);
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.corewing.app.modules.app;
|
||||
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.entity.ContactMsg;
|
||||
import com.corewing.app.service.ContactMsgService;
|
||||
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.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/contactMsg")
|
||||
public class AppContactMsgController {
|
||||
|
||||
@Resource
|
||||
private ContactMsgService contactMsgService;
|
||||
|
||||
@PostMapping("/save")
|
||||
public Result<String> save(@RequestBody ContactMsg contactMsg) {
|
||||
return Result.isBool(contactMsgService.save(contactMsg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.FeedbackRequest;
|
||||
import com.corewing.app.dto.api.FeedbackRequest;
|
||||
import com.corewing.app.entity.Feedback;
|
||||
import com.corewing.app.service.FeedbackService;
|
||||
import com.corewing.app.util.DingTalkUtil;
|
||||
@@ -23,13 +23,13 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/feedback")
|
||||
public class FeedbackController {
|
||||
public class AppFeedbackController {
|
||||
|
||||
private final FeedbackService feedbackService;
|
||||
private final DingTalkUtil dingTalkUtil;
|
||||
private final Ip2RegionUtil ip2RegionUtil;
|
||||
|
||||
public FeedbackController(FeedbackService feedbackService, DingTalkUtil dingTalkUtil, Ip2RegionUtil ip2RegionUtil) {
|
||||
public AppFeedbackController(FeedbackService feedbackService, DingTalkUtil dingTalkUtil, Ip2RegionUtil ip2RegionUtil) {
|
||||
this.feedbackService = feedbackService;
|
||||
this.dingTalkUtil = dingTalkUtil;
|
||||
this.ip2RegionUtil = ip2RegionUtil;
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.corewing.app.modules.app;
|
||||
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.entity.FeedbackLog;
|
||||
import com.corewing.app.service.FeedbackLogService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 上传日志接口控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/feedback_log")
|
||||
public class AppFeedbackLogController {
|
||||
|
||||
@Resource
|
||||
private FeedbackLogService feedbackLogService;
|
||||
|
||||
/**
|
||||
* 上传日志
|
||||
* @param feedbackLog
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/uploadFeedbackLog")
|
||||
public Result<String> uploadFeedbackLog(MultipartFile file, FeedbackLog feedbackLog) {
|
||||
return Result.isBool(feedbackLogService.uploadFeedbackLog(file, feedbackLog));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,11 +15,11 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/firmware")
|
||||
public class FirmwareController {
|
||||
public class AppFirmwareController {
|
||||
|
||||
private final FirmwareService firmwareService;
|
||||
|
||||
public FirmwareController(FirmwareService firmwareService) {
|
||||
public AppFirmwareController(FirmwareService firmwareService) {
|
||||
this.firmwareService = firmwareService;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.CreateParamRequest;
|
||||
import com.corewing.app.dto.UpdateParamRequest;
|
||||
import com.corewing.app.dto.api.CreateParamRequest;
|
||||
import com.corewing.app.dto.api.UpdateParamRequest;
|
||||
import com.corewing.app.entity.ParamsCenter;
|
||||
import com.corewing.app.service.ParamsCenterService;
|
||||
import com.corewing.app.util.I18nUtil;
|
||||
@@ -20,11 +20,11 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/params")
|
||||
public class ParamsCenterController {
|
||||
public class AppParamsCenterController {
|
||||
|
||||
private final ParamsCenterService paramsService;
|
||||
|
||||
public ParamsCenterController(ParamsCenterService paramsService) {
|
||||
public AppParamsCenterController(ParamsCenterService paramsService) {
|
||||
this.paramsService = paramsService;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public class ParamsCenterController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有参数列表(公开接口,支持飞控型号过滤)
|
||||
* 查询所有公共参数列表(公开接口,支持飞控型号过滤)
|
||||
*/
|
||||
@GetMapping("/all/list")
|
||||
public Result<List<ParamsCenterVO>> listAll(@RequestParam(required = false) String fcModel) {
|
||||
@@ -230,4 +230,32 @@ public class ParamsCenterController {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交审核
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/review/{id}")
|
||||
public Result<String> review(@PathVariable Long id) {
|
||||
try {
|
||||
ParamsCenter params = paramsService.getById(id);
|
||||
if (params == null) {
|
||||
return Result.error(I18nUtil.getMessage("params.not.found"));
|
||||
}
|
||||
|
||||
// 提交审核
|
||||
ParamsCenter updateParams = new ParamsCenter();
|
||||
updateParams.setId(id);
|
||||
updateParams.setAuditStatus("1");
|
||||
updateParams.setAuditErrorMsg("");
|
||||
boolean success = paramsService.updateById(updateParams);
|
||||
if (success) {
|
||||
return Result.success(I18nUtil.getMessage("params.update.success"));
|
||||
}
|
||||
return Result.error(I18nUtil.getMessage("params.update.failed"));
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.corewing.app.modules.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.entity.PrivacyPolicy;
|
||||
import com.corewing.app.service.PrivacyPolicyService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
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.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 隐私政策与协议
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/privacy_policy")
|
||||
public class AppPrivacyPolicyController {
|
||||
|
||||
@Resource
|
||||
private PrivacyPolicyService privacyPolicyService;
|
||||
|
||||
/**
|
||||
* 隐私政策列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/view_list/{lang}")
|
||||
public String viewList(@PathVariable String lang, ModelMap modelMap) {
|
||||
List<PrivacyPolicy> list = privacyPolicyService.list();
|
||||
modelMap.put("list", list);
|
||||
// 获取最新更新时间
|
||||
modelMap.put("lastUpdateTime", privacyPolicyService.getLastUpdateTime());
|
||||
return "app/privacyPolicy/index";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型获取集合数据
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getListByCategory/{category}")
|
||||
@ResponseBody
|
||||
public Result<PrivacyPolicy> getListByCategory(@PathVariable Integer category) {
|
||||
LambdaQueryWrapper<PrivacyPolicy> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PrivacyPolicy::getCategory, category);
|
||||
return Result.success(privacyPolicyService.getOne(wrapper));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.corewing.app.modules.app;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.api.uploadReplaySessionRequest;
|
||||
import com.corewing.app.entity.ReplaySession;
|
||||
import com.corewing.app.service.ReplaySessionService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/replay-session")
|
||||
public class AppReplaySessionController {
|
||||
|
||||
@Resource
|
||||
private ReplaySessionService replaySessionService;
|
||||
|
||||
/**
|
||||
* 获取飞行记录
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getReplayList")
|
||||
public Result<List<ReplaySession>> getReplayList() {
|
||||
return Result.success(replaySessionService.getReplayList(StpUtil.getLoginId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传飞行记录
|
||||
* @param uploadReplaySessionRequests
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/uploadReplaySession")
|
||||
public Result<Boolean> uploadReplaySession(@RequestBody List<uploadReplaySessionRequest> uploadReplaySessionRequests) {
|
||||
return Result.isBool(replaySessionService.uploadReplaySession(uploadReplaySessionRequests));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据同步id删除数据
|
||||
* @param syncId
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/deleteReplaySession/{syncId}")
|
||||
public Result<Boolean> deleteReplaySession(@PathVariable String syncId) {
|
||||
return Result.isBool(replaySessionService.deleteReplaySession(syncId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.api.TutorialListRequest;
|
||||
import com.corewing.app.entity.Tutorial;
|
||||
import com.corewing.app.entity.TutorialCategory;
|
||||
import com.corewing.app.service.TutorialCategoryService;
|
||||
@@ -22,12 +23,12 @@ import java.util.List;
|
||||
@RequestMapping("/tutorial")
|
||||
@Controller
|
||||
@Slf4j
|
||||
public class TutorialController {
|
||||
public class AppTutorialController {
|
||||
|
||||
private final TutorialService tutorialService;
|
||||
private final TutorialCategoryService tutorialCategoryService;
|
||||
|
||||
public TutorialController(TutorialService tutorialService, TutorialCategoryService tutorialCategoryService) {
|
||||
public AppTutorialController(TutorialService tutorialService, TutorialCategoryService tutorialCategoryService) {
|
||||
this.tutorialService = tutorialService;
|
||||
this.tutorialCategoryService = tutorialCategoryService;
|
||||
}
|
||||
@@ -42,7 +43,7 @@ public class TutorialController {
|
||||
public String viewDetail(@PathVariable Long tutorialId, ModelMap model) {
|
||||
Tutorial tutorial = tutorialService.getById(tutorialId);
|
||||
model.put("tutorial", tutorial);
|
||||
return "/app/tutorial/viewDetail";
|
||||
return "app/tutorial/viewDetail";
|
||||
}
|
||||
|
||||
|
||||
@@ -96,16 +97,15 @@ public class TutorialController {
|
||||
public Result<IPage<Tutorial>> getPageList(
|
||||
@RequestParam(defaultValue = "1") Long current,
|
||||
@RequestParam(defaultValue = "10") Long size,
|
||||
@RequestParam(required = false, defaultValue = "0") Integer categoryId,
|
||||
@RequestParam(required = false, defaultValue = "0") Long categoryId,
|
||||
@RequestParam(required = false) String tutorialTitle) {
|
||||
try {
|
||||
Page<Tutorial> page = new Page<>(current, size);
|
||||
IPage<Tutorial> pageResult = tutorialService.pageList(page, categoryId, tutorialTitle, I18nUtil.getCurrentLocale().getLanguage());
|
||||
Page<Tutorial> pageResult = tutorialService.pageList(page, categoryId, tutorialTitle, I18nUtil.getCurrentLocale().getLanguage());
|
||||
return Result.success(pageResult);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
66
src/main/java/com/corewing/app/modules/app/UserController.java → src/main/java/com/corewing/app/modules/app/AppUserController.java
Normal file → Executable file
66
src/main/java/com/corewing/app/modules/app/UserController.java → src/main/java/com/corewing/app/modules/app/AppUserController.java
Normal file → Executable file
@@ -2,18 +2,18 @@ package com.corewing.app.modules.app;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.LoginRequest;
|
||||
import com.corewing.app.dto.RegisterRequest;
|
||||
import com.corewing.app.dto.SendCodeRequest;
|
||||
import com.corewing.app.dto.UpdatePasswordRequest;
|
||||
import com.corewing.app.dto.api.*;
|
||||
import com.corewing.app.dto.biz.user.ResetPasswordRequest;
|
||||
import com.corewing.app.entity.User;
|
||||
import com.corewing.app.service.UserService;
|
||||
import com.corewing.app.service.VerifyCodeService;
|
||||
import com.corewing.app.util.I18nUtil;
|
||||
import com.corewing.app.util.IpUtil;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -22,12 +22,12 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
public class AppUserController {
|
||||
|
||||
private final UserService userService;
|
||||
private final VerifyCodeService verifyCodeService;
|
||||
|
||||
public UserController(UserService userService, VerifyCodeService verifyCodeService) {
|
||||
public AppUserController(UserService userService, VerifyCodeService verifyCodeService) {
|
||||
this.userService = userService;
|
||||
this.verifyCodeService = verifyCodeService;
|
||||
}
|
||||
@@ -132,11 +132,12 @@ public class UserController {
|
||||
/**
|
||||
* 更新用户信息
|
||||
*/
|
||||
@PutMapping
|
||||
@PutMapping("/update")
|
||||
public Result<String> update(@RequestBody User user) {
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
user.setId(userId);
|
||||
// 不允许通过此接口修改密码
|
||||
user.setPassword(null);
|
||||
|
||||
boolean success = userService.updateById(user);
|
||||
if (success) {
|
||||
return Result.success(I18nUtil.getMessage("user.update.success"));
|
||||
@@ -173,4 +174,53 @@ public class UserController {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 忘记密码
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/forgetPassword")
|
||||
public Result<String> forgetPassword(@RequestBody ForgetPasswordRequest request) {
|
||||
return Result.isBool(userService.forgetPassword(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证码登录
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/codeLogin")
|
||||
public Result<Map<String, Object>> codeLogin(@RequestBody CodeLoginRequest codeLoginRequest, HttpServletRequest request) {
|
||||
|
||||
String token = userService.codeLogin(codeLoginRequest);
|
||||
// 更新登录IP和归属地
|
||||
User user = userService.getByAccount(codeLoginRequest.getAccount());
|
||||
String loginIp = IpUtil.getClientIp(request);
|
||||
userService.updateLoginInfo(user.getId(), loginIp);
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("token", token);
|
||||
data.put("userId", user.getId());
|
||||
data.put("username", user.getUsername());
|
||||
return Result.success(I18nUtil.getMessage("user.login.success"), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销用户
|
||||
* @param logoffRequest
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
public Result<String> logoff(@RequestBody @Valid LogoffRequest logoffRequest) {
|
||||
return Result.isBool(userService.logoff(logoffRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销发送验证码
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/delete/sendCode")
|
||||
public Result<Map<String, String>> deleteSendCode() {
|
||||
return userService.deleteSendCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.corewing.app.modules.app;
|
||||
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.biz.appVersion.CheckVersionRequest;
|
||||
import com.corewing.app.entity.AppVersion;
|
||||
import com.corewing.app.service.AppVersionService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* app升级校验接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app_version")
|
||||
public class AppVersionController {
|
||||
|
||||
@Resource
|
||||
private AppVersionService appVersionService;
|
||||
|
||||
/**
|
||||
* 校验是否存在新版本
|
||||
* @param checkVersionRequest
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/checkUpdate")
|
||||
public Result<Object> checkUpdate(CheckVersionRequest checkVersionRequest) {
|
||||
AppVersion version = appVersionService.getNewAppVersion(checkVersionRequest);
|
||||
if(version == null) {
|
||||
return Result.error("暂无新版本");
|
||||
}
|
||||
return Result.success(version);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.corewing.app.modules.directive;
|
||||
|
||||
import com.corewing.app.service.SysOptionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service("option")
|
||||
public class SysOptionDirective {
|
||||
|
||||
@Resource
|
||||
private SysOptionService sysOptionService;
|
||||
|
||||
public String getValue(String key) {
|
||||
return sysOptionService.getValueByKey(key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.dto.biz.appVersion.CheckVersionRequest;
|
||||
import com.corewing.app.entity.AppVersion;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
public interface AppVersionService extends IService<AppVersion> {
|
||||
|
||||
AppVersion getNewAppVersion(@Valid CheckVersionRequest checkVersionRequest);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.entity.ContactMsg;
|
||||
|
||||
public interface ContactMsgService extends IService<ContactMsg> {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.entity.FeedbackLog;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface FeedbackLogService extends IService<FeedbackLog> {
|
||||
|
||||
boolean uploadFeedbackLog(MultipartFile file, FeedbackLog feedbackLog);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.corewing.app.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.dto.biz.feedback.FeedbackBatchStatusRequest;
|
||||
import com.corewing.app.entity.Feedback;
|
||||
|
||||
import java.util.List;
|
||||
@@ -12,6 +13,9 @@ import java.util.List;
|
||||
*/
|
||||
public interface FeedbackService extends IService<Feedback> {
|
||||
|
||||
Page<Feedback> page(Feedback feedback);
|
||||
|
||||
|
||||
/**
|
||||
* 创建反馈
|
||||
*
|
||||
@@ -47,4 +51,11 @@ public interface FeedbackService extends IService<Feedback> {
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateStatus(Long id, Integer status);
|
||||
|
||||
/**
|
||||
* 批量修改状态
|
||||
* @param feedbackBatchStatusRequest
|
||||
* @return
|
||||
*/
|
||||
boolean batchStatus(FeedbackBatchStatusRequest feedbackBatchStatusRequest);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.entity.Firmware;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 固件 Service 接口
|
||||
*/
|
||||
public interface FirmwareService extends IService<Firmware> {
|
||||
|
||||
/**
|
||||
* 查询固件分页数据
|
||||
* @param firmware
|
||||
* @return
|
||||
*/
|
||||
Page<Firmware> page(Firmware firmware);
|
||||
|
||||
/**
|
||||
* 根据固件名称查询固件
|
||||
*
|
||||
@@ -15,4 +25,19 @@ public interface FirmwareService extends IService<Firmware> {
|
||||
* @return 固件信息
|
||||
*/
|
||||
Firmware getByFirmwareName(String firmwareName);
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param file
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean uploadFile(MultipartFile file, Long id);
|
||||
|
||||
/**
|
||||
* 根据id删除固件
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean removeData(Long id);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.entity.PrivacyPolicy;
|
||||
|
||||
public interface PrivacyPolicyService extends IService<PrivacyPolicy> {
|
||||
|
||||
Page<PrivacyPolicy> page(PrivacyPolicy privacyPolicy);
|
||||
|
||||
String getLastUpdateTime();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.dto.api.uploadReplaySessionRequest;
|
||||
import com.corewing.app.entity.ReplaySession;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface ReplaySessionService extends IService<ReplaySession> {
|
||||
|
||||
List<ReplaySession> getReplayList(Object loginId);
|
||||
|
||||
boolean uploadReplaySession(List<uploadReplaySessionRequest> uploadReplaySessionRequests);
|
||||
|
||||
boolean deleteReplaySession(String syncId);
|
||||
}
|
||||
10
src/main/java/com/corewing/app/service/SysMenuService.java
Normal file
10
src/main/java/com/corewing/app/service/SysMenuService.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.entity.SysMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysMenuService extends IService<SysMenu> {
|
||||
List<SysMenu> initSysMenu();
|
||||
}
|
||||
10
src/main/java/com/corewing/app/service/SysOptionService.java
Normal file
10
src/main/java/com/corewing/app/service/SysOptionService.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.entity.SysOption;
|
||||
|
||||
public interface SysOptionService extends IService<SysOption> {
|
||||
|
||||
String getValueByKey(String key);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.dto.sys.SysResetPasswordRequest;
|
||||
import com.corewing.app.entity.SysUser;
|
||||
|
||||
/**
|
||||
@@ -8,6 +10,12 @@ import com.corewing.app.entity.SysUser;
|
||||
*/
|
||||
public interface SysUserService extends IService<SysUser> {
|
||||
|
||||
Page<SysUser> page(SysUser sysUser);
|
||||
|
||||
boolean save(SysUser sysUser);
|
||||
|
||||
boolean update(SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 根据用户名查询用户
|
||||
*
|
||||
@@ -33,4 +41,11 @@ public interface SysUserService extends IService<SysUser> {
|
||||
* @param loginIp 登录IP
|
||||
*/
|
||||
void updateLoginInfo(Long userId, String loginIp);
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param sysResetPasswordRequest
|
||||
* @return
|
||||
*/
|
||||
boolean resetPassword(SysResetPasswordRequest sysResetPasswordRequest);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.entity.TutorialCategory;
|
||||
|
||||
public interface TutorialCategoryService extends IService<TutorialCategory> {
|
||||
|
||||
Page<TutorialCategory> page(TutorialCategory tutorialCategory);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,21 @@ package com.corewing.app.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.dto.api.TutorialListRequest;
|
||||
import com.corewing.app.entity.Tutorial;
|
||||
import com.corewing.app.entity.TutorialCategory;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TutorialService extends IService<Tutorial> {
|
||||
IPage<Tutorial> pageList(Page<Tutorial> page, int categoryId, String tutorialTitle, String lang);
|
||||
Page<Tutorial> pageList(Page<Tutorial> page, Long categoryId, String tutorialTitle, String lang);
|
||||
|
||||
Page<Tutorial> page(Tutorial tutorial);
|
||||
|
||||
boolean save(Tutorial tutorial);
|
||||
|
||||
boolean update(Tutorial tutorial);
|
||||
|
||||
boolean remove(Long id);
|
||||
}
|
||||
|
||||
72
src/main/java/com/corewing/app/service/UserService.java
Normal file → Executable file
72
src/main/java/com/corewing/app/service/UserService.java
Normal file → Executable file
@@ -1,13 +1,44 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.dto.api.CodeLoginRequest;
|
||||
import com.corewing.app.dto.api.ForgetPasswordRequest;
|
||||
import com.corewing.app.dto.api.LogoffRequest;
|
||||
import com.corewing.app.dto.biz.user.BizUserStatusRequest;
|
||||
import com.corewing.app.dto.biz.user.ResetPasswordRequest;
|
||||
import com.corewing.app.entity.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 应用用户 Service 接口
|
||||
*/
|
||||
public interface UserService extends IService<User> {
|
||||
|
||||
/**
|
||||
* 获取用户分页数据
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
Page<User> page(User user);
|
||||
|
||||
/**
|
||||
* 新增用户数据
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
boolean save(User user);
|
||||
|
||||
/**
|
||||
* 更新用户数据
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
boolean update(User user);
|
||||
|
||||
/**
|
||||
* 根据用户名查询用户
|
||||
*
|
||||
@@ -74,4 +105,45 @@ public interface UserService extends IService<User> {
|
||||
* @param loginIp 登录IP
|
||||
*/
|
||||
void updateLoginInfo(Long userId, String loginIp);
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param resetPasswordRequest
|
||||
* @return
|
||||
*/
|
||||
boolean resetPassword(ResetPasswordRequest resetPasswordRequest);
|
||||
|
||||
/**
|
||||
* 批量修改状态
|
||||
* @param bizUserStatusRequest
|
||||
* @return
|
||||
*/
|
||||
boolean batchStatus(BizUserStatusRequest bizUserStatusRequest);
|
||||
|
||||
/**
|
||||
* 忘记密码
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
boolean forgetPassword(ForgetPasswordRequest request);
|
||||
|
||||
/**
|
||||
* 验证码登录
|
||||
* @param codeLoginRequest
|
||||
* @return
|
||||
*/
|
||||
String codeLogin(CodeLoginRequest codeLoginRequest);
|
||||
|
||||
/**
|
||||
* 注销用户
|
||||
* @param logoffRequest
|
||||
* @return
|
||||
*/
|
||||
boolean logoff(LogoffRequest logoffRequest);
|
||||
|
||||
/**
|
||||
* 删除发送验证码
|
||||
* @return
|
||||
*/
|
||||
Result<Map<String, String>> deleteSendCode();
|
||||
}
|
||||
|
||||
0
src/main/java/com/corewing/app/service/VerifyCodeService.java
Normal file → Executable file
0
src/main/java/com/corewing/app/service/VerifyCodeService.java
Normal file → Executable file
@@ -0,0 +1,31 @@
|
||||
package com.corewing.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.corewing.app.dto.biz.appVersion.CheckVersionRequest;
|
||||
import com.corewing.app.entity.AppVersion;
|
||||
import com.corewing.app.mapper.AppVersionMapper;
|
||||
import com.corewing.app.service.AppVersionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements AppVersionService {
|
||||
|
||||
@Override
|
||||
public AppVersion getNewAppVersion(CheckVersionRequest checkVersionRequest) {
|
||||
// int checkVersionNumber = Integer.parseInt(checkVersionRequest.getLocalVersion().replace(".", ""));
|
||||
LambdaQueryWrapper<AppVersion> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.gt(AppVersion::getBuildNumber, checkVersionRequest.getLocalBuildNumber());
|
||||
wrapper.eq(AppVersion::getType, checkVersionRequest.getType());
|
||||
wrapper.eq(AppVersion::getStatus, 1);
|
||||
wrapper.orderByDesc(AppVersion::getVersionNumber, AppVersion::getBuildNumber);
|
||||
wrapper.last("limit 1");
|
||||
List<AppVersion> list = list(wrapper);
|
||||
if (list == null || list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.corewing.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.corewing.app.entity.ContactMsg;
|
||||
import com.corewing.app.mapper.ContactMsgMapper;
|
||||
import com.corewing.app.service.ContactMsgService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ContactMsgServiceImpl extends ServiceImpl<ContactMsgMapper, ContactMsg> implements ContactMsgService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.corewing.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.corewing.app.entity.FeedbackLog;
|
||||
import com.corewing.app.mapper.FeedbackLogMapper;
|
||||
import com.corewing.app.service.FeedbackLogService;
|
||||
import com.corewing.app.util.OSSUploadUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Service
|
||||
public class FeedbackLogServiceImpl extends ServiceImpl<FeedbackLogMapper, FeedbackLog> implements FeedbackLogService {
|
||||
|
||||
@Override
|
||||
public boolean uploadFeedbackLog(MultipartFile file, FeedbackLog feedbackLog) {
|
||||
|
||||
feedbackLog.setLogSize(file.getSize());
|
||||
feedbackLog.setLogName(feedbackLog.getUserId() + "_" + file.getOriginalFilename());
|
||||
|
||||
try {
|
||||
String ossPath = OSSUploadUtil.uploadFile(file.getInputStream(), "feedback_log/" + feedbackLog.getLogName());
|
||||
feedbackLog.setOssPath(ossPath);
|
||||
return save(feedbackLog);
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,44 @@
|
||||
package com.corewing.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.corewing.app.common.page.PageContext;
|
||||
import com.corewing.app.dto.biz.feedback.FeedbackBatchStatusRequest;
|
||||
import com.corewing.app.entity.Feedback;
|
||||
import com.corewing.app.mapper.FeedbackMapper;
|
||||
import com.corewing.app.service.FeedbackService;
|
||||
import com.corewing.app.util.I18nUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static io.lettuce.core.GeoArgs.Unit.m;
|
||||
|
||||
/**
|
||||
* 问题反馈 Service 实现类
|
||||
*/
|
||||
@Service
|
||||
public class FeedbackServiceImpl extends ServiceImpl<FeedbackMapper, Feedback> implements FeedbackService {
|
||||
|
||||
@Resource
|
||||
private FeedbackMapper feedbackMapper;
|
||||
|
||||
@Override
|
||||
public Page<Feedback> page(Feedback feedback) {
|
||||
Page<Feedback> page = PageContext.getPage(Feedback.class);
|
||||
// LambdaQueryWrapper<Feedback> wrapper = new LambdaQueryWrapper<>();
|
||||
// wrapper.eq(feedback.getStatus() != null, Feedback::getStatus, feedback.getStatus());
|
||||
// wrapper.like(StringUtils.hasText(feedback.getTitle()), Feedback::getTitle, feedback.getTitle());
|
||||
// wrapper.eq(StringUtils.hasText(feedback.getFeedbackType()), Feedback::getFeedbackType, feedback.getFeedbackType());
|
||||
return feedbackMapper.page(page, feedback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createFeedback(Feedback feedback) {
|
||||
// 设置默认状态为待处理
|
||||
@@ -75,4 +95,16 @@ public class FeedbackServiceImpl extends ServiceImpl<FeedbackMapper, Feedback> i
|
||||
|
||||
return this.updateById(feedback);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean batchStatus(FeedbackBatchStatusRequest feedbackBatchStatusRequest) {
|
||||
feedbackBatchStatusRequest.getIds().forEach(id -> {
|
||||
LambdaUpdateWrapper<Feedback> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(Feedback::getId, id);
|
||||
wrapper.set(Feedback::getStatus, feedbackBatchStatusRequest.getStatus());
|
||||
update(wrapper);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
package com.corewing.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.corewing.app.common.page.PageContext;
|
||||
import com.corewing.app.entity.Firmware;
|
||||
import com.corewing.app.mapper.FirmwareMapper;
|
||||
import com.corewing.app.service.FirmwareService;
|
||||
import com.corewing.app.util.OSSUploadUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 固件 Service 实现类
|
||||
@@ -13,10 +21,91 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class FirmwareServiceImpl extends ServiceImpl<FirmwareMapper, Firmware> implements FirmwareService {
|
||||
|
||||
@Override
|
||||
public Page<Firmware> page(Firmware firmware) {
|
||||
Page<Firmware> page = PageContext.getPage(Firmware.class);
|
||||
LambdaQueryWrapper<Firmware> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.hasText(firmware.getFirmwareName()), Firmware::getFirmwareName, firmware.getFirmwareName());
|
||||
queryWrapper.eq(firmware.getFirmwareType() != null, Firmware::getFirmwareType, firmware.getFirmwareType());
|
||||
return page(page, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Firmware getByFirmwareName(String firmwareName) {
|
||||
LambdaQueryWrapper<Firmware> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Firmware::getFirmwareName, firmwareName);
|
||||
return this.getOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean uploadFile(MultipartFile file, Long id) {
|
||||
try {
|
||||
String downloadUrl = OSSUploadUtil.uploadFile(file.getInputStream(), file.getOriginalFilename());
|
||||
Firmware firmware = getById(id);
|
||||
firmware.setFirmwareSize(file.getSize());
|
||||
firmware.setDownloadUrl(downloadUrl);
|
||||
return updateById(firmware);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean removeData(Long id) {
|
||||
Firmware firmware = getById(id);
|
||||
if(firmware != null ){
|
||||
if(firmware.getDownloadUrl() != null) {
|
||||
OSSUploadUtil.deleteFile(getUrlLastSegment(firmware.getDownloadUrl()));
|
||||
}
|
||||
return removeById(id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 URL 路径的最后一节(忽略查询参数 ? 和锚点 #)
|
||||
* @param urlStr URL字符串
|
||||
* @return 最后一节(如文件名、资源ID),异常/无路径时返回空字符串
|
||||
*/
|
||||
public static String getUrlLastSegment(String urlStr) {
|
||||
// 1. 空值判断
|
||||
if (urlStr == null || urlStr.trim().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 2. 移除查询参数(? 及后面的内容)
|
||||
int queryIndex = urlStr.indexOf('?');
|
||||
if (queryIndex != -1) {
|
||||
urlStr = urlStr.substring(0, queryIndex);
|
||||
}
|
||||
|
||||
// 3. 移除锚点(# 及后面的内容)
|
||||
int anchorIndex = urlStr.indexOf('#');
|
||||
if (anchorIndex != -1) {
|
||||
urlStr = urlStr.substring(0, anchorIndex);
|
||||
}
|
||||
|
||||
// 4. 找到最后一个 "/" 的位置
|
||||
int lastSlashIndex = urlStr.lastIndexOf('/');
|
||||
|
||||
// 5. 处理特殊情况:无 "/" 或 "/" 在末尾
|
||||
if (lastSlashIndex == -1) {
|
||||
// 无路径(如 "https://example.com" 或 "example.com")
|
||||
return "";
|
||||
}
|
||||
if (lastSlashIndex == urlStr.length() - 1) {
|
||||
// 路径以 "/" 结尾(如 "https://example.com/folder/"),需找倒数第二个 "/"
|
||||
urlStr = urlStr.substring(0, lastSlashIndex);
|
||||
lastSlashIndex = urlStr.lastIndexOf('/');
|
||||
// 若倒数第二个 "/" 不存在(如 "https://example.com/"),返回空
|
||||
if (lastSlashIndex == -1) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// 6. 截取最后一个 "/" 后面的内容
|
||||
return urlStr.substring(lastSlashIndex + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user