fix: 获取jira模板报错提示优化
--bug=1009273 --user=陈建星 [github#8805]使用jira模版选择数据异常 https://www.tapd.cn/55049933/s/1087964444
This commit is contained in:
parent
de2665e53c
commit
a5e120848f
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.track.issue.domain.jira.*;
|
import io.metersphere.track.issue.domain.jira.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.core.io.FileSystemResource;
|
import org.springframework.core.io.FileSystemResource;
|
||||||
|
@ -35,14 +36,19 @@ public abstract class JiraAbstractClient extends BaseClient {
|
||||||
public Map<String, JiraCreateMetadataResponse.Field> getCreateMetadata(String projectKey, String issueType) {
|
public Map<String, JiraCreateMetadataResponse.Field> getCreateMetadata(String projectKey, String issueType) {
|
||||||
String url = getBaseUrl() + "/issue/createmeta?projectKeys={1}&issuetypeNames={2}&expand=projects.issuetypes.fields";
|
String url = getBaseUrl() + "/issue/createmeta?projectKeys={1}&issuetypeNames={2}&expand=projects.issuetypes.fields";
|
||||||
ResponseEntity<String> response = null;
|
ResponseEntity<String> response = null;
|
||||||
|
Map<String, JiraCreateMetadataResponse.Field> fields = null;
|
||||||
try {
|
try {
|
||||||
response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, projectKey, issueType);
|
response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, projectKey, issueType);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e.getMessage(), e);
|
LogUtil.error(e.getMessage(), e);
|
||||||
MSException.throwException(e.getMessage());
|
MSException.throwException(e.getMessage());
|
||||||
}
|
}
|
||||||
Map<String, JiraCreateMetadataResponse.Field> fields = ((JiraCreateMetadataResponse) getResultForObject(JiraCreateMetadataResponse.class, response))
|
try {
|
||||||
.getProjects().get(0).getIssuetypes().get(0).getFields();
|
fields = ((JiraCreateMetadataResponse) getResultForObject(JiraCreateMetadataResponse.class, response))
|
||||||
|
.getProjects().get(0).getIssuetypes().get(0).getFields();
|
||||||
|
} catch (Exception e) {
|
||||||
|
MSException.throwException(Translator.get("issue_jira_info_error"));
|
||||||
|
}
|
||||||
fields.remove("project");
|
fields.remove("project");
|
||||||
fields.remove("issuetype");
|
fields.remove("issuetype");
|
||||||
return fields;
|
return fields;
|
||||||
|
|
|
@ -73,3 +73,4 @@ mock_warning=
|
||||||
invalid_parameter=
|
invalid_parameter=
|
||||||
workspace_template_settings_issue=
|
workspace_template_settings_issue=
|
||||||
zentao_test_type_error=
|
zentao_test_type_error=
|
||||||
|
issue_jira_info_error=
|
||||||
|
|
|
@ -292,3 +292,4 @@ enterprise_test_report=Enterprise report
|
||||||
null_environment_group_name = Environment group name is null
|
null_environment_group_name = Environment group name is null
|
||||||
environment_group_name = Environment group name
|
environment_group_name = Environment group name
|
||||||
environment_group_exist = already exists
|
environment_group_exist = already exists
|
||||||
|
issue_jira_info_error=Check the service integration information or Jira project ID
|
||||||
|
|
|
@ -290,4 +290,5 @@ enterprise_test_report=项目报告
|
||||||
#环境组
|
#环境组
|
||||||
null_environment_group_name = 环境组名称不存在
|
null_environment_group_name = 环境组名称不存在
|
||||||
environment_group_name = 环境组名称
|
environment_group_name = 环境组名称
|
||||||
environment_group_exist = 已存在
|
environment_group_exist = 已存在
|
||||||
|
issue_jira_info_error=请检查服务集成信息或Jira项目ID
|
||||||
|
|
|
@ -290,4 +290,5 @@ enterprise_test_report=項目報告
|
||||||
#环境组
|
#环境组
|
||||||
null_environment_group_name = 環境組名稱不存在
|
null_environment_group_name = 環境組名稱不存在
|
||||||
environment_group_name = 環境組名稱
|
environment_group_name = 環境組名稱
|
||||||
environment_group_exist = 已存在
|
environment_group_exist = 已存在
|
||||||
|
issue_jira_info_error=請檢查服務集成信息或Jira項目ID
|
||||||
|
|
Loading…
Reference in New Issue