#老板的上位机登录
This commit is contained in:
@@ -328,13 +328,24 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
if (!CollectionUtils.isEmpty(deviceList)) {
|
||||
List<String> ids = deviceList.stream().map(Device::getDeviceName).collect(Collectors.toList());
|
||||
List<DeviceRunningStatusHistory> allStatusList = deviceStatusHistoryMapper.selectLatestByDeviceIds(ids);
|
||||
// 有上位机的
|
||||
LambdaQueryWrapper<LocationMessage> query = new LambdaQueryWrapper<>();
|
||||
query.in(LocationMessage::getDeviceId, ids);
|
||||
List<LocationMessage> hostLocations = hostLocationMapper.selectList(query);
|
||||
Map<String, LocationMessage> locationMap = hostLocations.stream()
|
||||
.collect(Collectors.toMap(LocationMessage::getDeviceId, Function.identity()));
|
||||
|
||||
for (Device x : deviceList) {
|
||||
if (siteMemory.hasTask(x.getSerialNumber())) {
|
||||
work += 1;
|
||||
x.setFeStatus(1);
|
||||
} else {
|
||||
free += 1;
|
||||
x.setFeStatus(2);
|
||||
if (x.getOnlineStatus() == null || x.getOnlineStatus() == 0) {
|
||||
x.setFeStatus(3);
|
||||
} else {
|
||||
x.setFeStatus(2);
|
||||
}
|
||||
}
|
||||
String key = "running_status:" + x.getDeviceName();
|
||||
DeviceStatusRecordDTO recordDTO = redisCache.getCacheObject(key);
|
||||
@@ -360,7 +371,16 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x.setLastRunningStatus(lastRunningStatus);
|
||||
|
||||
String locationKey = NettyCacheKey.latestPositonKey + x.getDeviceName();
|
||||
LocationMessage locationMessage = redisCache.getCacheObject(locationKey);
|
||||
if (locationMessage == null) {
|
||||
locationMessage = locationMap.get(x.getDeviceName());
|
||||
}
|
||||
x.setLocationMessage(locationMessage);
|
||||
|
||||
}
|
||||
statusStatistics.put(0, work);
|
||||
statusStatistics.put(1, free);
|
||||
|
||||
Reference in New Issue
Block a user