feat: 修改终端设备接口
This commit is contained in:
@@ -98,6 +98,11 @@ public interface OmadaClientApi {
|
||||
method = RequestMethod.GET)
|
||||
ResponseEntity<OperationResponseClientGridVoClientInfo> getGridActiveClients(@ApiParam(value = "Site ID",required=true) @PathVariable("siteId") String siteId,@NotNull @ApiParam(value = "Start page number. Start from 1.", required = true) @Valid @RequestParam(value = "page", required = true) Integer page,@NotNull @ApiParam(value = "Number of entries per page. It should be within the range of 1–1000.", required = true) @Valid @RequestParam(value = "pageSize", required = true) Integer pageSize);
|
||||
|
||||
@RequestMapping(value = "/openapi/v1/${omada.omadac-id}/sites/{siteId}/clients",
|
||||
produces = "*/*",
|
||||
method = RequestMethod.GET)
|
||||
ResponseEntity<OperationResponseClientGridVoClientInfo> getGridActiveClients(@ApiParam(value = "Site ID",required=true) @PathVariable("siteId") String siteId,@NotNull @ApiParam(value = "Start page number. Start from 1.", required = true) @Valid @RequestParam(value = "page", required = true) Integer page,@NotNull @ApiParam(value = "Number of entries per page. It should be within the range of 1–1000.", required = true) @Valid @RequestParam(value = "pageSize", required = true) Integer pageSize, @ApiParam(value = "Fuzzy query parameters, support field clientName,clientMac,ip,channel,ssid,apName,apMac,switchMac,switchName,gatewayMac,gatewayName.") @Valid @RequestParam(value = "searchKey", required = false) String searchKey);
|
||||
|
||||
|
||||
/**
|
||||
* POST /openapi/v1/{omadacId}/sites/{siteId}/clients/{clientMac}/reconnect : Reconnect the client
|
||||
|
||||
@@ -45,7 +45,9 @@ public class SysDeviceController extends BaseController {
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysDevice sysDevice) {
|
||||
List<SysDevice> list = sysDeviceService.list();
|
||||
List<SysDevice> list = sysDeviceService.list(Wrappers.<SysDevice>lambdaQuery()
|
||||
.like(SysDevice::getName, sysDevice.getName())
|
||||
.like(SysDevice::getMac, sysDevice.getMac()));
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
package org.wfc.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.system.domain.UClient;
|
||||
import org.wfc.omada.api.client.model.ClientInfo;
|
||||
import org.wfc.system.service.IUClientService;
|
||||
|
||||
import java.util.List;
|
||||
@@ -34,36 +29,16 @@ public class UClientController extends BaseController {
|
||||
private IUClientService uClientService;
|
||||
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(UClient uClient) {
|
||||
public TableDataInfo page(@RequestParam(value = "searchKey", required = false) String searchKey) {
|
||||
startPage();
|
||||
List<UClient> list = uClientService.list();
|
||||
List<ClientInfo> list = uClientService.clientList(searchKey);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(UClient uClient) {
|
||||
List<UClient> list = uClientService.list();
|
||||
public AjaxResult list(@RequestParam(value = "searchKey", required = false) String searchKey) {
|
||||
List<ClientInfo> list = uClientService.clientList(searchKey);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getById(@PathVariable("id") Long id) {
|
||||
return success(uClientService.getById(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody UClient uClient) {
|
||||
return toAjax(uClientService.save(uClient));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody UClient uClient) {
|
||||
return toAjax(uClientService.updateById(uClient));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(uClientService.removeByIds(CollUtil.newArrayList(ids)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package org.wfc.system.service;
|
||||
|
||||
import org.wfc.omada.api.client.model.ClientInfo;
|
||||
import org.wfc.system.domain.UClient;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户设备表 服务类
|
||||
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IUClientService extends IService<UClient> {
|
||||
|
||||
List<ClientInfo> clientList(String searchKey);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
package org.wfc.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.wfc.omada.api.client.OmadaClientApi;
|
||||
import org.wfc.omada.api.client.model.ClientInfo;
|
||||
import org.wfc.omada.api.client.model.OperationResponseClientGridVoClientInfo;
|
||||
import org.wfc.omada.api.organization.OmadaSiteApi;
|
||||
import org.wfc.omada.api.organization.model.OperationResponseGridVoSiteSummaryInfo;
|
||||
import org.wfc.omada.api.organization.model.SiteSummaryInfo;
|
||||
import org.wfc.system.domain.UClient;
|
||||
import org.wfc.system.mapper.UClientMapper;
|
||||
import org.wfc.system.service.IUClientService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -17,4 +30,26 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class UClientServiceImpl extends ServiceImpl<UClientMapper, UClient> implements IUClientService {
|
||||
|
||||
@Autowired
|
||||
private OmadaSiteApi omadaSiteApi;
|
||||
|
||||
@Autowired
|
||||
private OmadaClientApi omadaClientApi;
|
||||
|
||||
public List<ClientInfo> clientList(String searchKey) {
|
||||
ResponseEntity<OperationResponseGridVoSiteSummaryInfo> siteResp = omadaSiteApi.getSiteList(1, 1000);
|
||||
if (ObjectUtil.isNull(siteResp.getBody())) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<SiteSummaryInfo> sites = siteResp.getBody().getResult().getData();
|
||||
List<ClientInfo> clients = new ArrayList<>();
|
||||
for (SiteSummaryInfo site : sites) {
|
||||
ResponseEntity<OperationResponseClientGridVoClientInfo> clientResp = omadaClientApi.getGridActiveClients(site.getSiteId(), 1, 1000, searchKey);
|
||||
if (ObjectUtil.isNull(clientResp.getBody())) {
|
||||
continue;
|
||||
}
|
||||
clients.addAll(clientResp.getBody().getResult().getData());
|
||||
}
|
||||
return clients;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user