|
@@ -5,22 +5,16 @@ import cn.reghao.autodop.dmaster.app.db.crud.config.AppConfigCrud;
|
|
|
import cn.reghao.autodop.dmaster.app.db.query.AppDeployingQuery;
|
|
import cn.reghao.autodop.dmaster.app.db.query.AppDeployingQuery;
|
|
|
import cn.reghao.autodop.dmaster.app.db.query.config.AppConfigQuery;
|
|
import cn.reghao.autodop.dmaster.app.db.query.config.AppConfigQuery;
|
|
|
import cn.reghao.autodop.dmaster.app.db.repository.AppRunningRepository;
|
|
import cn.reghao.autodop.dmaster.app.db.repository.AppRunningRepository;
|
|
|
-import cn.reghao.autodop.dmaster.app.model.dto.DeployConfigDto;
|
|
|
|
|
-import cn.reghao.autodop.dmaster.app.model.po.AppRunning;
|
|
|
|
|
import cn.reghao.autodop.dmaster.app.model.po.config.AppConfig;
|
|
import cn.reghao.autodop.dmaster.app.model.po.config.AppConfig;
|
|
|
import cn.reghao.autodop.dmaster.app.model.dto.NewApp;
|
|
import cn.reghao.autodop.dmaster.app.model.dto.NewApp;
|
|
|
import cn.reghao.autodop.dmaster.app.service.impl.BuildDeployConfigServiceImpl;
|
|
import cn.reghao.autodop.dmaster.app.service.impl.BuildDeployConfigServiceImpl;
|
|
|
import cn.reghao.autodop.dmaster.app.service.config.AppConfigService;
|
|
import cn.reghao.autodop.dmaster.app.service.config.AppConfigService;
|
|
|
import cn.reghao.autodop.dmaster.machine.db.query.MachineHostQuery;
|
|
import cn.reghao.autodop.dmaster.machine.db.query.MachineHostQuery;
|
|
|
-import cn.reghao.autodop.dmaster.notification.model.po.NotifyGroup;
|
|
|
|
|
import cn.reghao.jdkutil.result.Result;
|
|
import cn.reghao.jdkutil.result.Result;
|
|
|
import cn.reghao.jdkutil.result.ResultStatus;
|
|
import cn.reghao.jdkutil.result.ResultStatus;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author reghao
|
|
* @author reghao
|
|
|
* @date 2021-09-16 18:28:51
|
|
* @date 2021-09-16 18:28:51
|
|
@@ -72,45 +66,6 @@ public class AppConfigServiceImpl implements AppConfigService {
|
|
|
sharedEntityChecker.checkAndSetBuildConfig(app);
|
|
sharedEntityChecker.checkAndSetBuildConfig(app);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public Result setDeployConfig(int id, List<DeployConfigDto> deployConfigDtos) {
|
|
|
|
|
- AppConfig app = appConfigQuery.findById(id);
|
|
|
|
|
- if (app == null) {
|
|
|
|
|
- return Result.fail(String.format("id %s 不存在", id));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*PackerConfig packerConfig = app.getPackerConfig();
|
|
|
|
|
- String packType = packerConfig.getType();
|
|
|
|
|
- List<DeployConfig> list = deployConfigDtos.stream()
|
|
|
|
|
- .map(deployConfigDto -> {
|
|
|
|
|
- String machineId = deployConfigDto.getMachineId();
|
|
|
|
|
- String machineIpv4 = machineHostQuery.findByMachineId(machineId).getMachineIpv4();
|
|
|
|
|
- String startScript = deployConfigDto.getStartScript();
|
|
|
|
|
- return new DeployConfig(machineId, machineIpv4, packType, startScript);
|
|
|
|
|
- })
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
-
|
|
|
|
|
- app.setDeployConfigs(list);
|
|
|
|
|
- appConfigCrud.save(app);
|
|
|
|
|
-
|
|
|
|
|
- List<AppDeploying> appDeployings = list.stream()
|
|
|
|
|
- .map(deployConfig -> new AppDeploying(app, deployConfig)).collect(Collectors.toList());
|
|
|
|
|
- appDeployingCrud.saveAll(appDeployings);*/
|
|
|
|
|
- return Result.result(ResultStatus.SUCCESS);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public Result setNotify(int id, List<NotifyGroup> notifyGroups) {
|
|
|
|
|
- AppConfig app = appConfigQuery.findById(id);
|
|
|
|
|
- if (app == null) {
|
|
|
|
|
- return Result.fail(String.format("id %s 不存在", id));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- app.setNotifyGroups(notifyGroups);
|
|
|
|
|
- appConfigCrud.save(app);
|
|
|
|
|
- return Result.result(ResultStatus.SUCCESS);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Result copy(AppConfig from, NewApp to) {
|
|
public Result copy(AppConfig from, NewApp to) {
|
|
|
if (from == null) {
|
|
if (from == null) {
|