package com.brilliance.isc.esb.model;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.util.StringUtils;

public abstract class AbsRes {
    /**
     * 系统信息头
     */
    public SysHeader SYSHEADER;
    /**
     * 交易公共信息头
     */
    public RetPublicHeader RETPUBLICHEADER;

    @JsonIgnore
    @JSONField(serialize = false)
    public boolean isSuccess() {
        if (RETPUBLICHEADER == null) {
            return false;
        }
        return "AAAAAAA".equals(RETPUBLICHEADER.PTCWDH);
    }
    @JsonIgnore
    @JSONField(serialize = false)
    public boolean isSuccess(String code) {
        if (RETPUBLICHEADER == null) {
            return false;
        }
        if(StringUtils.isEmpty(code)){
            return false;
        }
        return "AAAAAAA".equals(RETPUBLICHEADER.PTCWDH) || code.equals(RETPUBLICHEADER.PTCWDH);
    }


}
