package com.xhpc.payment.service;

import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcRefundOrder;

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

/**
 * 退款订单信息 服务层
 *
 * @author ruoyi
 */
public interface IXhpcRefundOrderService {

    /**
     * 更新 退款订单
     *
     * @param xhpcRefundOrder 退款订单
     */
    public int update(XhpcRefundOrder xhpcRefundOrder);

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

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



    /**
     * 退款订单分页列表导出
     *
     * @param phone
     * @param refundOrderNumber
     * @param status
     * @param createTimeStart
     * @param createTimeEnd
     * @return
     */
    public void export(HttpServletResponse response, String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type,Integer source,Integer userId) throws IOException;


    /**
     * 退款订单分页列表
     *
     * @param phone
     * @param refundOrderNumber
     * @param status
     * @param createTimeStart
     * @param createTimeEnd
     * @return
     */
    public Map<String, Object> sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type);

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

    /**
     * 新增 退款订单
     *
     * @param appUserId C端用户id
     * @param amount    充值金额
     * @param type      退款渠道（1微信 2支付宝）
     * @param remark    备注
     * @return
     */
    public AjaxResult addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid, String remark,Integer userType,String tenantId);

    /**
     * 新增 云快充退款订单
     *
     * @param appUserId C端用户id
     * @param amount    充值金额
     * @param type      退款渠道（1微信 2支付宝）
     * @return
     */
    public AjaxResult addCycRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber,Integer userType,String tenantId);
    /**
     * 通过用户id查询未完成退款订单
     *
     * @param userId 用户id
     * @return 结果
     */
    public Map<String, Object> getNotRefundOrder(Long userId,Integer userType,String tenantId);

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


    /**
     * 判断用户是否在充电中
     */
    int countXhpcRealTimeOrder(Long userId,Integer source,String tenantId);
    //是否有异常订单
    /**
     * 判断用户是否有异常订单未处理
     */
    int countXhpcChargeOrder(Long userId,Integer source,String tenantId);

    /**
     * 定时任务，每5分钟，扫描一次，退款订单金额小于100，自动审核通过
     * type 1 小于101元   2大于100元
     */
    public List<Long> moneyPage(Integer type);

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


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

    void updateXhpcRefundOrder(Long refundOrderId);

    //修改请求数据
    void updateXhpcRefundOrderBalance(Long refundOrderId,String balance);
}
