package com.iformall.domain.po;

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

@Table(name = "wx_merchant")
public class WxMerchant 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 List<Long> userids;
	@Transient
	private List<Long> shopids;

	@Transient
	private List<WxShop> shops;

	@Transient
    private List<WxMerchantBUser> users;

	@Transient
	private Long rentContractId;

	/*租期开始时间**/
	@Transient
	private Date rentalStartDate;
	/*租期结束时间**/
	@Transient
	private Date rentalEndDate;

	/*单价**/
	@Transient
	private BigDecimal price;

	/*单价**/
	@Transient
	private Integer receivePeriod;

	/*账户类型**/
	@Transient
	private Integer accountTypeValue;

	/*账户ID**/
	@Transient
	private String accountId;

	/*账户名**/
	@Transient
	private String accountName;

	/*账户参数**/
	@Transient
	private String accountParameter;

	@Transient
	private List<Map<String,Object>> shoplist;

	@Transient
	private WxMerchantCorp wxMerchantCorp;

	@Transient
	private WxMerchantTax wxMerchantTax;

	@Transient
	private List<WxLevelConfig> levelConfigList;

	@Transient
	private Integer rentShopType;

	/*租户ID**/
	@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
	private String tenantId;
	/*商户图片**/
	@io.swagger.annotations.ApiModelProperty(value="商户图片",name="imgUrl")
	private String imgUrl;
	/*商户名**/
	@io.swagger.annotations.ApiModelProperty(value="商户名",name="name")
	private String name;
	/*联系方式**/
	@io.swagger.annotations.ApiModelProperty(value="联系方式",name="linkPhone")
	private String linkPhone;
	/*创建时间**/
	@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
	private Date createDate;
	/*更新时间**/
	@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
	private Date updateDate;
	/*停车厂商(1:ETCP)**/
	@io.swagger.annotations.ApiModelProperty(value="停车厂商(1:ETCP)",name="carVendorType")
	private Integer carVendorType;
	/*停车厂商参数**/
	@io.swagger.annotations.ApiModelProperty(value="停车厂商参数",name="carParams")
	private String carParams;
	/*商户状态**/
	@io.swagger.annotations.ApiModelProperty(value="状态1可用0停用",name="status")
	private Integer status;

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

	@io.swagger.annotations.ApiModelProperty(value="经营业态ID:参照wx_business表",name="businessId")
	private Integer businessId;

	@io.swagger.annotations.ApiModelProperty(value="子业态",name="subBusinessId")
	private Integer subBusinessId;

	@io.swagger.annotations.ApiModelProperty(value="店铺类型:1直营店2加盟店3个体店4旗舰店",name="shopType")
	private Integer shopType;

	@io.swagger.annotations.ApiModelProperty(value="品牌",name="brand")
	private Long brand;

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

	@io.swagger.annotations.ApiModelProperty(value = "是否显示在C端", name = "isPublic")
	private Integer isPublic;

	@io.swagger.annotations.ApiModelProperty(value = "邮件", name = "email")
	private String email;

	@io.swagger.annotations.ApiModelProperty(value = "副标题", name = "title")
	private String title;

	@io.swagger.annotations.ApiModelProperty(value = "封面图", name = "coverPicture")
	private String coverPicture;

	/*商户状态**/
	@io.swagger.annotations.ApiModelProperty(value="是否为商管商户 1是 0否",name="status")
	private Integer isAdmin;

	@io.swagger.annotations.ApiModelProperty(value = "待缴提醒", name = "billSetting")
	private Integer billSetting;

	public Integer getBillSetting() {
		return billSetting;
	}

	public void setBillSetting(Integer billSetting) {
		this.billSetting = billSetting;
	}

	public Integer getIsAdmin() {
		return isAdmin;
	}

	public void setIsAdmin(Integer isAdmin) {
		this.isAdmin = isAdmin;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getCoverPicture() {
		return coverPicture;
	}

	public void setCoverPicture(String coverPicture) {
		this.coverPicture = coverPicture;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public List<WxLevelConfig> getLevelConfigList() {
		return levelConfigList;
	}

	public void setLevelConfigList(List<WxLevelConfig> levelConfigList) {
		this.levelConfigList = levelConfigList;
	}

	public List<Map<String, Object>> getShoplist() {
		return shoplist;
	}

	public void setShoplist(List<Map<String, Object>> shoplist) {
		this.shoplist = shoplist;
	}

	public String  getTenantId() {
		return tenantId;
	}
	public void setTenantId(String _tenantId) {
		tenantId = _tenantId;
	}
	public String  getImgUrl() {
		return imgUrl;
	}
	public void setImgUrl(String _imgUrl) {
		imgUrl = _imgUrl;
	}
	public String  getName() {
		return name;
	}
	public void setName(String _name) {
		name = _name;
	}
	public String  getLinkPhone() {
		return linkPhone;
	}
	public void setLinkPhone(String _linkPhone) {
		linkPhone = _linkPhone;
	}

	public Date  getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date _createDate) {
		createDate = _createDate;
	}
	public Date  getUpdateDate() {
		return updateDate;
	}
	public void setUpdateDate(Date _updateDate) {
		updateDate = _updateDate;
	}
	public Integer  getCarVendorType() {
		return carVendorType;
	}
	public void setCarVendorType(Integer _carVendorType) {
		carVendorType = _carVendorType;
	}
	public String  getCarParams() {
		return carParams;
	}
	public void setCarParams(String _carParams) {
		carParams = _carParams;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public List<Long> getUserids() {
		return userids;
	}

	public void setUserids(List<Long> userids) {
		this.userids = userids;
	}

	public List<Long> getShopids() {
		return shopids;
	}

	public void setShopids(List<Long> shopids) {
		this.shopids = shopids;
	}

	public List<WxShop> getShops() {
		return shops;
	}

	public void setShops(List<WxShop> shops) {
		this.shops = shops;
	}

    public List<WxMerchantBUser> getUsers() {
        return users;
    }

    public void setUsers(List<WxMerchantBUser> users) {
        this.users = users;
	}

	public Date getRentalStartDate() {
		return rentalStartDate;
	}

	public void setRentalStartDate(Date rentalStartDate) {
		this.rentalStartDate = rentalStartDate;
	}

	public Date getRentalEndDate() {
		return rentalEndDate;
	}

	public void setRentalEndDate(Date rentalEndDate) {
		this.rentalEndDate = rentalEndDate;
	}

	public String getLinkPerson() {
		return linkPerson;
	}

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

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}


	public Integer getReceivePeriod() {
		return receivePeriod;
	}

	public void setReceivePeriod(Integer receivePeriod) {
		this.receivePeriod = receivePeriod;
	}


	public String getAccountName() {
		return accountName;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	public String getAccountId() {
		return accountId;
	}

	public void setAccountId(String accountId) {
		this.accountId = accountId;
	}

	public Integer getAccountTypeValue() {
		return accountTypeValue;
	}

	public void setAccountTypeValue(Integer accountTypeValue) {
		this.accountTypeValue = accountTypeValue;
	}

	public Long getRentContractId() {
		return rentContractId;
	}

	public void setRentContractId(Long rentContractId) {
		this.rentContractId = rentContractId;
	}

	public Integer getBusinessId() {
		return businessId;
	}

	public void setBusinessId(Integer businessId) {
		this.businessId = businessId;
	}

	public Integer getSubBusinessId() {
		return subBusinessId;
	}

	public void setSubBusinessId(Integer subBusinessId) {
		this.subBusinessId = subBusinessId;
	}

	public Integer getShopType() {
		return shopType;
	}

	public void setShopType(Integer shopType) {
		this.shopType = shopType;
	}

	public Long getBrand() {
		return brand;
	}

	public void setBrand(Long brand) {
		this.brand = brand;
	}

	public WxMerchantCorp getWxMerchantCorp() {
		return wxMerchantCorp;
	}

	public void setWxMerchantCorp(WxMerchantCorp wxMerchantCorp) {
		this.wxMerchantCorp = wxMerchantCorp;
	}

	public WxMerchantTax getWxMerchantTax() {
		return wxMerchantTax;
	}

	public void setWxMerchantTax(WxMerchantTax wxMerchantTax) {
		this.wxMerchantTax = wxMerchantTax;
	}


	public String getAccountParameter() {
		return accountParameter;
	}

	public void setAccountParameter(String accountParameter) {
		this.accountParameter = accountParameter;
	}

    public Integer getType() {
        return type;
    }

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

	public Integer getIsPublic() {
		return isPublic;
	}

	public void setIsPublic(Integer isPublic) {
		this.isPublic = isPublic;
	}

	public Integer getRentShopType() {
		return rentShopType;
	}

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

	public static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
			,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC")
			,ImgUrl_ASC("`img_url` ASC"),ImgUrl_DESC("`img_url` DESC")
			,Name_ASC("`name` ASC"),Name_DESC("`name` DESC")
			,LinkPhone_ASC("`link_phone` ASC"),LinkPhone_DESC("`link_phone` DESC")
			,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC")
			,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC")
			,CarVendorType_ASC("`car_vendor_type` ASC"),CarVendorType_DESC("`car_vendor_type` DESC")
			,CarParams_ASC("`car_params` ASC"),CarParams_DESC("`car_params` DESC")
		    ,Status_ASC("`status` ASC"),Status_DESC("`status` 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(WxMerchant.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(",");
			java.util.List<Field> fList = new java.util.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));
		}
	}
}
