fix(缺陷管理): 获取Jira用户选项不全

Closes #18011
This commit is contained in:
shiziyuan9527 2022-09-20 11:01:47 +08:00 committed by 刘瑞斌
parent 201cabd0d3
commit b6d07fa0d3
1 changed files with 14 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.client.HttpClientErrorException;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -87,7 +88,19 @@ public abstract class JiraAbstractClient extends BaseClient {
}
public List<JiraUser> getAssignableUser(String projectKey) {
String url = getBaseUrl() + "/user/assignable/search?project={1}&maxResults=" + 1000 + "&startAt=" + 0;
List<JiraUser> res = new ArrayList<>();
int maxResults = 1000, startAt = 0;
List<JiraUser> list;
do {
list = this.getAssignableUser(startAt, maxResults, projectKey);
res.addAll(list);
startAt += maxResults;
} while (list.size() >= maxResults);
return res;
}
private List<JiraUser> getAssignableUser(int startAt, int maxResult, String projectKey) {
String url = getBaseUrl() + "/user/assignable/search?project={1}&maxResults=" + maxResult + "&startAt=" + startAt;
ResponseEntity<String> response = null;
try {
response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, projectKey);