CompanyStatus.java
1.3 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.aigeo.common.enums;
import lombok.Getter;
/**
* 公司状态枚举
* 对应数据库字段:ai_companies.status
*
* @author AIGEO Team
* @since 1.0.0
*/
@Getter
public enum CompanyStatus {
/**
* 活跃状态 - 正常运营的付费公司
*/
ACTIVE("active", "活跃"),
/**
* 暂停状态 - 因违规或欠费被暂停服务
*/
SUSPENDED("suspended", "暂停"),
/**
* 试用状态 - 试用期内的公司,功能受限
*/
TRIAL("trial", "试用");
/**
* 数据库存储值
*/
private final String code;
/**
* 显示名称
*/
private final String displayName;
CompanyStatus(String code, String displayName) {
this.code = code;
this.displayName = displayName;
}
/**
* 根据代码获取枚举
*/
public static CompanyStatus fromCode(String code) {
for (CompanyStatus status : values()) {
if (status.code.equals(code)) {
return status;
}
}
throw new IllegalArgumentException("未知的公司状态代码: " + code);
}
/**
* 检查是否为活跃状态
*/
public boolean isActive() {
return this == ACTIVE || this == TRIAL;
}
}