From 3222e861b5ba5425dcea8acb5225a9ff747b32d7 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Wed, 27 Apr 2022 11:10:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=B2=A1=E6=9C=89=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E6=A8=A1=E7=89=88=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=BC=96=E8=BE=91=E7=94=A8=E4=BE=8B=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1012801 --user=刘瑞斌 【测试跟踪】功能用例-编辑-版本-新建-异常 https://www.tapd.cn/55049933/s/1148943 --- .../track/issue/service/XpackIssueService.java | 8 ++++++++ .../metersphere/track/service/TestCaseService.java | 13 ++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/track/issue/service/XpackIssueService.java diff --git a/backend/src/main/java/io/metersphere/track/issue/service/XpackIssueService.java b/backend/src/main/java/io/metersphere/track/issue/service/XpackIssueService.java new file mode 100644 index 0000000000..234812a5ba --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/issue/service/XpackIssueService.java @@ -0,0 +1,8 @@ +package io.metersphere.track.issue.service; + +import io.metersphere.track.request.testcase.EditTestCaseRequest; + +public interface XpackIssueService { + + void updateThirdPartyIssuesLink(EditTestCaseRequest testCase); +} diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index b475a25fa7..5b0b30925f 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -47,6 +47,7 @@ import io.metersphere.track.dto.TestCaseCommentDTO; import io.metersphere.track.dto.TestCaseDTO; import io.metersphere.track.issue.AbstractIssuePlatform; import io.metersphere.track.issue.IssueFactory; +import io.metersphere.track.issue.service.XpackIssueService; import io.metersphere.track.request.testcase.*; import io.metersphere.track.request.testplan.LoadCaseRequest; import io.metersphere.xmind.XmindCaseParser; @@ -70,7 +71,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.BufferedInputStream; import java.io.IOException; import java.io.OutputStream; -import java.lang.reflect.Method; import java.net.URLEncoder; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; @@ -352,14 +352,9 @@ public class TestCaseService { * @param testCase */ public void updateThirdPartyIssuesLink(EditTestCaseRequest testCase) { - try { - if (Class.forName("io.metersphere.xpack.issue.service.XpackIssueService") != null) { - Class clazz = Class.forName("io.metersphere.xpack.issue.service.XpackIssueService"); - Method method = clazz.getMethod("updateThirdPartyIssuesLink", EditTestCaseRequest.class); - method.invoke(CommonBeanFactory.getBean("xpackIssueService"), testCase); - } - } catch (Exception exception) { - LogUtil.error("不存在XpackIssueService类"); + XpackIssueService issueService = CommonBeanFactory.getBean(XpackIssueService.class); + if (issueService != null) { + issueService.updateThirdPartyIssuesLink(testCase); } }