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.entity.PayList;
import com.ssm.manage.entity.Salesman;
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 java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Setter
@Getter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class RechargeListRequest extends BasePage {
    private Long id;
    private int isSendSms;
    private List<Long> storeIds;

    /**
     * 充值单号
     */
    @Column(name = "recharge_num")
    private String rechargeNum;

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



    /**
     * 门店名称
     */
    @Column(name = "store_name")
    private String storeName;

    /**
     * 会员编码
     */
    @Column(name = "member_id")
    private Long memberId;

    /**
     * 会员名称
     */
    @Column(name = "member_name")
    private String memberName;

    /**
     * 会员身份证号
     */
    @Column(name = "member_identity_card")
    private String memberIdentityCard;

    /**
     * 手机
     */
    @Column(name = "mobile_phone")
    private String mobilePhone;

    /**
     * 充值类别
     */
    @Column(name = "recharge_type_id")
    private Long rechargeTypeId;

    /**
     * 充值名称
     */
    @Column(name = "recharge_type_name")
    private String rechargeTypeName;

    /**
     * 享受优惠
     */
    private BigDecimal discount;

    /**
     * 充值日期
     */
    @Column(name = "recharge_date")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date rechargeDate;

    /**
     * 充值标准金额
     */
    @Column(name = "recharge_amount")
    private BigDecimal rechargeAmount;

    /**
     * 现付充值金额
     */
    @Column(name = "collection_cash_amount")
    private BigDecimal collectionCashAmount;

    /**
     * 积分金额
     */
    @Column(name = "collection_integral_amount")
    private BigDecimal collectionIntegralAmount;

    /**
     * 积分
     */
    private Integer integral;

    /**
     * 实际充值金额
     */
    @Column(name = "collection_amount")
    private BigDecimal collectionAmount;

    /**
     * 是否欠款 1:欠款/0:不欠款
     */
    @Column(name = "is_debt")
    private Integer isDebt;

    /**
     * 欠款金额
     */
    @Column(name = "debt_money")
    private BigDecimal debtMoney;

    /**
     * 提成比率
     */
    @Column(name = "type_ratio")
    private BigDecimal typeRatio;

    /**
     * 充值卡（会员卡）
     */
    private String card;

    /**
     * 第一充值人水牌号
     */
    @Column(name = "brand_number_one")
    private String brandNumberOne;

    /**
     * 第一充值人编码（来源于员工档案）
     */
    @Column(name = "sale_one_staff_id")
    private Long saleOneStaffId;

    /**
     * 第一充值人名称（来源于员工档案）
     */
    @Column(name = "sale_one_staff_name")
    private String saleOneStaffName;

    /**
     * 第一充值人占比
     */
    @Column(name = "sale_one_ratio")
    private BigDecimal saleOneRatio;

    /**
     * 第一充值会业绩
     */
    @Column(name = "sale_one_achievement_amount")
    private BigDecimal saleOneAchievementAmount;

    /**
     * 第一充值人提成
     */
    @Column(name = "sale_one_commission_amount")
    private BigDecimal saleOneCommissionAmount;

    /**
     * 第一充值人身份证号
     */
    @Column(name = "sale_one_identity_card")
    private String saleOneIdentityCard;

    /**
     * 第二充值人编码（来源于员工档案）
     */
    @Column(name = "sale_two_staff_id")
    private Long saleTwoStaffId;

    /**
     * 第二充值人名称（来源于员工档案）
     */
    @Column(name = "sale_two_staff_name")
    private String saleTwoStaffName;

    /**
     * 第二充值人身份证号
     */
    @Column(name = "sale_two_identity_card")
    private String saleTwoIdentityCard;

    /**
     * 第二充值人占比
     */
    @Column(name = "sale_two_ratio")
    private BigDecimal saleTwoRatio;

    /**
     * 第二充值人业绩
     */
    @Column(name = "sale_two_achievement_amount")
    private BigDecimal saleTwoAchievementAmount;

    /**
     * 第二充值人提成
     */
    @Column(name = "sale_two_commission_amount")
    private BigDecimal saleTwoCommissionAmount;

    /**
     * 第三充值人编码（来源于员工档案）
     */
    @Column(name = "sale_three_staff_id")
    private Long saleThreeStaffId;

    /**
     * 第三充值人名称（来源于员工档案）
     */
    @Column(name = "sale_three_staff_name")
    private String saleThreeStaffName;

    /**
     * 第三充值人身份证号
     */
    @Column(name = "sale_three_identity_card")
    private String saleThreeIdentityCard;

    /**
     * 第三充值人占比
     */
    @Column(name = "sale_three_ratio")
    private BigDecimal saleThreeRatio;

    /**
     * 第三充值人业绩
     */
    @Column(name = "sale_three_achievement_amount")
    private BigDecimal saleThreeAchievementAmount;

    /**
     * 第三充值人提成
     */
    @Column(name = "sale_three_commission_amount")
    private BigDecimal saleThreeCommissionAmount;

    /**
     * 第二充值人水牌号
     */
    @Column(name = "brand_number_two")
    private String brandNumberTwo;

    /**
     * 第三充值人水牌号
     */
    @Column(name = "brand_number_three")
    private String brandNumberThree;

    /**
     * 充值账户ID
     */
    @Column(name = "recharge_account_id")
    private Long rechargeAccountId;

    /**
     * 第四充值人编码
     */
    @Column(name = "sale_four_staff_id")
    private Long saleFourStaffId;

    /**
     * 第四充值人名称
     */
    @Column(name = "sale_four_staff_name")
    private String saleFourStaffName;

    /**
     * 第四充值人水牌号
     */
    @Column(name = "brand_number_four")
    private String brandNumberFour;

    /**
     * 第四充值人身份证号
     */
    @Column(name = "sale_four_identity_card")
    private String saleFourIdentityCard;

    /**
     * 第四充值人占比
     */
    @Column(name = "sale_four_ratio")
    private BigDecimal saleFourRatio;

    /**
     * 第四充值人业绩
     */
    @Column(name = "sale_four_achievement_amount")
    private BigDecimal saleFourAchievementAmount;

    /**
     * 第四充值人提成
     */
    @Column(name = "sale_four_commission_amount")
    private BigDecimal saleFourCommissionAmount;

    /**
     * 门店高管编码
     */
    @Column(name = "manage_staff_id")
    private Long manageStaffId;

    /**
     * 门店高管名称
     */
    @Column(name = "manage_staff_name")
    private String manageStaffName;

    /**
     * 门店高管身份证号
     */
    @Column(name = "manage_identity_card")
    private String manageIdentityCard;

    /**
     * 门店高管水牌号
     */
    @Column(name = "manage_brand_number")
    private String manageBrandNumber;

    /**
     * 充前金额
     */
    @Column(name = "before_money")
    private BigDecimal beforeMoney;

    /**
     * 充后金额
     */
    @Column(name = "after_money")
    private BigDecimal afterMoney;

    /**
     * 是否作废 1:作废/0:未作废
     */
    @Column(name = "is_cancel")
    private Integer isCancel;

    /**
     * 作废时间
     */
    @Column(name = "cancel_date")
    private Date cancelDate;

    /**
     * 充前赠送金额
     */
    @Column(name = "gift_before_money")
    private BigDecimal giftBeforeMoney;

    /**
     * 充后赠送金额
     */
    @Column(name = "gift_after_money")
    private BigDecimal giftAfterMoney;

    /**
     * 说明
     */
    private String description;

    /**
     * 业绩
     */
    @Column(name = "sale_achievement")
    private BigDecimal saleAchievement;

    /**
     * 提成
     */
    @Column(name = "sale_commission")
    private BigDecimal saleCommission;

    /**
     * 升降级卡对应ID
     */
    @Column(name = "card_num")
    private Integer cardNum;


    private List<PayList> payLists;

    private List<StaffRequest> staffLists;
    /*
    * 单据号查询时间
    * */
    private String selectDate;
    //门店员工登录账户
    private String staffPhone;

    /**
     * 录单人ID
     */
    @Column(name = "input_id")
    private Long inputId;

    /**
     * 录单人名称
     */
    @Column(name = "input_by")
    private String inputBy;

    /**
     * 作废人ID
     */
    @Column(name = "cancel_id")
    private Long cancelId;

    /**
     * 作废人名称
     */
    @Column(name = "cancel_by")
    private String cancelBy;


    private String dateStr;
    private String rechargeTypeNum;


    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;

    /**
     * 补单时间
     */
    @Column(name = "addition_date")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date additionDate;

    /**
     * 是否补单0:不是/1:是
     */
    @Column(name = "is_addition")
    private Integer isAddition;

    /**
     * 单据高管管理者
     */
    private List<Salesman> salesmens;

    /**
     * 升级前的；类型ID
     */
    private Long ids;


    /**
     * 0=正常卡，1=升级级关系卡
     */
    @Column(name = "card_type")
    private Integer cardType;

    /**
     * 升降级卡对应ID
     */
    @Column(name = "lift_card_id")
    private Long liftCardId;


    /**
     * 升降级卡对应ID
     */
    @Column(name = "raw_card_id")
    private Long rawCardId;

    /**
     * 升降级卡对应ID
     */
    @Column(name = "lift_type")
    private Integer liftType;

    /**
     * 升降级卡对应ID
     */
    @Column(name = "raw_recharge_type_id")
    private Long rawRechargeTypeId;


    /**
     * 升降级卡对应ID
     */
    @Column(name = "lift_money")
    private BigDecimal liftMoney;

    /**
     * 升降级卡对应ID
     */
    @Column(name = "lift_gift_money")
    private BigDecimal liftGiftMoney;



    /**
     * 升降级卡对应ID
     */
    @Column(name = "raw_recharge_type_num")
    private String rawRechargeTypeNum;

    @Column(name = "raw_recharge_type_name")
    private String rawRechargeTypeName;


    /**
     * 0=固定赠送，1=比例赠送
     */
    @Column(name = "donate_type")
    private Integer donateType;

    private List<Long> storeList;

    /**
     * 查询方式，0=指定查询，1=自动查询
     */
    private Integer selectType;


    /**
     * 第五充值人水牌号
     */
    @Column(name = "brand_number_five")
    private String brandNumberFive;

    /**
     * 第五充值人编码（来源于员工档案）
     */
    @Column(name = "sale_five_staff_id")
    private Long saleFiveStaffId;

    /**
     * 第五充值人名称（来源于员工档案）
     */
    @Column(name = "sale_five_staff_name")
    private String saleFiveStaffName;

    /**
     * 第五充值人占比
     */
    @Column(name = "sale_five_ratio")
    private BigDecimal saleFiveRatio;

    /**
     * 第五充值会业绩
     */
    @Column(name = "sale_five_achievement_amount")
    private BigDecimal saleFiveAchievementAmount;

    /**
     * 第五充值人提成
     */
    @Column(name = "sale_Five_commission_amount")
    private BigDecimal saleFiveCommissionAmount;

    /**
     * 第五充值人身份证号
     */
    @Column(name = "sale_Five_identity_card")
    private String saleFiveIdentityCard;


//____________
    /**
     * 第六充值人水牌号
     */
    @Column(name = "brand_number_six")
    private String brandNumberSix;

    /**
     * 第六充值人编码（来源于员工档案）
     */
    @Column(name = "sale_six_staff_id")
    private Long saleSixStaffId;

    /**
     * 第六充值人名称（来源于员工档案）
     */
    @Column(name = "sale_six_staff_name")
    private String saleSixStaffName;

    /**
     * 第六充值人占比
     */
    @Column(name = "sale_six_ratio")
    private BigDecimal saleSixRatio;

    /**
     * 第六充值会业绩
     */
    @Column(name = "sale_six_achievement_amount")
    private BigDecimal saleSixAchievementAmount;

    /**
     * 第六充值人提成
     */
    @Column(name = "sale_six_commission_amount")
    private BigDecimal saleSixCommissionAmount;

    /**
     * 第六充值人身份证号
     */
    @Column(name = "sale_six_identity_card")
    private String saleSixIdentityCard;

    //__________________

    /**
     * 第七充值人水牌号
     */
    @Column(name = "brand_number_seven")
    private String brandNumberSeven;

    /**
     * 第七充值人编码（来源于员工档案）
     */
    @Column(name = "sale_seven_staff_id")
    private Long saleSevenStaffId;

    /**
     * 第七充值人名称（来源于员工档案）
     */
    @Column(name = "sale_seven_staff_name")
    private String saleSevenStaffName;

    /**
     * 第七充值人占比
     */
    @Column(name = "sale_seven_ratio")
    private BigDecimal saleSevenRatio;

    /**
     * 第七充值会业绩
     */
    @Column(name = "sale_seven_achievement_amount")
    private BigDecimal saleSevenAchievementAmount;

    /**
     * 第七充值人提成
     */
    @Column(name = "sale_seven_commission_amount")
    private BigDecimal saleSevenCommissionAmount;

    /**
     * 第七充值人身份证号
     */
    @Column(name = "sale_seven_identity_card")
    private String saleSevenIdentityCard;


    //_________________
    /**
     * 第八充值人水牌号
     */
    @Column(name = "brand_number_eight")
    private String brandNumberEight;

    /**
     * 第八充值人编码（来源于员工档案）
     */
    @Column(name = "sale_eight_staff_id")
    private Long saleEightStaffId;

    /**
     * 第八充值人名称（来源于员工档案）
     */
    @Column(name = "sale_eight_staff_name")
    private String saleEightStaffName;

    /**
     * 第八充值人占比
     */
    @Column(name = "sale_eight_ratio")
    private BigDecimal saleEightRatio;

    /**
     * 第八充值会业绩
     */
    @Column(name = "sale_eight_achievement_amount")
    private BigDecimal saleEightAchievementAmount;

    /**
     * 第八充值人提成
     */
    @Column(name = "sale_eight_commission_amount")
    private BigDecimal saleEightCommissionAmount;

    /**
     * 第八充值人身份证号
     */
    @Column(name = "sale_eight_identity_card")
    private String saleEightIdentityCard;

    /**
     * 门店充值欠款可用百分比
     */
    @Column(name = "store_recDebtUsable")
    private String storeRecDebtUsable;

    /**
     * 赠送卡是否限制门店使用（1限制门店使用，0不限制门店使用）
     */
    @Column(name = "give_type")
    private Integer giveType;



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