fix(缺项管理): 缺陷列表部分系统字段解析问题
This commit is contained in:
parent
9975bc12db
commit
fbef87ad59
|
@ -32,6 +32,9 @@ public class BugDTO extends Bug {
|
|||
@Schema(description = "关联用例数量")
|
||||
private Integer relationCaseCount;
|
||||
|
||||
@Schema(description = "状态名称")
|
||||
private String statusName;
|
||||
|
||||
@Schema(description = "自定义字段集合")
|
||||
private List<BugCustomFieldDTO> customFields;
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ public class BugService {
|
|||
Platform platform = platformPluginService.getPlatform(serviceIntegration.getPluginId(), serviceIntegration.getOrganizationId(),
|
||||
new String(serviceIntegration.getConfiguration()));
|
||||
PlatformBugUpdateRequest platformRequest = buildPlatformBugRequest(request);
|
||||
platformRequest.setUserPlatformConfig(JSON.toJSONString(userPlatformAccountService.get(currentUser, currentOrgId)));
|
||||
platformRequest.setUserPlatformConfig(JSON.toJSONString(userPlatformAccountService.getPluginUserPlatformConfig(serviceIntegration.getPluginId(), currentOrgId, currentUser)));
|
||||
platformRequest.setProjectConfig(projectApplicationService.getProjectBugThirdPartConfig(request.getProjectId()));
|
||||
if (isUpdate) {
|
||||
Bug bug = bugMapper.selectByPrimaryKey(request.getId());
|
||||
|
@ -1114,7 +1114,18 @@ public class BugService {
|
|||
List<String> ids = bugs.stream().map(BugDTO::getId).toList();
|
||||
List<BugCustomFieldDTO> customFields = extBugCustomFieldMapper.getBugAllCustomFields(ids, projectId);
|
||||
Map<String, List<BugCustomFieldDTO>> customFieldMap = customFields.stream().collect(Collectors.groupingBy(BugCustomFieldDTO::getBugId));
|
||||
bugs.forEach(bug -> bug.setCustomFields(customFieldMap.get(bug.getId())));
|
||||
// 处理人选项
|
||||
List<SelectOption> handleUserOption = bugCommonService.getHeaderHandlerOption(projectId);
|
||||
Map<String, String> handleMap = handleUserOption.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText));
|
||||
// 状态选项
|
||||
List<SelectOption> statusOption = bugStatusService.getHeaderStatusOption(projectId);
|
||||
Map<String, String> statusMap = statusOption.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText));
|
||||
bugs.forEach(bug -> {
|
||||
bug.setCustomFields(customFieldMap.get(bug.getId()));
|
||||
// 解析处理人, 状态, 严重程度
|
||||
bug.setHandleUserName(handleMap.get(bug.getHandleUser()));
|
||||
bug.setStatusName(statusMap.get(bug.getStatus()));
|
||||
});
|
||||
return bugs;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ public class BugStatusService {
|
|||
|
||||
public String getJiraPlatformBugKeyLatest(String projectId) {
|
||||
BugExample example = new BugExample();
|
||||
example.createCriteria().andTemplateIdEqualTo("jira").andProjectIdEqualTo(projectId);
|
||||
example.createCriteria().andPlatformEqualTo("JIRA").andProjectIdEqualTo(projectId);
|
||||
example.setOrderByClause("create_time desc");
|
||||
List<Bug> bugs = bugMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(bugs)) {
|
||||
|
|
|
@ -109,4 +109,21 @@ public class UserPlatformAccountService {
|
|||
// noinspection unchecked
|
||||
return (Map<String, Object>) userPlatformInfo.get(orgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取插件个人三方平台账号
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param orgId 组织ID
|
||||
* @return 三方平台账号
|
||||
*/
|
||||
public Map<String, Object> getPluginUserPlatformConfig(String pluginId, String orgId, String userId) {
|
||||
// 获取组织用户集成信息
|
||||
Map<String, Object> userPlatformInfo = get(userId, orgId);
|
||||
if (userPlatformInfo == null) {
|
||||
return null;
|
||||
}
|
||||
// noinspection unchecked
|
||||
return (Map<String, Object>) userPlatformInfo.get(pluginId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import io.metersphere.system.domain.Plugin;
|
|||
import io.metersphere.system.domain.UserExtend;
|
||||
import io.metersphere.system.domain.UserExtendExample;
|
||||
import io.metersphere.system.mapper.UserExtendMapper;
|
||||
import io.metersphere.system.service.UserPlatformAccountService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.mockserver.client.MockServerClient;
|
||||
|
@ -39,6 +40,8 @@ public class UserPlatformAccountControllerTests extends BaseTest {
|
|||
private MockServerClient mockServerClient;
|
||||
@Resource
|
||||
private UserExtendMapper userExtendMapper;
|
||||
@Resource
|
||||
private UserPlatformAccountService userPlatformAccountService;
|
||||
private static final String VALIDATE_POST = "/user/platform/validate/{0}/{1}";
|
||||
private static final String SAVE_POST = "/user/platform/save";
|
||||
public static <T> T parseObjectFromMvcResult(MvcResult mvcResult, Class<T> parseClass) {
|
||||
|
@ -94,6 +97,7 @@ public class UserPlatformAccountControllerTests extends BaseTest {
|
|||
// noinspection unchecked
|
||||
Map<String, Object> accountMap = parseObjectFromMvcResult(mvcResult, Map.class);
|
||||
Assertions.assertNull(accountMap);
|
||||
userPlatformAccountService.getPluginUserPlatformConfig("jira", "100001", "admin");
|
||||
// @@请求成功 保存两次
|
||||
this.requestPostWithOk(SAVE_POST, buildUserPlatformConfig());
|
||||
UserExtend record = new UserExtend();
|
||||
|
@ -102,6 +106,7 @@ public class UserPlatformAccountControllerTests extends BaseTest {
|
|||
userExtendMapper.updateByPrimaryKeyWithBLOBs(record);
|
||||
this.requestPostWithOk(SAVE_POST, buildUserPlatformConfig());
|
||||
this.requestPostWithOk(SAVE_POST, buildUserPlatformConfig());
|
||||
userPlatformAccountService.getPluginUserPlatformConfig("jira", "100001", "admin");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -120,11 +125,15 @@ public class UserPlatformAccountControllerTests extends BaseTest {
|
|||
private Map<String, Object> buildUserPlatformConfig() {
|
||||
Map<String, Object> platformInfo = new HashMap<>();
|
||||
Map<String, Object> userPlatformConfig = new HashMap<>();
|
||||
userPlatformConfig.put("authType", "test");
|
||||
userPlatformConfig.put("jiraAccount", "test");
|
||||
userPlatformConfig.put("jiraPassword", "test");
|
||||
userPlatformConfig.put("zentaoAccount", "test");
|
||||
userPlatformConfig.put("zentaoPassword", "test");
|
||||
Map<String, Object> zentaoConfig = new HashMap<>();
|
||||
Map<String, Object> jiraConfig = new HashMap<>();
|
||||
zentaoConfig.put("zentaoAccount", "test");
|
||||
zentaoConfig.put("zentaoPassword", "test");
|
||||
jiraConfig.put("authType", "test");
|
||||
jiraConfig.put("jiraAccount", "test");
|
||||
jiraConfig.put("jiraPassword", "test");
|
||||
userPlatformConfig.put("zentao", zentaoConfig);
|
||||
userPlatformConfig.put("jira", jiraConfig);
|
||||
platformInfo.put("100001", userPlatformConfig);
|
||||
return platformInfo;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue