From c5b44509976793bc369d8b6362ff4a14bbcec69f Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Fri, 5 Feb 2021 15:07:27 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/controller/TestCaseIssuesController.java | 4 ++-- .../java/io/metersphere/track/issue/IssuesPlatform.java | 1 + .../main/java/io/metersphere/track/issue/JiraPlatform.java | 1 + .../main/java/io/metersphere/track/issue/LocalPlatform.java | 1 + .../main/java/io/metersphere/track/issue/TapdPlatform.java | 6 +++--- .../issue/TapdRestUtils.java} | 6 ++++-- .../java/io/metersphere/track/issue/ZentaoPlatform.java | 2 ++ .../metersphere/track/issue/{ => domain}/PlatformUser.java | 2 +- .../io/metersphere/track/{ => issue}/domain/TapdUser.java | 2 +- .../metersphere/track/issue/{ => domain}/ZentaoBuild.java | 2 +- .../java/io/metersphere/track/service/IssuesService.java | 2 ++ 11 files changed, 19 insertions(+), 10 deletions(-) rename backend/src/main/java/io/metersphere/{commons/utils/RestTemplateUtils.java => track/issue/TapdRestUtils.java} (91%) rename backend/src/main/java/io/metersphere/track/issue/{ => domain}/PlatformUser.java (79%) rename backend/src/main/java/io/metersphere/track/{ => issue}/domain/TapdUser.java (83%) rename backend/src/main/java/io/metersphere/track/issue/{ => domain}/ZentaoBuild.java (70%) diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseIssuesController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseIssuesController.java index 6b279c0d4a..d0b690e94b 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseIssuesController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseIssuesController.java @@ -1,8 +1,8 @@ package io.metersphere.track.controller; import io.metersphere.base.domain.Issues; -import io.metersphere.track.issue.PlatformUser; -import io.metersphere.track.issue.ZentaoBuild; +import io.metersphere.track.issue.domain.PlatformUser; +import io.metersphere.track.issue.domain.ZentaoBuild; import io.metersphere.track.service.IssuesService; import io.metersphere.track.request.testcase.IssuesRequest; import org.springframework.web.bind.annotation.*; diff --git a/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java b/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java index 458e885408..8bb25cc063 100644 --- a/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java @@ -1,6 +1,7 @@ package io.metersphere.track.issue; import io.metersphere.base.domain.Issues; +import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; import java.util.List; diff --git a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java index 981b76e2ef..50a4e66c37 100644 --- a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java @@ -7,6 +7,7 @@ import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.EncryptUtils; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; import org.apache.commons.lang3.StringUtils; import org.commonmark.node.Node; diff --git a/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java b/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java index bbbd12df8f..7db678e738 100644 --- a/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java @@ -5,6 +5,7 @@ import io.metersphere.base.domain.TestCaseIssues; import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; import java.util.List; diff --git a/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java b/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java index aff4db0543..fc7e2f3137 100644 --- a/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java @@ -7,9 +7,9 @@ import io.metersphere.base.domain.*; import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; -import io.metersphere.commons.utils.RestTemplateUtils; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.ResultHolder; +import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpEntity; @@ -194,9 +194,9 @@ public class TapdPlatform extends AbstractIssuePlatform { HttpHeaders header = auth(account, password); if (httpMethod.equals(HttpMethod.GET)) { - responseJson = RestTemplateUtils.get(url, header); + responseJson = TapdRestUtils.get(url, header); } else { - responseJson = RestTemplateUtils.post(url, params, header); + responseJson = TapdRestUtils.post(url, params, header); } ResultHolder result = JSON.parseObject(responseJson, ResultHolder.class); diff --git a/backend/src/main/java/io/metersphere/commons/utils/RestTemplateUtils.java b/backend/src/main/java/io/metersphere/track/issue/TapdRestUtils.java similarity index 91% rename from backend/src/main/java/io/metersphere/commons/utils/RestTemplateUtils.java rename to backend/src/main/java/io/metersphere/track/issue/TapdRestUtils.java index 0f66e13177..141a1d355e 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/RestTemplateUtils.java +++ b/backend/src/main/java/io/metersphere/track/issue/TapdRestUtils.java @@ -1,6 +1,8 @@ -package io.metersphere.commons.utils; +package io.metersphere.track.issue; import io.metersphere.commons.exception.MSException; +import io.metersphere.commons.utils.CommonBeanFactory; +import io.metersphere.commons.utils.LogUtil; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -8,7 +10,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; -public class RestTemplateUtils { +public class TapdRestUtils { private static RestTemplate restTemplate; diff --git a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java index 1d0196651e..749deecfb4 100644 --- a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java @@ -7,6 +7,8 @@ import io.metersphere.base.domain.*; import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.track.issue.domain.PlatformUser; +import io.metersphere.track.issue.domain.ZentaoBuild; import io.metersphere.track.request.testcase.IssuesRequest; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpEntity; diff --git a/backend/src/main/java/io/metersphere/track/issue/PlatformUser.java b/backend/src/main/java/io/metersphere/track/issue/domain/PlatformUser.java similarity index 79% rename from backend/src/main/java/io/metersphere/track/issue/PlatformUser.java rename to backend/src/main/java/io/metersphere/track/issue/domain/PlatformUser.java index ac913343ae..658f8005b5 100644 --- a/backend/src/main/java/io/metersphere/track/issue/PlatformUser.java +++ b/backend/src/main/java/io/metersphere/track/issue/domain/PlatformUser.java @@ -1,4 +1,4 @@ -package io.metersphere.track.issue; +package io.metersphere.track.issue.domain; import lombok.Data; diff --git a/backend/src/main/java/io/metersphere/track/domain/TapdUser.java b/backend/src/main/java/io/metersphere/track/issue/domain/TapdUser.java similarity index 83% rename from backend/src/main/java/io/metersphere/track/domain/TapdUser.java rename to backend/src/main/java/io/metersphere/track/issue/domain/TapdUser.java index 53d193c088..dead7a1bb6 100644 --- a/backend/src/main/java/io/metersphere/track/domain/TapdUser.java +++ b/backend/src/main/java/io/metersphere/track/issue/domain/TapdUser.java @@ -1,4 +1,4 @@ -package io.metersphere.track.domain; +package io.metersphere.track.issue.domain; import lombok.Data; import java.io.Serializable; diff --git a/backend/src/main/java/io/metersphere/track/issue/ZentaoBuild.java b/backend/src/main/java/io/metersphere/track/issue/domain/ZentaoBuild.java similarity index 70% rename from backend/src/main/java/io/metersphere/track/issue/ZentaoBuild.java rename to backend/src/main/java/io/metersphere/track/issue/domain/ZentaoBuild.java index fa6dc42b67..7515ede569 100644 --- a/backend/src/main/java/io/metersphere/track/issue/ZentaoBuild.java +++ b/backend/src/main/java/io/metersphere/track/issue/domain/ZentaoBuild.java @@ -1,4 +1,4 @@ -package io.metersphere.track.issue; +package io.metersphere.track.issue.domain; import lombok.Data; diff --git a/backend/src/main/java/io/metersphere/track/service/IssuesService.java b/backend/src/main/java/io/metersphere/track/service/IssuesService.java index 4239dbb49e..fca1712896 100644 --- a/backend/src/main/java/io/metersphere/track/service/IssuesService.java +++ b/backend/src/main/java/io/metersphere/track/service/IssuesService.java @@ -16,6 +16,8 @@ import io.metersphere.notice.service.NoticeSendService; import io.metersphere.service.IntegrationService; import io.metersphere.service.ProjectService; import io.metersphere.track.issue.*; +import io.metersphere.track.issue.domain.PlatformUser; +import io.metersphere.track.issue.domain.ZentaoBuild; import io.metersphere.track.request.testcase.IssuesRequest; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service;