package com.jeequan.jeepay.db.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jeequan.jeepay.core.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * <p>
 * 渠道对账单表
 * </p>
 *
 * @author [mybatis plus generator]
 * @since 2022-09-09
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_check_channel_bill")
public class CheckChannelBill extends BaseModel {

    private static final long serialVersionUID=1L;

    public static final LambdaQueryWrapper<CheckChannelBill> gw(){
        return new LambdaQueryWrapper<>();
    }

    public static String BILL_TYPE_PAY = "pay"; // 支付账单
    public static String BILL_TYPE_REFUND = "refund"; // 退款账单

    /**
     * ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 对账批次号，支付接口代码ifCode_渠道商户号_对账日期
     */
    private String batchNo;

    /**
     * 支付接口代码
     */
    private String ifCode;

    /**
     * 渠道商户号
     */
    private String channelMchNo;

    /**
     * 对账日期
     */
    private Date billDate;

    /**
     * 账单类型，pay：支付, refund：退款
     */
    private String billType;

    /**
     * 三位货币代码,人民币:cny
     */
    private String currency;

    /**
     * 平台订单号
     */
    private String orderId;

    /**
     * 渠道订单号
     */
    private String channelOrderNo;

    /**
     * 交易金额 单位：分
     */
    private Long channelAmount;

    /**
     * 渠道手续费 单位：分
     */
    private Long channelFeeAmount;

    /**
     * 渠道交易成功时间
     */
    private Date channelSuccessAt;

    /**
     * 渠道用户标识,如微信openId,支付宝账号
     */
    private String channelUser;

    /**
     * 渠道订单状态：0-订单生成, 1-支付中, 2-支付成功, 3-支付失败, 4-已撤销, 5-已退款, 6-订单关闭
     */
    private Byte channelState;

    /**
     * 退款原支付订单号
     */
    private String orgPayOrderId;

    /**
     * 退款金额
     */
    private String channelRefundAmount;

    /**
     * 创建时间
     */
    private Date createdAt;

    /**
     * 更新时间
     */
    private Date updatedAt;


}
