package org.jeecg.module.custom.ocr.base.jsonDomain;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.jeecg.module.custom.ocr.utils.DateUtils;

import java.io.IOException;

/**
 * @author zhangyong
 * @title: DateSerializer
 * @projectName jyjz-parent
 * @description: long类型的时间转yyyy-MM-dd HH:mm:ss格式字符串
 * @date 2021/11/29 10:24 PM
 */
public class DateSerializer extends JsonSerializer<Long> {

    @Override
    public void serialize(Long longTime, JsonGenerator gen,
        SerializerProvider serializerProvider) throws IOException {

        gen.writeString(DateUtils.getDateTime(longTime) );
    }
}
