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