From 8984a98ce882c930a259d44bdf5efed476e029dc Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 22 Nov 2021 11:44:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=8C=E6=AD=A5=E7=A6=85=E9=81=93?= =?UTF-8?q?=E5=85=A8=E9=87=8F=E7=BC=BA=E9=99=B7=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/track/issue/ZentaoPlatform.java | 4 ++-- .../java/io/metersphere/track/issue/client/ZentaoClient.java | 5 +++-- .../src/main/resources/db/migration/V99__v1.15_release.sql | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) 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 eb76bf688b..e100d9bd7d 100644 --- a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java @@ -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 getBuilds() { String session = zentaoClient.login();; - String projectId1 = getProjectId(projectId); HttpHeaders httpHeaders = new HttpHeaders(); HttpEntity> requestEntity = new HttpEntity<>(httpHeaders); RestTemplate restTemplate = new RestTemplate(); String buildGet = zentaoClient.requestUrl.getBuildsGet(); ResponseEntity 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); 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 e25b35aac2..e57ae09d20 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 @@ -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=¶m=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=¶m=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 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"); } diff --git a/backend/src/main/resources/db/migration/V99__v1.15_release.sql b/backend/src/main/resources/db/migration/V99__v1.15_release.sql index 68726cc0a5..9e04f2dcfb 100644 --- a/backend/src/main/resources/db/migration/V99__v1.15_release.sql +++ b/backend/src/main/resources/db/migration/V99__v1.15_release.sql @@ -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; \ No newline at end of file + ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci; + + +CREATE INDEX issues_platform_id_IDX ON issues (platform_id);