package com.tax.file.utils.invoice;

import java.math.BigDecimal;

import com.tax.file.model.FinInvoice;
import com.tax.file.model.FinInvoiceDetail;
import com.tax.file.utils.invoice.SpecialInvoiceCellRead.SingletonHolder;
import com.yxcheng.token.utils.StringUtil;
/** 
 * 发票单元格读取抽象类 封装一些公共的方法
 * 
 * */ 
public abstract class AbstractInvoiceCellRead implements InvoiceCellRead{
	
	/** 
     * 根据单元格的值获取发票状态值
     * @param cellValue 
     */  
    public static String getInvStatus(String cellValue){
    	String invStatus = null;
    	if(StringUtil.isEmpty(cellValue)){
    		return invStatus;
    	}
    	
    	if("正常".equals(cellValue.trim())){
    		invStatus = "0";
    	}else if("失控".equals(cellValue.trim())){
    		invStatus = "1";
    	}else if("作废".equals(cellValue.trim())){
    		invStatus = "2";
    	}else if("红冲".equals(cellValue.trim())){
    		invStatus = "3";
    	}else if("异常".equals(cellValue.trim())){
    		invStatus = "4";
    	}else{
    		invStatus = "10";//未知
    	}
    	
    	return invStatus;
    }
    /** 
     * 根据单元格的值获取浮点值
     * @param cellValue 
     */ 
    public static Double getDoubleValue(String cellValue){
    	Double dou = null;
    	if(StringUtil.isNotEmpty(cellValue)){
			dou = Double.parseDouble(cellValue);
		}
    	
    	return dou;
    }
    
    /** 
     * 根据单元格的值获取浮点值
     * @param cellValue 
     */ 
    public static BigDecimal getBigDecimalValue(String cellValue){
    	Double dou = null;
    	if(StringUtil.isNotEmpty(cellValue)){
			dou = Double.parseDouble(cellValue);
		}else{
			return null;
		}
    	
    	return new BigDecimal(dou);
    }
    
	@Override
	public void readCellDetail(FinInvoiceDetail invoiceDetail, int cellNum, String cellValue, boolean flag)
			throws Exception {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void readCellInvoice(FinInvoice invoice, int cellNum, String cellValue) throws Exception {
		// TODO Auto-generated method stub
		
	}
	
}
