4g挂牌对接,可以接收到 心跳日志, 上传的音频文件 ,保存到数据库和本地文件

This commit is contained in:
ZLI263
2025-11-30 21:16:47 +08:00
parent 9344846772
commit 153c8bfaf1
33 changed files with 3418 additions and 36 deletions

View File

@@ -0,0 +1,34 @@
package com.rj.common;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import java.io.IOException;
/**
* 自定义 Integer 反序列化器
* 支持从字符串和整数两种格式反序列化为 Integer
* 如果无法解析,返回 null
*/
public class IntegerDeserializer extends JsonDeserializer<Integer> {
@Override
public Integer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
String value = p.getValueAsString();
if (value == null || value.trim().isEmpty()) {
return null;
}
try {
// 尝试直接解析为整数
return Integer.parseInt(value);
} catch (NumberFormatException e) {
// 如果无法解析为整数,返回 null
// 这样可以避免反序列化错误,字段会被设置为 null
return null;
}
}
}