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.page.BasePage;
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.Table;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

@Setter
@Getter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
@Table(name = "account_trade_record_${tab}${tab1}${tab2}${tab3}${tab4}${tab5}")
public class AccountTradeRecordRequest extends BasePage {
    private Long id;

    /**
     * 门店ID
     */
    @Column(name = "store_id")
    private Long storeId;

    private List<Long> storeIds;

    /**
     * 门店名称
     */
    @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;

    /**
     * 账户ID
     */
    @Column(name = "account_id")
    private Long accountId;

    /**
     * 账户名称
     */
    @Column(name = "account_name")
    private String accountName;

    /**
     * 账户类型
     */
    @Column(name = "account_type")
    private String accountType;

    /**
     * 单据ID
     */
    @Column(name = "doc_id")
    private Long docId;

    /**
     * 单据号
     */
    @Column(name = "doc_num")
    private String docNum;

    /**
     * 单据时间
     */
    @Column(name = "input_date")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date inputDate;

    /**
     * 单据时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endDate;

    /**
     * 单据类型
     */
    @Column(name = "doc_type")
    private String docType;

    /**
     * 交易ID
     */
    @Column(name = "trade_id")
    private Long tradeId;

    /**
     * 交易ID
     */
    @Column(name = "order_statu")
    private Integer orderStatu;

    /**
     * 交易名称
     */
    @Column(name = "trade_name")
    private String tradeName;

    /**
     * 交易名称
     */
    @Column(name = "payment_amount")
    private BigDecimal paymentAmount;


    /**
     * 卡付总额
     */
    @Column(name = "card_money")
    private BigDecimal cardMoney;

    /**
     * 现付总额
     */
    @Column(name = "cash_money")
    private BigDecimal cashMoney;

    private List<String> docTypes;

    private String date;

    private Integer type;//项目统计使用

    private List<Long> storeIdl;




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


    public String getTab1() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(inputDate); // 设置为当前时间
        calendar.add(Calendar.MONTH, -1);
        String s = DateUtils.YMFormat(calendar.getTime());
        return s;
    }

    public String getTab2() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(inputDate); // 设置为当前时间
        calendar.add(Calendar.MONTH, -2);
        String s = DateUtils.YMFormat(calendar.getTime());
        return s;
    }
    public String getTab3() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(inputDate); // 设置为当前时间
        calendar.add(Calendar.MONTH, -3);
        String s = DateUtils.YMFormat(calendar.getTime());
        return s;
    }
    public String getTab4() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(inputDate); // 设置为当前时间
        calendar.add(Calendar.MONTH, -4);
        String s = DateUtils.YMFormat(calendar.getTime());
        return s;
    }
    public String getTab5() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(inputDate); // 设置为当前时间
        calendar.add(Calendar.MONTH, -5);
        String s = DateUtils.YMFormat(calendar.getTime());
        return s;
    }
}
