From 4ecefaa8f6988ead3d6486f346d0f5388e443010 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Wed, 21 Feb 2024 20:44:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=BC=BA=E9=99=B7=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E7=BC=BA=E9=99=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BA=BA=E5=8F=8A=E7=8A=B6=E6=80=81=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/bug/service/BugCommonService.java | 6 ++---- .../io/metersphere/bug/service/BugService.java | 14 +++++++++----- .../metersphere/bug/service/BugStatusService.java | 6 ++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugCommonService.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugCommonService.java index 90f141c302..0da022ee9e 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugCommonService.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugCommonService.java @@ -16,7 +16,6 @@ import io.metersphere.system.domain.ServiceIntegration; import io.metersphere.system.service.PlatformPluginService; import io.metersphere.system.service.PluginLoadService; import jakarta.annotation.Resource; -import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -51,8 +50,7 @@ public class BugCommonService { // Local处理人 return getLocalHandlerOption(projectId); } else { - // 第三方平台(Local处理人 && 平台处理人) - List localHandlerOption = getLocalHandlerOption(projectId); + // 第三方平台处理人 // 获取插件中自定义的注入字段(处理人) Platform platform = platformPluginService.getPlatform(serviceIntegration.getPluginId(), serviceIntegration.getOrganizationId(), new String(serviceIntegration.getConfiguration())); @@ -66,7 +64,7 @@ public class BugCommonService { platformHandlerOption = platform.getFormOptions(request); } } - return ListUtils.union(localHandlerOption, platformHandlerOption); + return platformHandlerOption; } } diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java index 3c98fbf4a9..e34fd5ab95 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java @@ -1118,17 +1118,21 @@ public class BugService { List ids = bugs.stream().map(BugDTO::getId).toList(); List customFields = extBugCustomFieldMapper.getBugAllCustomFields(ids, projectId); Map> customFieldMap = customFields.stream().collect(Collectors.groupingBy(BugCustomFieldDTO::getBugId)); - // 处理人选项 + // 表头处理人选项 List handleUserOption = bugCommonService.getHeaderHandlerOption(projectId); Map handleMap = handleUserOption.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText)); - // 状态选项 + List localHandlerOption = bugCommonService.getLocalHandlerOption(projectId); + Map localHandleMap = localHandlerOption.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText)); + // 表头状态选项 List statusOption = bugStatusService.getHeaderStatusOption(projectId); Map statusMap = statusOption.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText)); + List localStatusOptions = bugStatusService.getAllLocalStatusOptions(projectId); + Map localStatusMap = localStatusOptions.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText)); bugs.forEach(bug -> { bug.setCustomFields(customFieldMap.get(bug.getId())); - // 解析处理人, 状态, 严重程度 - bug.setHandleUserName(handleMap.get(bug.getHandleUser())); - bug.setStatusName(statusMap.get(bug.getStatus())); + // 解析处理人, 状态 + bug.setHandleUserName(StringUtils.isBlank(handleMap.get(bug.getHandleUser())) ? localHandleMap.get(bug.getHandleUser()) : handleMap.get(bug.getHandleUser())); + bug.setStatusName(StringUtils.isBlank(statusMap.get(bug.getStatus())) ? localStatusMap.get(bug.getStatus()) : statusMap.get(bug.getStatus())); }); return bugs; } diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugStatusService.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugStatusService.java index d1516779c8..23c14e402f 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugStatusService.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugStatusService.java @@ -12,7 +12,6 @@ import io.metersphere.sdk.util.LogUtils; import io.metersphere.system.service.BaseStatusFlowSettingService; import jakarta.annotation.Resource; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -41,8 +40,7 @@ public class BugStatusService { // Local状态流 return getAllLocalStatusOptions(projectId); } else { - // 第三方平台(Local状态流 && 第三方平台状态流) - List localStatusOption = getAllLocalStatusOptions(projectId); + // 第三方平台状态流 Platform platform = projectApplicationService.getPlatform(projectId, true); String projectConfig = projectApplicationService.getProjectBugThirdPartConfig(projectId); // 获取一条最新的Jira默认模板缺陷Key @@ -52,7 +50,7 @@ public class BugStatusService { } catch (Exception e) { LogUtils.error("获取平台状态选项有误: " + e.getMessage()); } - return ListUtils.union(localStatusOption, platformStatusOption); + return platformStatusOption; } }