应用迁移到团队应用里配置GIT
This commit is contained in:
parent
4f28a9d3e5
commit
d0538de830
@ -330,25 +330,36 @@ public class RepositoryProjectServiceImpl extends BaseServiceImpl<RepositoryProj
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. 收集所有仓库组的 repo_group_id(Git系统的组ID,不是数据库主键)
|
||||
// 1. 收集所有仓库组的 repo_group_id 和 external_system_id
|
||||
Set<Long> repoGroupIds = projects.stream()
|
||||
.map(RepositoryProjectDTO::getRepoGroupId)
|
||||
.filter(id -> id != null)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<Long> externalSystemIds = projects.stream()
|
||||
.map(RepositoryProjectDTO::getExternalSystemId)
|
||||
.filter(id -> id != null)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 2. 批量查询仓库组信息(根据 repo_group_id 字段查询,不是主键 id)
|
||||
Map<Long, RepositoryGroup> repoGroupMap = Collections.emptyMap();
|
||||
// 2. 批量查询仓库组信息(需要同时匹配 repo_group_id 和 external_system_id)
|
||||
Map<String, RepositoryGroup> repoGroupMap = Collections.emptyMap();
|
||||
if (!repoGroupIds.isEmpty()) {
|
||||
List<Long> repoGroupIdList = new ArrayList<>(repoGroupIds);
|
||||
// 使用复合键:externalSystemId + "_" + repoGroupId 避免不同系统的 ID 冲突
|
||||
repoGroupMap = repositoryGroupRepository.findByRepoGroupIdIn(repoGroupIdList).stream()
|
||||
.collect(Collectors.toMap(RepositoryGroup::getRepoGroupId, Function.identity()));
|
||||
.filter(group -> externalSystemIds.contains(group.getExternalSystemId()))
|
||||
.collect(Collectors.toMap(
|
||||
group -> group.getExternalSystemId() + "_" + group.getRepoGroupId(),
|
||||
Function.identity()
|
||||
));
|
||||
}
|
||||
|
||||
// 3. 填充仓库组名称(使用 repo_group_id 作为 key)
|
||||
Map<Long, RepositoryGroup> finalRepoGroupMap = repoGroupMap;
|
||||
// 3. 填充仓库组名称(使用复合键:externalSystemId + "_" + repoGroupId)
|
||||
Map<String, RepositoryGroup> finalRepoGroupMap = repoGroupMap;
|
||||
projects.forEach(project -> {
|
||||
if (project.getRepoGroupId() != null) {
|
||||
RepositoryGroup group = finalRepoGroupMap.get(project.getRepoGroupId());
|
||||
if (project.getRepoGroupId() != null && project.getExternalSystemId() != null) {
|
||||
String key = project.getExternalSystemId() + "_" + project.getRepoGroupId();
|
||||
RepositoryGroup group = finalRepoGroupMap.get(key);
|
||||
if (group != null) {
|
||||
project.setRepoGroupName(group.getName());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user