|
|
@@ -1,5 +1,6 @@
|
|
|
package cn.seecoder.judgement.utils;
|
|
|
|
|
|
+import com.fasterxml.jackson.core.JsonParseException;
|
|
|
import com.fasterxml.jackson.core.JsonParser;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
|
|
@@ -13,7 +14,12 @@ import java.time.ZoneOffset;
|
|
|
public class LocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
|
|
|
@Override
|
|
|
public LocalDateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
|
|
|
- Long timestamp = jsonParser.getLongValue();
|
|
|
+ Long timestamp;
|
|
|
+ try {
|
|
|
+ timestamp = jsonParser.getLongValue();
|
|
|
+ } catch (JsonParseException e) {
|
|
|
+ timestamp = Long.valueOf(jsonParser.getText());
|
|
|
+ }
|
|
|
return LocalDateTime.ofEpochSecond(timestamp / 1000, 0, ZoneOffset.ofHours(8));
|
|
|
}
|
|
|
}
|