fix: jira校验报错

This commit is contained in:
chenjianxing 2021-06-16 18:16:11 +08:00 committed by jianxing
parent 555a70d745
commit 062a237775
2 changed files with 10 additions and 2 deletions

View File

@ -44,7 +44,7 @@ public abstract class JiraAbstractClient extends BaseClient {
} }
public String getIssueCreateMetadata() { public String getIssueCreateMetadata() {
ResponseEntity<String> response = restTemplate.exchange(getBaseUrl() + "/createmeta", HttpMethod.GET, getAuthHttpEntity(), String.class); ResponseEntity<String> response = restTemplate.exchange(getBaseUrl() + "/issue/createmeta", HttpMethod.GET, getAuthHttpEntity(), String.class);
return (String) getResultForObject(String.class, response); return (String) getResultForObject(String.class, response);
} }

View File

@ -24,6 +24,7 @@ import io.metersphere.log.vo.track.TestPlanReference;
import io.metersphere.notice.sender.NoticeModel; import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService; import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.IntegrationService; import io.metersphere.service.IntegrationService;
import io.metersphere.service.IssueTemplateService;
import io.metersphere.service.ProjectService; import io.metersphere.service.ProjectService;
import io.metersphere.track.issue.*; import io.metersphere.track.issue.*;
import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.issue.domain.PlatformUser;
@ -68,6 +69,8 @@ public class IssuesService {
private ExtIssuesMapper extIssuesMapper; private ExtIssuesMapper extIssuesMapper;
@Resource @Resource
private WorkspaceMapper workspaceMapper; private WorkspaceMapper workspaceMapper;
@Resource
private IssueTemplateService issueTemplateService;
public void testAuth(String platform) { public void testAuth(String platform) {
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, new IssuesRequest()); AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, new IssuesRequest());
@ -160,11 +163,16 @@ public class IssuesService {
public String getIssueTemplate(String projectId) { public String getIssueTemplate(String projectId) {
Project project = projectService.getProjectById(projectId); Project project = projectService.getProjectById(projectId);
IssueTemplate issueTemplate = null;
String id = project.getIssueTemplateId(); String id = project.getIssueTemplateId();
if (StringUtils.isBlank(id)) { if (StringUtils.isBlank(id)) {
issueTemplate = issueTemplateService.getDefaultTemplate(project.getWorkspaceId());
} else {
issueTemplate = issueTemplateMapper.selectByPrimaryKey(id);
}
if (issueTemplate == null) {
MSException.throwException("project issue template id is null."); MSException.throwException("project issue template id is null.");
} }
IssueTemplate issueTemplate = issueTemplateMapper.selectByPrimaryKey(id);
String platform = issueTemplate.getPlatform(); String platform = issueTemplate.getPlatform();
if (StringUtils.equals(platform, "metersphere")) { if (StringUtils.equals(platform, "metersphere")) {
return IssuesManagePlatform.Local.name(); return IssuesManagePlatform.Local.name();