package com.bonus.canteen.core.customer.v4.mobile.constant;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.bonus.canteen.core.account.v4.constant.CardStatusEnum;

public class CardStatusNumberConverter implements Converter<String> {
   public Class supportJavaTypeKey() {
      return Number.class;
   }

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

   public String convertToJavaData(ReadCellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
      return cellData.getNumberValue().toString();
   }

   public WriteCellData convertToExcelData(String s, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
      String cardStatusStr = "";

      try {
         if (ObjectUtil.isNotNull(s)) {
            String[] split = s.split(",");
            String[] var6 = split;
            int var7 = split.length;

            for(int var8 = 0; var8 < var7; ++var8) {
               String string = var6[var8];
               String desc = CardStatusEnum.getDesc(Integer.valueOf(string.trim()));
               cardStatusStr = cardStatusStr + desc + ",";
            }

            cardStatusStr = cardStatusStr.substring(0, cardStatusStr.lastIndexOf(","));
         }
      } catch (Exception var11) {
      }

      return new WriteCellData(cardStatusStr);
   }
}
