KeywordSource.java
2.5 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package com.aigeo.common.enums;
import lombok.Getter;
/**
* 关键词来源枚举
* 对应数据库字段:
* - ai_keywords.source
* - ai_keyword_expansions.source
* - ai_topics.source
*
* 关键词获取渠道:
* - BAIDU: 百度关键词工具
* - GOOGLE: Google关键词规划师
* - MANUAL: 人工手动添加
* - EXPANSION: 关键词扩展生成
* - IMPORT: 批量导入
*
* @author AIGEO Team
* @since 1.0.0
*/
@Getter
public enum KeywordSource {
/**
* 百度关键词工具 - 通过百度API获取
*/
BAIDU("baidu", "百度关键词"),
/**
* Google关键词规划师 - 通过Google API获取
*/
GOOGLE("google", "Google关键词"),
/**
* 手动添加 - 用户手工输入
*/
MANUAL("manual", "手动添加"),
/**
* 关键词扩展 - 基于现有关键词扩展
*/
EXPANSION("expansion", "关键词扩展"),
/**
* 批量导入 - 从文件或其他系统导入
*/
IMPORT("import", "批量导入");
/**
* 数据库存储值
*/
private final String code;
/**
* 显示名称
*/
private final String displayName;
KeywordSource(String code, String displayName) {
this.code = code;
this.displayName = displayName;
}
/**
* 根据代码获取枚举
*/
public static KeywordSource fromCode(String code) {
for (KeywordSource source : values()) {
if (source.code.equals(code)) {
return source;
}
}
throw new IllegalArgumentException("未知的关键词来源代码: " + code);
}
/**
* 检查是否为自动获取
*/
public boolean isAutomaticSource() {
return this == BAIDU || this == GOOGLE || this == EXPANSION;
}
/**
* 检查是否需要API调用
*/
public boolean requiresApiCall() {
return this == BAIDU || this == GOOGLE;
}
/**
* 检查是否支持批量操作
*/
public boolean supportsBatchOperation() {
return this == IMPORT || this == EXPANSION;
}
/**
* 获取数据可靠性评分(1-5分)
*/
public int getReliabilityScore() {
switch (this) {
case GOOGLE:
return 5;
case BAIDU:
return 4;
case EXPANSION:
return 3;
case IMPORT:
return 2;
case MANUAL:
return 1;
default:
return 1;
}
}
}