Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -25,6 +25,7 @@ public class DeviceStageMonitorServiceImpl implements DeviceStageMonitorService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONArray getData(JSONArray jsonArray) throws Exception {
|
public JSONArray getData(JSONArray jsonArray) throws Exception {
|
||||||
|
long begin = System.currentTimeMillis();
|
||||||
JSONArray arr = new JSONArray();
|
JSONArray arr = new JSONArray();
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
@@ -49,7 +50,9 @@ public class DeviceStageMonitorServiceImpl implements DeviceStageMonitorService
|
|||||||
obj.put("id", js.getString("id")); // 设备不存在就只保留id,方便前端查看
|
obj.put("id", js.getString("id")); // 设备不存在就只保留id,方便前端查看
|
||||||
arr.add(obj);
|
arr.add(obj);
|
||||||
}
|
}
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
long duration = end - begin;
|
||||||
|
System.out.println("监控数据返回耗时:"+duration);
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.nl.acs.opc;
|
package org.nl.acs.opc;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.udw.UnifiedDataAccessor;
|
import org.nl.acs.udw.UnifiedDataAccessor;
|
||||||
@@ -10,7 +11,6 @@ import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
|||||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.openscada.opc.lib.da.*;
|
import org.openscada.opc.lib.da.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -195,8 +195,9 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
|||||||
if (true) {
|
if (true) {
|
||||||
this.logItemChanged(itemId, accessor_value, value, itemDto);
|
this.logItemChanged(itemId, accessor_value, value, itemDto);
|
||||||
}
|
}
|
||||||
|
if(!ObjectUtil.isEmpty(value)){
|
||||||
accessor_value.setValue(itemId, value);
|
accessor_value.setValue(itemId, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,15 +413,15 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
|||||||
Object obj = accessor_value.getValue(relate);
|
Object obj = accessor_value.getValue(relate);
|
||||||
sb.append("key:" + relate + "value:" + obj + ";");
|
sb.append("key:" + relate + "value:" + obj + ";");
|
||||||
}
|
}
|
||||||
|
// log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value, sb});
|
||||||
if (!itemDto.getItem_code().endsWith("heartbeat")) {
|
if (!itemDto.getItem_code().endsWith("heartbeat")) {
|
||||||
lucene.deviceExecuteLog(new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".")+1), String.valueOf(his), String.valueOf(value)));
|
lucene.deviceExecuteLog(new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".")+1), String.valueOf(his), String.valueOf(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value});
|
||||||
if (!itemDto.getItem_code().endsWith("heartbeat")) {
|
if (!itemDto.getItem_code().endsWith("heartbeat")) {
|
||||||
lucene.deviceExecuteLog(new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".")+1), String.valueOf(his), String.valueOf(value)));
|
lucene.deviceExecuteLog(new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".")+1), String.valueOf(his), String.valueOf(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user