package com.xhpc.payment.mapper;

import com.xhpc.common.domain.XhpcRefundOrder;
import org.apache.ibatis.annotations.Param;

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

/**
 * 退款订单信息 数据层
 *
 * @author ruoyi
 */
public interface XhpcRefundOrderMapper {

    /**
     * 新增 退款订单信息
     *
     * @param xhpcRefundOrder 退款订单信息
     * @return 结果
     */
    public int insert(XhpcRefundOrder xhpcRefundOrder);

    /**
     * 修改退款订单信息
     *
     * @param xhpcRefundOrder 退款订单信息
     * @return 结果
     */
    public int update(XhpcRefundOrder xhpcRefundOrder);

    /**
     * 修改退款订单信息
     *
     * @param xhpcRefundOrder 退款订单信息
     * @return 结果
     */
    public int updateStatus(XhpcRefundOrder xhpcRefundOrder);

    /**
     * 修改退款订单审核状态信息
     *
     * @param xhpcRefundOrder 退款订单信息
     * @return 结果
     */
    public int updateExamineStatus(XhpcRefundOrder xhpcRefundOrder);

    /**
     * 查询退款订单详情
     *
     * @param refundOrderId 退款订单id
     * @return 结果
     */
    public Map<String, Object> info(@Param("refundOrderId") Long refundOrderId);

    /**
     * 退款订单分页列表
     *
     * @param phone
     * @param refundOrderNumber
     * @param status
     * @param createTimeStart
     * @param createTimeEnd
     * @return
     */
    public List<Map<String, Object>> page(@Param("phone") String phone, @Param("refundOrderNumber") String refundOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type,@Param("source")Integer source,@Param("userId")Integer userId,@Param("tenantId")String tenantId);


    /**
     * 统计订单列表
     *
     * @param phone
     * @param refundOrderNumber
     * @param status
     * @param createTimeStart
     * @param createTimeEnd
     * @return
     */
    public Map<String, Object> sumMoney(@Param("phone") String phone, @Param("refundOrderNumber") String refundOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type,@Param("tenantId")String tenantId,@Param("time1")String time1,@Param("time2")String time2,@Param("time3")String time3,@Param("time4")String time4);


    public Map<String, Object> sumUserMoney(@Param("phone") String phone, @Param("refundOrderNumber") String refundOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type,@Param("tenantId")String tenantId,@Param("userId")Integer userId);


    /**
     * 通过用户id查询未完成充电订单
     *
     * @param userId 用户id
     * @return 结果
     */
    public List<Map<String, Object>> getNotChargeOrder(@Param("userId") Long userId,@Param("userType") Integer userType,@Param("tenantId") String tenantId);

    /**
     * 通过用户id查询未完成退款订单
     *
     * @param userId 用户id
     * @return 结果
     */
    public Map<String, Object> getNotRefundOrder(@Param("userId") Long userId,@Param("userType")Integer userType,@Param("tenantId")String tenantId);


    /**
     * 判断用户是否在充电中
     */
    int countXhpcRealTimeOrder(@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId);

    /**
     * 判断用户是否有异常订单未处理
     */
    int countXhpcChargeOrder(@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId);


    /**
     * 定时任务，每1小时，扫描一次，退款订单金额小于100，自动审核通过
     */
    public List<Long> moneyPage(@Param("type")Integer type);

    public int cycXhpcChargeOrder(@Param("appInternetUserId")Long appInternetUserId,@Param("time") String time);

    public int cycXhpcrRefundOrder(@Param("appInternetUserId")Long appInternetUserId,@Param("time") String time);

    List<Map<String, Object>> cycAppInternetUserPage();
    /**
     * 社区人员是否有退款订单审核（0无 1有）
     * @param userId
     * @param isRefundApplication
     * @return
     */
    int updateRefundApplication(@Param("userId")Long userId,@Param("isRefundApplication")Integer isRefundApplication);

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

    void updateXhpcRefundOrder(@Param("refundOrderId")Long refundOrderId);

    void updateXhpcRefundOrderBalance(@Param("refundOrderId")Long refundOrderId,@Param("balance")String balance);
}
