2
0

fix: 修复仪表盘分页

This commit is contained in:
caiyuchao
2025-02-08 11:19:25 +08:00
parent 804b25a875
commit faa8e0ad5e
8 changed files with 67 additions and 13 deletions

View File

@@ -24,9 +24,8 @@ public class SysDashboardController extends BaseController {
@GetMapping("/page")
public TableDataInfo page(@RequestParam(value = "searchKey", required = false) String searchKey) {
startPage();
return sysDashboardService.getSiteList(searchKey);
public TableDataInfo page(@RequestParam(value = "searchKey", required = false) String searchKey, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
return sysDashboardService.getSiteList(searchKey, pageNum, pageSize);
}
@GetMapping("/overview")

View File

@@ -10,7 +10,7 @@ import org.wfc.system.domain.vo.SysDashboardVo;
*/
public interface ISysDashboardService {
TableDataInfo getSiteList(String searchKey);
TableDataInfo getSiteList(String searchKey, Integer pageNum, Integer pageSize);
SysDashboardVo overview();
}

View File

@@ -2,7 +2,6 @@ package org.wfc.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -10,7 +9,9 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.wfc.common.core.constant.CacheConstants;
import org.wfc.common.core.constant.HttpStatus;
import org.wfc.common.core.constant.WifiConstants;
import org.wfc.common.core.domain.LoginUser;
import org.wfc.common.core.exception.OmadaException;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.redis.service.RedisService;
import org.wfc.omada.api.monitor.OmadaDashboardApi;
@@ -28,7 +29,6 @@ import org.wfc.system.service.ISysDashboardService;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
@@ -52,12 +52,13 @@ public class SysDashboardServiceImpl implements ISysDashboardService {
private UUserMapper userMapper;
@Override
public TableDataInfo getSiteList(String searchKey) {
ResponseEntity<OperationResponseGridVoSiteSummaryInfo> siteList = omadaSiteApi.getSiteList(PageHelper.getLocalPage().getPageNum(), PageHelper.getLocalPage().getPageSize(), searchKey);
if (siteList.getBody() == null) {
return getDataTable(Collections.emptyList(), 0L);
public TableDataInfo getSiteList(String searchKey, Integer pageNum, Integer pageSize) {
ResponseEntity<OperationResponseGridVoSiteSummaryInfo> siteList = omadaSiteApi.getSiteList(pageNum, pageSize, searchKey);
if (siteList.getBody() == null || siteList.getBody().getErrorCode() != WifiConstants.ERROR_CODE_SUCCESS) {
log.error("Omada error msg: {}",siteList.getBody().getMsg());
throw new OmadaException();
}
log.info("Omada reulst msg: {}",siteList.getBody().getMsg());
List<SiteSummaryInfo> sites = siteList.getBody().getResult().getData();
List<SysDashboardSiteVo> siteVos = new ArrayList<>();
for (SiteSummaryInfo site : sites) {
@@ -77,9 +78,11 @@ public class SysDashboardServiceImpl implements ISysDashboardService {
public SysDashboardVo overview() {
ResponseEntity<OperationResponseGridVoSiteSummaryInfo> siteList = omadaSiteApi.getSiteList(1, 1000);
SysDashboardVo sysDashboardVo = new SysDashboardVo();
if (siteList.getBody() == null) {
return sysDashboardVo;
if (siteList.getBody() == null || siteList.getBody().getErrorCode() != WifiConstants.ERROR_CODE_SUCCESS) {
log.error("Omada error msg: {}",siteList.getBody().getMsg());
throw new OmadaException();
}
List<SiteSummaryInfo> sites = siteList.getBody().getResult().getData();
List<GetDashboardOverview> dashboardOverviews = new ArrayList<>();