Commit 0c1ed10f authored by suhuiguang's avatar suhuiguang

feat(综合搜索):实体类创建

1.人员、企业、设备 2.技术参数
parent 1f9f0b33
...@@ -4,7 +4,7 @@ import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter; ...@@ -4,7 +4,7 @@ import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import lombok.Data; import lombok.Data;
@Data @Data
public class TechParamMeta { public class TechParamItem {
/** /**
* 设备种类 * 设备种类
......
package com.yeejoin.amos.boot.module.common.api.entity; package com.yeejoin.amos.boot.module.common.api.entity;
import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter; import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import com.yeejoin.amos.boot.module.common.api.dto.TechParamMeta; import com.yeejoin.amos.boot.module.common.api.dto.TechParamItem;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
...@@ -364,7 +364,7 @@ public class ESEquipmentInfo { ...@@ -364,7 +364,7 @@ public class ESEquipmentInfo {
@Field(type = FieldType.Date) @Field(type = FieldType.Date)
private Date dateValue; private Date dateValue;
public TechParam(TechParamMeta meta, Object rawValue) { public TechParam(TechParamItem meta, Object rawValue) {
this.paramKey = meta.getParamKey(); this.paramKey = meta.getParamKey();
this.paramLabel = meta.getParamLabel(); this.paramLabel = meta.getParamLabel();
setValueByType(meta.getParamType(), rawValue, meta.getMaxPrecision()); setValueByType(meta.getParamType(), rawValue, meta.getMaxPrecision());
......
...@@ -3,7 +3,7 @@ package com.yeejoin.amos.boot.module.common.biz.utils; ...@@ -3,7 +3,7 @@ package com.yeejoin.amos.boot.module.common.biz.utils;
import com.yeejoin.amos.boot.biz.common.annotation.Group; import com.yeejoin.amos.boot.biz.common.annotation.Group;
import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter; import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import com.yeejoin.amos.boot.module.common.api.dto.ITechParamDefine; import com.yeejoin.amos.boot.module.common.api.dto.ITechParamDefine;
import com.yeejoin.amos.boot.module.common.api.dto.TechParamMeta; import com.yeejoin.amos.boot.module.common.api.dto.TechParamItem;
import org.reflections.Reflections; import org.reflections.Reflections;
import java.lang.reflect.Field; import java.lang.reflect.Field;
...@@ -15,7 +15,7 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -15,7 +15,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class TechParamUtil { public class TechParamUtil {
private static final Set<Class<? extends ITechParamDefine>> subClasses; private static final Set<Class<? extends ITechParamDefine>> subClasses;
private static final Map<String, List<TechParamMeta>> techParamsMetaMap = new ConcurrentHashMap<>(); private static final Map<String, List<TechParamItem>> techParamsMetaMap = new ConcurrentHashMap<>();
static { static {
//▼ 指定扫描包路径(根据实际项目调整) //▼ 指定扫描包路径(根据实际项目调整)
...@@ -24,9 +24,9 @@ public class TechParamUtil { ...@@ -24,9 +24,9 @@ public class TechParamUtil {
subClasses = reflections.getSubTypesOf(ITechParamDefine.class); subClasses = reflections.getSubTypesOf(ITechParamDefine.class);
} }
public static List<TechParamMeta> getParamMetaList(String equListCode) { public static List<TechParamItem> getParamMetaList(String equListCode) {
return techParamsMetaMap.computeIfAbsent(equListCode, (key) -> { return techParamsMetaMap.computeIfAbsent(equListCode, (key) -> {
List<TechParamMeta> techParamMetas = new ArrayList<>(); List<TechParamItem> techParamItems = new ArrayList<>();
for (Class<? extends ITechParamDefine> subClass : subClasses) { for (Class<? extends ITechParamDefine> subClass : subClasses) {
Field[] fields = subClass.getDeclaredFields(); Field[] fields = subClass.getDeclaredFields();
Group group = subClass.getAnnotation(Group.class); Group group = subClass.getAnnotation(Group.class);
...@@ -34,16 +34,16 @@ public class TechParamUtil { ...@@ -34,16 +34,16 @@ public class TechParamUtil {
for (Field field : fields) { for (Field field : fields) {
field.setAccessible(true); field.setAccessible(true);
TechnicalParameter technicalParameter = field.getAnnotation(TechnicalParameter.class); TechnicalParameter technicalParameter = field.getAnnotation(TechnicalParameter.class);
TechParamMeta techParamMeta = new TechParamMeta(); TechParamItem techParamItem = new TechParamItem();
techParamMeta.setParamKey(technicalParameter.key()); techParamItem.setParamKey(technicalParameter.key());
techParamMeta.setParamLabel(technicalParameter.label()); techParamItem.setParamLabel(technicalParameter.label());
techParamMeta.setEquListCode(equListCode); techParamItem.setEquListCode(equListCode);
techParamMeta.setParamType(technicalParameter.type()); techParamItem.setParamType(technicalParameter.type());
techParamMetas.add(techParamMeta); techParamItems.add(techParamItem);
} }
} }
} }
return techParamMetas; return techParamItems;
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment