package cn.com.countrygarden.bi.main.dao.bigholderSatisfy;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.github.pagehelper.PageRowBounds;

import cn.com.countrygarden.bi.main.dto.BigholderImportedDto;
import cn.com.countrygarden.bi.main.dto.BigholderProjectDto;
import cn.com.countrygarden.bi.main.dto.bigholder.UnsatisfyDto;
import cn.com.countrygarden.bi.main.model.BigholderLandEstate;
import cn.com.countrygarden.bi.main.model.BigholderSatisfacationInfo;

public interface BigholderSatisfyMapper {

	/**
	 * 导入数据已存在，删除再插入
	 * @param answerFinishTime
	 */
	void deleteImport(@Param("answerFinishTime") String answerFinishTime);
	
	/**
	 * 插入数据
	 * @param list
	 */
	void addSatisfyList(List<BigholderSatisfacationInfo> list);

	/**
	 * 查询导入的项目总数据
	 * @param yearMonth
	 * @return
	 */
	List<BigholderImportedDto> findImportedList(@Param(value="yearMonth") String yearMonth,PageRowBounds pageRowBounds);
	
	/**
	 * 通过月份和地区来查找
	 * @param yearMon
	 * @param area
	 * @return
	 */
	public List<BigholderSatisfacationInfo> getSelectByMonAndArea(
			@Param(value="yearMonth")String yearMonth,
			@Param(value="area")String area
			);
	
	/**
	 * 修改对应的项目
	 * @param yearMonth
	 * @param area
	 * @param correspondProject
	 * @param id
	 */
	public void updateBigholderSatisfy(
			@Param(value="correspondProject")String correspondProject,
			@Param(value="id")String id
			);
	
	public void updateAuditStatus(BigholderSatisfacationInfo bigholderSatisfacationInfo);
	
	/**
	 * 查看满意度信息
	 * @param id
	 * @return
	 */
	public BigholderSatisfacationInfo getViewInfo(
			@Param(value="id")String id);
	
	/**
	 * 修改异常信息
	 * @param id
	 * @param exceptionInfoAuditStruts
	 * @param exceptionMessage
	 * @return
	 */
	 
	public BigholderSatisfacationInfo updateExceptionStatus(@Param(value="id")String id,
			@Param(value="exceptionInfoAuditStruts") String exceptionInfoAuditStruts,
			@Param(value="exceptionMessage") String exceptionMessage);
	
	/**
	 * 删除异常信息
	 * @param id
	 * @return
	 */
	public void deleteExceptionStatus(@Param(value="id")String id);
	
	/**
	 * 修改区域和对应的项目
	 * @param bigholderSatisfacationInfo
	 */
	public void updateAreaOrProjectName(BigholderSatisfacationInfo bigholderSatisfacationInfo);

	public void updateRejectedInfo(BigholderSatisfacationInfo bigholderSatisfacationInfo);
	
	/**
	 * 将添加了区域负责人的isExistOwner状态改为1
	 * @param area
	 */
	void updateIsExistOwner(@Param(value="area") String area,@Param(value="flag") String flag);
	
	/**
	 * 修正区域
	 * @param estateArea
	 * @param area
	 * @param isExistOwner 
	 */
	void updateArea(@Param(value="estateArea") String estateArea,@Param(value="area") String area,@Param(value="project") String project,@Param(value="isExistOwner") String isExistOwner);

	/**
	 * 再次导入和修正后的区域需要更新当月对应区域下的审核状态为待提交(审核表)
	 * @param updateAuditAreas
	 */
	void updateAuditAreas(@Param(value="updateAuditAreas") ArrayList<String> updateAuditAreas);

	/**
	 * 再次导入和修正后的区域需要更新当月对应区域下的审核状态为待提交(问卷表)
	 * @param updateAuditAreas
	 */
	void updateSatisfyAreas(@Param(value="updateAuditAreas") ArrayList<String> updateAuditAreas);
	
	/**
	 * 再次导入和修正后的区域需要更新当月对应区域下的审核状态为待提交(推送表)
	 */
	void updatePushDatas();
	
	/**
	 * 再次导入和修正后的区域需要更新当月对应区域下的审核状态为待提交(异常表)
	 * @param updateAuditAreas
	 */
	void updateExceptionDatas(@Param(value="updateAuditAreas") ArrayList<String> updateAuditAreas);

	void updateSatisfyProject(@Param(value="estateArea") String estateArea,@Param(value="project") String project);
	void updateExceptionProject(@Param(value="estateArea") String estateArea,@Param(value="project") String project);
	
	/**
	 * 插入 导入地产物业 数据
	 * @param multipartFile
	 * @param fileName
	 * @param userCode
	 * @return
	 */
	void addLandEstateList(List<BigholderLandEstate> list);

	/**
	 * 查询某个季度的数据，判断某个季度的数据是否已存在
	 * @param quarters
	 * @return
	 */
	List<String> findDataByQuarters(@Param(value="quarters") ArrayList<String> quarters);

	/**
	 * 获取项目满意度排名列表(带分页)
	 * @param areas 
	 * @param monthList 
	 */
	List<BigholderProjectDto> projectRankList(@Param("areas")List<String> areas,@Param(value="nowMonthList") List<String> nowMonthList,@Param(value="lastMonthList") List<String> lastMonthList,PageRowBounds pageRowBounds);

	/**
	 * 获取项目满意度排名列表(不带分页)
	 * @param areas 
	 * @param monthList 
	 */
	List<BigholderProjectDto> projectRankList(@Param("areas")List<String> areas,@Param(value="nowMonthList") List<String> nowMonthList,@Param(value="lastMonthList") List<String> lastMonthList);

	/**
	 * 全国或多个区域  满意度
	 * @param monthList
	 * @param areas
	 * @return
	 */
//	String countrySatisfy(@Param(value="monthList") List<String> monthList,@Param(value="areas")List<String> areas);
	
	/**
	 * 区域满意度
	 * @param monthList
	 * @param areas 
	 * @return
	 */
	String satisfyInfosByMonth(@Param(value="monthList")List<String> monthList,@Param(value="areas")List<String> areas);

	/**
	 * 项目满意度
	 * @param monthList
	 * @param areas
	 * @return
	 */
	String projectSatisfyByMonth(@Param(value="monthList")List<String> monthList,@Param(value="areas")List<String> areas,@Param(value="project")String project);
	

	/**
	 * 通过usercode获取角色
	 * @param userCode
	 * @return
	 */
	List<String> getRoleByUserCode(@Param(value = "userCode")String userCode);

	/**
	 * 不满意度
	 * @param areas
	 * @param project
	 * @param monthList
	 * @return
	 */
	List<UnsatisfyDto> unsatisfyInfo(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);

	/**
	 * 走势分析
	 */
	List<UnsatisfyDto> trendA2(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA41(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA42(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA43(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA44(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA51(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA52(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA53(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA54(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA61(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA62(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA71(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA72(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);
	List<UnsatisfyDto> trendA73(@Param(value="areas")List<String> areas,@Param(value="project") String project, @Param(value="monthList")List<String> monthList);

	/**
	 * 判断是否存在异常区域
	 * @return
	 */
	List<String> getEstateAreas();

}