Skip to content

Commit

Permalink
manager check style modify (#1592)
Browse files Browse the repository at this point in the history
Co-authored-by: Logic <[email protected]>
  • Loading branch information
yqxxgh and zqr10159 authored Feb 28, 2024
1 parent ce3a9b4 commit 2f85127
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class Manager {
public static void main(String[] args) {
SpringApplication.run(Manager.class, args);
}

@PostConstruct
public void init() {
System.setProperty("jdk.jndi.object.factoriesFilter", "!com.zaxxer.hikari.HikariJNDIFactory");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public byte type() {

@Data
private static class GotifyWebHookDto {
private String title;
private String message;
private Extras extras;
private String title;
private String message;
private Extras extras;


@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.hertzbeat.common.entity.alerter.Alert;
import org.dromara.hertzbeat.common.entity.manager.NoticeReceiver;
import org.dromara.hertzbeat.common.entity.manager.NoticeTemplate;
import org.dromara.hertzbeat.manager.support.exception.AlertNoticeException;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

/**
* Send alarm information by Telegram Bot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private void startCombineHistory() {
// combine history every day at 1:00 AM
LocalDateTime now = LocalDateTime.now();
LocalDateTime nextRun = now.withHour(1).withMinute(0).withSecond(0);
if(now.isAfter(nextRun)) {
if (now.isAfter(nextRun)) {
nextRun = nextRun.plusDays(1);
}
long delay = Duration.between(now, nextRun).toMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.dromara.hertzbeat.manager.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider;
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProviders;
import org.springframework.boot.autoconfigure.web.WebProperties;
Expand Down Expand Up @@ -44,6 +45,7 @@
*
*/
@Configuration
@Slf4j
public class AngularErrorViewResolver implements ErrorViewResolver, Ordered {

private static final Map<HttpStatus.Series, String> SERIES_VIEWS;
Expand Down Expand Up @@ -103,6 +105,7 @@ private ModelAndView resolveResource(String viewName, Map<String, Object> model)
return new ModelAndView(new HtmlResourceView(resource), model);
}
} catch (Exception ex) {
log.error("Error resolving resource", ex);
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,13 @@

package org.dromara.hertzbeat.manager.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.dromara.hertzbeat.common.constants.CommonConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.dromara.hertzbeat.common.entity.dto.Message;
import org.dromara.hertzbeat.common.entity.manager.Monitor;
import org.dromara.hertzbeat.manager.pojo.dto.MonitorDto;
import org.dromara.hertzbeat.manager.service.MonitorService;
import org.dromara.hertzbeat.common.constants.CommonConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class NoticeConfigController {

@Autowired
private NoticeConfigService noticeConfigService;

@PostMapping(path = "/receiver")
@Operation(summary = "Add a recipient", description = "新增一个接收人")
public ResponseEntity<Message<Void>> addNewNoticeReceiver(@Valid @RequestBody NoticeReceiver noticeReceiver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public enum Type {
OBS
}

/**
* 文件存储配置
*/
@Data
public static class ObsConfig {
private String accessKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* concurrent treemap
* @author tom
*/
public class ConcurrentTreeMap<K,V> extends TreeMap<K,V> {
public class ConcurrentTreeMap<K, V> extends TreeMap<K, V> {

private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package org.dromara.hertzbeat.manager.scheduler;

import lombok.extern.slf4j.Slf4j;
import org.dromara.hertzbeat.collector.util.CollectUtil;
import org.dromara.hertzbeat.common.constants.CommonConstants;
import org.dromara.hertzbeat.common.entity.dto.CollectorInfo;
import org.dromara.hertzbeat.common.entity.job.Configmap;
import org.dromara.hertzbeat.common.entity.job.Job;
import org.dromara.hertzbeat.common.entity.job.Metrics;
import org.dromara.hertzbeat.common.entity.manager.*;
import org.dromara.hertzbeat.manager.dao.CollectorDao;
import org.dromara.hertzbeat.manager.dao.CollectorMonitorBindDao;
Expand All @@ -19,9 +17,6 @@
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ public ServerProperties getServer() {
public void setServer(ServerProperties server) {
this.server = server;
}


/**
* server properties
*/
public static class ServerProperties {

private boolean enabled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ public void run(String... args) throws Exception {
this.start();
}

/**
* manage netty event listener
*/
public class ManageNettyEventListener implements NettyEventListener {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* ConfigService接口,提供配置的增删查改操作。
*
* <p>ConfigService interface provides CRUD operations for configurations.</p>
* @author zqr10159
* @param <T> 配置类型
* @author zqr10159
* @version 1.0
*/
public interface GeneralConfigService<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ private MonitorDto convert(ExportMonitorDTO exportMonitor) {
return monitorDto;
}

protected String
fileNamePrefix() {
protected String fileNamePrefix() {
return "hertzbeat_monitor_" + LocalDate.now();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public List<Hierarchy> getAllAppHierarchy(String lang) {
hierarchyField.setValue(item.getName());
hierarchyField.setLabel(item.getName());
hierarchyField.setIsLeaf(true);
hierarchyField.setType((byte)item.getType());
hierarchyField.setType((byte) item.getType());
hierarchyField.setUnit(item.getUnit());
return hierarchyField;
}).collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@


/**
* MailGeneralConfigServiceImpl类是通用邮件配置服务实现类,继承了AbstractGeneralConfigServiceImpl<NoticeSender>类
* MailGeneralConfigServiceImpl类是通用邮件配置服务实现类,继承了AbstractGeneralConfigServiceImpl类
* MailGeneralConfigServiceImpl class is the implementation of general email configuration service,
* which inherits the AbstractGeneralConfigServiceImpl<NoticeSender> class.
* which inherits the AbstractGeneralConfigServiceImpl class.
*
* @author zqr10159
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public String buildAlertHtmlTemplate(final Alert alert, NoticeTemplate noticeTem
model.put("nameContent", bundle.getString("alerter.notify.content"));
model.put("content", alert.getContent());
if (noticeTemplate == null) {
noticeTemplate = noticeConfigService.getDefaultNoticeTemplateByType((byte)1);
noticeTemplate = noticeConfigService.getDefaultNoticeTemplateByType((byte) 1);
}
if (noticeTemplate == null) {
throw new NullPointerException("email does not have mapping default notice template");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,8 +765,8 @@ public void copyMonitors(List<Long> ids) {

@Override
public void updateAppCollectJob(Job job) {
List<Monitor> monitors = monitorDao.findMonitorsByAppEquals(job.getApp()).
stream().filter(monitor -> monitor.getStatus() != CommonConstants.UN_MANAGE_CODE)
List<Monitor> monitors = monitorDao.findMonitorsByAppEquals(job.getApp())
.stream().filter(monitor -> monitor.getStatus() != CommonConstants.UN_MANAGE_CODE)
.collect(Collectors.toList());
List<CollectorMonitorBind> monitorBinds = collectorMonitorBindDao.findCollectorMonitorBindsByMonitorIdIn(
monitors.stream().map(Monitor::getId).collect(Collectors.toSet()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public void handler(ObjectStoreDTO<T> config) {
initObs(config);
break;
// case other object store service
default:
}
ctx.publishEvent(new ObjectStoreConfigChangeEvent(config));
}
Expand Down

0 comments on commit 2f85127

Please sign in to comment.