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