hby100japp功能2

This commit is contained in:
2026-02-04 15:49:53 +08:00
parent 2db37a75d2
commit 0f0dd4c6b1
9 changed files with 51 additions and 86 deletions

View File

@ -29,13 +29,13 @@ public class FuncType10StrobeMode implements NewMqttMessageRule {
log.info("HBY100J爆闪模式开启/关闭,消息负载:{}", context.getPayloadDict()); log.info("HBY100J爆闪模式开启/关闭,消息负载:{}", context.getPayloadDict());
try { try {
String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + // String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX +
context.getDeviceImei() + ":strobeMode"; // context.getDeviceImei() + ":strobeMode";
//
Map<String, Object> payloadDict = context.getPayloadDict(); // Map<String, Object> payloadDict = context.getPayloadDict();
if (payloadDict != null) { // if (payloadDict != null) {
RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict)); // RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict));
} // }
} catch (Exception e) { } catch (Exception e) {
log.error("HBY100J爆闪模式开启/关闭失败", e); log.error("HBY100J爆闪模式开启/关闭失败", e);
} }

View File

@ -29,13 +29,13 @@ public class FuncType11Frequency implements NewMqttMessageRule {
log.info("HBY100J修改警示灯爆闪频率消息负载{}", context.getPayloadDict()); log.info("HBY100J修改警示灯爆闪频率消息负载{}", context.getPayloadDict());
try { try {
String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + // String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX +
context.getDeviceImei() + ":frequency"; // context.getDeviceImei() + ":frequency";
//
Map<String, Object> payloadDict = context.getPayloadDict(); // Map<String, Object> payloadDict = context.getPayloadDict();
if (payloadDict != null) { // if (payloadDict != null) {
RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict)); // RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict));
} // }
} catch (Exception e) { } catch (Exception e) {
log.error("HBY100J修改警示灯爆闪频率失败", e); log.error("HBY100J修改警示灯爆闪频率失败", e);
} }

View File

@ -30,14 +30,14 @@ public class FuncType12ForceAudio implements NewMqttMessageRule {
try { try {
// 构建强制声光报警开关的Redis键 // 构建强制声光报警开关的Redis键
String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + // String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX +
context.getDeviceImei() + ":forceAudio"; // context.getDeviceImei() + ":forceAudio";
//
Map<String, Object> payloadDict = context.getPayloadDict(); // Map<String, Object> payloadDict = context.getPayloadDict();
if (payloadDict != null) { // if (payloadDict != null) {
// 存储强制声光报警开关状态到Redis // // 存储强制声光报警开关状态到Redis
RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict)); // RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict));
} // }
} catch (Exception e) { } catch (Exception e) {
log.error("HBY100J强制声光报警开启/关闭失败", e); log.error("HBY100J强制声光报警开启/关闭失败", e);
} }

View File

@ -29,13 +29,13 @@ public class FuncType13Brightness implements NewMqttMessageRule {
log.info("HBY100J警示灯LED亮度调节消息负载{}", context.getPayloadDict()); log.info("HBY100J警示灯LED亮度调节消息负载{}", context.getPayloadDict());
try { try {
String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + // String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX +
context.getDeviceImei() + ":brightness"; // context.getDeviceImei() + ":brightness";
//
Map<String, Object> payloadDict = context.getPayloadDict(); // Map<String, Object> payloadDict = context.getPayloadDict();
if (payloadDict != null) { // if (payloadDict != null) {
RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict)); // RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict));
} // }
} catch (Exception e) { } catch (Exception e) {
log.error("HBY100J警示灯LED亮度调节失败", e); log.error("HBY100J警示灯LED亮度调节失败", e);
} }

View File

@ -29,13 +29,13 @@ public class FuncType5UpdateVoice implements NewMqttMessageRule {
log.info("HBY100J更新语音消息负载{}", context.getPayloadDict()); log.info("HBY100J更新语音消息负载{}", context.getPayloadDict());
try { try {
String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + // String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX +
context.getDeviceImei() + ":updateVoice"; // context.getDeviceImei() + ":updateVoice";
//
Map<String, Object> payloadDict = context.getPayloadDict(); // Map<String, Object> payloadDict = context.getPayloadDict();
if (payloadDict != null) { // if (payloadDict != null) {
RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict)); // RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict));
} // }
} catch (Exception e) { } catch (Exception e) {
log.error("HBY100J更新语音失败", e); log.error("HBY100J更新语音失败", e);
} }

View File

@ -29,13 +29,13 @@ public class FuncType6VoicePlay implements NewMqttMessageRule {
log.info("HBY100J语音播报开启/关闭,消息负载:{}", context.getPayloadDict()); log.info("HBY100J语音播报开启/关闭,消息负载:{}", context.getPayloadDict());
try { try {
String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + // String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX +
context.getDeviceImei() + ":VoicePlay"; // context.getDeviceImei() + ":VoicePlay";
//
Map<String, Object> payloadDict = context.getPayloadDict(); // Map<String, Object> payloadDict = context.getPayloadDict();
if (payloadDict != null) { // if (payloadDict != null) {
RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict)); // RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict));
} // }
} catch (Exception e) { } catch (Exception e) {
log.error("HBY100J语音播报开启/关闭失败", e); log.error("HBY100J语音播报开启/关闭失败", e);
} }

View File

@ -29,13 +29,13 @@ public class FuncType9UpdateVolume implements NewMqttMessageRule {
log.info("HBY100J修改音量消息负载{}", context.getPayloadDict()); log.info("HBY100J修改音量消息负载{}", context.getPayloadDict());
try { try {
String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + // String redisKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX +
context.getDeviceImei() + ":updateVolume"; // context.getDeviceImei() + ":updateVolume";
//
Map<String, Object> payloadDict = context.getPayloadDict(); // Map<String, Object> payloadDict = context.getPayloadDict();
if (payloadDict != null) { // if (payloadDict != null) {
RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict)); // RedisUtils.setCacheObject(redisKey, JSONObject.toJSONString(payloadDict));
} // }
} catch (Exception e) { } catch (Exception e) {
log.error("HBY100J修改音量失败", e); log.error("HBY100J修改音量失败", e);
} }

View File

@ -1,35 +0,0 @@
package com.fuyuanshen.global.mqtt.rule.hby100j.domin;
import com.alibaba.fastjson2.JSONObject;
public class Test {
public static void main(String[] args) {
String a = "{\n" +
"\"imei\":\"868108070185303\",\n" +
"\"funcType\":\"14\",\n" +
"\"status\":\"200\",\n" +
"\"timestamp\":1770169375000,\n" +
"\"data\":{\n" +
"\"voice_broadcast\":0,\n" +
"\"siren_alarm\":{\n" +
"\"enable\":0,\n" +
"\"mode\":0\n" +
"},\n" +
"\"led_strobe\":{\n" +
"\"enable\":1,\n" +
"\"mode\":0,\n" +
"\"frequency\":0\n" +
"},\n" +
"\"volume\":0,\n" +
"\"brightness\":{\n" +
"\"red\":0,\n" +
"\"green\":0,\n" +
"\"blue\":0\n" +
"}\n" +
"}\n" +
"}";
FuncType14StatusReport deviceStatusReport = JSONObject.parseObject(a, FuncType14StatusReport.class);
System.out.println(deviceStatusReport);
System.out.println("hello world");
}
}

View File

@ -195,7 +195,7 @@ public class DeviceHBY100JBizService {
FuncType6VoicePlayRequest request = new FuncType6VoicePlayRequest(); FuncType6VoicePlayRequest request = new FuncType6VoicePlayRequest();
request.setRequestId(GenerateIdUtil.generateNumericId()); request.setRequestId(GenerateIdUtil.generateNumericId());
request.setImei(deviceObj.getDeviceImei()); request.setImei(deviceObj.getDeviceImei());
request.setFuncType("12"); request.setFuncType("6");
request.setTimestamp(System.currentTimeMillis()); request.setTimestamp(System.currentTimeMillis());
FuncType6VoicePlayRequest.Data data = new FuncType6VoicePlayRequest.Data(); FuncType6VoicePlayRequest.Data data = new FuncType6VoicePlayRequest.Data();
data.setVoiceBroadcast(bo.getVoiceStrobeAlarm()); data.setVoiceBroadcast(bo.getVoiceStrobeAlarm());