|
@@ -94,6 +94,7 @@ public class MpsMessageHandler {
|
|
|
handleDeviceReboot(topic, payload);
|
|
|
} else {
|
|
|
switch (topic) {
|
|
|
+ // todo 待确定是否废弃
|
|
|
case MqttTopics.MPS_GET_DEV_INFO:
|
|
|
handleGetDeviceInfo(topic, payload);
|
|
|
break;
|
|
@@ -103,6 +104,7 @@ public class MpsMessageHandler {
|
|
|
case MqttTopics.MPS_SET_DEV_PARAM:
|
|
|
handleSetDeviceParam(topic, payload);
|
|
|
break;
|
|
|
+ // todo 待确定 添加删除 逻辑
|
|
|
case MqttTopics.MPS_ADD_DEVICE:
|
|
|
handleAddDevice(topic, payload);
|
|
|
break;
|
|
@@ -289,12 +291,12 @@ public class MpsMessageHandler {
|
|
|
log.info("Processing set device param request: {}, payload: {}", devId, payload);
|
|
|
|
|
|
// 获取操作者信息用于审计
|
|
|
- String operatorId = (String) messageData.get("operator_id");
|
|
|
- String operatorType = (String) messageData.get("operator_type");
|
|
|
- String operationReason = (String) messageData.get("reason");
|
|
|
-
|
|
|
- log.info("Device parameters being set by: {} ({}), target device: {}, reason: {}",
|
|
|
- operatorId, operatorType, devId, operationReason);
|
|
|
+// String operatorId = (String) messageData.get("operator_id");
|
|
|
+// String operatorType = (String) messageData.get("operator_type");
|
|
|
+// String operationReason = (String) messageData.get("reason");
|
|
|
+//
|
|
|
+// log.info("Device parameters being set by: {} ({}), target device: {}, reason: {}",
|
|
|
+// operatorId, operatorType, devId, operationReason);
|
|
|
|
|
|
// 参数合理性验证
|
|
|
Float heightValue = height.floatValue();
|
|
@@ -341,7 +343,7 @@ public class MpsMessageHandler {
|
|
|
// 应用层将处理:设备通信、配置下发、确认等待、数据库更新、审计记录
|
|
|
deviceCommandService.handleSetDeviceParam(devId, mountingPlain, areaStr, heightValue);
|
|
|
|
|
|
- log.info("Device parameter setting request submitted by operator {}: {}", operatorId, devId);
|
|
|
+// log.info("Device parameter setting request submitted by operator {}: {}", operatorId, devId);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
log.error("Error handling set device param request: {}", e.getMessage(), e);
|
|
@@ -391,23 +393,23 @@ public class MpsMessageHandler {
|
|
|
String devId = matcher.group(1);
|
|
|
log.warn("CRITICAL: Processing device reboot request for: {}", devId);
|
|
|
|
|
|
- // 解析重启请求信息
|
|
|
- Map<String, Object> messageData = JsonUtil.parseMap(payload);
|
|
|
- String operatorId = (String) messageData.get("operator_id");
|
|
|
- String operatorType = (String) messageData.get("operator_type");
|
|
|
- String rebootReason = (String) messageData.get("reason");
|
|
|
- String emergencyLevel = (String) messageData.get("emergency_level");
|
|
|
-
|
|
|
- // 记录重要的重启操作
|
|
|
- log.warn("DEVICE REBOOT INITIATED - Device: {}, Operator: {} ({}), Reason: {}, Emergency Level: {}",
|
|
|
- devId, operatorId, operatorType, rebootReason, emergencyLevel);
|
|
|
-
|
|
|
- // 验证重启权限(高风险操作)
|
|
|
- if (!"admin".equals(operatorType) && !"technician".equals(operatorType)) {
|
|
|
- log.error("UNAUTHORIZED REBOOT ATTEMPT - Device: {}, Operator: {} ({})",
|
|
|
- devId, operatorId, operatorType);
|
|
|
- return;
|
|
|
- }
|
|
|
+// // 解析重启请求信息
|
|
|
+// Map<String, Object> messageData = JsonUtil.parseMap(payload);
|
|
|
+// String operatorId = (String) messageData.get("operator_id");
|
|
|
+// String operatorType = (String) messageData.get("operator_type");
|
|
|
+// String rebootReason = (String) messageData.get("reason");
|
|
|
+// String emergencyLevel = (String) messageData.get("emergency_level");
|
|
|
+//
|
|
|
+// // 记录重要的重启操作
|
|
|
+// log.warn("DEVICE REBOOT INITIATED - Device: {}, Operator: {} ({}), Reason: {}, Emergency Level: {}",
|
|
|
+// devId, operatorId, operatorType, rebootReason, emergencyLevel);
|
|
|
+//
|
|
|
+// // 验证重启权限(高风险操作)
|
|
|
+// if (!"admin".equals(operatorType) && !"technician".equals(operatorType)) {
|
|
|
+// log.error("UNAUTHORIZED REBOOT ATTEMPT - Device: {}, Operator: {} ({})",
|
|
|
+// devId, operatorId, operatorType);
|
|
|
+// return;
|
|
|
+// }
|
|
|
|
|
|
// 记录重启前的设备状态用于审计
|
|
|
log.info("Recording device state before reboot: {}", devId);
|