| | |
| | | @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}") |
| | |
| | | |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | LambdaQueryWrapper<Client> wrapper = Wrappers.lambdaQuery(Client.class); |
| | | if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) { |
| | | wrapper.eq(Client::getSuperiorId, SecurityUtils.getUserId()); |
| | | if (AdministratorEnums.NORMAL.getCode().equals(SecurityUtils.getAdministratorIdentity())) { |
| | | wrapper.eq(Client::getSuperiorId, SecurityUtils.getUserId()).or(w -> w.eq( |
| | | Client::getId, SecurityUtils.getUserId() |
| | | )); |
| | | } |
| | | if (keyword != null && !keyword.isEmpty()) { |
| | | wrapper.like(Client::getClientName, keyword) |
| | | .or(clientLambdaQueryWrapper -> clientLambdaQueryWrapper.like(Client::getMobile, keyword)) |
| | | .or(clientLambdaQueryWrapper -> clientLambdaQueryWrapper.like(Client::getLinkMan, keyword)); |
| | | .or(w1 -> w1.like(Client::getMobile, keyword)) |
| | | .or(w2 -> w2.like(Client::getLinkMan, keyword)); |
| | | } |
| | | List<Client> clientList = clientService.list(wrapper); |
| | | List<ClientDto> clientDtoList = new ArrayList<>(); |