|
|
@@ -13,15 +13,12 @@ import cn.reghao.autodop.dmaster.app.service.bd.AppRunningService;
|
|
|
import cn.reghao.autodop.dmaster.app.service.config.AppConfigService;
|
|
|
import cn.reghao.autodop.dmaster.monitor.db.crud.AppMonitorCrud;
|
|
|
import cn.reghao.autodop.dmaster.monitor.model.po.AppMonitor;
|
|
|
+import cn.reghao.autodop.dmaster.monitor.service.AppMonitorService;
|
|
|
import cn.reghao.jdkutil.result.Result;
|
|
|
import cn.reghao.jdkutil.result.ResultStatus;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
/**
|
|
|
* @author reghao
|
|
|
* @date 2021-09-16 18:28:51
|
|
|
@@ -31,41 +28,35 @@ public class AppConfigServiceImpl implements AppConfigService {
|
|
|
private final AppConfigQuery appConfigQuery;
|
|
|
private final AppConfigCrud appConfigCrud;
|
|
|
private final BuildConfigChecker buildConfigChecker;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private AppBuildingService buildingService;
|
|
|
- @Autowired
|
|
|
- private AppDeployingService deployingService;
|
|
|
- @Autowired
|
|
|
- private AppDeployingQuery deployingQuery;
|
|
|
- @Autowired
|
|
|
- private AppRunningService runningService;
|
|
|
- @Autowired
|
|
|
- private AppDeployConfigQuery deployConfigQuery;
|
|
|
- @Autowired
|
|
|
- private AppMonitorCrud appMonitorCrud;
|
|
|
+ private AppBuildingService appBuildingService;
|
|
|
+ private AppMonitorService appMonitorService;
|
|
|
|
|
|
public AppConfigServiceImpl(AppConfigQuery appConfigQuery, AppConfigCrud appConfigCrud,
|
|
|
- BuildConfigChecker buildConfigChecker) {
|
|
|
+ BuildConfigChecker buildConfigChecker, AppBuildingService appBuildingService,
|
|
|
+ AppMonitorService appMonitorService) {
|
|
|
this.appConfigQuery = appConfigQuery;
|
|
|
this.appConfigCrud = appConfigCrud;
|
|
|
this.buildConfigChecker = buildConfigChecker;
|
|
|
+ this.appBuildingService = appBuildingService;
|
|
|
+ this.appMonitorService = appMonitorService;
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public Result add(AppConfig app) {
|
|
|
+ public Result add(AppConfig appConfig) {
|
|
|
// TODO 处理所有与 app 关联的数据
|
|
|
// TODO 不能有应用处于构建中
|
|
|
// 首先处理共享实体,将 app 的所有属性填充完整
|
|
|
try {
|
|
|
- checkSharedEntity(app);
|
|
|
+ checkSharedEntity(appConfig);
|
|
|
} catch (Exception e) {
|
|
|
return Result.fail(e.getMessage());
|
|
|
}
|
|
|
|
|
|
- appConfigCrud.save(app);
|
|
|
- String msg = String.format("添加 %s 成功", app.getAppId());
|
|
|
+ appConfigCrud.save(appConfig);
|
|
|
+ appBuildingService.add(appConfig);
|
|
|
+ appMonitorService.add(appConfig);
|
|
|
+ String msg = String.format("添加 %s 成功", appConfig.getAppId());
|
|
|
return Result.result(ResultStatus.SUCCESS, msg);
|
|
|
}
|
|
|
|
|
|
@@ -122,6 +113,6 @@ public class AppConfigServiceImpl implements AppConfigService {
|
|
|
|
|
|
// TODO 处理所有与 app 关联的数据
|
|
|
appConfigCrud.delete(app);*/
|
|
|
- return Result.result(ResultStatus.SUCCESS);
|
|
|
+ return Result.result(ResultStatus.SUCCESS, "暂未实现");
|
|
|
}
|
|
|
}
|