11d65810 张雷

perf(alarm): 优化报警记录查询性能

- 在处理报警记录时,增加了对树路径字段的非空判断
- 使用 ConvertUtils.isNotEmpty() 替代了原有的判断方式
- 优化了代码结构,减少了不必要的循环和字符串操作
1 个父辈 88172627
......@@ -56,7 +56,7 @@ public class AlarmCustomRecordHistoryServiceImpl extends ServiceImpl<AlarmRecord
private IAlarmCustomRuleRepositoryService alarmCustomRuleRepositoryService;
@Autowired
private IAlarmRuleConfigPublicTabService alarmRuleConfigPublicTabService;
@Override
public Page<AlarmRecordHistoryVO> queryCustomPageList(Page<AlarmRecordHistoryVO> pageList, AlarmRecordHistoryVO alarmRecordHistoryVO) {
Page<AlarmRecordHistoryVO> pagelist = pageList.setRecords(alarmCustomRecordHistoryMapper.queryCustomPageList(pageList, alarmRecordHistoryVO));
......@@ -76,29 +76,32 @@ public class AlarmCustomRecordHistoryServiceImpl extends ServiceImpl<AlarmRecord
for(AlarmRuleConfigPublicTab alarmRuleTypeInfo : alarmRuleTypeList) {
typeDictMap.put(alarmRuleTypeInfo.getId(), alarmRuleTypeInfo.getTabName());
}
List<AlarmRecordHistoryVO> recordList = pagelist.getRecords();
if(recordList!=null&&recordList.size()>0) {
for(AlarmRecordHistoryVO record : recordList) {
String alarmCustomRuleTypeTreepath = record.getAlarmCustomRuleTypeTreepath();
String[] customRuleTypeArray = alarmCustomRuleTypeTreepath.split(",");
String customRuleTypeTreepathName = "";
for(String type : customRuleTypeArray) {
customRuleTypeTreepathName = customRuleTypeTreepathName+"/"+customDictMap.get(type);
}
if(StringUtils.isNotEmpty(customRuleTypeTreepathName)) {
record.setAlarmCustomRuleTypeTreepathName(customRuleTypeTreepathName.substring(1));
}
String alarmRuleTypeTreepath = record.getAlarmRuleTypeTreepath();
String[] ruleTypeArray = alarmRuleTypeTreepath.split(",");
String alarmRuleTypeTreepathName = "";
for(String type : ruleTypeArray) {
alarmRuleTypeTreepathName = alarmRuleTypeTreepathName+"/"+typeDictMap.get(type);
}
if(StringUtils.isNotEmpty(alarmRuleTypeTreepathName)) {
record.setAlarmRuleTypeTreepathName(alarmRuleTypeTreepathName.substring(1));
}
if(ConvertUtils.isNotEmpty(record.getAlarmCustomRuleTypeTreepath())){
String alarmCustomRuleTypeTreepath = record.getAlarmCustomRuleTypeTreepath();
String[] customRuleTypeArray = alarmCustomRuleTypeTreepath.split(",");
String customRuleTypeTreepathName = "";
for(String type : customRuleTypeArray) {
customRuleTypeTreepathName = customRuleTypeTreepathName+"/"+customDictMap.get(type);
}
if(StringUtils.isNotEmpty(customRuleTypeTreepathName)) {
record.setAlarmCustomRuleTypeTreepathName(customRuleTypeTreepathName.substring(1));
}
}
if(ConvertUtils.isNotEmpty(record.getAlarmRuleTypeTreepath())){
String alarmRuleTypeTreepath = record.getAlarmRuleTypeTreepath();
String[] ruleTypeArray = alarmRuleTypeTreepath.split(",");
String alarmRuleTypeTreepathName = "";
for(String type : ruleTypeArray) {
alarmRuleTypeTreepathName = alarmRuleTypeTreepathName+"/"+typeDictMap.get(type);
}
if(StringUtils.isNotEmpty(alarmRuleTypeTreepathName)) {
record.setAlarmRuleTypeTreepathName(alarmRuleTypeTreepathName.substring(1));
}
}
}
}
//添加流程信息
......@@ -131,7 +134,7 @@ public class AlarmCustomRecordHistoryServiceImpl extends ServiceImpl<AlarmRecord
vo.setFlow(flow);
}
}
return pagelist;
}
@Override
......@@ -153,7 +156,7 @@ public class AlarmCustomRecordHistoryServiceImpl extends ServiceImpl<AlarmRecord
Map<String,Object> noResponseMap = new HashMap<String,Object>();
noResponseMap.put("count", noResponseCount);
noResponseMap.put("responseState", "0");
resultMap.put("totalMap", totalMap);
resultMap.put("responseMap", responseMap);
resultMap.put("noResponseMap", noResponseMap);
......@@ -179,4 +182,4 @@ public class AlarmCustomRecordHistoryServiceImpl extends ServiceImpl<AlarmRecord
public void readAlarmBatch(AlarmRecordHistoryVO alarmRecordHistoryVO) {
alarmCustomRecordHistoryMapper.readAlarmBatch(alarmRecordHistoryVO);
}
}
\ No newline at end of file
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!