package com.ozs.rpm.service;

import java.util.List;

import org.springframework.web.multipart.MultipartFile;

import com.ozs.rpm.dto.ReportDTO;
import com.ozs.rpm.dto.ReportKPIDTO;
import com.ozs.rpm.dto.ReportKpiRelUserDTO;
import com.ozs.rpm.dto.ReportRelUserDTO;
import com.ozs.rpm.dto.RpmDimTypeAll;
import com.ozs.rpm.dto.UserDTO;
import com.ozs.rpm.dto.chart.ChartTypeDTO;
import com.ozs.rpm.dto.chart.RichTextFileR;
import com.ozs.rpm.dto.data.ReportDataDTO;
import com.ozs.rpm.dto.mdm.MdmInfoColumn;
import com.ozs.rpm.dto.mdm.MdmInfoDatabase;
import com.ozs.rpm.dto.mdm.MdmInfoTable;
import com.ozs.rpm.dto.save.SaveFiveDTO;
import com.ozs.rpm.dto.save.SaveFourDTO;
import com.ozs.rpm.dto.save.SaveOneDTO;
import com.ozs.rpm.dto.save.SaveReportDTO;
import com.ozs.rpm.dto.save.SaveThreeDTO;
import com.ozs.rpm.dto.save.SaveTwoDTO;
import com.ozs.rpm.dto.view.ReportViewDataParam;
import com.ozs.rpm.util.R;

public interface ReportService {

	public R<List<ReportDTO>> listReport(String reportName, Integer reportLevel, Integer ifFinish, Integer page,
			Integer pageSize, String sort, String order) throws Exception;

	public R<String> updateStatus(String id, ReportDTO status) throws Exception;

	public R<String> removeReport(String id) throws Exception;

	public R<List<RpmDimTypeAll>> listReportType(Integer typeId) throws Exception;

	// 建表1~5步
	public R<SaveReportDTO> saveOne(SaveOneDTO saveDto);

	public R<SaveReportDTO> saveTwo(SaveTwoDTO saveDto);

	public R<SaveReportDTO> saveThree(SaveThreeDTO saveDto);

	public R<SaveReportDTO> saveFour(SaveFourDTO saveDto);

	public R<SaveReportDTO> saveFive(SaveFiveDTO saveDto);

	public R<List<ReportDTO>> listSonReport();

	public R<String> saveSix(SaveReportDTO saveDto);

	public R<List<ReportDTO>> listParentReport(String menuCode);

	public R<List<UserDTO>> listUser();

	public R<List<ReportKpiRelUserDTO>> listRelUser(String reportId);

	public R<SaveReportDTO> getReportInfoById(String id);

	/**
	 * 报表授权给多个用户接口
	 * 
	 * @param id
	 * @param userId
	 * @return
	 */
	public R<String> reportRelUsers(ReportRelUserDTO reportRelUserDto);

	public R<String> reportsRelUsers(ReportRelUserDTO reportRelUserDto);

	/**
	 * 获取报表数据
	 * 
	 * @param reportViewDataParam
	 * @return
	 */
	public R<ReportDataDTO> getReportData(ReportViewDataParam reportViewDataParam, String userId) throws Exception;

	public R<List<ReportDTO>> listReportByMenu(String menuCode);

	/**
	 * 查询报表中KPI列表
	 * 
	 * @param reportId
	 * @return
	 */
	public R<List<ReportKPIDTO>> listKpiByReportId(String reportId);

	/**
	 * 获取报表已授权的kpi列表
	 * 
	 * @param reportId
	 * @param userId
	 * @return
	 */
	public R<List<ReportKPIDTO>> listKpiByReportAndUser(String reportId, String userId);

	public String downloadReportFile(ReportViewDataParam reportViewDataParam, String userId) throws Exception;

	// ----------------------------添加图表设置---------------------------------------
	/**
	 * 获取MDM数据库列表-非原始库
	 * 
	 * @param resourceName
	 * @return
	 */
	public R<List<MdmInfoDatabase>> listDatabase(String resourceName) throws Exception;

	/**
	 * 获取根据数据库ID获取数据表信息
	 * 
	 * @param databaseId
	 * @return
	 */
	public R<List<MdmInfoTable>> listTableByDatabaseId(String databaseId) throws Exception;

	/**
	 * 获取根据数据库ID获取字段信息
	 * 
	 * @param databaseId
	 * @return
	 */
	public R<List<MdmInfoColumn>> listColumnByTableId(String tableId) throws Exception;

	/**
	 * 获取图表类型
	 * 
	 * @return
	 */
	public R<List<ChartTypeDTO>> listChartType() throws Exception;

	/**
	 * 上传文件
	 * 
	 * @param file
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public R<String> loadChartFile(MultipartFile file, String userId) throws Exception;

	/**
	 * 富文本上传文件
	 * 
	 * @param file
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public RichTextFileR uploadRichTextFile(MultipartFile file, String userId) throws Exception;

	/**
	 * 根据表Id生成获取DML
	 * 
	 * @param tableId
	 * @return
	 */
	public R<String> getDML(String tableId, String columnIds) throws Exception;

}
