fix: 配置jira第三方模板
This commit is contained in:
parent
7708a39416
commit
378426795e
|
@ -225,6 +225,34 @@ public class IssueTemplateService extends TemplateBaseService {
|
|||
} else {
|
||||
issueTemplate = getDefaultTemplate(project.getWorkspaceId());
|
||||
}
|
||||
if (!project.getPlatform().equals(issueTemplate.getPlatform())) {
|
||||
MSException.throwException("请在项目中配置缺陷模板");
|
||||
}
|
||||
BeanUtils.copyBean(issueTemplateDao, issueTemplate);
|
||||
List<CustomFieldDao> result = customFieldService.getCustomFieldByTemplateId(issueTemplate.getId());
|
||||
issueTemplateDao.setCustomFields(result);
|
||||
return issueTemplateDao;
|
||||
}
|
||||
|
||||
public IssueTemplateDao getTemplate(String projectId, boolean thirdPartTemplate) {
|
||||
Project project = projectService.getProjectById(projectId);
|
||||
if (thirdPartTemplate) {
|
||||
|
||||
}
|
||||
String issueTemplateId = project.getIssueTemplateId();
|
||||
IssueTemplate issueTemplate;
|
||||
IssueTemplateDao issueTemplateDao = new IssueTemplateDao();
|
||||
if (StringUtils.isNotBlank(issueTemplateId)) {
|
||||
issueTemplate = issueTemplateMapper.selectByPrimaryKey(issueTemplateId);
|
||||
if (issueTemplate == null) {
|
||||
issueTemplate = getDefaultTemplate(project.getWorkspaceId());
|
||||
}
|
||||
} else {
|
||||
issueTemplate = getDefaultTemplate(project.getWorkspaceId());
|
||||
}
|
||||
if (!project.getPlatform().equals(issueTemplate.getPlatform())) {
|
||||
MSException.throwException("请在项目中配置缺陷模板");
|
||||
}
|
||||
BeanUtils.copyBean(issueTemplateDao, issueTemplate);
|
||||
List<CustomFieldDao> result = customFieldService.getCustomFieldByTemplateId(issueTemplate.getId());
|
||||
issueTemplateDao.setCustomFields(result);
|
||||
|
|
|
@ -1255,7 +1255,7 @@ public class UserService {
|
|||
public UserDTO.PlatformInfo getCurrentPlatformInfo(String workspaceId) {
|
||||
User user = userMapper.selectByPrimaryKey(SessionUtils.getUserId());
|
||||
String platformInfoStr = user.getPlatformInfo();
|
||||
if (StringUtils.isBlank(workspaceId) || StringUtils.isBlank(platformInfoStr)) {
|
||||
if (StringUtils.isBlank(workspaceId) || StringUtils.isBlank(platformInfoStr) || platformInfoStr.equals("null")) {
|
||||
return null;
|
||||
}
|
||||
JSONObject platformInfos = JSONObject.parseObject(platformInfoStr);
|
||||
|
|
|
@ -233,17 +233,21 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
fields.put(fieldName, attrs);
|
||||
} else if (StringUtils.equalsAny(item.getType(), "cascadingSelect")) {
|
||||
if (item.getValue() != null) {
|
||||
JSONArray values = (JSONArray)item.getValue();
|
||||
JSONObject attr = new JSONObject();
|
||||
if (CollectionUtils.isNotEmpty(values)) {
|
||||
if (values.size() > 0) {
|
||||
attr.put("id", values.get(0));
|
||||
}
|
||||
if (values.size() > 1) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("id", values.get(1));
|
||||
attr.put("child", param);
|
||||
if (item.getValue() instanceof JSONArray) {
|
||||
JSONArray values = (JSONArray) item.getValue();
|
||||
if (CollectionUtils.isNotEmpty(values)) {
|
||||
if (values.size() > 0) {
|
||||
attr.put("id", values.get(0));
|
||||
}
|
||||
if (values.size() > 1) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("id", values.get(1));
|
||||
attr.put("child", param);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
attr.put("id", item.getValue());
|
||||
}
|
||||
fields.put(fieldName, attr);
|
||||
}
|
||||
|
|
|
@ -128,12 +128,10 @@ public class IssuesService {
|
|||
List<String> platforms = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(updateRequest.getTestCaseId())) {
|
||||
// 测试计划关联
|
||||
String p = getPlatformsByCaseId(updateRequest.getTestCaseId());
|
||||
platforms.add(p);
|
||||
platforms.add(getPlatformsByCaseId(updateRequest.getTestCaseId()));
|
||||
} else {
|
||||
// 缺陷管理关联
|
||||
String t = getIssueTemplate(updateRequest.getProjectId());
|
||||
platforms.add(t);
|
||||
platforms.add(getPlatform(updateRequest.getProjectId()));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(platforms)) {
|
||||
|
@ -193,26 +191,12 @@ public class IssuesService {
|
|||
public String getPlatformsByCaseId(String caseId) {
|
||||
TestCaseWithBLOBs testCase = testCaseService.getTestCase(caseId);
|
||||
Project project = projectService.getProjectById(testCase.getProjectId());
|
||||
return getIssueTemplate(project.getId());
|
||||
return getPlatform(project.getId());
|
||||
}
|
||||
|
||||
public String getIssueTemplate(String projectId) {
|
||||
public String getPlatform(String projectId) {
|
||||
Project project = projectService.getProjectById(projectId);
|
||||
IssueTemplate issueTemplate;
|
||||
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.");
|
||||
}
|
||||
String platform = issueTemplate.getPlatform();
|
||||
if (StringUtils.equals(platform, "metersphere")) {
|
||||
return IssuesManagePlatform.Local.name();
|
||||
}
|
||||
return platform;
|
||||
return project.getPlatform();
|
||||
}
|
||||
|
||||
public List<String> getPlatforms(Project project) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8bd3730267a6c1b383a781b3c4ef8526e5414d82
|
||||
Subproject commit cf8337c9a6341d8c9eb7f5c9bef897083b0d2951
|
|
@ -120,7 +120,7 @@
|
|||
},
|
||||
getPlatformInfo(row) {
|
||||
let orgId = getCurrentWorkspaceId();
|
||||
if (row.platformInfo) {
|
||||
if (row.platformInfo && row.platformInfo !== 'null') {
|
||||
this.form = row;
|
||||
if (!row.platformInfo[orgId]) {
|
||||
this.form.platformInfo = JSON.parse(row.platformInfo);
|
||||
|
|
|
@ -182,23 +182,21 @@ export default {
|
|||
let initAddFuc = this.initEdit;
|
||||
getCurrentProject((responseData) => {
|
||||
this.currentProject = responseData;
|
||||
this.$nextTick(() => {
|
||||
if (this.enableThirdPartTemplate) {
|
||||
getIssueThirdPartTemplate()
|
||||
.then((template) => {
|
||||
this.issueTemplate = template;
|
||||
this.getThirdPartyInfo();
|
||||
initAddFuc(data);
|
||||
});
|
||||
} else {
|
||||
getIssueTemplate()
|
||||
.then((template) => {
|
||||
this.issueTemplate = template;
|
||||
this.getThirdPartyInfo();
|
||||
initAddFuc(data);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (hasLicense() && this.currentProject && this.currentProject.thirdPartTemplate && this.currentProject.platform === JIRA) {
|
||||
getIssueThirdPartTemplate()
|
||||
.then((template) => {
|
||||
this.issueTemplate = template;
|
||||
this.getThirdPartyInfo();
|
||||
initAddFuc(data);
|
||||
});
|
||||
} else {
|
||||
getIssueTemplate()
|
||||
.then((template) => {
|
||||
this.issueTemplate = template;
|
||||
this.getThirdPartyInfo();
|
||||
initAddFuc(data);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if(data&&data.id){
|
||||
|
|
Loading…
Reference in New Issue