SignInConvert.java 1.3 KB
package com.ruoyi.pojo.converter;

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;

import static com.ruoyi.common.ConstSignInConstSignInProperties.*;

/**
 * 签到类型
 * @author 20412
 */
@SuppressWarnings(value = {"unchecked", "rawtypes"})
public class SignInConvert implements Converter<Integer> {
    @Override
    public Class supportJavaTypeKey() {
        return Integer.class;
    }

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

    @Override
    public Integer convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return null;
    }

    @Override
    public CellData convertToExcelData(Integer integer, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        String str = "";
        if (SIGN_IN.equals(integer)){
            str = SIGN_IN_STRING;
        }
        if (SIGN_OUT.equals(integer)){
            str = SIGN_IN_OUT_STRING;
        }
        return new CellData(str);
    }
}