Browse Source

报警记录中补充信息获取添加集团编码入参

miaolijing 2 years ago
parent
commit
93727fba10

+ 1 - 1
src/main/java/com/persagy/apm/diagnose/indicatorrecord/service/impl/MonitorIndicatorRecordServiceImpl.java

@@ -861,7 +861,7 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
 
     private List<Double> getObjStaticDataFromCenterData(String projectId, String objId, String computeCode) throws Exception {
         List<Double> arrayList = new ArrayList<>();
-        List<JSONObject> objectList = centerDataService.queryObjListByObjId(projectId, Collections.singletonList(objId));
+        List<JSONObject> objectList = centerDataService.queryObjListByObjId(null,projectId, Collections.singletonList(objId));
         if (CollectionUtils.isEmpty(objectList)) {
            throw new Exception("【指标数据计算线程】:查询数据中台对象不存在,:objId:" + objId + ";信息点:" + computeCode);
         }

+ 1 - 1
src/main/java/com/persagy/apm/diagnose/maintenance/service/impl/ProjectDataRecordServiceImpl.java

@@ -217,7 +217,7 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
             }
             //新增报警
             if (!CollectionUtils.isEmpty(saveAlarmEquipIdList) && saveAlarmEquipIdList.size() > 0) {
-                List<JSONObject> objectList = centerDataService.queryObjListByObjId(projectId, saveAlarmEquipIdList);
+                List<JSONObject> objectList = centerDataService.queryObjListByObjId(projectDTO.getGroupCode(),projectId, saveAlarmEquipIdList);
                 if (!CollectionUtils.isEmpty(objectList) && objectList.size() > 0) {
                     for (JSONObject object : objectList) {
                         String classCode = object.getString("classCode");//类型编码

+ 2 - 2
src/main/java/com/persagy/apm/diagnose/service/CenterDataService.java

@@ -75,7 +75,7 @@ public class CenterDataService{
 	}
 
 
-	public List<JSONObject> queryObjListByObjId(String projectId, List<String> objIdList) throws Exception {
+	public List<JSONObject> queryObjListByObjId(String groupCode,String projectId, List<String> objIdList) throws Exception {
 		List<JSONObject> list = new ArrayList<>();
 		Map<String, Object> requestMap = new HashMap<>(16);
 		try {
@@ -84,7 +84,7 @@ public class CenterDataService{
 			criteria.put("id", objIdList);
 			criteria.put("valid", 1);
 			requestMap.put("criteria", criteria);
-			requestMap.put("groupCode", SaasContext.getContextGroupCode());
+			requestMap.put("groupCode", groupCode == null?SaasContext.getContextGroupCode():groupCode);
 			String result = centerMiddlewareClient.queryObject(requestMap);
 			JSONArray jsonArray = handleDataResult(result);
 

+ 2 - 2
src/main/java/com/persagy/apm/diagnose/service/NettyAlarmServiceImpl.java

@@ -61,7 +61,7 @@ public class NettyAlarmServiceImpl extends AlarmRecordMsgHandler {
 //            "alarm_obj_name": "yy1中文名"
 //        }
         String objId = alarmRecord.getString("objId");
-        List<JSONObject> objectList = centerDataService.queryObjListByObjId(alarmRecord.getString("projectId"), Arrays.asList(objId));
+        List<JSONObject> objectList = centerDataService.queryObjListByObjId(alarmUrlParam.getGroupCode(),alarmRecord.getString("projectId"), Arrays.asList(objId));
         JSONObject supplement = new JSONObject();
         if (!CollectionUtils.isEmpty(objectList)) {
             supplement.put("alarm_obj_name", objectList.get(0).get("localName"));
@@ -105,7 +105,7 @@ public class NettyAlarmServiceImpl extends AlarmRecordMsgHandler {
     @SneakyThrows
     @Override
     protected String getObjClassCode(AlarmUrlParam urlParam, String objId) {
-        List<JSONObject> objectList = centerDataService.queryObjListByObjId(urlParam.getProjectId(), Arrays.asList(objId));
+        List<JSONObject> objectList = centerDataService.queryObjListByObjId(urlParam.getGroupCode(),urlParam.getProjectId(), Arrays.asList(objId));
         if (!CollectionUtils.isEmpty(objectList)) {
             return objectList.get(0).getString("classCode");//设备类型编码
         }