refactor(bps): 重构项目目录结构和代码
- 更新包名从 com.mzaxd.noodles 到 com.mzaxd.bps - 删除了一些未使用的类和接口 - 调整了部分代码结构以适应新的项目需求
This commit is contained in:
@@ -25,15 +25,15 @@
|
||||
|
||||
### 主要框架
|
||||
|
||||
| 技术 | 说明 | 官网 |
|
||||
| -------------- | ------------ | ------------------------------------------------------------ |
|
||||
| SpringBoot | 后端框架 | [https://spring.io/projects/spring-boot](https://spring.io/projects/spring-boot) |
|
||||
| SpringSecurity | 登录认证 | [https://spring.io/projects/spring-security](https://spring.io/projects/spring-security) |
|
||||
| jjwt | 生成Token | [https://github.com/jwtk/jjwt](https://github.com/jwtk/jjwt) |
|
||||
| MyBatis-Plus | ORM框架 | [https://baomidou.com/pages/24112f/](https://baomidou.com/pages/24112f/) |
|
||||
| oshi-core | 获取本机信息 | [https://github.com/oshi/oshi](https://github.com/oshi/oshi) |
|
||||
| hutool-all | 工具包 | [https://github.com/dromara/hutool](https://github.com/dromara/hutool) |
|
||||
| jsch | 连接控制台 | [http://www.jcraft.com/jsch/](http://www.jcraft.com/jsch/) |
|
||||
| 技术 | 说明 | 官网 |
|
||||
|----------------|---------|------------------------------------------------------------------------------------------|
|
||||
| SpringBoot | 后端框架 | [https://spring.io/projects/spring-boot](https://spring.io/projects/spring-boot) |
|
||||
| SpringSecurity | 登录认证 | [https://spring.io/projects/spring-security](https://spring.io/projects/spring-security) |
|
||||
| jjwt | 生成Token | [https://github.com/jwtk/jjwt](https://github.com/jwtk/jjwt) |
|
||||
| MyBatis-Plus | ORM框架 | [https://baomidou.com/pages/24112f/](https://baomidou.com/pages/24112f/) |
|
||||
| oshi-core | 获取本机信息 | [https://github.com/oshi/oshi](https://github.com/oshi/oshi) |
|
||||
| hutool-all | 工具包 | [https://github.com/dromara/hutool](https://github.com/dromara/hutool) |
|
||||
| jsch | 连接控制台 | [http://www.jcraft.com/jsch/](http://www.jcraft.com/jsch/) |
|
||||
|
||||
### 中间件&其他服务
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.mzaxd</groupId>
|
||||
<artifactId>Noodles</artifactId>
|
||||
<artifactId>BPS</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>Noodles</name>
|
||||
<description>Noodles</description>
|
||||
<name>BPS-Server</name>
|
||||
<description>BPS-Server</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -30,10 +30,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!-- druid -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.15</version>
|
||||
</dependency>
|
||||
<!--lombok-->
|
||||
<dependency>
|
||||
@@ -55,7 +56,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.33</version>
|
||||
<version>1.2.83</version>
|
||||
</dependency>
|
||||
<!--jwt依赖-->
|
||||
<dependency>
|
||||
@@ -84,10 +85,6 @@
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
@@ -107,28 +104,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.lionsoul/ip2region -->
|
||||
<dependency>
|
||||
<groupId>org.lionsoul</groupId>
|
||||
<artifactId>ip2region</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
<!--工具类-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.3.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>1.4.7</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.alibaba/easyexcel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<version>5.8.24</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.jcraft/jsch -->
|
||||
@@ -143,12 +123,6 @@
|
||||
<artifactId>ganymed-ssh2</artifactId>
|
||||
<version>262</version>
|
||||
</dependency>
|
||||
<!--监控-->
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
<version>2.7.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
+4
-5
@@ -1,9 +1,8 @@
|
||||
package com.mzaxd.noodles;
|
||||
package com.mzaxd.bps;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
@@ -11,11 +10,11 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
@MapperScan("com.mzaxd.noodles.mapper")
|
||||
public class NoodlesApplication {
|
||||
@MapperScan("com.mzaxd.bps.mapper")
|
||||
public class BPSApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(NoodlesApplication.class, args);
|
||||
SpringApplication.run(BPSApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.mzaxd.noodles.annotation;
|
||||
package com.mzaxd.bps.annotation;
|
||||
|
||||
import com.mzaxd.noodles.enums.OperationEnum;
|
||||
import com.mzaxd.bps.enums.OperationEnum;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
+13
-13
@@ -1,10 +1,10 @@
|
||||
package com.mzaxd.noodles.aspect;
|
||||
package com.mzaxd.bps.aspect;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mzaxd.noodles.annotation.SysLog;
|
||||
import com.mzaxd.noodles.domain.entity.AuditLog;
|
||||
import com.mzaxd.noodles.enums.OperationEnum;
|
||||
import com.mzaxd.noodles.service.AuditLogService;
|
||||
import com.mzaxd.bps.annotation.SysLog;
|
||||
import com.mzaxd.bps.domain.entity.AuditLog;
|
||||
import com.mzaxd.bps.service.AuditLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@@ -14,19 +14,19 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
@Component
|
||||
@Aspect
|
||||
@Slf4j
|
||||
public class SysLogAspect {
|
||||
|
||||
@Resource
|
||||
private AuditLogService auditLogService;
|
||||
|
||||
@Pointcut("@annotation(com.mzaxd.noodles.annotation.SysLog)")
|
||||
@Pointcut("@annotation(com.mzaxd.bps.annotation.SysLog)")
|
||||
public void logPointCut() {
|
||||
|
||||
}
|
||||
@@ -45,24 +45,24 @@ public class SysLogAspect {
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
|
||||
AuditLog log = new AuditLog();
|
||||
AuditLog auditLog = new AuditLog();
|
||||
SysLog syslog = method.getAnnotation(SysLog.class);
|
||||
if (syslog != null) {
|
||||
//注解上的描述
|
||||
log.setOperation(syslog.operation().getOperation());
|
||||
log.setOperationType(syslog.operation().getOperationType());
|
||||
auditLog.setOperation(syslog.operation().getOperation());
|
||||
auditLog.setOperationType(syslog.operation().getOperationType());
|
||||
}
|
||||
|
||||
//请求的参数
|
||||
Object[] args = joinPoint.getArgs();
|
||||
try {
|
||||
String params = JSON.toJSONString(args);
|
||||
log.setParam(params);
|
||||
auditLog.setParam(params);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
//保存系统日志
|
||||
auditLogService.save(log);
|
||||
auditLogService.save(auditLog);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.config;
|
||||
package com.mzaxd.bps.config;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.parser.ParserConfig;
|
||||
@@ -53,4 +53,4 @@ public class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||
protected JavaType getJavaType(Class<?> clazz) {
|
||||
return TypeFactory.defaultInstance().constructType(clazz);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.config;
|
||||
package com.mzaxd.bps.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||
@@ -23,4 +23,4 @@ public class MyBatisPlusConfig {
|
||||
mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
|
||||
return mybatisPlusInterceptor;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.config;
|
||||
package com.mzaxd.bps.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -28,4 +28,4 @@ public class RedisConfig {
|
||||
template.afterPropertiesSet();
|
||||
return template;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.config;
|
||||
package com.mzaxd.bps.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
+2
-3
@@ -1,11 +1,10 @@
|
||||
package com.mzaxd.noodles.config;
|
||||
package com.mzaxd.bps.config;
|
||||
|
||||
import com.mzaxd.noodles.filter.JwtAuthenticationTokenFilter;
|
||||
import com.mzaxd.bps.filter.JwtAuthenticationTokenFilter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.config;
|
||||
package com.mzaxd.bps.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -23,7 +23,7 @@ public class SwaggerConfig {
|
||||
.build();
|
||||
}
|
||||
private ApiInfo apiInfo() {
|
||||
Contact contact = new Contact("一个人的团队", "http://www.my.com", "my@my.com");
|
||||
Contact contact = new Contact("一个人的团队", "https://www.my.com", "my@my.com");
|
||||
return new ApiInfoBuilder()
|
||||
.title("文档标题")
|
||||
.description("文档描述")
|
||||
@@ -31,4 +31,4 @@ public class SwaggerConfig {
|
||||
.version("1.0.0") // 版本
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.config;
|
||||
package com.mzaxd.bps.config;
|
||||
|
||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
@@ -47,8 +47,7 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
fastJsonConfig.setSerializeConfig(SerializeConfig.globalInstance);
|
||||
fastConverter.setFastJsonConfig(fastJsonConfig);
|
||||
HttpMessageConverter<?> converter = fastConverter;
|
||||
return converter;
|
||||
return fastConverter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,4 +55,4 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
converters.add(fastJsonHttpMessageConverters());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.config;
|
||||
package com.mzaxd.bps.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.constant;
|
||||
package com.mzaxd.bps.constant;
|
||||
|
||||
/**
|
||||
* @author Mzaxd
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.constant;
|
||||
package com.mzaxd.bps.constant;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.constant;
|
||||
package com.mzaxd.bps.constant;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.constant;
|
||||
package com.mzaxd.bps.constant;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.constant;
|
||||
package com.mzaxd.bps.constant;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
+10
-10
@@ -1,10 +1,10 @@
|
||||
package com.mzaxd.noodles.controller;
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.noodles.annotation.SysLog;
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.entity.User;
|
||||
import com.mzaxd.noodles.enums.OperationEnum;
|
||||
import com.mzaxd.noodles.service.LoginService;
|
||||
import com.mzaxd.bps.annotation.SysLog;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.mzaxd.bps.enums.OperationEnum;
|
||||
import com.mzaxd.bps.service.LoginService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -20,23 +20,23 @@ public class AuthController {
|
||||
private LoginService loginService;
|
||||
|
||||
@PostMapping("/login")
|
||||
public ResponseResult login(@RequestBody User user) {
|
||||
public ResponseResult<?> login(@RequestBody User user) {
|
||||
return loginService.login(user);
|
||||
}
|
||||
|
||||
@SysLog(operation = OperationEnum.USER_FIRST_USE)
|
||||
@PostMapping("/updateAccount")
|
||||
public ResponseResult updateAccount(@RequestBody User user) {
|
||||
public ResponseResult<?> updateAccount(@RequestBody User user) {
|
||||
return loginService.updateAccount(user);
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public ResponseResult logout() {
|
||||
public ResponseResult<?> logout() {
|
||||
return loginService.logout();
|
||||
}
|
||||
|
||||
@GetMapping("/deleteAccount")
|
||||
public ResponseResult deleteAccount() {
|
||||
public ResponseResult<?> deleteAccount() {
|
||||
return loginService.deleteAccount();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.service.DashboardService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dashboard")
|
||||
public class DashboardController {
|
||||
|
||||
@Resource
|
||||
private DashboardService dashboardService;
|
||||
|
||||
@GetMapping("/getInstancesRealTimeData")
|
||||
public ResponseResult<?> getInstancesRealTimeData() {
|
||||
return dashboardService.getInstancesRealTimeData();
|
||||
}
|
||||
|
||||
@GetMapping("/getRecentConsoleList")
|
||||
public ResponseResult<?> getRecentConsoleList() {
|
||||
return dashboardService.getRecentConsoleList();
|
||||
}
|
||||
|
||||
@GetMapping("/getAffectedServirList")
|
||||
public ResponseResult<?> getAffectedServirList() {
|
||||
return dashboardService.getAffectedServirList();
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.mzaxd.noodles.controller;
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.service.AuditLogService;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.service.AuditLogService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
+5
-7
@@ -1,14 +1,12 @@
|
||||
package com.mzaxd.noodles.controller;
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.noodles.annotation.SysLog;
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.enums.OperationEnum;
|
||||
import com.mzaxd.noodles.service.NotificationService;
|
||||
import io.swagger.models.auth.In;
|
||||
import com.mzaxd.bps.annotation.SysLog;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.enums.OperationEnum;
|
||||
import com.mzaxd.bps.service.NotificationService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
+5
-9
@@ -1,18 +1,14 @@
|
||||
package com.mzaxd.noodles.controller;
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.search.SearchCategory;
|
||||
import com.mzaxd.noodles.domain.search.SearchItem;
|
||||
import com.mzaxd.noodles.util.SearchUtil;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.search.SearchCategory;
|
||||
import com.mzaxd.bps.domain.search.SearchItem;
|
||||
import com.mzaxd.bps.util.SearchUtil;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
package com.mzaxd.noodles.controller;
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.vo.SmtpVo;
|
||||
import com.mzaxd.noodles.domain.vo.SystemVo;
|
||||
import com.mzaxd.noodles.domain.vo.TerminalVo;
|
||||
import com.mzaxd.noodles.service.SystemSettingService;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.vo.SmtpVo;
|
||||
import com.mzaxd.bps.domain.vo.SystemVo;
|
||||
import com.mzaxd.bps.domain.vo.TerminalVo;
|
||||
import com.mzaxd.bps.service.SystemSettingService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.mzaxd.noodles.controller;
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.service.UserService;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.service.UserService;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
+8
-16
@@ -1,16 +1,14 @@
|
||||
package com.mzaxd.noodles.controller;
|
||||
package com.mzaxd.bps.controller;
|
||||
|
||||
import com.mzaxd.noodles.annotation.SysLog;
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.entity.User;
|
||||
import com.mzaxd.noodles.domain.vo.UserInfoVo;
|
||||
import com.mzaxd.noodles.enums.OperationEnum;
|
||||
import com.mzaxd.noodles.service.UserService;
|
||||
import com.mzaxd.noodles.util.IpUtil;
|
||||
import com.mzaxd.bps.annotation.SysLog;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.mzaxd.bps.domain.vo.UserInfoVo;
|
||||
import com.mzaxd.bps.enums.OperationEnum;
|
||||
import com.mzaxd.bps.service.UserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -33,12 +31,6 @@ public class UserController {
|
||||
return userService.updateUserInfo(user);
|
||||
}
|
||||
|
||||
@GetMapping("/profileHeader/{id}")
|
||||
public ResponseResult profileHeader(@PathVariable("id") Integer id, HttpServletRequest request) {
|
||||
String ipAddr = IpUtil.getIpAddr(request);
|
||||
return userService.getProfileHeader(id, ipAddr);
|
||||
}
|
||||
|
||||
@GetMapping("/profile")
|
||||
public ResponseResult profile() {
|
||||
return userService.getProfile();
|
||||
@@ -62,4 +54,4 @@ public class UserController {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+28
-46
@@ -1,13 +1,17 @@
|
||||
package com.mzaxd.noodles.domain;
|
||||
package com.mzaxd.bps.domain;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author Mzaxd
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ResponseResult<T> implements Serializable {
|
||||
private Integer code;
|
||||
@@ -35,49 +39,51 @@ public class ResponseResult<T> implements Serializable {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static ResponseResult errorResult(int code, String msg) {
|
||||
ResponseResult result = new ResponseResult();
|
||||
public static ResponseResult<?> errorResult(int code, String msg) {
|
||||
ResponseResult<?> result = new ResponseResult<>();
|
||||
return result.error(code, msg);
|
||||
}
|
||||
public static ResponseResult okResult() {
|
||||
ResponseResult result = new ResponseResult();
|
||||
return result;
|
||||
|
||||
public static ResponseResult<?> okResult() {
|
||||
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);
|
||||
}
|
||||
public static ResponseResult okResult(String msg, Object data) {
|
||||
|
||||
public static ResponseResult<?> okResult(String msg, Object data) {
|
||||
ResponseResult result = setAppHttpCodeEnum(AppHttpCodeEnum.SUCCESS);
|
||||
result.setMsg(msg);
|
||||
if(data!=null) {
|
||||
if (data != null) {
|
||||
result.setData(data);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ResponseResult okResult(Object data) {
|
||||
public static ResponseResult<?> okResult(Object data) {
|
||||
ResponseResult result = setAppHttpCodeEnum(AppHttpCodeEnum.SUCCESS, AppHttpCodeEnum.SUCCESS.getMsg());
|
||||
if(data!=null) {
|
||||
if (data != null) {
|
||||
result.setData(data);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ResponseResult errorResult(AppHttpCodeEnum enums){
|
||||
return setAppHttpCodeEnum(enums,enums.getMsg());
|
||||
public static ResponseResult<?> errorResult(AppHttpCodeEnum enums) {
|
||||
return setAppHttpCodeEnum(enums, enums.getMsg());
|
||||
}
|
||||
|
||||
public static ResponseResult errorResult(AppHttpCodeEnum enums, String msg){
|
||||
return setAppHttpCodeEnum(enums,msg);
|
||||
public static ResponseResult<?> errorResult(AppHttpCodeEnum enums, String msg) {
|
||||
return setAppHttpCodeEnum(enums, msg);
|
||||
}
|
||||
|
||||
public static ResponseResult setAppHttpCodeEnum(AppHttpCodeEnum enums){
|
||||
return okResult(enums.getCode(),enums.getMsg());
|
||||
public static ResponseResult<?> setAppHttpCodeEnum(AppHttpCodeEnum enums) {
|
||||
return okResult(enums.getCode(), enums.getMsg());
|
||||
}
|
||||
|
||||
private static ResponseResult setAppHttpCodeEnum(AppHttpCodeEnum enums, String msg){
|
||||
return okResult(enums.getCode(),msg);
|
||||
private static ResponseResult<?> setAppHttpCodeEnum(AppHttpCodeEnum enums, String msg) {
|
||||
return okResult(enums.getCode(), msg);
|
||||
}
|
||||
|
||||
public ResponseResult<?> error(Integer code, String msg) {
|
||||
@@ -104,28 +110,4 @@ public class ResponseResult<T> implements Serializable {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+6
-12
@@ -1,19 +1,16 @@
|
||||
package com.mzaxd.noodles.domain.entity;
|
||||
package com.mzaxd.bps.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 13439
|
||||
* @TableName audit_log
|
||||
*/
|
||||
@@ -23,7 +20,7 @@ import lombok.experimental.Accessors;
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(of = "param")
|
||||
public class AuditLog implements Serializable {
|
||||
public class AuditLog {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@@ -57,7 +54,4 @@ public class AuditLog implements Serializable {
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.entity;
|
||||
package com.mzaxd.bps.domain.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+6
-11
@@ -1,17 +1,15 @@
|
||||
package com.mzaxd.noodles.domain.entity;
|
||||
package com.mzaxd.bps.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @TableName notification
|
||||
*/
|
||||
@TableName(value ="notification")
|
||||
@@ -19,7 +17,7 @@ import lombok.experimental.Accessors;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class Notification implements Serializable {
|
||||
public class Notification {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@@ -71,7 +69,4 @@ public class Notification implements Serializable {
|
||||
* 删除标志(0代表未删除,1代表已删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
+4
-9
@@ -1,24 +1,21 @@
|
||||
package com.mzaxd.noodles.domain.entity;
|
||||
package com.mzaxd.bps.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @TableName system_setting
|
||||
*/
|
||||
@TableName(value ="system_setting")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SystemSetting implements Serializable {
|
||||
public class SystemSetting {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@@ -80,6 +77,4 @@ public class SystemSetting implements Serializable {
|
||||
*/
|
||||
private String background;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
+4
-7
@@ -1,21 +1,20 @@
|
||||
package com.mzaxd.noodles.domain.entity;
|
||||
package com.mzaxd.bps.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author root
|
||||
* @TableName user
|
||||
*/
|
||||
@TableName(value ="user")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class User implements Serializable {
|
||||
public class User {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@@ -81,6 +80,4 @@ public class User implements Serializable {
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.mzaxd.noodles.domain.message;
|
||||
package com.mzaxd.bps.domain.message;
|
||||
|
||||
import com.mzaxd.noodledetector.util.Arith;
|
||||
import com.mzaxd.bps.util.Arith;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.message;
|
||||
package com.mzaxd.bps.domain.message;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-2
@@ -1,11 +1,10 @@
|
||||
package com.mzaxd.noodles.domain.message;
|
||||
package com.mzaxd.bps.domain.message;
|
||||
|
||||
/**
|
||||
* @author Mzaxd
|
||||
* @since 2023-02-05 10:50
|
||||
*/
|
||||
|
||||
import com.mzaxd.noodledetector.util.Arith;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.message;
|
||||
package com.mzaxd.bps.domain.message;
|
||||
|
||||
/**
|
||||
* @author Mzaxd
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.message;
|
||||
package com.mzaxd.bps.domain.message;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.message;
|
||||
package com.mzaxd.bps.domain.message;
|
||||
|
||||
/**
|
||||
* @author Mzaxd
|
||||
@@ -38,7 +38,7 @@ public class Server {
|
||||
/**
|
||||
* Os相关信息
|
||||
*/
|
||||
private com.mzaxd.noodles.domain.message.Os os = new Os();
|
||||
private com.mzaxd.bps.domain.message.Os os = new Os();
|
||||
|
||||
/**
|
||||
* CPU相关信息
|
||||
@@ -58,7 +58,7 @@ public class Server {
|
||||
/**
|
||||
* 磁盘相关信息
|
||||
*/
|
||||
private List<SysFile> sysFiles = new LinkedList<SysFile>();
|
||||
private List<SysFile> sysFiles = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* 网络相关信息
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.message;
|
||||
package com.mzaxd.bps.domain.message;
|
||||
|
||||
/**
|
||||
* @author Mzaxd
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.message;
|
||||
package com.mzaxd.bps.domain.message;
|
||||
|
||||
/**
|
||||
* @author Mzaxd
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.search;
|
||||
package com.mzaxd.bps.domain.search;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONType;
|
||||
import lombok.Getter;
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package com.mzaxd.noodles.domain.search;
|
||||
package com.mzaxd.bps.domain.search;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONType;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package com.mzaxd.noodles.domain.search;
|
||||
package com.mzaxd.bps.domain.search;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONType;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-5
@@ -1,9 +1,5 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-6
@@ -1,14 +1,9 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.domain.vo;
|
||||
package com.mzaxd.bps.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+4
-8
@@ -1,9 +1,12 @@
|
||||
package com.mzaxd.noodles.enums;
|
||||
package com.mzaxd.bps.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author Mzaxd
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public enum AppHttpCodeEnum {
|
||||
/**
|
||||
* 操作成功通用返回信息
|
||||
@@ -55,11 +58,4 @@ public enum AppHttpCodeEnum {
|
||||
this.msg = errorMessage;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
+4
-8
@@ -1,4 +1,6 @@
|
||||
package com.mzaxd.noodles.enums;
|
||||
package com.mzaxd.bps.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 操作日志-操作类型
|
||||
@@ -6,6 +8,7 @@ package com.mzaxd.noodles.enums;
|
||||
* @author 13439
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public enum OperationEnum {
|
||||
|
||||
/**
|
||||
@@ -111,11 +114,4 @@ public enum OperationEnum {
|
||||
this.operationType = operationType;
|
||||
}
|
||||
|
||||
public String getOperation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
public String getOperationType() {
|
||||
return operationType;
|
||||
}
|
||||
}
|
||||
+5
-11
@@ -1,6 +1,7 @@
|
||||
package com.mzaxd.noodles.exception;
|
||||
package com.mzaxd.bps.exception;
|
||||
|
||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -8,24 +9,17 @@ import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
||||
* @date 11/27/22 3:19 AM
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public class SystemException extends RuntimeException{
|
||||
|
||||
private final int code;
|
||||
|
||||
private final String msg;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public SystemException(AppHttpCodeEnum httpCodeEnum) {
|
||||
super(httpCodeEnum.getMsg());
|
||||
this.code = httpCodeEnum.getCode();
|
||||
this.msg = httpCodeEnum.getMsg();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+12
-10
@@ -1,13 +1,14 @@
|
||||
package com.mzaxd.noodles.filter;
|
||||
package com.mzaxd.bps.filter;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.entity.LoginUser;
|
||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.noodles.util.JwtUtil;
|
||||
import com.mzaxd.noodles.util.RedisCache;
|
||||
import com.mzaxd.noodles.util.WebUtils;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.LoginUser;
|
||||
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.bps.util.JwtUtil;
|
||||
import com.mzaxd.bps.util.RedisCache;
|
||||
import com.mzaxd.bps.util.WebUtils;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -26,6 +27,7 @@ import java.util.Objects;
|
||||
* @author root
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||
|
||||
@Resource
|
||||
@@ -45,10 +47,10 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||
try {
|
||||
claims = JwtUtil.parseJWT(token);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
//token超时 token非法
|
||||
//响应告诉前端需要重新登录
|
||||
ResponseResult result = ResponseResult.errorResult(AppHttpCodeEnum.NEED_LOGIN);
|
||||
ResponseResult<?> result = ResponseResult.errorResult(AppHttpCodeEnum.NEED_LOGIN);
|
||||
WebUtils.renderString(response, JSON.toJSONString(result));
|
||||
return;
|
||||
}
|
||||
@@ -58,7 +60,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||
//如果redis中没有用户信息
|
||||
if (Objects.isNull(loginUser)) {
|
||||
//说明登录过期 需要重新登录
|
||||
ResponseResult result = ResponseResult.errorResult(AppHttpCodeEnum.NEED_LOGIN);
|
||||
ResponseResult<?> result = ResponseResult.errorResult(AppHttpCodeEnum.NEED_LOGIN);
|
||||
WebUtils.renderString(response, JSON.toJSONString(result));
|
||||
return;
|
||||
}
|
||||
+9
-7
@@ -1,9 +1,10 @@
|
||||
package com.mzaxd.noodles.handler;
|
||||
package com.mzaxd.bps.handler;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.noodles.util.WebUtils;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.bps.util.WebUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -16,12 +17,13 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @author root
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AccessDeniedHandlerImpl implements AccessDeniedHandler {
|
||||
@Override
|
||||
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws ServletException {
|
||||
accessDeniedException.printStackTrace();
|
||||
ResponseResult result = ResponseResult.errorResult(AppHttpCodeEnum.NO_OPERATOR_AUTH);
|
||||
log.error(accessDeniedException.getMessage());
|
||||
ResponseResult<?> result = ResponseResult.errorResult(AppHttpCodeEnum.NO_OPERATOR_AUTH);
|
||||
//响应给前端
|
||||
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.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.noodles.util.WebUtils;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.bps.util.WebUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.InsufficientAuthenticationException;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
@@ -17,14 +18,15 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @author root
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) {
|
||||
authException.printStackTrace();
|
||||
log.error(authException.getMessage());
|
||||
//InsufficientAuthenticationException
|
||||
//BadCredentialsException
|
||||
ResponseResult result;
|
||||
ResponseResult<?> result;
|
||||
if (authException instanceof BadCredentialsException) {
|
||||
result = ResponseResult.errorResult(AppHttpCodeEnum.LOGIN_ERROR.getCode(), authException.getMessage());
|
||||
} 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.noodles.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.noodles.exception.SystemException;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
@@ -15,17 +15,17 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
+6
-4
@@ -1,7 +1,8 @@
|
||||
package com.mzaxd.noodles.handler;
|
||||
package com.mzaxd.bps.handler;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import com.mzaxd.noodles.util.SecurityUtils;
|
||||
import com.mzaxd.bps.util.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -10,6 +11,7 @@ import java.util.Date;
|
||||
/**
|
||||
* @author root
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
@Override
|
||||
@@ -18,7 +20,7 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
try {
|
||||
userId = SecurityUtils.getUserId();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
//表示是自己创建
|
||||
userId = -1L;
|
||||
}
|
||||
@@ -40,4 +42,4 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
this.setFieldValByName("updateTime", new Date(), metaObject);
|
||||
this.setFieldValByName("updateBy", userId, metaObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -1,13 +1,12 @@
|
||||
package com.mzaxd.noodles.mapper;
|
||||
package com.mzaxd.bps.mapper;
|
||||
|
||||
import com.mzaxd.noodles.domain.entity.AuditLog;
|
||||
import com.mzaxd.bps.domain.entity.AuditLog;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
* @description 针对表【audit_log】的数据库操作Mapper
|
||||
* @createDate 2023-02-13 12:19:26
|
||||
* @Entity com.mzaxd.noodles.domain.entity.AuditLog
|
||||
*/
|
||||
public interface AuditLogMapper extends BaseMapper<AuditLog> {
|
||||
|
||||
+2
-3
@@ -1,13 +1,12 @@
|
||||
package com.mzaxd.noodles.mapper;
|
||||
package com.mzaxd.bps.mapper;
|
||||
|
||||
import com.mzaxd.noodles.domain.entity.Notification;
|
||||
import com.mzaxd.bps.domain.entity.Notification;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
* @description 针对表【notification】的数据库操作Mapper
|
||||
* @createDate 2023-02-16 16:04:53
|
||||
* @Entity com.mzaxd.noodles.domain.entity.Notification
|
||||
*/
|
||||
public interface NotificationMapper extends BaseMapper<Notification> {
|
||||
|
||||
+2
-3
@@ -1,13 +1,12 @@
|
||||
package com.mzaxd.noodles.mapper;
|
||||
package com.mzaxd.bps.mapper;
|
||||
|
||||
import com.mzaxd.noodles.domain.entity.SystemSetting;
|
||||
import com.mzaxd.bps.domain.entity.SystemSetting;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
* @description 针对表【system_setting】的数据库操作Mapper
|
||||
* @createDate 2023-02-16 20:25:57
|
||||
* @Entity com.mzaxd.noodles.domain.entity.SystemSetting
|
||||
*/
|
||||
public interface SystemSettingMapper extends BaseMapper<SystemSetting> {
|
||||
|
||||
+2
-3
@@ -1,13 +1,12 @@
|
||||
package com.mzaxd.noodles.mapper;
|
||||
package com.mzaxd.bps.mapper;
|
||||
|
||||
import com.mzaxd.noodles.domain.entity.User;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
* @description 针对表【user】的数据库操作Mapper
|
||||
* @createDate 2023-01-28 09:16:07
|
||||
* @Entity com.mzaxd.noodles.domain.entity.User
|
||||
*/
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
package com.mzaxd.noodles.service;
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.entity.AuditLog;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.AuditLog;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ public interface AuditLogService extends IService<AuditLog> {
|
||||
* @param currentPage
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getLogList(Integer perPage, Integer currentPage);
|
||||
ResponseResult<?> getLogList(Integer perPage, Integer currentPage);
|
||||
|
||||
/**
|
||||
* 获取参数
|
||||
@@ -26,12 +26,12 @@ public interface AuditLogService extends IService<AuditLog> {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getParam(Integer id);
|
||||
ResponseResult<?> getParam(Integer id);
|
||||
|
||||
/**
|
||||
* 获取用户日志
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getUserLog();
|
||||
ResponseResult<?> getUserLog();
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
package com.mzaxd.noodles.service;
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
@@ -11,14 +11,14 @@ public interface DashboardService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getInstancesRealTimeData();
|
||||
ResponseResult<?> getInstancesRealTimeData();
|
||||
|
||||
/**
|
||||
* 获取最近连接过的控制台列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getRecentConsoleList();
|
||||
ResponseResult<?> getRecentConsoleList();
|
||||
|
||||
/**
|
||||
* 获取所有受影响的服务
|
||||
@@ -27,5 +27,5 @@ public interface DashboardService {
|
||||
* @author mzaxd
|
||||
* @date 2023/3/8 9:43
|
||||
*/
|
||||
ResponseResult getAffectedServirList();
|
||||
ResponseResult<?> getAffectedServirList();
|
||||
}
|
||||
+7
-7
@@ -1,8 +1,8 @@
|
||||
package com.mzaxd.noodles.service;
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.entity.User;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
@@ -17,7 +17,7 @@ public interface LoginService extends IService<User> {
|
||||
* @param user
|
||||
* @return ResponseResult
|
||||
*/
|
||||
ResponseResult login(User user);
|
||||
ResponseResult<?> login(User user);
|
||||
|
||||
/**
|
||||
* 后台用户退出登陆
|
||||
@@ -26,7 +26,7 @@ public interface LoginService extends IService<User> {
|
||||
* @date 12/6/22 2:07 PM
|
||||
* @return ResponseResult
|
||||
*/
|
||||
ResponseResult logout();
|
||||
ResponseResult<?> logout();
|
||||
|
||||
/**
|
||||
* 首次登陆时 修改账户信息
|
||||
@@ -34,12 +34,12 @@ public interface LoginService extends IService<User> {
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
ResponseResult updateAccount(User user);
|
||||
ResponseResult<?> updateAccount(User user);
|
||||
|
||||
/**
|
||||
* 删除账号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult deleteAccount();
|
||||
ResponseResult<?> deleteAccount();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.Notification;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
* @description 针对表【notification】的数据库操作Service
|
||||
* @createDate 2023-02-16 16:04:53
|
||||
*/
|
||||
public interface NotificationService extends IService<Notification> {
|
||||
|
||||
/**
|
||||
* 提醒列表
|
||||
* @param tab
|
||||
* @param perPage
|
||||
* @param currentPage
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getNotificationList(Integer tab, Integer perPage, Integer currentPage);
|
||||
|
||||
/**
|
||||
* 获取新通知数量
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> getNotificationCount();
|
||||
|
||||
/**
|
||||
* 确认提醒
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResponseResult<?> affirmNotification(Long id);
|
||||
}
|
||||
+12
-12
@@ -1,11 +1,11 @@
|
||||
package com.mzaxd.noodles.service;
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.entity.SystemSetting;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.SystemSetting;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mzaxd.noodles.domain.vo.SmtpVo;
|
||||
import com.mzaxd.noodles.domain.vo.SystemVo;
|
||||
import com.mzaxd.noodles.domain.vo.TerminalVo;
|
||||
import com.mzaxd.bps.domain.vo.SmtpVo;
|
||||
import com.mzaxd.bps.domain.vo.SystemVo;
|
||||
import com.mzaxd.bps.domain.vo.TerminalVo;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
@@ -19,7 +19,7 @@ public interface SystemSettingService extends IService<SystemSetting> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getSmtpSetting();
|
||||
ResponseResult<?> getSmtpSetting();
|
||||
|
||||
/**
|
||||
* 保存smtp设置
|
||||
@@ -27,14 +27,14 @@ public interface SystemSettingService extends IService<SystemSetting> {
|
||||
* @param smtpVo
|
||||
* @return
|
||||
*/
|
||||
ResponseResult saveSmtpSetting(SmtpVo smtpVo);
|
||||
ResponseResult<?> saveSmtpSetting(SmtpVo smtpVo);
|
||||
|
||||
/**
|
||||
* 获取终端设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getTerminalSetting();
|
||||
ResponseResult<?> getTerminalSetting();
|
||||
|
||||
/**
|
||||
* 报错终端设置
|
||||
@@ -42,14 +42,14 @@ public interface SystemSettingService extends IService<SystemSetting> {
|
||||
* @param terminalVo
|
||||
* @return
|
||||
*/
|
||||
ResponseResult saveTerminalSetting(TerminalVo terminalVo);
|
||||
ResponseResult<?> saveTerminalSetting(TerminalVo terminalVo);
|
||||
|
||||
/**
|
||||
* 获取系统设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getSystemSetting();
|
||||
ResponseResult<?> getSystemSetting();
|
||||
|
||||
|
||||
/**
|
||||
@@ -58,5 +58,5 @@ public interface SystemSettingService extends IService<SystemSetting> {
|
||||
* @param systemVo
|
||||
* @return
|
||||
*/
|
||||
ResponseResult saveSystemSetting(SystemVo systemVo);
|
||||
ResponseResult<?> saveSystemSetting(SystemVo systemVo);
|
||||
}
|
||||
+11
-19
@@ -1,9 +1,9 @@
|
||||
package com.mzaxd.noodles.service;
|
||||
package com.mzaxd.bps.service;
|
||||
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.entity.User;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mzaxd.noodles.domain.vo.UserInfoVo;
|
||||
import com.mzaxd.bps.domain.vo.UserInfoVo;
|
||||
|
||||
/**
|
||||
* @author root
|
||||
@@ -19,7 +19,7 @@ public interface UserService extends IService<User> {
|
||||
* @date 1/29/23 4:16 AM
|
||||
* @return ResponseResult
|
||||
*/
|
||||
ResponseResult userInfo();
|
||||
ResponseResult<?> userInfo();
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
@@ -29,35 +29,27 @@ public interface UserService extends IService<User> {
|
||||
* @param user
|
||||
* @return ResponseResult
|
||||
*/
|
||||
ResponseResult updateUserInfo(User user);
|
||||
|
||||
/**
|
||||
* 返回个人信息页面头部数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getProfileHeader(Integer id, String ip);
|
||||
ResponseResult<?> updateUserInfo(User user);
|
||||
|
||||
/**
|
||||
* 返回profile页面所需数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getProfile();
|
||||
ResponseResult<?> getProfile();
|
||||
|
||||
/**
|
||||
* 通过判断默认账户的state状态来判断是否第一次使用
|
||||
* @return
|
||||
*/
|
||||
ResponseResult isFirstUse();
|
||||
ResponseResult<?> isFirstUse();
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
ResponseResult changePassword(String password);
|
||||
ResponseResult<?> changePassword(String password);
|
||||
|
||||
/**
|
||||
* 通过id获取UserInfo
|
||||
@@ -65,12 +57,12 @@ public interface UserService extends IService<User> {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResponseResult getUserInfo(Integer id);
|
||||
ResponseResult<?> getUserInfo(Integer id);
|
||||
|
||||
/**
|
||||
* 修改账号信息
|
||||
* @param userData
|
||||
* @return
|
||||
*/
|
||||
ResponseResult updateUserInfo(UserInfoVo userData);
|
||||
ResponseResult<?> updateUserInfo(UserInfoVo userData);
|
||||
}
|
||||
+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.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mzaxd.noodles.constant.SystemConstant;
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.entity.*;
|
||||
import com.mzaxd.noodles.domain.vo.*;
|
||||
import com.mzaxd.noodles.mapper.UserMapper;
|
||||
import com.mzaxd.noodles.service.AuditLogService;
|
||||
import com.mzaxd.noodles.mapper.AuditLogMapper;
|
||||
import com.mzaxd.noodles.util.BeanCopyUtils;
|
||||
import com.mzaxd.bps.constant.SystemConstant;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.*;
|
||||
import com.mzaxd.bps.domain.vo.*;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.mapper.UserMapper;
|
||||
import com.mzaxd.bps.service.AuditLogService;
|
||||
import com.mzaxd.bps.mapper.AuditLogMapper;
|
||||
import com.mzaxd.bps.util.BeanCopyUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@@ -23,6 +25,7 @@ import java.util.List;
|
||||
* @createDate 2023-02-13 12:19:26
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = SystemException.class)
|
||||
public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog>
|
||||
implements AuditLogService{
|
||||
|
||||
@@ -30,7 +33,7 @@ public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog>
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public ResponseResult getLogList(Integer perPage, Integer currentPage) {
|
||||
public ResponseResult<?> getLogList(Integer perPage, Integer currentPage) {
|
||||
//分页
|
||||
PageHelper.startPage(currentPage, perPage);
|
||||
LambdaQueryWrapper<AuditLog> auditLogLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
@@ -52,13 +55,13 @@ public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog>
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult getParam(Integer id) {
|
||||
public ResponseResult<?> getParam(Integer id) {
|
||||
AuditLog auditLog = getById(id);
|
||||
return ResponseResult.okResult(auditLog.getParam());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult getUserLog() {
|
||||
public ResponseResult<?> getUserLog() {
|
||||
LambdaQueryWrapper<AuditLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AuditLog::getOperationType, SystemConstant.LOG_USER);
|
||||
queryWrapper.orderByDesc(AuditLog::getCreateTime);
|
||||
+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.mzaxd.noodles.constant.SystemConstant;
|
||||
import com.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.entity.LoginUser;
|
||||
import com.mzaxd.noodles.domain.entity.User;
|
||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.noodles.mapper.UserMapper;
|
||||
import com.mzaxd.noodles.service.LoginService;
|
||||
import com.mzaxd.noodles.service.UserService;
|
||||
import com.mzaxd.noodles.util.JwtUtil;
|
||||
import com.mzaxd.noodles.util.RedisCache;
|
||||
import com.mzaxd.noodles.util.SecurityUtils;
|
||||
import com.mzaxd.bps.constant.SystemConstant;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.LoginUser;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.mapper.UserMapper;
|
||||
import com.mzaxd.bps.service.LoginService;
|
||||
import com.mzaxd.bps.util.JwtUtil;
|
||||
import com.mzaxd.bps.util.RedisCache;
|
||||
import com.mzaxd.bps.util.SecurityUtils;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
@@ -27,6 +28,7 @@ import java.util.Objects;
|
||||
* @author root
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = {SystemException.class})
|
||||
public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements LoginService {
|
||||
|
||||
@Resource
|
||||
@@ -39,7 +41,7 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public ResponseResult login(User user) {
|
||||
public ResponseResult<?> login(User user) {
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getEmail(), user.getPassword());
|
||||
Authentication authenticate = authenticationManager.authenticate(authenticationToken);
|
||||
//判断是否认证通过
|
||||
@@ -60,7 +62,7 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult logout() {
|
||||
public ResponseResult<?> logout() {
|
||||
//获取当前登录的用户id
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
//删除redis中对应的值
|
||||
@@ -69,7 +71,7 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult updateAccount(User user) {
|
||||
public ResponseResult<?> updateAccount(User user) {
|
||||
//获取当前登录的用户id
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
User defaultUser = getById(userId);
|
||||
@@ -81,7 +83,7 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult deleteAccount() {
|
||||
public ResponseResult<?> deleteAccount() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
userMapper.deleteById(userId);
|
||||
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.mzaxd.noodles.domain.ResponseResult;
|
||||
import com.mzaxd.noodles.domain.entity.SystemSetting;
|
||||
import com.mzaxd.noodles.domain.vo.SmtpVo;
|
||||
import com.mzaxd.noodles.domain.vo.SystemVo;
|
||||
import com.mzaxd.noodles.domain.vo.TerminalVo;
|
||||
import com.mzaxd.noodles.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.noodles.service.SystemSettingService;
|
||||
import com.mzaxd.noodles.mapper.SystemSettingMapper;
|
||||
import com.mzaxd.noodles.util.BeanCopyUtils;
|
||||
import com.mzaxd.bps.domain.ResponseResult;
|
||||
import com.mzaxd.bps.domain.entity.SystemSetting;
|
||||
import com.mzaxd.bps.domain.vo.SmtpVo;
|
||||
import com.mzaxd.bps.domain.vo.SystemVo;
|
||||
import com.mzaxd.bps.domain.vo.TerminalVo;
|
||||
import com.mzaxd.bps.enums.AppHttpCodeEnum;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.service.SystemSettingService;
|
||||
import com.mzaxd.bps.mapper.SystemSettingMapper;
|
||||
import com.mzaxd.bps.util.BeanCopyUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author 13439
|
||||
@@ -18,18 +20,19 @@ import org.springframework.stereotype.Service;
|
||||
* @createDate 2023-02-16 20:25:57
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = SystemException.class)
|
||||
public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, SystemSetting>
|
||||
implements SystemSettingService{
|
||||
|
||||
@Override
|
||||
public ResponseResult getSmtpSetting() {
|
||||
public ResponseResult<?> getSmtpSetting() {
|
||||
SystemSetting systemSetting = getSetting();
|
||||
SmtpVo smtpVo = BeanCopyUtils.copyBean(systemSetting, SmtpVo.class);
|
||||
return ResponseResult.okResult(smtpVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult saveSmtpSetting(SmtpVo smtpVo) {
|
||||
public ResponseResult<?> saveSmtpSetting(SmtpVo smtpVo) {
|
||||
SystemSetting systemSetting = getById(1);
|
||||
systemSetting.setServerEmail(smtpVo.getServerEmail());
|
||||
systemSetting.setEmailPass(smtpVo.getEmailPass());
|
||||
@@ -39,14 +42,14 @@ public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, S
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult getTerminalSetting() {
|
||||
public ResponseResult<?> getTerminalSetting() {
|
||||
SystemSetting systemSetting = getSetting();
|
||||
TerminalVo terminalVo = BeanCopyUtils.copyBean(systemSetting, TerminalVo.class);
|
||||
return ResponseResult.okResult(terminalVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult saveTerminalSetting(TerminalVo terminalVo) {
|
||||
public ResponseResult<?> saveTerminalSetting(TerminalVo terminalVo) {
|
||||
SystemSetting systemSetting = getById(1);
|
||||
systemSetting.setRendererType(terminalVo.getRendererType());
|
||||
systemSetting.setFontSize(terminalVo.getFontSize());
|
||||
@@ -58,14 +61,14 @@ public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, S
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult getSystemSetting() {
|
||||
public ResponseResult<?> getSystemSetting() {
|
||||
SystemSetting systemSetting = getSetting();
|
||||
SystemVo systemVo = BeanCopyUtils.copyBean(systemSetting, SystemVo.class);
|
||||
return ResponseResult.okResult(systemVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult saveSystemSetting(SystemVo systemVo) {
|
||||
public ResponseResult<?> saveSystemSetting(SystemVo systemVo) {
|
||||
SystemSetting systemSetting = getById(1);
|
||||
systemSetting.setLogExpire(systemVo.getLogExpire());
|
||||
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.mzaxd.noodles.domain.entity.LoginUser;
|
||||
import com.mzaxd.noodles.domain.entity.User;
|
||||
import com.mzaxd.noodles.mapper.UserMapper;
|
||||
import com.mzaxd.bps.domain.entity.LoginUser;
|
||||
import com.mzaxd.bps.domain.entity.User;
|
||||
import com.mzaxd.bps.exception.SystemException;
|
||||
import com.mzaxd.bps.mapper.UserMapper;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Objects;
|
||||
@@ -18,6 +20,7 @@ import java.util.Objects;
|
||||
* @createDate 2022-11-26 12:24:08
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = SystemException.class)
|
||||
public class UserDetailServiceImpl implements UserDetailsService {
|
||||
|
||||
@Resource
|
||||
@@ -0,0 +1,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
|
||||
+4
-2
@@ -1,5 +1,6 @@
|
||||
package com.mzaxd.noodles.util;
|
||||
package com.mzaxd.bps.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
@@ -9,6 +10,7 @@ import java.util.stream.Collectors;
|
||||
* @author Mzaxd
|
||||
* @since 2022-11-22 15:36
|
||||
*/
|
||||
@Slf4j
|
||||
public class BeanCopyUtils {
|
||||
|
||||
private BeanCopyUtils() {
|
||||
@@ -22,7 +24,7 @@ public class BeanCopyUtils {
|
||||
//实现属性copy
|
||||
BeanUtils.copyProperties(source, result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
//返回结果
|
||||
return result;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodles.util;
|
||||
package com.mzaxd.bps.util;
|
||||
|
||||
import oshi.SystemInfo;
|
||||
import oshi.hardware.CentralProcessor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.mzaxd.noodledetector.util;
|
||||
package com.mzaxd.bps.util;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
package com.mzaxd.noodles.util;
|
||||
package com.mzaxd.bps.util;
|
||||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.JwtBuilder;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
@@ -119,4 +118,4 @@ public class JwtUtil {
|
||||
.parseClaimsJws(jwt)
|
||||
.getBody();
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-18
@@ -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.HashOperations;
|
||||
@@ -71,7 +71,7 @@ public class RedisCache {
|
||||
* @return true=设置成功;false=设置失败
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public boolean deleteObject(final String key) {
|
||||
return redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除集合对象
|
||||
*
|
||||
* @param collection 多个对象
|
||||
* @return
|
||||
*/
|
||||
public long deleteObject(final Collection collection) {
|
||||
return redisTemplate.delete(collection);
|
||||
public void deleteObject(final String key) {
|
||||
redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,9 +136,8 @@ public class RedisCache {
|
||||
*/
|
||||
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) {
|
||||
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
|
||||
Iterator<T> it = dataSet.iterator();
|
||||
while (it.hasNext()) {
|
||||
setOperation.add(it.next());
|
||||
for (T t : dataSet) {
|
||||
setOperation.add(t);
|
||||
}
|
||||
return setOperation;
|
||||
}
|
||||
@@ -252,4 +241,4 @@ public class RedisCache {
|
||||
public void incrementCacheMapValue(String key, String hKey, long v) {
|
||||
redisTemplate.boundHashOps(key).increment(hKey, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user