|
|
|
|
@ -1809,16 +1809,20 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public DeviceOperationStatusRespVO getDeviceOperationalStatus() {
|
|
|
|
|
public DeviceOperationStatusRespVO getDeviceOperationalStatus(Integer deviceType) {
|
|
|
|
|
|
|
|
|
|
DeviceOperationStatusRespVO result = new DeviceOperationStatusRespVO();
|
|
|
|
|
|
|
|
|
|
// 1. 从 MySQL 获取设备总数
|
|
|
|
|
Integer totalDevices = deviceMapper.getTotalDeviceCount();
|
|
|
|
|
Integer totalDevices = deviceType == null
|
|
|
|
|
? deviceMapper.getTotalDeviceCount()
|
|
|
|
|
: deviceMapper.getTotalDeviceCountByType(deviceType);
|
|
|
|
|
result.setTotalDevices(totalDevices);
|
|
|
|
|
|
|
|
|
|
// 2. 从 MySQL 获取所有设备ID
|
|
|
|
|
List<Long> deviceIds = deviceMapper.getAllDeviceIds();
|
|
|
|
|
List<Long> deviceIds = deviceType == null
|
|
|
|
|
? deviceMapper.getAllDeviceIds()
|
|
|
|
|
: deviceMapper.getAllDeviceIdsByType(deviceType);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(deviceIds)) {
|
|
|
|
|
// 没有设备,所有状态设为0
|
|
|
|
|
@ -1957,7 +1961,7 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Object>> getMultiDeviceAttributes(Long goviewId) {
|
|
|
|
|
public List<Map<String, Object>> getMultiDeviceAttributes(Long goviewId, Integer deviceType) {
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
@ -1994,7 +1998,9 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
|
|
|
|
|
|
// 3. 批量查设备
|
|
|
|
|
Map<Long, DeviceDO> deviceMap = deviceMapper
|
|
|
|
|
.selectBatchIds(allDeviceIds)
|
|
|
|
|
.selectList(Wrappers.<DeviceDO>lambdaQuery()
|
|
|
|
|
.in(DeviceDO::getId, allDeviceIds)
|
|
|
|
|
.eq(deviceType != null, DeviceDO::getDeviceType, deviceType))
|
|
|
|
|
.stream()
|
|
|
|
|
.collect(Collectors.toMap(DeviceDO::getId, Function.identity()));
|
|
|
|
|
log.info("deviceMap size: {}", deviceMap.size());
|
|
|
|
|
|