|
|
|
|
@ -75,9 +75,10 @@ public class ConfigMonitorServiceImpl extends ServiceImpl<ConfigMonitorMapper, C |
|
|
|
|
@Override |
|
|
|
|
public void updateMonitorInfo() { |
|
|
|
|
try { |
|
|
|
|
LambdaQueryWrapper<ConfigMonitor> queryWrapper = null; |
|
|
|
|
queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
LambdaQueryWrapper<ConfigMonitor> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(BaseEntity::getIsDeleted,"0"); |
|
|
|
|
List<String> types = Arrays.asList("web","redis","mysql","service"); |
|
|
|
|
queryWrapper.in(ConfigMonitor::getType,types); |
|
|
|
|
List<ConfigMonitor> list = baseMapper.selectList(queryWrapper); |
|
|
|
|
if(CollectionUtils.isNotEmpty(list)){ |
|
|
|
|
for(ConfigMonitor monitor : list){ |
|
|
|
|
@ -137,6 +138,7 @@ public class ConfigMonitorServiceImpl extends ServiceImpl<ConfigMonitorMapper, C |
|
|
|
|
dictList.forEach(item ->{ |
|
|
|
|
dictMap.put(item.getDictKey(),item.getDictValue()); |
|
|
|
|
}); |
|
|
|
|
List<Long> parents = new ArrayList<>(); |
|
|
|
|
for(Map.Entry<Long,List<ConfigMonitor>> entry : map.entrySet()){ |
|
|
|
|
Long parentId = entry.getKey(); |
|
|
|
|
List<ConfigMonitor> monitorList = entry.getValue(); |
|
|
|
|
@ -164,8 +166,12 @@ public class ConfigMonitorServiceImpl extends ServiceImpl<ConfigMonitorMapper, C |
|
|
|
|
ConfigMonitor serviceConfigMonitor = baseMapper.selectOne(serviceWrapper); |
|
|
|
|
if(serviceConfigMonitor.getType().equals(MonitorConstant.SERVICE) && breakList.size() > 0){ |
|
|
|
|
serviceConfigMonitor.setColor("red"); |
|
|
|
|
parents.add(serviceId); |
|
|
|
|
}else{ |
|
|
|
|
serviceConfigMonitor.setColor("green"); |
|
|
|
|
//如果之前已经是红色的了,不能改为绿色
|
|
|
|
|
if(!parents.contains(serviceId)){ |
|
|
|
|
serviceConfigMonitor.setColor("green"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
baseMapper.updateById(serviceConfigMonitor); |
|
|
|
|
|
|
|
|
|
|