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.sarBussionessStand.entity.SarBussionessStand;
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;
@@ -121,7 +122,22 @@ public class SendBussMQService {
saveMap.put("put_time_data",-1000000000000000000L);
}
//查询字典表,形成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));
saveMap.put("id",infoEO.getId());
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())){
@@ -217,6 +233,19 @@ public class SendBussMQService {
}
}
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);