|
@@ -600,18 +600,23 @@ public class OnlineMonitorImpl implements OnlineMonitorService {
|
|
|
//取缓存里的数据
|
|
|
byte[] bytes = redisUtil.get(("sms_water_"+monDataCol.getDeviceCode()).getBytes());
|
|
|
if(bytes != null && bytes.length>0) {
|
|
|
- monitorDataEntity = (MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get();}
|
|
|
+ monitorDataEntity = (MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get();
|
|
|
+ }
|
|
|
}
|
|
|
//获取最新数据 更新
|
|
|
for(MonitorDataDto monData : monDataCol.getMonitorDataEntities()) {
|
|
|
if(monDataCol.getDeviceId()==null) {
|
|
|
byte[] bytes = redisUtil.get(("sms_water_"+monData.getDeviceCode()).getBytes());
|
|
|
if(bytes != null && bytes.length>0) {
|
|
|
- monitorDataEntity = (MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get();}
|
|
|
+ monitorDataEntity = (MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get();
|
|
|
+ }else {
|
|
|
+ monitorDataEntity=null;
|
|
|
+ }
|
|
|
}
|
|
|
if(monitorDataEntity != null) {
|
|
|
- if(monDataCol.getCollectDate()==null || monitorDataEntity.getCollectDate().getTime()>monDataCol.getCollectDate().getTime() )
|
|
|
+ if(monDataCol.getCollectDate()==null || monitorDataEntity.getCollectDate().getTime()>monDataCol.getCollectDate().getTime() ){
|
|
|
monDataCol.setCollectDate(monitorDataEntity.getCollectDate());
|
|
|
+ }
|
|
|
SimpleDateFormat formatdate = new SimpleDateFormat("YYYY-MM-dd");//日期算换格式
|
|
|
//筛选该设备相同属性的值
|
|
|
List<MonitorDataValueEntity> attributeEntities=monitorDataEntity.getDataValues().stream().filter((MonitorDataValueEntity m)
|
|
@@ -638,7 +643,10 @@ public class OnlineMonitorImpl implements OnlineMonitorService {
|
|
|
if(monDataCol.getDeviceId()==null) {
|
|
|
byte[] bytes = redisUtil.get(("sms_water_"+monitorData.getDeviceCode()).getBytes());
|
|
|
if(bytes != null && bytes.length>0) {
|
|
|
- monitorDataEntity = (MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get();}
|
|
|
+ monitorDataEntity = (MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get();
|
|
|
+ }else{
|
|
|
+ monitorDataEntity=null;
|
|
|
+ }
|
|
|
}
|
|
|
if(monitorDataEntity != null) {
|
|
|
SimpleDateFormat formatdate = new SimpleDateFormat("YYYY-MM-dd");//日期算换格式
|
|
@@ -710,11 +718,15 @@ public class OnlineMonitorImpl implements OnlineMonitorService {
|
|
|
if(monDataCol.getDeviceId()==null) {
|
|
|
byte[] bytes = redisUtil.get(("sms_water_"+monitorData.getDeviceCode()).getBytes());
|
|
|
if(bytes != null && bytes.length>0) {
|
|
|
- monitorDataEntity = (MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get();}
|
|
|
+ monitorDataEntity = (MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get();
|
|
|
+ }else{
|
|
|
+ monitorDataEntity=null;
|
|
|
+ }
|
|
|
}
|
|
|
if(monitorDataEntity != null) {
|
|
|
- if(monDataCol.getCollectDate()==null||monitorDataEntity.getCollectDate().getTime()>monDataCol.getCollectDate().getTime())
|
|
|
+ if(monDataCol.getCollectDate()==null||monitorDataEntity.getCollectDate().getTime()>monDataCol.getCollectDate().getTime()){
|
|
|
monDataCol.setCollectDate(monitorDataEntity.getCollectDate());
|
|
|
+ }
|
|
|
//筛选该设备相同属性的值
|
|
|
List<MonitorDataValueEntity> attributeEntities = monitorDataEntity.getDataValues().stream().filter((MonitorDataValueEntity m)
|
|
|
-> m.getAttributeId().equals(monitorData.getAttributeId())).collect(Collectors.toList());
|