153 lines
3.0 KiB
Plaintext
153 lines
3.0 KiB
Plaintext
package com.nationalelectirc.utils;
|
|
|
|
import java.io.Serializable;
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
import com.nationalelectric.greenH5.utils.AesEncryptUtil;
|
|
import com.nationalelectric.greenH5.utils.MD5Util;
|
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
public class RestResult_secret implements Serializable {
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 1633954754563892918L;
|
|
|
|
private String returnCode;
|
|
|
|
private String returnMsg;
|
|
|
|
private Object returnData;
|
|
|
|
private String sign;
|
|
|
|
private String body;
|
|
|
|
private Boolean flag;
|
|
|
|
public RestResult_secret(String returnCode) {
|
|
this.returnCode = returnCode;
|
|
}
|
|
|
|
public RestResult_secret(String returnCode, String reason) {
|
|
this.returnCode = returnCode;
|
|
this.returnMsg = reason;
|
|
JSONObject jsonObject = JSONObject.fromObject(this);
|
|
String json = jsonObject.toString();
|
|
String aes = null;
|
|
try {
|
|
aes = AesEncryptUtil.encrypt(json);
|
|
} catch (Exception e1) {
|
|
e1.printStackTrace();
|
|
}
|
|
String md5Sign = null;
|
|
try {
|
|
md5Sign = MD5Util.encrypt(aes);
|
|
} catch (Exception e) {
|
|
}
|
|
this.sign = md5Sign;
|
|
this.body = aes;
|
|
this.returnData = null;
|
|
}
|
|
|
|
public RestResult_secret(String returnCode, Object obj) {
|
|
this.returnCode = returnCode;
|
|
this.returnData = obj;
|
|
JSONObject jsonObject = JSONObject.fromObject(this);
|
|
String json = jsonObject.toString();
|
|
String aes = null;
|
|
try {
|
|
aes = AesEncryptUtil.encrypt(json);
|
|
} catch (Exception e1) {
|
|
e1.printStackTrace();
|
|
}
|
|
String md5Sign = null;
|
|
try {
|
|
md5Sign = MD5Util.encrypt(aes);
|
|
} catch (Exception e) {
|
|
}
|
|
this.sign = md5Sign;
|
|
this.body = aes;
|
|
this.returnData = null;
|
|
}
|
|
|
|
public RestResult_secret(String returnCode, String reason, Object obj) {
|
|
this.returnCode = returnCode;
|
|
this.returnMsg = reason;
|
|
this.returnData = obj;
|
|
JSONObject jsonObject = JSONObject.fromObject(this);
|
|
String json = jsonObject.toString();
|
|
String aes = null;
|
|
try {
|
|
aes = AesEncryptUtil.encrypt(json);
|
|
} catch (Exception e1) {
|
|
}
|
|
String md5Sign = null;
|
|
try {
|
|
md5Sign = MD5Util.encrypt(aes);
|
|
} catch (Exception e) {
|
|
}
|
|
this.sign = md5Sign;
|
|
this.body = aes;
|
|
this.returnData = null;
|
|
}
|
|
//无加密返回,例子:餐券扫码使用
|
|
public RestResult_secret(String returnCode, String reason,boolean flag) {
|
|
this.returnCode = returnCode;
|
|
this.returnMsg = reason;
|
|
this.flag = flag;
|
|
}
|
|
|
|
public String getReturnCode() {
|
|
return returnCode;
|
|
}
|
|
|
|
public void setReturnCode(String returnCode) {
|
|
this.returnCode = returnCode;
|
|
}
|
|
|
|
public String getReturnMsg() {
|
|
return returnMsg;
|
|
}
|
|
|
|
public void setReturnMsg(String returnMsg) {
|
|
this.returnMsg = returnMsg;
|
|
}
|
|
|
|
public Object getReturnData() {
|
|
return returnData;
|
|
}
|
|
|
|
public void setReturnData(Object returnData) {
|
|
this.returnData = returnData;
|
|
}
|
|
|
|
public String getSign() {
|
|
return sign;
|
|
}
|
|
|
|
public void setSign(String sign) {
|
|
this.sign = sign;
|
|
}
|
|
|
|
public String getBody() {
|
|
return body;
|
|
}
|
|
|
|
public void setBody(String body) {
|
|
this.body = body;
|
|
}
|
|
|
|
public Boolean getFlag() {
|
|
return flag;
|
|
}
|
|
|
|
public void setFlag(Boolean flag) {
|
|
this.flag = flag;
|
|
}
|
|
|
|
|
|
}
|