1
zj
2025-06-19 69d51d9510c284c52b8e330ef3ff800a35ed6aac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package project.blockchain;
 
import java.io.Serializable;
 
public enum ChannelStateEnum implements Serializable {
    STATE_SUCCESS("0", "成功"), STATE_FAIL("1", "失败"), STATE_UNKNOWN("3", "状态未知"), STATE_OTHER("4", "其它");
 
    private String code;
    private String msg;
 
    ChannelStateEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
 
    public static String getMsgByCode(String code) {
 
        for (ChannelStateEnum rspMsgEnum : ChannelStateEnum.values()) {
            if (rspMsgEnum.getCode().equals(code)) {
                return rspMsgEnum.getMsg();
            }
        }
        return "未知错误";
    }
 
    public String getCode() {
        return code;
    }
 
    public void setCode(String code) {
        this.code = code;
    }
 
    public String getMsg() {
        return msg;
    }
 
    public void setMsg(String msg) {
        this.msg = msg;
    }
}