fixedBug:#I6460T-多个虚拟设备共用同一个设备导致重复执行
parent
6231e7d63b
commit
91ee9bda5c
|
@ -32,6 +32,7 @@
|
|||
"16537594784840wenshidu0100300013a",
|
||||
"16537594752710wenshidu0100200013d",
|
||||
"16537594707840wenshidu0100100013c",
|
||||
"16538390097670switch0300100500143",
|
||||
"16514626218250abe124000010000011a"
|
||||
],
|
||||
"type": "thingModel",
|
||||
|
|
|
@ -50,7 +50,7 @@ public class VirtualExecutor implements Job {
|
|||
continue;
|
||||
}
|
||||
log.info("invoke virtual device report,jobKey:{},deviceId:{}", jobKey, device.getDeviceId());
|
||||
virtualManager.invokeReport(device);
|
||||
virtualManager.invokeReport(device, virtualDevice.getId());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
virtualDeviceLog.setResult(e.getMessage());
|
||||
|
|
|
@ -269,23 +269,15 @@ public class VirtualManager {
|
|||
/**
|
||||
* 调用脚本中上报方法
|
||||
*/
|
||||
public void invokeReport(DeviceInfo device) {
|
||||
public void invokeReport(DeviceInfo device, String virtualId) {
|
||||
//设备上线
|
||||
deviceOnline(device);
|
||||
|
||||
String deviceId = device.getDeviceId();
|
||||
Set<String> virtualIds = deviceIdToVirtualId.get(deviceId);
|
||||
if (virtualIds == null) {
|
||||
Object scriptObj = virtualScripts.get(virtualId);
|
||||
if (scriptObj == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String virtualId : virtualIds) {
|
||||
Object scriptObj = virtualScripts.get(virtualId);
|
||||
if (scriptObj == null) {
|
||||
continue;
|
||||
}
|
||||
processReport(invokeMethod(scriptObj, "report", device));
|
||||
}
|
||||
processReport(invokeMethod(scriptObj, "report", device));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue