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: [],