From 01a3add609a65cfe5c066ebc743ea6308d32a053 Mon Sep 17 00:00:00 2001 From: 张晓波 <bingbo1993@126.com> Date: 星期三, 18 十月 2023 16:12:54 +0800 Subject: [PATCH] 苏州配置文件简化 --- hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java index f975e44..57595ad 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/utils/MqUtils.java @@ -1,13 +1,17 @@ package com.thhy.staff.utils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.thhy.general.utils.UUIDUtils; import com.thhy.staff.config.EmqxConfig; +import com.thhy.staff.modules.biz.face.entity.MqContent; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; +import java.util.ArrayList; import java.util.List; public class MqUtils { @@ -51,4 +55,37 @@ throw new RuntimeException(e); } } + + public static void main(String[] args) { + EmqxConfig emqxConfig = new EmqxConfig(); + emqxConfig.setHost("111.30.93.215"); + emqxConfig.setPort("1883"); + emqxConfig.setQos(1); + emqxConfig.setUsername("thhy"); + emqxConfig.setPassword("Thhy@123"); + + List<String> list = new ArrayList<>(); + list.add("0A:0C:E1:25:75:2C"); + + String prefix = "http://111.30.93.212:15002/staff/face/"; + String notify = "/sp/notify"; + + MqContent mqContent = new MqContent("sync_person", prefix+notify); + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("path",prefix+"syncPersonSingle"); + JSONObject pathParamJson = new JSONObject(); + pathParamJson.put("dev_sno",""); + pathParamJson.put("limit",10); + pathParamJson.put("offset",0); + pathParamJson.put("total",1); + List<String> userIds = new ArrayList<>(); + userIds.add("02e6d1c4ded41512d0ca3622"); + pathParamJson.put("person_list",userIds); + pathParamJson.put("person_type","4"); + jsonObject.put("path_params",pathParamJson); + mqContent.setData(jsonObject); + + System.out.println(JSON.toJSONString(mqContent)); + } } -- Gitblit v1.9.3