From 9659b7f200951e69c81908d87f8ff893866a734c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E5=86=B7?= <2270033969@qq.com> Date: Thu, 15 Aug 2024 09:30:08 +0800 Subject: [PATCH] =?UTF-8?q?style(=E6=A0=BC=E5=BC=8F=E5=8C=96):=20spring=20?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pig/auth/endpoint/ImageCodeEndpoint.java | 38 +++++++++---------- .../service/impl/SysUserServiceImpl.java | 6 ++- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/ImageCodeEndpoint.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/ImageCodeEndpoint.java index 056d1374..14819769 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/ImageCodeEndpoint.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/ImageCodeEndpoint.java @@ -25,29 +25,29 @@ import java.util.concurrent.TimeUnit; @RequiredArgsConstructor public class ImageCodeEndpoint { - private static final Integer DEFAULT_IMAGE_WIDTH = 100; + private static final Integer DEFAULT_IMAGE_WIDTH = 100; - private static final Integer DEFAULT_IMAGE_HEIGHT = 40; + private static final Integer DEFAULT_IMAGE_HEIGHT = 40; - private final RedisTemplate redisTemplate; + private final RedisTemplate redisTemplate; - /** - * 创建图形验证码 - */ - @SneakyThrows - @GetMapping("/image") - public void image(String randomStr, HttpServletResponse response) { - ArithmeticCaptcha captcha = new ArithmeticCaptcha(DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT); + /** + * 创建图形验证码 + */ + @SneakyThrows + @GetMapping("/image") + public void image(String randomStr, HttpServletResponse response) { + ArithmeticCaptcha captcha = new ArithmeticCaptcha(DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT); - if (Validator.isMobile(randomStr)) { - return; - } + if (Validator.isMobile(randomStr)) { + return; + } - String result = captcha.text(); - redisTemplate.opsForValue() - .set(CacheConstants.DEFAULT_CODE_KEY + randomStr, result, SecurityConstants.CODE_TIME, TimeUnit.SECONDS); - // 转换流信息写出 - captcha.out(response.getOutputStream()); - } + String result = captcha.text(); + redisTemplate.opsForValue() + .set(CacheConstants.DEFAULT_CODE_KEY + randomStr, result, SecurityConstants.CODE_TIME, TimeUnit.SECONDS); + // 转换流信息写出 + captcha.out(response.getOutputStream()); + } } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java index 75324524..c416e17d 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java @@ -229,7 +229,8 @@ public class SysUserServiceImpl extends ServiceImpl impl // 更新用户角色表 if (Objects.nonNull(userDto.getRole())) { // 删除用户角色关系 - sysUserRoleMapper.delete(Wrappers.lambdaQuery().eq(SysUserRole::getUserId, userDto.getUserId())); + sysUserRoleMapper + .delete(Wrappers.lambdaQuery().eq(SysUserRole::getUserId, userDto.getUserId())); userDto.getRole().stream().map(roleId -> { SysUserRole userRole = new SysUserRole(); userRole.setUserId(sysUser.getUserId()); @@ -240,7 +241,8 @@ public class SysUserServiceImpl extends ServiceImpl impl if (Objects.nonNull(userDto.getPost())) { // 删除用户岗位关系 - sysUserPostMapper.delete(Wrappers.lambdaQuery().eq(SysUserPost::getUserId, userDto.getUserId())); + sysUserPostMapper + .delete(Wrappers.lambdaQuery().eq(SysUserPost::getUserId, userDto.getUserId())); userDto.getPost().stream().map(postId -> { SysUserPost userPost = new SysUserPost(); userPost.setUserId(sysUser.getUserId());