[测评系统]--测评系统核心代码库
林致杰
2021-12-02 424457cef2dfc4fe1baf580860e9f78fde7934bf
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
package com.ots.common.enums;
import lombok.Getter;
import java.util.Objects;
@Getter
public enum ReportTypeEnum {
    Brief("Brief", "简易版"), Complete("Complete", "完整版"), SAQ("SAQ", "SAQ报告"), RuiLin("RuiLin", "睿邻报告"), CAQ("CAQ", "CAQ报告"),
    JAQ("JAQ","JAQ报告"),MAQ("MAQ", "MAQ报告"),MAQV2("MAQV2", "MAQV2报告"),PAQ("PAQ", "PAQ报告"),MAQ_IAR("MAQ-IAR", "MAQ-IAR报告");
    private final String code;
    private final String message;
    ReportTypeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }
    public static ReportTypeEnum codeOf(String code) {
        for (ReportTypeEnum xxxEnum : values()) {
            //MAQ-IAR特殊处理
            if (code.contains(MAQ_IAR.code)) {
                return MAQ_IAR;
            }
            if (Objects.equals(xxxEnum.getCode(), code)) {
                return xxxEnum;
            }
        }
        throw new RuntimeException("The Report is not supported!");
    }
}