|
@@ -141,6 +141,18 @@ public class MqttSend {
|
|
|
// 根据值设置 isCeiling
|
|
|
int isCeiling = "Ceiling".equalsIgnoreCase(mountPlainValue) ? 1 : 0;
|
|
|
|
|
|
+ // 构建坐摔配置消息体
|
|
|
+ Map<String, Object> target_on_ground_setting = new HashMap<>();
|
|
|
+ target_on_ground_setting.put("fallSettingEnabled",getFieldValue(params,"fallSettingEnabled"));
|
|
|
+ target_on_ground_setting.put("lowHighSnrRatio",getFieldValue(params,"lowHighSnrRatio"));
|
|
|
+ target_on_ground_setting.put("lowMidSnrRatio",getFieldValue(params,"lowMidSnrRatio"));
|
|
|
+ target_on_ground_setting.put("lowSnrThr",getFieldValue(params,"lowSnrThr"));
|
|
|
+ target_on_ground_setting.put("lowZMax",getFieldValue(params,"lowZMax"));
|
|
|
+ target_on_ground_setting.put("humanPredThreshold",getFieldValue(params,"humanPredThreshold"));
|
|
|
+ target_on_ground_setting.put("minEventsForDetection",getFieldValue(params,"minEventsForDetection"));
|
|
|
+ target_on_ground_setting.put("minHumanEventsForDetection",getFieldValue(params,"minHumanEventsForDetection"));
|
|
|
+
|
|
|
+
|
|
|
|
|
|
//发送最终消息
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
@@ -148,6 +160,8 @@ public class MqttSend {
|
|
|
jsonObject.put("sensor_location", z_cm);
|
|
|
jsonObject.put("fallingStateMachineDurations", fallingStateMachineDurations);
|
|
|
jsonObject.put("isCeiling", isCeiling);
|
|
|
+ jsonObject.put("target_on_ground_setting",target_on_ground_setting);
|
|
|
+
|
|
|
|
|
|
try {
|
|
|
mqttClient.sendMessage(topic, jsonObject.toJSONString());
|
|
@@ -189,11 +203,23 @@ public class MqttSend {
|
|
|
// 根据值设置 isCeiling
|
|
|
int isCeiling = "Ceiling".equalsIgnoreCase(mountPlainValue) ? 1 : 0;
|
|
|
|
|
|
+ // 构建坐摔配置消息体
|
|
|
+ Map<String, Object> target_on_ground_setting = new HashMap<>();
|
|
|
+ target_on_ground_setting.put("fallSettingEnabled",getFieldValue(params,"fallSettingEnabled"));
|
|
|
+ target_on_ground_setting.put("lowHighSnrRatio",getFieldValue(params,"lowHighSnrRatio"));
|
|
|
+ target_on_ground_setting.put("lowMidSnrRatio",getFieldValue(params,"lowMidSnrRatio"));
|
|
|
+ target_on_ground_setting.put("lowSnrThr",getFieldValue(params,"lowSnrThr"));
|
|
|
+ target_on_ground_setting.put("lowZMax",getFieldValue(params,"lowZMax"));
|
|
|
+ target_on_ground_setting.put("humanPredThreshold",getFieldValue(params,"humanPredThreshold"));
|
|
|
+ target_on_ground_setting.put("minEventsForDetection",getFieldValue(params,"minEventsForDetection"));
|
|
|
+ target_on_ground_setting.put("minHumanEventsForDetection",getFieldValue(params,"minHumanEventsForDetection"));
|
|
|
+
|
|
|
//发送最终消息
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("ext_region", baseParent);
|
|
|
jsonObject.put("sensor_location", z_cm);
|
|
|
jsonObject.put("isCeiling", isCeiling);
|
|
|
+ jsonObject.put("target_on_ground_setting",target_on_ground_setting);
|
|
|
|
|
|
try {
|
|
|
mqttClient.sendMessage(topic, jsonObject.toJSONString());
|
|
@@ -214,7 +240,27 @@ public class MqttSend {
|
|
|
try {
|
|
|
Field field = obj.getClass().getDeclaredField(fieldName);
|
|
|
field.setAccessible(true);
|
|
|
- return (BigDecimal) field.get(obj);
|
|
|
+ Object value = field.get(obj);
|
|
|
+
|
|
|
+ if (value == null) {
|
|
|
+ return BigDecimal.ZERO;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (value instanceof BigDecimal) {
|
|
|
+ return (BigDecimal) value;
|
|
|
+ } else if (value instanceof Integer) {
|
|
|
+ return BigDecimal.valueOf((Integer) value);
|
|
|
+ } else if (value instanceof Long) {
|
|
|
+ return BigDecimal.valueOf((Long) value);
|
|
|
+ } else if (value instanceof Double) {
|
|
|
+ return BigDecimal.valueOf((Double) value);
|
|
|
+ } else if (value instanceof Float) {
|
|
|
+ return BigDecimal.valueOf((Float) value);
|
|
|
+ } else if (value instanceof String) {
|
|
|
+ return new BigDecimal((String) value);
|
|
|
+ } else {
|
|
|
+ return BigDecimal.ZERO;
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
log.error("获取字段值失败: {}", fieldName, e);
|
|
|
return BigDecimal.ZERO;
|