feat: There is no way the, 新需求 调整ES 检索规则 更新 es 操作文档

This commit is contained in:
super_liu
2022-06-17 15:21:38 +08:00
parent 71ac54b05e
commit dc902ab411
10 changed files with 165 additions and 27 deletions
@@ -5,6 +5,7 @@ import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
import com.adc.da.sys.dao.DicTypeEODao;
import com.adc.da.sys.entity.DicTypeEO;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.rabbitmq.client.Channel;
import net.sf.json.JSONObject;
@@ -87,6 +88,20 @@ public class SendStandMQService {
Map<String,Object> infoMap = infoEO.getAttrInfoMap();
Map<String,String> infoEOMapItems = infoEO.getMapItems();
//查询字典表,形成Hash映射提升速度
List<DicTypeEO> dicInfo = dicTypeEODao.getDicInfo("dic_id","dic_type_code", "dic_type_name","show_index");
dicInfo = dicInfo.stream().filter(dicTypeEO -> {
if(org.apache.commons.lang3.StringUtils.isNotBlank(dicTypeEO.getDicTypeCode())){
dicTypeEO.setDicTypeCode(dicTypeEO.getDicTypeCode().replace(" ",""));
return true;
}
return false;
}).collect(Collectors.toList());
Map<String, Integer> dicMap = dicInfo.stream()
.filter(item-> ("2klxdk7fo3tvpvin70dk".equals(item.getDicId()) || "18mg1g4x0rwubcto7fdd".equals(item.getDicId()) || "08rerbsn8ucjfk13z2ci".equals(item.getDicId()) || "pnv0ik979yqogocqujwo".equals(item.getDicId())) && !item.getDicTypeCode().isEmpty())
.collect(Collectors.toMap(DicTypeEO::getDicTypeCode,DicTypeEO::getShowIndex,(value1, value2 )->value2));
// 往索引表中插入数据
String getCodeName = "";
Map<String,Object> saveMap = new HashMap<>();
@@ -101,6 +116,7 @@ public class SendStandMQService {
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getCountry(),"RFRFRFSCXVB");
saveMap.put("countryShow",codeName);
}
saveMap.put("standSortOrder",esStateOrder(String.valueOf(infoEO.getStandSort()),dicMap));
saveMap.put("standSort",infoEO.getStandSort());
saveMap.put("stand_sort",infoEO.getStandSort());
if (StringUtils.isNotEmpty(infoEO.getStandSort())) {
@@ -252,6 +268,19 @@ public class SendStandMQService {
}
}
private String esStateOrder(String data, Map<String, Integer> dicMap){
if(StringUtils.isNotBlank(data)){
data = data.replace(" ","");
if(dicMap.get(data.trim().toUpperCase()) != null){
return String.valueOf(dicMap.get(data.trim().toUpperCase()));
}else {
return "99999";
}
}else {
return "99999";
}
}
private String filterStringIsNotBlank(String str,boolean boo){
String f = ",";
return (str == null || str.equals("") || str.equals("null")) ? "" : (boo ? str+f : str);