package com.iamberry.wechat.tools;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @company	深圳爱贝源科技有限公司
 * @website www.iamberry.com
 * @author 	献
 * @tel		18271840547
 * @date	2016年9月5日
 * @explain	返回数据的json格式封装
 */
public class ResponseJson implements Serializable {
	
	private static final long serialVersionUID = -8905563601242066596L;

	private int resultCode = 200;			// 请求code
	
	private String resultMsg = "SUCCESS";	// 请求code描述
	
	private Integer returnCode;				// 业务结果
	
	private Map<String, Object> message;	// 返回的结果信息
	
	public ResponseJson(int resultCode, String resultMsg, Integer returnCode) {
		this.resultCode = resultCode;
		this.resultMsg = resultMsg;
		this.returnCode = returnCode;
	}
	
	public ResponseJson() {
	}

	public int getResultCode() {
		return resultCode;
	}

	public void setResultCode(int resultCode) {
		this.resultCode = resultCode;
	}

	public String getResultMsg() {
		return resultMsg;
	}

	public void setResultMsg(String resultMsg) {
		this.resultMsg = resultMsg;
	}

	public Integer getReturnCode() {
		return returnCode;
	}

	public void setReturnCode(Integer returnCode) {
		this.returnCode = returnCode;
	}

	public Map<String, Object> getReturnMsg() {
		return message;
	}

	public void setReturnMsg(Map<String, Object> returnMsg) {
		this.message = returnMsg;
	}
	
	/**
	 * 添加返回结果 returnMsg='value'结果
	 * @param key
	 * @param value
	 */
	public void addResponseKeyValue(String value) {
		if (this.message == null) {
			message = new HashMap<String, Object>();
		}
		this.message.put("returnMsg", value);
	}

	/**
	 * 添加返回结果 key='value'结果
	 * @param key
	 * @param value
	 */
	public void addResponseKeyValue(String Key, Object value) {
		if (this.message == null) {
			message = new HashMap<String, Object>();
		}
		this.message.put(Key, value);
	}

	@Override
	public String toString() {
		String s = super.toString();
		return s;
	}
}
