package com.xhpc.order.service;

import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
import com.xhpc.order.dto.XhpcWorkHistoryOrderDto;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @author yuyang
 * @date 2021/8/3 21:23
 */
public interface IXhpcHistoryOrderService {


    /**
     * 用户历史订单表
     * @param
     * @return
     */
    List<Map<String,Object>> list(HttpServletRequest request);

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

    /**
     * 用户订单详情
     * @param userId
     * @param historyOrderId
     * @return
     */
    AjaxResult gethistotyOrderMessage(HttpServletRequest request, Long userId, Long historyOrderId, Integer type, Long chargingOrderId);

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

    void insertXhpcWorkHistoryOrderDto(XhpcWorkHistoryOrderDto xhpcWorkHistoryOrderDto);


    int updateXhpcHistoryOrderSerialNumber(XhpcHistoryOrder xhpcHistoryOrder);

    /**
     * 修改停车优惠券是否发生
     * @param xhpcHistoryOrder
     * @return
     */
    int updateXhpcHistoryOrderParkingVoucher(XhpcHistoryOrder xhpcHistoryOrder);


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


    /**
     * 历史订单记录导出（PC）
     * @return
     */
    void export(HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult,String mark) throws IOException;


    /**
     * 历史订单详情（PC）
     * @param historyOrderId 历史订单id
     * @return
     */
    AjaxResult getById(Long historyOrderId);


    XhpcHistoryOrder getHistoryOrderById(Long historyOrderId,String serialNumber);

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

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



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

    /**
     * 获取为统计的历史订单（日期、电站）
     * @param number
     * @return
     */
    List<XhpcChargeHistoryOrder> getNoStatisticsOrderDay(int number);

    /**
     * 获取为统计的历史订单
     * @param number
     * @return
     */
    List<XhpcChargeHistoryOrder> getNoStatisticsOrder(int number);
    /**
     * 更新历史订单
     *
     */
    void updateXhpcHistoryOrder(Long historyOrderId,Integer state);


    /**
     * 异常订单24小时自动结算
     */
    void addXhpcChargeOrder(Long realTimeOrderId,Long chargeOrderId);


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

    //最近一个月推送情况
    List<Map<String, Object>> getToday();

    List<Map<String, Object>> getConfirmResultPage(Integer status);

    AjaxResult  updateOrderConfirmResult(Long historyOrderId);

    AjaxResult  updateOrderInternetPush(Long historyOrderId);

    AjaxResult  updateChengDuPush(Long historyOrderId);

    AjaxResult  cancelOrders(Long historyOrderId);

    Map<String, Object> getXhpcRateTimeFee(Long rateModelId);

    R fileUpload(HttpServletRequest request, HttpServletResponse response, String tenantId, MultipartFile file, int type, String startTime, String endTime) throws Exception;

    List<Map<String,Object>> getTerminalListPage(HttpServletRequest request,Long terminalId,Long chargingStationId);

    AjaxResult  getOrderMassageOrRateTime(String serialNumber);

    AjaxResult  addOrderMassageOrRateTime(String serialNumber,String chargeOrderInfo);
}
