Skip to content

Commit

Permalink
style(格式化): spring 规范代码格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
lltx committed Aug 15, 2024
1 parent a3fe7a7 commit 9659b7f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,29 @@
@RequiredArgsConstructor
public class ImageCodeEndpoint {

private static final Integer DEFAULT_IMAGE_WIDTH = 100;

private static final Integer DEFAULT_IMAGE_HEIGHT = 40;

private final RedisTemplate redisTemplate;

/**
* 创建图形验证码
*/
@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;
}

String result = captcha.text();
redisTemplate.opsForValue()
.set(CacheConstants.DEFAULT_CODE_KEY + randomStr, result, SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
// 转换流信息写出
captcha.out(response.getOutputStream());
}
private static final Integer DEFAULT_IMAGE_WIDTH = 100;

private static final Integer DEFAULT_IMAGE_HEIGHT = 40;

private final RedisTemplate redisTemplate;

/**
* 创建图形验证码
*/
@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;
}

String result = captcha.text();
redisTemplate.opsForValue()
.set(CacheConstants.DEFAULT_CODE_KEY + randomStr, result, SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
// 转换流信息写出
captcha.out(response.getOutputStream());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ public Boolean updateUser(UserDTO userDto) {
// 更新用户角色表
if (Objects.nonNull(userDto.getRole())) {
// 删除用户角色关系
sysUserRoleMapper.delete(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getUserId, userDto.getUserId()));
sysUserRoleMapper
.delete(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getUserId, userDto.getUserId()));
userDto.getRole().stream().map(roleId -> {
SysUserRole userRole = new SysUserRole();
userRole.setUserId(sysUser.getUserId());
Expand All @@ -240,7 +241,8 @@ public Boolean updateUser(UserDTO userDto) {

if (Objects.nonNull(userDto.getPost())) {
// 删除用户岗位关系
sysUserPostMapper.delete(Wrappers.<SysUserPost>lambdaQuery().eq(SysUserPost::getUserId, userDto.getUserId()));
sysUserPostMapper
.delete(Wrappers.<SysUserPost>lambdaQuery().eq(SysUserPost::getUserId, userDto.getUserId()));
userDto.getPost().stream().map(postId -> {
SysUserPost userPost = new SysUserPost();
userPost.setUserId(sysUser.getUserId());
Expand Down

0 comments on commit 9659b7f

Please sign in to comment.