修改搜索中心重构后出现问题

This commit is contained in:
zhangjun
2022-09-29 13:09:41 +08:00
parent a460bdb05b
commit 06ebf1d3fc
2 changed files with 66 additions and 27 deletions
@@ -7,6 +7,7 @@ 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.adc.da.utils.util.Utils;
import com.rabbitmq.client.Channel;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
@@ -82,8 +83,10 @@ public class SendStandMQService {
}
String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr();
Map<String,Object> attrInfoMap = new TreeMap<>();
Map<String,Object> attrInfoMapForAuth = new TreeMap<>();
if(StringUtils.isNotBlank(sarStandAttrEOStr)){
attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr);
attrInfoMapForAuth.putAll(attrInfoMap);
}
Map<String,Object> infoMap = infoEO.getAttrInfoMap();
Map<String,String> infoEOMapItems = infoEO.getMapItems();
@@ -274,6 +277,34 @@ public class SendStandMQService {
if (!"null".equals(standEnName) && StringUtils.isNotBlank(standEnName)) {
saveMap.put("standEnNameBig", standEnName.toUpperCase());
}
if ("1".equals(attrInfoMapForAuth.get("updateAuth"))) {
Map<String, Object> getAttrMap = new TreeMap<>(attrInfoMapForAuth);
if (getAttrMap != null && getAttrMap.size() > 0) {
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
String value = "";
List<String> valArr = new ArrayList<>();
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
if (StringUtils.isNotBlank(entry.getValue().toString())) {
Object json = null;
if (Utils.isJson(entry.getValue().toString())) {
json = new JSONTokener(entry.getValue().toString()).nextValue();
}
if (json instanceof org.json.JSONArray) {
valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(), String.class);
} else {
value = entry.getValue().toString();
valArr = Arrays.asList(value.split(","));
}
if (!valArr.isEmpty()) {
value = dicTypeEODao.getDicNamesByCodes(valArr, "");
}
}
saveMap.put(name + "Name",value);
}
}
}
}
if("add".equals(addOrUpdate)){
sarStandardsInfoService.insertIntoIndexForMap(saveMap);
} else {
@@ -27,6 +27,7 @@ import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.slrs.standardSplit.service.SarStandardsInfoEOService;
import com.adc.da.sys.dao.DicTypeEODao;
import com.adc.da.sys.entity.DicTypeEO;
import com.adc.da.util.http.ResponseMessage;
@@ -37,6 +38,7 @@ import com.adc.da.utils.util.InitStandAttrUtil;
import com.adc.da.utils.util.Utils;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.client.transport.TransportClient;
@@ -107,6 +109,9 @@ public class ResetSearchCenterService {
@Autowired
private SarBussStandAttrInfoDao sarBussStandAttrInfoEODao;
@Autowired
private ISarStandardsInfoService sarStandardsInfoEOService;
@PostConstruct
public void init() {
@@ -854,36 +859,39 @@ public class ResetSearchCenterService {
getAttrMap.put(clobField, fieldValue);
}
}
getAttrMap.put("updateAuth","1");
row.setAttrInfoMap(getAttrMap);
}
Map<String, Object> getAttrMap = row.getAttrInfoMap();
if (getAttrMap != null && getAttrMap.size() > 0) {
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
String value = "";
List<String> valArr = new ArrayList<>();
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
if (StringUtils.isNotBlank(entry.getValue().toString())) {
Object json = null;
if(Utils.isJson(entry.getValue().toString())){
json = new JSONTokener(entry.getValue().toString()).nextValue();
}
if (json instanceof org.json.JSONArray) {
valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(), String.class);
} else {
value = entry.getValue().toString();
valArr = Arrays.asList(value.split(","));
}
if (!valArr.isEmpty()) {
value = dicTypeEODao.getDicNamesByCodes(valArr, "");
}
}
entry.setValue(value);
}
}
}
// Map<String, Object> getAttrMap = row.getAttrInfoMap();
// if (getAttrMap != null && getAttrMap.size() > 0) {
// for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
// String name = entry.getKey();
// String value = "";
// List<String> valArr = new ArrayList<>();
// if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
// if (StringUtils.isNotBlank(entry.getValue().toString())) {
// Object json = null;
// if(Utils.isJson(entry.getValue().toString())){
// json = new JSONTokener(entry.getValue().toString()).nextValue();
// }
// if (json instanceof org.json.JSONArray) {
// valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(), String.class);
// } else {
// value = entry.getValue().toString();
// valArr = Arrays.asList(value.split(","));
// }
// if (!valArr.isEmpty()) {
// value = dicTypeEODao.getDicNamesByCodes(valArr, "");
// }
// }
// entry.setValue(value);
// }
// }
// }
// if (getAttrMap != null) {
// row.setSarStandAttrEOStr(JSONObject.toJSONString(getAttrMap));
// }
}
}