大声道撒旦
This commit is contained in:
parent
dab7eb177d
commit
9441d2a7a5
@ -44,15 +44,6 @@ public class ExternalSystemApiController extends BaseController<ExternalSystem,
|
||||
return Response.success(externalSystemService.testConnection(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "同步数据")
|
||||
@PostMapping("/{id}/sync")
|
||||
public Response<Void> syncData(
|
||||
@Parameter(description = "系统ID", required = true) @PathVariable Long id
|
||||
) {
|
||||
externalSystemService.syncData(id);
|
||||
return Response.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "更新状态")
|
||||
@PutMapping("/{id}/status")
|
||||
public Response<Void> updateStatus(
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package com.qqchen.deploy.backend.deploy.api;
|
||||
|
||||
import com.qqchen.deploy.backend.framework.controller.BaseController;
|
||||
import com.qqchen.deploy.backend.deploy.entity.RepositoryGroup;
|
||||
import com.qqchen.deploy.backend.deploy.dto.RepositoryGroupDTO;
|
||||
import com.qqchen.deploy.backend.deploy.query.RepositoryGroupQuery;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* GIT分组 Controller
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/repo-group")
|
||||
@Tag(name = "GIT分组管理", description = "GIT分组管理相关接口")
|
||||
public class RepositoryGroupApiController extends BaseController<RepositoryGroup, RepositoryGroupDTO, Long, RepositoryGroupQuery> {
|
||||
|
||||
@Override
|
||||
protected void exportData(HttpServletResponse response, List<RepositoryGroupDTO> data) {
|
||||
// TODO: 实现导出逻辑
|
||||
log.info("导出GIT分组数据,数据量:{}", data.size());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.qqchen.deploy.backend.deploy.converter;
|
||||
|
||||
import com.qqchen.deploy.backend.framework.converter.BaseConverter;
|
||||
import com.qqchen.deploy.backend.deploy.entity.RepositoryGroup;
|
||||
import com.qqchen.deploy.backend.deploy.dto.RepositoryGroupDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* GIT分组 Converter
|
||||
*/
|
||||
@Mapper(config = BaseConverter.class)
|
||||
public interface RepositoryGroupConverter extends BaseConverter<RepositoryGroup, RepositoryGroupDTO> {
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.qqchen.deploy.backend.deploy.dto;
|
||||
|
||||
import com.qqchen.deploy.backend.framework.dto.BaseDTO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* GIT分组 DTO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RepositoryGroupDTO extends BaseDTO {
|
||||
|
||||
/**
|
||||
* 仓库组名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 仓库组描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 外部系统中的组ID
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 父级仓库组ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 仓库组路径
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 外部系统ID
|
||||
*/
|
||||
private Long externalSystemId;
|
||||
|
||||
/**
|
||||
* 头像URL
|
||||
*/
|
||||
private String avatarUrl;
|
||||
|
||||
/**
|
||||
* 网页URL
|
||||
*/
|
||||
private String webUrl;
|
||||
|
||||
private String visibility;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
private Boolean enabled;
|
||||
|
||||
}
|
||||
@ -12,16 +12,10 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@jakarta.persistence.Entity
|
||||
@Table(name = "deploy_repository_branch")
|
||||
@Table(name = "deploy_repo_branch")
|
||||
@LogicDelete
|
||||
public class RepositoryBranch extends Entity<Long> {
|
||||
|
||||
@Column(name = "external_system_id")
|
||||
private Long externalSystemId;
|
||||
|
||||
@Column(name = "project_id", nullable = false)
|
||||
private Long projectId;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String name;
|
||||
|
||||
@ -54,4 +48,11 @@ public class RepositoryBranch extends Entity<Long> {
|
||||
|
||||
@Column(name = "web_url")
|
||||
private String webUrl;
|
||||
|
||||
@Column(name = "project_id", nullable = false)
|
||||
private Long projectId;
|
||||
|
||||
@Column(name = "external_system_id")
|
||||
private Long externalSystemId;
|
||||
|
||||
}
|
||||
@ -20,12 +20,6 @@ import lombok.EqualsAndHashCode;
|
||||
@LogicDelete
|
||||
public class RepositoryGroup extends Entity<Long> {
|
||||
|
||||
@Column(name = "external_system_id")
|
||||
private Long externalSystemId;
|
||||
|
||||
@Column(name = "group_id", nullable = false)
|
||||
private Long groupId;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String name;
|
||||
|
||||
@ -45,8 +39,7 @@ public class RepositoryGroup extends Entity<Long> {
|
||||
@Column(name = "avatar_url")
|
||||
private String avatarUrl;
|
||||
|
||||
@Column(nullable = false)
|
||||
private Boolean enabled = true;
|
||||
@Column(name = "external_system_id")
|
||||
private Long externalSystemId;
|
||||
|
||||
private Integer sort = 0;
|
||||
}
|
||||
@ -12,15 +12,10 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@jakarta.persistence.Entity
|
||||
@Table(name = "deploy_repository_project")
|
||||
@Table(name = "deploy_repo_project")
|
||||
@LogicDelete
|
||||
public class RepositoryProject extends Entity<Long> {
|
||||
|
||||
@Column(name = "external_system_id")
|
||||
private Long externalSystemId;
|
||||
|
||||
@Column(name = "project_id", nullable = false)
|
||||
private Long projectId;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String name;
|
||||
@ -50,8 +45,9 @@ public class RepositoryProject extends Entity<Long> {
|
||||
@Column(name = "last_activity_at")
|
||||
private LocalDateTime lastActivityAt;
|
||||
|
||||
@Column(nullable = false)
|
||||
private Boolean enabled = true;
|
||||
@Column(name = "external_system_id")
|
||||
private Long externalSystemId;
|
||||
|
||||
private Integer sort = 0;
|
||||
@Column(name = "project_id", nullable = false)
|
||||
private Long projectId;
|
||||
}
|
||||
@ -14,7 +14,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@jakarta.persistence.Entity
|
||||
@Table(name = "deploy_repository_sync_history")
|
||||
@Table(name = "deploy_repo_sync_history")
|
||||
@LogicDelete
|
||||
public class RepositorySyncHistory extends Entity<Long> {
|
||||
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
package com.qqchen.deploy.backend.deploy.query;
|
||||
|
||||
import com.qqchen.deploy.backend.framework.annotation.QueryField;
|
||||
import com.qqchen.deploy.backend.framework.enums.QueryType;
|
||||
import com.qqchen.deploy.backend.framework.query.BaseQuery;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* GIT分组查询对象
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RepositoryGroupQuery extends BaseQuery {
|
||||
|
||||
/**
|
||||
* 仓库组名
|
||||
*/
|
||||
@QueryField(field = "name", type = QueryType.LIKE)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 仓库组描述
|
||||
*/
|
||||
@QueryField(field = "description", type = QueryType.LIKE)
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 外部系统中的组ID
|
||||
*/
|
||||
@QueryField(field = "group_id")
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 父级仓库组ID
|
||||
*/
|
||||
@QueryField(field = "parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 仓库组路径
|
||||
*/
|
||||
@QueryField(field = "path", type = QueryType.LIKE)
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 外部系统ID
|
||||
*/
|
||||
@QueryField(field = "external_system_id")
|
||||
private Long externalSystemId;
|
||||
|
||||
/**
|
||||
* 头像URL
|
||||
*/
|
||||
@QueryField(field = "avatar_url", type = QueryType.LIKE)
|
||||
private String avatarUrl;
|
||||
|
||||
/**
|
||||
* 网页URL
|
||||
*/
|
||||
@QueryField(field = "web_url", type = QueryType.LIKE)
|
||||
private String webUrl;
|
||||
|
||||
@QueryField(field = "visibility", type = QueryType.LIKE)
|
||||
private String visibility;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
@QueryField(field = "sort")
|
||||
private Integer sort;
|
||||
|
||||
@QueryField(field = "enabled")
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 外部系统下路径唯一
|
||||
*/
|
||||
@QueryField(field = "path)", type = QueryType.LIKE)
|
||||
private String path);
|
||||
|
||||
}
|
||||
@ -2,21 +2,11 @@ package com.qqchen.deploy.backend.deploy.repository;
|
||||
|
||||
import com.qqchen.deploy.backend.framework.repository.IBaseRepository;
|
||||
import com.qqchen.deploy.backend.deploy.entity.RepositoryGroup;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* GIT分组 Repository
|
||||
*/
|
||||
@Repository
|
||||
public interface IRepositoryGroupRepository extends IBaseRepository<RepositoryGroup, Long> {
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
void deleteByExternalSystemId(Long externalSystemId);
|
||||
|
||||
Optional<RepositoryGroup> findByExternalSystemIdAndGroupId(Long externalSystemId, Long groupId);
|
||||
|
||||
List<RepositoryGroup> findByExternalSystemIdAndDeletedFalseOrderBySortAsc(Long externalSystemId);
|
||||
}
|
||||
@ -15,12 +15,6 @@ public interface IExternalSystemService extends IBaseService<ExternalSystem, Ext
|
||||
*/
|
||||
boolean testConnection(Long id);
|
||||
|
||||
/**
|
||||
* 同步系统数据
|
||||
*
|
||||
* @param id 系统ID
|
||||
*/
|
||||
void syncData(Long id);
|
||||
|
||||
/**
|
||||
* 启用/禁用系统
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.qqchen.deploy.backend.deploy.service;
|
||||
|
||||
import com.qqchen.deploy.backend.framework.service.IBaseService;
|
||||
import com.qqchen.deploy.backend.deploy.entity.RepositoryGroup;
|
||||
import com.qqchen.deploy.backend.deploy.dto.RepositoryGroupDTO;
|
||||
import com.qqchen.deploy.backend.deploy.query.RepositoryGroupQuery;
|
||||
|
||||
/**
|
||||
* GIT分组 Service接口
|
||||
*/
|
||||
public interface IRepositoryGroupService extends IBaseService<RepositoryGroup, RepositoryGroupDTO, RepositoryGroupQuery, Long> {
|
||||
}
|
||||
@ -121,36 +121,6 @@ public class ExternalSystemServiceImpl extends BaseServiceImpl<ExternalSystem, E
|
||||
return success;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void syncData(Long id) {
|
||||
ExternalSystem system = findEntityById(id);
|
||||
if (!system.getEnabled()) {
|
||||
throw new BusinessException(ResponseCode.EXTERNAL_SYSTEM_DISABLED);
|
||||
}
|
||||
|
||||
try {
|
||||
system.setSyncStatus(ExternalSystemSyncStatusEnum.RUNNING);
|
||||
externalSystemRepository.save(system);
|
||||
|
||||
// TODO: 根据不同的系统类型调用不同的同步方法
|
||||
switch (system.getType()) {
|
||||
case JENKINS -> syncJenkinsData(system);
|
||||
case GIT -> syncGitData(system);
|
||||
case ZENTAO -> syncZentaoData(system);
|
||||
}
|
||||
|
||||
system.setSyncStatus(ExternalSystemSyncStatusEnum.SUCCESS);
|
||||
system.setLastSyncTime(LocalDateTime.now());
|
||||
} catch (Exception e) {
|
||||
system.setSyncStatus(ExternalSystemSyncStatusEnum.FAILED);
|
||||
log.error("Sync data failed for external system: {}", system.getName(), e);
|
||||
throw new BusinessException(ResponseCode.EXTERNAL_SYSTEM_SYNC_FAILED);
|
||||
} finally {
|
||||
externalSystemRepository.save(system);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(Long id, boolean enabled) {
|
||||
@ -159,29 +129,4 @@ public class ExternalSystemServiceImpl extends BaseServiceImpl<ExternalSystem, E
|
||||
externalSystemRepository.save(system);
|
||||
}
|
||||
|
||||
// 私有辅助方法,后续实现具体的连接测试逻辑
|
||||
private void testJenkinsConnection(ExternalSystem system) {
|
||||
// TODO: 实现Jenkins连接测试
|
||||
}
|
||||
|
||||
private void testGitConnection(ExternalSystem system) {
|
||||
// TODO: 实现Git连接测试
|
||||
}
|
||||
|
||||
private void testZentaoConnection(ExternalSystem system) {
|
||||
// TODO: 实现禅道连接测试
|
||||
}
|
||||
|
||||
// 私有辅助方法,后续实现具体的数据同步逻辑
|
||||
private void syncJenkinsData(ExternalSystem system) {
|
||||
// TODO: 实现Jenkins数据同步
|
||||
}
|
||||
|
||||
private void syncGitData(ExternalSystem system) {
|
||||
// TODO: 实现Git数据同步
|
||||
}
|
||||
|
||||
private void syncZentaoData(ExternalSystem system) {
|
||||
// TODO: 实现禅道数据同步
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.qqchen.deploy.backend.deploy.service.impl;
|
||||
|
||||
import com.qqchen.deploy.backend.framework.service.impl.BaseServiceImpl;
|
||||
import com.qqchen.deploy.backend.deploy.entity.RepositoryGroup;
|
||||
import com.qqchen.deploy.backend.deploy.dto.RepositoryGroupDTO;
|
||||
import com.qqchen.deploy.backend.deploy.query.RepositoryGroupQuery;
|
||||
import com.qqchen.deploy.backend.deploy.service.IRepositoryGroupService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* GIT分组 Service实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class RepositoryGroupServiceImpl extends BaseServiceImpl<RepositoryGroup, RepositoryGroupDTO, RepositoryGroupQuery, Long>
|
||||
implements IRepositoryGroupService {
|
||||
}
|
||||
@ -4,7 +4,7 @@ import com.qqchen.deploy.backend.workflow.annotation.SchemaProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 事件节点基础配置
|
||||
* 每次使用基本都是会变的变量
|
||||
*/
|
||||
@Data
|
||||
public class BaseDeployNodeFormVariables {
|
||||
|
||||
@ -4,7 +4,7 @@ import com.qqchen.deploy.backend.workflow.annotation.SchemaProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 事件节点基础配置
|
||||
* 系统需要使用的变量
|
||||
*/
|
||||
@Data
|
||||
public class BaseNodeLocalVariables {
|
||||
|
||||
@ -4,7 +4,7 @@ import com.qqchen.deploy.backend.workflow.annotation.SchemaProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 事件节点基础配置
|
||||
* 节点可配置变量(比如:配置一次就不需要再变)
|
||||
*/
|
||||
@Data
|
||||
public class BaseNodePanelVariables {
|
||||
|
||||
@ -175,8 +175,7 @@ public class WorkflowInstanceServiceImpl extends BaseServiceImpl<WorkflowInstanc
|
||||
@Transactional
|
||||
public WorkflowInstanceDTO startWorkflow(WorkflowInstanceStartRequest request) {
|
||||
try {
|
||||
WorkflowDefinition workflowDefinition = workflowDefinitionRepository.findByKey(request.getProcessKey())
|
||||
.orElseThrow(() -> new RuntimeException("Workflow definition process key not found: " + request.getProcessKey()));
|
||||
WorkflowDefinition workflowDefinition = workflowDefinitionRepository.findByKey(request.getProcessKey()).orElseThrow(() -> new RuntimeException("Workflow definition process key not found: " + request.getProcessKey()));
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceBuilder()
|
||||
.processDefinitionKey(request.getProcessKey())
|
||||
.businessKey(request.getBusinessKey())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user