fix(系统设置): 编辑项目时验证集成平台的关联项目报错
--bug=1017735 --user=李玉号 【系统设置】MS集成禅道后,验证项目ID没有反应,接口有报错 https://www.tapd.cn/55049933/s/1258166
This commit is contained in:
parent
67322d8ebb
commit
1d30a1ee88
|
@ -126,4 +126,14 @@ public class SystemProjectController {
|
|||
public Object getFieldTemplateOption(@PathVariable String type, @PathVariable(required = false) String projectId) {
|
||||
return microService.getForData(MicroServiceName.PROJECT_MANAGEMENT, String.format("/field/template/%s/option/%s", type, projectId));
|
||||
}
|
||||
|
||||
@PostMapping("/check/third/project")
|
||||
public void checkThirdProjectExist(@RequestBody Project project) {
|
||||
microService.postForData(MicroServiceName.TEST_TRACK, "/issues/check/third/project", project);
|
||||
}
|
||||
|
||||
@PostMapping("/issues/jira/issuetype")
|
||||
public Object getJiraIssueType(@RequestBody Object request) {
|
||||
return microService.postForData(MicroServiceName.TEST_TRACK, "/issues/jira/issuetype", request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.github.pagehelper.Page;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.Issues;
|
||||
import io.metersphere.base.domain.IssuesWithBLOBs;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.constants.OperLogModule;
|
||||
|
@ -184,4 +185,9 @@ public class IssuesController {
|
|||
public List<PlatformStatusDTO> getPlatformTransitions(@RequestBody PlatformIssueTypeRequest request) {
|
||||
return issuesService.getPlatformTransitions(request);
|
||||
}
|
||||
|
||||
@PostMapping("/check/third/project")
|
||||
public void checkThirdProjectExist(@RequestBody Project project) {
|
||||
issuesService.checkThirdProjectExist(project);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import io.metersphere.service.wapper.TrackProjectService;
|
|||
import io.metersphere.xpack.track.dto.PlatformStatusDTO;
|
||||
import io.metersphere.xpack.track.issue.IssuesPlatform;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
|
@ -1002,4 +1003,34 @@ public class IssuesService {
|
|||
public boolean isThirdPartTemplate(Project project) {
|
||||
return project.getThirdPartTemplate() != null && project.getThirdPartTemplate() && project.getPlatform().equals(IssuesManagePlatform.Jira.name());
|
||||
}
|
||||
|
||||
|
||||
public void checkThirdProjectExist(Project project) {
|
||||
IssuesRequest issuesRequest = new IssuesRequest();
|
||||
if (StringUtils.isBlank(project.getId())) {
|
||||
MSException.throwException("project ID cannot be empty");
|
||||
}
|
||||
issuesRequest.setProjectId(project.getId());
|
||||
issuesRequest.setWorkspaceId(project.getWorkspaceId());
|
||||
if (StringUtils.equalsIgnoreCase(project.getPlatform(), IssuesManagePlatform.Tapd.name())) {
|
||||
TapdPlatform tapd = new TapdPlatform(issuesRequest);
|
||||
this.doCheckThirdProjectExist(tapd, project.getTapdId());
|
||||
} else if (StringUtils.equalsIgnoreCase(project.getPlatform(), IssuesManagePlatform.Jira.name())) {
|
||||
JiraPlatform jira = new JiraPlatform(issuesRequest);
|
||||
this.doCheckThirdProjectExist(jira, project.getJiraKey());
|
||||
} else if (StringUtils.equalsIgnoreCase(project.getPlatform(), IssuesManagePlatform.Zentao.name())) {
|
||||
ZentaoPlatform zentao = new ZentaoPlatform(issuesRequest);
|
||||
this.doCheckThirdProjectExist(zentao, project.getZentaoId());
|
||||
}
|
||||
}
|
||||
|
||||
private void doCheckThirdProjectExist(AbstractIssuePlatform platform, String relateId) {
|
||||
if (StringUtils.isBlank(relateId)) {
|
||||
MSException.throwException(Translator.get("issue_project_not_exist"));
|
||||
}
|
||||
Boolean exist = platform.checkProjectExist(relateId);
|
||||
if (BooleanUtils.isFalse(exist)) {
|
||||
MSException.throwException(Translator.get("issue_project_not_exist"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue