修复部分bug

This commit is contained in:
yangsb
2024-04-25 09:04:35 +08:00
parent a1cbfbfaef
commit a2e05e7112
5 changed files with 25 additions and 7 deletions
@@ -115,11 +115,11 @@ public class PermissionController {
throw new ServiceException(ROLE_ME_ERROR); throw new ServiceException(ROLE_ME_ERROR);
} }
Set<Long> roleIds = listReqVO.stream().flatMap(e -> e.getRoleIds().stream()).collect(Collectors.toSet()); Set<Long> roleIds = listReqVO.stream().flatMap(e -> e.getRoleIds().stream()).collect(Collectors.toSet());
if(!loginUser.getIsSupAdmin()) { /* if(!loginUser.getIsSupAdmin()) {
if(roleIds.contains(ORGAN_ADMIN_ROLE_ID) ) { if(roleIds.contains(ORGAN_ADMIN_ROLE_ID) ) {
throw new ServiceException(11541, "内置角色无权修改"); throw new ServiceException(11541, "内置角色无权修改");
} }
} }*/
permissionService.bathAssignUserRole(listReqVO); permissionService.bathAssignUserRole(listReqVO);
return success(true); return success(true);
} }
@@ -29,11 +29,11 @@ public class UserExportRespVO {
private Long id; private Long id;
@Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "chenfeng") @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "chenfeng")
@ExcelProperty("用户名") @ExcelProperty("用户名")
private String username; private String username;
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰") @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@ExcelProperty("用户") @ExcelProperty("用户")
private String nickname; private String nickname;
@Schema(description = "备注", example = "我是一个用户") @Schema(description = "备注", example = "我是一个用户")
@@ -75,13 +75,13 @@ public class UserExportRespVO {
@DictFormat(DictTypeConstants.COMMON_STATUS) @DictFormat(DictTypeConstants.COMMON_STATUS)
private Integer status; private Integer status;
@Schema(description = "最后登录 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "192.168.1.1") /*@Schema(description = "最后登录 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "192.168.1.1")
@ExcelProperty("最后登录IP") @ExcelProperty("最后登录IP")
private String loginIp; private String loginIp;
@Schema(description = "最后登录时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") @Schema(description = "最后登录时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
@ExcelProperty("最后登录时间") @ExcelProperty("最后登录时间")
private LocalDateTime loginDate; private LocalDateTime loginDate;*/
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
private LocalDateTime createTime; private LocalDateTime createTime;
@@ -93,7 +93,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
throw ServiceExceptionUtil.exception(ORGAN_NOT_EXISTS); throw ServiceExceptionUtil.exception(ORGAN_NOT_EXISTS);
} }
// 校验账号是否存在 // 校验账号是否存在
AdminUserDO user = userService.getUserByUsername(username, organ.getId()); AdminUserDO user = userService.getUserByUsernameAndOrganId(username, organ.getId());
if (user == null) { if (user == null) {
createLoginLog(null, username, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS); createLoginLog(null, username, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS); throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
@@ -104,6 +104,15 @@ public interface AdminUserService {
*/ */
AdminUserDO getUserByUsername(String username, Long organId); AdminUserDO getUserByUsername(String username, Long organId);
/**
* 通过用户名与组织id查询用户
*
* @param username 用户名
* @return 用户对象信息
*/
AdminUserDO getUserByUsernameAndOrganId(String username, Long organId);
/** /**
* 通过手机号获取用户 * 通过手机号获取用户
* *
@@ -248,6 +248,15 @@ public class AdminUserServiceImpl implements AdminUserService {
return userMapper.selectByUsername(username, organId); return userMapper.selectByUsername(username, organId);
} }
@Override
@OrganIgnore
public AdminUserDO getUserByUsernameAndOrganId(String username, Long organId) {
return userMapper.selectOne(new LambdaQueryWrapperX<AdminUserDO>()
.eq(AdminUserDO::getUsername, username)
.eq(AdminUserDO::getOrganId, organId)
);
}
@Override @Override
public AdminUserDO getUserByMobile(String mobile) { public AdminUserDO getUserByMobile(String mobile) {
return userMapper.selectByMobile(mobile); return userMapper.selectByMobile(mobile);