package com.hzs.member.account.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hzs.common.core.enums.EApproveStatus;
import com.hzs.common.domain.member.account.CuMemberTrade;
import com.hzs.member.account.dto.BusinessCommissionDTO;
import com.hzs.member.account.dto.MemberBalanceDTO;
import com.hzs.member.account.dto.MemberBusinessBalanceDTO;
import com.hzs.member.account.vo.CuMemberTradeDetailVO;
import com.hzs.member.account.vo.CuMemberTradeVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 会员交易明细 服务类
 */
public interface ICuMemberTradeService extends IService<CuMemberTrade> {

    /**
     * 查询订单的消费记录，含退款的
     *
     * @param pkMember   会员主键
     * @param sourceCode 订单编号
     */
    List<CuMemberTrade> queryCuMemberTrade(Long pkMember, String sourceCode);

    /**
     * 查询列表信息
     *
     * @param cuMemberTradeVO 交易明细信息
     * @return List<CuMemberTradeVO>
     */
    Object[] selectMemberTradeList(CuMemberTradeVO cuMemberTradeVO);

    /**
     * 批量插入流水信息
     *
     * @param cuMemberTrades
     * @return Integer
     */
    Integer batchSaveTradeByMemberCode(@Param("cuMemberTrades") List<CuMemberTrade> cuMemberTrades);

    /**
     * 查询钱包明细详情信息
     *
     * @param memberTradeDetailVO 交易明细信息
     * @return List<CuMemberTradeDetailVO>
     */
    Object[] selectMemberTradeDetailList(CuMemberTradeDetailVO memberTradeDetailVO);

    /**
     * 业务办理扣费提交
     *
     * @param businessCommissionDTO 业务办理入参
     * @return Integer
     */
    Boolean businessCommissionSubmit(BusinessCommissionDTO businessCommissionDTO, EApproveStatus eApproveStatus);

    /**
     * 业务办理扣费提交
     *
     * @param businessCommissionDTO 业务办理入参
     * @return Integer
     */
    Boolean businessCommissionSubmit(BusinessCommissionDTO businessCommissionDTO);

    /**
     * 业务办理扣费驳回
     *
     * @param businessCommissionDTO 业务办理入参
     * @return Integer
     */
    Boolean businessCommissionReject(BusinessCommissionDTO businessCommissionDTO);

    /**
     * 查询余额不足的用户信息
     *
     * @param businessCommissionDTO 业务参数
     * @return List<MemberBalanceDTO>
     */
    List<MemberBalanceDTO> selectBalanceNotEnoughMember(BusinessCommissionDTO businessCommissionDTO);

    /**
     * 办理业务专用查询会员余额
     **/
    List<MemberBusinessBalanceDTO> selectBusinessBalanceNotEnoughMember(List<MemberBusinessBalanceDTO> mbbList, Integer pkCountry);

    /**
     * 特殊业务业务办理专用查询会员余额
     **/
    List<MemberBusinessBalanceDTO> selectSpecialBusinessBalanceNotEnoughMember(List<MemberBusinessBalanceDTO> mbbList, Integer pkCountry);

    /**
     * 查询钱包明细（前端）
     *
     * @param cuMemberTradeVO 交易明细
     * @return List<CuMemberTrade>
     */
    List<CuMemberTradeVO> selectWattleDetail(CuMemberTradeVO cuMemberTradeVO);

    /**
     * 根据 来源编号更新交易编号
     *
     * @param cuMemberTradeVO 交易入参
     * @return Integer
     */
    Integer updateSourceCodeByTradeCode(CuMemberTradeVO cuMemberTradeVO);

    /**
     * 查询会员订单产生的最新交易明细
     *
     * @param pkMember      会员
     * @param sourceCode    来源单号
     * @param tradeClassify 交易分类 -- 非必传
     * @return
     */
    List<CuMemberTrade> querySourceCodeLastTrade(Long pkMember, String sourceCode, Integer tradeClassify);

    /**
     * 根据充值单号插入交易流水、余额表
     *
     * @param rechargeCode 充值单号
     * @return Integer
     */
    Integer saveMemberTradeAndAccountByRechargeCode(String rechargeCode);

    /**
     * 根据来源单号查询会员奖金币种的流水信息
     *
     * @param sourceCode 来源单号
     * @return List<CuMemberTrade>
     */
    List<CuMemberTrade> selectMemberTradeBySourceCode(String sourceCode);


    /**
     * 查询用户交易类型
     *
     * @param pkMember  用户ID
     * @param pkCountry 国家ID
     * @return Integer
     */
    List<Integer> selectTradeType(Long pkMember, Integer pkCountry);

}
