fix: 同步缺陷优化错误提示

--bug=1013369 --user=陈建星 【测试跟踪】集成第三方平台tapd/zentao,输入错误的项目id ,缺陷管理同步缺陷会报错,建议有友好提示 https://www.tapd.cn/55049933/s/1164111
This commit is contained in:
chenjianxing 2022-05-25 18:36:40 +08:00 committed by jianxing
parent 47eff73e12
commit 0270b507e2
2 changed files with 14 additions and 2 deletions

View File

@ -36,7 +36,13 @@ public class TapdClient extends BaseClient {
public Map<String, String> getStatusMap(String projectId) {
String url = getBaseUrl() + "/workflows/status_map?workspace_id={1}&system=bug";
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, projectId);
ResponseEntity<String> response = null;
try {
response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, projectId);
} catch (Exception e) {
MSException.throwException("请检查配置信息是否填写正确!");
LogUtil.error(e);
}
String resultForObject = (String) getResultForObject(String.class, response);
JSONObject jsonObject = JSONObject.parseObject(resultForObject);
String data = jsonObject.getString("data");

View File

@ -157,7 +157,13 @@ public abstract class ZentaoClient extends BaseClient {
String sessionId = login();
ResponseEntity<String> response = restTemplate.exchange(requestUrl.getBugList(),
HttpMethod.GET, null, String.class, projectId, 9999999, pageSize, pageNum, sessionId);
try {
return JSONObject.parseObject(response.getBody()).getJSONObject("data").getJSONArray("bugs");
} catch (Exception e) {
LogUtil.error(e);
MSException.throwException("请检查配置信息是否填写正确!");
}
return null;
}
public String getBaseUrl() {