|
|
@@ -1,12 +1,11 @@
|
|
|
package cn.reghao.autodop.dmaster.app.model.po;
|
|
|
|
|
|
import cn.reghao.autodop.common.msg.rpc.dto.app.StatusResult;
|
|
|
-import cn.reghao.autodop.dmaster.app.model.po.config.AppConfig;
|
|
|
-import cn.reghao.autodop.dmaster.app.model.po.config.AppDeployConfig;
|
|
|
-import cn.reghao.autodop.dmaster.app.model.po.log.BuildLog;
|
|
|
+import cn.reghao.autodop.dmaster.util.db.BaseEntity;
|
|
|
import lombok.*;
|
|
|
|
|
|
import javax.persistence.Entity;
|
|
|
+import javax.persistence.OneToOne;
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
|
/**
|
|
|
@@ -19,41 +18,16 @@ import java.time.LocalDateTime;
|
|
|
@Getter
|
|
|
@Setter
|
|
|
@Entity
|
|
|
-public class AppRunning extends AppProperty {
|
|
|
- private Integer httpPort;
|
|
|
- private String healthCheck;
|
|
|
- private String buildLogId;
|
|
|
- private String packagePath;
|
|
|
+public class AppRunning extends BaseEntity<Integer> {
|
|
|
+ @OneToOne
|
|
|
+ private AppDeploying appDeploying;
|
|
|
private Boolean isRunning;
|
|
|
private LocalDateTime startTime;
|
|
|
private Integer pid;
|
|
|
private LocalDateTime lastCheck;
|
|
|
|
|
|
- public AppRunning(AppConfig app, AppDeployConfig deployConfig) {
|
|
|
- super(app, deployConfig);
|
|
|
- this.httpPort = app.getHttpPort();
|
|
|
- this.healthCheck = app.getHealthCheck();
|
|
|
- }
|
|
|
-
|
|
|
- public AppRunning update(AppConfig app, String machineIpv4) {
|
|
|
- this.update0(app.getAppName(), machineIpv4);
|
|
|
- this.httpPort = app.getHttpPort();
|
|
|
- this.healthCheck = app.getHealthCheck();
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public AppRunning update(BuildLog buildLog, StatusResult appStatus) {
|
|
|
- this.setBuildLogId(buildLog.getId());
|
|
|
- this.setPackagePath(buildLog.getPackagePath());
|
|
|
- this.setIsRunning(appStatus.getIsRunning());
|
|
|
- this.setStartTime(appStatus.getStartTime());
|
|
|
- this.setPid(appStatus.getPid());
|
|
|
- this.setLastCheck(LocalDateTime.now());
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public AppRunning update(StatusResult appStatus) {
|
|
|
- this.setPackagePath(appStatus.getPackagePath());
|
|
|
+ public AppRunning update(AppDeploying appDeploying, StatusResult appStatus) {
|
|
|
+ this.appDeploying = appDeploying;
|
|
|
this.setIsRunning(appStatus.getIsRunning());
|
|
|
this.setStartTime(appStatus.getStartTime());
|
|
|
this.setPid(appStatus.getPid());
|