package com.zcxk.rmcp.api.vo;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

/**
 * @author Andy
 * @version V1.0
 * @description: TODO
 * @date 2021/7/23
 **/
public class ExcelConverter implements Converter<MeterReadRecordVo.MeterReadInfo> {
    @Override
    public Class supportJavaTypeKey() {
        return MeterReadRecordVo.MeterReadInfo.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public MeterReadRecordVo.MeterReadInfo convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty,
                                                             GlobalConfiguration globalConfiguration) throws Exception {
        return new MeterReadRecordVo.MeterReadInfo();
    }

    @Override
    public CellData convertToExcelData(MeterReadRecordVo.MeterReadInfo meterReadInfo, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return new CellData<>(meterReadInfo.getReadData());
    }
}
