package com.xhpc.order.mapper;

import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.dto.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 历史订单信息 数据层
 *
 * @author ruoyi
 */
public interface XhpcHistoryOrderMapper {

    /**
     * 新增 历史订单信息
     *
     * @param xhpcHistoryOrder 历史订单信息
     * @return 结果
     */
    public int insert(XhpcHistoryOrder xhpcHistoryOrder);

    public int insertXhpcWorkHistoryOrderDto(XhpcWorkHistoryOrderDto xhpcWorkHistoryOrderDto);

    int updateXhpcHistoryOrderSerialNumber(XhpcHistoryOrder xhpcHistoryOrder);


    int updateXhpcHistoryOrderParkingVoucher(XhpcHistoryOrder xhpcHistoryOrder);
    /**
     * 更新 历史订单信息
     *
     * @param xhpcHistoryOrder 历史订单信息
     * @return 结果
     */
    public int update(XhpcHistoryOrder xhpcHistoryOrder);

    /**
     * 详情 历史订单信息
     *
     * @param historyOrderId 历史订单id
     * @return 结果
     */
    public XhpcHistoryOrder info(@Param("historyOrderId") Long historyOrderId);

    /**
     * 更新对账状态 历史订单信息
     *
     * @param xhpcHistoryOrderIds 历史订单信息
     * @return 结果
     */
    public int updateReconciliation(@Param("xhpcHistoryOrderIds") String[] xhpcHistoryOrderIds, @Param("status") String status);

    /**
     * 更新清分状态 历史订单信息
     *
     * @param xhpcHistoryOrderIds 历史订单信息
     * @return 结果
     */
    public int updateSorting(@Param("xhpcHistoryOrderIds") String[] xhpcHistoryOrderIds, @Param("status") String status);

    /**
     * 用户历史订单表
     *
     * @param userId
     * @return
     */
    List<Map<String, Object>> list(@Param("userId") Long userId,@Param("source") Integer source,@Param("tenantId") String tenantId);

    /**
     * 订单详情
     *
     * @param userId
     * @param historyOrderId
     * @return
     */
    Map<String, Object> gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId, @Param("source") Integer source, @Param("chargingOrderId") Long chargingOrderId, @Param("tenantId") String tenantId);

    /**
     * 历史订单记录（PC）
     * @return
     */
    List<Map<String,Object>> getListPage(@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("terminalId")Long terminalId,@Param("phone")String phone,@Param("transactionNumber")String transactionNumber,@Param("status")Integer status,@Param("chargingStationName")String chargingStationName,@Param("operatorId")Long operatorId,@Param("source")Integer source,@Param("beginStartTime")String beginStartTime,@Param("beginEndTime")String beginEndTime,@Param("userId")Long userId,@Param("type")Integer type,@Param("number")Integer number,@Param("affiliationOrganization")String affiliationOrganization,@Param("evcsOrderNo")String evcsOrderNo,@Param("plateNum")String plateNum,@Param("internetId")Integer internetId,@Param("internetSerialNumber")String internetSerialNumber,@Param("terminalName")String terminalName,@Param("vinCode")String vinCode,@Param("overStartTime")String overStartTime,@Param("overEndTime")String overEndTime,@Param("personnelId")Long personnelId,@Param("confirmResult")Integer confirmResult,@Param("tenantId")String tenantId,@Param("isNotNull")Integer isNotNull,@Param("mark")String mark);

    /**
     * 获取费率时段
     * @param startTime     开始时间
     * @param endTime       结束时间
     * @param rateModelId   计费模型
     * @return
     */
    List<Map<String,Object>> getReatTimeList(@Param("startTime")String startTime,@Param("endTime")String endTime,@Param("rateModelId")Long rateModelId);

    /**
     * 历史订单详情（PC）
     * @param historyOrderId 历史订单id
     * @return
     */
    Map<String,Object> getById(@Param("historyOrderId")Long historyOrderId);


    /**
     * 获取为统计的历史订单
     * @param number
     * @return
     */
    List<XhpcChargeHistoryOrder> getStatistisList(@Param("number")int number,@Param("state")int state);


    /**
     * 获取为统计的历史订单
     * @param number
     * @return
     */
    List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(@Param("number")int number);

    List<XhpcChargeHistoryOrder> getNoStatisticsOrderDay(@Param("number")int number);

    List<XhpcChargeHistoryOrder> getNoStatisticsOrder(@Param("number")int number);

    XhpcHistoryOrder getHistoryOrderById(@Param("historyOrderId")Long historyOrderId,@Param("serialNumber")String serialNumber);
    /**
     * 更新历史订单
     *
     */
    void updateXhpcHistoryOrder(@Param("historyOrderId")Long historyOrderId,@Param("state")Integer state);

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


    /**
     * 查询启动订单表
     */
    Map<String, Object> getchargingOrderById(@Param("chargingOrderId")Long chargingOrderId,@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId);

    //获取跨天最后一帧数据
    Map<String, Object> getXhpcRealTimeOrderTwentyFour(@Param("chargingOrderId")Long chargingOrderId,@Param("time")String time);

    //流量方统计
    int getToday(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("time")String time,@Param("tenantId")String tenantId);

    //成都监管平台未推送订单量
    int getChengDuShiToday();

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

    int updateOrderConfirmResult(Long historyOrderId);

    int updateOrderInternetPush(Long historyOrderId);

    int cancelOrders(Long historyOrderId);
    int updateChengDuPush(Long historyOrderId);

    Map<String, Object> getXhpcRateTimeFee(@Param("date") String date, @Param("rateModelId") Long rateModelId);


    List<XhpcHistoryOrderDto> getFileUpload(@Param("mapLst")List<XhpcHistoryOrderYuDto> mapLst);

    List<Map<String, Object>> getXhpcHistoryOrderChargeDetailsList(@Param("historyOrderId")Long historyOrderId);


    List<Map<String,Object>> getTerminalListPage(@Param("terminalId")Long terminalId,@Param("status")Integer status,@Param("operatorId")Long operatorId,@Param("chargingStationId")Long chargingStationId);


    XhpcHistoryOrder getOrderMassageOrRateTime(@Param("serialNumber") String serialNumber);

    List<Map<String,Object>> getRateTimeList(@Param("rateModelId")Long rateModelId);
}
