From 3bae6e7b886d26447fdb1ebea13f773a8ee5c427 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 24 Dec 2021 15:54:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=A6=85=E9=81=93=E7=89=88=E6=9C=AC=E5=92=8C?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BA=BA=E7=9A=84=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1009066 --user=郭雨琦 解决禅道版本和处理人的回显 --- .../java/io/metersphere/base/domain/IssuesDao.java | 2 ++ .../io/metersphere/track/issue/ZentaoPlatform.java | 14 ++++++++++++++ .../track/issue/client/ZentaoClient.java | 11 +++++++++++ .../metersphere/track/service/IssuesService.java | 4 ++++ .../components/track/issue/IssueEditDetail.vue | 3 ++- 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/base/domain/IssuesDao.java b/backend/src/main/java/io/metersphere/base/domain/IssuesDao.java index 15f32e5eb5..da8aa98c9c 100644 --- a/backend/src/main/java/io/metersphere/base/domain/IssuesDao.java +++ b/backend/src/main/java/io/metersphere/base/domain/IssuesDao.java @@ -17,4 +17,6 @@ public class IssuesDao extends IssuesWithBLOBs { private String caseId; private int totalIssueCount; private List tapdUsers; + private ListzentaoBuilds; + private String zentaoAssigned; } 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 631045b1f4..361c715c2d 100644 --- a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java @@ -20,6 +20,7 @@ import io.metersphere.track.issue.domain.zentao.ZentaoConfig; import io.metersphere.track.request.testcase.IssuesRequest; import io.metersphere.track.request.testcase.IssuesUpdateRequest; import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.util.Strings; import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -63,6 +64,19 @@ public class ZentaoPlatform extends AbstractIssuePlatform { return issues; } + public IssuesDao getZentaoAssignedAndBuilds(IssuesDao issue){ + JSONObject zentaoIssue = zentaoClient.getBugById(issue.getPlatformId()); + String openedBy = zentaoIssue.getString("openedBy"); + String openedBuild = zentaoIssue.getString("openedBuild"); + ListzentaoBuilds = new ArrayList<>(); + if(Strings.isNotBlank(openedBuild)){ + zentaoBuilds = Arrays.asList(openedBuild.split(",")); + } + issue.setZentaoAssigned(openedBy); + issue.setZentaoBuilds(zentaoBuilds); + return issue; + } + @Override public List getDemandList(String projectId) { //getTestStories diff --git a/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java b/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java index e917949ae5..cec22915f3 100644 --- a/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java +++ b/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java @@ -1,5 +1,6 @@ package io.metersphere.track.issue.client; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONObject; @@ -117,6 +118,16 @@ public abstract class ZentaoClient extends BaseClient { ResponseEntity response = restTemplate.exchange(bugGet, HttpMethod.GET, null, String.class, id, sessionId); GetIssueResponse getIssueResponse = (GetIssueResponse) getResultForObject(GetIssueResponse.class, response); + if(StringUtils.equalsIgnoreCase(getIssueResponse.getStatus(),"fail")){ + GetIssueResponse.Issue issue = new GetIssueResponse.Issue(); + issue.setId(id); + issue.setSteps(" "); + issue.setTitle(" "); + issue.setStatus("closed"); + issue.setDeleted("1"); + issue.setOpenedBy(" "); + getIssueResponse.setData(JSON.toJSON(issue).toString()); + } return JSONObject.parseObject(getIssueResponse.getData()); } 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 e743b26b7d..c91dedea7d 100644 --- a/backend/src/main/java/io/metersphere/track/service/IssuesService.java +++ b/backend/src/main/java/io/metersphere/track/service/IssuesService.java @@ -358,6 +358,10 @@ public class IssuesService { List tapdUsers = platform.getTapdUsers(item.getProjectId(), item.getPlatformId()); item.setTapdUsers(tapdUsers); } + if (StringUtils.equals(item.getPlatform(), "Zentao")) { + ZentaoPlatform platform = (ZentaoPlatform) IssueFactory.createPlatform(item.getPlatform(), request); + platform.getZentaoAssignedAndBuilds(item); + } }); return issues; } diff --git a/frontend/src/business/components/track/issue/IssueEditDetail.vue b/frontend/src/business/components/track/issue/IssueEditDetail.vue index 52a47518a8..86886ccf32 100644 --- a/frontend/src/business/components/track/issue/IssueEditDetail.vue +++ b/frontend/src/business/components/track/issue/IssueEditDetail.vue @@ -166,7 +166,8 @@ export default { description: '', creator: null, remark: null, - tapdUsers:[] + tapdUsers:[], + zentaoBuilds:[] }, tapdUsers: [], zentaoUsers: [],