fix: 用例导入无法显示责任人

This commit is contained in:
chenjianxing 2021-06-24 14:19:27 +08:00 committed by jianxing
parent c3f9c1fc00
commit acd9287f64
3 changed files with 23 additions and 19 deletions

View File

@ -35,7 +35,7 @@ public class TestCaseExcelDataCn extends TestCaseExcelData {
private String nodePath; private String nodePath;
@NotBlank(message = "{cannot_be_null}") @NotBlank(message = "{cannot_be_null}")
@ExcelProperty("维护") @ExcelProperty(value = "责任")
private String maintainer; private String maintainer;
@NotBlank(message = "{cannot_be_null}") @NotBlank(message = "{cannot_be_null}")

View File

@ -16,6 +16,7 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.OrderRequest; import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.excel.domain.ExcelErrData; import io.metersphere.excel.domain.ExcelErrData;
import io.metersphere.excel.domain.ExcelResponse; import io.metersphere.excel.domain.ExcelResponse;
import io.metersphere.excel.domain.TestCaseExcelData; import io.metersphere.excel.domain.TestCaseExcelData;
@ -32,6 +33,7 @@ import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.track.TestCaseReference; import io.metersphere.log.vo.track.TestCaseReference;
import io.metersphere.service.FileService; import io.metersphere.service.FileService;
import io.metersphere.service.ProjectService; import io.metersphere.service.ProjectService;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseCommentDTO; import io.metersphere.track.dto.TestCaseCommentDTO;
import io.metersphere.track.dto.TestCaseDTO; import io.metersphere.track.dto.TestCaseDTO;
import io.metersphere.track.request.testcase.EditTestCaseRequest; import io.metersphere.track.request.testcase.EditTestCaseRequest;
@ -74,7 +76,7 @@ public class TestCaseService {
ExtTestCaseMapper extTestCaseMapper; ExtTestCaseMapper extTestCaseMapper;
@Resource @Resource
TestPlanMapper testPlanMapper; UserService userService;
@Resource @Resource
TestPlanTestCaseMapper testPlanTestCaseMapper; TestPlanTestCaseMapper testPlanTestCaseMapper;
@ -488,16 +490,13 @@ public class TestCaseService {
} }
} else { } else {
GroupExample groupExample = new GroupExample();
groupExample.createCriteria().andTypeIn(Arrays.asList(UserGroupType.WORKSPACE, UserGroupType.PROJECT));
List<Group> groups = groupMapper.selectByExample(groupExample);
List<String> groupIds = groups.stream().map(Group::getId).collect(Collectors.toList());
UserGroupExample userGroupExample = new UserGroupExample(); QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
userGroupExample.createCriteria() queryMemberRequest.setProjectId(projectId);
.andGroupIdIn(groupIds) Set<String> userIds = userService.getProjectMemberList(queryMemberRequest)
.andSourceIdEqualTo(currentWorkspaceId); .stream()
Set<String> userIds = userGroupMapper.selectByExample(userGroupExample).stream().map(UserGroup::getUserId).collect(Collectors.toSet()); .map(User::getId)
.collect(Collectors.toSet());
try { try {
//根据本地语言环境选择用哪种数据对象进行存放读取的数据 //根据本地语言环境选择用哪种数据对象进行存放读取的数据

View File

@ -57,13 +57,6 @@
:label="$t('commons.create_user')" :label="$t('commons.create_user')"
min-width="120"/> min-width="120"/>
<ms-table-column
prop="maintainer"
:field="item"
:fields-width="fieldsWidth"
:label="$t('custom_field.case_maintainer')"
min-width="120"/>
<ms-table-column <ms-table-column
prop="reviewStatus" prop="reviewStatus"
min-width="100px" min-width="100px"
@ -353,7 +346,19 @@ export default {
}); });
}, },
getCustomFieldValue(row, field) { getCustomFieldValue(row, field) {
return getCustomFieldValue(row, field, this.members); let value = getCustomFieldValue(row, field, this.members);
if (!value) {
if (field.name === '用例等级') {
return row.priority;
}
if (field.name === '责任人') {
return row.maintainer;
}
if (field.name === '用例状态') {
return row.status;
}
}
return value;
}, },
checkRedirectEditPage(redirectParam) { checkRedirectEditPage(redirectParam) {
if (redirectParam != null) { if (redirectParam != null) {