|
|
|
@ -359,7 +359,7 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService { |
|
|
|
|
log.info("策略id:{}", sceneCode); |
|
|
|
|
log.info("设备id:{}", deviceId); |
|
|
|
|
log.info("控制指令:{}", data); |
|
|
|
|
|
|
|
|
|
List<HashMap> ary = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
PsdcDevice psdcDevice = psdcDeviceMapper.queryById(deviceId); |
|
|
|
|
if (psdcDevice == null) { |
|
|
|
@ -376,6 +376,9 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService { |
|
|
|
|
// 模式策略下属各场景步骤控制指令下发执行日志
|
|
|
|
|
String controlKey = map.get("controlKey").toString(); |
|
|
|
|
String controlValue = map.get("controlValue").toString(); |
|
|
|
|
HashMap<String, Object> map2 = new HashMap<>(); |
|
|
|
|
map2.put(coverKey(controlKey), controlValue); |
|
|
|
|
ary.add(map2); |
|
|
|
|
if (controlValue.equals("1") || controlValue.equals("2")) { |
|
|
|
|
controlValue = coverStr("r", Integer.parseInt(controlValue)); |
|
|
|
|
} |
|
|
|
@ -389,7 +392,7 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService { |
|
|
|
|
jsonObject.put("timestamp",sdf2.format(new Date())); |
|
|
|
|
jsonObject.put("deviceId",deviceId); |
|
|
|
|
jsonObject.put("sceneCode",sceneCode); |
|
|
|
|
jsonObject.put("data",data); |
|
|
|
|
jsonObject.put("data",ary); |
|
|
|
|
MID = MID + 1; |
|
|
|
|
myMQTTClient.publish(jsonObject.toJSONString(), "/hwj1/dntd/request/action/command", 2, false); |
|
|
|
|
// psdcControlLogMapper.insert(new PsdcControlLog(deviceId,psdcDevice.getDeviceName(),psdcDevice.getDeviceSn(),controlContext,controlValue,controlMethod,2,"控制成功",controlBy));
|
|
|
|
@ -656,4 +659,15 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService { |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String coverKey(String s){ |
|
|
|
|
switch (s){ |
|
|
|
|
case "open": |
|
|
|
|
return "Open"; |
|
|
|
|
case "close": |
|
|
|
|
return "Close"; |
|
|
|
|
default: |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |