package com.yiqi.recharge.service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yiqi.app.domain.AppUserBillMstr;
import com.yiqi.common.core.domain.PageVO;
import com.yiqi.common.core.page.TableDataInfo;
import com.yiqi.common.exception.ServiceException;
import com.yiqi.order.domain.dto.RechargeCardPayDTO;
import com.yiqi.recharge.domain.RechargeCardBatchRecord;
import com.yiqi.recharge.domain.RechargePasswordCard;
import com.yiqi.recharge.domain.dto.*;
import com.yiqi.recharge.domain.dto.weapp.WeAppCardRecordByCardDTO;
import com.yiqi.recharge.domain.dto.weapp.WeAppCardRecordByUserDTO;
import com.yiqi.recharge.domain.vo.RechargeBalanceCountVO;
import com.yiqi.recharge.domain.vo.RechargeCardBillMstrQueryVO;
import com.yiqi.recharge.domain.vo.RechargePasswordCardQueryVO;
import com.yiqi.recharge.domain.vo.StoreCardStatisticsVO;
import com.yiqi.recharge.domain.vo.weapp.WeAppCardsInfoVO;
import com.yiqi.recharge.domain.vo.weapp.WeAppCardsUseRecordsVO;

/**
 * 密码充值卡管理Service接口
 *
 * @author xiaohei
 * @date 2023-08-29
 */
public interface IRechargePasswordCardService extends IService<RechargePasswordCard> {

    public List<RechargePasswordCardQueryVO> selectRechargePasswordCardList(PageVO pageVO);

    public List<RechargePasswordCardQueryVO> selectRechargePasswordCardList(MemberCardQueryDTO memberCardQueryDTO);

    public int countRechargePasswordCardList(MemberCardQueryDTO memberCardQueryDTO);

    public RechargePasswordCard selectTotalBalanceGroupByAppUser(Long appUserId);

    public RechargePasswordCard selectTotalBalanceGroupByAppUser(Long appUserId,String orderType);

    public List<RechargeBalanceCountVO> getUserBalanceCountList(RechargeBalanceCountDTO rechargeBalanceCountDTO);

    public int findUserPageByBalanceCount(RechargeBalanceCountDTO rechargeBalanceCountDTO);

    public List<RechargeCardBillMstrQueryVO> getCardBillMstrInfoById(Long rechargeCardId);

    public List<RechargeCardBillMstrQueryVO> getBillMstrInfoList(BillMstrQueryDTO billMstrQueryDTO);

    public int countBillMstrInfoList(BillMstrQueryDTO billMstrQueryDTO);


    /**
     * 查询密码充值卡管理
     *
     * @param id 密码充值卡管理主键
     * @return 密码充值卡管理
     */
    public RechargePasswordCard selectRechargePasswordCardById(Long id);

    /**
     * 查询密码充值卡管理
     *
     * @param orderNo 订单编号
     * @return 密码充值卡管理
     */
    public RechargePasswordCard selectRechargePasswordCardByOrderNo(String orderNo);

    /**
     * 查询密码充值卡管理列表
     *
     * @param rechargePasswordCardQueryDTO 密码充值卡管理
     * @return 密码充值卡管理集合
     */
    public List<RechargePasswordCardQueryVO> selectRechargePasswordCardList(RechargePasswordCardQueryDTO rechargePasswordCardQueryDTO);

    /**
     * 新增密码充值卡管理
     *
     * @param rechargePasswordCard 密码充值卡管理
     * @return 结果
     */
    public int insertRechargePasswordCard(RechargePasswordCard rechargePasswordCard);

    /**
     * 修改密码充值卡管理
     *
     * @param rechargePasswordCard 密码充值卡管理
     * @return 结果
     */
    public int updateRechargePasswordCard(RechargePasswordCard rechargePasswordCard);

    /**
     * 批量删除密码充值卡管理
     *
     * @param ids 需要删除的密码充值卡管理主键集合
     * @return 结果
     */
    public int deleteRechargePasswordCardByIds(Long[] ids);

    /**
     * 删除密码充值卡管理信息
     *
     * @param id 密码充值卡管理主键
     * @return 结果
     */
    public int deleteRechargePasswordCardById(Long id);

    /**
     * 导入充值卡数据
     *
     * @param rechargePasswordImportDTOS        充值卡数据列表
     * @return 结果
     */
    public String importData(List<RechargePasswordImportDTO> rechargePasswordImportDTOS, RechargeCardBatchRecord rechargeCardBatchRecord);


    /**
     * 直充导入
     */
    DirectChargingImportVO importDirectCharging(DirectChargingImportRequest request);


    /**
     * 按客户获取充值卡信息
     */
    public List<WeAppCardsInfoVO> getPasswordCardsInfoByAppUserId(WeAppCardRecordByUserDTO weAppCardRecordByUserDTO);

    /**
     * 按充值卡查消费记录
     */
    public WeAppCardsUseRecordsVO getUseRecordsByCardId(WeAppCardRecordByCardDTO weAppCardRecordByCardDTO);

    /**
     * 订单支付
     * @param rechargeCardPayDTO
     * @throws ServiceException
     */
    void orderPayByBalance(RechargeCardPayDTO rechargeCardPayDTO) throws ServiceException;

    /**
     * 根据充值单号查询充值卡信息
     * @param rechargeSn
     * @return
     */
    RechargePasswordCard selectRechargePasswordCardBySn(String rechargeSn);

    /**
     * 退款余额
     *
     */
    public Boolean orderRefundByBalance(String orderSn, BigDecimal refundAmount);


    /**
     * 分页查询门店会员卡统计
     */
    TableDataInfo<StoreCardStatisticsVO> getStoreCardStatisticsPage(Long storeId, Date beginTime, Date endTime, int pageNum, int pageSize);

    /**
     * 导出门店会员卡统计
     */
    List<StoreCardStatisticsVO> getStoreCardStatisticsExport(Long storeId, Date beginTime, Date endTime);

}
