Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
849ddb78bd | ||
|
|
2a84b71920 | ||
|
|
4136dcc307 | ||
|
|
9f678d422e | ||
|
|
1e03f301aa | ||
|
|
e34ca42f3c | ||
|
|
b1a200aad1 | ||
|
|
4bd84c23b8 | ||
|
|
b76b7769a8 | ||
|
|
8946f9b98f |
@@ -0,0 +1,15 @@
|
|||||||
|
# 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
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
<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/微云盘/软路由)的飞速发展,个人用户拥有多台不同厂家、不同系统服务器的情况越来越多。另一方面随着虚拟机和容器的大量应用,使得个人用户~~(我)~~对于指数上升的管理难度应接不暇。
|
||||||
|
|
||||||
|
本项目就是为了解决我在使用我个人的多台服务器时发现的一些问题,比如:
|
||||||
|
|
||||||
|
- 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/)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 一些演示图
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
@@ -9,12 +9,12 @@
|
|||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.mzaxd</groupId>
|
<groupId>com.mzaxd</groupId>
|
||||||
<artifactId>Noodles</artifactId>
|
<artifactId>BPS</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>Noodles</name>
|
<name>BPS-Server</name>
|
||||||
<description>Noodles</description>
|
<description>BPS-Server</description>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>17</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -30,10 +30,11 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- druid -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
<scope>runtime</scope>
|
<version>1.2.15</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--lombok-->
|
<!--lombok-->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -55,7 +56,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>1.2.33</version>
|
<version>1.2.83</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--jwt依赖-->
|
<!--jwt依赖-->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -84,10 +85,6 @@
|
|||||||
<artifactId>springfox-swagger-ui</artifactId>
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
<version>2.9.2</version>
|
<version>2.9.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
@@ -107,28 +104,11 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.lionsoul/ip2region -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.lionsoul</groupId>
|
|
||||||
<artifactId>ip2region</artifactId>
|
|
||||||
<version>2.7.0</version>
|
|
||||||
</dependency>
|
|
||||||
<!--工具类-->
|
<!--工具类-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
<version>5.3.7</version>
|
<version>5.8.24</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.mail</groupId>
|
|
||||||
<artifactId>mail</artifactId>
|
|
||||||
<version>1.4.7</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.alibaba/easyexcel -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>easyexcel</artifactId>
|
|
||||||
<version>3.2.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.jcraft/jsch -->
|
<!-- https://mvnrepository.com/artifact/com.jcraft/jsch -->
|
||||||
@@ -143,17 +123,6 @@
|
|||||||
<artifactId>ganymed-ssh2</artifactId>
|
<artifactId>ganymed-ssh2</artifactId>
|
||||||
<version>262</version>
|
<version>262</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--监控-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.codecentric</groupId>
|
|
||||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
|
||||||
<version>2.7.8</version>
|
|
||||||
</dependency>
|
|
||||||
<!--暴露端点-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
+4
-5
@@ -1,9 +1,8 @@
|
|||||||
package com.mzaxd.noodles;
|
package com.mzaxd.bps;
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,11 +10,11 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@MapperScan("com.mzaxd.noodles.mapper")
|
@MapperScan("com.mzaxd.bps.mapper")
|
||||||
public class NoodlesApplication {
|
public class BPSApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(NoodlesApplication.class, args);
|
SpringApplication.run(BPSApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package com.mzaxd.noodles.annotation;
|
package com.mzaxd.bps.annotation;
|
||||||
|
|
||||||
import com.mzaxd.noodles.enums.OperationEnum;
|
import com.mzaxd.bps.enums.OperationEnum;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
+13
-13
@@ -1,10 +1,10 @@
|
|||||||
package com.mzaxd.noodles.aspect;
|
package com.mzaxd.bps.aspect;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.mzaxd.noodles.annotation.SysLog;
|
import com.mzaxd.bps.annotation.SysLog;
|
||||||
import com.mzaxd.noodles.domain.entity.AuditLog;
|
import com.mzaxd.bps.domain.entity.AuditLog;
|
||||||
import com.mzaxd.noodles.enums.OperationEnum;
|
import com.mzaxd.bps.service.AuditLogService;
|
||||||
import com.mzaxd.noodles.service.AuditLogService;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.Around;
|
import org.aspectj.lang.annotation.Around;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
@@ -14,19 +14,19 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 13439
|
* @author 13439
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Aspect
|
@Aspect
|
||||||
|
@Slf4j
|
||||||
public class SysLogAspect {
|
public class SysLogAspect {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AuditLogService auditLogService;
|
private AuditLogService auditLogService;
|
||||||
|
|
||||||
@Pointcut("@annotation(com.mzaxd.noodles.annotation.SysLog)")
|
@Pointcut("@annotation(com.mzaxd.bps.annotation.SysLog)")
|
||||||
public void logPointCut() {
|
public void logPointCut() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -45,24 +45,24 @@ public class SysLogAspect {
|
|||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
Method method = signature.getMethod();
|
Method method = signature.getMethod();
|
||||||
|
|
||||||
AuditLog log = new AuditLog();
|
AuditLog auditLog = new AuditLog();
|
||||||
SysLog syslog = method.getAnnotation(SysLog.class);
|
SysLog syslog = method.getAnnotation(SysLog.class);
|
||||||
if (syslog != null) {
|
if (syslog != null) {
|
||||||
//注解上的描述
|
//注解上的描述
|
||||||
log.setOperation(syslog.operation().getOperation());
|
auditLog.setOperation(syslog.operation().getOperation());
|
||||||
log.setOperationType(syslog.operation().getOperationType());
|
auditLog.setOperationType(syslog.operation().getOperationType());
|
||||||
}
|
}
|
||||||
|
|
||||||
//请求的参数
|
//请求的参数
|
||||||
Object[] args = joinPoint.getArgs();
|
Object[] args = joinPoint.getArgs();
|
||||||
try {
|
try {
|
||||||
String params = JSON.toJSONString(args);
|
String params = JSON.toJSONString(args);
|
||||||
log.setParam(params);
|
auditLog.setParam(params);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
//保存系统日志
|
//保存系统日志
|
||||||
auditLogService.save(log);
|
auditLogService.save(auditLog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-3
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.config;
|
package com.mzaxd.bps.config;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.parser.ParserConfig;
|
import com.alibaba.fastjson.parser.ParserConfig;
|
||||||
@@ -9,6 +9,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
|||||||
import org.springframework.data.redis.serializer.SerializationException;
|
import org.springframework.data.redis.serializer.SerializationException;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redis使用FastJson序列化
|
* Redis使用FastJson序列化
|
||||||
@@ -17,9 +18,9 @@ import java.nio.charset.Charset;
|
|||||||
*/
|
*/
|
||||||
public class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
|
public class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||||
|
|
||||||
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
|
||||||
|
|
||||||
private Class<T> clazz;
|
private final Class<T> clazz;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
|
ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.config;
|
package com.mzaxd.bps.config;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.config;
|
package com.mzaxd.bps.config;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.config;
|
package com.mzaxd.bps.config;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
+2
-3
@@ -1,11 +1,10 @@
|
|||||||
package com.mzaxd.noodles.config;
|
package com.mzaxd.bps.config;
|
||||||
|
|
||||||
import com.mzaxd.noodles.filter.JwtAuthenticationTokenFilter;
|
import com.mzaxd.bps.filter.JwtAuthenticationTokenFilter;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.config;
|
package com.mzaxd.bps.config;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -23,7 +23,7 @@ public class SwaggerConfig {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
private ApiInfo apiInfo() {
|
private ApiInfo apiInfo() {
|
||||||
Contact contact = new Contact("一个人的团队", "http://www.my.com", "my@my.com");
|
Contact contact = new Contact("一个人的团队", "https://www.my.com", "my@my.com");
|
||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder()
|
||||||
.title("文档标题")
|
.title("文档标题")
|
||||||
.description("文档描述")
|
.description("文档描述")
|
||||||
+2
-3
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.config;
|
package com.mzaxd.bps.config;
|
||||||
|
|
||||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
@@ -47,8 +47,7 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
|
|
||||||
fastJsonConfig.setSerializeConfig(SerializeConfig.globalInstance);
|
fastJsonConfig.setSerializeConfig(SerializeConfig.globalInstance);
|
||||||
fastConverter.setFastJsonConfig(fastJsonConfig);
|
fastConverter.setFastJsonConfig(fastJsonConfig);
|
||||||
HttpMessageConverter<?> converter = fastConverter;
|
return fastConverter;
|
||||||
return converter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.config;
|
package com.mzaxd.bps.config;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.constant;
|
package com.mzaxd.bps.constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mzaxd
|
* @author Mzaxd
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.constant;
|
package com.mzaxd.bps.constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author root
|
* @author root
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.constant;
|
package com.mzaxd.bps.constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author root
|
* @author root
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.constant;
|
package com.mzaxd.bps.constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author root
|
* @author root
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.constant;
|
package com.mzaxd.bps.constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author root
|
* @author root
|
||||||
+10
-10
@@ -1,10 +1,10 @@
|
|||||||
package com.mzaxd.noodles.controller;
|
package com.mzaxd.bps.controller;
|
||||||
|
|
||||||
import com.mzaxd.noodles.annotation.SysLog;
|
import com.mzaxd.bps.annotation.SysLog;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.entity.User;
|
import com.mzaxd.bps.domain.entity.User;
|
||||||
import com.mzaxd.noodles.enums.OperationEnum;
|
import com.mzaxd.bps.enums.OperationEnum;
|
||||||
import com.mzaxd.noodles.service.LoginService;
|
import com.mzaxd.bps.service.LoginService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -20,23 +20,23 @@ public class AuthController {
|
|||||||
private LoginService loginService;
|
private LoginService loginService;
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public ResponseResult login(@RequestBody User user) {
|
public ResponseResult<?> login(@RequestBody User user) {
|
||||||
return loginService.login(user);
|
return loginService.login(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SysLog(operation = OperationEnum.USER_FIRST_USE)
|
@SysLog(operation = OperationEnum.USER_FIRST_USE)
|
||||||
@PostMapping("/updateAccount")
|
@PostMapping("/updateAccount")
|
||||||
public ResponseResult updateAccount(@RequestBody User user) {
|
public ResponseResult<?> updateAccount(@RequestBody User user) {
|
||||||
return loginService.updateAccount(user);
|
return loginService.updateAccount(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/logout")
|
@PostMapping("/logout")
|
||||||
public ResponseResult logout() {
|
public ResponseResult<?> logout() {
|
||||||
return loginService.logout();
|
return loginService.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/deleteAccount")
|
@GetMapping("/deleteAccount")
|
||||||
public ResponseResult deleteAccount() {
|
public ResponseResult<?> deleteAccount() {
|
||||||
return loginService.deleteAccount();
|
return loginService.deleteAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
package com.mzaxd.noodles.controller;
|
package com.mzaxd.bps.controller;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.service.AuditLogService;
|
import com.mzaxd.bps.service.AuditLogService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
+5
-7
@@ -1,14 +1,12 @@
|
|||||||
package com.mzaxd.noodles.controller;
|
package com.mzaxd.bps.controller;
|
||||||
|
|
||||||
import com.mzaxd.noodles.annotation.SysLog;
|
import com.mzaxd.bps.annotation.SysLog;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.enums.OperationEnum;
|
import com.mzaxd.bps.enums.OperationEnum;
|
||||||
import com.mzaxd.noodles.service.NotificationService;
|
import com.mzaxd.bps.service.NotificationService;
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 13439
|
* @author 13439
|
||||||
+6
-10
@@ -1,18 +1,14 @@
|
|||||||
package com.mzaxd.noodles.controller;
|
package com.mzaxd.bps.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.mzaxd.bps.domain.search.SearchCategory;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.search.SearchItem;
|
||||||
import com.mzaxd.noodles.domain.search.SearchCategory;
|
import com.mzaxd.bps.util.SearchUtil;
|
||||||
import com.mzaxd.noodles.domain.search.SearchItem;
|
|
||||||
import com.mzaxd.noodles.util.SearchUtil;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -65,6 +61,6 @@ public class OtherController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ResponseResult.okResult(result);
|
return ResponseResult.success(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -1,10 +1,10 @@
|
|||||||
package com.mzaxd.noodles.controller;
|
package com.mzaxd.bps.controller;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.vo.SmtpVo;
|
import com.mzaxd.bps.domain.vo.SmtpVo;
|
||||||
import com.mzaxd.noodles.domain.vo.SystemVo;
|
import com.mzaxd.bps.domain.vo.SystemVo;
|
||||||
import com.mzaxd.noodles.domain.vo.TerminalVo;
|
import com.mzaxd.bps.domain.vo.TerminalVo;
|
||||||
import com.mzaxd.noodles.service.SystemSettingService;
|
import com.mzaxd.bps.service.SystemSettingService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
package com.mzaxd.noodles.controller;
|
package com.mzaxd.bps.controller;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.service.UserService;
|
import com.mzaxd.bps.service.UserService;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
+7
-15
@@ -1,16 +1,14 @@
|
|||||||
package com.mzaxd.noodles.controller;
|
package com.mzaxd.bps.controller;
|
||||||
|
|
||||||
import com.mzaxd.noodles.annotation.SysLog;
|
import com.mzaxd.bps.annotation.SysLog;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.entity.User;
|
import com.mzaxd.bps.domain.entity.User;
|
||||||
import com.mzaxd.noodles.domain.vo.UserInfoVo;
|
import com.mzaxd.bps.domain.vo.UserInfoVo;
|
||||||
import com.mzaxd.noodles.enums.OperationEnum;
|
import com.mzaxd.bps.enums.OperationEnum;
|
||||||
import com.mzaxd.noodles.service.UserService;
|
import com.mzaxd.bps.service.UserService;
|
||||||
import com.mzaxd.noodles.util.IpUtil;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,12 +31,6 @@ public class UserController {
|
|||||||
return userService.updateUserInfo(user);
|
return userService.updateUserInfo(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/profileHeader/{id}")
|
|
||||||
public ResponseResult profileHeader(@PathVariable("id") Integer id, HttpServletRequest request) {
|
|
||||||
String ipAddr = IpUtil.getIpAddr(request);
|
|
||||||
return userService.getProfileHeader(id, ipAddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/profile")
|
@GetMapping("/profile")
|
||||||
public ResponseResult profile() {
|
public ResponseResult profile() {
|
||||||
return userService.getProfile();
|
return userService.getProfile();
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.mzaxd.bps.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一响应结果类
|
||||||
|
*
|
||||||
|
* @author Mzaxd
|
||||||
|
* @param <T> 响应数据类型
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public class ResponseResult<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态码
|
||||||
|
*/
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应消息
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应数据
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建响应结果
|
||||||
|
*/
|
||||||
|
private ResponseResult(Builder<T> builder) {
|
||||||
|
this.code = builder.code;
|
||||||
|
this.message = builder.message;
|
||||||
|
this.data = builder.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建者类
|
||||||
|
*/
|
||||||
|
public static class Builder<T> {
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public Builder<T> code(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder<T> message(String message) {
|
||||||
|
this.message = message;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder<T> data(T data) {
|
||||||
|
this.data = data;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseResult<T> build() {
|
||||||
|
return new ResponseResult<>(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建成功响应(无数据)
|
||||||
|
*/
|
||||||
|
public static <T> ResponseResult<T> success() {
|
||||||
|
return new Builder<T>()
|
||||||
|
.code(AppHttpCodeEnum.SUCCESS.getCode())
|
||||||
|
.message(AppHttpCodeEnum.SUCCESS.getMsg())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建成功响应(带数据)
|
||||||
|
*/
|
||||||
|
public static <T> ResponseResult<T> success(T data) {
|
||||||
|
return new Builder<T>()
|
||||||
|
.code(AppHttpCodeEnum.SUCCESS.getCode())
|
||||||
|
.message(AppHttpCodeEnum.SUCCESS.getMsg())
|
||||||
|
.data(data)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建成功响应(自定义消息和数据)
|
||||||
|
*/
|
||||||
|
public static <T> ResponseResult<T> success(String message, T data) {
|
||||||
|
return new Builder<T>()
|
||||||
|
.code(AppHttpCodeEnum.SUCCESS.getCode())
|
||||||
|
.message(message)
|
||||||
|
.data(data)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建失败响应
|
||||||
|
*/
|
||||||
|
public static <T> ResponseResult<T> failure(AppHttpCodeEnum errorEnum) {
|
||||||
|
return new Builder<T>()
|
||||||
|
.code(errorEnum.getCode())
|
||||||
|
.message(errorEnum.getMsg())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建失败响应(自定义消息)
|
||||||
|
*/
|
||||||
|
public static <T> ResponseResult<T> failure(AppHttpCodeEnum errorEnum, String message) {
|
||||||
|
return new Builder<T>()
|
||||||
|
.code(errorEnum.getCode())
|
||||||
|
.message(message)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建失败响应(完全自定义)
|
||||||
|
*/
|
||||||
|
public static <T> ResponseResult<T> failure(Integer code, String message) {
|
||||||
|
return new Builder<T>()
|
||||||
|
.code(code)
|
||||||
|
.message(message)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-10
@@ -1,17 +1,14 @@
|
|||||||
package com.mzaxd.noodles.domain.entity;
|
package com.mzaxd.bps.domain.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author 13439
|
* @author 13439
|
||||||
@@ -23,7 +20,7 @@ import lombok.experimental.Accessors;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@EqualsAndHashCode(of = "param")
|
@EqualsAndHashCode(of = "param")
|
||||||
public class AuditLog implements Serializable {
|
public class AuditLog {
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@@ -57,7 +54,4 @@ public class AuditLog implements Serializable {
|
|||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Long createBy;
|
private Long createBy;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.entity;
|
package com.mzaxd.bps.domain.entity;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+4
-9
@@ -1,15 +1,13 @@
|
|||||||
package com.mzaxd.noodles.domain.entity;
|
package com.mzaxd.bps.domain.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @TableName notification
|
* @TableName notification
|
||||||
@@ -19,7 +17,7 @@ import lombok.experimental.Accessors;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class Notification implements Serializable {
|
public class Notification {
|
||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
@@ -71,7 +69,4 @@ public class Notification implements Serializable {
|
|||||||
* 删除标志(0代表未删除,1代表已删除)
|
* 删除标志(0代表未删除,1代表已删除)
|
||||||
*/
|
*/
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
}
|
||||||
+2
-7
@@ -1,11 +1,8 @@
|
|||||||
package com.mzaxd.noodles.domain.entity;
|
package com.mzaxd.bps.domain.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -18,7 +15,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class SystemSetting implements Serializable {
|
public class SystemSetting {
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@@ -80,6 +77,4 @@ public class SystemSetting implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String background;
|
private String background;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
}
|
||||||
+2
-5
@@ -1,10 +1,9 @@
|
|||||||
package com.mzaxd.noodles.domain.entity;
|
package com.mzaxd.bps.domain.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,7 +14,7 @@ import java.util.Date;
|
|||||||
@TableName(value ="user")
|
@TableName(value ="user")
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class User implements Serializable {
|
public class User {
|
||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
@@ -81,6 +80,4 @@ public class User implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package com.mzaxd.noodles.domain.message;
|
package com.mzaxd.bps.domain.message;
|
||||||
|
|
||||||
import com.mzaxd.noodledetector.util.Arith;
|
import com.mzaxd.bps.util.Arith;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.message;
|
package com.mzaxd.bps.domain.message;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-2
@@ -1,11 +1,10 @@
|
|||||||
package com.mzaxd.noodles.domain.message;
|
package com.mzaxd.bps.domain.message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mzaxd
|
* @author Mzaxd
|
||||||
* @since 2023-02-05 10:50
|
* @since 2023-02-05 10:50
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.mzaxd.noodledetector.util.Arith;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.message;
|
package com.mzaxd.bps.domain.message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mzaxd
|
* @author Mzaxd
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.message;
|
package com.mzaxd.bps.domain.message;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.message;
|
package com.mzaxd.bps.domain.message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mzaxd
|
* @author Mzaxd
|
||||||
@@ -38,7 +38,7 @@ public class Server {
|
|||||||
/**
|
/**
|
||||||
* Os相关信息
|
* Os相关信息
|
||||||
*/
|
*/
|
||||||
private com.mzaxd.noodles.domain.message.Os os = new Os();
|
private com.mzaxd.bps.domain.message.Os os = new Os();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CPU相关信息
|
* CPU相关信息
|
||||||
@@ -58,7 +58,7 @@ public class Server {
|
|||||||
/**
|
/**
|
||||||
* 磁盘相关信息
|
* 磁盘相关信息
|
||||||
*/
|
*/
|
||||||
private List<SysFile> sysFiles = new LinkedList<SysFile>();
|
private List<SysFile> sysFiles = new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 网络相关信息
|
* 网络相关信息
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.message;
|
package com.mzaxd.bps.domain.message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mzaxd
|
* @author Mzaxd
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.message;
|
package com.mzaxd.bps.domain.message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mzaxd
|
* @author Mzaxd
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.search;
|
package com.mzaxd.bps.domain.search;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONType;
|
import com.alibaba.fastjson.annotation.JSONType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
package com.mzaxd.noodles.domain.search;
|
package com.mzaxd.bps.domain.search;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONType;
|
import com.alibaba.fastjson.annotation.JSONType;
|
||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
package com.mzaxd.noodles.domain.search;
|
package com.mzaxd.bps.domain.search;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONType;
|
import com.alibaba.fastjson.annotation.JSONType;
|
||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-5
@@ -1,9 +1,5 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-2
@@ -1,6 +1,5 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-6
@@ -1,14 +1,9 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.domain.vo;
|
package com.mzaxd.bps.domain.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
+4
-8
@@ -1,9 +1,12 @@
|
|||||||
package com.mzaxd.noodles.enums;
|
package com.mzaxd.bps.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mzaxd
|
* @author Mzaxd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum AppHttpCodeEnum {
|
public enum AppHttpCodeEnum {
|
||||||
/**
|
/**
|
||||||
* 操作成功通用返回信息
|
* 操作成功通用返回信息
|
||||||
@@ -55,11 +58,4 @@ public enum AppHttpCodeEnum {
|
|||||||
this.msg = errorMessage;
|
this.msg = errorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsg() {
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+4
-8
@@ -1,4 +1,6 @@
|
|||||||
package com.mzaxd.noodles.enums;
|
package com.mzaxd.bps.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志-操作类型
|
* 操作日志-操作类型
|
||||||
@@ -6,6 +8,7 @@ package com.mzaxd.noodles.enums;
|
|||||||
* @author 13439
|
* @author 13439
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum OperationEnum {
|
public enum OperationEnum {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,11 +114,4 @@ public enum OperationEnum {
|
|||||||
this.operationType = operationType;
|
this.operationType = operationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOperation() {
|
|
||||||
return operation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOperationType() {
|
|
||||||
return operationType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+4
-10
@@ -1,6 +1,7 @@
|
|||||||
package com.mzaxd.noodles.exception;
|
package com.mzaxd.bps.exception;
|
||||||
|
|
||||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -8,20 +9,13 @@ import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
|||||||
* @date 11/27/22 3:19 AM
|
* @date 11/27/22 3:19 AM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
public class SystemException extends RuntimeException{
|
public class SystemException extends RuntimeException{
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
|
|
||||||
private final String msg;
|
private final String msg;
|
||||||
|
|
||||||
public int getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsg() {
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SystemException(AppHttpCodeEnum httpCodeEnum) {
|
public SystemException(AppHttpCodeEnum httpCodeEnum) {
|
||||||
super(httpCodeEnum.getMsg());
|
super(httpCodeEnum.getMsg());
|
||||||
this.code = httpCodeEnum.getCode();
|
this.code = httpCodeEnum.getCode();
|
||||||
+12
-10
@@ -1,13 +1,14 @@
|
|||||||
package com.mzaxd.noodles.filter;
|
package com.mzaxd.bps.filter;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.entity.LoginUser;
|
import com.mzaxd.bps.domain.entity.LoginUser;
|
||||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||||
import com.mzaxd.noodles.util.JwtUtil;
|
import com.mzaxd.bps.util.JwtUtil;
|
||||||
import com.mzaxd.noodles.util.RedisCache;
|
import com.mzaxd.bps.util.RedisCache;
|
||||||
import com.mzaxd.noodles.util.WebUtils;
|
import com.mzaxd.bps.util.WebUtils;
|
||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -26,6 +27,7 @@ import java.util.Objects;
|
|||||||
* @author root
|
* @author root
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
|
@Slf4j
|
||||||
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -45,10 +47,10 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
|||||||
try {
|
try {
|
||||||
claims = JwtUtil.parseJWT(token);
|
claims = JwtUtil.parseJWT(token);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error(e.getMessage());
|
||||||
//token超时 token非法
|
//token超时 token非法
|
||||||
//响应告诉前端需要重新登录
|
//响应告诉前端需要重新登录
|
||||||
ResponseResult result = ResponseResult.errorResult(AppHttpCodeEnum.NEED_LOGIN);
|
ResponseResult<?> result = ResponseResult.failure(AppHttpCodeEnum.NEED_LOGIN);
|
||||||
WebUtils.renderString(response, JSON.toJSONString(result));
|
WebUtils.renderString(response, JSON.toJSONString(result));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -58,7 +60,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
|||||||
//如果redis中没有用户信息
|
//如果redis中没有用户信息
|
||||||
if (Objects.isNull(loginUser)) {
|
if (Objects.isNull(loginUser)) {
|
||||||
//说明登录过期 需要重新登录
|
//说明登录过期 需要重新登录
|
||||||
ResponseResult result = ResponseResult.errorResult(AppHttpCodeEnum.NEED_LOGIN);
|
ResponseResult<?> result = ResponseResult.failure(AppHttpCodeEnum.NEED_LOGIN);
|
||||||
WebUtils.renderString(response, JSON.toJSONString(result));
|
WebUtils.renderString(response, JSON.toJSONString(result));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
+8
-6
@@ -1,9 +1,10 @@
|
|||||||
package com.mzaxd.noodles.handler;
|
package com.mzaxd.bps.handler;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||||
import com.mzaxd.noodles.util.WebUtils;
|
import com.mzaxd.bps.util.WebUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.AccessDeniedException;
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
import org.springframework.security.web.access.AccessDeniedHandler;
|
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -16,11 +17,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
* @author root
|
* @author root
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
|
@Slf4j
|
||||||
public class AccessDeniedHandlerImpl implements AccessDeniedHandler {
|
public class AccessDeniedHandlerImpl implements AccessDeniedHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws ServletException {
|
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws ServletException {
|
||||||
accessDeniedException.printStackTrace();
|
log.error(accessDeniedException.getMessage());
|
||||||
ResponseResult result = ResponseResult.errorResult(AppHttpCodeEnum.NO_OPERATOR_AUTH);
|
ResponseResult<?> result = ResponseResult.failure(AppHttpCodeEnum.NO_OPERATOR_AUTH);
|
||||||
//响应给前端
|
//响应给前端
|
||||||
WebUtils.renderString(response, JSON.toJSONString(result));
|
WebUtils.renderString(response, JSON.toJSONString(result));
|
||||||
}
|
}
|
||||||
+11
-9
@@ -1,9 +1,10 @@
|
|||||||
package com.mzaxd.noodles.handler;
|
package com.mzaxd.bps.handler;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||||
import com.mzaxd.noodles.util.WebUtils;
|
import com.mzaxd.bps.util.WebUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
import org.springframework.security.authentication.InsufficientAuthenticationException;
|
import org.springframework.security.authentication.InsufficientAuthenticationException;
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
@@ -17,20 +18,21 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
* @author root
|
* @author root
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
|
@Slf4j
|
||||||
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
|
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) {
|
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) {
|
||||||
authException.printStackTrace();
|
log.error(authException.getMessage());
|
||||||
//InsufficientAuthenticationException
|
//InsufficientAuthenticationException
|
||||||
//BadCredentialsException
|
//BadCredentialsException
|
||||||
ResponseResult result;
|
ResponseResult<?> result;
|
||||||
if (authException instanceof BadCredentialsException) {
|
if (authException instanceof BadCredentialsException) {
|
||||||
result = ResponseResult.errorResult(AppHttpCodeEnum.LOGIN_ERROR.getCode(), authException.getMessage());
|
result = ResponseResult.failure(AppHttpCodeEnum.LOGIN_ERROR.getCode(), authException.getMessage());
|
||||||
} else if (authException instanceof InsufficientAuthenticationException) {
|
} else if (authException instanceof InsufficientAuthenticationException) {
|
||||||
result = ResponseResult.errorResult(AppHttpCodeEnum.NEED_LOGIN);
|
result = ResponseResult.failure(AppHttpCodeEnum.NEED_LOGIN);
|
||||||
} else {
|
} else {
|
||||||
result = ResponseResult.errorResult(AppHttpCodeEnum.SYSTEM_ERROR.getCode(), "认证或授权失败");
|
result = ResponseResult.failure(AppHttpCodeEnum.SYSTEM_ERROR.getCode(), "认证或授权失败");
|
||||||
}
|
}
|
||||||
//响应给前端
|
//响应给前端
|
||||||
WebUtils.renderString(response, JSON.toJSONString(result));
|
WebUtils.renderString(response, JSON.toJSONString(result));
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.mzaxd.bps.handler;
|
||||||
|
|
||||||
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
|
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||||
|
import com.mzaxd.bps.exception.SystemException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author root
|
||||||
|
*/
|
||||||
|
@RestControllerAdvice
|
||||||
|
@Slf4j
|
||||||
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
|
@ExceptionHandler(SystemException.class)
|
||||||
|
public ResponseResult<?> systemExceptionHandler(SystemException e) {
|
||||||
|
//打印异常信息
|
||||||
|
log.error("出现了异常! {}", e.getMessage());
|
||||||
|
//从异常对象中获取提示信息封装返回
|
||||||
|
return ResponseResult.failure(e.getCode(), e.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
public ResponseResult<?> exceptionHandler(Exception e) {
|
||||||
|
//打印异常信息
|
||||||
|
log.error("出现了异常! {}", e.getMessage());
|
||||||
|
//从异常对象中获取提示信息封装返回
|
||||||
|
return ResponseResult.failure(AppHttpCodeEnum.SYSTEM_ERROR, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-3
@@ -1,7 +1,8 @@
|
|||||||
package com.mzaxd.noodles.handler;
|
package com.mzaxd.bps.handler;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
import com.mzaxd.noodles.util.SecurityUtils;
|
import com.mzaxd.bps.util.SecurityUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.ibatis.reflection.MetaObject;
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ import java.util.Date;
|
|||||||
/**
|
/**
|
||||||
* @author root
|
* @author root
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class MyMetaObjectHandler implements MetaObjectHandler {
|
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||||
@Override
|
@Override
|
||||||
@@ -18,7 +20,7 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
|||||||
try {
|
try {
|
||||||
userId = SecurityUtils.getUserId();
|
userId = SecurityUtils.getUserId();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error(e.getMessage());
|
||||||
//表示是自己创建
|
//表示是自己创建
|
||||||
userId = -1L;
|
userId = -1L;
|
||||||
}
|
}
|
||||||
+2
-3
@@ -1,13 +1,12 @@
|
|||||||
package com.mzaxd.noodles.mapper;
|
package com.mzaxd.bps.mapper;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.entity.AuditLog;
|
import com.mzaxd.bps.domain.entity.AuditLog;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 13439
|
* @author 13439
|
||||||
* @description 针对表【audit_log】的数据库操作Mapper
|
* @description 针对表【audit_log】的数据库操作Mapper
|
||||||
* @createDate 2023-02-13 12:19:26
|
* @createDate 2023-02-13 12:19:26
|
||||||
* @Entity com.mzaxd.noodles.domain.entity.AuditLog
|
|
||||||
*/
|
*/
|
||||||
public interface AuditLogMapper extends BaseMapper<AuditLog> {
|
public interface AuditLogMapper extends BaseMapper<AuditLog> {
|
||||||
|
|
||||||
+2
-3
@@ -1,13 +1,12 @@
|
|||||||
package com.mzaxd.noodles.mapper;
|
package com.mzaxd.bps.mapper;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.entity.Notification;
|
import com.mzaxd.bps.domain.entity.Notification;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 13439
|
* @author 13439
|
||||||
* @description 针对表【notification】的数据库操作Mapper
|
* @description 针对表【notification】的数据库操作Mapper
|
||||||
* @createDate 2023-02-16 16:04:53
|
* @createDate 2023-02-16 16:04:53
|
||||||
* @Entity com.mzaxd.noodles.domain.entity.Notification
|
|
||||||
*/
|
*/
|
||||||
public interface NotificationMapper extends BaseMapper<Notification> {
|
public interface NotificationMapper extends BaseMapper<Notification> {
|
||||||
|
|
||||||
+2
-3
@@ -1,13 +1,12 @@
|
|||||||
package com.mzaxd.noodles.mapper;
|
package com.mzaxd.bps.mapper;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.entity.SystemSetting;
|
import com.mzaxd.bps.domain.entity.SystemSetting;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 13439
|
* @author 13439
|
||||||
* @description 针对表【system_setting】的数据库操作Mapper
|
* @description 针对表【system_setting】的数据库操作Mapper
|
||||||
* @createDate 2023-02-16 20:25:57
|
* @createDate 2023-02-16 20:25:57
|
||||||
* @Entity com.mzaxd.noodles.domain.entity.SystemSetting
|
|
||||||
*/
|
*/
|
||||||
public interface SystemSettingMapper extends BaseMapper<SystemSetting> {
|
public interface SystemSettingMapper extends BaseMapper<SystemSetting> {
|
||||||
|
|
||||||
+2
-3
@@ -1,13 +1,12 @@
|
|||||||
package com.mzaxd.noodles.mapper;
|
package com.mzaxd.bps.mapper;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.entity.User;
|
import com.mzaxd.bps.domain.entity.User;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author root
|
* @author root
|
||||||
* @description 针对表【user】的数据库操作Mapper
|
* @description 针对表【user】的数据库操作Mapper
|
||||||
* @createDate 2023-01-28 09:16:07
|
* @createDate 2023-01-28 09:16:07
|
||||||
* @Entity com.mzaxd.noodles.domain.entity.User
|
|
||||||
*/
|
*/
|
||||||
public interface UserMapper extends BaseMapper<User> {
|
public interface UserMapper extends BaseMapper<User> {
|
||||||
|
|
||||||
+6
-6
@@ -1,7 +1,7 @@
|
|||||||
package com.mzaxd.noodles.service;
|
package com.mzaxd.bps.service;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.entity.AuditLog;
|
import com.mzaxd.bps.domain.entity.AuditLog;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,7 +18,7 @@ public interface AuditLogService extends IService<AuditLog> {
|
|||||||
* @param currentPage
|
* @param currentPage
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult getLogList(Integer perPage, Integer currentPage);
|
ResponseResult<?> getLogList(Integer perPage, Integer currentPage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取参数
|
* 获取参数
|
||||||
@@ -26,12 +26,12 @@ public interface AuditLogService extends IService<AuditLog> {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult getParam(Integer id);
|
ResponseResult<?> getParam(Integer id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户日志
|
* 获取用户日志
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult getUserLog();
|
ResponseResult<?> getUserLog();
|
||||||
}
|
}
|
||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
package com.mzaxd.noodles.service;
|
package com.mzaxd.bps.service;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 13439
|
* @author 13439
|
||||||
@@ -11,14 +11,14 @@ public interface DashboardService {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult getInstancesRealTimeData();
|
ResponseResult<?> getInstancesRealTimeData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取最近连接过的控制台列表
|
* 获取最近连接过的控制台列表
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult getRecentConsoleList();
|
ResponseResult<?> getRecentConsoleList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有受影响的服务
|
* 获取所有受影响的服务
|
||||||
@@ -27,5 +27,5 @@ public interface DashboardService {
|
|||||||
* @author mzaxd
|
* @author mzaxd
|
||||||
* @date 2023/3/8 9:43
|
* @date 2023/3/8 9:43
|
||||||
*/
|
*/
|
||||||
ResponseResult getAffectedServirList();
|
ResponseResult<?> getAffectedServirList();
|
||||||
}
|
}
|
||||||
+7
-7
@@ -1,8 +1,8 @@
|
|||||||
package com.mzaxd.noodles.service;
|
package com.mzaxd.bps.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.entity.User;
|
import com.mzaxd.bps.domain.entity.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author root
|
* @author root
|
||||||
@@ -17,7 +17,7 @@ public interface LoginService extends IService<User> {
|
|||||||
* @param user
|
* @param user
|
||||||
* @return ResponseResult
|
* @return ResponseResult
|
||||||
*/
|
*/
|
||||||
ResponseResult login(User user);
|
ResponseResult<?> login(User user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 后台用户退出登陆
|
* 后台用户退出登陆
|
||||||
@@ -26,7 +26,7 @@ public interface LoginService extends IService<User> {
|
|||||||
* @date 12/6/22 2:07 PM
|
* @date 12/6/22 2:07 PM
|
||||||
* @return ResponseResult
|
* @return ResponseResult
|
||||||
*/
|
*/
|
||||||
ResponseResult logout();
|
ResponseResult<?> logout();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首次登陆时 修改账户信息
|
* 首次登陆时 修改账户信息
|
||||||
@@ -34,12 +34,12 @@ public interface LoginService extends IService<User> {
|
|||||||
* @param user
|
* @param user
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult updateAccount(User user);
|
ResponseResult<?> updateAccount(User user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除账号
|
* 删除账号
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult deleteAccount();
|
ResponseResult<?> deleteAccount();
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
+12
-12
@@ -1,11 +1,11 @@
|
|||||||
package com.mzaxd.noodles.service;
|
package com.mzaxd.bps.service;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.entity.SystemSetting;
|
import com.mzaxd.bps.domain.entity.SystemSetting;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.mzaxd.noodles.domain.vo.SmtpVo;
|
import com.mzaxd.bps.domain.vo.SmtpVo;
|
||||||
import com.mzaxd.noodles.domain.vo.SystemVo;
|
import com.mzaxd.bps.domain.vo.SystemVo;
|
||||||
import com.mzaxd.noodles.domain.vo.TerminalVo;
|
import com.mzaxd.bps.domain.vo.TerminalVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 13439
|
* @author 13439
|
||||||
@@ -19,7 +19,7 @@ public interface SystemSettingService extends IService<SystemSetting> {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult getSmtpSetting();
|
ResponseResult<?> getSmtpSetting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存smtp设置
|
* 保存smtp设置
|
||||||
@@ -27,14 +27,14 @@ public interface SystemSettingService extends IService<SystemSetting> {
|
|||||||
* @param smtpVo
|
* @param smtpVo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult saveSmtpSetting(SmtpVo smtpVo);
|
ResponseResult<?> saveSmtpSetting(SmtpVo smtpVo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取终端设置
|
* 获取终端设置
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult getTerminalSetting();
|
ResponseResult<?> getTerminalSetting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报错终端设置
|
* 报错终端设置
|
||||||
@@ -42,14 +42,14 @@ public interface SystemSettingService extends IService<SystemSetting> {
|
|||||||
* @param terminalVo
|
* @param terminalVo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult saveTerminalSetting(TerminalVo terminalVo);
|
ResponseResult<?> saveTerminalSetting(TerminalVo terminalVo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取系统设置
|
* 获取系统设置
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult getSystemSetting();
|
ResponseResult<?> getSystemSetting();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,5 +58,5 @@ public interface SystemSettingService extends IService<SystemSetting> {
|
|||||||
* @param systemVo
|
* @param systemVo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult saveSystemSetting(SystemVo systemVo);
|
ResponseResult<?> saveSystemSetting(SystemVo systemVo);
|
||||||
}
|
}
|
||||||
+11
-19
@@ -1,9 +1,9 @@
|
|||||||
package com.mzaxd.noodles.service;
|
package com.mzaxd.bps.service;
|
||||||
|
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.entity.User;
|
import com.mzaxd.bps.domain.entity.User;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.mzaxd.noodles.domain.vo.UserInfoVo;
|
import com.mzaxd.bps.domain.vo.UserInfoVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author root
|
* @author root
|
||||||
@@ -19,7 +19,7 @@ public interface UserService extends IService<User> {
|
|||||||
* @date 1/29/23 4:16 AM
|
* @date 1/29/23 4:16 AM
|
||||||
* @return ResponseResult
|
* @return ResponseResult
|
||||||
*/
|
*/
|
||||||
ResponseResult userInfo();
|
ResponseResult<?> userInfo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户信息
|
* 修改用户信息
|
||||||
@@ -29,35 +29,27 @@ public interface UserService extends IService<User> {
|
|||||||
* @param user
|
* @param user
|
||||||
* @return ResponseResult
|
* @return ResponseResult
|
||||||
*/
|
*/
|
||||||
ResponseResult updateUserInfo(User user);
|
ResponseResult<?> updateUserInfo(User user);
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回个人信息页面头部数据
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
ResponseResult getProfileHeader(Integer id, String ip);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回profile页面所需数据
|
* 返回profile页面所需数据
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult getProfile();
|
ResponseResult<?> getProfile();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过判断默认账户的state状态来判断是否第一次使用
|
* 通过判断默认账户的state状态来判断是否第一次使用
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult isFirstUse();
|
ResponseResult<?> isFirstUse();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改密码
|
* 修改密码
|
||||||
* @param password
|
* @param password
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult changePassword(String password);
|
ResponseResult<?> changePassword(String password);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id获取UserInfo
|
* 通过id获取UserInfo
|
||||||
@@ -65,12 +57,12 @@ public interface UserService extends IService<User> {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult getUserInfo(Integer id);
|
ResponseResult<?> getUserInfo(Integer id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改账号信息
|
* 修改账号信息
|
||||||
* @param userData
|
* @param userData
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult updateUserInfo(UserInfoVo userData);
|
ResponseResult<?> updateUserInfo(UserInfoVo userData);
|
||||||
}
|
}
|
||||||
+18
-15
@@ -1,18 +1,20 @@
|
|||||||
package com.mzaxd.noodles.service.impl;
|
package com.mzaxd.bps.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.mzaxd.noodles.constant.SystemConstant;
|
import com.mzaxd.bps.constant.SystemConstant;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.entity.*;
|
import com.mzaxd.bps.domain.entity.*;
|
||||||
import com.mzaxd.noodles.domain.vo.*;
|
import com.mzaxd.bps.domain.vo.*;
|
||||||
import com.mzaxd.noodles.mapper.UserMapper;
|
import com.mzaxd.bps.exception.SystemException;
|
||||||
import com.mzaxd.noodles.service.AuditLogService;
|
import com.mzaxd.bps.mapper.UserMapper;
|
||||||
import com.mzaxd.noodles.mapper.AuditLogMapper;
|
import com.mzaxd.bps.service.AuditLogService;
|
||||||
import com.mzaxd.noodles.util.BeanCopyUtils;
|
import com.mzaxd.bps.mapper.AuditLogMapper;
|
||||||
|
import com.mzaxd.bps.util.BeanCopyUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -23,6 +25,7 @@ import java.util.List;
|
|||||||
* @createDate 2023-02-13 12:19:26
|
* @createDate 2023-02-13 12:19:26
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional(rollbackFor = SystemException.class)
|
||||||
public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog>
|
public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog>
|
||||||
implements AuditLogService{
|
implements AuditLogService{
|
||||||
|
|
||||||
@@ -30,7 +33,7 @@ public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog>
|
|||||||
private UserMapper userMapper;
|
private UserMapper userMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult getLogList(Integer perPage, Integer currentPage) {
|
public ResponseResult<?> getLogList(Integer perPage, Integer currentPage) {
|
||||||
//分页
|
//分页
|
||||||
PageHelper.startPage(currentPage, perPage);
|
PageHelper.startPage(currentPage, perPage);
|
||||||
LambdaQueryWrapper<AuditLog> auditLogLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<AuditLog> auditLogLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
@@ -48,22 +51,22 @@ public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog>
|
|||||||
auditLogListVo.setUser(userInfoVo);
|
auditLogListVo.setUser(userInfoVo);
|
||||||
});
|
});
|
||||||
pageInfo.setList(auditLogListVos);
|
pageInfo.setList(auditLogListVos);
|
||||||
return ResponseResult.okResult(pageInfo);
|
return ResponseResult.success(pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult getParam(Integer id) {
|
public ResponseResult<?> getParam(Integer id) {
|
||||||
AuditLog auditLog = getById(id);
|
AuditLog auditLog = getById(id);
|
||||||
return ResponseResult.okResult(auditLog.getParam());
|
return ResponseResult.success(auditLog.getParam());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult getUserLog() {
|
public ResponseResult<?> getUserLog() {
|
||||||
LambdaQueryWrapper<AuditLog> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<AuditLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(AuditLog::getOperationType, SystemConstant.LOG_USER);
|
queryWrapper.eq(AuditLog::getOperationType, SystemConstant.LOG_USER);
|
||||||
queryWrapper.orderByDesc(AuditLog::getCreateTime);
|
queryWrapper.orderByDesc(AuditLog::getCreateTime);
|
||||||
List<AuditLog> list = list(queryWrapper);
|
List<AuditLog> list = list(queryWrapper);
|
||||||
return ResponseResult.okResult(list);
|
return ResponseResult.success(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+21
-20
@@ -1,22 +1,22 @@
|
|||||||
package com.mzaxd.noodles.service.impl;
|
package com.mzaxd.bps.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mzaxd.noodles.constant.SystemConstant;
|
import com.mzaxd.bps.constant.SystemConstant;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.entity.LoginUser;
|
import com.mzaxd.bps.domain.entity.LoginUser;
|
||||||
import com.mzaxd.noodles.domain.entity.User;
|
import com.mzaxd.bps.domain.entity.User;
|
||||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
import com.mzaxd.bps.exception.SystemException;
|
||||||
import com.mzaxd.noodles.mapper.UserMapper;
|
import com.mzaxd.bps.mapper.UserMapper;
|
||||||
import com.mzaxd.noodles.service.LoginService;
|
import com.mzaxd.bps.service.LoginService;
|
||||||
import com.mzaxd.noodles.service.UserService;
|
import com.mzaxd.bps.util.JwtUtil;
|
||||||
import com.mzaxd.noodles.util.JwtUtil;
|
import com.mzaxd.bps.util.RedisCache;
|
||||||
import com.mzaxd.noodles.util.RedisCache;
|
import com.mzaxd.bps.util.SecurityUtils;
|
||||||
import com.mzaxd.noodles.util.SecurityUtils;
|
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -27,6 +27,7 @@ import java.util.Objects;
|
|||||||
* @author root
|
* @author root
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional(rollbackFor = {SystemException.class})
|
||||||
public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements LoginService {
|
public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements LoginService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -39,7 +40,7 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
|||||||
private UserMapper userMapper;
|
private UserMapper userMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult login(User user) {
|
public ResponseResult<?> login(User user) {
|
||||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getEmail(), user.getPassword());
|
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getEmail(), user.getPassword());
|
||||||
Authentication authenticate = authenticationManager.authenticate(authenticationToken);
|
Authentication authenticate = authenticationManager.authenticate(authenticationToken);
|
||||||
//判断是否认证通过
|
//判断是否认证通过
|
||||||
@@ -56,20 +57,20 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
|||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put("token", jwt);
|
map.put("token", jwt);
|
||||||
map.put("userId", userId);
|
map.put("userId", userId);
|
||||||
return ResponseResult.okResult("登录成功", map);
|
return ResponseResult.success("登录成功", map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult logout() {
|
public ResponseResult<?> logout() {
|
||||||
//获取当前登录的用户id
|
//获取当前登录的用户id
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
//删除redis中对应的值
|
//删除redis中对应的值
|
||||||
redisCache.deleteObject("login:" + userId);
|
redisCache.deleteObject("login:" + userId);
|
||||||
return ResponseResult.okResult();
|
return ResponseResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult updateAccount(User user) {
|
public ResponseResult<?> updateAccount(User user) {
|
||||||
//获取当前登录的用户id
|
//获取当前登录的用户id
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
User defaultUser = getById(userId);
|
User defaultUser = getById(userId);
|
||||||
@@ -77,13 +78,13 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
|||||||
defaultUser.setPassword(passwordEncoder.encode(user.getPassword()));
|
defaultUser.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||||
defaultUser.setUserState(SystemConstant.NORMAL_STATE);
|
defaultUser.setUserState(SystemConstant.NORMAL_STATE);
|
||||||
saveOrUpdate(defaultUser);
|
saveOrUpdate(defaultUser);
|
||||||
return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS.getCode(),"修改账号信息成功");
|
return ResponseResult.success("修改账号信息成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult deleteAccount() {
|
public ResponseResult<?> deleteAccount() {
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
userMapper.deleteById(userId);
|
userMapper.deleteById(userId);
|
||||||
return ResponseResult.okResult();
|
return ResponseResult.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+25
-22
@@ -1,16 +1,18 @@
|
|||||||
package com.mzaxd.noodles.service.impl;
|
package com.mzaxd.bps.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mzaxd.noodles.domain.ResponseResult;
|
import com.mzaxd.bps.domain.ResponseResult;
|
||||||
import com.mzaxd.noodles.domain.entity.SystemSetting;
|
import com.mzaxd.bps.domain.entity.SystemSetting;
|
||||||
import com.mzaxd.noodles.domain.vo.SmtpVo;
|
import com.mzaxd.bps.domain.vo.SmtpVo;
|
||||||
import com.mzaxd.noodles.domain.vo.SystemVo;
|
import com.mzaxd.bps.domain.vo.SystemVo;
|
||||||
import com.mzaxd.noodles.domain.vo.TerminalVo;
|
import com.mzaxd.bps.domain.vo.TerminalVo;
|
||||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||||
import com.mzaxd.noodles.service.SystemSettingService;
|
import com.mzaxd.bps.exception.SystemException;
|
||||||
import com.mzaxd.noodles.mapper.SystemSettingMapper;
|
import com.mzaxd.bps.service.SystemSettingService;
|
||||||
import com.mzaxd.noodles.util.BeanCopyUtils;
|
import com.mzaxd.bps.mapper.SystemSettingMapper;
|
||||||
|
import com.mzaxd.bps.util.BeanCopyUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 13439
|
* @author 13439
|
||||||
@@ -18,35 +20,36 @@ import org.springframework.stereotype.Service;
|
|||||||
* @createDate 2023-02-16 20:25:57
|
* @createDate 2023-02-16 20:25:57
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional(rollbackFor = SystemException.class)
|
||||||
public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, SystemSetting>
|
public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, SystemSetting>
|
||||||
implements SystemSettingService{
|
implements SystemSettingService{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult getSmtpSetting() {
|
public ResponseResult<?> getSmtpSetting() {
|
||||||
SystemSetting systemSetting = getSetting();
|
SystemSetting systemSetting = getSetting();
|
||||||
SmtpVo smtpVo = BeanCopyUtils.copyBean(systemSetting, SmtpVo.class);
|
SmtpVo smtpVo = BeanCopyUtils.copyBean(systemSetting, SmtpVo.class);
|
||||||
return ResponseResult.okResult(smtpVo);
|
return ResponseResult.success(smtpVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult saveSmtpSetting(SmtpVo smtpVo) {
|
public ResponseResult<?> saveSmtpSetting(SmtpVo smtpVo) {
|
||||||
SystemSetting systemSetting = getById(1);
|
SystemSetting systemSetting = getById(1);
|
||||||
systemSetting.setServerEmail(smtpVo.getServerEmail());
|
systemSetting.setServerEmail(smtpVo.getServerEmail());
|
||||||
systemSetting.setEmailPass(smtpVo.getEmailPass());
|
systemSetting.setEmailPass(smtpVo.getEmailPass());
|
||||||
systemSetting.setNotificationEmail(smtpVo.getNotificationEmail());
|
systemSetting.setNotificationEmail(smtpVo.getNotificationEmail());
|
||||||
saveOrUpdate(systemSetting);
|
saveOrUpdate(systemSetting);
|
||||||
return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
|
return ResponseResult.success(AppHttpCodeEnum.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult getTerminalSetting() {
|
public ResponseResult<?> getTerminalSetting() {
|
||||||
SystemSetting systemSetting = getSetting();
|
SystemSetting systemSetting = getSetting();
|
||||||
TerminalVo terminalVo = BeanCopyUtils.copyBean(systemSetting, TerminalVo.class);
|
TerminalVo terminalVo = BeanCopyUtils.copyBean(systemSetting, TerminalVo.class);
|
||||||
return ResponseResult.okResult(terminalVo);
|
return ResponseResult.success(terminalVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult saveTerminalSetting(TerminalVo terminalVo) {
|
public ResponseResult<?> saveTerminalSetting(TerminalVo terminalVo) {
|
||||||
SystemSetting systemSetting = getById(1);
|
SystemSetting systemSetting = getById(1);
|
||||||
systemSetting.setRendererType(terminalVo.getRendererType());
|
systemSetting.setRendererType(terminalVo.getRendererType());
|
||||||
systemSetting.setFontSize(terminalVo.getFontSize());
|
systemSetting.setFontSize(terminalVo.getFontSize());
|
||||||
@@ -54,24 +57,24 @@ public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, S
|
|||||||
systemSetting.setForeground(terminalVo.getForeground());
|
systemSetting.setForeground(terminalVo.getForeground());
|
||||||
systemSetting.setBackground(terminalVo.getBackground());
|
systemSetting.setBackground(terminalVo.getBackground());
|
||||||
saveOrUpdate(systemSetting);
|
saveOrUpdate(systemSetting);
|
||||||
return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
|
return ResponseResult.success(AppHttpCodeEnum.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult getSystemSetting() {
|
public ResponseResult<?> getSystemSetting() {
|
||||||
SystemSetting systemSetting = getSetting();
|
SystemSetting systemSetting = getSetting();
|
||||||
SystemVo systemVo = BeanCopyUtils.copyBean(systemSetting, SystemVo.class);
|
SystemVo systemVo = BeanCopyUtils.copyBean(systemSetting, SystemVo.class);
|
||||||
return ResponseResult.okResult(systemVo);
|
return ResponseResult.success(systemVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult saveSystemSetting(SystemVo systemVo) {
|
public ResponseResult<?> saveSystemSetting(SystemVo systemVo) {
|
||||||
SystemSetting systemSetting = getById(1);
|
SystemSetting systemSetting = getById(1);
|
||||||
systemSetting.setLogExpire(systemVo.getLogExpire());
|
systemSetting.setLogExpire(systemVo.getLogExpire());
|
||||||
systemSetting.setDefaultLang(systemVo.getDefaultLang());
|
systemSetting.setDefaultLang(systemVo.getDefaultLang());
|
||||||
systemSetting.setCheckInstanceStatePeriod(systemVo.getCheckInstanceStatePeriod());
|
systemSetting.setCheckInstanceStatePeriod(systemVo.getCheckInstanceStatePeriod());
|
||||||
saveOrUpdate(systemSetting);
|
saveOrUpdate(systemSetting);
|
||||||
return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
|
return ResponseResult.success(AppHttpCodeEnum.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SystemSetting getSetting(){
|
private SystemSetting getSetting(){
|
||||||
+7
-4
@@ -1,13 +1,15 @@
|
|||||||
package com.mzaxd.noodles.service.impl;
|
package com.mzaxd.bps.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.mzaxd.noodles.domain.entity.LoginUser;
|
import com.mzaxd.bps.domain.entity.LoginUser;
|
||||||
import com.mzaxd.noodles.domain.entity.User;
|
import com.mzaxd.bps.domain.entity.User;
|
||||||
import com.mzaxd.noodles.mapper.UserMapper;
|
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.UserDetails;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -18,6 +20,7 @@ import java.util.Objects;
|
|||||||
* @createDate 2022-11-26 12:24:08
|
* @createDate 2022-11-26 12:24:08
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional(rollbackFor = SystemException.class)
|
||||||
public class UserDetailServiceImpl implements UserDetailsService {
|
public class UserDetailServiceImpl implements UserDetailsService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
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("账号信息修改成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodledetector.util;
|
package com.mzaxd.bps.util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mzaxd
|
* @author Mzaxd
|
||||||
+4
-2
@@ -1,5 +1,6 @@
|
|||||||
package com.mzaxd.noodles.util;
|
package com.mzaxd.bps.util;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -9,6 +10,7 @@ import java.util.stream.Collectors;
|
|||||||
* @author Mzaxd
|
* @author Mzaxd
|
||||||
* @since 2022-11-22 15:36
|
* @since 2022-11-22 15:36
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class BeanCopyUtils {
|
public class BeanCopyUtils {
|
||||||
|
|
||||||
private BeanCopyUtils() {
|
private BeanCopyUtils() {
|
||||||
@@ -22,7 +24,7 @@ public class BeanCopyUtils {
|
|||||||
//实现属性copy
|
//实现属性copy
|
||||||
BeanUtils.copyProperties(source, result);
|
BeanUtils.copyProperties(source, result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
//返回结果
|
//返回结果
|
||||||
return result;
|
return result;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.util;
|
package com.mzaxd.bps.util;
|
||||||
|
|
||||||
import oshi.SystemInfo;
|
import oshi.SystemInfo;
|
||||||
import oshi.hardware.CentralProcessor;
|
import oshi.hardware.CentralProcessor;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodledetector.util;
|
package com.mzaxd.bps.util;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
+1
-2
@@ -1,10 +1,9 @@
|
|||||||
package com.mzaxd.noodles.util;
|
package com.mzaxd.bps.util;
|
||||||
|
|
||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
import io.jsonwebtoken.JwtBuilder;
|
import io.jsonwebtoken.JwtBuilder;
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
import io.jsonwebtoken.SignatureAlgorithm;
|
import io.jsonwebtoken.SignatureAlgorithm;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user