parent
0080615344
commit
d46a4b9f46
|
@ -141,11 +141,21 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
//post
|
//post
|
||||||
ResponseEntity<String> responseEntity = null;
|
ResponseEntity<String> responseEntity = null;
|
||||||
responseEntity = restTemplate.exchange(url + "/rest/api/2/search?jql=project="+key+"+AND+issuetype="+type+"&fields=summary,issuetype",
|
int maxResults = 50, startAt = 0, total = 0, currentStartAt = 0;
|
||||||
|
do {
|
||||||
|
String jql = url + "/rest/api/2/search?jql=project=" + key + "+AND+issuetype=" + type
|
||||||
|
+ "&maxResults=" + maxResults + "&startAt=" + startAt + "&fields=summary,issuetype";
|
||||||
|
responseEntity = restTemplate.exchange(jql,
|
||||||
HttpMethod.GET, requestEntity, String.class);
|
HttpMethod.GET, requestEntity, String.class);
|
||||||
String body = responseEntity.getBody();
|
String body = responseEntity.getBody();
|
||||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||||
JSONArray jsonArray = jsonObject.getJSONArray("issues");
|
JSONArray jsonArray = jsonObject.getJSONArray("issues");
|
||||||
|
if (jsonArray.size() == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
total = jsonObject.getInteger("total");
|
||||||
|
startAt = startAt + maxResults;
|
||||||
|
currentStartAt = jsonObject.getInteger("startAt");
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
JSONObject o = jsonArray.getJSONObject(i);
|
JSONObject o = jsonArray.getJSONObject(i);
|
||||||
String issueKey = o.getString("key");
|
String issueKey = o.getString("key");
|
||||||
|
@ -157,6 +167,9 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
demandDTO.setPlatform(IssuesManagePlatform.Jira.name());
|
demandDTO.setPlatform(IssuesManagePlatform.Jira.name());
|
||||||
list.add(demandDTO);
|
list.add(demandDTO);
|
||||||
}
|
}
|
||||||
|
} while (currentStartAt + maxResults < total);
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e.getMessage(), e);
|
LogUtil.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue