[manager] bugfix-时间自动更新未生效
This commit is contained in:
@@ -9,6 +9,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
@@ -103,12 +104,14 @@ public class Monitor {
|
||||
* 记录创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "记录创建时间(毫秒时间戳)", example = "1612198922000", accessMode = READ_ONLY, position = 10)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtCreate;
|
||||
|
||||
/**
|
||||
* 记录最新修改时间
|
||||
*/
|
||||
@ApiModelProperty(value = "记录最新修改时间(毫秒时间戳)", example = "1612198444000", accessMode = READ_ONLY, position = 11)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtUpdate;
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
@@ -74,12 +75,14 @@ public class Param {
|
||||
* 记录创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "记录创建时间(毫秒时间戳)", example = "1612198922000", accessMode = READ_ONLY, position = 5)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtCreate;
|
||||
|
||||
/**
|
||||
* 记录最新修改时间
|
||||
*/
|
||||
@ApiModelProperty(value = "记录最新修改时间(毫秒时间戳)", example = "1612198444000", accessMode = READ_ONLY, position = 6)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtUpdate;
|
||||
|
||||
}
|
||||
|
||||
@@ -126,12 +126,14 @@ public class ParamDefine {
|
||||
* 记录创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "记录创建时间(毫秒时间戳)", example = "1612198922000", accessMode = READ_ONLY, position = 11)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtCreate;
|
||||
|
||||
/**
|
||||
* 记录最新修改时间
|
||||
*/
|
||||
@ApiModelProperty(value = "记录最新修改时间(毫秒时间戳)", example = "1612198444000", accessMode = READ_ONLY, position = 12)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtUpdate;
|
||||
|
||||
@Data
|
||||
|
||||
@@ -96,8 +96,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
appDefine.setTimestamp(System.currentTimeMillis());
|
||||
List<Configmap> configmaps = params.stream().map(param -> {
|
||||
param.setMonitorId(monitorId);
|
||||
param.setGmtCreate(null);
|
||||
param.setGmtUpdate(null);
|
||||
return new Configmap(param.getField(), param.getValue(), param.getType());
|
||||
}).collect(Collectors.toList());
|
||||
appDefine.setConfigmap(configmaps);
|
||||
@@ -108,8 +106,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
monitor.setId(monitorId);
|
||||
monitor.setJobId(jobId);
|
||||
monitor.setStatus(CommonConstants.AVAILABLE);
|
||||
monitor.setGmtCreate(null);
|
||||
monitor.setGmtUpdate(null);
|
||||
monitorDao.save(monitor);
|
||||
paramDao.saveAll(params);
|
||||
} catch (Exception e) {
|
||||
@@ -224,12 +220,8 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
appDefine.setInterval(monitor.getIntervals());
|
||||
appDefine.setCyclic(true);
|
||||
appDefine.setTimestamp(System.currentTimeMillis());
|
||||
List<Configmap> configmaps = params.stream().map(param -> {
|
||||
param.setMonitorId(monitorId);
|
||||
param.setGmtCreate(null);
|
||||
param.setGmtUpdate(null);
|
||||
return new Configmap(param.getField(), param.getValue(), param.getType());
|
||||
}).collect(Collectors.toList());
|
||||
List<Configmap> configmaps = params.stream().map(param ->
|
||||
new Configmap(param.getField(), param.getValue(), param.getType())).collect(Collectors.toList());
|
||||
appDefine.setConfigmap(configmaps);
|
||||
// 更新采集任务
|
||||
jobScheduling.updateAsyncCollectJob(appDefine);
|
||||
@@ -237,8 +229,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
try {
|
||||
monitor.setJobId(preMonitor.getJobId());
|
||||
monitor.setStatus(preMonitor.getStatus());
|
||||
monitor.setGmtCreate(null);
|
||||
monitor.setGmtUpdate(null);
|
||||
monitorDao.save(monitor);
|
||||
paramDao.saveAll(params);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -37,7 +37,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
this.refresh();
|
||||
this.appsCountLoading = false;
|
||||
// https://stackoverflow.com/questions/43908009/why-is-setinterval-in-an-angular-service-only-firing-one-time
|
||||
this.interval$ = setInterval(this.refresh.bind(this), 10000);
|
||||
this.interval$ = setInterval(this.refresh.bind(this), 30000);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
|
||||
Reference in New Issue
Block a user