|
@@ -1,61 +0,0 @@
|
|
|
-package com.xy.alipay;
|
|
|
-
|
|
|
-import cn.hutool.json.JSONObject;
|
|
|
-import com.xy.consumer.connected.ConnectedMqttConfiguration;
|
|
|
-import com.xy.consumer.connected.ConnectedProducer;
|
|
|
-import com.xy.consumer.disconnect.DisconnectedMqttConfiguration;
|
|
|
-import com.xy.consumer.disconnect.DisconnectedProducer;
|
|
|
-import com.xy.utils.SpringBeanUtils;
|
|
|
-
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * todo 支付宝设备工具类
|
|
|
- */
|
|
|
-public class AliPayUtils {
|
|
|
-
|
|
|
- /**
|
|
|
- * 设备上线
|
|
|
- *
|
|
|
- * @param deviceId
|
|
|
- */
|
|
|
- public static void connectedNotify(Long deviceId) {
|
|
|
- connectedNotify(Arrays.asList(deviceId));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 设备上线
|
|
|
- *
|
|
|
- * @param deviceIds
|
|
|
- */
|
|
|
- public static void connectedNotify(List<Long> deviceIds) {
|
|
|
- ConnectedProducer connectedProducer = SpringBeanUtils.getBean(ConnectedProducer.class);
|
|
|
- deviceIds.forEach(deviceId -> {
|
|
|
- JSONObject jsonObject = new JSONObject().set("clientid", deviceId);
|
|
|
- connectedProducer.sendToMqtt(jsonObject.toString(), ConnectedMqttConfiguration.TOPIC, 1);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 设备下线
|
|
|
- *
|
|
|
- * @param deviceId
|
|
|
- */
|
|
|
- public static void disConnectedNotify(Long deviceId) {
|
|
|
- disConnectedNotify(Arrays.asList(deviceId));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 设备下线
|
|
|
- *
|
|
|
- * @param deviceIds
|
|
|
- */
|
|
|
- public static void disConnectedNotify(List<Long> deviceIds) {
|
|
|
- DisconnectedProducer disconnectedProducer = SpringBeanUtils.getBean(DisconnectedProducer.class);
|
|
|
- deviceIds.forEach(deviceId -> {
|
|
|
- JSONObject jsonObject = new JSONObject().set("clientid", deviceId);
|
|
|
- disconnectedProducer.sendToMqtt(jsonObject.toString(), DisconnectedMqttConfiguration.TOPIC, 1);
|
|
|
- });
|
|
|
- }
|
|
|
-}
|