package cn.com.countrygarden.bi.main.service.investment;

import java.io.FileNotFoundException;
import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.springframework.web.multipart.MultipartFile;

import cn.com.countrygarden.bi.main.core.Result;
import cn.com.countrygarden.bi.main.dto.investment.InvestProjectExcelVO;
import cn.com.countrygarden.bi.main.dto.investment.InvestProjectInvestmentVo;
import cn.com.countrygarden.bi.main.dto.investment.InvestProjectProfitVo;
import cn.com.countrygarden.bi.main.dto.investment.InvestRegionExcelSummaryVo;
import cn.com.countrygarden.bi.main.dto.investment.InvestRegionExcelVo;
import cn.com.countrygarden.bi.main.dto.investment.InvestRegionInvestmentVO;
import cn.com.countrygarden.bi.main.model.AccessToken;
import cn.com.countrygarden.bi.main.model.twerp.hm.TbSysOrgan;

public interface InvestExcelService {
	Result importInvest(HttpServletResponse response, AccessToken accessToken, String regionId) throws Exception;

	/**
	 * 个人sheet页处理
	 * 
	 * @param sheet
	 * @param organCode：根据登录的账号查找相应的区域信息
	 * @param regionIds
	 *            根据查询条件查找相应的区域信息
	 * @throws FileNotFoundException
	 * @throws IOException
	 */
	void getInvestProjectSheel1(XSSFSheet sheet, String organCode, String[] regionIds)
			throws FileNotFoundException, IOException;

	/**
	 * 个人常规数据
	 * 
	 * @param sheet
	 * @param investExcelVO
	 * @param mergeRow
	 * @param rowCount
	 * @param count
	 */
	void getinvestExcelVOData(XSSFSheet sheet, InvestProjectExcelVO investExcelVO, int mergeRow, int rowCount,
			int count);

	/**
	 * 个人小计数据
	 * 
	 * @param sheet
	 * @param investExcelVO
	 * @param count
	 * @param investProjectProfitVo
	 */
	void getTotalData(XSSFSheet sheet, InvestProjectExcelVO investExcelVO, int count,
			InvestProjectProfitVo investProjectProfitVo);

	/**
	 * 区域sheet页处理
	 * 
	 * @param sheet
	 * @param regionIds
	 * @throws FileNotFoundException
	 * @throws IOException
	 */
	void getInvestRegionSheel2(XSSFSheet sheet, String organCode, String[] regionIds)
			throws FileNotFoundException, IOException;

	/**
	 * 区域excel的常规数据
	 * 
	 * @param sheet
	 *            :处理的sheel
	 * @param investExcelVO
	 * @param mergeRow
	 *            ：需要合并的总共行数：当>1时才需要合并
	 * @param rowCount
	 *            ：可能做合并的行数从第rowCount行开始写数据
	 * @param count
	 *            ：当前进行的行数
	 */
	void getInvestRegionExcelVOData(XSSFSheet sheet, InvestRegionExcelVo investRegionExcelVo, int mergeRow,
			int rowCount, int count);

	/**
	 * 区域、项目小计
	 * 
	 * @param sheet
	 * @param investRegionExcelVo
	 * @param totalCount
	 * @param investProjectInvestmentVo
	 */
	void getInvestRegionExcelVOTotalData(XSSFSheet sheet, InvestRegionExcelVo investRegionExcelVo, int totalCount,
			InvestProjectInvestmentVo investProjectInvestmentVo);

	/**
	 * 区域excel的合计
	 * 
	 * @param sheet
	 * @param count
	 */
	void getInvestRegionExcelSummaryVo(XSSFSheet sheet, int count,
			InvestRegionExcelSummaryVo investRegionExcelSummaryVo, boolean end);

	/**
	 * 数据导入
	 * 
	 * @param fileName
	 * @param multipartFile
	 * @param radio
	 * @param accessToken
	 * @return
	 */
	public Result exportExcel(String fileName, MultipartFile multipartFile, AccessToken accessToken);

	/**
	 * sheet0页的人个数据导入处理
	 * 
	 * @param sheet
	 * @param accessToken
	 */
	public void readSheet0(Sheet sheet, AccessToken accessToken);

	/**
	 * sheet1页的项目数据导入处理
	 * 
	 * @param sheet
	 * @param accessToken
	 */
	public void readSheet1(Sheet sheet, AccessToken accessToken);
}
