You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
3.5 KiB
158 lines
3.5 KiB
/* |
|
* Copyright (C), 2018-2021 |
|
* Project: starter |
|
* FileName: DataResponse |
|
* Author: Louis |
|
* Date: 2021/3/19 11:46 |
|
*/ |
|
package com.fr.plugin.mqh.dingtalksyn.bean; |
|
|
|
import com.fanruan.api.util.StringKit; |
|
import com.fr.decision.webservice.Response; |
|
import com.fr.third.fasterxml.jackson.annotation.JsonInclude; |
|
import com.fr.third.fasterxml.jackson.annotation.JsonProperty; |
|
|
|
import java.util.Map; |
|
|
|
/** |
|
* <Function Description><br> |
|
* <DataResponse> |
|
* |
|
* @author Louis |
|
* @since 1.0.0 |
|
*/ |
|
@JsonInclude(JsonInclude.Include.NON_DEFAULT) |
|
public class DataResponse extends Response { |
|
private static final long serialVersionUID = -6470353731188369521L; |
|
@JsonProperty("msg_signature") |
|
private String msgSignature; |
|
private String timeStamp; |
|
private String nonce; |
|
private String encrypt; |
|
|
|
private String code; |
|
private String message; |
|
|
|
public DataResponse() { |
|
} |
|
|
|
private static DataResponse create() { |
|
return new DataResponse(); |
|
} |
|
|
|
/** |
|
* 相应success结果 |
|
* |
|
* @return |
|
*/ |
|
public static DataResponse success(Map<String, String> successMap) { |
|
return create().msgSignature(successMap.get("msg_signature")) |
|
.timeStamp(successMap.get("timeStamp")) |
|
.nonce(successMap.get("nonce")) |
|
.encrypt(successMap.get("encrypt")); |
|
} |
|
|
|
/** |
|
* 操作结果 |
|
* |
|
* @param data |
|
* @return |
|
*/ |
|
public static DataResponse operation(String data) { |
|
return create().code("200").message("success").data(data); |
|
} |
|
|
|
/** |
|
* 报错结果 |
|
* |
|
* @param code |
|
* @param message |
|
* @return |
|
*/ |
|
public static DataResponse error(String code, String message) { |
|
return create().code(code).message(message).data(StringKit.EMPTY); |
|
} |
|
|
|
public DataResponse msgSignature(String msgSignature) { |
|
this.msgSignature = msgSignature; |
|
return this; |
|
} |
|
|
|
public DataResponse timeStamp(String timeStamp) { |
|
this.timeStamp = timeStamp; |
|
return this; |
|
} |
|
|
|
public DataResponse nonce(String nonce) { |
|
this.nonce = nonce; |
|
return this; |
|
} |
|
|
|
public DataResponse encrypt(String encrypt) { |
|
this.encrypt = encrypt; |
|
return this; |
|
} |
|
|
|
public DataResponse code(String code) { |
|
this.code = code; |
|
return this; |
|
} |
|
|
|
public DataResponse message(String message) { |
|
this.message = message; |
|
return this; |
|
} |
|
|
|
public DataResponse data(Object data) { |
|
this.setData(data); |
|
return this; |
|
} |
|
|
|
public String getMsgSignature() { |
|
return msgSignature; |
|
} |
|
|
|
public void setMsgSignature(String msgSignature) { |
|
this.msgSignature = msgSignature; |
|
} |
|
|
|
public String getTimeStamp() { |
|
return timeStamp; |
|
} |
|
|
|
public void setTimeStamp(String timeStamp) { |
|
this.timeStamp = timeStamp; |
|
} |
|
|
|
public String getNonce() { |
|
return nonce; |
|
} |
|
|
|
public void setNonce(String nonce) { |
|
this.nonce = nonce; |
|
} |
|
|
|
public String getEncrypt() { |
|
return encrypt; |
|
} |
|
|
|
public void setEncrypt(String encrypt) { |
|
this.encrypt = encrypt; |
|
} |
|
|
|
public String getCode() { |
|
return code; |
|
} |
|
|
|
public void setCode(String code) { |
|
this.code = code; |
|
} |
|
|
|
public String getMessage() { |
|
return message; |
|
} |
|
|
|
public void setMessage(String message) { |
|
this.message = message; |
|
} |
|
} |