feat: 搜索中心 子项目 添加 相关依赖文件 及 修改
This commit is contained in:
@@ -0,0 +1,219 @@
|
||||
package com.adc.da.search.util;
|
||||
|
||||
import com.adc.da.search.sarStandAttrDetails.entity.SarStandAttrDetails;
|
||||
import com.adc.da.search.sarStandAttrDetails.service.ISarStandAttrDetailsSearchService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 启动项目时加载标准属性信息
|
||||
* @Author: super_liu
|
||||
* date: 2020/9/7 10:54
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class InitStandAttrSearchUtil implements ApplicationRunner {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(InitStandAttrSearchUtil.class);
|
||||
|
||||
@Autowired
|
||||
private ISarStandAttrDetailsSearchService sarStandAttrDetailsEOService;
|
||||
|
||||
private final static List<String> standTypeList = new ArrayList<>();
|
||||
private final static List<String> lawsTypeList = new ArrayList<>();
|
||||
public final static List<String> standStateList = new ArrayList<>();
|
||||
static {
|
||||
standTypeList.add(SarTypeEnum.STAND.getValue());
|
||||
standTypeList.add(SarTypeEnum.INLAND_STAND.getValue());
|
||||
standTypeList.add(SarTypeEnum.FOREIGN_STAND.getValue());
|
||||
lawsTypeList.add(SarTypeEnum.LAWS.getValue());
|
||||
lawsTypeList.add(SarTypeEnum.INLAND_LAWS.getValue());
|
||||
lawsTypeList.add(SarTypeEnum.FOREIGN_LAWS.getValue());
|
||||
standStateList.add("DRAFT");
|
||||
standStateList.add("ADVICE");
|
||||
standStateList.add("RADYSUBMIT");
|
||||
standStateList.add("SUBMIT");
|
||||
standStateList.add("FJNVYX9Q7J");
|
||||
standStateList.add("ZTJJSS");
|
||||
standStateList.add("TOVOID");
|
||||
standStateList.add("ZTXXYX");
|
||||
standStateList.add("5E5Z3CELX6");
|
||||
standStateList.add("N5KLTFLNRC");
|
||||
}
|
||||
|
||||
// 标准属性字段信息
|
||||
public static String queryField = ""; //所有属性表需要查询的字段以逗号分隔
|
||||
public static String queryFieldNames = ""; //所有属性表需要查询的字段名以逗号分隔
|
||||
public static List<String> queryFieldList = new ArrayList<>(); //所有属性表需要查询的字段
|
||||
public static List<String> selectionFieldList = new ArrayList<>(); // 属性表下拉选项类型字段
|
||||
public static List<String> fileFieldList = new ArrayList<>(); // 属性表文件类型字段
|
||||
public static List<String> clobFieldList = new ArrayList<>(); // 属性表clob类型字段
|
||||
public static List<String> timeFieldList = new ArrayList<>(); // 属性表日期类型字段
|
||||
public static List<String> multiTimeFieldList = new ArrayList<>(); // 属性表多个日期类型字段
|
||||
public static List<String> numFieldList = new ArrayList<>(); // 属性表数字类型字段
|
||||
public static List<SarStandAttrDetails> standInlandAttrFieldList = new ArrayList<>(); // 全部国内标准字段属性
|
||||
public static List<SarStandAttrDetails> standForeignAttrFieldList = new ArrayList<>(); // 全部海外标准字段属性
|
||||
public static Map<String,String> selectFieldMap = new HashMap<>(); // 下拉属性字段及选项值
|
||||
|
||||
// 政策属性字段信息
|
||||
public static String queryFieldLaws = ""; //所有属性表需要查询的字段以逗号分隔
|
||||
public static String queryFieldNamesLaws = ""; //所有属性表需要查询的字段名以逗号分隔
|
||||
public static List<String> queryFieldListLaws = new ArrayList<>(); //所有属性表需要查询的字段
|
||||
public static List<String> selectionFieldListLaws = new ArrayList<>(); // 属性表下拉选项类型字段
|
||||
public static List<String> fileFieldListLaws = new ArrayList<>(); // 属性表文件类型字段
|
||||
public static List<String> clobFieldListLaws = new ArrayList<>(); // 属性表clob类型字段
|
||||
public static List<String> timeFieldListLaws = new ArrayList<>(); // 属性表日期类型字段
|
||||
public static List<String> multiTimeFieldListLaws = new ArrayList<>(); // 属性表多个日期类型字段
|
||||
public static List<String> numFieldListLaws = new ArrayList<>(); // 属性表数字类型字段
|
||||
public static List<SarStandAttrDetails> lawsInlandAttrFieldList = new ArrayList<>(); // 属性表数字类型字段
|
||||
public static List<SarStandAttrDetails> lawsForeignAttrFieldList = new ArrayList<>(); // 全部政策字段属性
|
||||
public static Map<String,String> selectFieldMapLaws = new HashMap<>(); // 下拉属性字段及选项值
|
||||
|
||||
// 企标属性字段信息
|
||||
public static String queryFieldBuss = ""; //所有属性表需要查询的字段以逗号分隔
|
||||
public static String queryFieldNamesBuss = ""; //所有属性表需要查询的字段名以逗号分隔
|
||||
public static List<String> queryFieldListBuss = new ArrayList<>(); //所有属性表需要查询的字段
|
||||
public static List<String> selectionFieldListBuss = new ArrayList<>(); // 属性表下拉选项类型字段
|
||||
public static List<String> fileFieldListBuss = new ArrayList<>(); // 属性表文件类型字段
|
||||
public static List<String> clobFieldListBuss = new ArrayList<>(); // 属性表clob类型字段
|
||||
public static List<String> timeFieldListBuss = new ArrayList<>(); // 属性表日期类型字段
|
||||
public static List<String> multiTimeFieldListBuss = new ArrayList<>(); // 属性表多个日期类型字段
|
||||
public static List<String> numFieldListBuss = new ArrayList<>(); // 属性表数字类型字段
|
||||
public static List<SarStandAttrDetails> bussAttrFieldList = new ArrayList<>(); // 全部企标字段属性
|
||||
public static Map<String,String> selectFieldMapBuss = new HashMap<>(); // 下拉属性字段及选项值
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
logger.info("项目启动时加载-搜索中心-查询标准属性类!");
|
||||
// 属性表需要查询的字段
|
||||
StringBuilder fieldInfoBuilder = new StringBuilder();
|
||||
StringBuilder fieldInfoBuilderLaws = new StringBuilder();
|
||||
StringBuilder fieldInfoBuilderBuss = new StringBuilder();
|
||||
StringBuilder fieldInfoNameBuilder = new StringBuilder();
|
||||
StringBuilder fieldInfoNameBuilderLaws = new StringBuilder();
|
||||
StringBuilder fieldInfoNameBuilderBuss = new StringBuilder();
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.eq("VALID_FLAG","0");
|
||||
qw.orderByAsc("ORDER_NUM");
|
||||
List<SarStandAttrDetails> getDetailsList = sarStandAttrDetailsEOService.list(qw);
|
||||
if (getDetailsList != null && !getDetailsList.isEmpty()) {
|
||||
logger.info("项目启动时加载-搜索中心-查询标准属性类--查询到" + getDetailsList.size() + "条属性字段数据!");
|
||||
for (SarStandAttrDetails detailsEO : getDetailsList) {
|
||||
String sarType = detailsEO.getSarType();
|
||||
String attrType = detailsEO.getAttrType();
|
||||
if (standTypeList.contains(sarType)) {
|
||||
if (!SarTypeEnum.FOREIGN_STAND.getValue().equals(sarType)) {
|
||||
standInlandAttrFieldList.add(detailsEO);
|
||||
}
|
||||
if (!SarTypeEnum.INLAND_STAND.getValue().equals(sarType)) {
|
||||
standForeignAttrFieldList.add(detailsEO);
|
||||
}
|
||||
fieldInfoBuilder.append(detailsEO.getAttrField() + ",");
|
||||
fieldInfoNameBuilder.append(detailsEO.getAttrName() + ",");
|
||||
queryFieldList.add(detailsEO.getAttrField());
|
||||
if (StandAttrTypeEnum.SELECT_OPTION.getValue().equals(attrType) || StandAttrTypeEnum.SEL_OPTS.getValue().equals(attrType)) {
|
||||
selectionFieldList.add(detailsEO.getAttrField());
|
||||
selectFieldMap.put(detailsEO.getAttrField(),detailsEO.getSelVal());
|
||||
} else if (StandAttrTypeEnum.FILE.getValue().equals(attrType)) {
|
||||
fileFieldList.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.TEXTAREA.getValue().equals(attrType) && detailsEO.getAttrLen() >= 4000) {
|
||||
clobFieldList.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.DATE_PICKER.getValue().equals(attrType)) {
|
||||
timeFieldList.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.DATE_PIC_OPTS.getValue().equals(attrType)) {
|
||||
multiTimeFieldList.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.INPUT_NUM.getValue().equals(attrType)) {
|
||||
numFieldList.add(detailsEO.getAttrField());
|
||||
}
|
||||
} else if (lawsTypeList.contains(sarType)) {
|
||||
if (!SarTypeEnum.FOREIGN_LAWS.getValue().equals(sarType)) {
|
||||
lawsInlandAttrFieldList.add(detailsEO);
|
||||
}
|
||||
if (!SarTypeEnum.INLAND_LAWS.getValue().equals(sarType)) {
|
||||
lawsForeignAttrFieldList.add(detailsEO);
|
||||
}
|
||||
fieldInfoBuilderLaws.append(detailsEO.getAttrField() + ",");
|
||||
fieldInfoNameBuilderLaws.append(detailsEO.getAttrName() + ",");
|
||||
queryFieldListLaws.add(detailsEO.getAttrField());
|
||||
if (StandAttrTypeEnum.SELECT_OPTION.getValue().equals(attrType) || StandAttrTypeEnum.SEL_OPTS.getValue().equals(attrType)) {
|
||||
selectionFieldListLaws.add(detailsEO.getAttrField());
|
||||
selectFieldMapLaws.put(detailsEO.getAttrField(),detailsEO.getSelVal());
|
||||
} else if (StandAttrTypeEnum.FILE.getValue().equals(attrType)) {
|
||||
fileFieldListLaws.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.TEXTAREA.getValue().equals(attrType) && detailsEO.getAttrLen() >= 4000) {
|
||||
clobFieldListLaws.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.DATE_PICKER.getValue().equals(attrType)) {
|
||||
timeFieldListLaws.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.DATE_PIC_OPTS.getValue().equals(attrType)) {
|
||||
multiTimeFieldListLaws.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.INPUT_NUM.getValue().equals(attrType)) {
|
||||
numFieldListLaws.add(detailsEO.getAttrField());
|
||||
}
|
||||
} else if (SarTypeEnum.BUSS.getValue().equals(sarType)) {
|
||||
bussAttrFieldList.add(detailsEO);
|
||||
fieldInfoBuilderBuss.append(detailsEO.getAttrField() + ",");
|
||||
fieldInfoNameBuilderBuss.append(detailsEO.getAttrName() + ",");
|
||||
queryFieldListBuss.add(detailsEO.getAttrField());
|
||||
if (StandAttrTypeEnum.SELECT_OPTION.getValue().equals(attrType) || StandAttrTypeEnum.SEL_OPTS.getValue().equals(attrType)) {
|
||||
selectionFieldListBuss.add(detailsEO.getAttrField());
|
||||
selectFieldMapBuss.put(detailsEO.getAttrField(),detailsEO.getSelVal());
|
||||
} else if (StandAttrTypeEnum.FILE.getValue().equals(attrType)) {
|
||||
fileFieldListBuss.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.TEXTAREA.getValue().equals(attrType) && detailsEO.getAttrLen() >= 4000) {
|
||||
clobFieldListBuss.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.DATE_PICKER.getValue().equals(attrType)) {
|
||||
timeFieldListBuss.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.DATE_PIC_OPTS.getValue().equals(attrType)) {
|
||||
multiTimeFieldListBuss.add(detailsEO.getAttrField());
|
||||
} else if (StandAttrTypeEnum.INPUT_NUM.getValue().equals(attrType)) {
|
||||
numFieldListBuss.add(detailsEO.getAttrField());
|
||||
}
|
||||
}
|
||||
}
|
||||
queryField = fieldInfoBuilder.toString();
|
||||
queryFieldLaws = fieldInfoBuilderLaws.toString();
|
||||
queryFieldBuss = fieldInfoBuilderBuss.toString();
|
||||
if (StringUtils.isNotBlank(queryField)) {
|
||||
queryField = queryField.substring(0,queryField.length()-1);
|
||||
}
|
||||
if (StringUtils.isNotBlank(queryFieldLaws)) {
|
||||
queryFieldLaws = queryFieldLaws.substring(0,queryFieldLaws.length()-1);
|
||||
}
|
||||
if (StringUtils.isNotBlank(queryFieldBuss)) {
|
||||
queryFieldBuss = queryFieldBuss.substring(0,queryFieldBuss.length()-1);
|
||||
}
|
||||
logger.info("项目启动时加载-搜索中心-查询标准属性类--查询到属性字段为:" + queryField);
|
||||
logger.info("项目启动时加载-搜索中心-查询政策属性类--查询到属性字段为:" + queryFieldLaws);
|
||||
logger.info("项目启动时加载-搜索中心-查询企标属性类--查询到属性字段为:" + queryFieldBuss);
|
||||
queryFieldNames = fieldInfoNameBuilder.toString();
|
||||
queryFieldNamesLaws = fieldInfoNameBuilderLaws.toString();
|
||||
queryFieldNamesBuss = fieldInfoNameBuilderBuss.toString();
|
||||
if (StringUtils.isNotBlank(queryFieldNames)) {
|
||||
queryFieldNames = queryFieldNames.substring(0,queryFieldNames.length()-1);
|
||||
}
|
||||
if (StringUtils.isNotBlank(queryFieldNamesLaws)) {
|
||||
queryFieldNamesLaws = queryFieldNamesLaws.substring(0,queryFieldNamesLaws.length()-1);
|
||||
}
|
||||
if (StringUtils.isNotBlank(queryFieldNamesBuss)) {
|
||||
queryFieldNamesBuss = queryFieldNamesBuss.substring(0,queryFieldNamesBuss.length()-1);
|
||||
}
|
||||
logger.info("项目启动时加载-搜索中心-查询标准属性类--查询到属性字段名称为:" + queryFieldNames);
|
||||
logger.info("项目启动时加载-搜索中心-查询政策属性类--查询到属性字段名称为:" + queryFieldNamesLaws);
|
||||
logger.info("项目启动时加载-搜索中心-查询企标属性类--查询到属性字段名称为:" + queryFieldNamesBuss);
|
||||
} else {
|
||||
logger.error("项目启动时加载-搜索中心-查询标准属性类--未查询到属性字段数据!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.adc.da.search.util;
|
||||
|
||||
/**
|
||||
* 标准法规分类
|
||||
* @author gaoyan
|
||||
* date 2018/09/19
|
||||
*/
|
||||
public enum SarTypeEnum {
|
||||
|
||||
INLAND_STAND("INLAND_STAND","国内标准法规"),INLAND_LAWS("INLAND_LAWS","国内政策"),
|
||||
FOREIGN_STAND("FOREIGN_STAND","国外标准法规"),FOREIGN_LAWS("FOREIGN_LAWS","国外政策"),
|
||||
STAND("STAND","国内外标准法规"),
|
||||
LAWS("LAWS","国内外政策"),
|
||||
BUSINESS("BUSINESS","企业标准"),
|
||||
BUSS("BUSS","企业标准"),
|
||||
SPLIT("SPLIT","标准拆分"),
|
||||
ACCESS("ACCESS","标准法规清单"),
|
||||
// 增加清单临时分类代码 后续通过同步按钮同步时切换类型
|
||||
INLAND_STAND_ACCESS("INLAND_STAND_ACCESS","国内标准法规清单"),
|
||||
FOREIGN_STAND_ACCESS("FOREIGN_STAND_ACCESS","国外标准法规清单"),
|
||||
FOREIGN_LAWS_ACCESS("FOREIGN_LAWS_ACCESS","国内外政策清单"),
|
||||
BUSS_ACCESS("BUSS","企业标准清单"),
|
||||
PRODUCT("PRODUCT","车型/项目库"),
|
||||
RECORDS("RECORDS","企标备案库");
|
||||
|
||||
private String value;
|
||||
private String lable;
|
||||
|
||||
private SarTypeEnum(String value, String lable) {
|
||||
this.value = value;
|
||||
this.lable = lable;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.adc.da.search.util;
|
||||
|
||||
/**
|
||||
* @Description: 属性类型枚举类
|
||||
* @Author: super_liu
|
||||
* date: 2020/8/17 17:02
|
||||
*/
|
||||
public enum StandAttrTypeEnum {
|
||||
|
||||
INPUT_STR("INPUT_STR","输入框(字符串)"),INPUT_NUM("INPUT_NUM","输入框(数字)"),
|
||||
SELECT_OPTION("SEL_OPTION","单选下拉框"),SEL_OPTS("SEL_OPTS","多选下拉框"),DATE_PICKER("DATE_PICKER","日期选择"),
|
||||
DATE_PIC_OPTS("DATE_PIC_OPTS","多日期选择"),FILE("FILE","文件"),
|
||||
TEXTAREA("TEXTAREA","文本框") ;
|
||||
|
||||
private String value;
|
||||
private String lable;
|
||||
|
||||
private StandAttrTypeEnum(String value, String lable) {
|
||||
this.value = value;
|
||||
this.lable = lable;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user