refactor(bps): 重构项目目录结构和代码
- 更新包名从 com.mzaxd.noodles 到 com.mzaxd.bps - 删除了一些未使用的类和接口 - 调整了部分代码结构以适应新的项目需求
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
### 主要框架
|
### 主要框架
|
||||||
|
|
||||||
| 技术 | 说明 | 官网 |
|
| 技术 | 说明 | 官网 |
|
||||||
| -------------- | ------------ | ------------------------------------------------------------ |
|
|----------------|---------|------------------------------------------------------------------------------------------|
|
||||||
| SpringBoot | 后端框架 | [https://spring.io/projects/spring-boot](https://spring.io/projects/spring-boot) |
|
| 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) |
|
| 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) |
|
| jjwt | 生成Token | [https://github.com/jwtk/jjwt](https://github.com/jwtk/jjwt) |
|
||||||
|
|||||||
@@ -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,12 +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>
|
|
||||||
</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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -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;
|
||||||
+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
|
||||||
+5
-9
@@ -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;
|
||||||
|
|
||||||
+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();
|
||||||
+21
-39
@@ -1,13 +1,17 @@
|
|||||||
package com.mzaxd.noodles.domain;
|
package com.mzaxd.bps.domain;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mzaxd
|
* @author Mzaxd
|
||||||
*/
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class ResponseResult<T> implements Serializable {
|
public class ResponseResult<T> implements Serializable {
|
||||||
private Integer code;
|
private Integer code;
|
||||||
@@ -35,19 +39,21 @@ public class ResponseResult<T> implements Serializable {
|
|||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseResult errorResult(int code, String msg) {
|
public static ResponseResult<?> errorResult(int code, String msg) {
|
||||||
ResponseResult result = new ResponseResult();
|
ResponseResult<?> result = new ResponseResult<>();
|
||||||
return result.error(code, msg);
|
return result.error(code, msg);
|
||||||
}
|
}
|
||||||
public static ResponseResult okResult() {
|
|
||||||
ResponseResult result = new ResponseResult();
|
public static ResponseResult<?> okResult() {
|
||||||
return result;
|
return (ResponseResult<?>) new ResponseResult<>();
|
||||||
}
|
}
|
||||||
public static ResponseResult okResult(int code, String msg) {
|
|
||||||
ResponseResult result = new ResponseResult();
|
public static ResponseResult<?> okResult(int code, String msg) {
|
||||||
|
ResponseResult<?> result = new ResponseResult<>();
|
||||||
return result.ok(code, null, msg);
|
return result.ok(code, null, msg);
|
||||||
}
|
}
|
||||||
public static ResponseResult okResult(String msg, Object data) {
|
|
||||||
|
public static ResponseResult<?> okResult(String msg, Object data) {
|
||||||
ResponseResult result = setAppHttpCodeEnum(AppHttpCodeEnum.SUCCESS);
|
ResponseResult result = setAppHttpCodeEnum(AppHttpCodeEnum.SUCCESS);
|
||||||
result.setMsg(msg);
|
result.setMsg(msg);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
@@ -56,7 +62,7 @@ public class ResponseResult<T> implements Serializable {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseResult okResult(Object data) {
|
public static ResponseResult<?> okResult(Object data) {
|
||||||
ResponseResult result = setAppHttpCodeEnum(AppHttpCodeEnum.SUCCESS, AppHttpCodeEnum.SUCCESS.getMsg());
|
ResponseResult result = setAppHttpCodeEnum(AppHttpCodeEnum.SUCCESS, AppHttpCodeEnum.SUCCESS.getMsg());
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
result.setData(data);
|
result.setData(data);
|
||||||
@@ -64,19 +70,19 @@ public class ResponseResult<T> implements Serializable {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseResult errorResult(AppHttpCodeEnum enums){
|
public static ResponseResult<?> errorResult(AppHttpCodeEnum enums) {
|
||||||
return setAppHttpCodeEnum(enums, enums.getMsg());
|
return setAppHttpCodeEnum(enums, enums.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseResult errorResult(AppHttpCodeEnum enums, String msg){
|
public static ResponseResult<?> errorResult(AppHttpCodeEnum enums, String msg) {
|
||||||
return setAppHttpCodeEnum(enums, msg);
|
return setAppHttpCodeEnum(enums, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResponseResult setAppHttpCodeEnum(AppHttpCodeEnum enums){
|
public static ResponseResult<?> setAppHttpCodeEnum(AppHttpCodeEnum enums) {
|
||||||
return okResult(enums.getCode(), enums.getMsg());
|
return okResult(enums.getCode(), enums.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ResponseResult setAppHttpCodeEnum(AppHttpCodeEnum enums, String msg){
|
private static ResponseResult<?> setAppHttpCodeEnum(AppHttpCodeEnum enums, String msg) {
|
||||||
return okResult(enums.getCode(), msg);
|
return okResult(enums.getCode(), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,28 +110,4 @@ public class ResponseResult<T> implements Serializable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(Integer code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsg() {
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMsg(String msg) {
|
|
||||||
this.msg = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(T data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+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.errorResult(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.errorResult(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.errorResult(AppHttpCodeEnum.NO_OPERATOR_AUTH);
|
||||||
//响应给前端
|
//响应给前端
|
||||||
WebUtils.renderString(response, JSON.toJSONString(result));
|
WebUtils.renderString(response, JSON.toJSONString(result));
|
||||||
}
|
}
|
||||||
+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.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,14 +18,15 @@ 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.errorResult(AppHttpCodeEnum.LOGIN_ERROR.getCode(), authException.getMessage());
|
||||||
} else if (authException instanceof InsufficientAuthenticationException) {
|
} else if (authException instanceof InsufficientAuthenticationException) {
|
||||||
+8
-8
@@ -1,8 +1,8 @@
|
|||||||
package com.mzaxd.noodles.handler;
|
package com.mzaxd.bps.handler;
|
||||||
|
|
||||||
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.exception.SystemException;
|
import com.mzaxd.bps.exception.SystemException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
@@ -15,17 +15,17 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|||||||
public class GlobalExceptionHandler {
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
@ExceptionHandler(SystemException.class)
|
@ExceptionHandler(SystemException.class)
|
||||||
public ResponseResult systemExceptionHandler(SystemException e) {
|
public ResponseResult<?> systemExceptionHandler(SystemException e) {
|
||||||
//打印异常信息
|
//打印异常信息
|
||||||
log.error("出现了异常! {}", e);
|
log.error("出现了异常! {}", e.getMessage());
|
||||||
//从异常对象中获取提示信息封装返回
|
//从异常对象中获取提示信息封装返回
|
||||||
return ResponseResult.errorResult(e.getCode(), e.getMsg());
|
return ResponseResult.errorResult(e.getCode(), e.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
public ResponseResult exceptionHandler(Exception e) {
|
public ResponseResult<?> exceptionHandler(Exception e) {
|
||||||
//打印异常信息
|
//打印异常信息
|
||||||
log.error("出现了异常! {}", e);
|
log.error("出现了异常! {}", e.getMessage());
|
||||||
//从异常对象中获取提示信息封装返回
|
//从异常对象中获取提示信息封装返回
|
||||||
return ResponseResult.errorResult(AppHttpCodeEnum.SYSTEM_ERROR, e.getMessage());
|
return ResponseResult.errorResult(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);
|
||||||
}
|
}
|
||||||
+15
-12
@@ -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<>();
|
||||||
@@ -52,13 +55,13 @@ public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@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.okResult(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);
|
||||||
+18
-16
@@ -1,22 +1,23 @@
|
|||||||
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.enums.AppHttpCodeEnum;
|
||||||
import com.mzaxd.noodles.mapper.UserMapper;
|
import com.mzaxd.bps.exception.SystemException;
|
||||||
import com.mzaxd.noodles.service.LoginService;
|
import com.mzaxd.bps.mapper.UserMapper;
|
||||||
import com.mzaxd.noodles.service.UserService;
|
import com.mzaxd.bps.service.LoginService;
|
||||||
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.SecurityUtils;
|
import com.mzaxd.bps.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 +28,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 +41,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);
|
||||||
//判断是否认证通过
|
//判断是否认证通过
|
||||||
@@ -60,7 +62,7 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseResult logout() {
|
public ResponseResult<?> logout() {
|
||||||
//获取当前登录的用户id
|
//获取当前登录的用户id
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
//删除redis中对应的值
|
//删除redis中对应的值
|
||||||
@@ -69,7 +71,7 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
|||||||
}
|
}
|
||||||
|
|
||||||
@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);
|
||||||
@@ -81,7 +83,7 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
|||||||
}
|
}
|
||||||
|
|
||||||
@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.okResult();
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
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.enums.AppHttpCodeEnum;
|
||||||
|
import com.mzaxd.bps.exception.SystemException;
|
||||||
|
import com.mzaxd.bps.service.NotificationService;
|
||||||
|
import com.mzaxd.bps.mapper.NotificationMapper;
|
||||||
|
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.okResult(AppHttpCodeEnum.SUCCESS.getCode(), "处理完成");
|
||||||
|
}
|
||||||
|
|
||||||
|
@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.okResult(count(notificationLambdaQueryWrapper));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+19
-16
@@ -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,18 +20,19 @@ 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.okResult(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());
|
||||||
@@ -39,14 +42,14 @@ public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, S
|
|||||||
}
|
}
|
||||||
|
|
||||||
@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.okResult(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());
|
||||||
@@ -58,14 +61,14 @@ public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, S
|
|||||||
}
|
}
|
||||||
|
|
||||||
@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.okResult(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());
|
||||||
+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,98 @@
|
|||||||
|
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.enums.AppHttpCodeEnum;
|
||||||
|
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.okResult(userInfoVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseResult<?> updateUserInfo(User user) {
|
||||||
|
updateById(user);
|
||||||
|
return ResponseResult.okResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseResult<?> getProfile() {
|
||||||
|
//获取当前用户id
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
User user = getById(userId);
|
||||||
|
ProfileVo profile = BeanCopyUtils.copyBean(user, ProfileVo.class);
|
||||||
|
return ResponseResult.okResult(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseResult<?> isFirstUse() {
|
||||||
|
User user = getById(1);
|
||||||
|
if (user.getUserState() == 0) {
|
||||||
|
return ResponseResult.okResult(true);
|
||||||
|
} else {
|
||||||
|
return ResponseResult.okResult(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseResult<?> changePassword(String password) {
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
User user = getById(userId);
|
||||||
|
user.setPassword(passwordEncoder.encode(password));
|
||||||
|
saveOrUpdate(user);
|
||||||
|
return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS.getCode(), "密码修改成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseResult<?> getUserInfo(Integer id) {
|
||||||
|
User user = getById(id);
|
||||||
|
UserInfoVo userInfoVo = BeanCopyUtils.copyBean(user, UserInfoVo.class);
|
||||||
|
return ResponseResult.okResult(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.okResult(AppHttpCodeEnum.SUCCESS.getCode(), "账号信息修改成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+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;
|
||||||
+6
-17
@@ -1,4 +1,4 @@
|
|||||||
package com.mzaxd.noodles.util;
|
package com.mzaxd.bps.util;
|
||||||
|
|
||||||
import org.springframework.data.redis.core.BoundSetOperations;
|
import org.springframework.data.redis.core.BoundSetOperations;
|
||||||
import org.springframework.data.redis.core.HashOperations;
|
import org.springframework.data.redis.core.HashOperations;
|
||||||
@@ -71,7 +71,7 @@ public class RedisCache {
|
|||||||
* @return true=设置成功;false=设置失败
|
* @return true=设置成功;false=设置失败
|
||||||
*/
|
*/
|
||||||
public boolean expire(final String key, final long timeout, final TimeUnit unit) {
|
public boolean expire(final String key, final long timeout, final TimeUnit unit) {
|
||||||
return redisTemplate.expire(key, timeout, unit);
|
return Boolean.TRUE.equals(redisTemplate.expire(key, timeout, unit));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,18 +101,8 @@ public class RedisCache {
|
|||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
*/
|
*/
|
||||||
public boolean deleteObject(final String key) {
|
public void deleteObject(final String key) {
|
||||||
return redisTemplate.delete(key);
|
redisTemplate.delete(key);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除集合对象
|
|
||||||
*
|
|
||||||
* @param collection 多个对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long deleteObject(final Collection collection) {
|
|
||||||
return redisTemplate.delete(collection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,9 +136,8 @@ public class RedisCache {
|
|||||||
*/
|
*/
|
||||||
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) {
|
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) {
|
||||||
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
|
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
|
||||||
Iterator<T> it = dataSet.iterator();
|
for (T t : dataSet) {
|
||||||
while (it.hasNext()) {
|
setOperation.add(t);
|
||||||
setOperation.add(it.next());
|
|
||||||
}
|
}
|
||||||
return setOperation;
|
return setOperation;
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user