看看方式
package com.server.domain;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
import com.server.utils.DateUtil;
/**
* 像素图
*
* @author dirk
*/
public class Pixmap {
private int id;
private String brief = "";//说点什么
private String unionId = "";//唯一标示
private String latticeColor = "";//格子颜色
private String lineColor = "";//线颜色
private int lineHidden = 0;//是否隐藏
private String backdropColor = "";//背景颜色
private String backdropImage = "";//背景图片
private String frontCoverImage = "";//封面分享的原图
private int numberOfSquares = 0;//格子数
private String pixels = "";//像素坐标
private String activityid = "";//活动id
private int shareTemplate = 0;// 0:不分享;1:分享
private int likenum = 0;// 点赞数
private int vlike = 0;// 虚拟点赞数
private String uid = "";// 冗余存在
private String nick = "";// 冗余存在
private String avatar = "";// 冗余存在
private int status = 1;
private Date createTime;
private Map<String, String> extraFields = new HashMap<String, String>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getBrief() {
return brief;
}
public void setBrief(String brief) {
this.brief = brief;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getLatticeColor() {
return latticeColor;
}
public void setLatticeColor(String latticeColor) {
this.latticeColor = latticeColor;
}
public String getLineColor() {
return lineColor;
}
public void setLineColor(String lineColor) {
this.lineColor = lineColor;
}
public int getLineHidden() {
return lineHidden;
}
public void setLineHidden(int lineHidden) {
this.lineHidden = lineHidden;
}
public String getBackdropColor() {
return backdropColor;
}
public void setBackdropColor(String backdropColor) {
this.backdropColor = backdropColor;
}
public String getBackdropImage() {
return backdropImage;
}
public void setBackdropImage(String backdropImage) {
this.backdropImage = backdropImage;
}
public String getFrontCoverImage() {
return frontCoverImage;
}
public void setFrontCoverImage(String frontCoverImage) {
this.frontCoverImage = frontCoverImage;
}
public int getNumberOfSquares() {
return numberOfSquares;
}
public void setNumberOfSquares(int numberOfSquares) {
this.numberOfSquares = numberOfSquares;
}
public String getPixels() {
return pixels;
}
public void setPixels(String pixels) {
this.pixels = pixels;
}
public String getActivityid() {
return activityid;
}
public void setActivityid(String activityid) {
this.activityid = activityid;
}
public int getShareTemplate() {
return shareTemplate;
}
public void setShareTemplate(int shareTemplate) {
this.shareTemplate = shareTemplate;
}
public int getLikenum() {
return likenum;
}
public void setLikenum(int likenum) {
this.likenum = likenum;
}
public int getVlike() {
return vlike;
}
public void setVlike(int vlike) {
this.vlike = vlike;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Map<String, String> getExtraFields() {
return extraFields;
}
public void setExtraFields(Map<String, String> extraFields) {
this.extraFields = extraFields;
}
public JSONObject toJson(){
JSONObject _item = new JSONObject();
_item.put("unionid", getUnionId());
_item.put("latticecolor", getLatticeColor());
_item.put("linecolor", getLineColor());
_item.put("linehidden", getLineHidden());
_item.put("backdropcolor", getBackdropColor());
_item.put("backdropimage", getBackdropImage());
_item.put("frontcoverimage", getFrontCoverImage());
_item.put("numberofsquares", getNumberOfSquares());
_item.put("pixels", getPixels());
_item.put("brief", getBrief());
_item.put("activityid", getActivityid());
_item.put("isshare", getShareTemplate()==1?true:false);
_item.put("like", getLikenum());
_item.put("uid", getUid());
_item.put("nick", getNick());
_item.put("avatar", getAvatar());
_item.put("createtime", DateUtil.sdf_ymd.format(getCreateTime()));
return _item;
}
public JSONObject toSimpleJson(){
JSONObject _item = new JSONObject();
_item.put("unionid", getUnionId());
_item.put("frontcoverimage", getFrontCoverImage());
_item.put("brief", getBrief());
_item.put("activityid", getActivityid());
_item.put("isshare", getShareTemplate()==1?true:false);
_item.put("like", getLikenum());
_item.put("uid", getUid());
_item.put("nick", getNick());
_item.put("avatar", getAvatar());
_item.put("createtime", DateUtil.sdf_ymd.format(getCreateTime()));
return _item;
}
public JSONObject toIndexJson(){
JSONObject _item = new JSONObject();
_item.put("unionid", getUnionId());
_item.put("frontcoverimage", getFrontCoverImage());
_item.put("numberofsquares", getNumberOfSquares());
return _item;
}
}