| | |
| | | @Log("修改普通用户的密码") |
| | | @PostMapping("/updateClientPassword") |
| | | public ResponseVO<Object> updateClientPassword(@Validated @RequestBody UserPwsParm param) { |
| | | if (!SecurityUtils.getUserDetails().getAdministratorType().equals(AdministratorEnums.ADMIN.getCode())) { |
| | | throw new BusinessException("非超级管理员无法修改密码!"); |
| | | } |
| | | boolean result; |
| | | |
| | | boolean result = clientService.updateAdminPassword(param); |
| | | //超管直接修改 |
| | | if (SecurityUtils.getUserDetails().getAdministratorType().equals(AdministratorEnums.ADMIN.getCode())) { |
| | | result = clientService.updateAdminPassword(param); |
| | | } else { |
| | | //当前登录账号ID |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //要修要密码的用户的上级ID |
| | | Client client = clientService.getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, param.getUserid())); |
| | | //为其下属才能修改 |
| | | if (client != null && userId.equals(client.getSuperiorId())) { |
| | | result = clientService.updateAdminPassword(param); |
| | | } else { |
| | | throw new BusinessException("非超级管理员或该用户不是您下属用户,无法修改密码!"); |
| | | } |
| | | } |
| | | |
| | | if (result) { |
| | | return ResponseUtil.success("修改成功"); |
| | | } else { |
| | | return ResponseUtil.fail("修改失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | @PostMapping("/delete/{id}") |