refactor(缺陷管理): 优化缺陷插件逻辑
This commit is contained in:
parent
102aa3a88e
commit
7fb02e6c4e
|
@ -34,4 +34,8 @@ public class PlatformBugUpdateRequest extends PlatformBugDTO {
|
|||
* MS平台缺陷富文本文件集合
|
||||
*/
|
||||
private Map<String, File> richFileMap = new HashMap<>();
|
||||
/**
|
||||
* 当前MS站点URL
|
||||
*/
|
||||
private String baseUrl;
|
||||
}
|
||||
|
|
|
@ -72,10 +72,11 @@ public interface Platform extends ExtensionPoint {
|
|||
* 获取第三方平台缺陷状态选项
|
||||
* @param projectConfig 项目配置信息
|
||||
* @param issueKey 缺陷ID
|
||||
* @param previousStatus 当前状态
|
||||
* @return 缺陷平台状态
|
||||
* @throws Exception 获取平台状态异常
|
||||
*/
|
||||
List<SelectOption> getStatusTransitions(String projectConfig, String issueKey) throws Exception;
|
||||
List<SelectOption> getStatusTransitions(String projectConfig, String issueKey, String previousStatus) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取第三方平台关联需求列表
|
||||
|
|
|
@ -12,7 +12,11 @@ public enum BugPlatform {
|
|||
/**
|
||||
* 本地
|
||||
*/
|
||||
LOCAL("Local");
|
||||
LOCAL("Local"),
|
||||
JIRA("JIRA"),
|
||||
ZENTAO("禅道"),
|
||||
TAPD("TAPD");
|
||||
|
||||
|
||||
private final String name;
|
||||
|
||||
|
|
|
@ -46,10 +46,7 @@ import io.metersphere.system.log.dto.LogDTO;
|
|||
import io.metersphere.system.log.service.OperationLogService;
|
||||
import io.metersphere.system.mapper.BaseUserMapper;
|
||||
import io.metersphere.system.mapper.TemplateMapper;
|
||||
import io.metersphere.system.service.BaseTemplateCustomFieldService;
|
||||
import io.metersphere.system.service.BaseTemplateService;
|
||||
import io.metersphere.system.service.PlatformPluginService;
|
||||
import io.metersphere.system.service.UserPlatformAccountService;
|
||||
import io.metersphere.system.service.*;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
import io.metersphere.system.uid.NumGenerator;
|
||||
import io.metersphere.system.utils.ServiceUtils;
|
||||
|
@ -160,6 +157,8 @@ public class BugService {
|
|||
private BugAttachmentService bugAttachmentService;
|
||||
@Resource
|
||||
private BugPlatformService bugPlatformService;
|
||||
@Resource
|
||||
private SystemParameterService systemParameterService;
|
||||
|
||||
public static final Long INTERVAL_POS = 5000L;
|
||||
|
||||
|
@ -1193,6 +1192,7 @@ public class BugService {
|
|||
}
|
||||
});
|
||||
}
|
||||
platformRequest.setBaseUrl(systemParameterService.getBaseInfo().getUrl());
|
||||
return platformRequest;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,17 @@ public class BugStatusService {
|
|||
// 第三方平台状态流
|
||||
Platform platform = projectApplicationService.getPlatform(projectId, true);
|
||||
String projectConfig = projectApplicationService.getProjectBugThirdPartConfig(projectId);
|
||||
// 获取一条最新的Jira默认模板缺陷Key
|
||||
String issueKey;
|
||||
if (StringUtils.equals(platformName, BugPlatform.JIRA.name())) {
|
||||
// 如果是Jira平台, 获取一条最新的缺陷默认Key作为参数
|
||||
issueKey = getJiraPlatformBugKeyLatest(projectId);
|
||||
} else {
|
||||
// 其余平台获取表头状态流暂不需要issue key参数
|
||||
issueKey = platformName;
|
||||
}
|
||||
List<SelectOption> platformStatusOption = new ArrayList<>();
|
||||
try {
|
||||
platformStatusOption = platform.getStatusTransitions(projectConfig, getJiraPlatformBugKeyLatest(projectId));
|
||||
platformStatusOption = platform.getStatusTransitions(projectConfig, issueKey, null);
|
||||
} catch (Exception e) {
|
||||
LogUtils.error("获取平台状态选项有误: " + e.getMessage());
|
||||
}
|
||||
|
@ -73,7 +80,7 @@ public class BugStatusService {
|
|||
String projectConfig = projectApplicationService.getProjectBugThirdPartConfig(projectId);
|
||||
List<SelectOption> platformOption = new ArrayList<>();
|
||||
try {
|
||||
platformOption = platform.getStatusTransitions(projectConfig, platformBugKey);
|
||||
platformOption = platform.getStatusTransitions(projectConfig, platformBugKey, fromStatusId);
|
||||
} catch (Exception e) {
|
||||
LogUtils.error("获取平台状态选项有误: " + e.getMessage());
|
||||
}
|
||||
|
@ -102,7 +109,7 @@ public class BugStatusService {
|
|||
|
||||
public String getJiraPlatformBugKeyLatest(String projectId) {
|
||||
BugExample example = new BugExample();
|
||||
example.createCriteria().andPlatformEqualTo("JIRA").andProjectIdEqualTo(projectId);
|
||||
example.createCriteria().andPlatformEqualTo(BugPlatform.JIRA.name()).andProjectIdEqualTo(projectId);
|
||||
example.setOrderByClause("create_time desc");
|
||||
List<Bug> bugs = bugMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(bugs)) {
|
||||
|
|
|
@ -694,7 +694,7 @@ public class BugControllerTests extends BaseTest {
|
|||
|
||||
@Test
|
||||
@Order(99)
|
||||
void coverZentaoBugTests() throws Exception {
|
||||
void coverExtraBugTests() throws Exception {
|
||||
// 批量删除
|
||||
BugBatchRequest request = new BugBatchRequest();
|
||||
request.setProjectId("default-project-for-bug");
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue