From 76285a5ba672fc591fbc30fd2b64d1d2be7f3dd4 Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Wed, 26 Mar 2025 21:57:41 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E7=94=A8=E6=88=B7=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/pom.xml | 12 +- .../bunny/services/config/Knife4jConfig.java | 9 +- .../cn/bunny/services/config/WebConfig.java | 13 ++ .../ConfigurationController.java | 9 +- .../log/UserLoginLogController.java | 28 ++- .../exception/GlobalExceptionHandler.java | 2 +- .../security/config/WebSecurityConfig.java | 4 +- .../log/impl/UserLoginLogServiceImpl.java | 22 +- .../cn/bunny/services/utils/JwtHelper.java | 9 +- .../bunny/services/utils/system/UserUtil.java | 9 - service/src/main/resources/application.yml | 2 + .../src/main/resources/static/error/400.html | 117 +++++----- .../src/main/resources/static/error/403.html | 117 +++++----- .../src/main/resources/static/error/404.html | 135 ++++++------ .../src/main/resources/static/error/501.html | 111 +++++----- .../src/main/resources/static/error/502.html | 137 ++++++------ .../src/main/resources/static/error/503.html | 117 +++++----- .../src/main/resources/static/error/504.html | 132 ++++++------ .../src/main/resources/static/error/505.html | 120 ++++++----- .../src/main/resources/static/error/506.html | 111 +++++----- .../src/main/resources/static/error/507.html | 111 +++++----- .../src/main/resources/static/error/509.html | 111 +++++----- .../src/main/resources/static/error/510.html | 111 +++++----- .../src/main/resources/templates/index.html | 203 +++++++++--------- .../controller/DeptControllerTest.java | 26 --- .../EmailTemplateControllerTest.java | 10 - .../ConfigurationControllerTest.java | 22 +- .../EmailTemplateControllerTest.java | 36 ++++ .../log/UserLoginLogControllerTest.java | 181 ++++++++++++++++ .../bunny/services/utils/TokenUtilsTest.java | 25 +++ 30 files changed, 1161 insertions(+), 891 deletions(-) create mode 100644 service/src/main/java/cn/bunny/services/config/WebConfig.java delete mode 100644 service/src/test/java/cn/bunny/services/controller/DeptControllerTest.java delete mode 100644 service/src/test/java/cn/bunny/services/controller/EmailTemplateControllerTest.java create mode 100644 service/src/test/java/cn/bunny/services/controller/configuration/EmailTemplateControllerTest.java create mode 100644 service/src/test/java/cn/bunny/services/controller/log/UserLoginLogControllerTest.java create mode 100644 service/src/test/java/cn/bunny/services/utils/TokenUtilsTest.java diff --git a/dao/pom.xml b/dao/pom.xml index 1737d03..dd5fd35 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -38,16 +38,20 @@ com.github.xiaoymin knife4j-openapi3-jakarta-spring-boot-starter - - com.alibaba.fastjson2 - fastjson2 + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.8.6 - io.swagger swagger-annotations 1.6.14 + + + com.alibaba.fastjson2 + fastjson2 + diff --git a/service/src/main/java/cn/bunny/services/config/Knife4jConfig.java b/service/src/main/java/cn/bunny/services/config/Knife4jConfig.java index 3e01696..27aa8f7 100644 --- a/service/src/main/java/cn/bunny/services/config/Knife4jConfig.java +++ b/service/src/main/java/cn/bunny/services/config/Knife4jConfig.java @@ -18,9 +18,14 @@ public class Knife4jConfig { // 作者等信息 Contact contact = new Contact().name("Bunny").email("1319900154@qq.com").url("http://bunny-web.site"); // 使用协议 - License license = new License().name("MIT").url("https://MUT.com"); + License license = new License().name("MIT").url("https://mit-license.org"); // 相关信息 - Info info = new Info().title("Bunny-Admin").description("权限管理模板").version("v1.0.0").contact(contact).license(license).termsOfService("MIT"); + Info info = new Info().title("Bunny-Admin") + .contact(contact).license(license) + .description("权限管理模板") + .summary("Auth权限模板") + .termsOfService("http://bunny-web.site") + .version("v1.0.0"); return new OpenAPI().info(info).externalDocs(new ExternalDocumentation()); } diff --git a/service/src/main/java/cn/bunny/services/config/WebConfig.java b/service/src/main/java/cn/bunny/services/config/WebConfig.java new file mode 100644 index 0000000..fcb2d91 --- /dev/null +++ b/service/src/main/java/cn/bunny/services/config/WebConfig.java @@ -0,0 +1,13 @@ +package cn.bunny.services.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class WebConfig { + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } +} diff --git a/service/src/main/java/cn/bunny/services/controller/configuration/ConfigurationController.java b/service/src/main/java/cn/bunny/services/controller/configuration/ConfigurationController.java index ab6a110..3951122 100644 --- a/service/src/main/java/cn/bunny/services/controller/configuration/ConfigurationController.java +++ b/service/src/main/java/cn/bunny/services/controller/configuration/ConfigurationController.java @@ -8,7 +8,6 @@ import cn.bunny.services.service.configuration.ConfigurationService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @Tag(name = "系统配置", description = "系统配置相关接口") @@ -16,8 +15,11 @@ import org.springframework.web.bind.annotation.*; @RequestMapping("/api/config") public class ConfigurationController { - @Autowired - private ConfigurationService configurationService; + private final ConfigurationService configurationService; + + public ConfigurationController(ConfigurationService configurationService) { + this.configurationService = configurationService; + } @Operation(summary = "读取web配置文件", description = "读取web配置文件") @GetMapping("noAuth/webConfig") @@ -38,5 +40,4 @@ public class ConfigurationController { configurationService.updateWebConfiguration(dto); return Result.success(ResultCodeEnum.UPDATE_SUCCESS); } - } diff --git a/service/src/main/java/cn/bunny/services/controller/log/UserLoginLogController.java b/service/src/main/java/cn/bunny/services/controller/log/UserLoginLogController.java index 512c190..a6c3b2d 100644 --- a/service/src/main/java/cn/bunny/services/controller/log/UserLoginLogController.java +++ b/service/src/main/java/cn/bunny/services/controller/log/UserLoginLogController.java @@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import reactor.core.publisher.Mono; @@ -31,32 +30,31 @@ import java.util.List; @RequestMapping("api/userLoginLog") public class UserLoginLogController { - @Autowired - private UserLoginLogService userLoginLogService; + private final UserLoginLogService userLoginLogService; + + public UserLoginLogController(UserLoginLogService userLoginLogService) { + this.userLoginLogService = userLoginLogService; + } @Operation(summary = "分页查询用户登录日志", description = "分页查询用户登录日志") @GetMapping("getUserLoginLogList/{page}/{limit}") - public Mono>> getUserLoginLogList( - @Parameter(name = "page", description = "当前页", required = true) - @PathVariable("page") Integer page, - @Parameter(name = "limit", description = "每页记录数", required = true) - @PathVariable("limit") Integer limit, + public Result> getUserLoginLogList( + @Parameter(name = "page", description = "当前页", required = true) @PathVariable("page") Integer page, + @Parameter(name = "limit", description = "每页记录数", required = true) @PathVariable("limit") Integer limit, UserLoginLogDto dto) { Page pageParams = new Page<>(page, limit); PageResult pageResult = userLoginLogService.getUserLoginLogList(pageParams, dto); - return Mono.just(Result.success(pageResult)); + return Result.success(pageResult); } @Operation(summary = "获取本地用户登录日志", description = "获取本地用户登录日志") @GetMapping("noManage/getUserLoginLogListByLocalUser/{page}/{limit}") - public Mono>> getUserLoginLogListByLocalUser( - @Parameter(name = "page", description = "当前页", required = true) - @PathVariable("page") Integer page, - @Parameter(name = "limit", description = "每页记录数", required = true) - @PathVariable("limit") Integer limit) { + public Result> getUserLoginLogListByLocalUser( + @Parameter(name = "page", description = "当前页", required = true) @PathVariable("page") Integer page, + @Parameter(name = "limit", description = "每页记录数", required = true) @PathVariable("limit") Integer limit) { Page pageParams = new Page<>(page, limit); PageResult voPageResult = userLoginLogService.getUserLoginLogListByLocalUser(pageParams); - return Mono.just(Result.success(voPageResult)); + return Result.success(voPageResult); } @Operation(summary = "删除用户登录日志", description = "删除用户登录日志") diff --git a/service/src/main/java/cn/bunny/services/exception/GlobalExceptionHandler.java b/service/src/main/java/cn/bunny/services/exception/GlobalExceptionHandler.java index a02e299..75e7044 100644 --- a/service/src/main/java/cn/bunny/services/exception/GlobalExceptionHandler.java +++ b/service/src/main/java/cn/bunny/services/exception/GlobalExceptionHandler.java @@ -40,7 +40,7 @@ public class GlobalExceptionHandler { String message = exception.getMessage(); message = StringUtils.hasText(message) ? message : "服务器异常"; exception.printStackTrace(); - + // 解析异常 String jsonParseError = "JSON parse error (.*)"; Matcher jsonParseErrorMatcher = Pattern.compile(jsonParseError).matcher(message); diff --git a/service/src/main/java/cn/bunny/services/security/config/WebSecurityConfig.java b/service/src/main/java/cn/bunny/services/security/config/WebSecurityConfig.java index 873f5ea..779ca3e 100644 --- a/service/src/main/java/cn/bunny/services/security/config/WebSecurityConfig.java +++ b/service/src/main/java/cn/bunny/services/security/config/WebSecurityConfig.java @@ -30,9 +30,9 @@ public class WebSecurityConfig { // 需要排出的无需验证的请求路径 public static String[] annotations = { - "/", "/ws/**", + "/", "/ws/**", "/**.html", + "/media.ico", "/favicon.ico", "/webjars/**", "/v3/api-docs/**", "/swagger-ui/**", "/*/*/noAuth/**", "/*/noAuth/**", "/noAuth/**", - "/media.ico", "/favicon.ico", "*.html", "/webjars/**", "/v3/api-docs/**", "/swagger-ui/**", "/error", "/*/i18n/getI18n", }; diff --git a/service/src/main/java/cn/bunny/services/service/log/impl/UserLoginLogServiceImpl.java b/service/src/main/java/cn/bunny/services/service/log/impl/UserLoginLogServiceImpl.java index 056cb70..fe3d2c8 100644 --- a/service/src/main/java/cn/bunny/services/service/log/impl/UserLoginLogServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/log/impl/UserLoginLogServiceImpl.java @@ -40,11 +40,12 @@ public class UserLoginLogServiceImpl extends ServiceImpl getUserLoginLogList(Page pageParams, UserLoginLogDto dto) { IPage page = baseMapper.selectListByPage(pageParams, dto); - List voList = page.getRecords().stream().map(userLoginLog -> { - UserLoginLogVo userLoginLogVo = new UserLoginLogVo(); - BeanUtils.copyProperties(userLoginLog, userLoginLogVo); - return userLoginLogVo; - }).toList(); + List voList = page.getRecords().stream() + .map(userLoginLog -> { + UserLoginLogVo userLoginLogVo = new UserLoginLogVo(); + BeanUtils.copyProperties(userLoginLog, userLoginLogVo); + return userLoginLogVo; + }).toList(); return PageResult.builder() .list(voList) @@ -79,11 +80,12 @@ public class UserLoginLogServiceImpl extends ServiceImpl page = baseMapper.selectListByPageWithLocalUser(pageParams, userId); - List voList = page.getRecords().stream().map(userLoginLog -> { - UserLoginLogLocalVo userLoginLogVo = new UserLoginLogLocalVo(); - BeanUtils.copyProperties(userLoginLog, userLoginLogVo); - return userLoginLogVo; - }).toList(); + List voList = page.getRecords().stream() + .map(userLoginLog -> { + UserLoginLogLocalVo userLoginLogVo = new UserLoginLogLocalVo(); + BeanUtils.copyProperties(userLoginLog, userLoginLogVo); + return userLoginLogVo; + }).toList(); return PageResult.builder() .list(voList) diff --git a/service/src/main/java/cn/bunny/services/utils/JwtHelper.java b/service/src/main/java/cn/bunny/services/utils/JwtHelper.java index 87c3a16..b70dce6 100644 --- a/service/src/main/java/cn/bunny/services/utils/JwtHelper.java +++ b/service/src/main/java/cn/bunny/services/utils/JwtHelper.java @@ -5,25 +5,27 @@ import cn.bunny.services.exception.AuthCustomerException; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jws; import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.security.Keys; import io.micrometer.common.lang.Nullable; import org.springframework.util.StringUtils; import javax.crypto.SecretKey; +import java.nio.charset.StandardCharsets; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.UUID; public class JwtHelper { + // JWT 的 秘钥 + // static SecretKey key = new SecretKeySpec("Bunny-Java-Template".getBytes(), "AES"); + private static final SecretKey key = Keys.hmacShaKeyFor("Bunny-Auth-Server-Private-SecretKey".getBytes(StandardCharsets.UTF_8)); // 时间 按天 计算 private static final long tokenExpiration = 24 * 60 * 60 * 1000; - // JWT 的 秘钥 - private static final String tokenSignKey = "Bunny-Java-Template"; // 默认主题 private static final String subject = "Bunny"; // 默认时间 private static final Date time = new Date(System.currentTimeMillis() + tokenExpiration * 7); - static SecretKey key = Jwts.SIG.HS256.key().build(); /** * 使用默认主题,默认时间,默认秘钥,创建自定义集合token @@ -324,6 +326,7 @@ public class JwtHelper { return expiration != null && expiration.before(new Date()); } catch (Exception exception) { + exception.printStackTrace(); return true; } } diff --git a/service/src/main/java/cn/bunny/services/utils/system/UserUtil.java b/service/src/main/java/cn/bunny/services/utils/system/UserUtil.java index dfc0a24..c5cb4f3 100644 --- a/service/src/main/java/cn/bunny/services/utils/system/UserUtil.java +++ b/service/src/main/java/cn/bunny/services/utils/system/UserUtil.java @@ -44,15 +44,6 @@ public class UserUtil { private final UserLoginLogMapper userLoginLogMapper; private final RedisTemplate redisTemplate; - // public UserUtil(MinioUtil minioUtil, PowerMapper powerMapper, RoleMapper roleMapper, UserMapper userMapper, UserLoginLogMapper userLoginLogMapper, RedisTemplate redisTemplate) { - // this.minioUtil = minioUtil; - // this.powerMapper = powerMapper; - // this.roleMapper = roleMapper; - // this.userMapper = userMapper; - // this.userLoginLogMapper = userLoginLogMapper; - // this.redisTemplate = redisTemplate; - // } - /** * 构建登录用户返回对象 * diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml index fe1bcbf..da9f83c 100644 --- a/service/src/main/resources/application.yml +++ b/service/src/main/resources/application.yml @@ -1,3 +1,5 @@ +server: + port: 8000 spring: profiles: active: @profiles.active@ diff --git a/service/src/main/resources/static/error/400.html b/service/src/main/resources/static/error/400.html index 6cee43c..fc1e212 100644 --- a/service/src/main/resources/static/error/400.html +++ b/service/src/main/resources/static/error/400.html @@ -1,66 +1,69 @@ - - 400 错误 - phpstudy - - - - - - - - - - - - - + + 400 错误 - phpstudy + + + + + + + + + + + + + -
-
-

HTTP 400 - Bad Request

+
+
+

HTTP 400 - Bad Request

-
错误说明:因为错误的语法导致服务器无法理解请求信息。
-
原因1:客户端发起的请求不符合服务器对请求的某些限制,或者请求本身存在一定的错误。
-
解决办法:
-
链接中有特殊字符或者链接长度过长导致,请对应修改.
-
原因2:request header 或者 cookie 过大所引起
-
解决办法:
-
crtl+shift+delete 快捷键清除cookie.
+
错误说明:因为错误的语法导致服务器无法理解请求信息。
+
原因1:客户端发起的请求不符合服务器对请求的某些限制,或者请求本身存在一定的错误。
+
解决办法:
+
链接中有特殊字符或者链接长度过长导致,请对应修改.
+
原因2:request header 或者 cookie 过大所引起
+
解决办法:
+
crtl+shift+delete 快捷键清除cookie.
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/403.html b/service/src/main/resources/static/error/403.html index 77270de..6c281b0 100644 --- a/service/src/main/resources/static/error/403.html +++ b/service/src/main/resources/static/error/403.html @@ -1,66 +1,69 @@ - - 403 错误 - phpstudy - - - - - - - - - - - - - + + 403 错误 - phpstudy + + + + + + + + + + + + + -
-
-

403 - Forbidden 禁止访问: 访问被拒绝

+
+
+

403 - Forbidden 禁止访问: 访问被拒绝

-
错误说明:禁止访问,服务器拒绝访问
-
原因1:未找到默认的索引文件
-
解决办法:
-
IIS中【启用默认内容文档】选项中将默认打开文档修改为程序首页文件格式,如:index.html或者index.php
-
原因2:文件夹安全权限导致
-
解决办法:
-
程序文件-右击-属性-安全-Users-修改为读取和执行权限
+
错误说明:禁止访问,服务器拒绝访问
+
原因1:未找到默认的索引文件
+
解决办法:
+
IIS中【启用默认内容文档】选项中将默认打开文档修改为程序首页文件格式,如:index.html或者index.php
+
原因2:文件夹安全权限导致
+
解决办法:
+
程序文件-右击-属性-安全-Users-修改为读取和执行权限
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/404.html b/service/src/main/resources/static/error/404.html index fb3d77e..6cc5d1e 100644 --- a/service/src/main/resources/static/error/404.html +++ b/service/src/main/resources/static/error/404.html @@ -1,75 +1,78 @@ - - 404 错误 - phpstudy - - - - - - - - - - - - - + + 404 错误 - phpstudy + + + + + + + + + + + + + -
-
-

404 - Page Not Found 未找到

+
+
+

404 - Page Not Found 未找到

-
错误说明:请求的页面不存在
-
原因1:访问的文档权限不够
-
解决办法:
-
修改文件权限为755,windos系统修改目录权限为可写可读。
-
原因2:防火墙的原因
-
解决办法:
-
先关闭让防火墙通过WWW服务。
-
原因3:站点根目录无默认访问文件
-
解决办法:
-
在根目录中创建index.html或者创建index.php。
-
原因4:站点配置目录不正确
-
解决办法:
-
将网站应用程序复制到站点目录中,或者修改站点配置目录指定到应用程序目录中。
-
原因5:站点使用了伪静态
-
解决办法:
-
将伪静态规则删除,或者重新编写正确的伪静态规则,或关闭伪静态配置。
+
错误说明:请求的页面不存在
+
原因1:访问的文档权限不够
+
解决办法:
+
修改文件权限为755,windos系统修改目录权限为可写可读。
+
原因2:防火墙的原因
+
解决办法:
+
先关闭让防火墙通过WWW服务。
+
原因3:站点根目录无默认访问文件
+
解决办法:
+
在根目录中创建index.html或者创建index.php。
+
原因4:站点配置目录不正确
+
解决办法:
+
将网站应用程序复制到站点目录中,或者修改站点配置目录指定到应用程序目录中。
+
原因5:站点使用了伪静态
+
解决办法:
+
将伪静态规则删除,或者重新编写正确的伪静态规则,或关闭伪静态配置。
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/501.html b/service/src/main/resources/static/error/501.html index c879908..48ac544 100644 --- a/service/src/main/resources/static/error/501.html +++ b/service/src/main/resources/static/error/501.html @@ -1,63 +1,66 @@ - - 501 错误 - phpstudy - - - - - - - - - - - - - + + 501 错误 - phpstudy + + + + + + + + + + + + + -
-
-

HTTP 501 - Not Implemented

+
+
+

HTTP 501 - Not Implemented

-
错误说明:服务器没有相应的执行动作来完成当前请求。
-
原因1:Web 服务器不支持实现此请求所需的功能
-
解决办法:
-
可以用来HttpWebRequest指定一个UserAgent来试试的,有时候你可以换电脑来测试一下的。
+
错误说明:服务器没有相应的执行动作来完成当前请求。
+
原因1:Web 服务器不支持实现此请求所需的功能
+
解决办法:
+
可以用来HttpWebRequest指定一个UserAgent来试试的,有时候你可以换电脑来测试一下的。
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/502.html b/service/src/main/resources/static/error/502.html index 194f16f..ea44be2 100644 --- a/service/src/main/resources/static/error/502.html +++ b/service/src/main/resources/static/error/502.html @@ -1,75 +1,80 @@ - - 502 错误 - phpstudy - - - - - - - - - - - - - + + 502 错误 - phpstudy + + + + + + + + + + + + + -
-
-

HTTP 502 - Bad Gateway 没有响应

+
+
+

HTTP 502 - Bad Gateway 没有响应

-
错误说明:坏的网关,http向后端节点请求,没有响应
-
原因1:DNS 缓冲
-
解决办法:
-
在dos窗口运行 ipconfig /flushdns,该命令会刷新DNS缓冲。
-
原因2:浏览器代理
-
解决办法:
-
关掉代理。
-
原因3:dns 被劫持了,即使使用国外的dns,也会被劫持
-
解决办法:
-
去掉VPN服务器的DNS。切换另外的dns。在windows系统中,可以在本地网络连接的属性中,去掉默认的dns,选用国外的dns,比如google的或opendns。
-
原因4:php执行超时
-
解决办法:
-
修改/usr/local/php/etc/php.ini 将max_execution_time 改为300。
-
原因5:nginx等待时间超时
-
解决办法:
-
适当增加nginx.conf配置文件中FastCGI的timeout时间。
+
错误说明:坏的网关,http向后端节点请求,没有响应
+
原因1:DNS 缓冲
+
解决办法:
+
在dos窗口运行 ipconfig /flushdns,该命令会刷新DNS缓冲。
+
原因2:浏览器代理
+
解决办法:
+
关掉代理。
+
原因3:dns 被劫持了,即使使用国外的dns,也会被劫持
+
解决办法:
+
+ 去掉VPN服务器的DNS。切换另外的dns。在windows系统中,可以在本地网络连接的属性中,去掉默认的dns,选用国外的dns,比如google的或opendns。 +
+
原因4:php执行超时
+
解决办法:
+
修改/usr/local/php/etc/php.ini 将max_execution_time 改为300。
+
原因5:nginx等待时间超时
+
解决办法:
+
适当增加nginx.conf配置文件中FastCGI的timeout时间。
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/503.html b/service/src/main/resources/static/error/503.html index f21f507..c6fec86 100644 --- a/service/src/main/resources/static/error/503.html +++ b/service/src/main/resources/static/error/503.html @@ -1,66 +1,69 @@ - - 503 错误 - phpstudy - - - - - - - - - - - - - + + 503 错误 - phpstudy + + + + + + + + + + + + + -
-
-

HTTP 503 - Service Unavailable 服务不可用

+
+
+

HTTP 503 - Service Unavailable 服务不可用

-
错误说明:服务当前不可用
-
原因1:服务不可用状态
-
解决办法:
-
服务器或许就是正在维护或者暂停了,你可以联系一下服务器空间商。
-
原因2:程序占用资源太多
-
解决办法:
-
通过设置应用程序池把账户改为NetworkService即可解决。
+
错误说明:服务当前不可用
+
原因1:服务不可用状态
+
解决办法:
+
服务器或许就是正在维护或者暂停了,你可以联系一下服务器空间商。
+
原因2:程序占用资源太多
+
解决办法:
+
通过设置应用程序池把账户改为NetworkService即可解决。
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/504.html b/service/src/main/resources/static/error/504.html index 62fa692..2980dd0 100644 --- a/service/src/main/resources/static/error/504.html +++ b/service/src/main/resources/static/error/504.html @@ -1,69 +1,81 @@ - - 504 错误 - phpstudy - - - - - - - - - - - - - + + 504 错误 - phpstudy + + + + + + + + + + + + + -
-
-

HTTP 504 - Gateway Timeout 网关超时

+
+
+

HTTP 504 - Gateway Timeout 网关超时

-
错误说明:网关超时,服务器响应时间,达到超出设定的范围
-
原因1:后端电脑之间 IP 通讯缓慢而产生
-
解决办法:
-
如果您的 Web 服务器由某一网站托管, 只有负责那个网站设置的人员才能解决这个问题。
-
原因2:由于nginx默认的fastcgi进程响应的缓冲区太小造成的错误
-
解决办法:
-
一般默认的fastcgi进程响应的缓冲区是8K,这时可以设置大一点,在nginx.conf里,加入:fastcgi_buffers 8 128k这表示设置fastcgi缓冲区为8块128k大小的空间。当然如果在进行某一项即时的操作, 可能需要nginx的超时参数调大点, 例如设置成60秒:send_timeout 60;经过这两个参数的调整,一般不会再提示“504 Gateway Time-out”错误,问题基本解决。
-
原因3:PHP环境的配置问题
-
解决办法:
-
更改php-fpm的几处配置: 把max_children由之前的10改为现在的30,这样就可以保证有充足的php-cgi进程可以被使用; 把request_terminate_timeout由之前的0s改为60s,这样php-cgi进程 处理脚本的超时时间就是60秒,可以防止进程都被挂起,提高利用效率。 接着再更改nginx的几个配置项,减少FastCGI的请求次数,尽量维持buffers不变: fastcgi_buffers由 4 64k 改为 2 256k; fastcgi_buffer_size 由 64k 改为 128K; fastcgi_busy_buffers_size 由 128K 改为 256K; fastcgi_temp_file_write_size 由 128K 改为 256K。 重新加载php-fpm和nginx的配置,再次测试,如果没有出现“504 Gateway Time-out”错误,问题解决。
+
错误说明:网关超时,服务器响应时间,达到超出设定的范围
+
原因1:后端电脑之间 IP 通讯缓慢而产生
+
解决办法:
+
如果您的 Web 服务器由某一网站托管, 只有负责那个网站设置的人员才能解决这个问题。
+
原因2:由于nginx默认的fastcgi进程响应的缓冲区太小造成的错误
+
解决办法:
+
一般默认的fastcgi进程响应的缓冲区是8K,这时可以设置大一点,在nginx.conf里,加入:fastcgi_buffers 8 + 128k这表示设置fastcgi缓冲区为8块128k大小的空间。当然如果在进行某一项即时的操作, 可能需要nginx的超时参数调大点, + 例如设置成60秒:send_timeout 60;经过这两个参数的调整,一般不会再提示“504 Gateway Time-out”错误,问题基本解决。 +
+
原因3:PHP环境的配置问题
+
解决办法:
+
更改php-fpm的几处配置: 把max_children由之前的10改为现在的30,这样就可以保证有充足的php-cgi进程可以被使用; + 把request_terminate_timeout由之前的0s改为60s,这样php-cgi进程 处理脚本的超时时间就是60秒,可以防止进程都被挂起,提高利用效率。 + 接着再更改nginx的几个配置项,减少FastCGI的请求次数,尽量维持buffers不变: fastcgi_buffers由 4 64k 改为 2 + 256k; fastcgi_buffer_size 由 64k 改为 128K; fastcgi_busy_buffers_size 由 128K 改为 256K; + fastcgi_temp_file_write_size 由 128K 改为 256K。 重新加载php-fpm和nginx的配置,再次测试,如果没有出现“504 + Gateway Time-out”错误,问题解决。 +
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/505.html b/service/src/main/resources/static/error/505.html index 5e153c0..1cd5dd5 100644 --- a/service/src/main/resources/static/error/505.html +++ b/service/src/main/resources/static/error/505.html @@ -1,66 +1,72 @@ - - 505 错误 - phpstudy - - - - - - - - - - - - - + + 505 错误 - phpstudy + + + + + + + + + + + + + -
-
-

HTTP 505 - HTTP Version Not Supported

+
+
+

HTTP 505 - HTTP Version Not Supported

-
错误说明:HTTP 版本不受支持。
-
原因1:您的 Web 服务器不支持,或拒绝支持客户端(如您的浏览器)在发送给服务器的 HTTP 请求数据流中指定的 HTTP 协议版本
-
解决办法:
-
升级您的 Web 服务器软件。
-
原因2:http请求格式的错误
-
解决办法:
-
对照一下自己的代码,从打印的信息中终于找到问题所在。可能在请求后面多加了一个空格。http协议真是很严格了。
+
错误说明:HTTP 版本不受支持。
+
原因1:您的 Web 服务器不支持,或拒绝支持客户端(如您的浏览器)在发送给服务器的 HTTP 请求数据流中指定的 HTTP + 协议版本 +
+
解决办法:
+
升级您的 Web 服务器软件。
+
原因2:http请求格式的错误
+
解决办法:
+
对照一下自己的代码,从打印的信息中终于找到问题所在。可能在请求后面多加了一个空格。http协议真是很严格了。 +
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/506.html b/service/src/main/resources/static/error/506.html index d8ed766..8160abd 100644 --- a/service/src/main/resources/static/error/506.html +++ b/service/src/main/resources/static/error/506.html @@ -1,63 +1,66 @@ - - 506 错误 - phpstudy - - - - - - - - - - - - - + + 506 错误 - phpstudy + + + + + + + + + + + + + -
-
-

HTTP 506 - Variant Also Negotiates

+
+
+

HTTP 506 - Variant Also Negotiates

-
错误说明:
-
原因1:服务器存在内部配置错误
-
解决办法:
-
被请求的协商变元资源被配置为在透明内容协商中使用自己,因此在一个协商处理中不是一个合适的重点。
+
错误说明:
+
原因1:服务器存在内部配置错误
+
解决办法:
+
被请求的协商变元资源被配置为在透明内容协商中使用自己,因此在一个协商处理中不是一个合适的重点。
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/507.html b/service/src/main/resources/static/error/507.html index 9e6da66..fb6c7e7 100644 --- a/service/src/main/resources/static/error/507.html +++ b/service/src/main/resources/static/error/507.html @@ -1,63 +1,66 @@ - - 507 错误 - phpstudy - - - - - - - - - - - - - + + 507 错误 - phpstudy + + + + + + + + + + + + + -
-
-

HTTP 507 - Insufficient Storage

+
+
+

HTTP 507 - Insufficient Storage

-
错误说明:
-
原因1:服务器无法存储完成请求所必须的内容
-
解决办法:
-
这个状况被认为是临时的。WebDAV (RFC 4918)。
+
错误说明:
+
原因1:服务器无法存储完成请求所必须的内容
+
解决办法:
+
这个状况被认为是临时的。WebDAV (RFC 4918)。
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/509.html b/service/src/main/resources/static/error/509.html index 12ee6bc..520abbd 100644 --- a/service/src/main/resources/static/error/509.html +++ b/service/src/main/resources/static/error/509.html @@ -1,63 +1,66 @@ - - 509 错误 - phpstudy - - - - - - - - - - - - - + + 509 错误 - phpstudy + + + + + + + + + + + + + -
-
-

HTTP 509 - Bandwidth Limit Exceeded

+
+
+

HTTP 509 - Bandwidth Limit Exceeded

-
错误说明:
-
原因1:网站流量已经超出您所购买的方案限制即服务器达到带宽限制
-
解决办法:
-
1.升级方案 2.等到下个月后流量重新计算,网站即可正常浏览。
+
错误说明:
+
原因1:网站流量已经超出您所购买的方案限制即服务器达到带宽限制
+
解决办法:
+
1.升级方案 2.等到下个月后流量重新计算,网站即可正常浏览。
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/static/error/510.html b/service/src/main/resources/static/error/510.html index 436ad68..95b2f9f 100644 --- a/service/src/main/resources/static/error/510.html +++ b/service/src/main/resources/static/error/510.html @@ -1,63 +1,66 @@ - - 510 错误 - phpstudy - - - - - - - - - - - - - + + 510 错误 - phpstudy + + + + + + + + + + + + + -
-
-

HTTP 510 - Not Extended

+
+
+

HTTP 510 - Not Extended

-
错误说明:
-
原因1:获取资源所需要的策略并没有被满足
-
解决办法:
-
需要请求有额外的扩展内容,服务器才能处理请求。
+
错误说明:
+
原因1:获取资源所需要的策略并没有被满足
+
解决办法:
+
需要请求有额外的扩展内容,服务器才能处理请求。
-
使用手册,视频教程,BUG反馈,官网地址: www.xp.cn
- -
-
+
+
\ No newline at end of file diff --git a/service/src/main/resources/templates/index.html b/service/src/main/resources/templates/index.html index 8f43ff0..c3b8b96 100644 --- a/service/src/main/resources/templates/index.html +++ b/service/src/main/resources/templates/index.html @@ -1,111 +1,118 @@ - - - - - - - bunny-admin-server项目介绍 - - - + footer { + position: sticky; + bottom: 0; + text-align: center; + padding: 20px 0; + background-color: #007BFF; + color: white; + margin-top: 20px; + } + + + -
-

bunny-admin-server项目介绍

-
+
+

bunny-admin-server项目介绍

+
-
-

项目名称

-

这是权限管理系统,之前有2个版本,这个是第3个,我将部分的代码优化了一遍;比如下面的:

-
    -
  • 登录优化:使用登录策略方便以后扩展登录方式
  • -
  • 邮件发送模板:邮件发送用的是模板方法模式
  • -
  • 密码校验:登录密码校验器,改用自带的不是md5加密,看起来像这样:$2a$10$h5BUwmMaVcEuu7Bz0TPPy.PQV8JP6CFJlbHTgT78G1s0YPIu2kfXe -
  • -
  • 接口请求路径:将原本请求路径/admin改为/api
  • -
+
+

项目名称

+

这是权限管理系统,之前有2个版本,这个是第3个,我将部分的代码优化了一遍;比如下面的:

+
    +
  • 登录优化:使用登录策略方便以后扩展登录方式
  • +
  • 邮件发送模板:邮件发送用的是模板方法模式
  • +
  • 密码校验:登录密码校验器,改用自带的不是md5加密,看起来像这样:$2a$10$h5BUwmMaVcEuu7Bz0TPPy.PQV8JP6CFJlbHTgT78G1s0YPIu2kfXe +
  • +
  • 接口请求路径:将原本请求路径/admin改为/api
  • +
-

展示下验证码图片

- + +
+

© 2025 Bunny.保留所有权利.

+
+ \ No newline at end of file diff --git a/service/src/test/java/cn/bunny/services/controller/DeptControllerTest.java b/service/src/test/java/cn/bunny/services/controller/DeptControllerTest.java deleted file mode 100644 index d753ad7..0000000 --- a/service/src/test/java/cn/bunny/services/controller/DeptControllerTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.bunny.services.controller; - -import org.junit.jupiter.api.Test; - -class DeptControllerTest { - - @Test - void getDeptList() { - } - - @Test - void getAllDeptList() { - } - - @Test - void addDept() { - } - - @Test - void updateDept() { - } - - @Test - void deleteDept() { - } -} \ No newline at end of file diff --git a/service/src/test/java/cn/bunny/services/controller/EmailTemplateControllerTest.java b/service/src/test/java/cn/bunny/services/controller/EmailTemplateControllerTest.java deleted file mode 100644 index 63a2e24..0000000 --- a/service/src/test/java/cn/bunny/services/controller/EmailTemplateControllerTest.java +++ /dev/null @@ -1,10 +0,0 @@ -package cn.bunny.services.controller; - -import org.junit.jupiter.api.BeforeEach; - -class EmailTemplateControllerTest { - - @BeforeEach - void setUp() { - } -} \ No newline at end of file diff --git a/service/src/test/java/cn/bunny/services/controller/configuration/ConfigurationControllerTest.java b/service/src/test/java/cn/bunny/services/controller/configuration/ConfigurationControllerTest.java index cdda4b1..ffb848d 100644 --- a/service/src/test/java/cn/bunny/services/controller/configuration/ConfigurationControllerTest.java +++ b/service/src/test/java/cn/bunny/services/controller/configuration/ConfigurationControllerTest.java @@ -2,14 +2,10 @@ package cn.bunny.services.controller.configuration; import cn.bunny.dao.dto.system.configuration.WebConfigurationDto; import cn.bunny.dao.entity.configuration.WebConfiguration; -import cn.bunny.dao.entity.system.AdminUser; import cn.bunny.dao.vo.result.Result; -import cn.bunny.dao.vo.system.user.LoginVo; -import cn.bunny.services.mapper.system.UserMapper; -import cn.bunny.services.utils.system.UserUtil; +import cn.bunny.services.utils.TokenUtilsTest; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.TypeReference; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.BeanUtils; @@ -37,22 +33,15 @@ class ConfigurationControllerTest { private WebApplicationContext webApplicationContext; @Autowired - private UserUtil userUtil; - - @Autowired - private UserMapper userMapper; - - private String token; + private TokenUtilsTest tokenUtils; private MockMvc mockMvc; + private String token; + @BeforeEach void setUpMockMvc() { - AdminUser adminUser = userMapper.selectOne(Wrappers.lambdaQuery().eq(AdminUser::getUsername, "Administrator")); - adminUser.setPassword("admin123"); - LoginVo loginVo = userUtil.buildLoginUserVo(adminUser, 7); - token = loginVo.getToken(); - + token = tokenUtils.getToken(); mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext) .apply(SecurityMockMvcConfigurers.springSecurity()) .build(); @@ -74,7 +63,6 @@ class ConfigurationControllerTest { throw new Exception(); } - System.out.println(webConfiguration); }); } diff --git a/service/src/test/java/cn/bunny/services/controller/configuration/EmailTemplateControllerTest.java b/service/src/test/java/cn/bunny/services/controller/configuration/EmailTemplateControllerTest.java new file mode 100644 index 0000000..adc7675 --- /dev/null +++ b/service/src/test/java/cn/bunny/services/controller/configuration/EmailTemplateControllerTest.java @@ -0,0 +1,36 @@ +package cn.bunny.services.controller.configuration; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class EmailTemplateControllerTest { + + @BeforeEach + void setUp() { + } + + @AfterEach + void tearDown() { + } + + @Test + void getEmailTemplateList() { + } + + @Test + void getEmailTypes() { + } + + @Test + void addEmailTemplate() { + } + + @Test + void updateEmailTemplate() { + } + + @Test + void deleteEmailTemplate() { + } +} \ No newline at end of file diff --git a/service/src/test/java/cn/bunny/services/controller/log/UserLoginLogControllerTest.java b/service/src/test/java/cn/bunny/services/controller/log/UserLoginLogControllerTest.java new file mode 100644 index 0000000..03a541c --- /dev/null +++ b/service/src/test/java/cn/bunny/services/controller/log/UserLoginLogControllerTest.java @@ -0,0 +1,181 @@ +package cn.bunny.services.controller.log; + +import cn.bunny.dao.dto.log.UserLoginLogDto; +import cn.bunny.dao.entity.log.UserLoginLog; +import cn.bunny.dao.vo.log.UserLoginLogLocalVo; +import cn.bunny.dao.vo.log.UserLoginLogVo; +import cn.bunny.dao.vo.result.PageResult; +import cn.bunny.dao.vo.result.Result; +import cn.bunny.services.service.log.UserLoginLogService; +import cn.bunny.services.utils.TokenUtilsTest; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.TypeReference; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.*; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.context.WebApplicationContext; + +import java.util.List; +import java.util.Map; + +@Slf4j +@SpringBootTest +@WebAppConfiguration +class UserLoginLogControllerTest { + private static final String prefix = "/api/userLoginLog"; + + private WebTestClient testClient; + + @Autowired + private WebApplicationContext webApplicationContext; + + @Autowired + private UserLoginLogService userLoginLogService; + + @Autowired + private TokenUtilsTest tokenUtils; + + private MockMvc mockMvc; + + private String token; + + @Autowired + private RestTemplate restTemplate; + + @BeforeEach + void setUp() { + token = tokenUtils.getToken(); + mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext) + .apply(SecurityMockMvcConfigurers.springSecurity()) + .build(); + + testClient = WebTestClient.bindToController(new UserLoginLogController(userLoginLogService)).build(); + } + + @AfterEach + void tearDown() { + } + + @Test + void getUserLoginLogList() throws Exception { + UserLoginLogDto dto = UserLoginLogDto.builder() + .username("bunny") + .build(); + + mockMvc.perform(MockMvcRequestBuilders.get(prefix + "/getUserLoginLogList/1/10") + .contentType(MediaType.APPLICATION_JSON) + .content(JSON.toJSONString(dto)) + .header("token", token)) + .andExpect(MockMvcResultMatchers.status().isOk()) + .andExpect(result -> { + MockHttpServletResponse response = result.getResponse(); + String contentAsString = response.getContentAsString(); + + System.out.println(contentAsString); + }); + } + + @Test + void getUserLoginLogList2() { + UserLoginLogDto dto = UserLoginLogDto.builder() + .username("bunny") + .build(); + Map params = JSON.parseObject(JSON.toJSONString(dto), new TypeReference<>() { + }); + + HttpHeaders headers = new HttpHeaders(); + headers.set("token", token); + headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity> request = new HttpEntity<>(params, headers); + + // 发送请求 + ResponseEntity>> response = restTemplate.exchange( + "http://localhost:7070" + prefix + "/getUserLoginLogList/1/10", + HttpMethod.GET, + request, + new ParameterizedTypeReference<>() { + } + ); + + Result> body = response.getBody(); + System.out.println(JSON.toJSONString(body)); + } + + @Test + void getUserLoginLogListByLocalUser() throws Exception { + String api = prefix + "/noManage/getUserLoginLogListByLocalUser/1/10"; + + mockMvc.perform(MockMvcRequestBuilders.get(api) + .header("token", token)) + .andExpect(MockMvcResultMatchers.status().isOk()) + .andExpect(result -> { + MockHttpServletResponse response = result.getResponse(); + String contentAsString = response.getContentAsString(); + + System.out.println(contentAsString); + }); + } + + @Test + void getUserLoginLogListByLocalUser2() { + String api = prefix + "/noManage/getUserLoginLogListByLocalUser/1/10"; + + testClient.get() + .uri(api) + .header("token", token) + .accept(MediaType.APPLICATION_JSON) + .exchange() + .expectStatus().isOk() + .expectBody(new ParameterizedTypeReference>>() { + }) + .consumeWith(result -> { + Result> responseBody = result.getResponseBody(); + System.out.println(JSON.toJSONString(responseBody)); + }); + } + + @Test + void deleteUserLoginLog() throws Exception { + String api = prefix + "/deleteUserLoginLog"; + + Page page = new Page<>(1, 10); + List deleteBeforeList = userLoginLogService.list(page); + List ids = deleteBeforeList.stream().map(UserLoginLog::getId).limit(4).toList(); + List deleteBeforeIds = deleteBeforeList.stream().map(UserLoginLog::getId).toList(); + + log.info("要删除的ids: {}", ids); + log.info("删除前ids数据:{}", deleteBeforeIds); + + mockMvc.perform(MockMvcRequestBuilders + .delete(api) + .header("token", token) + .contentType(MediaType.APPLICATION_JSON) + .content(JSON.toJSONString(ids))) + .andExpect(MockMvcResultMatchers.status().isOk()) + .andExpect(result -> { + MockHttpServletResponse response = result.getResponse(); + String contentAsString = response.getContentAsString(); + System.out.println(contentAsString); + }); + + deleteBeforeList = userLoginLogService.list(page); + deleteBeforeIds = deleteBeforeList.stream().map(UserLoginLog::getId).toList(); + log.info("要删除的ids: {}", ids); + log.info("删除前ids数据:{}", deleteBeforeIds); + } +} \ No newline at end of file diff --git a/service/src/test/java/cn/bunny/services/utils/TokenUtilsTest.java b/service/src/test/java/cn/bunny/services/utils/TokenUtilsTest.java new file mode 100644 index 0000000..09fd641 --- /dev/null +++ b/service/src/test/java/cn/bunny/services/utils/TokenUtilsTest.java @@ -0,0 +1,25 @@ +package cn.bunny.services.utils; + +import cn.bunny.dao.entity.system.AdminUser; +import cn.bunny.dao.vo.system.user.LoginVo; +import cn.bunny.services.mapper.system.UserMapper; +import cn.bunny.services.utils.system.UserUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class TokenUtilsTest { + @Autowired + private UserUtil userUtil; + + @Autowired + private UserMapper userMapper; + + public String getToken() { + AdminUser adminUser = userMapper.selectOne(Wrappers.lambdaQuery().eq(AdminUser::getUsername, "Administrator")); + adminUser.setPassword("admin123"); + LoginVo loginVo = userUtil.buildLoginUserVo(adminUser, 7); + return loginVo.getToken(); + } +}