RedisKeyEnum.java
1.73 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
64
65
66
67
68
69
70
71
package vion.constant;
import org.dromara.hutool.core.text.StrUtil;
import lombok.Getter;
import java.util.Arrays;
/**
* @author HlQ
* @date 2024/2/2
*/
@Getter
public enum RedisKeyEnum {
/**
* 字典 key
*/
DICT_PREFIX("sys:dict:"),
IMPLEMENT_TYPE("implementType"),
PROJECT_STAGE("projectStage"),
PROJECT_STATE("projectState"),
PRODUCT_TYPE("productType"),
BRAND("brand"),
ORDER_TEMP_STATUS("orderTempStatus"),
ORDER_STATUS("orderStatus"),
FAULT_TYPE("faultType"),
STATUS("status"),
SOLVE_TYPE("solveType"),
FILE_TYPE("fileType"),
SOURCE_TYPE("sourceType"),
INSPECT_TYPE("inspectType"),
FAULT_REASON("faultReason"),
SERVICE_ORDER_STATUS("serviceOrderStatus"),
SERVICE_TYPE("serviceType"),
PAY_TYPE("payType"),
CONTRACT_TYPE("contractType"),
FINANCIAL_STATUS("financialStatus"),
PRODUCT_LINE("productLine"),
CONSTRUCTION_STATUS("constructionStatus"),
DIFF_TYPE("diffType"),
OFFSET_ITEM("offset_item"),
POINT_STATUS("pointStatus"),
REPAIR_STATUS("repairStatus"),
/**
* 钉钉 key
*/
DING_PREFIX("dingtalk:"),
USER_ID("user:id:"),
USER_NAME("user:name:"),
ACCESS_TOKEN("accessToken"),
/**
* 合同同步时间
*/
CONTRACT_SYNC_TIME("contract:sync:time");
private final String val;
RedisKeyEnum(String val) {
this.val = val;
}
public static String getValByKey(String key) {
return Arrays.stream(RedisKeyEnum.values())
.filter(e -> StrUtil.equalsAnyIgnoreCase(e.name(), key))
.findFirst()
.map(RedisKeyEnum::getVal)
.orElseThrow(() -> new IllegalArgumentException("未找到对应的枚举"));
}
}