代码调整

This commit is contained in:
tiger_zhou 2023-10-31 11:22:03 +08:00
parent 2cf13503e7
commit d965607ab7

View File

@ -10,6 +10,7 @@ import com.alibaba.fastjson2.writer.ObjectWriter;
import java.lang.reflect.Type;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
@ -47,6 +48,9 @@ public class JsonConfig implements ApplicationRunner {
public LocalDateTime readObject(JSONReader jsonReader, Type fieldType, Object fieldName,
long features) {
String str = jsonReader.readString();
if (StringUtils.isEmpty(str)) {
return null;
}
return LocalDateTime.parse(str, DATE_TIME_FORMATTER);
}
});