1.监督计划功能调整
2.全过程功能调整
This commit is contained in:
@@ -1,30 +1,26 @@
|
||||
package com.njcn.process.utils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
||||
import com.alibaba.fastjson.serializer.JSONSerializer;
|
||||
import com.alibaba.fastjson.serializer.ObjectSerializer;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@Component
|
||||
public class TimestampAsLongSerializer extends StdSerializer<Timestamp> {
|
||||
|
||||
protected TimestampAsLongSerializer(Class<Timestamp> t) {
|
||||
super(t);
|
||||
}
|
||||
public TimestampAsLongSerializer() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public class TimestampAsLongSerializer implements ObjectSerializer {
|
||||
|
||||
@Override
|
||||
public void serialize(Timestamp value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||
if (value != null) {
|
||||
gen.writeNumber(value.getTime());
|
||||
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
|
||||
if (object instanceof Timestamp) {
|
||||
Timestamp timestamp = (Timestamp) object;
|
||||
// 将Timestamp转换为时间戳(毫秒数)
|
||||
long time = timestamp.getTime();
|
||||
serializer.write(time);
|
||||
} else {
|
||||
gen.writeNull();
|
||||
serializer.write(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user