| | |
| | | import com.sandu.common.util.IpUtil; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.dto.ClientDto; |
| | | import com.sandu.ximon.admin.dto.ClientDtoNode; |
| | | import com.sandu.ximon.admin.param.AddClientPrarm; |
| | | import com.sandu.ximon.admin.param.AdminLoginParam; |
| | | import com.sandu.ximon.admin.param.UpdateClientPrarm; |
| | |
| | | import com.sandu.ximon.dao.domain.ClientRoleRelation; |
| | | import com.sandu.ximon.dao.enums.AdministratorEnums; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import com.sandu.ximon.dao.enums.OrderByEnums; |
| | | import eu.bitwalker.useragentutils.Browser; |
| | | import eu.bitwalker.useragentutils.OperatingSystem; |
| | | import eu.bitwalker.useragentutils.UserAgent; |
| | |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> listLikeClient(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | public ResponseVO<Object> listLikeClient(@RequestParam(value = "keyword", required = false) String keyword, |
| | | @RequestParam(value = "order", required = false) Integer order, |
| | | @RequestParam(value = "seq", required = false) Integer seq) { |
| | | if (!permissionConfig.check(MenuEnum.CLIENT_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<ClientDtoNode> clientDtoNodes = clientService.listLikeClient(keyword, order, seq); |
| | | |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | LambdaQueryWrapper<Client> wrapper = Wrappers.lambdaQuery(Client.class); |
| | | 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(w1 -> w1.like(Client::getMobile, keyword)) |
| | | .or(w2 -> w2.like(Client::getLinkMan, keyword)); |
| | | } |
| | | List<Client> clientList = clientService.list(wrapper); |
| | | List<ClientDto> clientDtoList = new ArrayList<>(); |
| | | |
| | | for (Client demo : clientList) { |
| | | ClientDto clientDto = new ClientDto(); |
| | | BeanUtil.copyProperties(demo, clientDto); |
| | | ClientRoleRelation one = clientRoleRelationService.getOne(Wrappers.lambdaQuery(ClientRoleRelation.class) |
| | | .eq(ClientRoleRelation::getClientId, demo.getId())); |
| | | |
| | | if (one != null) { |
| | | clientDto.setRoleId(one.getRoleId()); |
| | | } |
| | | clientDtoList.add(clientDto); |
| | | |
| | | } |
| | | return ResponseUtil.successPage(clientDtoList); |
| | | return ResponseUtil.successPage(clientDtoNodes); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | |
| | | StoreOperationRecordsUtils.storeOperationLoginData(client.getId(), client.getClientName(), "用户登录", content); |
| | | return ResponseUtil.success(authInfo); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | | @GetMapping("/getTokenByKey") |
| | | public ResponseVO<Object> getLonginKey(@RequestParam(required = false, value = "keyValue") String keyValue) { |
| | | |
| | | return ResponseUtil.success(clientService.creatKeyByLogin(keyValue)); |
| | | } |
| | | } |