fix(测试跟踪): 企业版禅道无法获取影响版本

--bug=1010678 --user=陈建星 github#11044,对接禅道企业版6.4,无法取得“影响版本”,导致创建缺陷时报错 https://www.tapd.cn/55049933/s/1112366
This commit is contained in:
chenjianxing 2022-03-02 20:51:37 +08:00 committed by john1298308460
parent 9a472560ed
commit c2f37b1e42
4 changed files with 16 additions and 6 deletions

View File

@ -338,11 +338,14 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
} }
public List<ZentaoBuild> getBuilds() { public List<ZentaoBuild> getBuilds() {
Map<String, String> builds = zentaoClient.getBuilds(getProjectId(projectId)); Map<String, Object> builds = zentaoClient.getBuildsByCreateMetaData(getProjectId(projectId));
if (builds == null || builds.isEmpty()) {
builds = zentaoClient.getBuilds(getProjectId(projectId));
}
List<ZentaoBuild> res = new ArrayList<>(); List<ZentaoBuild> res = new ArrayList<>();
builds.forEach((k, v) -> { builds.forEach((k, v) -> {
if (StringUtils.isNotBlank(k)) { if (StringUtils.isNotBlank(k)) {
res.add(new ZentaoBuild(k, v)); res.add(new ZentaoBuild(k, v.toString()));
} }
}); });
return res; return res;

View File

@ -142,8 +142,15 @@ public abstract class ZentaoClient extends BaseClient {
return getCreateMetaData(productID).getCustomFields(); return getCreateMetaData(productID).getCustomFields();
} }
public Map<String, String> getBuilds(String productID) { public Map<String, Object> getBuildsByCreateMetaData(String projectId) {
return getCreateMetaData(productID).getBuilds(); return getCreateMetaData(projectId).getBuilds();
}
public Map<String, Object> getBuilds(String projectId) {
String sessionId = login();
ResponseEntity<String> response = restTemplate.exchange(requestUrl.getBuildsGet(),
HttpMethod.GET, null, String.class, projectId, sessionId);
return JSONObject.parseObject(response.getBody()).getJSONObject("data").getInnerMap();
} }
public JSONArray getBugsByProjectId(String projectId, int pageNum, int pageSize) { public JSONArray getBugsByProjectId(String projectId, int pageNum, int pageSize) {

View File

@ -14,7 +14,7 @@ public class ZentaoGetClient extends ZentaoClient {
private static final String BUG_GET="&module=bug&methodName=getById&params=bugID={1}&t=json&zentaosid={2}"; private static final String BUG_GET="&module=bug&methodName=getById&params=bugID={1}&t=json&zentaosid={2}";
private static final String STORY_GET="&module=story&methodName=getProductStories&params=productID={key}&t=json&zentaosid="; private static final String STORY_GET="&module=story&methodName=getProductStories&params=productID={key}&t=json&zentaosid=";
private static final String USER_GET="&module=user&methodName=getList&t=json&zentaosid="; private static final String USER_GET="&module=user&methodName=getList&t=json&zentaosid=";
private static final String BUILDS_GET="&module=build&methodName=getProductBuildPairs&productID={0}&zentaosid="; private static final String BUILDS_GET="&module=build&methodName=getProductBuildPairs&productID={0}&zentaosid={1}";
private static final String FILE_UPLOAD="&module=file&methodName=saveUpload&t=json&zentaosid="; private static final String FILE_UPLOAD="&module=file&methodName=saveUpload&t=json&zentaosid=";
private static final String CREATE_META_DATA="?m=bug&f=create&productID={0}&t=json&zentaosid={1}"; private static final String CREATE_META_DATA="?m=bug&f=create&productID={0}&t=json&zentaosid={1}";
private static final String REPLACE_IMG_URL="<img src=\"%s/index.php?m=file&f=read&fileID=$1\"/>"; private static final String REPLACE_IMG_URL="<img src=\"%s/index.php?m=file&f=read&fileID=$1\"/>";

View File

@ -15,7 +15,7 @@ public class ZentaoPathInfoClient extends ZentaoClient {
private static final String BUG_GET = "/api-getModel-bug-getById-bugID={1}?zentaosid={2}"; private static final String BUG_GET = "/api-getModel-bug-getById-bugID={1}?zentaosid={2}";
private static final String STORY_GET = "/api-getModel-story-getProductStories-productID={key}?zentaosid="; private static final String STORY_GET = "/api-getModel-story-getProductStories-productID={key}?zentaosid=";
private static final String USER_GET = "/api-getModel-user-getList?zentaosid="; private static final String USER_GET = "/api-getModel-user-getList?zentaosid=";
private static final String BUILDS_GET = "/api-getModel-build-getProductBuildPairs-productID={projectId}?zentaosid="; private static final String BUILDS_GET = "/api-getModel-build-getProductBuildPairs-productID={0}?zentaosid={1}";
private static final String CREATE_META_DATA="/bug-create-{0}.json"; private static final String CREATE_META_DATA="/bug-create-{0}.json";
private static final String FILE_UPLOAD = "/api-getModel-file-saveUpload.json?zentaosid="; private static final String FILE_UPLOAD = "/api-getModel-file-saveUpload.json?zentaosid=";
private static final String REPLACE_IMG_URL = "<img src=\"%s/file-read-$1\"/>"; private static final String REPLACE_IMG_URL = "<img src=\"%s/file-read-$1\"/>";