fix 导入用户该维护人不存在
This commit is contained in:
parent
db7707708f
commit
82f7b44a03
|
@ -6,6 +6,7 @@ import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.*;
|
import io.metersphere.base.mapper.*;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
|
||||||
|
import io.metersphere.commons.constants.RoleConstants;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.user.SessionUser;
|
import io.metersphere.commons.user.SessionUser;
|
||||||
import io.metersphere.commons.utils.BeanUtils;
|
import io.metersphere.commons.utils.BeanUtils;
|
||||||
|
@ -64,6 +65,9 @@ public class TestCaseService {
|
||||||
@Resource
|
@Resource
|
||||||
UserMapper userMapper;
|
UserMapper userMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
UserRoleMapper userRoleMapper;
|
||||||
|
|
||||||
public void addTestCase(TestCaseWithBLOBs testCase) {
|
public void addTestCase(TestCaseWithBLOBs testCase) {
|
||||||
testCase.setName(testCase.getName());
|
testCase.setName(testCase.getName());
|
||||||
TestCaseExample testCaseExample = new TestCaseExample();
|
TestCaseExample testCaseExample = new TestCaseExample();
|
||||||
|
@ -196,10 +200,12 @@ public class TestCaseService {
|
||||||
.map(TestCase::getName)
|
.map(TestCase::getName)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
UserExample userExample = new UserExample();
|
UserRoleExample userRoleExample = new UserRoleExample();
|
||||||
userExample.createCriteria().andLastWorkspaceIdEqualTo(currentWorkspaceId);
|
userRoleExample.createCriteria()
|
||||||
List<User> users = userMapper.selectByExample(userExample);
|
.andRoleIdIn(Arrays.asList(RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER))
|
||||||
Set<String> userIds = users.stream().map(User::getId).collect(Collectors.toSet());
|
.andSourceIdEqualTo(currentWorkspaceId);
|
||||||
|
|
||||||
|
Set<String> userIds = userRoleMapper.selectByExample(userRoleExample).stream().map(UserRole::getUserId).collect(Collectors.toSet());
|
||||||
|
|
||||||
EasyExcelListener easyExcelListener = null;
|
EasyExcelListener easyExcelListener = null;
|
||||||
List<ExcelErrData<TestCaseExcelData>> errList = null;
|
List<ExcelErrData<TestCaseExcelData>> errList = null;
|
||||||
|
|
Loading…
Reference in New Issue