fix: 非企业版勾选使用jira模板点同步缺陷会报错
This commit is contained in:
parent
ef93c1ee92
commit
bf5e92d34f
|
@ -512,6 +512,16 @@ public class ProjectService {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isThirdPartTemplate(String projectId) {
|
||||||
|
Project project = getProjectById(projectId);
|
||||||
|
if (project.getThirdPartTemplate() != null && project.getThirdPartTemplate()
|
||||||
|
&& project.getPlatform().equals(IssuesManagePlatform.Jira.name())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean useCustomNum(String projectId) {
|
public boolean useCustomNum(String projectId) {
|
||||||
Project project = this.getProjectById(projectId);
|
Project project = this.getProjectById(projectId);
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import io.metersphere.commons.constants.CustomFieldType;
|
||||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||||
import io.metersphere.commons.constants.IssuesStatus;
|
import io.metersphere.commons.constants.IssuesStatus;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.dto.CustomFieldDao;
|
import io.metersphere.dto.CustomFieldDao;
|
||||||
import io.metersphere.dto.CustomFieldItemDTO;
|
import io.metersphere.dto.CustomFieldItemDTO;
|
||||||
|
@ -21,6 +22,7 @@ import io.metersphere.track.issue.domain.PlatformUser;
|
||||||
import io.metersphere.track.issue.domain.jira.*;
|
import io.metersphere.track.issue.domain.jira.*;
|
||||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||||
|
import io.metersphere.track.service.IssuesService;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.commonmark.node.Node;
|
import org.commonmark.node.Node;
|
||||||
|
@ -297,7 +299,13 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void syncIssues(Project project, List<IssuesDao> issues) {
|
public void syncIssues(Project project, List<IssuesDao> issues) {
|
||||||
isThirdPartTemplate = isThirdPartTemplate();
|
super.isThirdPartTemplate = isThirdPartTemplate();
|
||||||
|
|
||||||
|
IssuesService issuesService = CommonBeanFactory.getBean(IssuesService.class);
|
||||||
|
if (project.getThirdPartTemplate()) {
|
||||||
|
super.defaultCustomFields = issuesService.getCustomFieldsValuesString(getThirdPartTemplate().getCustomFields());
|
||||||
|
}
|
||||||
|
|
||||||
issues.forEach(item -> {
|
issues.forEach(item -> {
|
||||||
try {
|
try {
|
||||||
IssuesWithBLOBs issuesWithBLOBs = issuesMapper.selectByPrimaryKey(item.getId());
|
IssuesWithBLOBs issuesWithBLOBs = issuesMapper.selectByPrimaryKey(item.getId());
|
||||||
|
|
|
@ -442,8 +442,10 @@ public class IssuesService {
|
||||||
IssuesRequest issuesRequest = new IssuesRequest();
|
IssuesRequest issuesRequest = new IssuesRequest();
|
||||||
issuesRequest.setProjectId(projectId);
|
issuesRequest.setProjectId(projectId);
|
||||||
issuesRequest.setWorkspaceId(project.getWorkspaceId());
|
issuesRequest.setWorkspaceId(project.getWorkspaceId());
|
||||||
String defaultCustomFields = getDefaultCustomFields(projectId);
|
if (!projectService.isThirdPartTemplate(projectId)) {
|
||||||
issuesRequest.setDefaultCustomFields(defaultCustomFields);
|
String defaultCustomFields = getDefaultCustomFields(projectId);
|
||||||
|
issuesRequest.setDefaultCustomFields(defaultCustomFields);
|
||||||
|
}
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(tapdIssues)) {
|
if (CollectionUtils.isNotEmpty(tapdIssues)) {
|
||||||
TapdPlatform tapdPlatform = new TapdPlatform(issuesRequest);
|
TapdPlatform tapdPlatform = new TapdPlatform(issuesRequest);
|
||||||
|
@ -471,6 +473,7 @@ public class IssuesService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取默认的自定义字段的取值,同步之后更新成第三方平台的值
|
* 获取默认的自定义字段的取值,同步之后更新成第三方平台的值
|
||||||
*
|
*
|
||||||
|
|
|
@ -185,6 +185,8 @@ public class TestPlanService {
|
||||||
private ApiTestCaseService apiTestCaseService;
|
private ApiTestCaseService apiTestCaseService;
|
||||||
@Resource
|
@Resource
|
||||||
private LoadTestMapper loadTestMapper;
|
private LoadTestMapper loadTestMapper;
|
||||||
|
@Resource
|
||||||
|
private ProjectService projectService;
|
||||||
|
|
||||||
public synchronized TestPlan addTestPlan(AddTestPlanRequest testPlan) {
|
public synchronized TestPlan addTestPlan(AddTestPlanRequest testPlan) {
|
||||||
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
||||||
|
@ -1827,7 +1829,6 @@ public class TestPlanService {
|
||||||
report.setEndTime(testPlan.getActualEndTime());
|
report.setEndTime(testPlan.getActualEndTime());
|
||||||
report.setSummary(testPlan.getReportSummary());
|
report.setSummary(testPlan.getReportSummary());
|
||||||
report.setConfig(testPlan.getReportConfig());
|
report.setConfig(testPlan.getReportConfig());
|
||||||
IssueTemplateDao template = issueTemplateService.getTemplate(testPlan.getProjectId());
|
|
||||||
testPlanTestCaseService.calculatePlanReport(planId, report);
|
testPlanTestCaseService.calculatePlanReport(planId, report);
|
||||||
issuesService.calculatePlanReport(planId, report);
|
issuesService.calculatePlanReport(planId, report);
|
||||||
if (testPlanExecuteReportDTO == null) {
|
if (testPlanExecuteReportDTO == null) {
|
||||||
|
@ -1858,7 +1859,8 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
|
|
||||||
report.setName(testPlan.getName());
|
report.setName(testPlan.getName());
|
||||||
if (template == null || template.getPlatform().equals("metersphere")) {
|
Project project = projectService.getProjectById(testPlan.getProjectId());
|
||||||
|
if (project.getPlatform() != null && project.getPlatform().equals(IssuesManagePlatform.Local.name())) {
|
||||||
report.setIsThirdPartIssue(false);
|
report.setIsThirdPartIssue(false);
|
||||||
} else {
|
} else {
|
||||||
report.setIsThirdPartIssue(true);
|
report.setIsThirdPartIssue(true);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ceffcd883aa519d3f7bfb2641337abaaae4c9295
|
Subproject commit b0ec4c9d288471d2d9653ca5202ad067c3b380f2
|
|
@ -225,15 +225,19 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
// 解决错位问题
|
this.page.result.loading = true;
|
||||||
window.addEventListener('resize', this.tableDoLayout);
|
this.$nextTick(() => {
|
||||||
getProjectMember((data) => {
|
// 解决错位问题
|
||||||
this.members = data;
|
window.addEventListener('resize', this.tableDoLayout);
|
||||||
|
getProjectMember((data) => {
|
||||||
|
this.members = data;
|
||||||
|
});
|
||||||
|
getIssuePartTemplateWithProject((template) => {
|
||||||
|
this.initFields(template);
|
||||||
|
this.page.result.loading = false;
|
||||||
|
});
|
||||||
|
this.getIssues();
|
||||||
});
|
});
|
||||||
getIssuePartTemplateWithProject((template) => {
|
|
||||||
this.initFields(template);
|
|
||||||
});
|
|
||||||
this.getIssues();
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
platformFilters() {
|
platformFilters() {
|
||||||
|
|
|
@ -227,6 +227,7 @@ export function getPageInfo(condition) {
|
||||||
result: {},
|
result: {},
|
||||||
data: [],
|
data: [],
|
||||||
condition: condition ? condition : {},
|
condition: condition ? condition : {},
|
||||||
|
loading: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue