fix(测试跟踪): jira插件jiraKey兼容性问题

--bug=1020151 --user=陈建星 【测试跟踪】测试计划-功能用例-脑图/列表-添加jira缺陷报错 https://www.tapd.cn/55049933/s/1303056
This commit is contained in:
chenjianxing 2022-11-23 17:05:19 +08:00 committed by jianxing
parent 1bf53e0e0e
commit 3f3763c726
2 changed files with 12 additions and 5 deletions

View File

@ -109,7 +109,7 @@ export default {
check() { check() {
validateProjectConfig(this.config.id, this.form) validateProjectConfig(this.config.id, this.form)
.then(() => { .then(() => {
this.$success(this.$t("system.check_third_project_success")); this.$success(this.$t("pj.check_third_project_success"));
}); });
}, },
validate() { validate() {

View File

@ -101,14 +101,21 @@ public class PlatformPluginService {
public static String getCompatibleProjectConfig(Project project) { public static String getCompatibleProjectConfig(Project project) {
String issueConfig = project.getIssueConfig(); String issueConfig = project.getIssueConfig();
Map map = JSON.parseMap(issueConfig); Map map = JSON.parseMap(issueConfig);
map.put("jiraKey", project.getJiraKey()); compatibleProjectKey(map, "jiraKey", project.getJiraKey());
map.put("tapdId", project.getTapdId()); compatibleProjectKey(map, "tapdId", project.getTapdId());
map.put("azureDevopsId", project.getAzureDevopsId()); compatibleProjectKey(map, "azureDevopsId", project.getAzureDevopsId());
map.put("zentaoId", project.getZentaoId()); compatibleProjectKey(map, "zentaoId", project.getZentaoId());
map.put("thirdPartTemplate", project.getThirdPartTemplate()); map.put("thirdPartTemplate", project.getThirdPartTemplate());
return JSON.toJSONString(map); return JSON.toJSONString(map);
} }
private static void compatibleProjectKey(Map map, String name, String compatibleValue) {
if (map.get(name) == null || StringUtils.isBlank(map.get(name).toString())) {
// 如果配置里面缺陷对应平台的项目ID则即使用旧数据的项目ID
map.put(name, compatibleValue);
}
}
public static boolean isPluginPlatform(String platform) { public static boolean isPluginPlatform(String platform) {
if (StringUtils.equalsAnyIgnoreCase(platform, if (StringUtils.equalsAnyIgnoreCase(platform,
IssuesManagePlatform.Tapd.name(), IssuesManagePlatform.AzureDevops.name(), IssuesManagePlatform.Tapd.name(), IssuesManagePlatform.AzureDevops.name(),