package com.xhpc.order.mapper;

import com.xhpc.common.domain.XhpcPlaceholderTime;
import com.xhpc.evcs.domain.PlaceholderRules;
import com.xhpc.evcs.domain.PriceInfo;
import com.xhpc.order.domain.XhpcPlaceholderOrder;
import com.xhpc.order.dto.PositionFeeDto;
import com.xhpc.order.dto.XhpcPlaceholderTimeOrderDto;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author yuyang
 * @Date 2025-05-06 11:16
 */
public interface XhpcPlaceholderOrderMapper {
    int insertXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder );

    XhpcPlaceholderOrder getXhpcPlaceholderOrderSerialNumber(@Param("serialNumber") String serialNumber);

    XhpcPlaceholderOrder getReturnGunRecord(@Param("serialNumber") String serialNumber);

    int getXhpcHistoryOrderTotalPrice(@Param("serialNumber") String serialNumber,@Param("type")Integer type);

    int getXhpcChargeOrderStatus(@Param("serialNumber") String serialNumber);

    List<XhpcPlaceholderTime> getXhpcPlaceholderTime(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("placeholderId")Long placeholderId);

    int updateXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder );

    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("totalMoneyMin") Double totalMoneyMin,@Param("totalMoneyMax") Double totalMoneyMax,@Param("placeholderOrderNumber")String placeholderOrderNumber);

    List<Map<String,Object>> getAbnormalListPage(@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);

    Map<String,Object> getById(@Param("placeholderOrderId")Long placeholderOrderId);

    int insertXhpcPlaceholderTimeOrder(XhpcPlaceholderTimeOrderDto xhpcPlaceholderTimeOrderDto);


    int deleteByPlaceholderOrderIdInt(@Param("placeholderOrderId")Long placeholderOrderId);

    List<Map<String,Object>> getXhpcPlaceholderTimeOrder(@Param("placeholderOrderId")Long placeholderOrderId);

    List<XhpcPlaceholderTime> getXhpcPlaceholderId(@Param("placeholderId")Long placeholderId);

    List<XhpcPlaceholderTime> getxhpcPlaceholderOrderTasks();

    List<PlaceholderRules> getPlaceholderIDs(@Param("stations")List<Long> stations);

    List<PriceInfo> getPriceInfo(@Param("placeholderId")Long placeholderId);

    void getAbnormal();

    XhpcPlaceholderOrder getAbnormalTime();

    List<XhpcPlaceholderOrder> getAbnormalTimeList();

    int getXhpcPlaceholderOrderNumber(@Param("userId")Long userId, @Param("source")Integer source, @Param("terminalId")String terminalId);

    XhpcPlaceholderOrder getByPlaceholderOrderId(@Param("placeholderOrderId")Long placeholderOrderId);

    Map<String,Object> getXhpcDeviceMessage(@Param("chargeOrderNo")String chargeOrderNo, @Param("gunStatus")Integer gunStatus, @Param("tenantId")String tenantId,@Param("createTime") Date createTime);

    /**
     * 订单来源列表
     * @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 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 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);

    int getXhpcHistoryOrderMessage(@Param("serialNumber")String serialNumber);

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

    List<Map<String, Object>> appealPlaceholderOrderListPC(@Param("operatorId")Long operatorId,@Param("name") String name, @Param("type") Integer type, @Param("serialNumber") String serialNumber, @Param("chargingStationId") Long chargingStationId,@Param("logOperatorId")Long logOperatorId,@Param("number")Integer number,@Param("tenantId") String tenantId);


    List<PositionFeeDto> getPlaceholderOrderExcelList(@Param("mapLst")List<PositionFeeDto> mapLst,@Param("userId") Long userId);

    List<PositionFeeDto> getPlaceholderOrderUserExcelList(@Param("mapLst")List<PositionFeeDto> mapLst);

    int updatePlaceholderOrderRechargeMoney(@Param("rechargeMoney")BigDecimal rechargeMoney,@Param("placeholderOrderNumber") String placeholderOrderNumber);

    int updatePlaceholderOrderRechargeUserMoney(@Param("rechargeMoney")BigDecimal rechargeMoney,@Param("placeholderOrderNumber") String placeholderOrderNumber);

    List<Map<String,Object>> deviceMessageList(@Param("chargeOrderNo") String chargeOrderNo ,@Param("gunNumber") String gunNumber);


    List<Map<String,Object>> getType();

    Map<String,Object> getXhpcPlaceholderOrderType(@Param("chargeOrderNo") String chargeOrderNo ,@Param("gunNumber") String gunNumber,@Param("currentMaxId") Long currentMaxId);

    Long getDeviceMessageIdMax(@Param("chargeOrderNo") String chargeOrderNo ,@Param("gunNumber") String gunNumber);


    Map<String,Object> getXhpcPlaceholderOrderTypeYu(@Param("chargeOrderNo") String chargeOrderNo ,@Param("gunNumber") String gunNumber);

    int getXhpcHistoryOrderNextOrderTime(@Param("historyOrderId")Long historyOrderId,@Param("terminalId")Long terminalId,@Param("startTime") String startTime);


    int getXhpcHistoryOrderNextOrderTimeYu(@Param("historyOrderId")Long historyOrderId,@Param("terminalId")Long terminalId,@Param("startTime") String startTime);

}
