wang-hao-jie
2022-03-17 6dfd2599d2e52507e018fd4c6b35d38873e48cfb
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java
@@ -58,9 +58,9 @@
            // 设置回调函数
            client.setCallback(new MqttCallback() {
                public void connectionLost(Throwable cause) {
                    System.out.println("connectionLost");
                    //System.out.println("connectionLost");
                    String topicInfo = haiKangPost.getTopicInfo();
                    System.out.println("重连-订阅信息:"+topicInfo);
                    //System.out.println("重连-订阅信息:"+topicInfo);
                    JSONObject jsonObject = JSONUtil.parseObj(topicInfo);
                    if(jsonObject.get("data")!=null){
                        String data = jsonObject.get("data").toString();
@@ -73,7 +73,7 @@
                }
                public void deliveryComplete(IMqttDeliveryToken token) {
                    System.out.println("deliveryComplete---------"+ token.isComplete());
                    //System.out.println("deliveryComplete---------"+ token.isComplete());
                }
@@ -96,9 +96,9 @@
                                    JSONObject jsonObject1 = JSONUtil.parseObj(s1);
                                    String data = jsonObject1.get("data").toString();
                                    JSONObject jsonObject2 = JSONUtil.parseObj(data);
                                    System.out.println(jsonObject2.get("alarmId"));//报警id
                                    System.out.println(jsonObject2.get("vehicleIndexCode"));//车辆code
                                    System.out.println(jsonObject2.get("eventType"));//报警类型
                                    //System.out.println(jsonObject2.get("alarmId"));//报警id
                                    //System.out.println(jsonObject2.get("vehicleIndexCode"));//车辆code
                                    //System.out.println(jsonObject2.get("eventType"));//报警类型
                                    //未系安全带:132376
                                    //抽烟:132375
                                    //接打电话:132374
@@ -122,7 +122,7 @@
                                        alarm.setType(4);
                                        alarm.setValue("抽烟");
                                    }else if(eventType.equals("132405")){
                                        alarm.setType(6);
                                        alarm.setType(7);
                                        alarm.setValue("超速");
                                    }else{
                                        return;