xuxiaofei лет назад: 3
Родитель
Сommit
58f6b04675

+ 7 - 2
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/controller/FireDeviceController.java

@@ -462,6 +462,10 @@ public class FireDeviceController extends BaseController {
         StringBuilder msg = new StringBuilder();
         //执行动作结果
         boolean flg = true;
+        //1正常执行 0执行失败
+        Integer fireStatus=1;
+        Map<String,Object> mapstatus = new HashMap<>();
+
         //打开继电器
         for (RemoteLabHardware hardware : hdlist) {
             String str = null;
@@ -470,6 +474,8 @@ public class FireDeviceController extends BaseController {
             for (Map.Entry<String, Object> enty : o.entrySet()) {
                 if (enty.getKey().equals("code") && Integer.valueOf(enty.getValue().toString()) == 500) {
                     flg = false;
+                    //灭火执行失败
+                    fireStatus=0;
                 }
                 if (enty.getKey().equals("msg")) {
                     str = enty.getValue().toString();
@@ -481,8 +487,7 @@ public class FireDeviceController extends BaseController {
         }
 
         //通知前端一键灭火正在执行
-        Map<String,Object> mapstatus = new HashMap<>();
-        mapstatus.put("fireStatus",1);
+        mapstatus.put("fireStatus",fireStatus);
         mapstatus.put("direTime",fireTime);
         mqttSend.send(MqttConstants.TOPIC_FIRE_DEVICE_EXECUTING+deviceCode,JSON.toJSONString(mapstatus));