|
@@ -7,7 +7,7 @@ import com.backendsys.modules.common.config.security.enums.SecurityEnum;
|
|
|
import com.backendsys.modules.common.config.security.utils.SecurityUtil;
|
|
|
import com.backendsys.modules.common.utils.Result;
|
|
|
import com.backendsys.modules.system.entity.SysUserDTO;
|
|
|
-import com.backendsys.modules.system.service.SysUserV2Service;
|
|
|
+import com.backendsys.modules.system.service.SysUserService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
@@ -32,20 +32,20 @@ public class SysUserController {
|
|
|
private SecurityUtil securityUtil;
|
|
|
|
|
|
@Autowired
|
|
|
- private SysUserV2Service sysUserV2Service;
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
|
|
@Operation(summary = "获取系统用户列表")
|
|
|
@PreAuthorize("@sr.hasPermission('3.2')")
|
|
|
@GetMapping("/api/system/user/getUserList")
|
|
|
public Result getUserList(SysUserDTO sysUserDTO) {
|
|
|
- return Result.success().put("data", sysUserV2Service.selectUserList(sysUserDTO));
|
|
|
+ return Result.success().put("data", sysUserService.selectUserList(sysUserDTO));
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "获取系统用户列表 (在线的)")
|
|
|
@PreAuthorize("@sr.hasPermission('3.1')")
|
|
|
@GetMapping("/api/system/user/getUserOnlineList")
|
|
|
public Result getUserOnlineList(SysUserDTO sysUserDTO) {
|
|
|
- return Result.success().put("data", sysUserV2Service.selectUserOnlineList(sysUserDTO));
|
|
|
+ return Result.success().put("data", sysUserService.selectUserOnlineList(sysUserDTO));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -64,12 +64,11 @@ public class SysUserController {
|
|
|
// 查询他人的用户信息
|
|
|
// - 查询自己 (无需权限)
|
|
|
// - 查询他人 (需要权限或超级管理员)
|
|
|
- System.out.println("SecurityUtil.isSuper(): " + SecurityUtil.isSuper());
|
|
|
- if (!user_id.equals(SecurityUtil.getUserId()) && !securityUtil.hasPermission("3.2.1.2") && !SecurityUtil.isSuper()) {
|
|
|
+ if (!user_id.equals(SecurityUtil.getUserId()) && !securityUtil.hasPermission("3.2.1.2")) {
|
|
|
throw new CustException(SecurityEnum.NOAUTH);
|
|
|
}
|
|
|
|
|
|
- return Result.success().put("data", sysUserV2Service.selectUserInfoSimple(user_id));
|
|
|
+ return Result.success().put("data", sysUserService.selectUserInfoSimple(user_id));
|
|
|
}
|
|
|
|
|
|
@SysLog("创建系统用户")
|
|
@@ -77,7 +76,7 @@ public class SysUserController {
|
|
|
@PreAuthorize("@sr.hasPermission('3.2.2')")
|
|
|
@PostMapping("/api/system/user/createUser")
|
|
|
public Result createUser(@Validated(SysUserDTO.Create.class) @RequestBody SysUserDTO sysUserDTO) {
|
|
|
- return Result.success().put("data", sysUserV2Service.insertUser(sysUserDTO));
|
|
|
+ return Result.success().put("data", sysUserService.insertUser(sysUserDTO));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -101,14 +100,14 @@ public class SysUserController {
|
|
|
// 编辑他人的用户信息
|
|
|
// - 编辑自己 (无需权限)
|
|
|
// - 编辑他人 (需要子权限或超级管理员)
|
|
|
- if (!user_id.equals(SecurityUtil.getUserId()) && !securityUtil.hasPermission("3.2.3.2") && !SecurityUtil.isSuper()) {
|
|
|
+ if (!user_id.equals(SecurityUtil.getUserId()) && !securityUtil.hasPermission("3.2.3.2")) {
|
|
|
throw new CustException(SecurityEnum.NOAUTH);
|
|
|
}
|
|
|
// 防止手动更新字段
|
|
|
sysUserDTO.setLast_login_time(null);
|
|
|
sysUserDTO.setLast_login_ip(null);
|
|
|
|
|
|
- return Result.success().put("data", sysUserV2Service.updateUserInfo(sysUserDTO));
|
|
|
+ return Result.success().put("data", sysUserService.updateUserInfo(sysUserDTO));
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "编辑系统用户密码")
|
|
@@ -127,11 +126,11 @@ public class SysUserController {
|
|
|
// 编辑他人的用户信息
|
|
|
// - 编辑自己 (无需权限)
|
|
|
// - 编辑他人 (需要子权限或超级管理员)
|
|
|
- if (!user_id.equals(SecurityUtil.getUserId()) && !securityUtil.hasPermission("3.2.3.2") && !SecurityUtil.isSuper()) {
|
|
|
+ if (!user_id.equals(SecurityUtil.getUserId()) && !securityUtil.hasPermission("3.2.3.2")) {
|
|
|
throw new CustException(SecurityEnum.NOAUTH);
|
|
|
}
|
|
|
|
|
|
- return Result.success().put("data", sysUserV2Service.updateUserPassword(sysUserDTO));
|
|
|
+ return Result.success().put("data", sysUserService.updateUserPassword(sysUserDTO));
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "重置系统用户密码")
|
|
@@ -152,7 +151,7 @@ public class SysUserController {
|
|
|
throw new CustException("不能重置自身密码,请自行修改密码");
|
|
|
}
|
|
|
|
|
|
- return Result.success().put("data", sysUserV2Service.resetUserPassword(sysUserDTO));
|
|
|
+ return Result.success().put("data", sysUserService.resetUserPassword(sysUserDTO));
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "删除系统用户")
|
|
@@ -166,7 +165,7 @@ public class SysUserController {
|
|
|
if (user_ids != null && user_ids.contains(SecurityUtil.getUserId()) && !user_id.equals(SecurityUtil.getUserId())) throw new CustException("不能删除自己的账号");
|
|
|
if (user_ids != null && user_ids.contains(1L) && !user_id.equals(1L)) throw new CustException("不能删除超管账号");
|
|
|
|
|
|
- return Result.success().put("data", sysUserV2Service.deleteUser(sysUserDTO));
|
|
|
+ return Result.success().put("data", sysUserService.deleteUser(sysUserDTO));
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "踢出系统用户")
|
|
@@ -178,7 +177,7 @@ public class SysUserController {
|
|
|
if (user_id.equals(1L)) throw new CustException("不能踢出超管账号");
|
|
|
if (user_id.equals(SecurityUtil.getUserId())) throw new CustException("不能踢出自己的账号");
|
|
|
|
|
|
- return Result.success().put("data", sysUserV2Service.kickUser(user_id));
|
|
|
+ return Result.success().put("data", sysUserService.kickUser(user_id));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -197,11 +196,11 @@ public class SysUserController {
|
|
|
// 查询他人的用户信息
|
|
|
// - 查询自己 (无需权限)
|
|
|
// - 查询他人 (需要子权限或超级管理员)
|
|
|
- if (!user_id.equals(SecurityUtil.getUserId()) && !securityUtil.hasPermission("3.4.1.2") && !SecurityUtil.isSuper()) {
|
|
|
+ if (!user_id.equals(SecurityUtil.getUserId()) && !securityUtil.hasPermission("3.4.1.2")) {
|
|
|
throw new CustException(SecurityEnum.NOAUTH);
|
|
|
}
|
|
|
|
|
|
- return Result.success().put("data", sysUserV2Service.selectUserPermission(user_id));
|
|
|
+ return Result.success().put("data", sysUserService.selectUserPermission(user_id));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -219,11 +218,11 @@ public class SysUserController {
|
|
|
// 查询他人的用户信息
|
|
|
// - 查询自己 (无需权限)
|
|
|
// - 查询他人 (需要子权限或超级管理员)
|
|
|
- if (!user_id.equals(SecurityUtil.getUserId()) && !securityUtil.hasPermission("3.4.1.2") && !SecurityUtil.isSuper()) {
|
|
|
+ if (!user_id.equals(SecurityUtil.getUserId()) && !securityUtil.hasPermission("3.4.1.2")) {
|
|
|
throw new CustException(SecurityEnum.NOAUTH);
|
|
|
}
|
|
|
|
|
|
- return Result.success().put("data", sysUserV2Service.selectUserMenu(user_id));
|
|
|
+ return Result.success().put("data", sysUserService.selectUserMenu(user_id));
|
|
|
}
|
|
|
|
|
|
}
|