fix: jira校验报错

This commit is contained in:
chenjianxing 2021-06-16 18:16:11 +08:00 committed by BugKing
parent bd735bc803
commit befd9dd053
2 changed files with 10 additions and 2 deletions

View File

@ -44,7 +44,7 @@ public abstract class JiraAbstractClient extends BaseClient {
}
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);
}

View File

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