|
|
@@ -1,93 +0,0 @@
|
|
|
-package cn.reghao.autodop.dmaster.app.service;
|
|
|
-
|
|
|
-import cn.reghao.autodop.dmaster.app.cache.BuildDeployCache;
|
|
|
-import cn.reghao.autodop.dmaster.app.entity.log.BuildLog;
|
|
|
-import cn.reghao.autodop.dmaster.app.entity.log.DeployLog;
|
|
|
-import cn.reghao.autodop.dmaster.app.repository.config.AppOrchestrationRepository;
|
|
|
-import cn.reghao.autodop.dmaster.app.repository.log.BuildLogRepository;
|
|
|
-import cn.reghao.autodop.dmaster.app.repository.log.DeployLogRepository;
|
|
|
-import cn.reghao.autodop.dmaster.app.repository.status.BuildDeployAppRepository;
|
|
|
-import cn.reghao.autodop.dmaster.common.db.PageList;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
-import org.springframework.data.domain.PageRequest;
|
|
|
-import org.springframework.data.domain.Sort;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author reghao
|
|
|
- * @date 2020-02-28 17:10:37
|
|
|
- */
|
|
|
-@Service
|
|
|
-public class BuildService {
|
|
|
- private AppOrchestrationRepository appOrchestrationRepository;
|
|
|
- private BuildDeployCache cache;
|
|
|
- private BuildDeployAppCrudService buildDeployAppCrudService;
|
|
|
- private BuildLogRepository buildLogRepository;
|
|
|
- private DeployLogRepository deployLogRepository;
|
|
|
- private BuildDeployAppRepository buildDeployAppRepository;
|
|
|
-
|
|
|
- public BuildService(AppOrchestrationRepository appOrchestrationRepository,
|
|
|
- BuildDeployCache cache,
|
|
|
- BuildDeployAppCrudService buildDeployAppCrudService,
|
|
|
- BuildLogRepository buildLogRepository,
|
|
|
- DeployLogRepository deployLogRepository,
|
|
|
- BuildDeployAppRepository buildDeployAppRepository) {
|
|
|
- this.cache = cache;
|
|
|
- this.buildDeployAppCrudService = buildDeployAppCrudService;
|
|
|
- this.buildLogRepository = buildLogRepository;
|
|
|
- this.deployLogRepository = deployLogRepository;
|
|
|
- this.buildDeployAppRepository = buildDeployAppRepository;
|
|
|
- }
|
|
|
-
|
|
|
- public PageList<BuildLog> buildLogs(int page, int size, String env) {
|
|
|
- PageRequest pageRequest =
|
|
|
- PageRequest.of(page-1, size, Sort.by(Sort.Direction.DESC, "createTime"));
|
|
|
-
|
|
|
- Page<BuildLog> buildLogs = buildLogRepository.findAll(pageRequest);
|
|
|
- PageList<BuildLog> pageList = new PageList<>();
|
|
|
- pageList.setTotalPages(buildLogs.getTotalPages());
|
|
|
- pageList.setTotalSize(buildLogs.getTotalElements());
|
|
|
- pageList.setHasNext(buildLogs.hasNext());
|
|
|
- pageList.setList(buildLogs.getContent());
|
|
|
- return pageList;
|
|
|
- }
|
|
|
-
|
|
|
- public PageList<BuildLog> buildLogsByApp(int page, int size, String appId) {
|
|
|
- PageRequest pageRequest =
|
|
|
- PageRequest.of(page-1, size, Sort.by(Sort.Direction.DESC, "createTime"));
|
|
|
-
|
|
|
- Page<BuildLog> buildLogs = buildLogRepository.findAll(pageRequest);
|
|
|
- PageList<BuildLog> pageList = new PageList<>();
|
|
|
- pageList.setTotalPages(buildLogs.getTotalPages());
|
|
|
- pageList.setTotalSize(buildLogs.getTotalElements());
|
|
|
- pageList.setHasNext(buildLogs.hasNext());
|
|
|
- pageList.setList(buildLogs.getContent());
|
|
|
- return pageList;
|
|
|
- }
|
|
|
-
|
|
|
- public PageList<DeployLog> deployLogs(int page, int size, String env) {
|
|
|
- PageRequest pageRequest =
|
|
|
- PageRequest.of(page-1, size, Sort.by(Sort.Direction.DESC, "createTime"));
|
|
|
- Page<DeployLog> deployLogs = deployLogRepository.findAll(pageRequest);
|
|
|
-
|
|
|
- PageList<DeployLog> pageList = new PageList<>();
|
|
|
- pageList.setTotalPages(deployLogs.getTotalPages());
|
|
|
- pageList.setTotalSize(deployLogs.getTotalElements());
|
|
|
- pageList.setHasNext(deployLogs.hasNext());
|
|
|
- pageList.setList(deployLogs.getContent());
|
|
|
- return pageList;
|
|
|
- }
|
|
|
-
|
|
|
- public PageList<DeployLog> deployLogsByApp(int page, int size, String appId) {
|
|
|
- PageRequest pageRequest =
|
|
|
- PageRequest.of(page-1, size, Sort.by(Sort.Direction.DESC, "createTime"));
|
|
|
- Page<DeployLog> deployLogs = deployLogRepository.findAll(pageRequest);
|
|
|
-
|
|
|
- PageList<DeployLog> pageList = new PageList<>();
|
|
|
- pageList.setTotalPages(deployLogs.getTotalPages());
|
|
|
- pageList.setTotalSize(deployLogs.getTotalElements());
|
|
|
- pageList.setHasNext(deployLogs.hasNext());
|
|
|
- pageList.setList(deployLogs.getContent());
|
|
|
- return pageList;
|
|
|
- }
|
|
|
-}
|