fix(测试跟踪): 提交Jira缺陷时获取报告人不全

--bug=1010876 --user=李玉号
【测试跟踪】github#11176,关联jira后,一些信息拿不全,如关联需求,报告人等只有部分
https://www.tapd.cn/55049933/s/1117558

Closes #11176
This commit is contained in:
shiziyuan9527 2022-03-14 18:30:34 +08:00 committed by shiziyuan9527
parent 7e726b36e1
commit 41686defa9
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}";
List<JiraUser> list = new ArrayList<>();
int maxResults = 50, startAt = 0;
List<JiraUser> users;
do {
users = getAssignableUser(projectKey, startAt, maxResults);
list.addAll(users);
startAt += maxResults;
} while (users.size() >= maxResults);
return list;
}
private List<JiraUser> getAssignableUser(String projectKey, int startAt, int maxResults) {
String url = getBaseUrl() + "/user/assignable/search?project={1}&maxResults=" + maxResults + "&startAt=" + startAt;
ResponseEntity<String> response = null;
try {
response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, projectKey);