From f1bb7f7b3f1b3d0ac08ece6c4007e19c61b5d39e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E6=B6=9B?= <731554297@qq.com> Date: Wed, 29 Apr 2026 11:22:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=B6=85=E7=AE=97=E4=B8=93=E5=8C=BA):=20?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=A1=B9=E7=9B=AE=E8=81=9A=E5=90=88=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=97=B6=EF=BC=8C=E8=8B=A5=E9=A1=B9=E7=9B=AE=E4=B8=BA?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E9=A1=B9=E7=9B=AE=E5=88=99=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=E9=95=9C=E5=83=8Fowner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ZoneProjectServiceImpl.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/microservices-modules/microservices-modules-zone/src/main/java/com/microservices/zone/project/service/impl/ZoneProjectServiceImpl.java b/microservices-modules/microservices-modules-zone/src/main/java/com/microservices/zone/project/service/impl/ZoneProjectServiceImpl.java index 36e65e7ac..cfc6463fa 100644 --- a/microservices-modules/microservices-modules-zone/src/main/java/com/microservices/zone/project/service/impl/ZoneProjectServiceImpl.java +++ b/microservices-modules/microservices-modules-zone/src/main/java/com/microservices/zone/project/service/impl/ZoneProjectServiceImpl.java @@ -214,6 +214,24 @@ public class ZoneProjectServiceImpl implements IZoneProjectService { } } + private static String extractFirstPathSegment(String url) { + if (url == null || url.isEmpty()) return null; + + // 找到协议后的第一个 '/' 的位置(路径开始) + int schemeSep = url.indexOf("://"); + if (schemeSep == -1) return null; + + int hostStart = schemeSep + 3; + int pathStart = url.indexOf('/', hostStart); + if (pathStart == -1) return null; // 没有路径 + + // 找到下一个 '/' 或结尾 + int pathEnd = url.indexOf('/', pathStart + 1); + if (pathEnd == -1) pathEnd = url.length(); + + return url.substring(pathStart + 1, pathEnd); + } + private ZoneProjectDataVo zoneProjectToZoneProjectDataVo(ZoneProject zoneProject, JSONObject gitLinkProject) { //每次从GitLink查询项目时自动更新项目名称和项目标识 updateProjectNameAndFullName(gitLinkProject, zoneProject); @@ -233,6 +251,11 @@ public class ZoneProjectServiceImpl implements IZoneProjectService { projectKeyName.put("name", "项目名称"); projectPropertiesVo.put("fullName", author.getString("login") + "/" + gitLinkProject.getString("identifier")); projectKeyName.put("fullName", "项目完整地址"); + projectPropertiesVo.put("fromOwner", author.getString("login")); + } + String mirrorUrl = gitLinkProject.getString("mirror_url"); + if (StringUtils.isNotEmpty(mirrorUrl)) { + projectPropertiesVo.put("fromOwner", extractFirstPathSegment(mirrorUrl)); } String description = gitLinkProject.getString("description"); projectPropertiesVo.put("description", description);