package com.xhpc.order.mapper;

import com.xhpc.order.domain.XhpcStatisticsStation;
import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * @author yuyang
 * @date 2021/9/1 10:00
 * @Version 1.0
 */
@Mapper
public interface XhpcStatisticsServiceMapper {

    /**
     * 小时统计
     * @param chargingStationIds         电站id集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getTimeIntervalPage(@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("terminalId")Long terminalId,@Param("chargingStationIds") List<String> chargingStationIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId);


    /**
     * 日期统计
     * @param chargingStationIds     电站id集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getDateIntervalPage(@Param("chargingStationId") Long chargingStationId,@Param("chargingPileId") Long chargingPileId,@Param("terminalId") Long terminalId,@Param("chargingStationIds") List<String> chargingStationIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId")Long userId,@Param("tenantId")String tenantId,@Param("beginStartTime") String beginStartTime,@Param("beginEndTime") String beginEndTime);

    /**
     * 电站统计
     * @param chargingStationIds         电站集合
     * @param operatorUserId        运营商集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param type                1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getStationIntervalPage(@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("terminalId")Long terminalId,@Param("chargingStationIds") List<String> chargingStationIds,@Param("operatorUserId") List<String> operatorUserId,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId,@Param("beginStartTime") String beginStartTime,@Param("beginEndTime") String beginEndTime);

    /**
     * 运营商统计
     * @param operatorUserId      运营商集合
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param type                1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getOperatorIntervalPage(@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("terminalId")Long terminalId,@Param("operatorUserId") List<String> operatorUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId,@Param("beginStartTime") String beginStartTime,@Param("beginEndTime") String beginEndTime);

    /**
     * 流量方统计
     * @param internetIds    流量方名称
     * @param internetUserId      流量方id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param type                1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getInternetUserIntervalPage(@Param("internetIds") List<String> internetIds,@Param("internetUserId") Long internetUserId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId);


    /**
     * 终端统计
     * @param chargingStationId    电站id
     * @param terminalId          终端id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getTerminalIntervalPage(@Param("chargingStationId") Long chargingStationId,@Param("terminalId") String terminalId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId") Long userId,@Param("tenantId")String tenantId,@Param("beginStartTime") String beginStartTime,@Param("beginEndTime") String beginEndTime);


    /**
     * 电站列表
     * @param operatorId      运营商id
     * @param userId          用户id
     * @param type            1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getChargingStationList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);


    /**
     * 电桩列表
     * @param operatorId      运营商id
     * @param userId          用户id
     * @param type            1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getChargingPileList(@Param("chargingStationId")Long chargingStationId,@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId,@Param("display")Integer display);

    /**
     * 运营商列表
     * @param operatorId      运营商id
     * @param userId          用户id
     * @param type            1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getOperatorList(@Param("operatorId")Long operatorId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);

    List<Map<String, Object>> getInternetOperatorList(@Param("userId")Long userId,@Param("tenantId")String tenantId);

    List<Map<String, Object>> getTenantList(@Param("userId")Long userId,@Param("type")Integer type);

    List<Map<String, Object>> getInternetTenantList(@Param("userId")Long userId);
    /**
     * 流量方列表
     * @param internetUserId  流量方id
     * @param userId          用户id
     * @param type            1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getInternetUserIList(@Param("internetUserId")Long internetUserId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);

    /**
     * 终端列表
     * @param chargingStationId  流量方id
     * @param userId          用户id
     * @param type            1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getTerminalList(@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("userId")Long userId,@Param("type")Integer type,@Param("tenantId")String tenantId);

    /**
     * 机构统计
     * @param chargingStationIds     电站id集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    List<Map<String, Object>> getMechanismPage(@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("terminalId")Long terminalId,@Param("chargingStationIds") List<String> chargingStationIds, @Param("internetUserId") Long internetUserId, @Param("operatorId") Long operatorId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") Integer type, @Param("userId")Long userId, @Param("tenantId")String tenantId,@Param("source")Integer source);



    /**
     * 添加时段订单统计
     * @param xhpcStatisticsTimeInterval
     */
    void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval);

    /**
     * 添加订单统计
     * @param xhpcStatisticsStation
     */
    void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation);

    /**
     * 查询是否重复录入数据
     * @param historyOrderId
     * @return
     */
    int getStatisticsTimeHistoryOrderId(@Param("historyOrderId")Long historyOrderId);
    /**
     * 获取流量方列表
     * @return
     */
    List<Map<String,String>> getInternetList(@Param("userId")Long userId,@Param("tenantId")String tenantId);

    int getStatisticsStationHistoryOrderId(@Param("historyOrderId")Long historyOrderId,@Param("type")Integer type);
    /**
     * 订单来源列表
     * @return
     */
    List<Map<String,Object>> getSumSourceList(@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("terminalId")Long terminalId,@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds,@Param("chargingStationIdList")List<String> chargingStationIdList,@Param("tenantId")String tenantId,@Param("sysUserId")Long sysUserId,@Param("number")Integer number,@Param("beginStartTime")String beginStartTime, @Param("beginEndTime")String beginEndTime);

    /**
     * 获取登陆用户信息
     */
    Map<String, Object> getLandUser(@Param("userId")Long userId);


    //今日订单量
    List<Map<String,Object>> getTodayStatusNumber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);

    int getTodayOrderNumber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);

    int getTodayNUmber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
    //今日订单量
    int getTodayDegreeNUmber(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);
    //今日营收
    double getTodayAmount(@Param("status")Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);

    /**
     * 根据电站获取终端的编号
     * @param chargingStationId
     * @return
     */
    List<String> getTerminal(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId);


    List<Map<String, Object>> getDateOrder(@Param("type") Integer type,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);


    int getDateOrderNUmber(@Param("type") Integer type,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);

    List<Map<String, Object>> getDateOrderCount(@Param("type") Integer type,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);

    int getDateOrderCountNUmber(@Param("type") Integer type,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);

    List<Map<String, Object>> getChargingStationEmptyOrder(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);

    List<Map<String, Object>> getTerminalEmptyOrder(@Param("chargingStationId")Long chargingStationId,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay);

    List<Map<String, Object>> getWorkHistoryOrderList(@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId,@Param("chargingPileId") Long chargingPileId,@Param("terminalId")Long terminalId, @Param("stopReason")String stopReason,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay,@Param("type")Integer type);

    List<Map<String, Object>> getWorkHistoryOrderListYY(@Param("operatorId")Long operatorId, @Param("chargingStationId")Long chargingStationId,@Param("chargingPileId") Long chargingPileId,@Param("terminalId")Long terminalId, @Param("stopReason")String stopReason,@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId,@Param("beginOfDay")String beginOfDay,@Param("endOfDay")String endOfDay,@Param("type")Integer type);

    List<Map<String, Object>>  getWorkOrderNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);

    Map<String, Object> getChargeOrderStatusNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);

    Map<String, Object> getRefundOderStatusNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);

    List<Map<String, Object>> getChargeOrderFaultPage(@Param("chargingStationId") Long chargingStationId,@Param("serialNumber") String serialNumber,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId")Long userId,@Param("tenantId")String tenantId);

    Map<String, Object> getHistoryOrderMassage(@Param("chargeOrderId")Long chargeOrderId);


    List<Map<String, Object>> getChargingPileStatusPage(@Param("chargingStationId") String chargingStationId,@Param("serialNumber") String serialNumber,@Param("statusName")String statusName,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId")Long userId,@Param("tenantId")String tenantId);



}
