package com.iformall.domain.po;

import javax.persistence.*;
import java.util.*;
import javax.persistence.Transient;
import java.util.List;
import javax.persistence.Id;
import java.io.Serializable;

@Table(name = "wx_profit_sharing_order")
public class WxProfitSharingOrder 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;
	}
	
	
	
	/*接收方(商场租户id)**/
	@io.swagger.annotations.ApiModelProperty(value="接收方(商场租户id)",name="tenantId")
	private String tenantId;
	/*商户ID**/
	@io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId")
	private Long merchantId;
	/*订单ID**/
	@io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId")
	private Long orderId;
	/*分账总金额(分)**/
	@io.swagger.annotations.ApiModelProperty(value="分账总金额(分)",name="payAmount")
	private Integer payAmount;
	/*分账结束时间(秒)**/
	@io.swagger.annotations.ApiModelProperty(value="分账结束时间(秒)",name="payTimeEnd")
	private Date payTimeEnd;
	/*分账发起时间(秒)**/
	@io.swagger.annotations.ApiModelProperty(value="分账发起时间(秒)",name="payTimeStart")
	private Date payTimeStart;
	/*微信生成的支付单号**/
	@io.swagger.annotations.ApiModelProperty(value="微信生成的支付单号",name="transactionId")
	private String transactionId;
	/*微信生成分账单号**/
	@io.swagger.annotations.ApiModelProperty(value="微信生成分账单号",name="sharingOrderId")
	private String sharingOrderNo;
	/*分账类型,0单次,1多次,2完结**/
	@io.swagger.annotations.ApiModelProperty(value="分账类型",name="type")
	private Integer type;
	/*分账接收者参数**/
	@io.swagger.annotations.ApiModelProperty(value="分账接收者参数",name="receivers")
	private String receivers;
	/*分账申请失败原因**/
	@io.swagger.annotations.ApiModelProperty(value="分账申请失败原因",name="errorMsg")
	private String errorMsg;
	/*分账状态:1=提交订单失败, 2=提交业务失败,3=受理成功,4=处理中,5=处理完成,6=处理失败, 已关单,(1-2)为API返回,2具体信息在error_des中,(2-6)为查询返回**/
	@io.swagger.annotations.ApiModelProperty(value="分账状态:1=提交订单失败, 2=提交业务失败,3=受理成功,4=处理中,5=处理完成,6=处理失败, 已关单,(1-2)为API返回,2具体信息在error_des中,(2-6)为查询返回",name="sharingStatus")
	private Integer sharingStatus;
	/*更新时间**/
	@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime")
	private Date updateTime;
	/*创建时间**/
	@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime")
	private Date createTime;
	public String  getTenantId() {
		return tenantId;
	}
	public void setTenantId(String _tenantId) {
		tenantId = _tenantId;
	}
	public Long  getMerchantId() {
		return merchantId;
	}
	public void setMerchantId(Long _merchantId) {
		merchantId = _merchantId;
	}
	public Long  getOrderId() {
		return orderId;
	}
	public void setOrderId(Long _orderId) {
		orderId = _orderId;
	}
	public Integer  getPayAmount() {
		return payAmount;
	}
	public void setPayAmount(Integer _payAmount) {
		payAmount = _payAmount;
	}
	public Date  getPayTimeEnd() {
		return payTimeEnd;
	}
	public void setPayTimeEnd(Date _payTimeEnd) {
		payTimeEnd = _payTimeEnd;
	}
	public Date  getPayTimeStart() {
		return payTimeStart;
	}
	public void setPayTimeStart(Date _payTimeStart) {
		payTimeStart = _payTimeStart;
	}
	public String  getTransaction() {
		return transactionId;
	}
	public void setTransactionId(String _transactionId) {
		transactionId = _transactionId;
	}
	public String  getSharingOrderNo() {
		return sharingOrderNo;
	}
	public void setSharingOrderNo(String _sharingOrderNo) {
		sharingOrderNo = _sharingOrderNo;
	}

	public Integer getType() {
		return type;
	}

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

	public String getReceivers() {
		return receivers;
	}

	public void setReceivers(String receivers) {
		this.receivers = receivers;
	}

	public String  getErrorMsg() {
		return errorMsg;
	}
	public void setErrorMsg(String _errorMsg) {
		errorMsg = _errorMsg;
	}
	public Integer  getSharingStatus() {
		return sharingStatus;
	}
	public void setSharingStatus(Integer _sharingStatus) {
		sharingStatus = _sharingStatus;
	}
	public Date  getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date _updateTime) {
		updateTime = _updateTime;
	}
	public Date  getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date _createTime) {
		createTime = _createTime;
	}



	public static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
			,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC")
			,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC")
			,OrderId_ASC("`order_id` ASC"),OrderId_DESC("`order_id` DESC")
			,PayAmount_ASC("`pay_amount` ASC"),PayAmount_DESC("`pay_amount` DESC")
			,PayTimeEnd_ASC("`pay_time_end` ASC"),PayTimeEnd_DESC("`pay_time_end` DESC")
			,PayTimeStart_ASC("`pay_time_start` ASC"),PayTimeStart_DESC("`pay_time_start` DESC")
			,TransactionId_ASC("`transaction_id` ASC"),TransactionId_DESC("`transaction_id` DESC")
			,SharingOrderNo_ASC("`sharing_order_no` ASC"),SharingOrderNo_DESC("`sharing_order_no` DESC")
			,ErrorMsg_ASC("`error_msg` ASC"),ErrorMsg_DESC("`error_msg` DESC")
			,SharingStatus_ASC("`sharing_status` ASC"),SharingStatus_DESC("`sharing_status` DESC")
			,UpdateTime_ASC("`update_time` ASC"),UpdateTime_DESC("`update_time` DESC")
			,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` 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(WxProfitSharingOrder.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));
		}
	}
}
