All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zopen.wechat.pay.dto.BaseResponse Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package com.zopen.wechat.pay.dto;

import java.io.Serializable;

/**
 * 所有返回的基础属性
 *
 * @author [email protected]
 * @since 2019/8/24
 */
public class BaseResponse implements Serializable {

    private static final long serialVersionUID = 1L;

    private final static String CODE_SUCCESS = "SUCCESS";

    // 返回状态码
    private String return_code;

    // 返回信息
    private String return_msg;

    // 业务结果
    private String result_code;

    // 错误代码
    private String err_code;

    // 错误代码描述
    private String err_code_des;

    private String sign;

    public boolean success() {
        return CODE_SUCCESS.equals(return_code) && CODE_SUCCESS.equals(result_code);
    }

    public String errorInfo() {
        if (!CODE_SUCCESS.equals(return_code)) {
            return "return_code[" + return_code + "], return_msg[" + return_msg + "]";
        }
        if (!CODE_SUCCESS.equals(result_code)) {
            return "err_code[" + err_code + "], err_code_des[" + err_code_des + "]";
        }
        return null;
    }

    @Override
    public String toString() {
        return "BaseResponse{" +
                "return_code='" + return_code + '\'' +
                ", return_msg='" + return_msg + '\'' +
                ", result_code='" + result_code + '\'' +
                ", err_code='" + err_code + '\'' +
                ", err_code_des='" + err_code_des + '\'' +
                ", sign='" + sign + '\'' +
                '}';
    }

    public String getReturn_code() {
        return return_code;
    }

    public void setReturn_code(String return_code) {
        this.return_code = return_code;
    }

    public String getReturn_msg() {
        return return_msg;
    }

    public void setReturn_msg(String return_msg) {
        this.return_msg = return_msg;
    }

    public String getResult_code() {
        return result_code;
    }

    public void setResult_code(String result_code) {
        this.result_code = result_code;
    }

    public String getErr_code() {
        return err_code;
    }

    public void setErr_code(String err_code) {
        this.err_code = err_code;
    }

    public String getErr_code_des() {
        return err_code_des;
    }

    public void setErr_code_des(String err_code_des) {
        this.err_code_des = err_code_des;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy