package com.fs.his.service;

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

import com.alibaba.fastjson.JSONObject;
import com.fs.common.core.domain.R;
import com.fs.company.param.FsStoreStatisticsParam;
import com.fs.company.vo.FsStorePaymentStatisticsVO;
import com.fs.his.config.AppConfig;
import com.fs.his.domain.FsStorePayment;
import com.fs.his.param.FsStorePaymentParam;
import com.fs.his.param.PayOrderParam;
import com.fs.his.param.WxSendRedPacketParam;
import com.fs.his.vo.FsStorePaymentExcelVO;
import com.fs.his.vo.FsStorePaymentVO;
import com.fs.hisStore.param.FsStorePaymentGetWxaCodeParam;
import com.fs.hisStore.param.FsStorePaymentPayParam;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * 支付明细Service接口
 *
 * @author fs
 * @date 2023-08-11
 */
public interface IFsStorePaymentService
{
    /**
     * 查询支付明细
     *
     * @param paymentId 支付明细主键
     * @return 支付明细
     */
    public FsStorePayment selectFsStorePaymentByPaymentId(Long paymentId);

    /**
     * 查询支付明细列表
     *
     * @param fsStorePayment 支付明细
     * @return 支付明细集合
     */
    public List<FsStorePayment> selectFsStorePaymentList(FsStorePayment fsStorePayment);

    /**
     * 新增支付明细
     *
     * @param fsStorePayment 支付明细
     * @return 结果
     */
    public int insertFsStorePayment(FsStorePayment fsStorePayment);

    /**
     * 修改支付明细
     *
     * @param fsStorePayment 支付明细
     * @return 结果
     */
    public int updateFsStorePayment(FsStorePayment fsStorePayment);

    /**
     * 批量删除支付明细
     *
     * @param paymentIds 需要删除的支付明细主键集合
     * @return 结果
     */
    public int deleteFsStorePaymentByPaymentIds(Long[] paymentIds);

    /**
     * 删除支付明细信息
     *
     * @param paymentId 支付明细主键
     * @return 结果
     */
    public int deleteFsStorePaymentByPaymentId(Long paymentId);

    FsStorePayment selectFsStorePaymentByPaymentCode(String payCode);

    List<FsStorePaymentVO> selectFsStorePaymentListVO(FsStorePaymentParam fsStorePayment);

    FsStorePaymentVO selectFsStorePaymentByPaymentIdVO(Long paymentId);

    List<FsStorePaymentStatisticsVO> selectFsStorePaymentStatisticsList(FsStoreStatisticsParam param);

    List<JSONObject> selectFsStorePaymentCounts(Map<String, Object> toMap);

    Long selectFsStorePaymentCount(int i, Long companyId);

    List<FsStorePaymentExcelVO> selectFsStorePaymentExcelVO(FsStorePaymentParam fsStorePayment);

    String updateFsStorePaymentByDecryptForm(Long paymentId);

    R refundFsStorePayment(Long paymentId);

    R sendRedPacket(WxSendRedPacketParam param);

    R sendRedPacketV3(WxSendRedPacketParam param);

    R sendRedPacketLimit(WxSendRedPacketParam param);

    R sendRedPacketDeduction(WxSendRedPacketParam param);

    String transferNotify(String notifyData, HttpServletRequest request);

    /**
     * 分公司配置回调地址
     * @param companyId
     * @param notifyData
     * @param request
     * @return
     */
    String TransferNotifyWithCompanyId(Long companyId,String notifyData, HttpServletRequest request);

    Boolean isEntityNull(FsStorePaymentParam fsStorePayment);

    Long selectFsStorePaymentExcelVOCount(FsStorePaymentParam fsStorePayment);

    String v3TransferNotify(String notifyData, HttpServletRequest request);

    /**
     * App 商家转账 V3 回调（验签使用 his.AppRedPacket，与小程序 redPacket.config 隔离）
     */
    String v3TransferNotifyApp(String notifyData, HttpServletRequest request);

    String v3TransferNotifyWithCompanyId(Long companyId,String notifyData, HttpServletRequest request);

    /**
     * 商家转账 V3 回调：按路径中的商户号从 merchant_app_config 取配置验签并同步红包状态
     *
     * @param mchId 微信商户号
     */
    String v3TransferNotifyWithMchId(String mchId, String notifyData, HttpServletRequest request);



    R sendRedPacketTest(WxSendRedPacketParam param);

    List<FsStorePaymentVO> selectFsStorePaymentListQueryVO(FsStorePaymentParam fsStorePayment);

    /**
     * 发起支付
     * @param payOrderParam 入参
     * @return R
     */
    R processPayment(PayOrderParam payOrderParam);

    R paymentByWxaCode(FsStorePaymentPayParam payment);

    R getWxaCodeByPayment(FsStorePaymentGetWxaCodeParam param);


    R payment(FsStorePaymentPayParam payParam);
    String payConfirm(String payCode,String tradeNo,String bankTransactionId,String bankSerialNo);

    void synchronizePayStatus();

    List<FsStorePayment> selectAllPayment();

    R sendAppRedPacket(WxSendRedPacketParam packetParam);

    R sendRedPacketV3ByApp(WxSendRedPacketParam param, AppConfig config);
}
