refactor(DeviceSnapshotService): 优化数值类型处理逻辑

- 将通用Number类型转换为具体数值类型(Integer、Long、Float、Double)
- 添加具体的数值类型判断和转换逻辑
- 保持Boolean和String类型的原有处理方式
- 在WebSocketUtil中添加lombok.var导入
This commit is contained in:
2026-01-07 13:49:52 +08:00
parent 5db2617028
commit c5a31075b8
2 changed files with 9 additions and 2 deletions

View File

@@ -764,8 +764,14 @@ public class DeviceSnapshotService {
// 处理不同类型的值
if (value != null) {
if (value instanceof Number) {
dataNode.put(field, (Number) value);
if (value instanceof Integer) {
dataNode.put(field, (Integer) value);
} else if (value instanceof Long) {
dataNode.put(field, (Long) value);
} else if (value instanceof Float) {
dataNode.put(field, (Float) value);
} else if (value instanceof Double) {
dataNode.put(field, (Double) value);
} else if (value instanceof Boolean) {
dataNode.put(field, (Boolean) value);
} else if (value instanceof String) {

View File

@@ -20,6 +20,7 @@ import com.fizz.business.form.WebOperateMatForm;
import com.fizz.business.service.client.TrackWsHandler;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;