package com.ssm.manage.query;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ssm.manage.utils.DateUtils;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 交易记录(TransactionRecord)实体类
 *
 * @author makejava
 * @since 2022-04-20 10:19:56
 */
@Setter
@Getter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
@Table(name = "transaction_record_${tab}")
public class TransactionRecordRequest{
    /**
     * id
     */
    @Id
    private Long id;
    /**
     * 门店ID
     */
    @Column(name = "store_id")
    private Long storeId;
    /**
     * 门店名称
     */
    @Column(name = "store_name")
    private String storeName;
    /**
     * 会员ID
     */
    @Column(name = "member_id")
    private Long memberId;
    /**
     * 会员名称
     */
    @Column(name = "member_name")
    private String memberName;
    /**
     * 会员身份证号
     */
    @Column(name = "member_identity")
    private String memberIdentity;
    /**
     * 会员手机号
     */
    @Column(name = "member_phone")
    private String memberPhone;
    /**
     * 日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Column(name = "date")
    private Date date;
    /**
     * 0=收银支付，1=收银作废，2=正常充值开卡，3=正常充值作废，4=升级充值开卡，5=升级充值转出，6=降级充值开卡，7=降级开卡转出，8=升级开卡作废，9=升级作废返回，10=降级开卡作废，11=降级作废返回，12=正常疗程开卡，13=疗程开卡作废，14=加价转入疗程，15=加价转出疗程，16=加价作废，17=加价作废返回，18=疗程转充值转入充值卡，19=疗程转充值转出疗程，20=疗程转充值作废扣卡，21=疗程转充值作废转出返回，22=充值退款，23=充值退款反审核返回，24=疗程退款，25=疗程退款反审核返回，26=消费退款返回，27=消费退款反审核扣除，28=还款添加，29=还款作废扣除，30=促销购买，31=促销赠送，32=促销作废扣除
     */
    @Column(name = "type")
    private Integer type;
    /**
     * 单据ID
     */
    @Column(name = "doc_id")
    private Long docId;
    /**
     * 单据号
     */
    @Column(name = "doc_num")
    private String docNum;
    /**
     * 单据时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Column(name = "doc_date")
    private Date docDate;
    /**
     * 账户ID
     */
    @Column(name = "account_id")
    private Long accountId;
    /**
     * 账户名称
     */
    @Column(name = "account_name")
    private String accountName;
    /**
     * 账户类型
     */
    @Column(name = "account_type")
    private String accountType;
    /**
     * 卡付金额
     */
    @Column(name = "card_money")
    private BigDecimal cardMoney;
    /**
     * 支付赠送金额
     */
    @Column(name = "account_gift_spend_money")
    private BigDecimal accountGiftSpendMoney;
    /**
     * 支付次数
     */
    @Column(name = "account_spend_count")
    private Integer accountSpendCount;
    /**
     * 剩余金额
     */
    @Column(name = "account_rest_money")
    private BigDecimal accountRestMoney;
    /**
     * 剩余可用金额
     */
    @Column(name = "account_consume_money")
    private BigDecimal accountConsumeMoney;
    /**
     * 剩余次数
     */
    @Column(name = "account_rest_count")
    private Integer accountRestCount;
    /**
     * 剩余可用次数
     */
    @Column(name = "account_consume_count")
    private Integer accountConsumeCount;
    /**
     * 剩余赠送金额
     */
    @Column(name = "account_gift_rest_money")
    private BigDecimal accountGiftRestMoney;
    /**
     * 剩余赠送次数
     */
    @Column(name = "account_gift_rest_count")
    private Integer accountGiftRestCount;
    /**
     * 剩余赠送可用金额
     */
    @Column(name = "account_gift_consume_money")
    private BigDecimal accountGiftConsumeMoney;
    /**
     * 剩余赠送可用次数
     */
    @Column(name = "account_gift_consume_count")
    private Integer accountGiftConsumeCount;
    /**
     * 账户编码（项目/充值类型）编码
     */
    @Column(name = "account_num")
    private String accountNum;
    /**
     * 操作人
     */
    @Column(name = "operation_by")
    private String operationBy;
    /**
     * 单据项目(充值类型)Id
     */
    @Column(name = "doc_project_id")
    private Long docProjectId;
    /**
     * 单据项目(充值类型)编码
     */
    @Column(name = "doc_project_num")
    private String docProjectNum;
    /**
     * 单据项目(充值类型)名称
     */
    @Column(name = "doc_project_name")
    private String docProjectName;
    /**
     * 单据当前状态
     */
    @Column(name = "doc_state")
    private Integer docState;
    /**
     * 单据购买数据
     */
    @Column(name = "quantity")
    private Integer quantity;
    /**
     * 单据购买单价
     */
    @Column(name = "price")
    private BigDecimal price;
    /**
     * 单据购买成交金额
     */
    @Column(name = "trading_money")
    private BigDecimal tradingMoney;
    /**
     * 欠款金额
     */
    @Column(name = "debt_money")
    private BigDecimal debtMoney;
    /**
     * 现付金额
     */
    @Column(name = "cash_money")
    private BigDecimal cashMoney;
    /**
     * 存入金额
     */
    @Column(name = "account_in_money")
    private BigDecimal accountInMoney;
    /**
     * 存入次数
     */
    @Column(name = "account_in_count")
    private Integer accountInCount;

    @JsonIgnore
    public String getTab(){
        return DateUtils.YMFormat(docDate);
    }
}

