|
@@ -1,15 +1,17 @@
|
|
|
package com.middle.platform.manage.biz.service;
|
|
package com.middle.platform.manage.biz.service;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.middle.platform.manage.biz.domain.req.TypeStatisticsReq;
|
|
import com.middle.platform.manage.biz.domain.req.TypeStatisticsReq;
|
|
|
import com.middle.platform.manage.biz.domain.vo.TotalStatisticsVo;
|
|
import com.middle.platform.manage.biz.domain.vo.TotalStatisticsVo;
|
|
|
import com.middle.platform.manage.biz.domain.vo.TypeStatisticsVo;
|
|
import com.middle.platform.manage.biz.domain.vo.TypeStatisticsVo;
|
|
|
import com.middle.platform.manage.biz.mapper.IotDeviceMapper;
|
|
import com.middle.platform.manage.biz.mapper.IotDeviceMapper;
|
|
|
import com.middle.platform.manage.biz.mapper.IotProductMapper;
|
|
import com.middle.platform.manage.biz.mapper.IotProductMapper;
|
|
|
|
|
+import com.middle.platform.pagehelper.core.PageRes;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -46,12 +48,14 @@ public class RealTimeMonitoringService {
|
|
|
/**
|
|
/**
|
|
|
* 分类统计
|
|
* 分类统计
|
|
|
*/
|
|
*/
|
|
|
- public List<TypeStatisticsVo> typeStatistics(TypeStatisticsReq typeStatisticsReq) {
|
|
|
|
|
|
|
+ public Object typeStatistics(TypeStatisticsReq typeStatisticsReq) {
|
|
|
|
|
+ PageHelper.startPage(typeStatisticsReq.getPage(), typeStatisticsReq.getPageSize());
|
|
|
List<TypeStatisticsVo> typeStatisticsVos = iotDeviceMapper.queryTypeStatistics(typeStatisticsReq);
|
|
List<TypeStatisticsVo> typeStatisticsVos = iotDeviceMapper.queryTypeStatistics(typeStatisticsReq);
|
|
|
|
|
+ PageInfo<TypeStatisticsVo> pageInfo = new PageInfo<>(typeStatisticsVos);
|
|
|
if (CollUtil.isEmpty(typeStatisticsVos)) {
|
|
if (CollUtil.isEmpty(typeStatisticsVos)) {
|
|
|
- return new ArrayList<>();
|
|
|
|
|
|
|
+ return new PageRes<>();
|
|
|
}
|
|
}
|
|
|
typeStatisticsVos.forEach(e -> e.setStatusName(e.getStatus().equals(1) ? "在线" : "离线"));
|
|
typeStatisticsVos.forEach(e -> e.setStatusName(e.getStatus().equals(1) ? "在线" : "离线"));
|
|
|
- return typeStatisticsVos;
|
|
|
|
|
|
|
+ return new PageRes<>(pageInfo, typeStatisticsVos);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|