fix(测试跟踪): 解决禅道版本和处理人的回显

--bug=1009066 --user=郭雨琦 解决禅道版本和处理人的回显
This commit is contained in:
guoyuqi 2021-12-24 15:54:06 +08:00 committed by xiaomeinvG
parent 96ed9a03a4
commit 3bae6e7b88
5 changed files with 33 additions and 1 deletions

View File

@ -17,4 +17,6 @@ public class IssuesDao extends IssuesWithBLOBs {
private String caseId;
private int totalIssueCount;
private List<String> tapdUsers;
private List<String>zentaoBuilds;
private String zentaoAssigned;
}

View File

@ -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");
List<String>zentaoBuilds = new ArrayList<>();
if(Strings.isNotBlank(openedBuild)){
zentaoBuilds = Arrays.asList(openedBuild.split(","));
}
issue.setZentaoAssigned(openedBy);
issue.setZentaoBuilds(zentaoBuilds);
return issue;
}
@Override
public List<DemandDTO> getDemandList(String projectId) {
//getTestStories

View File

@ -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<String> 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());
}

View File

@ -358,6 +358,10 @@ public class IssuesService {
List<String> 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;
}

View File

@ -166,7 +166,8 @@ export default {
description: '',
creator: null,
remark: null,
tapdUsers:[]
tapdUsers:[],
zentaoBuilds:[]
},
tapdUsers: [],
zentaoUsers: [],