package com.huiju.estateagents.service;

import com.huiju.estateagents.base.ResponseBean;
import com.huiju.estateagents.entity.TaPersonBuilding;
import com.huiju.estateagents.excel.IntentionUser;
import com.huiju.estateagents.excel.StatsBuilding;
import com.huiju.estateagents.excel.StatsTimeBuilding;

import java.time.LocalDate;
import java.util.List;

/**
 * 数据统计 接口
 */
public interface IStatisticalService {

    /**
     * 首页统计总数
     * @return
     */
    ResponseBean indexStatistical(Integer orgId);

    // ----------------   用户统计 start --------------
    /**
     * 用户总数
     * @return
     */
    ResponseBean selectUserCount(Integer orgId);

    /**
     * 注册数
     * @return
     */
    ResponseBean selectRegisteredCount(Integer orgId);

    /**
     * 用户最近七天
     * @return
     */
    ResponseBean selectRecentlyCount(Integer orgId, LocalDate startDate, LocalDate endDate);

    // ----------------   用户统计 end --------------

    /**
     * 性别比例
     * @return
     */
    ResponseBean selectSexUser(Integer orgId);

    /**
     * 城市比例
     * @return
     */
    ResponseBean selectCityUser(Integer orgId);

    /**
     * 活跃用户数
     * @return
     */
    ResponseBean selectActiveUserCount(Integer orgId, String dateType, LocalDate startDate, LocalDate endDate);

    /**
     * 新增用户数
     * @param startDate
     * @param endDate
     * @return
     */
    ResponseBean selectNewsUserCount(Integer orgId, LocalDate startDate,LocalDate endDate);

    /**
     * 用户行为
     * @param startDate
     * @param endDate
     * @return
     */
    ResponseBean selectUserBehavior(Integer pageNum,
                                    Integer pageSize,
                                    Integer orgId,
                                    LocalDate startDate,
                                    LocalDate endDate,
                                    String buildingId,
                                    String eventType,
                                    String event,
                                    String activity);

    /**
     * 行为分析的 具体数据列表
     * @param event
     * @param personId
     * @return
     */
    ResponseBean selectEventAll(Integer orgId, String event, String personId);

    /**
     * 转换率 统计
     * @param conversion
     * @return
     */
    ResponseBean selectConversion(Integer orgId, String conversion);

    /**
     * 用户来源 首页
     * @return
     */
    ResponseBean selectUserResource(Integer orgId, LocalDate startDate, LocalDate endDate);

    /**
     * 意向用户 首页
     * @param buildingId
     * @return
     */
    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);

    /**
     * 用户来源数据 首页
     * @param orgId
     * @param startDate
     * @param endDate
     * @return
     */
    ResponseBean selectPersonFrom(Integer orgId, LocalDate startDate, LocalDate endDate);

    /**
     * 用户来源数据统计折线图
     * @param orgId
     * @param startDate
     * @param endDate
     * @return
     */
    ResponseBean selectPersonFromGroupByDay(Integer orgId, LocalDate startDate, LocalDate endDate);

    /**
     * 获取楼盘的折线图统计
     * @param orgId
     * @param startDate
     * @param endDate
     * @param taPersonBuildingListByUserId
     * @return
     */
    ResponseBean getStatsBarList(Integer orgId, LocalDate startDate, LocalDate endDate, List<TaPersonBuilding> taPersonBuildingListByUserId);

    /**
     * 获取楼盘统计所有数据
     * @param orgId
     * @param startDate
     * @param endDate
     * @param buildingId
     * @param taPersonBuildingListByUserId
     * @return
     */
    ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,String sortField,String sortOrder);

    /**
     * 获取需要导出的数据
     * @param orgId
     * @param startDate
     * @param endDate
     * @param buildingId
     * @param taPersonBuildingListByUserId
     * @return
     */
    List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);

    /**
     * 按时间获取此楼盘的数据折线图
     * @param orgId
     * @param startDate
     * @param endDate
     * @param buildingId
     * @param taPersonBuildingListByUserId
     * @return
     */
    ResponseBean getStatsTimeBarList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);

    /**
     * 分页统计楼盘详情数据
     * @param pageNum
     * @param pageSize
     * @param orgId
     * @param startDate
     * @param endDate
     * @param buildingId
     * @param taPersonBuildingListByUserId
     * @param sortField
     * @param sortOrder
     * @return
     */
    ResponseBean getStatsTimeTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId, String sortField, String sortOrder);

    /**
     * 项目详情统计
     * @param orgId
     * @param startDate
     * @param endDate
     * @param buildingId
     * @param taPersonBuildingListByUserId
     * @return
     */
    List<StatsTimeBuilding> getExportTimeTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);

    /**
     * 意向客户导出
     * @param orgId
     * @param buildingId
     * @param taPersonBuildingListByUserId
     * @return
     */
    List<IntentionUser> getExportIntentionUser(Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);

    /**
     * 新调整--新增用户
     * @param orgId
     * @param startDate
     * @param endDate
     * @return
     */
    ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate);

    /**
     * 人员城市分布
     * @param orgId
     * @return
     */
    ResponseBean selectCityPerson(Integer orgId);
}
