package com.jeequan.jeepay.model;

import com.jeequan.jeepay.db.entity.PayOrder;
import lombok.Data;

import java.util.Date;

/**
 * TODO
 *
 * @author crystal
 * @date 2024/1/19 14:14
 */
@Data
public class RedPacketAccountOperate {

    /**
     * 付款用户
     */
    private String payUserId;

    /**
     * 所属门店
     */
    private String storeId;

    /**
     * 门店名称
     */
    private String storeName;

    /**
     * 关联流水号
     */
    private String flowNo;

    /**
     * 支付方式
     */
    private String payType;

    /**
     * 类型 1：交易 2：退款
     */
    private byte type;

    /**
     * 所属用户
     */
    private String mchNo;

    /**
     * 变化金额
     */
    private Long changeAmt;


    private Long orderAmt;

    private Date transTime;

    /**
     * 优惠金额
     */
    private Long discountAmt;

    public RedPacketAccountOperate(PayOrder payOrder, byte type) {
        this.payUserId = payOrder.getChannelUser();
        this.storeId = payOrder.getStoreId();
        this.storeName = payOrder.getStoreName();
        this.flowNo = payOrder.getPayOrderId();
        this.type = type;
        this.payType = payOrder.getWayCodeType();
        this.mchNo = payOrder.getMchNo();
        this.transTime = payOrder.getSuccessTime() == null ? new Date() : payOrder.getSuccessTime();
        this.orderAmt = payOrder.getAmount();
        this.discountAmt = payOrder.getDiscountAmt();
    }
}
