|
@@ -441,28 +441,26 @@ public class DmpDeviceInfoServiceImpl extends AbstractCrudService<DmpDeviceInfoM
|
|
}
|
|
}
|
|
queryVO.setDeviceuuid(deviceuuidList);
|
|
queryVO.setDeviceuuid(deviceuuidList);
|
|
|
|
|
|
- List<LastInnerResultVO> list = remoteTsdbProxyService.last(queryVO);
|
|
|
|
|
|
+ List<Map<String,Object>> list = remoteTsdbProxyService.getAllDeviceRealTime();
|
|
if(CollectionUtils.isNotEmpty(list)){
|
|
if(CollectionUtils.isNotEmpty(list)){
|
|
for(int i=0;i<list.size();i++){
|
|
for(int i=0;i<list.size();i++){
|
|
- if(Objects.nonNull(list.get(i).getMetrics())){
|
|
|
|
- String deviceuuid = list.get(i).getDeviceuuid();
|
|
|
|
- LocalDateTime lTime = Instant.ofEpochMilli(Long.valueOf(list.get(i).getMetrics().get("time").toString())).atZone(ZoneOffset.ofHours(8)).toLocalDateTime();
|
|
|
|
- String date = lTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
|
- String currentDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
|
- LambdaUpdateWrapper<DmpDeviceStatus> updateWrapper = Wrappers.lambdaUpdate();
|
|
|
|
- if(date.equals(currentDate)){
|
|
|
|
- updateWrapper.set(DmpDeviceStatus::getDeviceStatus,1) //设备在线
|
|
|
|
- .set(DmpDeviceStatus::getLastOnlineTime,lTime)
|
|
|
|
- .eq(DmpDeviceStatus::getDeviceUuid,deviceuuid);
|
|
|
|
|
|
+ String deviceuuid = list.get(i).get("deviceuuid").toString();
|
|
|
|
+ LocalDateTime lTime = Instant.ofEpochMilli(Long.valueOf(list.get(i).get("time").toString())).atZone(ZoneOffset.ofHours(8)).toLocalDateTime();
|
|
|
|
+ String date = lTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
|
+ String currentDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
|
+ LambdaUpdateWrapper<DmpDeviceStatus> updateWrapper = Wrappers.lambdaUpdate();
|
|
|
|
+ if(date.equals(currentDate)){
|
|
|
|
+ updateWrapper.set(DmpDeviceStatus::getDeviceStatus,1) //设备在线
|
|
|
|
+ .set(DmpDeviceStatus::getLastOnlineTime,lTime)
|
|
|
|
+ .eq(DmpDeviceStatus::getDeviceUuid,deviceuuid);
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ updateWrapper.set(DmpDeviceStatus::getDeviceStatus,2) //设备离线
|
|
|
|
+ .set(DmpDeviceStatus::getLastOnlineTime,lTime)
|
|
|
|
+ .eq(DmpDeviceStatus::getDeviceUuid,deviceuuid);
|
|
|
|
|
|
- }else{
|
|
|
|
- updateWrapper.set(DmpDeviceStatus::getDeviceStatus,2) //设备离线
|
|
|
|
- .set(DmpDeviceStatus::getLastOnlineTime,lTime)
|
|
|
|
- .eq(DmpDeviceStatus::getDeviceUuid,deviceuuid);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- dmpDeviceStatusService.update(updateWrapper);
|
|
|
|
}
|
|
}
|
|
|
|
+ dmpDeviceStatusService.update(updateWrapper);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|