1、自定义序列化类
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializerBase;
@JacksonStdImpl
public class ToDateStringSerializer extends ToStringSerializerBase {
public ToDateStringSerializer() {
super(Object.class);
}
public final String valueToString(Object value) {
return DateUtils.long2String((Long) value);
}
}
2、接口的返回类加对应的注解
@ApiModelProperty(value = "任务上传日期")
@JsonSerialize(using = ToDateStringSerializer.class)
private Long taskTime;
3、查看成果