|
|
|
package com.crossoverjie.cim.common.enums;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -12,16 +10,16 @@ import java.util.Map; |
|
|
|
* Date: 2018/12/26 18:38
|
|
|
|
* @since JDK 1.8
|
|
|
|
*/
|
|
|
|
public enum SystemCommandEnumType {
|
|
|
|
public enum SystemCommandEnum {
|
|
|
|
|
|
|
|
ALL(":all ","获取所有命令"),
|
|
|
|
ONLINE_USER(":olu ","获取所有在线用户"),
|
|
|
|
QUIT(":q! ","退出程序"),
|
|
|
|
QUERY(":q ","【:q 关键字】查询聊天记录"),
|
|
|
|
AI(":ai ","开启 AI 模式"),
|
|
|
|
QAI(":qai ","关闭 AI 模式"),
|
|
|
|
PREFIX(":pu ","模糊匹配用户"),
|
|
|
|
INFO(":info ","获取客户端信息")
|
|
|
|
ALL(":all ","获取所有命令","PrintAllCommand"),
|
|
|
|
ONLINE_USER(":olu ","获取所有在线用户","PrintOnlineUsersCommand"),
|
|
|
|
QUIT(":q! ","退出程序","ShutDownCommand"),
|
|
|
|
QUERY(":q ","【:q 关键字】查询聊天记录","QueryHistoryCommand"),
|
|
|
|
AI(":ai ","开启 AI 模式","OpenAIModelCommand"),
|
|
|
|
QAI(":qai ","关闭 AI 模式","CloseAIModelCommand"),
|
|
|
|
PREFIX(":pu ","模糊匹配用户","PrefixSearchCommand"),
|
|
|
|
INFO(":info ","获取客户端信息","EchoInfoCommand")
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
...
|
...
|
@@ -31,15 +29,21 @@ public enum SystemCommandEnumType { |
|
|
|
/** 枚举描述 */
|
|
|
|
private final String desc;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 实现类
|
|
|
|
*/
|
|
|
|
private final String clazz ;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 构建一个 。
|
|
|
|
* @param commandType 枚举值码。
|
|
|
|
* @param desc 枚举描述。
|
|
|
|
*/
|
|
|
|
private SystemCommandEnumType(String commandType, String desc) {
|
|
|
|
private SystemCommandEnum(String commandType, String desc, String clazz) {
|
|
|
|
this.commandType = commandType;
|
|
|
|
this.desc = desc;
|
|
|
|
this.clazz = clazz ;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -49,6 +53,13 @@ public enum SystemCommandEnumType { |
|
|
|
public String getCommandType() {
|
|
|
|
return commandType;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 获取 class。
|
|
|
|
* @return class。
|
|
|
|
*/
|
|
|
|
public String getClazz() {
|
|
|
|
return clazz;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 得到枚举描述。
|
|
...
|
...
|
@@ -80,13 +91,21 @@ public enum SystemCommandEnumType { |
|
|
|
* @return 全部枚举值码。
|
|
|
|
*/
|
|
|
|
public static Map<String,String> getAllStatusCode() {
|
|
|
|
List<String> list = new ArrayList<String>();
|
|
|
|
Map<String,String> map = new HashMap<String, String>(16) ;
|
|
|
|
for (SystemCommandEnumType status : values()) {
|
|
|
|
list.add(status.code());
|
|
|
|
for (SystemCommandEnum status : values()) {
|
|
|
|
map.put(status.getCommandType(),status.getDesc()) ;
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Map<String,String> getAllClazz() {
|
|
|
|
Map<String,String> map = new HashMap<String, String>(16) ;
|
|
|
|
for (SystemCommandEnum status : values()) {
|
|
|
|
map.put(status.getCommandType().trim(),"com.crossoverjie.cim.client.service.impl.command." + status.getClazz()) ;
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|