🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
返回报文对象org.walkframework.restful.model.rsp.RspInfo ~~~ @ApiModel(description = "通用返回报文信息") public class RspInfo<T> implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "返回代码", required = true, position = 10) private Integer rspCode = RspConstants.SUCCESS; @ApiModelProperty(value = "返回备注", position = 20) private String rspDesc; @ApiModelProperty(value = "返回内容", position = 30) private T rspData; public RspInfo(){ } public RspInfo(T rspData){ this(RspConstants.SUCCESS, null, rspData); } public RspInfo(Integer rspCode, T rspData){ this(rspCode, null, rspData); } public RspInfo(Integer rspCode, String rspDesc, T rspData){ this.rspCode = rspCode; this.rspDesc = rspDesc; this.rspData = rspData; } public T getRspData() { return rspData; } public RspInfo<T> setRspData(T rspData) { this.rspData = rspData; return this; } public Integer getRspCode() { return rspCode; } public RspInfo<T> setRspCode(Integer rspCode) { this.rspCode = rspCode; return this; } public String getRspDesc() { return rspDesc; } public RspInfo<T> setRspDesc(String rspDesc) { this.rspDesc = rspDesc; return this; } } ~~~ json样例 ~~~ { "rspCode": 0, "rspDesc": "string", "rspData": { "tradeId": 0, "tradeSource": "string", "touchCode": "string" } ~~~ 返回代码含义 ~~~ /** * 返回报文常量 * * @author shf675 * */ public interface RspConstants { Integer SUCCESS = 0; Integer INTERNAL_ERROR = -1; Integer SUBMIT_METHOD_ERROR = -2; Integer VALID_ERROR = -3; Integer FORMAT_ERROR = -4; Integer UNAUTHORIZED_ERROR = -5; Integer OTHER_ERROR = -99; Map<Integer, String> RSP = new HashMap<Integer, String>() { private static final long serialVersionUID = 1L; { put(SUCCESS, "成功"); put(INTERNAL_ERROR, "内部错误"); put(SUBMIT_METHOD_ERROR, "提交方式错误"); put(VALID_ERROR, "请求报文校验错误"); put(FORMAT_ERROR, "请求报文格式错误"); put(UNAUTHORIZED_ERROR, "无权限错误"); put(OTHER_ERROR, "其他错误"); } }; } ~~~