package com.brilliance.isc.common.esb;

import com.brilliance.isc.common.util.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import java.util.List;

/**
 * 处理结果vo
 *
 
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
public class ResultVo {

    private String respCode;

    private String respMsg;

    private boolean confirm;

    private boolean success;

    private List confirmMsg;

    private String rmatch;

    static final String FAIL_CODE = "999999";

    public void setRespMsg(String respMsg) {
        if(StringUtils.isEmpty(this.respMsg))
            this.respMsg = respMsg;
    }

    public void setRespCode(String respCode) {
        if(StringUtils.isEmpty(this.respCode))
            this.respCode = respCode;
    }

    public  void reset(){
        this.respCode="";
        this.respMsg="";
        this.success=false;
    }

    public static ResultVo fail(String message) {
        ResultVo resultVo = new ResultVo();
        resultVo.setRespCode(FAIL_CODE);
        resultVo.setRespMsg(message);
        resultVo.setSuccess(false);
        return resultVo;
    }

}
