| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.other.api.domain.TUserSite; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement", "/roleManagement/info"}, logical = Logical.OR) |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取系统用户列表", tags = {"管理后台-系统用户管理", "管理后台-角色管理"}) |
| | | public AjaxResult list(GetSysUserList getSysUserList) { |
| | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/add"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "添加系统用户", tags = {"管理后台-系统用户管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement/add", "/systemUserManagement/update"}, logical = Logical.OR) |
| | | @GetMapping("/verifyUserNameRepeat/{username}") |
| | | @ApiOperation(value = "校验账号是否重复", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult verifyUserNameRepeat(@PathVariable String username){ |
| | |
| | | return success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement/update"}, logical = Logical.OR) |
| | | @GetMapping("/getRoleSiteName/{roleId}") |
| | | @ApiOperation(value = "获取角色对应的站点名称", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult<List<String>> getRoleSiteName(@PathVariable Integer roleId){ |
| | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/update"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/update") |
| | | @ApiOperation(value = "编辑系统用户", tags = {"管理后台-系统用户管理"}) |
| | |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | user.setUpdateTime(new Date()); |
| | | userService.updateUser(user); |
| | | |
| | | |
| | | //删除旧的角色数据,添加新的角色 |
| | | userRoleService.remove(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, user.getUserId())); |
| | | //添加新的角色数据 |
| | | SysUserRole userRole = new SysUserRole(); |
| | | userRole.setUserId(user.getUserId()); |
| | | userRole.setRoleId(user.getRoleId()); |
| | | userRoleService.save(userRole); |
| | | |
| | | //删除旧的站点数据后添加新的 |
| | | userSiteClient.delUserSite(user.getUserId()); |
| | | List<Integer> siteIds = user.getSiteIds(); |
| | |
| | | return success(); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/del"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | @ApiOperation(value = "删除系统用户", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult remove(@PathVariable Long[] userIds) { |
| | | if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { |
| | | if (ArrayUtils.contains(userIds, tokenService.getLoginUser().getUserid())) { |
| | | return error("当前用户不能删除"); |
| | | } |
| | | return toAjax(userService.deleteUserByIds(userIds)); |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement/forbidden"}, logical = Logical.OR) |
| | | @PostMapping("/shopUserStart") |
| | | @ApiOperation(value = "账号管理--禁用/启用", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult shopUserStart(@RequestBody ShopUserStart shopUserStart) { |
| | |
| | | */ |
| | | @GetMapping("/getInfo") |
| | | public AjaxResult getInfo() { |
| | | SysUser user = userService.selectUserById(SecurityUtils.getUserId()); |
| | | SysUser user = userService.selectUserById(tokenService.getLoginUser().getUserid()); |
| | | // 角色集合 |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // 权限集合 |
| | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/reset_passwords"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | @ApiOperation(value = "重置密码", tags = {"管理后台-系统用户管理"}) |