package com.iformall.domain.po;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author gongbiao
 */
@Table(name = "wx_rent_contract")
public class WxRentContract implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    protected Long id;

    @Transient
    protected List<Long> ids;
    @Transient
    protected String sortColumns;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSortColumns() {
        return sortColumns;
    }

    public List<Long> getIds() {
        return ids;
    }

    public void setIds(List<Long> ids) {
        this.ids = ids;
    }

    @Transient
    private String shopNumber;

    @Transient
    private String building;

    @Transient
    private String floor;

    @Transient
    private String brandName;

    @Transient
    private String buildArea;

    public String getBuilding() {
        return building;
    }

    public void setBuilding(String building) {
        this.building = building;
    }

    public String getFloor() {
        return floor;
    }

    public void setFloor(String floor) {
        this.floor = floor;
    }

    public String getShopNumber() {
        return shopNumber;
    }

    public void setShopNumber(String shopNumber) {
        this.shopNumber = shopNumber;
    }

    /*商户**/
    @io.swagger.annotations.ApiModelProperty(value = "商户", name = "merchantId")
    private Long merchantId;
    /*月租金/分成(分)**/
    @io.swagger.annotations.ApiModelProperty(value = "月租金/分成(分)", name = "price")
    private Integer price;
    /*计租开始时间**/
    @io.swagger.annotations.ApiModelProperty(value = "计租开始时间", name = "rentalStartDate")
    private Date rentalStartDate;
    /*计租结束时间**/
    @io.swagger.annotations.ApiModelProperty(value = "计租结束时间", name = "rentalEndDate")
    private Date rentalEndDate;
    /*签定合同时间**/
    @io.swagger.annotations.ApiModelProperty(value = "签定合同时间", name = "signDate")
    private Date signDate;
    /*付款周期**/
    @io.swagger.annotations.ApiModelProperty(value = "付款周期", name = "receivePeriod")
    private Integer receivePeriod;
    /*租户ID**/
    @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId")
    private String tenantId;
    /*合同文件路径**/
    @io.swagger.annotations.ApiModelProperty(value = "合同文件路径", name = "filepath")
    private String filepath;
    /*合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期**/
    @io.swagger.annotations.ApiModelProperty(value = "合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期", name = "status")
    private Integer status;
    /*合同编号**/
    @io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "contractNumber")
    private String contractNumber;
    /*押金**/
    @io.swagger.annotations.ApiModelProperty(value = "押金", name = "deposit")
    private Integer deposit;

    /*交租日 计租开始时间减去交租日的天数为基数 提前多少日交租**/
    @io.swagger.annotations.ApiModelProperty(value = "交租日 计租开始时间减去交租日的天数为基数 提前多少日交租", name = "payDate")
    private Integer payDate;
    /*是否删除1是0否**/
    @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel")
    private Integer isDel;
    /*商户名称**/
    @io.swagger.annotations.ApiModelProperty(value = "商户名称", name = "merchantName")
    private String merchantName;
    /*经营品牌**/
    @io.swagger.annotations.ApiModelProperty(value = "经营品牌", name = "brand")
    private Long brand;
    /*经常业态ID**/
    @io.swagger.annotations.ApiModelProperty(value = "经常业态ID", name = "businessId")
    private Integer businessId;
    /*店铺类型**/
    @io.swagger.annotations.ApiModelProperty(value = "店铺类型", name = "shopType")
    private Integer shopType;
    /*商铺ID**/
    @io.swagger.annotations.ApiModelProperty(value = "商铺ID", name = "shopId")
    private Long shopId;
    /*更新时间**/
    @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime")
    private Date updatetime;

    @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createtime")
    private Date createtime;

    @io.swagger.annotations.ApiModelProperty(value = "计租面积", name = "rentArea")
    private String rentArea;

    @io.swagger.annotations.ApiModelProperty(value = "联系人", name = "linkPerson")
    private String linkPerson;

    @io.swagger.annotations.ApiModelProperty(value = "联系电话", name = "linkPhone")
    private String linkPhone;

    @io.swagger.annotations.ApiModelProperty(value = "付款账号", name = "payAccount")
    private String payAccount;

    @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "filename")
    private String filename;

    @io.swagger.annotations.ApiModelProperty(value = "租期(月)", name = "lease")
    private Integer lease;

    @io.swagger.annotations.ApiModelProperty(value = "类型", name = "type")
    private Integer type;

    @io.swagger.annotations.ApiModelProperty(value = "调整比例", name = "adjustRatio")
    private String adjustRatio;

    @io.swagger.annotations.ApiModelProperty(value = "计租周期 1日2月", name = "adjustPeriod")
    private Integer adjustPeriod;

    @io.swagger.annotations.ApiModelProperty(value = "支付比例", name = "payRatio")
    private Integer payRatio;

    @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue")
    private Integer revenue;

    @io.swagger.annotations.ApiModelProperty(value = "起租开始时间", name = "rentalStartDate")
    private Date startDate;

    @io.swagger.annotations.ApiModelProperty(value = "起租结束时间", name = "rentalEndDate")
    private Date endDate;

    //审核状态，0未审核 1审核中 2审核通过 3驳回
    @io.swagger.annotations.ApiModelProperty(value = "审核状态", name = "applyStatus")
    private Integer applyStatus;

    // 审批流1合同2账单3终止审批
    @io.swagger.annotations.ApiModelProperty(value = "审批流类型", name = "businessType")
    private Integer businessType;

    @io.swagger.annotations.ApiModelProperty(value = "开户行", name = "bankName")
    private String bankName;

    @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType")
    private Integer rentShopType;

    @Transient
    @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams")
    private Map<String, Object> flowParams;

    @io.swagger.annotations.ApiModelProperty(value = "装修期开始时间", name = "fixStartDate")
    private Date fixStartDate;

    @io.swagger.annotations.ApiModelProperty(value = "装修期结束时间", name = "fixEndDate")
    private Date fixEndDate;

    // 租赁合同预账单列表
    @Transient
    @io.swagger.annotations.ApiModelProperty(value = "租赁合同预账单列表", name = "previewBillRentList")
    private List<WxBillRent> previewBillRentList;

    // 物业合同预账单列表
    @Transient
    @io.swagger.annotations.ApiModelProperty(value = "物业合同预账单列表", name = "reviewBillPropertyPList")
    private List<WxBillProperty> reviewBillPropertyPList;

    public List<WxBillProperty> getReviewBillPropertyPList() {
        return reviewBillPropertyPList;
    }

    public void setReviewBillPropertyPList(List<WxBillProperty> reviewBillPropertyPList) {
        this.reviewBillPropertyPList = reviewBillPropertyPList;
    }

    public List<WxBillRent> getPreviewBillRentList() {
        return previewBillRentList;
    }

    public void setPreviewBillRentList(List<WxBillRent> previewBillRentList) {
        this.previewBillRentList = previewBillRentList;
    }

    public Integer getBusinessType() {
        return businessType;
    }

    public void setBusinessType(Integer businessType) {
        this.businessType = businessType;
    }

    public Date getFixStartDate() {
        return fixStartDate;
    }

    public void setFixStartDate(Date fixStartDate) {
        this.fixStartDate = fixStartDate;
    }

    public Date getFixEndDate() {
        return fixEndDate;
    }

    public void setFixEndDate(Date fixEndDate) {
        this.fixEndDate = fixEndDate;
    }

    public Map<String, Object> getFlowParams() {
        return flowParams;
    }

    public void setFlowParams(Map<String, Object> flowParams) {
        this.flowParams = flowParams;
    }

    public Integer getApplyStatus() {
        return applyStatus;
    }

    public void setApplyStatus(Integer applyStatus) {
        this.applyStatus = applyStatus;
    }

    public Long getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(Long _merchantId) {
        merchantId = _merchantId;
    }

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer _price) {
        price = _price;
    }

    public Date getRentalStartDate() {
        return rentalStartDate;
    }

    public void setRentalStartDate(Date _rentalStartDate) {
        rentalStartDate = _rentalStartDate;
    }

    public Date getRentalEndDate() {
        return rentalEndDate;
    }

    public void setRentalEndDate(Date _rentalEndDate) {
        rentalEndDate = _rentalEndDate;
    }

    public Date getSignDate() {
        return signDate;
    }

    public void setSignDate(Date _signDate) {
        signDate = _signDate;
    }

    public Integer getReceivePeriod() {
        return receivePeriod;
    }

    public void setReceivePeriod(Integer _receivePeriod) {
        receivePeriod = _receivePeriod;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String _tenantId) {
        tenantId = _tenantId;
    }

    public String getFilepath() {
        return filepath;
    }

    public void setFilepath(String _filepath) {
        filepath = _filepath;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer _status) {
        status = _status;
    }

    public String getContractNumber() {
        return contractNumber;
    }

    public void setContractNumber(String _contractNumber) {
        contractNumber = _contractNumber;
    }

    public Integer getDeposit() {
        return deposit;
    }

    public void setDeposit(Integer _deposit) {
        deposit = _deposit;
    }

    public Integer getPayDate() {
        return payDate;
    }

    public void setPayDate(Integer _payDate) {
        payDate = _payDate;
    }

    public Integer getIsDel() {
        return isDel;
    }

    public void setIsDel(Integer _isDel) {
        isDel = _isDel;
    }

    public String getMerchantName() {
        return merchantName;
    }

    public void setMerchantName(String _merchantName) {
        merchantName = _merchantName;
    }

    public Long getBrand() {
        return brand;
    }

    public void setBrand(Long _brand) {
        brand = _brand;
    }

    public Integer getBusinessId() {
        return businessId;
    }

    public void setBusinessId(Integer _businessId) {
        businessId = _businessId;
    }

    public Integer getShopType() {
        return shopType;
    }

    public void setShopType(Integer _shopType) {
        shopType = _shopType;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long _shopId) {
        shopId = _shopId;
    }

    public Date getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(Date _updatetime) {
        updatetime = _updatetime;
    }

    public Date getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    public String getRentArea() {
        return rentArea;
    }

    public void setRentArea(String rentArea) {
        this.rentArea = rentArea;
    }

    public String getLinkPerson() {
        return linkPerson;
    }

    public void setLinkPerson(String linkPerson) {
        this.linkPerson = linkPerson;
    }

    public String getLinkPhone() {
        return linkPhone;
    }

    public void setLinkPhone(String linkPhone) {
        this.linkPhone = linkPhone;
    }

    public String getPayAccount() {
        return payAccount;
    }

    public void setPayAccount(String payAccount) {
        this.payAccount = payAccount;
    }

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public Integer getLease() {
        return lease;
    }

    public void setLease(Integer lease) {
        this.lease = lease;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getAdjustRatio() {
        return adjustRatio;
    }

    public void setAdjustRatio(String adjustRatio) {
        this.adjustRatio = adjustRatio;
    }

    public Integer getAdjustPeriod() {
        return adjustPeriod;
    }

    public void setAdjustPeriod(Integer adjustPeriod) {
        this.adjustPeriod = adjustPeriod;
    }

    public Integer getPayRatio() {
        return payRatio;
    }

    public void setPayRatio(Integer payRatio) {
        this.payRatio = payRatio;
    }

    public Integer getRevenue() {
        return revenue;
    }

    public void setRevenue(Integer revenue) {
        this.revenue = revenue;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public Integer getRentShopType() {
        return rentShopType;
    }

    public void setRentShopType(Integer rentShopType) {
        this.rentShopType = rentShopType;
    }

    public String getBuildArea() {
        return buildArea;
    }

    public void setBuildArea(String buildArea) {
        this.buildArea = buildArea;
    }

    public static enum Field {
        Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC"), Price_ASC("`price` ASC"), Price_DESC("`price` DESC"), RentalStartDate_ASC("`rental_start_date` ASC"), RentalStartDate_DESC("`rental_start_date` DESC"), RentalEndDate_ASC("`rental_end_date` ASC"), RentalEndDate_DESC("`rental_end_date` DESC"), SignDate_ASC("`sign_date` ASC"), SignDate_DESC("`sign_date` DESC"), ReceivePeriod_ASC("`receive_period` ASC"), ReceivePeriod_DESC("`receive_period` DESC"), TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), Filepath_ASC("`filepath` ASC"), Filepath_DESC("`filepath` DESC"), Status_ASC("`status` ASC"), Status_DESC("`status` DESC"), ContractNumber_ASC("`contract_number` ASC"), ContractNumber_DESC("`contract_number` DESC"), Deposit_ASC("`deposit` ASC"), Deposit_DESC("`deposit` DESC"), PayDate_ASC("`pay_date` ASC"), PayDate_DESC("`pay_date` DESC"), IsDel_ASC("`is_del` ASC"), IsDel_DESC("`is_del` DESC"), MerchantName_ASC("`merchant_name` ASC"), MerchantName_DESC("`merchant_name` DESC"), Brand_ASC("`brand` ASC"), Brand_DESC("`brand` DESC"), BusinessId_ASC("`business_id` ASC"), BusinessId_DESC("`business_id` DESC"), ShopType_ASC("`shop_type` ASC"), ShopType_DESC("`shop_type` DESC"), ShopId_ASC("`shop_id` ASC"), ShopId_DESC("`shop_id` DESC"), Updatetime_ASC("`updatetime` ASC"), Updatetime_DESC("`updatetime` DESC"), Createtime_ASC("`createtime` ASC"), Createtime_DESC("`createtime` DESC");
        private String value;

        Field(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }

        public void setCol(String value) {
            this.value = value;
        }

        @Override
        public String toString() {
            return this.getValue();
        }
    }

    public void setSortColumns(Field... fields) {
        if (fields == null || fields.length == 0) {
            return;
        }
        for (int k = 0; k < fields.length; k++) {
            if (fields[k] == null) {
                return;
            }
        }
        StringBuilder sb = new StringBuilder(fields[0].toString());
        for (int k = 1; k < fields.length; k++) {
            sb.append(",");
            sb.append(fields[k].toString());
        }
        this.sortColumns = sb.toString();
    }

    public void setSortColumns(String sortColumns) {
        if (sortColumns == null || "".equals(sortColumns.trim())) {
            return;
        }
        if (sortColumns.contains(",")) {
            String[] cols = sortColumns.split(",");
            List<Field> fList = new ArrayList();
            for (int k = 0; k < cols.length; k++) {
                fList.add(Field.valueOf(cols[k]));
            }
            this.setSortColumns(fList.toArray(new Field[fList.size()]));
        } else {
            this.setSortColumns(Field.valueOf(sortColumns));
        }
    }
}
