Compare commits
3
Commits
bdaff206f2
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0843049b5a | ||
|
|
7025c84a58 | ||
|
|
4276942ca4 |
@@ -1,7 +1,5 @@
|
||||
# Add directories or file patterns to ignore during indexing (e.g. foo/ or *.csv)
|
||||
# Project exclude paths
|
||||
/Noodles-Detector/target/
|
||||
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
# Project exclude paths
|
||||
/Noodles-Detector/target/
|
||||
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
@@ -1,124 +1,16 @@
|
||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">Noodles</h1>
|
||||
<h4 align="center">基于SpringBoot的轻量服务(器)管理系统</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Mzaxd/Noodles"><img src="https://img.shields.io/badge/%E4%B8%BB%E9%A1%B5-Mzaxd%2FNoodles-orange"></a>
|
||||
<a href="https://github.com/Mzaxd/Noodles/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
||||
</p>
|
||||
|
||||
|
||||
# 百盘搜
|
||||
|
||||
## 这个项目是做什么的?
|
||||
|
||||
随着个人服务器(Nas/微云盘/软路由)的飞速发展,个人用户拥有多台不同厂家、不同系统服务器的情况越来越多。另一方面随着虚拟机和容器的大量应用,使得个人用户~~(我)~~对于指数上升的管理难度应接不暇。
|
||||
- 网盘聚合搜索器
|
||||
1.自动搜索对应的网盘资源(多种网盘,包括百度网盘,UC网盘,迅雷云盘,夸克网盘)然后转存到我的对应网盘的账号后,将分享链接返回。
|
||||
2.一个强大的搜索入口,高度扩展性,可以扩展各种网盘,返回对应网盘的分享链接,接口速度快,多级缓存。
|
||||
- 常见社交平台推广下载链接
|
||||
类似B站这样的平台,可以自动发现某个类型的视频,然后将所有资料整理,自动转存后形成分享链接,并且自动评论到评论区。
|
||||
|
||||
本项目就是为了解决我在使用我个人的多台服务器时发现的一些问题,比如:
|
||||
## 功能模块
|
||||
|
||||
- Windows Server这种`没有原生管理平台`,无法直接通过Web查看状态的系统
|
||||
- 物理机上使用虚拟机,虚拟机上再使用容器,多层虚拟导致最后记不清宿主关系而`误删除`的情况
|
||||
- 统一的掉线提醒。有些管理平台有多种掉线提醒(Unraid),有些没有,有些`配置麻烦`。
|
||||
- ……
|
||||
|
||||
|
||||
|
||||
## 技术栈?
|
||||
|
||||
### 主要框架
|
||||
|
||||
| 技术 | 说明 | 官网 |
|
||||
|----------------|---------|------------------------------------------------------------------------------------------|
|
||||
| SpringBoot | 后端框架 | [https://spring.io/projects/spring-boot](https://spring.io/projects/spring-boot) |
|
||||
| SpringSecurity | 登录认证 | [https://spring.io/projects/spring-security](https://spring.io/projects/spring-security) |
|
||||
| jjwt | 生成Token | [https://github.com/jwtk/jjwt](https://github.com/jwtk/jjwt) |
|
||||
| MyBatis-Plus | ORM框架 | [https://baomidou.com/pages/24112f/](https://baomidou.com/pages/24112f/) |
|
||||
| oshi-core | 获取本机信息 | [https://github.com/oshi/oshi](https://github.com/oshi/oshi) |
|
||||
| hutool-all | 工具包 | [https://github.com/dromara/hutool](https://github.com/dromara/hutool) |
|
||||
| jsch | 连接控制台 | [http://www.jcraft.com/jsch/](http://www.jcraft.com/jsch/) |
|
||||
|
||||
### 中间件&其他服务
|
||||
|
||||
- MySQL8
|
||||
- RabbitMq
|
||||
- Redis
|
||||
|
||||
|
||||
|
||||
## 都有什么功能?
|
||||
|
||||
1. 服务管理:配置管理所有服务。
|
||||
2. 物理机管理:配置管理所有的物理服务器。
|
||||
3. 虚拟机管理:配置管理所有的虚拟机。
|
||||
4. 容器管理:配置管理所有的容器。
|
||||
5. 账号管理:包括默认账号的更改,删除账号等。
|
||||
6. 远程控制台:连接任意一台配置了连接信息的实例。
|
||||
7. JVM监控:实时监控本机JVM运行环境。
|
||||
8. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
|
||||
9. 用户日志:记录用户信息的所有修改。
|
||||
10. 掉线提醒:提供多种实例掉线提醒。
|
||||
11. 物理机监控:实时监视所有物理机的CPU、内存、磁盘、等相关信息。
|
||||
|
||||
|
||||
|
||||
## 如何安装?
|
||||
|
||||
1. 拉取本项目
|
||||
|
||||
```bash
|
||||
git clone
|
||||
```
|
||||
|
||||
2. 导入MySQL数据库文件
|
||||
|
||||
3. 在对应的application-xxx.yml中配置连接信息
|
||||
|
||||
```yaml
|
||||
server:
|
||||
port: xxxx
|
||||
spring:
|
||||
#MySQL配置
|
||||
datasource:
|
||||
url: jdbc:mysql://xxxx/xxxx?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: xxxx
|
||||
password: xxxx
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
#Redis配置
|
||||
redis:
|
||||
host: xxxx
|
||||
database: x
|
||||
#RabbitMq配置
|
||||
rabbitmq:
|
||||
host: xxxx
|
||||
port: xxxx
|
||||
username: xxxxxx
|
||||
password: xxxxxx
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 如何使用?
|
||||
|
||||
[文档地址](https://mzaxd.github.io/2023/04/22/Noodles%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/)
|
||||
|
||||
|
||||
|
||||
## 一些演示图
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
1. 云盘管理(设计上是四种云盘,但目前只支持百度云盘)
|
||||
2. 资源管理
|
||||
3. 评论管理(评论时间,评论的链接要能跳转看到)
|
||||
4. 日志管理(都搜索了什么,要记录下来)
|
||||
@@ -140,6 +140,15 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
<excludes>
|
||||
<exclude>**/*.exe</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
package com.mzaxd.bps.aspect;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mzaxd.bps.annotation.SysLog;
|
||||
import com.mzaxd.bps.domain.entity.AuditLog;
|
||||
import com.mzaxd.bps.service.AuditLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@@ -23,46 +12,46 @@ import java.lang.reflect.Method;
|
||||
@Slf4j
|
||||
public class SysLogAspect {
|
||||
|
||||
@Resource
|
||||
private AuditLogService auditLogService;
|
||||
|
||||
@Pointcut("@annotation(com.mzaxd.bps.annotation.SysLog)")
|
||||
public void logPointCut() {
|
||||
|
||||
}
|
||||
|
||||
//方法执行前后都操作
|
||||
@Around("logPointCut()")
|
||||
public Object around(ProceedingJoinPoint point) throws Throwable {
|
||||
//执行方法
|
||||
Object result = point.proceed();
|
||||
//保存日志
|
||||
saveSysLog(point);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void saveSysLog(ProceedingJoinPoint joinPoint) {
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
|
||||
AuditLog auditLog = new AuditLog();
|
||||
SysLog syslog = method.getAnnotation(SysLog.class);
|
||||
if (syslog != null) {
|
||||
//注解上的描述
|
||||
auditLog.setOperation(syslog.operation().getOperation());
|
||||
auditLog.setOperationType(syslog.operation().getOperationType());
|
||||
}
|
||||
|
||||
//请求的参数
|
||||
Object[] args = joinPoint.getArgs();
|
||||
try {
|
||||
String params = JSON.toJSONString(args);
|
||||
auditLog.setParam(params);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
//保存系统日志
|
||||
auditLogService.save(auditLog);
|
||||
}
|
||||
// @Resource
|
||||
// private AuditLogService auditLogService;
|
||||
//
|
||||
// @Pointcut("@annotation(com.mzaxd.bps.annotation.SysLog)")
|
||||
// public void logPointCut() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //方法执行前后都操作
|
||||
// @Around("logPointCut()")
|
||||
// public Object around(ProceedingJoinPoint point) throws Throwable {
|
||||
// //执行方法
|
||||
// Object result = point.proceed();
|
||||
// //保存日志
|
||||
// saveSysLog(point);
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// private void saveSysLog(ProceedingJoinPoint joinPoint) {
|
||||
// MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
// Method method = signature.getMethod();
|
||||
//
|
||||
// AuditLog auditLog = new AuditLog();
|
||||
// SysLog syslog = method.getAnnotation(SysLog.class);
|
||||
// if (syslog != null) {
|
||||
// //注解上的描述
|
||||
// auditLog.setOperation(syslog.operation().getOperation());
|
||||
// auditLog.setOperationType(syslog.operation().getOperationType());
|
||||
// }
|
||||
//
|
||||
// //请求的参数
|
||||
// Object[] args = joinPoint.getArgs();
|
||||
// try {
|
||||
// String params = JSON.toJSONString(args);
|
||||
// auditLog.setParam(params);
|
||||
// } catch (Exception e) {
|
||||
// log.error(e.getMessage());
|
||||
// }
|
||||
//
|
||||
// //保存系统日志
|
||||
// auditLogService.save(auditLog);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mzaxd.bps.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 文件上传配置
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "file")
|
||||
public class FileConfig {
|
||||
|
||||
/**
|
||||
* 上传路径
|
||||
*/
|
||||
private String uploadPath;
|
||||
|
||||
/**
|
||||
* 访问路径
|
||||
*/
|
||||
private String accessPath;
|
||||
|
||||
public String getUploadPath() {
|
||||
return uploadPath;
|
||||
}
|
||||
|
||||
public void setUploadPath(String uploadPath) {
|
||||
this.uploadPath = uploadPath;
|
||||
}
|
||||
|
||||
public String getAccessPath() {
|
||||
return accessPath;
|
||||
}
|
||||
|
||||
public void setAccessPath(String accessPath) {
|
||||
this.accessPath = accessPath;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.mzaxd.bps.constant;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
public class UrlConstant {
|
||||
|
||||
/**
|
||||
* 协议
|
||||
*/
|
||||
public static final String PROTOCOL = "protocol";
|
||||
|
||||
/**
|
||||
* ip
|
||||
*/
|
||||
public static final String IP = "IP";
|
||||
|
||||
/**
|
||||
* 端口号
|
||||
*/
|
||||
public static final String PORT = "port";
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.bps.annotation.SysLog;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.mzaxd.bps.enums.OperationEnum;
|
||||
import com.mzaxd.bps.service.LoginService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
public class AuthController {
|
||||
|
||||
@Resource
|
||||
private LoginService loginService;
|
||||
|
||||
@PostMapping("/login")
|
||||
public ResponseResult<?> login(@RequestBody User user) {
|
||||
return loginService.login(user);
|
||||
}
|
||||
|
||||
@SysLog(operation = OperationEnum.USER_FIRST_USE)
|
||||
@PostMapping("/updateAccount")
|
||||
public ResponseResult<?> updateAccount(@RequestBody User user) {
|
||||
return loginService.updateAccount(user);
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public ResponseResult<?> logout() {
|
||||
return loginService.logout();
|
||||
}
|
||||
|
||||
@GetMapping("/deleteAccount")
|
||||
public ResponseResult<?> deleteAccount() {
|
||||
return loginService.deleteAccount();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.service.DashboardService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dashboard")
|
||||
public class DashboardController {
|
||||
|
||||
@Resource
|
||||
private DashboardService dashboardService;
|
||||
|
||||
@GetMapping("/getInstancesRealTimeData")
|
||||
public ResponseResult<?> getInstancesRealTimeData() {
|
||||
return dashboardService.getInstancesRealTimeData();
|
||||
}
|
||||
|
||||
@GetMapping("/getRecentConsoleList")
|
||||
public ResponseResult<?> getRecentConsoleList() {
|
||||
return dashboardService.getRecentConsoleList();
|
||||
}
|
||||
|
||||
@GetMapping("/getAffectedServirList")
|
||||
public ResponseResult<?> getAffectedServirList() {
|
||||
return dashboardService.getAffectedServirList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.bps.config.FileConfig;
|
||||
import com.mzaxd.bps.util.FileUtil;
|
||||
import com.mzaxd.bps.util.Result;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 文件上传Controller
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/file")
|
||||
public class FileController {
|
||||
|
||||
@Resource
|
||||
private FileConfig fileConfig;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public Result<String> upload(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
String fileName = FileUtil.upload(file, fileConfig.getUploadPath());
|
||||
return Result.success(fileConfig.getAccessPath() + fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*/
|
||||
@DeleteMapping("/{fileName}")
|
||||
public Result<Boolean> delete(@PathVariable String fileName) {
|
||||
return Result.success(FileUtil.delete(fileConfig.getUploadPath() + fileName));
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.service.AuditLogService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auditLog")
|
||||
public class LogController {
|
||||
|
||||
@Resource
|
||||
private AuditLogService auditLogService;
|
||||
|
||||
@GetMapping("/logList")
|
||||
public ResponseResult getLogList(@RequestParam("perPage") Integer perPage,
|
||||
@RequestParam("currentPage") Integer currentPage) {
|
||||
return auditLogService.getLogList(perPage, currentPage);
|
||||
}
|
||||
|
||||
@GetMapping("/getParam/{id}")
|
||||
public ResponseResult getParam(@PathVariable("id") Integer id) {
|
||||
return auditLogService.getParam(id);
|
||||
}
|
||||
|
||||
@GetMapping("/userLog")
|
||||
public ResponseResult getUserLog() {
|
||||
return auditLogService.getUserLog();
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.bps.annotation.SysLog;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.enums.OperationEnum;
|
||||
import com.mzaxd.bps.service.NotificationService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/notification")
|
||||
public class NotificationController {
|
||||
|
||||
@Resource
|
||||
private NotificationService notificationService;
|
||||
|
||||
@GetMapping("/notificationList")
|
||||
public ResponseResult getNotificationList(
|
||||
@RequestParam(value = "tab", required = false) Integer tab,
|
||||
@RequestParam("perPage") Integer perPage,
|
||||
@RequestParam("currentPage") Integer currentPage) {
|
||||
return notificationService.getNotificationList(tab, perPage, currentPage);
|
||||
}
|
||||
|
||||
@SysLog(operation = OperationEnum.NOTIFICATION_AFFIRM)
|
||||
@PutMapping("/{id}")
|
||||
public ResponseResult affirmNotification(@PathVariable("id") Long id) {
|
||||
return notificationService.affirmNotification(id);
|
||||
}
|
||||
|
||||
@GetMapping("/count")
|
||||
public ResponseResult getNotificationCount() {
|
||||
return notificationService.getNotificationCount();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.search.SearchCategory;
|
||||
import com.mzaxd.bps.domain.search.SearchItem;
|
||||
import com.mzaxd.bps.util.SearchUtil;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
*/
|
||||
|
||||
@RestController
|
||||
public class OtherController {
|
||||
|
||||
/**
|
||||
* 全局搜索功能的接口
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/app-bar/search")
|
||||
public ResponseResult searchbar(@RequestParam("q") String str) {
|
||||
List<SearchCategory> searchCategories = SearchUtil.getSearchCategory();
|
||||
|
||||
List<Object> result = new ArrayList<>();
|
||||
|
||||
for (SearchCategory category : searchCategories) {
|
||||
result.add(category);
|
||||
List<SearchItem> searchItems = null;
|
||||
switch (category) {
|
||||
case INSTANCE:
|
||||
searchItems = SearchUtil.getInstanceSearchItem();
|
||||
break;
|
||||
case STATISTICS:
|
||||
searchItems = SearchUtil.getStatisticsSearchItem();
|
||||
break;
|
||||
case SETTING:
|
||||
searchItems = SearchUtil.getSettingSearchItem();
|
||||
break;
|
||||
case OTHER:
|
||||
searchItems = SearchUtil.getOtherSearchItem();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (searchItems != null) {
|
||||
List<SearchItem> filteredItems = searchItems.stream()
|
||||
.filter(item -> item.getTitle().contains(str))
|
||||
.toList();
|
||||
if (!filteredItems.isEmpty()) {
|
||||
result.addAll(filteredItems);
|
||||
} else {
|
||||
result.remove(result.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ResponseResult.success(result);
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.vo.SmtpVo;
|
||||
import com.mzaxd.bps.domain.vo.SystemVo;
|
||||
import com.mzaxd.bps.domain.vo.TerminalVo;
|
||||
import com.mzaxd.bps.service.SystemSettingService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/setting")
|
||||
public class SettingController {
|
||||
|
||||
@Resource
|
||||
private SystemSettingService systemSettingService;
|
||||
|
||||
@GetMapping("/smtp")
|
||||
public ResponseResult getSmtpSetting() {
|
||||
return systemSettingService.getSmtpSetting();
|
||||
}
|
||||
|
||||
@PostMapping("/smtp")
|
||||
public ResponseResult saveSmtpSetting(@RequestBody SmtpVo smtpVo) {
|
||||
return systemSettingService.saveSmtpSetting(smtpVo);
|
||||
}
|
||||
@GetMapping("/terminal")
|
||||
public ResponseResult getTerminalSetting() {
|
||||
return systemSettingService.getTerminalSetting();
|
||||
}
|
||||
|
||||
@PostMapping("/terminal")
|
||||
public ResponseResult saveTerminalSetting(@RequestBody TerminalVo terminalVo) {
|
||||
return systemSettingService.saveTerminalSetting(terminalVo);
|
||||
}
|
||||
|
||||
@GetMapping("/system")
|
||||
public ResponseResult getSystemSetting() {
|
||||
return systemSettingService.getSystemSetting();
|
||||
}
|
||||
|
||||
@PostMapping("/system")
|
||||
public ResponseResult saveSystemSetting(@RequestBody SystemVo systemVo) {
|
||||
return systemSettingService.saveSystemSetting(systemVo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mzaxd.bps.domain.entity.SourceCategory;
|
||||
import com.mzaxd.bps.service.SourceCategoryService;
|
||||
import com.mzaxd.bps.util.Result;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 网盘分类Controller
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/source/category")
|
||||
public class SourceCategoryController {
|
||||
|
||||
@Resource
|
||||
private SourceCategoryService sourceCategoryService;
|
||||
|
||||
/**
|
||||
* 分页查询网盘分类
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Result<Page<SourceCategory>> page(
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) String name) {
|
||||
LambdaQueryWrapper<SourceCategory> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(name != null, SourceCategory::getName, name)
|
||||
.orderByAsc(SourceCategory::getSort);
|
||||
return Result.success(sourceCategoryService.page(new Page<>(pageNum, pageSize), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有网盘分类
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<List<SourceCategory>> list() {
|
||||
LambdaQueryWrapper<SourceCategory> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SourceCategory::getStatus, 1)
|
||||
.orderByAsc(SourceCategory::getSort);
|
||||
return Result.success(sourceCategoryService.list(queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网盘分类详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<SourceCategory> getById(@PathVariable Long id) {
|
||||
return Result.success(sourceCategoryService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增网盘分类
|
||||
*/
|
||||
@PostMapping
|
||||
public Result<Boolean> save(@RequestBody SourceCategory sourceCategory) {
|
||||
return Result.success(sourceCategoryService.save(sourceCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改网盘分类
|
||||
*/
|
||||
@PutMapping
|
||||
public Result<Boolean> updateById(@RequestBody SourceCategory sourceCategory) {
|
||||
return Result.success(sourceCategoryService.updateById(sourceCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除网盘分类
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public Result<Boolean> removeById(@PathVariable Long id) {
|
||||
return Result.success(sourceCategoryService.removeById(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mzaxd.bps.domain.entity.Source;
|
||||
import com.mzaxd.bps.service.SourceService;
|
||||
import com.mzaxd.bps.util.Result;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 网盘资源Controller
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/source")
|
||||
public class SourceController {
|
||||
|
||||
@Resource
|
||||
private SourceService sourceService;
|
||||
|
||||
/**
|
||||
* 搜索网盘资源
|
||||
*/
|
||||
@GetMapping("/search")
|
||||
public Result<Page<Source>> search(
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) String keyword,
|
||||
@RequestParam(required = false) Long categoryId) {
|
||||
return Result.success(sourceService.search(pageNum, pageSize, keyword, categoryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询网盘资源
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Result<Page<Source>> page(
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) String title,
|
||||
@RequestParam(required = false) Long sourceCategoryId) {
|
||||
LambdaQueryWrapper<Source> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(title != null, Source::getTitle, title)
|
||||
.eq(sourceCategoryId != null, Source::getSourceCategoryId, sourceCategoryId)
|
||||
.orderByDesc(Source::getCreateTime);
|
||||
return Result.success(sourceService.page(new Page<>(pageNum, pageSize), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网盘资源详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<Source> getById(@PathVariable Long id) {
|
||||
return Result.success(sourceService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增网盘资源
|
||||
*/
|
||||
@PostMapping
|
||||
public Result<Boolean> save(@RequestBody Source source) {
|
||||
return Result.success(sourceService.save(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改网盘资源
|
||||
*/
|
||||
@PutMapping
|
||||
public Result<Boolean> updateById(@RequestBody Source source) {
|
||||
return Result.success(sourceService.updateById(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除网盘资源
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public Result<Boolean> removeById(@PathVariable Long id) {
|
||||
return Result.success(sourceService.removeById(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mzaxd.bps.domain.entity.SourceLog;
|
||||
import com.mzaxd.bps.service.SourceLogService;
|
||||
import com.mzaxd.bps.util.Result;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 网盘日志Controller
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/source/log")
|
||||
public class SourceLogController {
|
||||
|
||||
@Resource
|
||||
private SourceLogService sourceLogService;
|
||||
|
||||
/**
|
||||
* 分页查询网盘日志
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Result<Page<SourceLog>> page(
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) Long sourceId) {
|
||||
LambdaQueryWrapper<SourceLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(sourceId != null, SourceLog::getSourceId, sourceId)
|
||||
.orderByDesc(SourceLog::getCreateTime);
|
||||
return Result.success(sourceLogService.page(new Page<>(pageNum, pageSize), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网盘日志详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<SourceLog> getById(@PathVariable Long id) {
|
||||
return Result.success(sourceLogService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增网盘日志
|
||||
*/
|
||||
@PostMapping
|
||||
public Result<Boolean> save(@RequestBody SourceLog sourceLog) {
|
||||
return Result.success(sourceLogService.save(sourceLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除网盘日志
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public Result<Boolean> removeById(@PathVariable Long id) {
|
||||
return Result.success(sourceLogService.removeById(id));
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.service.UserService;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/system")
|
||||
public class SystemController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@RequestMapping("/isFirstUse")
|
||||
private ResponseResult isFirstUse() {
|
||||
return userService.isFirstUse();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.bps.annotation.SysLog;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.mzaxd.bps.domain.vo.UserInfoVo;
|
||||
import com.mzaxd.bps.enums.OperationEnum;
|
||||
import com.mzaxd.bps.service.UserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@GetMapping("/userInfo")
|
||||
public ResponseResult userInfo() {
|
||||
return userService.userInfo();
|
||||
}
|
||||
|
||||
@PutMapping("/userInfo")
|
||||
public ResponseResult updateUserInfo(@RequestBody User user) {
|
||||
return userService.updateUserInfo(user);
|
||||
}
|
||||
|
||||
@GetMapping("/profile")
|
||||
public ResponseResult profile() {
|
||||
return userService.getProfile();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseResult getUserInfo(@PathVariable("id") Integer id) {
|
||||
return userService.getUserInfo(id);
|
||||
}
|
||||
|
||||
@SysLog(operation = OperationEnum.USER_UPDATE_PASSWORD)
|
||||
@PostMapping("/changePassword")
|
||||
public ResponseResult changePassword(@RequestBody Map<String, String> map) {
|
||||
return userService.changePassword(map.get("password"));
|
||||
}
|
||||
|
||||
@SysLog(operation = OperationEnum.USER_UPDATE_USERINFO)
|
||||
@PostMapping("/updateUserInfo")
|
||||
public ResponseResult updateUserInfo(@RequestBody Map<String, UserInfoVo> map) {
|
||||
return userService.updateUserInfo(map.get("user"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mzaxd.bps.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public class CloudFile {
|
||||
private String id;
|
||||
private String name;
|
||||
private String path;
|
||||
private long size;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime modifyTime;
|
||||
private String md5;
|
||||
private String shareLink;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mzaxd.bps.domain;
|
||||
|
||||
import com.mzaxd.bps.service.impl.BaiduPcsService;
|
||||
import com.mzaxd.bps.enums.CloudStorageType;
|
||||
import com.mzaxd.bps.service.CloudStorageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CloudStorageFactory {
|
||||
private final Map<CloudStorageType, CloudStorageService> services = new HashMap<>();
|
||||
|
||||
@Autowired
|
||||
public CloudStorageFactory(BaiduPcsService baiduPcsService) {
|
||||
services.put(CloudStorageType.BAIDU, baiduPcsService);
|
||||
}
|
||||
|
||||
public CloudStorageService getService(CloudStorageType type) {
|
||||
CloudStorageService service = services.get(type);
|
||||
if (service == null) {
|
||||
throw new IllegalArgumentException("Unsupported cloud storage type: " + type);
|
||||
}
|
||||
return service;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.mzaxd.bps.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 网盘资源实体类
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Data
|
||||
@TableName("source")
|
||||
public class Source {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long sourceId;
|
||||
|
||||
/**
|
||||
* 分类ID
|
||||
*/
|
||||
private Long sourceCategoryId;
|
||||
|
||||
/**
|
||||
* 资源标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 资源描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 资源URL
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 资源代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 视频内容
|
||||
*/
|
||||
private String vodContent;
|
||||
|
||||
/**
|
||||
* 视频封面
|
||||
*/
|
||||
private String vodPic;
|
||||
|
||||
/**
|
||||
* 资源类型
|
||||
*/
|
||||
private Integer isType;
|
||||
|
||||
/**
|
||||
* 是否定时
|
||||
*/
|
||||
private Integer isTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 浏览量
|
||||
*/
|
||||
private Integer pageViews;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.mzaxd.bps.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 网盘分类实体类
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Data
|
||||
@TableName("source_category")
|
||||
public class SourceCategory {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long sourceCategoryId;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mzaxd.bps.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 网盘日志实体类
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Data
|
||||
@TableName("source_log")
|
||||
public class SourceLog {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long logId;
|
||||
|
||||
/**
|
||||
* 资源ID
|
||||
*/
|
||||
private Long sourceId;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AccountVo {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
private String account;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 0代表管理员 1代表非管理员
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Mzaxd
|
||||
* @since 2023-03-08 10:23
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class AffectedServirListVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 所有关联的host
|
||||
*/
|
||||
private List<HostVo> hosts;
|
||||
|
||||
/**
|
||||
* 所有关联的容器
|
||||
*/
|
||||
private List<ContainerVo> containers;
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AuditLogListVo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 操作
|
||||
*/
|
||||
private String operation;
|
||||
|
||||
/**
|
||||
* 操作类型(用户/容器/虚拟机/物理机/服务/系统)
|
||||
*/
|
||||
private String operationType;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private String param;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 操作人信息
|
||||
*/
|
||||
private UserInfoVo user;
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ContainerSelectVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class ContainerVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 镜像名
|
||||
*/
|
||||
private String imageName;
|
||||
|
||||
/**
|
||||
* 实际服务器地址(不带协议,不带端口号)
|
||||
*/
|
||||
private String serverAddress;
|
||||
|
||||
/**
|
||||
* WebUi URL
|
||||
*/
|
||||
private String webUi;
|
||||
|
||||
/**
|
||||
* 宿主机id
|
||||
*/
|
||||
private Long hostMachineId;
|
||||
|
||||
/**
|
||||
* 宿主机信息
|
||||
*/
|
||||
private HostMachineVo hostMachine;
|
||||
|
||||
/**
|
||||
* 状态(0在线 1离线 2孤立镜像)
|
||||
*/
|
||||
private Integer containerState;
|
||||
|
||||
/**
|
||||
* 容器编号
|
||||
*/
|
||||
private String containerId;
|
||||
|
||||
/**
|
||||
* 状态(0不提醒 1浏览器 2邮件 3浏览器&邮件)
|
||||
*/
|
||||
private Integer notify;
|
||||
|
||||
/**
|
||||
* SSH Id
|
||||
*/
|
||||
private Long sshId;
|
||||
|
||||
/**
|
||||
* 控制台类型
|
||||
*/
|
||||
private String sshType;
|
||||
|
||||
/**
|
||||
* SSH连接地址
|
||||
*/
|
||||
private String sshHost;
|
||||
|
||||
/**
|
||||
* SSH连接地址端口号
|
||||
*/
|
||||
private Integer sshPort;
|
||||
|
||||
/**
|
||||
* SSH连接用户
|
||||
*/
|
||||
private String sshUser;
|
||||
|
||||
/**
|
||||
* SSH连接密码
|
||||
*/
|
||||
private String sshPwd;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HostMachineDrawerVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HostMachineListVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 状态(0在线 1离线 2睡眠)
|
||||
*/
|
||||
private Integer hostMachineState;
|
||||
|
||||
/**
|
||||
* 探测器地址
|
||||
*/
|
||||
private String detectorIpAddress;
|
||||
|
||||
/**
|
||||
* 操作系统id
|
||||
*/
|
||||
private Long osId;
|
||||
|
||||
/**
|
||||
* 操作系统Vo
|
||||
*/
|
||||
private OsVo os;
|
||||
|
||||
/**
|
||||
* 操作系统id
|
||||
*/
|
||||
private Long sshId;
|
||||
|
||||
/**
|
||||
* 操作系统Vo
|
||||
*/
|
||||
private SshLinkVo sshLink;
|
||||
|
||||
/**
|
||||
* 核心线程数
|
||||
*/
|
||||
private Long threads;
|
||||
|
||||
/**
|
||||
* 内存
|
||||
*/
|
||||
private Long memory;
|
||||
|
||||
/**
|
||||
* 管理ip地址
|
||||
*/
|
||||
private String manageIp;
|
||||
|
||||
/**
|
||||
* 状态(0不提醒 1浏览器 2邮件 3浏览器&邮件)
|
||||
*/
|
||||
private Integer notify;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HostMachineVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class HostPanelVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 管理ip地址
|
||||
*/
|
||||
private String manageIp;
|
||||
|
||||
/**
|
||||
* 协议
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* ip地址
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
private String port;
|
||||
|
||||
/**
|
||||
* 1代表Linux 2代表WindowsNT 3代表FreeBSD
|
||||
*/
|
||||
private Integer osKernel;
|
||||
|
||||
/**
|
||||
* 状态(0不提醒 1浏览器 2邮件 3浏览器&邮件)
|
||||
*/
|
||||
private Integer notify;
|
||||
|
||||
/**
|
||||
* 状态(0在线 1离线 2睡眠)
|
||||
*/
|
||||
private Integer hostMachineState;
|
||||
|
||||
/**
|
||||
* 虚拟机数量
|
||||
*/
|
||||
private Integer vmCount;
|
||||
|
||||
/**
|
||||
* 容器数量
|
||||
*/
|
||||
private Integer containerCount;
|
||||
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class HostVo {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 实际服务器地址(不带协议,不带端口号)
|
||||
*/
|
||||
private String serverAddress;
|
||||
|
||||
/**
|
||||
* 管理ip地址
|
||||
*/
|
||||
private String manageIp;
|
||||
|
||||
/**
|
||||
* 协议
|
||||
*/
|
||||
private String protocol;
|
||||
|
||||
/**
|
||||
* ip地址
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
private String port;
|
||||
|
||||
/**
|
||||
* 1代表Linux 2代表WindowsNT 3代表FreeBSD
|
||||
*/
|
||||
private Integer osKernel;
|
||||
|
||||
/**
|
||||
* 状态(0不提醒 1浏览器 2邮件 3浏览器&邮件)
|
||||
*/
|
||||
private Integer notify;
|
||||
|
||||
/**
|
||||
* 操作系统id
|
||||
*/
|
||||
private Long sshId;
|
||||
|
||||
/**
|
||||
* SSH连接地址
|
||||
*/
|
||||
private String sshHost;
|
||||
|
||||
/**
|
||||
* SSH连接地址端口号
|
||||
*/
|
||||
private Integer sshPort;
|
||||
|
||||
/**
|
||||
* SSH连接用户
|
||||
*/
|
||||
private String sshUser;
|
||||
|
||||
/**
|
||||
* SSH连接密码
|
||||
*/
|
||||
private String sshPwd;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class NotificationListVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 通知标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 通知内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 通知类型(0代表掉线通知,1代表统计通知)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 可能关联的实例的类型(0代表无 1代表host 2代表vm 3代表container)
|
||||
*/
|
||||
private Integer instanceType;
|
||||
|
||||
/**
|
||||
* 可能关联的实例id
|
||||
*/
|
||||
private Long instanceId;
|
||||
|
||||
/**
|
||||
* 提醒发送方式(0不提醒 1浏览器 1邮件 3代表两者)
|
||||
*/
|
||||
private Integer sendType;
|
||||
|
||||
/**
|
||||
* 用户是否确认(0代表未确认 1代表已确认)
|
||||
*/
|
||||
private Integer affirm;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 关联的实例名称
|
||||
*/
|
||||
private String instanceName;
|
||||
|
||||
/**
|
||||
* 关联的实例图标
|
||||
*/
|
||||
private String instanceAvatar;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OsVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 1代表Linux 2代表WindowsNT 3代表FreeBSD
|
||||
*/
|
||||
private Integer kernel;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分页结果封装类
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06 10:00:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PageVo<T> {
|
||||
/**
|
||||
* 总记录数
|
||||
*/
|
||||
private Long total;
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
private List<T> rows;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProfileHeaderVo {
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 登录地点
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 账号创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProfileVo {
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 总服务数
|
||||
*/
|
||||
private Integer servirNumber;
|
||||
|
||||
/**
|
||||
* 总物理机数
|
||||
*/
|
||||
private Integer hostNumber;
|
||||
|
||||
/**
|
||||
* 总虚拟机数
|
||||
*/
|
||||
private Integer vmNumber;
|
||||
|
||||
/**
|
||||
* 总容器数
|
||||
*/
|
||||
private Integer containerNumber;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class RecentConsoleListVo {
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* ssh连接信息表id
|
||||
*/
|
||||
private Long sshId;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SaveOrUpdateServirVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 容器id
|
||||
*/
|
||||
private List<Integer> containerIds;
|
||||
|
||||
/**
|
||||
* 主机id
|
||||
*/
|
||||
private List<Integer> hostIds;
|
||||
|
||||
/**
|
||||
* 标签id
|
||||
*/
|
||||
private List<Integer> tagIds;
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ServirContainerVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* WebUi URL
|
||||
*/
|
||||
private String webUi;
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ServirHostVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 管理ip地址
|
||||
*/
|
||||
private String manageIp;
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class ServirListVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 所有关联的host
|
||||
*/
|
||||
private List<ServirHostVo> hosts;
|
||||
|
||||
/**
|
||||
* 所有关联的容器
|
||||
*/
|
||||
private List<ServirContainerVo> containers;
|
||||
|
||||
/**
|
||||
* 所有标签
|
||||
*/
|
||||
private List<TagVo> tags;
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SmtpVo {
|
||||
/**
|
||||
* 发送邮箱
|
||||
*/
|
||||
private String serverEmail;
|
||||
|
||||
/**
|
||||
* 邮箱密码
|
||||
*/
|
||||
private String emailPass;
|
||||
|
||||
/**
|
||||
* 接收邮箱
|
||||
*/
|
||||
private String notificationEmail;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 网盘分类返回对象
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06 10:00:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SourceCategoryVo {
|
||||
/**
|
||||
* 分类ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 网盘日志返回对象
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06 10:00:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SourceLogVo {
|
||||
/**
|
||||
* 日志ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 资源ID
|
||||
*/
|
||||
private Long sourceId;
|
||||
|
||||
/**
|
||||
* 资源标题
|
||||
*/
|
||||
private String sourceTitle;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 网盘资源返回对象
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06 10:00:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SourceVo {
|
||||
/**
|
||||
* 资源ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分类ID
|
||||
*/
|
||||
private Long sourceCategoryId;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 资源标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 资源描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 资源URL
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 资源代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 视频内容
|
||||
*/
|
||||
private String vodContent;
|
||||
|
||||
/**
|
||||
* 视频封面
|
||||
*/
|
||||
private String vodPic;
|
||||
|
||||
/**
|
||||
* 资源类型
|
||||
*/
|
||||
private Integer isType;
|
||||
|
||||
/**
|
||||
* 是否定时
|
||||
*/
|
||||
private Integer isTime;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 浏览量
|
||||
*/
|
||||
private Integer pageViews;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SshLinkVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 端口号
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 控制台类型(bash/sh)
|
||||
*/
|
||||
private String consoleType;
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class SystemVo {
|
||||
|
||||
/**
|
||||
* 过期时间(1、3、7、30)
|
||||
*/
|
||||
private Integer logExpire;
|
||||
|
||||
/**
|
||||
* 检查实例状态间隔(秒)
|
||||
*/
|
||||
private Integer checkInstanceStatePeriod;
|
||||
|
||||
/**
|
||||
* ch/en
|
||||
*/
|
||||
private String defaultLang;
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class TagVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class TerminalVo {
|
||||
|
||||
/**
|
||||
* 控制台渲染类型
|
||||
*/
|
||||
private String rendererType;
|
||||
|
||||
/**
|
||||
* 字体大小
|
||||
*/
|
||||
private Integer fontSize;
|
||||
|
||||
/**
|
||||
* 光标是否闪烁(0关1开)
|
||||
*/
|
||||
private Integer cursorBlink;
|
||||
|
||||
/**
|
||||
* 字体颜色
|
||||
*/
|
||||
private String foreground;
|
||||
|
||||
/**
|
||||
* 背景色
|
||||
*/
|
||||
private String background;
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VirtualMachineListVo {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 控制台id
|
||||
*/
|
||||
private Long sshId;
|
||||
|
||||
/**
|
||||
* 操作系统id
|
||||
*/
|
||||
private Long osId;
|
||||
|
||||
/**
|
||||
* 操作系统Vo
|
||||
*/
|
||||
private OsVo os;
|
||||
|
||||
/**
|
||||
* 管理ip地址
|
||||
*/
|
||||
private String manageIp;
|
||||
|
||||
/**
|
||||
* 实际服务器地址(不带协议,不带端口号)
|
||||
*/
|
||||
private String serverAddress;
|
||||
|
||||
/**
|
||||
* 核心线程数
|
||||
*/
|
||||
private Long threads;
|
||||
|
||||
/**
|
||||
* 内存
|
||||
*/
|
||||
private Long memory;
|
||||
|
||||
/**
|
||||
* 状态(0在线 1离线 2睡眠)
|
||||
*/
|
||||
private Integer hostMachineState;
|
||||
|
||||
/**
|
||||
* 状态(0不提醒 1浏览器 2邮件 3浏览器&邮件)
|
||||
*/
|
||||
private Integer notify;
|
||||
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class VmVo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 图像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 宿主机id(0代表物理机没有宿主机)
|
||||
*/
|
||||
private Long hostMachineId;
|
||||
|
||||
/**
|
||||
* 核心线程数
|
||||
*/
|
||||
private Long threads;
|
||||
|
||||
/**
|
||||
* 内存
|
||||
*/
|
||||
private Long memory;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String osName;
|
||||
|
||||
/**
|
||||
* 实际服务器地址(不带协议,不带端口号)
|
||||
*/
|
||||
private String serverAddress;
|
||||
|
||||
/**
|
||||
* 管理ip地址
|
||||
*/
|
||||
private String manageIp;
|
||||
|
||||
/**
|
||||
* 1代表Linux 2代表WindowsNT 3代表FreeBSD
|
||||
*/
|
||||
private Integer osKernel;
|
||||
|
||||
/**
|
||||
* 状态(0不提醒 1浏览器 2邮件 3浏览器&邮件)
|
||||
*/
|
||||
private Integer notify;
|
||||
|
||||
/**
|
||||
* SSH连接地址
|
||||
*/
|
||||
private String sshHost;
|
||||
|
||||
/**
|
||||
* SSH连接地址端口号
|
||||
*/
|
||||
private Integer sshPort;
|
||||
|
||||
/**
|
||||
* SSH连接用户
|
||||
*/
|
||||
private String sshUser;
|
||||
|
||||
/**
|
||||
* SSH连接密码
|
||||
*/
|
||||
private String sshPwd;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mzaxd.bps.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum BaiduPcsCommand {
|
||||
LOGIN("login", "Login to Baidu PCS"),
|
||||
SEARCH("search", "Search files"),
|
||||
DOWNLOAD("download", "Download file"),
|
||||
UPLOAD("upload", "Upload file"),
|
||||
SHARE("share", "Create share link"),
|
||||
LIST("list", "List files"),
|
||||
META("meta", "Get file metadata"),
|
||||
QUOTA("quota", "Get quota information");
|
||||
|
||||
private final String command;
|
||||
private final String description;
|
||||
|
||||
BaiduPcsCommand(String command, String description) {
|
||||
this.command = command;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mzaxd.bps.enums;
|
||||
|
||||
public enum CloudStorageType {
|
||||
BAIDU("baidu", "BaiduPCS-GO"),
|
||||
UC("uc", "UC Cloud"),
|
||||
XUN_LEI("xunlei", "Xunlei Cloud"),
|
||||
QUARK("quark", "Quark Cloud");
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
CloudStorageType(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mzaxd.bps.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mzaxd.bps.domain.entity.SourceCategory;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 网盘分类Mapper接口
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Mapper
|
||||
public interface SourceCategoryMapper extends BaseMapper<SourceCategory> {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mzaxd.bps.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mzaxd.bps.domain.entity.SourceLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 网盘日志Mapper接口
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Mapper
|
||||
public interface SourceLogMapper extends BaseMapper<SourceLog> {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mzaxd.bps.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mzaxd.bps.domain.entity.Source;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 网盘资源Mapper接口
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Mapper
|
||||
public interface SourceMapper extends BaseMapper<Source> {
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.AuditLog;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
* @description 针对表【audit_log】的数据库操作Service
|
||||
* @createDate 2023-02-13 12:19:26
|
||||
*/
|
||||
public interface AuditLogService extends IService<AuditLog> {
|
||||
|
||||
/**
|
||||
* 返回日志列表
|
||||
*
|
||||
* @param perPage
|
||||
* @param currentPage
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getLogList(Integer perPage, Integer currentPage);
|
||||
|
||||
/**
|
||||
* 获取参数
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getParam(Integer id);
|
||||
|
||||
/**
|
||||
* 获取用户日志
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getUserLog();
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.bps.domain.CloudFile;
|
||||
import com.mzaxd.bps.enums.CloudStorageType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface CloudStorageService {
|
||||
/**
|
||||
* Initialize the cloud storage service
|
||||
*/
|
||||
void initialize();
|
||||
|
||||
/**
|
||||
* Login to the cloud storage
|
||||
* @param credentials login credentials
|
||||
* @return true if login successful
|
||||
*/
|
||||
boolean login(Map<String, String> credentials);
|
||||
|
||||
/**
|
||||
* Search for files in the cloud storage
|
||||
* @param keyword search keyword
|
||||
* @return list of search results
|
||||
*/
|
||||
List<CloudFile> search(String keyword);
|
||||
|
||||
/**
|
||||
* Download a file from the cloud storage
|
||||
* @param fileId file identifier
|
||||
* @param localPath local path to save the file
|
||||
* @return true if download successful
|
||||
*/
|
||||
boolean download(String fileId, String localPath);
|
||||
|
||||
/**
|
||||
* Upload a file to the cloud storage
|
||||
* @param localPath local file path
|
||||
* @param remotePath remote path to save the file
|
||||
* @return true if upload successful
|
||||
*/
|
||||
boolean upload(String localPath, String remotePath);
|
||||
|
||||
/**
|
||||
* Create a share link for a file
|
||||
* @param fileId file identifier
|
||||
* @return share link
|
||||
*/
|
||||
String createShareLink(String fileId);
|
||||
|
||||
/**
|
||||
* Get the type of cloud storage
|
||||
* @return cloud storage type
|
||||
*/
|
||||
CloudStorageType getType();
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
public interface DashboardService {
|
||||
/**
|
||||
* 获取仪表台实例服务实时数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getInstancesRealTimeData();
|
||||
|
||||
/**
|
||||
* 获取最近连接过的控制台列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getRecentConsoleList();
|
||||
|
||||
/**
|
||||
* 获取所有受影响的服务
|
||||
*
|
||||
* @return ResponseResult
|
||||
* @author mzaxd
|
||||
* @date 2023/3/8 9:43
|
||||
*/
|
||||
ResponseResult<?> getAffectedServirList();
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
public interface LoginService extends IService<User> {
|
||||
|
||||
/**
|
||||
* 后台登录接口
|
||||
*
|
||||
* @author mzaxd
|
||||
* @date 12/4/22 1:29 PM
|
||||
* @param user
|
||||
* @return ResponseResult
|
||||
*/
|
||||
ResponseResult<?> login(User user);
|
||||
|
||||
/**
|
||||
* 后台用户退出登陆
|
||||
*
|
||||
* @author mzaxd
|
||||
* @date 12/6/22 2:07 PM
|
||||
* @return ResponseResult
|
||||
*/
|
||||
ResponseResult<?> logout();
|
||||
|
||||
/**
|
||||
* 首次登陆时 修改账户信息
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> updateAccount(User user);
|
||||
|
||||
/**
|
||||
* 删除账号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> deleteAccount();
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.Notification;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
* @description 针对表【notification】的数据库操作Service
|
||||
* @createDate 2023-02-16 16:04:53
|
||||
*/
|
||||
public interface NotificationService extends IService<Notification> {
|
||||
|
||||
/**
|
||||
* 提醒列表
|
||||
* @param tab
|
||||
* @param perPage
|
||||
* @param currentPage
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getNotificationList(Integer tab, Integer perPage, Integer currentPage);
|
||||
|
||||
/**
|
||||
* 获取新通知数量
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getNotificationCount();
|
||||
|
||||
/**
|
||||
* 确认提醒
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> affirmNotification(Long id);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mzaxd.bps.domain.entity.SourceCategory;
|
||||
import com.mzaxd.bps.domain.vo.SourceCategoryVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 网盘分类表(SourceCategory)表服务接口
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06 10:00:00
|
||||
*/
|
||||
public interface SourceCategoryService extends IService<SourceCategory> {
|
||||
|
||||
/**
|
||||
* 获取分类列表
|
||||
*
|
||||
* @return 分类列表
|
||||
*/
|
||||
List<SourceCategoryVo> getCategoryList();
|
||||
|
||||
/**
|
||||
* 新增分类
|
||||
*
|
||||
* @param category 分类信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean addCategory(SourceCategory category);
|
||||
|
||||
/**
|
||||
* 更新分类
|
||||
*
|
||||
* @param category 分类信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateCategory(SourceCategory category);
|
||||
|
||||
/**
|
||||
* 删除分类
|
||||
*
|
||||
* @param id 分类ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteCategory(Long id);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mzaxd.bps.domain.entity.SourceLog;
|
||||
import com.mzaxd.bps.domain.vo.PageVo;
|
||||
import com.mzaxd.bps.domain.vo.SourceLogVo;
|
||||
|
||||
/**
|
||||
* 网盘日志Service接口
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
public interface SourceLogService extends IService<SourceLog> {
|
||||
|
||||
/**
|
||||
* 获取日志列表
|
||||
*
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页大小
|
||||
* @param sourceId 资源ID
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageVo<SourceLogVo> getLogList(Integer pageNum, Integer pageSize, Long sourceId);
|
||||
|
||||
/**
|
||||
* 添加日志
|
||||
*
|
||||
* @param sourceId 资源ID
|
||||
* @param ip IP地址
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean addLog(Long sourceId, String ip);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mzaxd.bps.domain.entity.Source;
|
||||
import com.mzaxd.bps.domain.vo.PageVo;
|
||||
import com.mzaxd.bps.domain.vo.SourceVo;
|
||||
|
||||
/**
|
||||
* 网盘资源Service接口
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
public interface SourceService extends IService<Source> {
|
||||
|
||||
/**
|
||||
* 获取资源列表
|
||||
*
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页大小
|
||||
* @param title 标题
|
||||
* @param categoryId 分类ID
|
||||
* @param isTime 是否定时
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageVo<SourceVo> getSourceList(Integer pageNum, Integer pageSize, String title, Long categoryId, Integer isTime);
|
||||
|
||||
/**
|
||||
* 获取资源详情
|
||||
*
|
||||
* @param id 资源ID
|
||||
* @return 资源详情
|
||||
*/
|
||||
SourceVo getSourceDetail(Long id);
|
||||
|
||||
/**
|
||||
* 新增资源
|
||||
*
|
||||
* @param source 资源信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean addSource(Source source);
|
||||
|
||||
/**
|
||||
* 更新资源
|
||||
*
|
||||
* @param source 资源信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateSource(Source source);
|
||||
|
||||
/**
|
||||
* 删除资源
|
||||
*
|
||||
* @param id 资源ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteSource(Long id);
|
||||
|
||||
/**
|
||||
* 搜索网盘资源
|
||||
*
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页大小
|
||||
* @param keyword 关键词
|
||||
* @param categoryId 分类ID
|
||||
* @return 分页结果
|
||||
*/
|
||||
Page<Source> search(Integer pageNum, Integer pageSize, String keyword, Long categoryId);
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.SystemSetting;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mzaxd.bps.domain.vo.SmtpVo;
|
||||
import com.mzaxd.bps.domain.vo.SystemVo;
|
||||
import com.mzaxd.bps.domain.vo.TerminalVo;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
* @description 针对表【system_setting】的数据库操作Service
|
||||
* @createDate 2023-02-16 20:25:57
|
||||
*/
|
||||
public interface SystemSettingService extends IService<SystemSetting> {
|
||||
|
||||
/**
|
||||
* 获取SMTP服务器设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getSmtpSetting();
|
||||
|
||||
/**
|
||||
* 保存smtp设置
|
||||
*
|
||||
* @param smtpVo
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> saveSmtpSetting(SmtpVo smtpVo);
|
||||
|
||||
/**
|
||||
* 获取终端设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getTerminalSetting();
|
||||
|
||||
/**
|
||||
* 报错终端设置
|
||||
*
|
||||
* @param terminalVo
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> saveTerminalSetting(TerminalVo terminalVo);
|
||||
|
||||
/**
|
||||
* 获取系统设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getSystemSetting();
|
||||
|
||||
|
||||
/**
|
||||
* 保存系统设置
|
||||
*
|
||||
* @param systemVo
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> saveSystemSetting(SystemVo systemVo);
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mzaxd.bps.domain.vo.UserInfoVo;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
* @description 针对表【user】的数据库操作Service
|
||||
* @createDate 2023-01-28 09:16:07
|
||||
*/
|
||||
public interface UserService extends IService<User> {
|
||||
|
||||
/**
|
||||
* 查询用户信息
|
||||
*
|
||||
* @author mzaxd
|
||||
* @date 1/29/23 4:16 AM
|
||||
* @return ResponseResult
|
||||
*/
|
||||
ResponseResult<?> userInfo();
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
* @author mzaxd
|
||||
* @date 1/29/23 4:16 AM
|
||||
* @param user
|
||||
* @return ResponseResult
|
||||
*/
|
||||
ResponseResult<?> updateUserInfo(User user);
|
||||
|
||||
/**
|
||||
* 返回profile页面所需数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getProfile();
|
||||
|
||||
/**
|
||||
* 通过判断默认账户的state状态来判断是否第一次使用
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> isFirstUse();
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> changePassword(String password);
|
||||
|
||||
/**
|
||||
* 通过id获取UserInfo
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getUserInfo(Integer id);
|
||||
|
||||
/**
|
||||
* 修改账号信息
|
||||
* @param userData
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> updateUserInfo(UserInfoVo userData);
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.mzaxd.bps.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mzaxd.bps.constant.SystemConstant;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.*;
|
||||
import com.mzaxd.bps.domain.vo.*;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.mapper.UserMapper;
|
||||
import com.mzaxd.bps.service.AuditLogService;
|
||||
import com.mzaxd.bps.mapper.AuditLogMapper;
|
||||
import com.mzaxd.bps.util.BeanCopyUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
* @description 针对表【audit_log】的数据库操作Service实现
|
||||
* @createDate 2023-02-13 12:19:26
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = SystemException.class)
|
||||
public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog>
|
||||
implements AuditLogService{
|
||||
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> getLogList(Integer perPage, Integer currentPage) {
|
||||
//分页
|
||||
PageHelper.startPage(currentPage, perPage);
|
||||
LambdaQueryWrapper<AuditLog> auditLogLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
auditLogLambdaQueryWrapper.orderByDesc(AuditLog::getCreateTime);
|
||||
//查询
|
||||
List<AuditLog> auditLogs = list(auditLogLambdaQueryWrapper);
|
||||
//封装分页信息
|
||||
PageInfo pageInfo = new PageInfo<>(auditLogs, perPage);
|
||||
|
||||
//封装结果返回
|
||||
List<AuditLogListVo> auditLogListVos = BeanCopyUtils.copyBeanList(auditLogs, AuditLogListVo.class);
|
||||
auditLogListVos.forEach(auditLogListVo -> {
|
||||
User user = userMapper.selectById(auditLogListVo.getCreateBy());
|
||||
UserInfoVo userInfoVo = BeanCopyUtils.copyBean(user, UserInfoVo.class);
|
||||
auditLogListVo.setUser(userInfoVo);
|
||||
});
|
||||
pageInfo.setList(auditLogListVos);
|
||||
return ResponseResult.success(pageInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> getParam(Integer id) {
|
||||
AuditLog auditLog = getById(id);
|
||||
return ResponseResult.success(auditLog.getParam());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> getUserLog() {
|
||||
LambdaQueryWrapper<AuditLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AuditLog::getOperationType, SystemConstant.LOG_USER);
|
||||
queryWrapper.orderByDesc(AuditLog::getCreateTime);
|
||||
List<AuditLog> list = list(queryWrapper);
|
||||
return ResponseResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.mzaxd.bps.service.impl;
|
||||
|
||||
import com.mzaxd.bps.enums.BaiduPcsCommand;
|
||||
import com.mzaxd.bps.enums.CloudStorageType;
|
||||
import com.mzaxd.bps.domain.CloudFile;
|
||||
import com.mzaxd.bps.service.CloudStorageService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
public class BaiduPcsService implements CloudStorageService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(BaiduPcsService.class);
|
||||
private static final String EXECUTABLE_NAME = "baidupcs-go";
|
||||
private String executablePath;
|
||||
private boolean initialized = false;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
String resourcePath = os.contains("win") ? "baidu/win/" : "baidu/linux/";
|
||||
|
||||
ClassPathResource resource = new ClassPathResource(resourcePath + EXECUTABLE_NAME);
|
||||
File tempFile = File.createTempFile(EXECUTABLE_NAME, "");
|
||||
Files.copy(resource.getInputStream(), tempFile.toPath());
|
||||
tempFile.setExecutable(true);
|
||||
|
||||
executablePath = tempFile.getAbsolutePath();
|
||||
initialized = true;
|
||||
logger.info("BaiduPCS-GO initialized successfully at: {}", executablePath);
|
||||
} catch (IOException e) {
|
||||
logger.error("Failed to initialize BaiduPCS-GO", e);
|
||||
throw new RuntimeException("Failed to initialize BaiduPCS-GO", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean login(Map<String, String> credentials) {
|
||||
String username = credentials.get("username");
|
||||
String password = credentials.get("password");
|
||||
|
||||
if (username == null || password == null) {
|
||||
throw new IllegalArgumentException("Username and password are required");
|
||||
}
|
||||
|
||||
try {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(
|
||||
executablePath,
|
||||
BaiduPcsCommand.LOGIN.getCommand(),
|
||||
username,
|
||||
password
|
||||
);
|
||||
|
||||
Process process = processBuilder.start();
|
||||
return process.waitFor(30, TimeUnit.SECONDS) && process.exitValue() == 0;
|
||||
} catch (IOException | InterruptedException e) {
|
||||
logger.error("Login failed", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CloudFile> search(String keyword) {
|
||||
try {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(
|
||||
executablePath,
|
||||
BaiduPcsCommand.SEARCH.getCommand(),
|
||||
keyword
|
||||
);
|
||||
|
||||
Process process = processBuilder.start();
|
||||
if (process.waitFor(30, TimeUnit.SECONDS) && process.exitValue() == 0) {
|
||||
// Parse the output and convert to CloudFile objects
|
||||
// This is a simplified version, you'll need to implement proper parsing
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return new ArrayList<>();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
logger.error("Search failed", e);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean download(String fileId, String localPath) {
|
||||
try {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(
|
||||
executablePath,
|
||||
BaiduPcsCommand.DOWNLOAD.getCommand(),
|
||||
fileId,
|
||||
localPath
|
||||
);
|
||||
|
||||
Process process = processBuilder.start();
|
||||
return process.waitFor(30, TimeUnit.SECONDS) && process.exitValue() == 0;
|
||||
} catch (IOException | InterruptedException e) {
|
||||
logger.error("Download failed", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean upload(String localPath, String remotePath) {
|
||||
try {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(
|
||||
executablePath,
|
||||
BaiduPcsCommand.UPLOAD.getCommand(),
|
||||
localPath,
|
||||
remotePath
|
||||
);
|
||||
|
||||
Process process = processBuilder.start();
|
||||
return process.waitFor(30, TimeUnit.SECONDS) && process.exitValue() == 0;
|
||||
} catch (IOException | InterruptedException e) {
|
||||
logger.error("Upload failed", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createShareLink(String fileId) {
|
||||
try {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(
|
||||
executablePath,
|
||||
BaiduPcsCommand.SHARE.getCommand(),
|
||||
fileId
|
||||
);
|
||||
|
||||
Process process = processBuilder.start();
|
||||
if (process.waitFor(30, TimeUnit.SECONDS) && process.exitValue() == 0) {
|
||||
// Parse the output to get the share link
|
||||
// This is a simplified version, you'll need to implement proper parsing
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
} catch (IOException | InterruptedException e) {
|
||||
logger.error("Create share link failed", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudStorageType getType() {
|
||||
return CloudStorageType.BAIDU;
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.mzaxd.bps.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mzaxd.bps.constant.SystemConstant;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.LoginUser;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.mapper.UserMapper;
|
||||
import com.mzaxd.bps.service.LoginService;
|
||||
import com.mzaxd.bps.util.JwtUtil;
|
||||
import com.mzaxd.bps.util.RedisCache;
|
||||
import com.mzaxd.bps.util.SecurityUtils;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = {SystemException.class})
|
||||
public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements LoginService {
|
||||
|
||||
@Resource
|
||||
private AuthenticationManager authenticationManager;
|
||||
@Resource
|
||||
private RedisCache redisCache;
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> login(User user) {
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getEmail(), user.getPassword());
|
||||
Authentication authenticate = authenticationManager.authenticate(authenticationToken);
|
||||
//判断是否认证通过
|
||||
if (Objects.isNull(authenticate)) {
|
||||
throw new RuntimeException("邮箱或密码错误");
|
||||
}
|
||||
//获取userid 生成token
|
||||
LoginUser loginUser = (LoginUser) authenticate.getPrincipal();
|
||||
String userId = loginUser.getUser().getId().toString();
|
||||
String jwt = JwtUtil.createJWT(userId);
|
||||
//把用户信息存入redis
|
||||
redisCache.setCacheObject("login:" + userId, loginUser);
|
||||
//把token封装 返回
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("token", jwt);
|
||||
map.put("userId", userId);
|
||||
return ResponseResult.success("登录成功", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> logout() {
|
||||
//获取当前登录的用户id
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
//删除redis中对应的值
|
||||
redisCache.deleteObject("login:" + userId);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> updateAccount(User user) {
|
||||
//获取当前登录的用户id
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
User defaultUser = getById(userId);
|
||||
defaultUser.setEmail(user.getEmail());
|
||||
defaultUser.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||
defaultUser.setUserState(SystemConstant.NORMAL_STATE);
|
||||
saveOrUpdate(defaultUser);
|
||||
return ResponseResult.success("修改账号信息成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> deleteAccount() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
userMapper.deleteById(userId);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.mzaxd.bps.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mzaxd.bps.constant.RedisConstant;
|
||||
import com.mzaxd.bps.constant.SystemConstant;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.Notification;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.mapper.NotificationMapper;
|
||||
import com.mzaxd.bps.service.NotificationService;
|
||||
import com.mzaxd.bps.util.SystemSettingUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
* @description 针对表【notification】的数据库操作Service实现
|
||||
* @createDate 2023-02-16 16:04:53
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = SystemException.class)
|
||||
public class NotificationServiceImpl extends ServiceImpl<NotificationMapper, Notification>
|
||||
implements NotificationService {
|
||||
|
||||
@Resource
|
||||
private SystemSettingUtils systemSettingUtils;
|
||||
|
||||
@Resource
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> affirmNotification(Long id) {
|
||||
Notification notification = getById(id);
|
||||
if (SystemConstant.INSTANCETYPE_HOST.equals(notification.getInstanceType())) {
|
||||
redisTemplate.opsForSet().remove(RedisConstant.NOTIFY_HOST_IDS, notification.getInstanceId().toString());
|
||||
}
|
||||
if (SystemConstant.INSTANCETYPE_VM.equals(notification.getInstanceType())) {
|
||||
redisTemplate.opsForSet().remove(RedisConstant.NOTIFY_VM_IDS, notification.getInstanceId().toString());
|
||||
}
|
||||
if (SystemConstant.INSTANCETYPE_CONTAINER.equals(notification.getInstanceType())) {
|
||||
redisTemplate.opsForSet().remove(RedisConstant.NOTIFY_CONTAINER_IDS, notification.getInstanceId().toString());
|
||||
}
|
||||
saveOrUpdate(notification.setAffirm(SystemConstant.NOTIFICATION_AFFIRM));
|
||||
return ResponseResult.success("处理完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> getNotificationList(Integer tab, Integer perPage, Integer currentPage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> getNotificationCount() {
|
||||
LambdaQueryWrapper<Notification> notificationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
notificationLambdaQueryWrapper.eq(Notification::getAffirm, SystemConstant.NOTIFICATION_NOT_AFFIRM);
|
||||
return ResponseResult.success(count(notificationLambdaQueryWrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mzaxd.bps.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mzaxd.bps.domain.entity.SourceCategory;
|
||||
import com.mzaxd.bps.domain.vo.SourceCategoryVo;
|
||||
import com.mzaxd.bps.mapper.SourceCategoryMapper;
|
||||
import com.mzaxd.bps.service.SourceCategoryService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 网盘分类表(SourceCategory)表服务实现类
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06 10:00:00
|
||||
*/
|
||||
@Service
|
||||
public class SourceCategoryServiceImpl extends ServiceImpl<SourceCategoryMapper, SourceCategory> implements SourceCategoryService {
|
||||
|
||||
@Override
|
||||
public List<SourceCategoryVo> getCategoryList() {
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<SourceCategory> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SourceCategory::getStatus, 0)
|
||||
.orderByDesc(SourceCategory::getSort);
|
||||
|
||||
// 查询分类列表
|
||||
List<SourceCategory> categories = list(queryWrapper);
|
||||
|
||||
// 转换为VO
|
||||
return categories.stream().map(category -> {
|
||||
SourceCategoryVo categoryVo = new SourceCategoryVo();
|
||||
BeanUtils.copyProperties(category, categoryVo);
|
||||
categoryVo.setId(category.getSourceCategoryId());
|
||||
return categoryVo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addCategory(SourceCategory category) {
|
||||
return save(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCategory(SourceCategory category) {
|
||||
return updateById(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteCategory(Long id) {
|
||||
return removeById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.mzaxd.bps.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.mzaxd.bps.domain.entity.Source;
|
||||
import com.mzaxd.bps.domain.entity.SourceLog;
|
||||
import com.mzaxd.bps.domain.vo.PageVo;
|
||||
import com.mzaxd.bps.domain.vo.SourceLogVo;
|
||||
import com.mzaxd.bps.mapper.SourceLogMapper;
|
||||
import com.mzaxd.bps.mapper.SourceMapper;
|
||||
import com.mzaxd.bps.service.SourceLogService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 网盘日志表(SourceLog)表服务实现类
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06 10:00:00
|
||||
*/
|
||||
@Service
|
||||
public class SourceLogServiceImpl extends ServiceImpl<SourceLogMapper, SourceLog> implements SourceLogService {
|
||||
|
||||
@Autowired
|
||||
private SourceMapper sourceMapper;
|
||||
|
||||
@Override
|
||||
public PageVo<SourceLogVo> getLogList(Integer pageNum, Integer pageSize, Long sourceId) {
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<SourceLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (sourceId != null) {
|
||||
queryWrapper.eq(SourceLog::getSourceId, sourceId);
|
||||
}
|
||||
queryWrapper.orderByDesc(SourceLog::getCreateTime);
|
||||
|
||||
// 分页查询
|
||||
Page<SourceLog> page = new Page<>(pageNum, pageSize);
|
||||
page(page, queryWrapper);
|
||||
|
||||
// 转换为VO
|
||||
List<SourceLogVo> logVos = page.getRecords().stream().map(log -> {
|
||||
SourceLogVo logVo = new SourceLogVo();
|
||||
BeanUtils.copyProperties(log, logVo);
|
||||
logVo.setId(log.getLogId());
|
||||
|
||||
// 查询资源标题
|
||||
Source source = sourceMapper.selectById(log.getSourceId());
|
||||
if (source != null) {
|
||||
logVo.setSourceTitle(source.getTitle());
|
||||
}
|
||||
|
||||
return logVo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 封装返回结果
|
||||
PageVo<SourceLogVo> pageVo = new PageVo<>();
|
||||
pageVo.setTotal(page.getTotal());
|
||||
pageVo.setRows(logVos);
|
||||
|
||||
return pageVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLog(Long sourceId, String ip) {
|
||||
SourceLog log = new SourceLog();
|
||||
log.setSourceId(sourceId);
|
||||
log.setIp(ip);
|
||||
return save(log);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.mzaxd.bps.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.mzaxd.bps.domain.entity.Source;
|
||||
import com.mzaxd.bps.domain.entity.SourceCategory;
|
||||
import com.mzaxd.bps.domain.vo.PageVo;
|
||||
import com.mzaxd.bps.domain.vo.SourceVo;
|
||||
import com.mzaxd.bps.mapper.SourceMapper;
|
||||
import com.mzaxd.bps.mapper.SourceCategoryMapper;
|
||||
import com.mzaxd.bps.service.SourceService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 网盘资源表(Source)表服务实现类
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06 10:00:00
|
||||
*/
|
||||
@Service
|
||||
public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> implements SourceService {
|
||||
|
||||
@Autowired
|
||||
private SourceCategoryMapper sourceCategoryMapper;
|
||||
|
||||
@Override
|
||||
public PageVo<SourceVo> getSourceList(Integer pageNum, Integer pageSize, String title, Long categoryId, Integer isTime) {
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<Source> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Source::getStatus, 1)
|
||||
.eq(Source::getIsDelete, 0);
|
||||
|
||||
if (StringUtils.hasText(title)) {
|
||||
queryWrapper.like(Source::getTitle, title);
|
||||
}
|
||||
|
||||
if (categoryId != null) {
|
||||
queryWrapper.eq(Source::getSourceCategoryId, categoryId);
|
||||
}
|
||||
|
||||
if (isTime != null) {
|
||||
queryWrapper.eq(Source::getIsTime, isTime);
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
Page<Source> page = new Page<>(pageNum, pageSize);
|
||||
page(page, queryWrapper);
|
||||
|
||||
// 转换为VO
|
||||
List<SourceVo> sourceVos = page.getRecords().stream().map(source -> {
|
||||
SourceVo sourceVo = new SourceVo();
|
||||
BeanUtils.copyProperties(source, sourceVo);
|
||||
sourceVo.setId(source.getSourceId());
|
||||
|
||||
// 查询分类名称
|
||||
SourceCategory category = sourceCategoryMapper.selectById(source.getSourceCategoryId());
|
||||
if (category != null) {
|
||||
sourceVo.setCategoryName(category.getName());
|
||||
}
|
||||
|
||||
return sourceVo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 封装返回结果
|
||||
PageVo<SourceVo> pageVo = new PageVo<>();
|
||||
pageVo.setTotal(page.getTotal());
|
||||
pageVo.setRows(sourceVos);
|
||||
|
||||
return pageVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVo getSourceDetail(Long id) {
|
||||
// 查询资源
|
||||
Source source = getById(id);
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 转换为VO
|
||||
SourceVo sourceVo = new SourceVo();
|
||||
BeanUtils.copyProperties(source, sourceVo);
|
||||
sourceVo.setId(source.getSourceId());
|
||||
|
||||
// 查询分类名称
|
||||
SourceCategory category = sourceCategoryMapper.selectById(source.getSourceCategoryId());
|
||||
if (category != null) {
|
||||
sourceVo.setCategoryName(category.getName());
|
||||
}
|
||||
|
||||
// 增加浏览量
|
||||
source.setPageViews(source.getPageViews() + 1);
|
||||
updateById(source);
|
||||
|
||||
return sourceVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addSource(Source source) {
|
||||
return save(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateSource(Source source) {
|
||||
return updateById(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSource(Long id) {
|
||||
return removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Source> search(Integer pageNum, Integer pageSize, String keyword, Long categoryId) {
|
||||
LambdaQueryWrapper<Source> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 关键词搜索(标题、描述、代码)
|
||||
if (StringUtils.hasText(keyword)) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.like(Source::getTitle, keyword)
|
||||
.or()
|
||||
.like(Source::getDescription, keyword)
|
||||
.or()
|
||||
.like(Source::getCode, keyword));
|
||||
}
|
||||
|
||||
// 分类筛选
|
||||
if (categoryId != null) {
|
||||
queryWrapper.eq(Source::getSourceCategoryId, categoryId);
|
||||
}
|
||||
|
||||
// 只查询未删除的资源
|
||||
queryWrapper.eq(Source::getIsDelete, 0)
|
||||
.eq(Source::getStatus, 1)
|
||||
.orderByDesc(Source::getCreateTime);
|
||||
|
||||
return page(new Page<>(pageNum, pageSize), queryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package com.mzaxd.bps.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.SystemSetting;
|
||||
import com.mzaxd.bps.domain.vo.SmtpVo;
|
||||
import com.mzaxd.bps.domain.vo.SystemVo;
|
||||
import com.mzaxd.bps.domain.vo.TerminalVo;
|
||||
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.service.SystemSettingService;
|
||||
import com.mzaxd.bps.mapper.SystemSettingMapper;
|
||||
import com.mzaxd.bps.util.BeanCopyUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
* @description 针对表【system_setting】的数据库操作Service实现
|
||||
* @createDate 2023-02-16 20:25:57
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = SystemException.class)
|
||||
public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, SystemSetting>
|
||||
implements SystemSettingService{
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> getSmtpSetting() {
|
||||
SystemSetting systemSetting = getSetting();
|
||||
SmtpVo smtpVo = BeanCopyUtils.copyBean(systemSetting, SmtpVo.class);
|
||||
return ResponseResult.success(smtpVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> saveSmtpSetting(SmtpVo smtpVo) {
|
||||
SystemSetting systemSetting = getById(1);
|
||||
systemSetting.setServerEmail(smtpVo.getServerEmail());
|
||||
systemSetting.setEmailPass(smtpVo.getEmailPass());
|
||||
systemSetting.setNotificationEmail(smtpVo.getNotificationEmail());
|
||||
saveOrUpdate(systemSetting);
|
||||
return ResponseResult.success(AppHttpCodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> getTerminalSetting() {
|
||||
SystemSetting systemSetting = getSetting();
|
||||
TerminalVo terminalVo = BeanCopyUtils.copyBean(systemSetting, TerminalVo.class);
|
||||
return ResponseResult.success(terminalVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> saveTerminalSetting(TerminalVo terminalVo) {
|
||||
SystemSetting systemSetting = getById(1);
|
||||
systemSetting.setRendererType(terminalVo.getRendererType());
|
||||
systemSetting.setFontSize(terminalVo.getFontSize());
|
||||
systemSetting.setCursorBlink(terminalVo.getCursorBlink());
|
||||
systemSetting.setForeground(terminalVo.getForeground());
|
||||
systemSetting.setBackground(terminalVo.getBackground());
|
||||
saveOrUpdate(systemSetting);
|
||||
return ResponseResult.success(AppHttpCodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> getSystemSetting() {
|
||||
SystemSetting systemSetting = getSetting();
|
||||
SystemVo systemVo = BeanCopyUtils.copyBean(systemSetting, SystemVo.class);
|
||||
return ResponseResult.success(systemVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> saveSystemSetting(SystemVo systemVo) {
|
||||
SystemSetting systemSetting = getById(1);
|
||||
systemSetting.setLogExpire(systemVo.getLogExpire());
|
||||
systemSetting.setDefaultLang(systemVo.getDefaultLang());
|
||||
systemSetting.setCheckInstanceStatePeriod(systemVo.getCheckInstanceStatePeriod());
|
||||
saveOrUpdate(systemSetting);
|
||||
return ResponseResult.success(AppHttpCodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
private SystemSetting getSetting(){
|
||||
return getById(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.mzaxd.bps.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mzaxd.bps.domain.entity.LoginUser;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.mapper.UserMapper;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
* @description
|
||||
* @createDate 2022-11-26 12:24:08
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = SystemException.class)
|
||||
public class UserDetailServiceImpl implements UserDetailsService {
|
||||
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
|
||||
//根据用户名查询用户信息
|
||||
LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(User::getEmail, email);
|
||||
User user = userMapper.selectOne(wrapper);
|
||||
//如果查询不到数据就通过抛出异常来给出提示
|
||||
if (Objects.isNull(user)) {
|
||||
throw new RuntimeException("邮箱或密码错误");
|
||||
}
|
||||
|
||||
//封装成UserDetails对象返回
|
||||
return new LoginUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
package com.mzaxd.bps.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.mzaxd.bps.domain.vo.ProfileVo;
|
||||
import com.mzaxd.bps.domain.vo.UserInfoVo;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.mapper.UserMapper;
|
||||
import com.mzaxd.bps.service.UserService;
|
||||
import com.mzaxd.bps.util.BeanCopyUtils;
|
||||
import com.mzaxd.bps.util.SecurityUtils;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
* @description 针对表【user】的数据库操作Service实现
|
||||
* @createDate 2023-01-28 09:16:07
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = SystemException.class)
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
||||
implements UserService{
|
||||
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> userInfo() {
|
||||
//获取当前用户id
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
//根据id查询用户信息
|
||||
User user = getById(userId);
|
||||
//将用户信息封装Vo并返回
|
||||
UserInfoVo userInfoVo = BeanCopyUtils.copyBean(user, UserInfoVo.class);
|
||||
return ResponseResult.success(userInfoVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> updateUserInfo(User user) {
|
||||
updateById(user);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> getProfile() {
|
||||
//获取当前用户id
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
User user = getById(userId);
|
||||
ProfileVo profile = BeanCopyUtils.copyBean(user, ProfileVo.class);
|
||||
return ResponseResult.success(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> isFirstUse() {
|
||||
User user = getById(1);
|
||||
if (user.getUserState() == 0) {
|
||||
return ResponseResult.success(true);
|
||||
} else {
|
||||
return ResponseResult.success(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> changePassword(String password) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
User user = getById(userId);
|
||||
user.setPassword(passwordEncoder.encode(password));
|
||||
saveOrUpdate(user);
|
||||
return ResponseResult.success("密码修改成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> getUserInfo(Integer id) {
|
||||
User user = getById(id);
|
||||
UserInfoVo userInfoVo = BeanCopyUtils.copyBean(user, UserInfoVo.class);
|
||||
return ResponseResult.success(userInfoVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<?> updateUserInfo(UserInfoVo userData) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
User user = getById(userId);
|
||||
user.setEmail(userData.getEmail()).setUserName(userData.getUserName()).setNickName(userData.getNickName()).setAvatar(userData.getAvatar());
|
||||
saveOrUpdate(user);
|
||||
return ResponseResult.success("账号信息修改成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.mzaxd.bps.util;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 文件操作工具类
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
public class FileUtil {
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @param path 保存路径
|
||||
* @return 文件名
|
||||
*/
|
||||
public static String upload(MultipartFile file, String path) throws IOException {
|
||||
// 获取文件名
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
// 获取文件后缀
|
||||
String suffix = originalFilename.substring(originalFilename.lastIndexOf("."));
|
||||
// 生成新文件名
|
||||
String fileName = UUID.randomUUID().toString() + suffix;
|
||||
// 创建文件对象
|
||||
File dest = new File(path + fileName);
|
||||
// 判断路径是否存在,不存在则创建
|
||||
if (!dest.getParentFile().exists()) {
|
||||
dest.getParentFile().mkdirs();
|
||||
}
|
||||
// 保存文件
|
||||
file.transferTo(dest);
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @return 是否成功
|
||||
*/
|
||||
public static boolean delete(String path) {
|
||||
File file = new File(path);
|
||||
if (file.exists() && file.isFile()) {
|
||||
return file.delete();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mzaxd.bps.util;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 统一响应结果
|
||||
*
|
||||
* @author mzaxd
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Data
|
||||
public class Result<T> {
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
private T data;
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static <T> Result<T> success() {
|
||||
return success(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static <T> Result<T> success(T data) {
|
||||
Result<T> result = new Result<>();
|
||||
result.setCode(200);
|
||||
result.setMessage("success");
|
||||
result.setData(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static <T> Result<T> error(String message) {
|
||||
return error(500, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static <T> Result<T> error(Integer code, String message) {
|
||||
Result<T> result = new Result<>();
|
||||
result.setCode(code);
|
||||
result.setMessage(message);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.mzaxd.bps.util;
|
||||
|
||||
import cn.hutool.extra.mail.MailAccount;
|
||||
import com.mzaxd.bps.domain.entity.SystemSetting;
|
||||
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.service.SystemSettingService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Component
|
||||
public class SystemSettingUtils {
|
||||
|
||||
@Resource
|
||||
private SystemSettingService systemSettingService;
|
||||
|
||||
/**
|
||||
* 获取邮件服务器Bean
|
||||
* @return
|
||||
*/
|
||||
public MailAccount getMailAccount() {
|
||||
//获取系统设置
|
||||
SystemSetting setting = systemSettingService.getById(1);
|
||||
MailAccount account = new MailAccount();
|
||||
if (!StringUtils.hasText(setting.getEmailPass())) {
|
||||
throw new SystemException(AppHttpCodeEnum.EMAIL_NOT_NULL);
|
||||
}
|
||||
account.setFrom(setting.getServerEmail());
|
||||
account.setUser(setting.getServerEmail());
|
||||
account.setPass(setting.getEmailPass());
|
||||
return account;
|
||||
}
|
||||
|
||||
public String getMailTarget() {
|
||||
//获取系统设置
|
||||
SystemSetting setting = systemSettingService.getById(1);
|
||||
//如果不配置目标邮箱的话,默认目标邮箱为服务器邮箱地址
|
||||
String target;
|
||||
if (StringUtils.hasText(setting.getNotificationEmail())) {
|
||||
target = setting.getNotificationEmail();
|
||||
} else {
|
||||
target = setting.getServerEmail();
|
||||
}
|
||||
return target;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package com.mzaxd.bps.util;
|
||||
|
||||
import com.mzaxd.bps.constant.UrlConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UrlUtil {
|
||||
|
||||
public static String getUrl(String protocol, String ip, String port, String path) {
|
||||
return getAddress(protocol, ip, port) + path;
|
||||
}
|
||||
|
||||
public static String getAddress(String protocol, String ip, String port) {
|
||||
return protocol + "://" + ip + ":" + port;
|
||||
}
|
||||
|
||||
public static Map<String, String> resolveUrl(String url) {
|
||||
HashMap<String, String> result = new HashMap<>(3);
|
||||
|
||||
String[] protocolAndAddress = url.split("://");
|
||||
String protocol = protocolAndAddress[0];
|
||||
String[] ipAndPort = protocolAndAddress[1].split(":");
|
||||
String ip = ipAndPort[0];
|
||||
String port = ipAndPort[1];
|
||||
result.put(UrlConstant.PROTOCOL, protocol);
|
||||
result.put(UrlConstant.IP, ip);
|
||||
result.put(UrlConstant.PORT, port);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String getHostname(String address) {
|
||||
String[] parts = address.split(":");
|
||||
return parts[0];
|
||||
}
|
||||
|
||||
public static boolean isHostOnline(String ipAddress) throws IOException {
|
||||
InetAddress inetAddress = InetAddress.getByName(ipAddress);
|
||||
// 超时时间为5秒
|
||||
return inetAddress.isReachable(5000);
|
||||
}
|
||||
|
||||
public static int getPort(String address) {
|
||||
String[] parts = address.split(":");
|
||||
return Integer.parseInt(parts[1]);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user