mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
(improvement)(Chat)Integration of tags into chat. (#798)
This commit is contained in:
@@ -15,6 +15,7 @@ public class Constants {
|
||||
public static final String COLON = ":";
|
||||
public static final String MINUS = "-";
|
||||
public static final String UNDERLINE = "_";
|
||||
public static final String DICT_VALUE = "v";
|
||||
public static final String UNDERLINE_DOUBLE = "__";
|
||||
public static final String PARENTHESES_START = "(";
|
||||
public static final String PARENTHESES_END = ")";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.tencent.supersonic.common.pojo.enums;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/***
|
||||
@@ -12,15 +13,17 @@ public enum DictWordType {
|
||||
|
||||
DIMENSION("dimension"),
|
||||
|
||||
VALUE("v"),
|
||||
VALUE("dv"),
|
||||
|
||||
VIEW("view"),
|
||||
DATASET("dataset"),
|
||||
|
||||
ENTITY("entity"),
|
||||
|
||||
NUMBER("m"),
|
||||
|
||||
TAG("t"),
|
||||
TAG("tag"),
|
||||
|
||||
TAG_VALUE("tv"),
|
||||
|
||||
SUFFIX("suffix");
|
||||
|
||||
@@ -32,7 +35,7 @@ public enum DictWordType {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
public String getTypeWithSpilt() {
|
||||
return NATURE_SPILT + type;
|
||||
}
|
||||
|
||||
@@ -41,19 +44,36 @@ public enum DictWordType {
|
||||
return null;
|
||||
}
|
||||
for (DictWordType dictWordType : values()) {
|
||||
if (nature.endsWith(dictWordType.getType())) {
|
||||
if (nature.endsWith(dictWordType.getTypeWithSpilt())) {
|
||||
return dictWordType;
|
||||
}
|
||||
}
|
||||
//view
|
||||
//dataSet
|
||||
String[] natures = nature.split(DictWordType.NATURE_SPILT);
|
||||
if (natures.length == 2 && StringUtils.isNumeric(natures[1])) {
|
||||
return VIEW;
|
||||
return DATASET;
|
||||
}
|
||||
//dimension value
|
||||
if (natures.length == 3 && StringUtils.isNumeric(natures[1]) && StringUtils.isNumeric(natures[2])) {
|
||||
if (natures.length >= 3 && StringUtils.isNumeric(natures[1]) && StringUtils.isNumeric(natures[2])) {
|
||||
return VALUE;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DictWordType of(TypeEnums type) {
|
||||
for (DictWordType wordType : DictWordType.values()) {
|
||||
if (wordType.name().equalsIgnoreCase(type.name())) {
|
||||
return wordType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getSuffixNature(TypeEnums type) {
|
||||
DictWordType wordType = of(type);
|
||||
if (Objects.nonNull(wordType)) {
|
||||
return wordType.type;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,6 @@ import com.fasterxml.jackson.databind.type.CollectionType;
|
||||
import com.fasterxml.jackson.databind.type.MapType;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.InvalidParameterException;
|
||||
@@ -25,6 +20,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@@ -32,7 +30,6 @@ public class JsonUtil {
|
||||
|
||||
public static final JsonUtil INSTANCE = new JsonUtil();
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user