fix: 同步禅道全量缺陷报错

This commit is contained in:
chenjianxing 2021-11-22 11:44:47 +08:00 committed by jianxing
parent af5a29abb0
commit 8984a98ce8
3 changed files with 9 additions and 5 deletions

View File

@ -148,6 +148,7 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
issue.setTitle(bugObj.getTitle());
issue.setDescription(steps);
issue.setReporter(bugObj.getOpenedBy());
issue.setPlatform(key);
issue.setCustomFields(syncIssueCustomField(issue.getCustomFields(), bug));
return issue;
}
@ -311,13 +312,12 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
public List<ZentaoBuild> getBuilds() {
String session = zentaoClient.login();;
String projectId1 = getProjectId(projectId);
HttpHeaders httpHeaders = new HttpHeaders();
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(httpHeaders);
RestTemplate restTemplate = new RestTemplate();
String buildGet = zentaoClient.requestUrl.getBuildsGet();
ResponseEntity<String> responseEntity = restTemplate.exchange(buildGet + session,
HttpMethod.GET, requestEntity, String.class, projectId1);
HttpMethod.GET, requestEntity, String.class, getProjectId(projectId));
String body = responseEntity.getBody();
JSONObject obj = JSONObject.parseObject(body);

View File

@ -29,7 +29,8 @@ public abstract class ZentaoClient extends BaseClient {
ENDPOINT = url;
}
private static final String BUG_LIST_URL="?m=bug&f=browse&productID={0}&branch=&browseType=&param=0&orderBy=&pageID={1}&recPerPage={2}&t=json&zentaosid=";
// 注意 recTotal={1}&recPerPage={2}&pageID={3} 顺序不能调换实在恶心
private static final String BUG_LIST_URL="?m=bug&f=browse&productID={0}&branch=&browseType=&param=0&orderBy=&recTotal={1}&recPerPage={2}&pageID={3}&t=json&zentaosid={4}";
public String login() {
GetUserResponse getUserResponse = new GetUserResponse();
@ -121,7 +122,7 @@ public abstract class ZentaoClient extends BaseClient {
public JSONArray getBugsByProjectId(String projectId, int pageNum, int pageSize) {
String sessionId = login();
ResponseEntity<String> response = restTemplate.exchange(getBaseUrl() + BUG_LIST_URL,
HttpMethod.GET, null, String.class, projectId, pageNum, pageSize, sessionId);
HttpMethod.GET, null, String.class, projectId, 9999999, pageSize, pageNum, sessionId);
return JSONObject.parseObject(response.getBody()).getJSONObject("data").getJSONArray("bugs");
}

View File

@ -62,4 +62,7 @@ CREATE TABLE IF NOT EXISTS `enterprise_test_report_send_record` (
`duplicated` longtext COMMENT 'report content',
PRIMARY KEY (`id`),
INDEX `enterprise_test_report_id` (`enterprise_test_report_id`) USING BTREE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci;
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci;
CREATE INDEX issues_platform_id_IDX ON issues (platform_id);