1.pms无线趋势图实时数据功能
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.njcn.device.pms.service.majornetwork.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -18,7 +19,9 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -44,6 +47,9 @@ public class PqsDeviceUnitServiceImpl extends ServiceImpl<PqsDeviceUnitMapper, P
|
||||
.eq(PmsTerminal::getStatus, DataStateEnum.ENABLE.getCode())
|
||||
.eq(StrUtil.isNotBlank(devFlag), PmsTerminal::getTerminalState, devFlag)
|
||||
);
|
||||
if(CollUtil.isEmpty(list)){
|
||||
return pqsDeviceUnitVos;
|
||||
}
|
||||
List<String> terminal = list.stream().map(PmsTerminal::getId).collect(Collectors.toList());
|
||||
//获取所有终端信息
|
||||
List<PqsDeviceUnit> pqsDeviceUnits = this.listByIds(terminal);
|
||||
@@ -61,12 +67,13 @@ public class PqsDeviceUnitServiceImpl extends ServiceImpl<PqsDeviceUnitMapper, P
|
||||
subUnitVo.setId(subKey);
|
||||
subUnitVo.setName(subValue.get(0).getPowerrName());
|
||||
Map<String, List<PmsTerminal>> terMap = subValue.stream().collect(Collectors.groupingBy(PmsTerminal::getId));
|
||||
List<DeviceUnitVo> terUnitVos = new ArrayList<>();
|
||||
List<DeviceUnitVo.DeviceUnit> terUnitVos = new ArrayList<>();
|
||||
terMap.forEach((terKey, terValue) -> {
|
||||
for (PmsTerminal pmsTerminal : terValue) {
|
||||
DeviceUnitVo terUnitVo = new DeviceUnitVo();
|
||||
DeviceUnitVo.DeviceUnit terUnitVo = new DeviceUnitVo.DeviceUnit();
|
||||
terUnitVo.setId(pmsTerminal.getId());
|
||||
terUnitVo.setName(pmsTerminal.getName());
|
||||
terUnitVo.setDevFlag(pmsTerminal.getTerminalState());
|
||||
PqsDeviceUnit pqsDeviceUnit;
|
||||
if (unitMap.containsKey(terKey)) {
|
||||
pqsDeviceUnit = unitMap.get(terKey);
|
||||
|
||||
Reference in New Issue
Block a user