package com.lgx8.management.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import org.json.JSONException;
import org.json.JSONObject;
import com.lgx8.common.IGridRow;
import com.lgx8.right.entities.User;
import com.lgx8.util.IdGenerator;
/**
* 消费信息
* @author pengdeyi
*
*/
@Entity
@Table(name="custmerxf")
public class Custmerxf implements Serializable,IGridRow {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.TABLE,generator=IdGenerator.CUSTMERXF_ID_GENERATOR)
@TableGenerator(
name = IdGenerator.CUSTMERXF_ID_GENERATOR,
table = IdGenerator.GENERATOR_TABLE,
pkColumnName = IdGenerator.GEN_NAME,
pkColumnValue = IdGenerator.CUSTMERXF_ID_GENERATOR,
valueColumnName = IdGenerator.GEN_VALUE,
initialValue = 1,
allocationSize = 1
)
private long ID;//系统编号
@ManyToOne
@JoinColumn(name = "hybh")
private User xfhy;
@ManyToOne
@JoinColumn(name = "xfsjbh")
private Merchant merchant;//消费商家
private double XFJE;//消费金额
private double HDJFS;//获得积分数
private String XFLX;//消费类型
private Date XFSJ;//消费时间
private String BZ;//备注
private String DELETEFLAG;//删除标注
private String RESERVATION01;
private String RESERVATION02;
private String RESERVATION03;
private Date RESERVATION04;
private double RESERVATION05;
public String getBZ() {
return BZ;
}
public void setBZ(String bz) {
BZ = bz;
}
public String getDELETEFLAG() {
return DELETEFLAG;
}
public void setDELETEFLAG(String deleteflag) {
DELETEFLAG = deleteflag;
}
public double getHDJFS() {
return HDJFS;
}
public void setHDJFS(double hdjfs) {
HDJFS = hdjfs;
}
public String getRESERVATION01() {
return RESERVATION01;
}
public void setRESERVATION01(String reservation01) {
RESERVATION01 = reservation01;
}
public String getRESERVATION02() {
return RESERVATION02;
}
public void setRESERVATION02(String reservation02) {
RESERVATION02 = reservation02;
}
public String getRESERVATION03() {
return RESERVATION03;
}
public void setRESERVATION03(String reservation03) {
RESERVATION03 = reservation03;
}
public Date getRESERVATION04() {
return RESERVATION04;
}
public void setRESERVATION04(Date reservation04) {
RESERVATION04 = reservation04;
}
public double getRESERVATION05() {
return RESERVATION05;
}
public void setRESERVATION05(double reservation05) {
RESERVATION05 = reservation05;
}
public long getID() {
return ID;
}
public void setID(long id) {
ID = id;
}
public double getXFJE() {
return XFJE;
}
public void setXFJE(double xfje) {
XFJE = xfje;
}
public String getXFLX() {
return XFLX;
}
public void setXFLX(String xflx) {
XFLX = xflx;
}
public Date getXFSJ() {
return XFSJ;
}
public void setXFSJ(Date xfsj) {
XFSJ = xfsj;
}
public Merchant getMerchant() {
return merchant;
}
public void setMerchant(Merchant merchant) {
this.merchant = merchant;
}
public User getXfhy() {
return xfhy;
}
public void setXfhy(User xfhy) {
this.xfhy = xfhy;
}
public String toJSON() {
JSONObject jObj = new JSONObject();
Merchant _mr = getMerchant();
User _u = getXfhy();
try {
jObj.put("id", getID());
jObj.put("xfsjmc", _mr==null?"":_mr.getSJMC());
jObj.put("hyxm", _u==null?"":_u.getUsername());
jObj.put("hynickName", _u==null?"":_u.getTruename());
jObj.put("hych", _u==null?"":(_u.getCard()==null?"":_u.getCard().getId()));
jObj.put("xfje", getXFJE());
jObj.put("zsjf", getHDJFS());
jObj.put("xfsj", getXFSJ());
//jObj.put("", arg1)
} catch (JSONException e) {
e.printStackTrace();
}
return jObj.toString();
}
}