chore: rename uuid to id generator
This commit is contained in:
parent
453522432b
commit
f39fc156c4
|
@ -4,7 +4,7 @@ import io.metersphere.api.dto.jmeter.processors.MSJSR223Processor;
|
||||||
import io.metersphere.api.dto.jmeter.sampler.MSDebugSampler;
|
import io.metersphere.api.dto.jmeter.sampler.MSDebugSampler;
|
||||||
import io.metersphere.api.util.ApiDataUtils;
|
import io.metersphere.api.util.ApiDataUtils;
|
||||||
import io.metersphere.plugin.api.dto.TestElementDTO;
|
import io.metersphere.plugin.api.dto.TestElementDTO;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
@ -22,7 +22,7 @@ public class PluginSubTypeTests {
|
||||||
public void pluginSubTypeTest() throws Exception {
|
public void pluginSubTypeTest() throws Exception {
|
||||||
MSDebugSampler debugSampler = new MSDebugSampler();
|
MSDebugSampler debugSampler = new MSDebugSampler();
|
||||||
debugSampler.setName("测试DebugSampler");
|
debugSampler.setName("测试DebugSampler");
|
||||||
debugSampler.setUuid(UUID.randomUUID().toString());
|
debugSampler.setUuid(IDGenerator.nextStr());
|
||||||
LinkedList<TestElementDTO> hashTree = new LinkedList<>();
|
LinkedList<TestElementDTO> hashTree = new LinkedList<>();
|
||||||
hashTree.add(debugSampler);
|
hashTree.add(debugSampler);
|
||||||
MSJSR223Processor msjsr223Processor = new MSJSR223Processor();
|
MSJSR223Processor msjsr223Processor = new MSJSR223Processor();
|
||||||
|
|
|
@ -7,7 +7,7 @@ import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.sdk.util.LogUtils;
|
import io.metersphere.sdk.util.LogUtils;
|
||||||
import io.metersphere.sdk.util.MsFileUtils;
|
import io.metersphere.sdk.util.MsFileUtils;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.aspectj.util.FileUtil;
|
import org.aspectj.util.FileUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -29,7 +29,7 @@ public class CommandService {
|
||||||
if (!fileDir.exists()) {
|
if (!fileDir.exists()) {
|
||||||
fileDir.mkdirs();
|
fileDir.mkdirs();
|
||||||
}
|
}
|
||||||
File file = new File(dir + UUID.randomUUID().toString() + "_" + bodyFile.getOriginalFilename());
|
File file = new File(dir + IDGenerator.nextStr() + "_" + bodyFile.getOriginalFilename());
|
||||||
try (InputStream in = bodyFile.getInputStream(); OutputStream out = new FileOutputStream(file)) {
|
try (InputStream in = bodyFile.getInputStream(); OutputStream out = new FileOutputStream(file)) {
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
FileUtil.copyStream(in, out);
|
FileUtil.copyStream(in, out);
|
||||||
|
|
|
@ -14,7 +14,7 @@ import io.metersphere.sdk.dto.OptionDTO;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||||
import io.metersphere.system.service.CreateProjectResourceService;
|
import io.metersphere.system.service.CreateProjectResourceService;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -44,7 +44,7 @@ public class CreateRobotResourceService implements CreateProjectResourceService
|
||||||
public void createResources(String projectId) {
|
public void createResources(String projectId) {
|
||||||
List<ProjectRobot> list = new ArrayList<>();
|
List<ProjectRobot> list = new ArrayList<>();
|
||||||
ProjectRobot projectRobot = new ProjectRobot();
|
ProjectRobot projectRobot = new ProjectRobot();
|
||||||
String inSiteId = UUID.randomUUID().toString();
|
String inSiteId = IDGenerator.nextStr();
|
||||||
projectRobot.setId(inSiteId);
|
projectRobot.setId(inSiteId);
|
||||||
projectRobot.setProjectId(projectId);
|
projectRobot.setProjectId(projectId);
|
||||||
projectRobot.setName("robot_in_site");
|
projectRobot.setName("robot_in_site");
|
||||||
|
@ -58,7 +58,7 @@ public class CreateRobotResourceService implements CreateProjectResourceService
|
||||||
projectRobot.setDescription("robot_in_site_description");
|
projectRobot.setDescription("robot_in_site_description");
|
||||||
list.add(projectRobot);
|
list.add(projectRobot);
|
||||||
ProjectRobot projectRobotMail = new ProjectRobot();
|
ProjectRobot projectRobotMail = new ProjectRobot();
|
||||||
projectRobotMail.setId(UUID.randomUUID().toString());
|
projectRobotMail.setId(IDGenerator.nextStr());
|
||||||
projectRobotMail.setProjectId(projectId);
|
projectRobotMail.setProjectId(projectId);
|
||||||
projectRobotMail.setName("robot_mail");
|
projectRobotMail.setName("robot_mail");
|
||||||
projectRobotMail.setPlatform(ProjectRobotPlatform.MAIL.toString());
|
projectRobotMail.setPlatform(ProjectRobotPlatform.MAIL.toString());
|
||||||
|
@ -108,7 +108,7 @@ public class CreateRobotResourceService implements CreateProjectResourceService
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (OptionDTO receiver : receivers) {
|
for (OptionDTO receiver : receivers) {
|
||||||
String id = UUID.randomUUID().toString();
|
String id = IDGenerator.nextStr();
|
||||||
MessageTask messageTask = new MessageTask();
|
MessageTask messageTask = new MessageTask();
|
||||||
messageTask.setId(id);
|
messageTask.setId(id);
|
||||||
messageTask.setEvent(event);
|
messageTask.setEvent(event);
|
||||||
|
|
|
@ -7,7 +7,7 @@ import io.metersphere.sdk.constants.InternalUserRole;
|
||||||
import io.metersphere.sdk.constants.ProjectApplicationType;
|
import io.metersphere.sdk.constants.ProjectApplicationType;
|
||||||
import io.metersphere.sdk.util.LogUtils;
|
import io.metersphere.sdk.util.LogUtils;
|
||||||
import io.metersphere.system.service.CreateProjectResourceService;
|
import io.metersphere.system.service.CreateProjectResourceService;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class CreateVersionResourceService implements CreateProjectResourceServic
|
||||||
public void createResources(String projectId) {
|
public void createResources(String projectId) {
|
||||||
// 初始化版本V1.0, 初始化版本配置项
|
// 初始化版本V1.0, 初始化版本配置项
|
||||||
ProjectVersion defaultVersion = new ProjectVersion();
|
ProjectVersion defaultVersion = new ProjectVersion();
|
||||||
defaultVersion.setId(UUID.randomUUID().toString());
|
defaultVersion.setId(IDGenerator.nextStr());
|
||||||
defaultVersion.setProjectId(projectId);
|
defaultVersion.setProjectId(projectId);
|
||||||
defaultVersion.setName(DEFAULT_VERSION);
|
defaultVersion.setName(DEFAULT_VERSION);
|
||||||
defaultVersion.setStatus(DEFAULT_VERSION_STATUS);
|
defaultVersion.setStatus(DEFAULT_VERSION_STATUS);
|
||||||
|
|
|
@ -28,7 +28,7 @@ import io.metersphere.system.log.constants.OperationLogModule;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.log.service.OperationLogService;
|
import io.metersphere.system.log.service.OperationLogService;
|
||||||
import io.metersphere.system.service.JdbcDriverPluginService;
|
import io.metersphere.system.service.JdbcDriverPluginService;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -101,7 +101,7 @@ public class EnvironmentService {
|
||||||
|
|
||||||
public EnvironmentRequest add(EnvironmentRequest request, String userId, List<MultipartFile> sslFiles) {
|
public EnvironmentRequest add(EnvironmentRequest request, String userId, List<MultipartFile> sslFiles) {
|
||||||
Environment environment = new Environment();
|
Environment environment = new Environment();
|
||||||
environment.setId(UUID.randomUUID().toString());
|
environment.setId(IDGenerator.nextStr());
|
||||||
environment.setCreateUser(userId);
|
environment.setCreateUser(userId);
|
||||||
environment.setName(request.getName());
|
environment.setName(request.getName());
|
||||||
environment.setProjectId(request.getProjectId());
|
environment.setProjectId(request.getProjectId());
|
||||||
|
@ -220,7 +220,7 @@ public class EnvironmentService {
|
||||||
Project project = projectMapper.selectByPrimaryKey(currentProjectId);
|
Project project = projectMapper.selectByPrimaryKey(currentProjectId);
|
||||||
environmentRequests.forEach(environmentRequest -> {
|
environmentRequests.forEach(environmentRequest -> {
|
||||||
Environment environment = new Environment();
|
Environment environment = new Environment();
|
||||||
environment.setId(UUID.randomUUID().toString());
|
environment.setId(IDGenerator.nextStr());
|
||||||
environment.setCreateUser(userId);
|
environment.setCreateUser(userId);
|
||||||
environment.setName(environmentRequest.getName());
|
environment.setName(environmentRequest.getName());
|
||||||
environment.setProjectId(currentProjectId);
|
environment.setProjectId(currentProjectId);
|
||||||
|
|
|
@ -15,7 +15,7 @@ import io.metersphere.sdk.constants.StorageType;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.file.FileRequest;
|
import io.metersphere.sdk.file.FileRequest;
|
||||||
import io.metersphere.sdk.util.*;
|
import io.metersphere.sdk.util.*;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -82,7 +82,7 @@ public class FileMetadataService {
|
||||||
//检查处理后的用户名合法性
|
//检查处理后的用户名合法性
|
||||||
this.checkFileName(null, fileMetadata.getName(), request.getProjectId());
|
this.checkFileName(null, fileMetadata.getName(), request.getProjectId());
|
||||||
|
|
||||||
fileMetadata.setId(UUID.randomUUID().toString());
|
fileMetadata.setId(IDGenerator.nextStr());
|
||||||
fileMetadata.setStorage(StorageType.MINIO.name());
|
fileMetadata.setStorage(StorageType.MINIO.name());
|
||||||
fileMetadata.setProjectId(request.getProjectId());
|
fileMetadata.setProjectId(request.getProjectId());
|
||||||
fileMetadata.setModuleId(request.getModuleId());
|
fileMetadata.setModuleId(request.getModuleId());
|
||||||
|
@ -139,7 +139,7 @@ public class FileMetadataService {
|
||||||
|
|
||||||
long operationTime = System.currentTimeMillis();
|
long operationTime = System.currentTimeMillis();
|
||||||
FileMetadata fileMetadata = new FileMetadata();
|
FileMetadata fileMetadata = new FileMetadata();
|
||||||
fileMetadata.setId(UUID.randomUUID().toString());
|
fileMetadata.setId(IDGenerator.nextStr());
|
||||||
fileMetadata.setStorage(oldFile.getStorage());
|
fileMetadata.setStorage(oldFile.getStorage());
|
||||||
fileMetadata.setProjectId(oldFile.getProjectId());
|
fileMetadata.setProjectId(oldFile.getProjectId());
|
||||||
fileMetadata.setModuleId(oldFile.getModuleId());
|
fileMetadata.setModuleId(oldFile.getModuleId());
|
||||||
|
|
|
@ -13,8 +13,7 @@ import io.metersphere.sdk.dto.request.NodeMoveRequest;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.service.CleanupProjectResourceService;
|
import io.metersphere.system.service.CleanupProjectResourceService;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.utils.SessionUtils;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -72,7 +71,7 @@ public class FileModuleService extends ModuleTreeService implements CleanupProje
|
||||||
|
|
||||||
public String add(FileModuleCreateRequest request, String operator) {
|
public String add(FileModuleCreateRequest request, String operator) {
|
||||||
FileModule fileModule = new FileModule();
|
FileModule fileModule = new FileModule();
|
||||||
fileModule.setId(UUID.randomUUID().toString());
|
fileModule.setId(IDGenerator.nextStr());
|
||||||
fileModule.setName(request.getName());
|
fileModule.setName(request.getName());
|
||||||
fileModule.setParentId(request.getParentId());
|
fileModule.setParentId(request.getParentId());
|
||||||
fileModule.setProjectId(request.getProjectId());
|
fileModule.setProjectId(request.getProjectId());
|
||||||
|
|
|
@ -10,7 +10,7 @@ import io.metersphere.sdk.mapper.ProjectParametersMapper;
|
||||||
|
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -33,7 +33,7 @@ public class GlobalParamsService {
|
||||||
projectParameters.setProjectId(globalParamsRequest.getProjectId());
|
projectParameters.setProjectId(globalParamsRequest.getProjectId());
|
||||||
checkExist(globalParamsRequest.getProjectId());
|
checkExist(globalParamsRequest.getProjectId());
|
||||||
checkProjectExist(globalParamsRequest.getProjectId());
|
checkProjectExist(globalParamsRequest.getProjectId());
|
||||||
projectParameters.setId(UUID.randomUUID().toString());
|
projectParameters.setId(IDGenerator.nextStr());
|
||||||
projectParameters.setCreateUser(userId);
|
projectParameters.setCreateUser(userId);
|
||||||
projectParameters.setUpdateUser(userId);
|
projectParameters.setUpdateUser(userId);
|
||||||
projectParameters.setCreateTime(System.currentTimeMillis());
|
projectParameters.setCreateTime(System.currentTimeMillis());
|
||||||
|
|
|
@ -21,7 +21,7 @@ import io.metersphere.system.mapper.UserMapper;
|
||||||
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
||||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||||
import io.metersphere.system.notice.utils.MessageTemplateUtils;
|
import io.metersphere.system.notice.utils.MessageTemplateUtils;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -216,7 +216,7 @@ public class NoticeMessageTaskService {
|
||||||
boolean useDefaultSubject = messageTaskRequest.getUseDefaultSubject() == null || messageTaskRequest.getUseDefaultSubject();
|
boolean useDefaultSubject = messageTaskRequest.getUseDefaultSubject() == null || messageTaskRequest.getUseDefaultSubject();
|
||||||
boolean useDefaultTemplate = messageTaskRequest.getUseDefaultTemplate() == null || messageTaskRequest.getUseDefaultTemplate();
|
boolean useDefaultTemplate = messageTaskRequest.getUseDefaultTemplate() == null || messageTaskRequest.getUseDefaultTemplate();
|
||||||
|
|
||||||
String insertId = UUID.randomUUID().toString();
|
String insertId = IDGenerator.nextStr();
|
||||||
messageTask.setId(insertId);
|
messageTask.setId(insertId);
|
||||||
messageTask.setTaskType(messageTaskRequest.getTaskType());
|
messageTask.setTaskType(messageTaskRequest.getTaskType());
|
||||||
messageTask.setEvent(messageTaskRequest.getEvent());
|
messageTask.setEvent(messageTaskRequest.getEvent());
|
||||||
|
|
|
@ -25,7 +25,7 @@ import io.metersphere.system.log.service.OperationLogService;
|
||||||
import io.metersphere.system.mapper.UserMapper;
|
import io.metersphere.system.mapper.UserMapper;
|
||||||
import io.metersphere.system.mapper.UserRoleMapper;
|
import io.metersphere.system.mapper.UserRoleMapper;
|
||||||
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -184,7 +184,7 @@ public class ProjectMemberService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserRoleRelation relation = new UserRoleRelation();
|
UserRoleRelation relation = new UserRoleRelation();
|
||||||
relation.setId(UUID.randomUUID().toString());
|
relation.setId(IDGenerator.nextStr());
|
||||||
relation.setUserId(request.getUserId());
|
relation.setUserId(request.getUserId());
|
||||||
relation.setRoleId(roleId);
|
relation.setRoleId(roleId);
|
||||||
relation.setSourceId(request.getProjectId());
|
relation.setSourceId(request.getProjectId());
|
||||||
|
@ -278,7 +278,7 @@ public class ProjectMemberService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserRoleRelation relation = new UserRoleRelation();
|
UserRoleRelation relation = new UserRoleRelation();
|
||||||
relation.setId(UUID.randomUUID().toString());
|
relation.setId(IDGenerator.nextStr());
|
||||||
relation.setUserId(userId);
|
relation.setUserId(userId);
|
||||||
relation.setRoleId(roleId);
|
relation.setRoleId(roleId);
|
||||||
relation.setSourceId(request.getProjectId());
|
relation.setSourceId(request.getProjectId());
|
||||||
|
|
|
@ -10,7 +10,7 @@ import io.metersphere.project.mapper.ProjectRobotMapper;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -34,7 +34,7 @@ public class ProjectRobotService {
|
||||||
private MessageTaskBlobMapper messageTaskBlobMapper;
|
private MessageTaskBlobMapper messageTaskBlobMapper;
|
||||||
|
|
||||||
public void add(ProjectRobot projectRobot) {
|
public void add(ProjectRobot projectRobot) {
|
||||||
projectRobot.setId(UUID.randomUUID().toString());
|
projectRobot.setId(IDGenerator.nextStr());
|
||||||
projectRobot.setEnable(projectRobot.getEnable());
|
projectRobot.setEnable(projectRobot.getEnable());
|
||||||
checkDingTalk(projectRobot);
|
checkDingTalk(projectRobot);
|
||||||
robotMapper.insert(projectRobot);
|
robotMapper.insert(projectRobot);
|
||||||
|
|
|
@ -19,7 +19,7 @@ import io.metersphere.system.mapper.UserMapper;
|
||||||
import io.metersphere.system.mapper.UserRoleMapper;
|
import io.metersphere.system.mapper.UserRoleMapper;
|
||||||
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
||||||
import io.metersphere.system.service.BaseUserRoleService;
|
import io.metersphere.system.service.BaseUserRoleService;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -108,7 +108,7 @@ public class ProjectUserRoleService extends BaseUserRoleService {
|
||||||
request.getUserIds().forEach(userId -> {
|
request.getUserIds().forEach(userId -> {
|
||||||
checkMemberParam(userId, request.getUserRoleId());
|
checkMemberParam(userId, request.getUserRoleId());
|
||||||
UserRoleRelation relation = new UserRoleRelation();
|
UserRoleRelation relation = new UserRoleRelation();
|
||||||
relation.setId(UUID.randomUUID().toString());
|
relation.setId(IDGenerator.nextStr());
|
||||||
relation.setUserId(userId);
|
relation.setUserId(userId);
|
||||||
relation.setRoleId(request.getUserRoleId());
|
relation.setRoleId(request.getUserRoleId());
|
||||||
relation.setSourceId(request.getProjectId());
|
relation.setSourceId(request.getProjectId());
|
||||||
|
|
|
@ -14,7 +14,7 @@ import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.base.BaseTest;
|
import io.metersphere.system.base.BaseTest;
|
||||||
import io.metersphere.system.controller.handler.ResultHolder;
|
import io.metersphere.system.controller.handler.ResultHolder;
|
||||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -627,7 +627,7 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (OptionDTO receiver : receivers) {
|
for (OptionDTO receiver : receivers) {
|
||||||
String id = UUID.randomUUID().toString();
|
String id = IDGenerator.nextStr();
|
||||||
MessageTask messageTask = new MessageTask();
|
MessageTask messageTask = new MessageTask();
|
||||||
messageTask.setId(id);
|
messageTask.setId(id);
|
||||||
messageTask.setEvent(event);
|
messageTask.setEvent(event);
|
||||||
|
|
|
@ -19,7 +19,7 @@ import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.base.BaseTest;
|
import io.metersphere.system.base.BaseTest;
|
||||||
import io.metersphere.system.controller.handler.ResultHolder;
|
import io.metersphere.system.controller.handler.ResultHolder;
|
||||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -541,7 +541,7 @@ public class ProjectRobotControllerTests extends BaseTest {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (OptionDTO receiver : receivers) {
|
for (OptionDTO receiver : receivers) {
|
||||||
String id = UUID.randomUUID().toString();
|
String id = IDGenerator.nextStr();
|
||||||
MessageTask messageTask = new MessageTask();
|
MessageTask messageTask = new MessageTask();
|
||||||
messageTask.setId(id);
|
messageTask.setId(id);
|
||||||
messageTask.setEvent(event);
|
messageTask.setEvent(event);
|
||||||
|
|
|
@ -19,7 +19,7 @@ import io.metersphere.sdk.util.Pager;
|
||||||
import io.metersphere.system.base.BaseTest;
|
import io.metersphere.system.base.BaseTest;
|
||||||
import io.metersphere.system.controller.handler.ResultHolder;
|
import io.metersphere.system.controller.handler.ResultHolder;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
@ -67,7 +67,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
public void initTestData() {
|
public void initTestData() {
|
||||||
if (project == null) {
|
if (project == null) {
|
||||||
Project initProject = new Project();
|
Project initProject = new Project();
|
||||||
initProject.setId(UUID.randomUUID().toString());
|
initProject.setId(IDGenerator.nextStr());
|
||||||
initProject.setNum(null);
|
initProject.setNum(null);
|
||||||
initProject.setOrganizationId("100001");
|
initProject.setOrganizationId("100001");
|
||||||
initProject.setName("建国创建的项目");
|
initProject.setName("建国创建的项目");
|
||||||
|
@ -264,7 +264,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
request = new FileModuleCreateRequest();
|
request = new FileModuleCreateRequest();
|
||||||
request.setProjectId(project.getId());
|
request.setProjectId(project.getId());
|
||||||
request.setName("ParentIsUUID");
|
request.setName("ParentIsUUID");
|
||||||
request.setParentId(UUID.randomUUID().toString());
|
request.setParentId(IDGenerator.nextStr());
|
||||||
this.requestPost(FileManagementRequestUtils.URL_MODULE_ADD, request).andExpect(status().is5xxServerError());
|
this.requestPost(FileManagementRequestUtils.URL_MODULE_ADD, request).andExpect(status().is5xxServerError());
|
||||||
|
|
||||||
//添加重复的a1节点
|
//添加重复的a1节点
|
||||||
|
@ -282,7 +282,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
|
|
||||||
//子节点的项目ID和父节点的不匹配
|
//子节点的项目ID和父节点的不匹配
|
||||||
request = new FileModuleCreateRequest();
|
request = new FileModuleCreateRequest();
|
||||||
request.setProjectId(UUID.randomUUID().toString());
|
request.setProjectId(IDGenerator.nextStr());
|
||||||
request.setName("RandomUUID");
|
request.setName("RandomUUID");
|
||||||
request.setParentId(a1Node.getId());
|
request.setParentId(a1Node.getId());
|
||||||
this.requestPost(FileManagementRequestUtils.URL_MODULE_ADD, request).andExpect(status().is5xxServerError());
|
this.requestPost(FileManagementRequestUtils.URL_MODULE_ADD, request).andExpect(status().is5xxServerError());
|
||||||
|
@ -333,8 +333,8 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
|
|
||||||
//id不存在
|
//id不存在
|
||||||
updateRequest = new FileModuleUpdateRequest();
|
updateRequest = new FileModuleUpdateRequest();
|
||||||
updateRequest.setId(UUID.randomUUID().toString());
|
updateRequest.setId(IDGenerator.nextStr());
|
||||||
updateRequest.setName(UUID.randomUUID().toString());
|
updateRequest.setName(IDGenerator.nextStr());
|
||||||
this.requestPost(FileManagementRequestUtils.URL_MODULE_UPDATE, updateRequest).andExpect(status().is5xxServerError());
|
this.requestPost(FileManagementRequestUtils.URL_MODULE_UPDATE, updateRequest).andExpect(status().is5xxServerError());
|
||||||
|
|
||||||
//名称重复 a1-a1改为a1-b1
|
//名称重复 a1-a1改为a1-b1
|
||||||
|
@ -416,7 +416,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
this.requestMultipart(FileManagementRequestUtils.URL_FILE_UPLOAD, paramMap).andExpect(status().isBadRequest());
|
this.requestMultipart(FileManagementRequestUtils.URL_FILE_UPLOAD, paramMap).andExpect(status().isBadRequest());
|
||||||
|
|
||||||
//模块不存在
|
//模块不存在
|
||||||
fileUploadRequest.setModuleId(UUID.randomUUID().toString());
|
fileUploadRequest.setModuleId(IDGenerator.nextStr());
|
||||||
paramMap = new LinkedMultiValueMap<>();
|
paramMap = new LinkedMultiValueMap<>();
|
||||||
paramMap.add("file", file);
|
paramMap.add("file", file);
|
||||||
paramMap.add("request", JSON.toJSONString(fileUploadRequest));
|
paramMap.add("request", JSON.toJSONString(fileUploadRequest));
|
||||||
|
@ -486,7 +486,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
this.requestMultipart(FileManagementRequestUtils.URL_FILE_RE_UPLOAD, paramMap).andExpect(status().isBadRequest());
|
this.requestMultipart(FileManagementRequestUtils.URL_FILE_RE_UPLOAD, paramMap).andExpect(status().isBadRequest());
|
||||||
|
|
||||||
//旧文件不存在
|
//旧文件不存在
|
||||||
fileReUploadRequest.setFileId(UUID.randomUUID().toString());
|
fileReUploadRequest.setFileId(IDGenerator.nextStr());
|
||||||
paramMap = new LinkedMultiValueMap<>();
|
paramMap = new LinkedMultiValueMap<>();
|
||||||
paramMap.add("file", file);
|
paramMap.add("file", file);
|
||||||
paramMap.add("request", JSON.toJSONString(fileReUploadRequest));
|
paramMap.add("request", JSON.toJSONString(fileReUploadRequest));
|
||||||
|
@ -514,7 +514,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
@Order(16)
|
@Order(16)
|
||||||
public void fileDownloadTestError() throws Exception {
|
public void fileDownloadTestError() throws Exception {
|
||||||
//下载不存在的文件
|
//下载不存在的文件
|
||||||
mockMvc.perform(getRequestBuilder(FileManagementRequestUtils.URL_FILE_DOWNLOAD, UUID.randomUUID()))
|
mockMvc.perform(getRequestBuilder(FileManagementRequestUtils.URL_FILE_DOWNLOAD, IDGenerator.randomUUID()))
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().is5xxServerError());
|
.andExpect(status().is5xxServerError());
|
||||||
}
|
}
|
||||||
|
@ -575,7 +575,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
this.setPageSize(10);
|
this.setPageSize(10);
|
||||||
this.setProjectId(project.getId());
|
this.setProjectId(project.getId());
|
||||||
this.setModuleIds(new ArrayList<>() {{
|
this.setModuleIds(new ArrayList<>() {{
|
||||||
this.add(UUID.randomUUID().toString());
|
this.add(IDGenerator.nextStr());
|
||||||
}});
|
}});
|
||||||
}};
|
}};
|
||||||
this.filePageRequestAndCheck(request, false);
|
this.filePageRequestAndCheck(request, false);
|
||||||
|
@ -658,7 +658,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
batchProcessDTO.setSelectAll(false);
|
batchProcessDTO.setSelectAll(false);
|
||||||
batchProcessDTO.setProjectId(project.getId());
|
batchProcessDTO.setProjectId(project.getId());
|
||||||
batchProcessDTO.setSelectIds(new ArrayList<>() {{
|
batchProcessDTO.setSelectIds(new ArrayList<>() {{
|
||||||
this.add(UUID.randomUUID().toString());
|
this.add(IDGenerator.nextStr());
|
||||||
}});
|
}});
|
||||||
|
|
||||||
mockMvc.perform(getPostRequestBuilder(FileManagementRequestUtils.URL_FILE_BATCH_DOWNLOAD, batchProcessDTO))
|
mockMvc.perform(getPostRequestBuilder(FileManagementRequestUtils.URL_FILE_BATCH_DOWNLOAD, batchProcessDTO))
|
||||||
|
@ -694,7 +694,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
fileBatchProcessDTO.setSelectAll(true);
|
fileBatchProcessDTO.setSelectAll(true);
|
||||||
fileBatchProcessDTO.setProjectId(project.getId());
|
fileBatchProcessDTO.setProjectId(project.getId());
|
||||||
fileBatchProcessDTO.setExcludeIds(new ArrayList<>() {{
|
fileBatchProcessDTO.setExcludeIds(new ArrayList<>() {{
|
||||||
this.add(UUID.randomUUID().toString());
|
this.add(IDGenerator.nextStr());
|
||||||
}});
|
}});
|
||||||
this.requestPostWithOk(FileManagementRequestUtils.URL_FILE_DELETE, fileBatchProcessDTO);
|
this.requestPostWithOk(FileManagementRequestUtils.URL_FILE_DELETE, fileBatchProcessDTO);
|
||||||
FileMetadataExample example = new FileMetadataExample();
|
FileMetadataExample example = new FileMetadataExample();
|
||||||
|
@ -762,7 +762,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
this.requestPost(FileManagementRequestUtils.URL_FILE_UPDATE, updateRequest).andExpect(status().isBadRequest());
|
this.requestPost(FileManagementRequestUtils.URL_FILE_UPDATE, updateRequest).andExpect(status().isBadRequest());
|
||||||
|
|
||||||
//文件不存在
|
//文件不存在
|
||||||
updateRequest.setId(UUID.randomUUID().toString());
|
updateRequest.setId(IDGenerator.nextStr());
|
||||||
this.requestPost(FileManagementRequestUtils.URL_FILE_UPDATE, updateRequest).andExpect(status().is5xxServerError());
|
this.requestPost(FileManagementRequestUtils.URL_FILE_UPDATE, updateRequest).andExpect(status().is5xxServerError());
|
||||||
|
|
||||||
//模块不存在
|
//模块不存在
|
||||||
|
@ -775,7 +775,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateRequest.setId(updateFileId);
|
updateRequest.setId(updateFileId);
|
||||||
updateRequest.setModuleId(UUID.randomUUID().toString());
|
updateRequest.setModuleId(IDGenerator.nextStr());
|
||||||
this.requestPost(FileManagementRequestUtils.URL_FILE_UPDATE, updateRequest).andExpect(status().is5xxServerError());
|
this.requestPost(FileManagementRequestUtils.URL_FILE_UPDATE, updateRequest).andExpect(status().is5xxServerError());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1042,7 +1042,7 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
checkLog(a1a1Node.getId(), OperationLogType.DELETE, FileManagementRequestUtils.URL_MODULE_DELETE);
|
checkLog(a1a1Node.getId(), OperationLogType.DELETE, FileManagementRequestUtils.URL_MODULE_DELETE);
|
||||||
|
|
||||||
//删除不存在的节点
|
//删除不存在的节点
|
||||||
this.requestGetWithOk(String.format(FileManagementRequestUtils.URL_MODULE_DELETE, UUID.randomUUID()));
|
this.requestGetWithOk(String.format(FileManagementRequestUtils.URL_MODULE_DELETE, IDGenerator.randomUUID()));
|
||||||
// 测试删除根节点
|
// 测试删除根节点
|
||||||
this.requestGetWithOk(String.format(FileManagementRequestUtils.URL_MODULE_DELETE, ModuleConstants.DEFAULT_NODE_ID));
|
this.requestGetWithOk(String.format(FileManagementRequestUtils.URL_MODULE_DELETE, ModuleConstants.DEFAULT_NODE_ID));
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class ScheduleService {
|
public class ScheduleService {
|
||||||
|
@ -25,7 +25,7 @@ public class ScheduleService {
|
||||||
private ScheduleManager scheduleManager;
|
private ScheduleManager scheduleManager;
|
||||||
|
|
||||||
public void addSchedule(Schedule schedule) {
|
public void addSchedule(Schedule schedule) {
|
||||||
schedule.setId(UUID.randomUUID().toString());
|
schedule.setId(IDGenerator.nextStr());
|
||||||
schedule.setCreateTime(System.currentTimeMillis());
|
schedule.setCreateTime(System.currentTimeMillis());
|
||||||
schedule.setUpdateTime(System.currentTimeMillis());
|
schedule.setUpdateTime(System.currentTimeMillis());
|
||||||
scheduleMapper.insert(schedule);
|
scheduleMapper.insert(schedule);
|
||||||
|
|
|
@ -2,7 +2,7 @@ package io.metersphere.system.service;
|
||||||
|
|
||||||
|
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.domain.AuthSource;
|
import io.metersphere.system.domain.AuthSource;
|
||||||
|
@ -46,7 +46,7 @@ public class AuthSourceService {
|
||||||
source.setType(authSource.getType());
|
source.setType(authSource.getType());
|
||||||
source.setCreateTime(createTime);
|
source.setCreateTime(createTime);
|
||||||
source.setUpdateTime(createTime);
|
source.setUpdateTime(createTime);
|
||||||
source.setId(UUID.randomUUID().toString());
|
source.setId(IDGenerator.nextStr());
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import io.metersphere.system.domain.CustomField;
|
||||||
import io.metersphere.system.domain.CustomFieldExample;
|
import io.metersphere.system.domain.CustomFieldExample;
|
||||||
import io.metersphere.system.domain.CustomFieldOption;
|
import io.metersphere.system.domain.CustomFieldOption;
|
||||||
import io.metersphere.system.mapper.CustomFieldMapper;
|
import io.metersphere.system.mapper.CustomFieldMapper;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.utils.ServiceUtils;
|
import io.metersphere.system.utils.ServiceUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -124,7 +124,7 @@ public class BaseCustomFieldService {
|
||||||
*/
|
*/
|
||||||
public CustomField baseAdd(CustomField customField, List<CustomFieldOption> options) {
|
public CustomField baseAdd(CustomField customField, List<CustomFieldOption> options) {
|
||||||
checkAddExist(customField);
|
checkAddExist(customField);
|
||||||
customField.setId(UUID.randomUUID().toString());
|
customField.setId(IDGenerator.nextStr());
|
||||||
customField.setCreateTime(System.currentTimeMillis());
|
customField.setCreateTime(System.currentTimeMillis());
|
||||||
customField.setUpdateTime(System.currentTimeMillis());
|
customField.setUpdateTime(System.currentTimeMillis());
|
||||||
customFieldMapper.insert(customField);
|
customFieldMapper.insert(customField);
|
||||||
|
@ -247,7 +247,7 @@ public class BaseCustomFieldService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomField initDefaultCustomField(CustomField customField) {
|
public CustomField initDefaultCustomField(CustomField customField) {
|
||||||
customField.setId(UUID.randomUUID().toString());
|
customField.setId(IDGenerator.nextStr());
|
||||||
customField.setInternal(true);
|
customField.setInternal(true);
|
||||||
customField.setCreateTime(System.currentTimeMillis());
|
customField.setCreateTime(System.currentTimeMillis());
|
||||||
customField.setUpdateTime(System.currentTimeMillis());
|
customField.setUpdateTime(System.currentTimeMillis());
|
||||||
|
|
|
@ -5,7 +5,7 @@ import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.system.domain.StatusFlow;
|
import io.metersphere.system.domain.StatusFlow;
|
||||||
import io.metersphere.system.domain.StatusFlowExample;
|
import io.metersphere.system.domain.StatusFlowExample;
|
||||||
import io.metersphere.system.mapper.StatusFlowMapper;
|
import io.metersphere.system.mapper.StatusFlowMapper;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -48,7 +48,7 @@ public class BaseStatusFlowService {
|
||||||
List<StatusFlow> statusFlows = statusFlowRequests.stream().map(request -> {
|
List<StatusFlow> statusFlows = statusFlowRequests.stream().map(request -> {
|
||||||
StatusFlow statusFlow = new StatusFlow();
|
StatusFlow statusFlow = new StatusFlow();
|
||||||
BeanUtils.copyBean(statusFlow, request);
|
BeanUtils.copyBean(statusFlow, request);
|
||||||
statusFlow.setId(UUID.nextStr());
|
statusFlow.setId(IDGenerator.nextStr());
|
||||||
return statusFlow;
|
return statusFlow;
|
||||||
}).toList();
|
}).toList();
|
||||||
statusFlowMapper.batchInsert(statusFlows);
|
statusFlowMapper.batchInsert(statusFlows);
|
||||||
|
@ -91,7 +91,7 @@ public class BaseStatusFlowService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
statusFlows.forEach(statusFlow -> {
|
statusFlows.forEach(statusFlow -> {
|
||||||
statusFlow.setId(UUID.nextStr());
|
statusFlow.setId(IDGenerator.nextStr());
|
||||||
});
|
});
|
||||||
statusFlowMapper.batchInsert(statusFlows);
|
statusFlowMapper.batchInsert(statusFlows);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import io.metersphere.system.domain.StatusFlow;
|
||||||
import io.metersphere.system.domain.StatusItem;
|
import io.metersphere.system.domain.StatusItem;
|
||||||
import io.metersphere.system.dto.StatusFlowSettingDTO;
|
import io.metersphere.system.dto.StatusFlowSettingDTO;
|
||||||
import io.metersphere.system.mapper.StatusDefinitionMapper;
|
import io.metersphere.system.mapper.StatusDefinitionMapper;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -169,7 +169,7 @@ public class BaseStatusFlowSettingService {
|
||||||
List<String> statusFlowTargets = defaultBugStatusItem.getStatusFlowTargets();
|
List<String> statusFlowTargets = defaultBugStatusItem.getStatusFlowTargets();
|
||||||
for (String statusFlowTarget : statusFlowTargets) {
|
for (String statusFlowTarget : statusFlowTargets) {
|
||||||
StatusFlow statusFlow = new StatusFlow();
|
StatusFlow statusFlow = new StatusFlow();
|
||||||
statusFlow.setId(UUID.randomUUID().toString());
|
statusFlow.setId(IDGenerator.nextStr());
|
||||||
statusFlow.setFromId(fromStatusId);
|
statusFlow.setFromId(fromStatusId);
|
||||||
statusFlow.setToId(statusNameMap.get(statusFlowTarget));
|
statusFlow.setToId(statusNameMap.get(statusFlowTarget));
|
||||||
statusFlows.add(statusFlow);
|
statusFlows.add(statusFlow);
|
||||||
|
|
|
@ -6,7 +6,7 @@ import io.metersphere.system.domain.StatusItem;
|
||||||
import io.metersphere.system.domain.StatusItemExample;
|
import io.metersphere.system.domain.StatusItemExample;
|
||||||
import io.metersphere.system.mapper.ExtStatusItemMapper;
|
import io.metersphere.system.mapper.ExtStatusItemMapper;
|
||||||
import io.metersphere.system.mapper.StatusItemMapper;
|
import io.metersphere.system.mapper.StatusItemMapper;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.utils.ServiceUtils;
|
import io.metersphere.system.utils.ServiceUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -77,7 +77,7 @@ public class BaseStatusItemService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatusItem baseAdd(StatusItem statusItem) {
|
public StatusItem baseAdd(StatusItem statusItem) {
|
||||||
statusItem.setId(UUID.nextStr());
|
statusItem.setId(IDGenerator.nextStr());
|
||||||
statusItemMapper.insert(statusItem);
|
statusItemMapper.insert(statusItem);
|
||||||
return statusItem;
|
return statusItem;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ public class BaseStatusItemService {
|
||||||
if (CollectionUtils.isEmpty(statusItems)) {
|
if (CollectionUtils.isEmpty(statusItems)) {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
statusItems.forEach(statusItem -> statusItem.setId(UUID.nextStr()));
|
statusItems.forEach(statusItem -> statusItem.setId(IDGenerator.nextStr()));
|
||||||
statusItemMapper.batchInsert(statusItems);
|
statusItemMapper.batchInsert(statusItems);
|
||||||
return statusItems;
|
return statusItems;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class BaseTemplateCustomFieldService {
|
||||||
AtomicReference<Integer> pos = new AtomicReference<>(0);
|
AtomicReference<Integer> pos = new AtomicReference<>(0);
|
||||||
List<TemplateCustomField> templateCustomFields = customFieldRequests.stream().map(field -> {
|
List<TemplateCustomField> templateCustomFields = customFieldRequests.stream().map(field -> {
|
||||||
TemplateCustomField templateCustomField = new TemplateCustomField();
|
TemplateCustomField templateCustomField = new TemplateCustomField();
|
||||||
templateCustomField.setId(UUID.randomUUID().toString());
|
templateCustomField.setId(IDGenerator.nextStr());
|
||||||
BeanUtils.copyBean(templateCustomField, field);
|
BeanUtils.copyBean(templateCustomField, field);
|
||||||
templateCustomField.setTemplateId(id);
|
templateCustomField.setTemplateId(id);
|
||||||
templateCustomField.setPos(pos.getAndSet(pos.get() + 1));
|
templateCustomField.setPos(pos.getAndSet(pos.get() + 1));
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static io.metersphere.system.controller.handler.result.CommonResultCode.*;
|
import static io.metersphere.system.controller.handler.result.CommonResultCode.*;
|
||||||
|
@ -118,7 +118,7 @@ public class BaseTemplateService {
|
||||||
|
|
||||||
public Template baseAdd(Template template, List<TemplateCustomFieldRequest> customFields) {
|
public Template baseAdd(Template template, List<TemplateCustomFieldRequest> customFields) {
|
||||||
checkAddExist(template);
|
checkAddExist(template);
|
||||||
template.setId(UUID.randomUUID().toString());
|
template.setId(IDGenerator.nextStr());
|
||||||
template.setCreateTime(System.currentTimeMillis());
|
template.setCreateTime(System.currentTimeMillis());
|
||||||
template.setUpdateTime(System.currentTimeMillis());
|
template.setUpdateTime(System.currentTimeMillis());
|
||||||
templateMapper.insert(template);
|
templateMapper.insert(template);
|
||||||
|
@ -320,7 +320,7 @@ public class BaseTemplateService {
|
||||||
|
|
||||||
public Template initDefaultTemplate(String scopeId, String name, TemplateScopeType scopeType, TemplateScene scene) {
|
public Template initDefaultTemplate(String scopeId, String name, TemplateScopeType scopeType, TemplateScene scene) {
|
||||||
Template template = new Template();
|
Template template = new Template();
|
||||||
template.setId(UUID.randomUUID().toString());
|
template.setId(IDGenerator.nextStr());
|
||||||
template.setName(name);
|
template.setName(name);
|
||||||
template.setInternal(true);
|
template.setInternal(true);
|
||||||
template.setUpdateTime(System.currentTimeMillis());
|
template.setUpdateTime(System.currentTimeMillis());
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,7 +68,7 @@ public class BaseUserRolePermissionService {
|
||||||
if (BooleanUtils.isTrue(permission.getEnable())) {
|
if (BooleanUtils.isTrue(permission.getEnable())) {
|
||||||
String permissionId = permission.getId();
|
String permissionId = permission.getId();
|
||||||
UserRolePermission groupPermission = new UserRolePermission();
|
UserRolePermission groupPermission = new UserRolePermission();
|
||||||
groupPermission.setId(UUID.randomUUID().toString());
|
groupPermission.setId(IDGenerator.nextStr());
|
||||||
groupPermission.setRoleId(groupId);
|
groupPermission.setRoleId(groupId);
|
||||||
groupPermission.setPermissionId(permissionId);
|
groupPermission.setPermissionId(permissionId);
|
||||||
userRolePermissionMapper.insert(groupPermission);
|
userRolePermissionMapper.insert(groupPermission);
|
||||||
|
|
|
@ -14,7 +14,7 @@ import io.metersphere.system.domain.UserRoleExample;
|
||||||
import io.metersphere.system.domain.UserRoleRelation;
|
import io.metersphere.system.domain.UserRoleRelation;
|
||||||
import io.metersphere.system.mapper.UserMapper;
|
import io.metersphere.system.mapper.UserMapper;
|
||||||
import io.metersphere.system.mapper.UserRoleMapper;
|
import io.metersphere.system.mapper.UserRoleMapper;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.utils.ServiceUtils;
|
import io.metersphere.system.utils.ServiceUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -133,7 +133,7 @@ public class BaseUserRoleService {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UserRole add(UserRole userRole) {
|
protected UserRole add(UserRole userRole) {
|
||||||
userRole.setId(UUID.randomUUID().toString());
|
userRole.setId(IDGenerator.nextStr());
|
||||||
userRole.setCreateTime(System.currentTimeMillis());
|
userRole.setCreateTime(System.currentTimeMillis());
|
||||||
userRole.setUpdateTime(System.currentTimeMillis());
|
userRole.setUpdateTime(System.currentTimeMillis());
|
||||||
userRoleMapper.insert(userRole);
|
userRoleMapper.insert(userRole);
|
||||||
|
@ -243,7 +243,7 @@ public class BaseUserRoleService {
|
||||||
// 如果当前用户组只有一个用户,并且就是要删除的用户组,则添加组织成员等默认用户组
|
// 如果当前用户组只有一个用户,并且就是要删除的用户组,则添加组织成员等默认用户组
|
||||||
if (relations.size() == 1 && StringUtils.equals(relations.get(0).getRoleId(), roleId)) {
|
if (relations.size() == 1 && StringUtils.equals(relations.get(0).getRoleId(), roleId)) {
|
||||||
UserRoleRelation relation = new UserRoleRelation();
|
UserRoleRelation relation = new UserRoleRelation();
|
||||||
relation.setId(UUID.randomUUID().toString());
|
relation.setId(IDGenerator.nextStr());
|
||||||
relation.setUserId(relations.get(0).getUserId());
|
relation.setUserId(relations.get(0).getUserId());
|
||||||
relation.setSourceId(relations.get(0).getSourceId());
|
relation.setSourceId(relations.get(0).getSourceId());
|
||||||
relation.setRoleId(defaultRoleId);
|
relation.setRoleId(defaultRoleId);
|
||||||
|
|
|
@ -26,7 +26,7 @@ import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.log.service.OperationLogService;
|
import io.metersphere.system.log.service.OperationLogService;
|
||||||
import io.metersphere.system.mapper.*;
|
import io.metersphere.system.mapper.*;
|
||||||
import io.metersphere.system.request.ProjectAddMemberBatchRequest;
|
import io.metersphere.system.request.ProjectAddMemberBatchRequest;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -103,7 +103,7 @@ public class CommonProjectService {
|
||||||
|
|
||||||
Project project = new Project();
|
Project project = new Project();
|
||||||
ProjectDTO projectDTO = new ProjectDTO();
|
ProjectDTO projectDTO = new ProjectDTO();
|
||||||
project.setId(UUID.randomUUID().toString());
|
project.setId(IDGenerator.nextStr());
|
||||||
project.setName(addProjectDTO.getName());
|
project.setName(addProjectDTO.getName());
|
||||||
project.setOrganizationId(addProjectDTO.getOrganizationId());
|
project.setOrganizationId(addProjectDTO.getOrganizationId());
|
||||||
checkProjectExistByName(project);
|
checkProjectExistByName(project);
|
||||||
|
@ -168,7 +168,7 @@ public class CommonProjectService {
|
||||||
userId.forEach(id -> {
|
userId.forEach(id -> {
|
||||||
if (!orgUserIds.contains(id)) {
|
if (!orgUserIds.contains(id)) {
|
||||||
UserRoleRelation memberRole = new UserRoleRelation();
|
UserRoleRelation memberRole = new UserRoleRelation();
|
||||||
memberRole.setId(UUID.randomUUID().toString());
|
memberRole.setId(IDGenerator.nextStr());
|
||||||
memberRole.setUserId(id);
|
memberRole.setUserId(id);
|
||||||
memberRole.setRoleId(InternalUserRole.ORG_MEMBER.getValue());
|
memberRole.setRoleId(InternalUserRole.ORG_MEMBER.getValue());
|
||||||
memberRole.setSourceId(orgId);
|
memberRole.setSourceId(orgId);
|
||||||
|
@ -396,7 +396,7 @@ public class CommonProjectService {
|
||||||
.andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
|
.andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
|
||||||
if (userRoleRelationMapper.selectByExample(userRoleRelationExample).size() == 0) {
|
if (userRoleRelationMapper.selectByExample(userRoleRelationExample).size() == 0) {
|
||||||
UserRoleRelation adminRole = new UserRoleRelation();
|
UserRoleRelation adminRole = new UserRoleRelation();
|
||||||
adminRole.setId(UUID.randomUUID().toString());
|
adminRole.setId(IDGenerator.nextStr());
|
||||||
adminRole.setUserId(userId);
|
adminRole.setUserId(userId);
|
||||||
adminRole.setRoleId(InternalUserRole.PROJECT_ADMIN.getValue());
|
adminRole.setRoleId(InternalUserRole.PROJECT_ADMIN.getValue());
|
||||||
adminRole.setSourceId(projectId);
|
adminRole.setSourceId(projectId);
|
||||||
|
@ -452,7 +452,7 @@ public class CommonProjectService {
|
||||||
.andSourceIdEqualTo(projectId);
|
.andSourceIdEqualTo(projectId);
|
||||||
if (userRoleRelationMapper.selectByExample(userRoleRelationExample).size() == 0) {
|
if (userRoleRelationMapper.selectByExample(userRoleRelationExample).size() == 0) {
|
||||||
UserRoleRelation memberRole = new UserRoleRelation();
|
UserRoleRelation memberRole = new UserRoleRelation();
|
||||||
memberRole.setId(UUID.randomUUID().toString());
|
memberRole.setId(IDGenerator.nextStr());
|
||||||
memberRole.setUserId(userId);
|
memberRole.setUserId(userId);
|
||||||
memberRole.setRoleId(InternalUserRole.PROJECT_MEMBER.getValue());
|
memberRole.setRoleId(InternalUserRole.PROJECT_MEMBER.getValue());
|
||||||
memberRole.setSourceId(projectId);
|
memberRole.setSourceId(projectId);
|
||||||
|
|
|
@ -6,7 +6,7 @@ import io.metersphere.sdk.dto.UserExcludeOptionDTO;
|
||||||
import io.metersphere.sdk.dto.UserRoleRelationUserDTO;
|
import io.metersphere.sdk.dto.UserRoleRelationUserDTO;
|
||||||
import io.metersphere.sdk.dto.request.GlobalUserRoleRelationUpdateRequest;
|
import io.metersphere.sdk.dto.request.GlobalUserRoleRelationUpdateRequest;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.domain.UserRole;
|
import io.metersphere.system.domain.UserRole;
|
||||||
|
@ -80,7 +80,7 @@ public class GlobalUserRoleRelationService extends BaseUserRoleRelationService {
|
||||||
userRoleRelation.setSourceId(UserRoleScope.SYSTEM);
|
userRoleRelation.setSourceId(UserRoleScope.SYSTEM);
|
||||||
checkExist(userRoleRelation);
|
checkExist(userRoleRelation);
|
||||||
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setOrganizationId(UserRoleScope.SYSTEM);
|
userRoleRelation.setOrganizationId(UserRoleScope.SYSTEM);
|
||||||
userRoleRelations.add(userRoleRelation);
|
userRoleRelations.add(userRoleRelation);
|
||||||
});
|
});
|
||||||
|
@ -118,7 +118,7 @@ public class GlobalUserRoleRelationService extends BaseUserRoleRelationService {
|
||||||
userRoleRelation.setCreateUser(operator);
|
userRoleRelation.setCreateUser(operator);
|
||||||
userRoleRelation.setCreateTime(createTime);
|
userRoleRelation.setCreateTime(createTime);
|
||||||
userRoleRelation.setSourceId(UserRoleScope.SYSTEM);
|
userRoleRelation.setSourceId(UserRoleScope.SYSTEM);
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setOrganizationId(UserRoleScope.SYSTEM);
|
userRoleRelation.setOrganizationId(UserRoleScope.SYSTEM);
|
||||||
saveList.add(userRoleRelation);
|
saveList.add(userRoleRelation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.log.service.OperationLogService;
|
import io.metersphere.system.log.service.OperationLogService;
|
||||||
import io.metersphere.system.mapper.*;
|
import io.metersphere.system.mapper.*;
|
||||||
import io.metersphere.system.request.*;
|
import io.metersphere.system.request.*;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.utils.ServiceUtils;
|
import io.metersphere.system.utils.ServiceUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -195,7 +195,7 @@ public class OrganizationService {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setUserId(userId);
|
userRoleRelation.setUserId(userId);
|
||||||
userRoleRelation.setSourceId(organizationId);
|
userRoleRelation.setSourceId(organizationId);
|
||||||
userRoleRelation.setRoleId(InternalUserRole.ORG_MEMBER.getValue());
|
userRoleRelation.setRoleId(InternalUserRole.ORG_MEMBER.getValue());
|
||||||
|
@ -616,7 +616,7 @@ public class OrganizationService {
|
||||||
|
|
||||||
private UserRoleRelation buildUserRoleRelation(String createUserId, String memberId, String sourceId, String roleId, String organizationId) {
|
private UserRoleRelation buildUserRoleRelation(String createUserId, String memberId, String sourceId, String roleId, String organizationId) {
|
||||||
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setUserId(memberId);
|
userRoleRelation.setUserId(memberId);
|
||||||
userRoleRelation.setOrganizationId(organizationId);
|
userRoleRelation.setOrganizationId(organizationId);
|
||||||
userRoleRelation.setSourceId(sourceId);
|
userRoleRelation.setSourceId(sourceId);
|
||||||
|
|
|
@ -11,7 +11,7 @@ import io.metersphere.system.domain.*;
|
||||||
import io.metersphere.system.mapper.*;
|
import io.metersphere.system.mapper.*;
|
||||||
import io.metersphere.system.request.OrganizationUserRoleMemberEditRequest;
|
import io.metersphere.system.request.OrganizationUserRoleMemberEditRequest;
|
||||||
import io.metersphere.system.request.OrganizationUserRoleMemberRequest;
|
import io.metersphere.system.request.OrganizationUserRoleMemberRequest;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -83,7 +83,7 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
||||||
request.getUserIds().forEach(userId -> {
|
request.getUserIds().forEach(userId -> {
|
||||||
checkMemberParam(userId, request.getUserRoleId());
|
checkMemberParam(userId, request.getUserRoleId());
|
||||||
UserRoleRelation relation = new UserRoleRelation();
|
UserRoleRelation relation = new UserRoleRelation();
|
||||||
relation.setId(UUID.randomUUID().toString());
|
relation.setId(IDGenerator.nextStr());
|
||||||
relation.setUserId(userId);
|
relation.setUserId(userId);
|
||||||
relation.setRoleId(request.getUserRoleId());
|
relation.setRoleId(request.getUserRoleId());
|
||||||
relation.setSourceId(request.getOrganizationId());
|
relation.setSourceId(request.getOrganizationId());
|
||||||
|
|
|
@ -2,7 +2,7 @@ package io.metersphere.system.service;
|
||||||
|
|
||||||
import io.metersphere.sdk.dto.OptionDTO;
|
import io.metersphere.sdk.dto.OptionDTO;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.domain.PluginScript;
|
import io.metersphere.system.domain.PluginScript;
|
||||||
import io.metersphere.system.domain.PluginScriptExample;
|
import io.metersphere.system.domain.PluginScriptExample;
|
||||||
|
@ -46,7 +46,7 @@ public class PluginScriptService {
|
||||||
ids.add(scriptInfo.getId());
|
ids.add(scriptInfo.getId());
|
||||||
pluginScript.setPluginId(pluginId);
|
pluginScript.setPluginId(pluginId);
|
||||||
pluginScript.setScriptId(
|
pluginScript.setScriptId(
|
||||||
StringUtils.isBlank(scriptInfo.getId()) ? UUID.randomUUID().toString() : scriptInfo.getId()
|
StringUtils.isBlank(scriptInfo.getId()) ? IDGenerator.nextStr() : scriptInfo.getId()
|
||||||
);
|
);
|
||||||
pluginScript.setName(scriptInfo.getName());
|
pluginScript.setName(scriptInfo.getName());
|
||||||
pluginScript.setScript(script.getBytes());
|
pluginScript.setScript(script.getBytes());
|
||||||
|
|
|
@ -3,7 +3,7 @@ package io.metersphere.system.service;
|
||||||
import io.metersphere.plugin.platform.spi.AbstractPlatformPlugin;
|
import io.metersphere.plugin.platform.spi.AbstractPlatformPlugin;
|
||||||
import io.metersphere.plugin.platform.spi.Platform;
|
import io.metersphere.plugin.platform.spi.Platform;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.utils.ServiceUtils;
|
import io.metersphere.system.utils.ServiceUtils;
|
||||||
|
@ -84,7 +84,7 @@ public class ServiceIntegrationService {
|
||||||
basePluginService.checkPluginEnableAndPermission(request.getPluginId(), request.getOrganizationId());
|
basePluginService.checkPluginEnableAndPermission(request.getPluginId(), request.getOrganizationId());
|
||||||
ServiceIntegration serviceIntegration = new ServiceIntegration();
|
ServiceIntegration serviceIntegration = new ServiceIntegration();
|
||||||
BeanUtils.copyBean(serviceIntegration, request);
|
BeanUtils.copyBean(serviceIntegration, request);
|
||||||
serviceIntegration.setId(UUID.randomUUID().toString());
|
serviceIntegration.setId(IDGenerator.nextStr());
|
||||||
serviceIntegration.setConfiguration(JSON.toJSONBytes(request.getConfiguration()));
|
serviceIntegration.setConfiguration(JSON.toJSONBytes(request.getConfiguration()));
|
||||||
checkAddExist(serviceIntegration);
|
checkAddExist(serviceIntegration);
|
||||||
serviceIntegrationMapper.insert(serviceIntegration);
|
serviceIntegrationMapper.insert(serviceIntegration);
|
||||||
|
|
|
@ -18,7 +18,7 @@ import io.metersphere.system.mapper.OrganizationMapper;
|
||||||
import io.metersphere.system.mapper.TestResourcePoolBlobMapper;
|
import io.metersphere.system.mapper.TestResourcePoolBlobMapper;
|
||||||
import io.metersphere.system.mapper.TestResourcePoolMapper;
|
import io.metersphere.system.mapper.TestResourcePoolMapper;
|
||||||
import io.metersphere.system.mapper.TestResourcePoolOrganizationMapper;
|
import io.metersphere.system.mapper.TestResourcePoolOrganizationMapper;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -51,7 +51,7 @@ public class TestResourcePoolService {
|
||||||
|
|
||||||
|
|
||||||
public TestResourcePool addTestResourcePool(TestResourcePoolDTO testResourcePool) {
|
public TestResourcePool addTestResourcePool(TestResourcePoolDTO testResourcePool) {
|
||||||
String id = UUID.randomUUID().toString();
|
String id = IDGenerator.nextStr();
|
||||||
|
|
||||||
checkTestResourcePool(testResourcePool);
|
checkTestResourcePool(testResourcePool);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public class TestResourcePoolService {
|
||||||
testResourcePool.setAllOrg(false);
|
testResourcePool.setAllOrg(false);
|
||||||
testResourceDTO.getOrgIds().forEach(orgId -> {
|
testResourceDTO.getOrgIds().forEach(orgId -> {
|
||||||
TestResourcePoolOrganization testResourcePoolOrganization = new TestResourcePoolOrganization();
|
TestResourcePoolOrganization testResourcePoolOrganization = new TestResourcePoolOrganization();
|
||||||
testResourcePoolOrganization.setId(UUID.randomUUID().toString());
|
testResourcePoolOrganization.setId(IDGenerator.nextStr());
|
||||||
testResourcePoolOrganization.setOrgId(orgId);
|
testResourcePoolOrganization.setOrgId(orgId);
|
||||||
testResourcePoolOrganization.setTestResourcePoolId(id);
|
testResourcePoolOrganization.setTestResourcePoolId(id);
|
||||||
poolOrganizationMapper.insert(testResourcePoolOrganization);
|
poolOrganizationMapper.insert(testResourcePoolOrganization);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.metersphere.system.service;
|
package io.metersphere.system.service;
|
||||||
|
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.domain.UserInvite;
|
import io.metersphere.system.domain.UserInvite;
|
||||||
|
@ -37,7 +37,7 @@ public class UserInviteService {
|
||||||
userInvite.setRoles(JSON.toJSONString(userRoleIds));
|
userInvite.setRoles(JSON.toJSONString(userRoleIds));
|
||||||
userInvite.setInviteUser(inviteUser);
|
userInvite.setInviteUser(inviteUser);
|
||||||
userInvite.setInviteTime(inviteTime);
|
userInvite.setInviteTime(inviteTime);
|
||||||
userInvite.setId(UUID.randomUUID().toString());
|
userInvite.setId(IDGenerator.nextStr());
|
||||||
inviteList.add(userInvite);
|
inviteList.add(userInvite);
|
||||||
}
|
}
|
||||||
userInviteMapper.batchInsert(inviteList);
|
userInviteMapper.batchInsert(inviteList);
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@ -45,7 +45,7 @@ public class UserKeyService {
|
||||||
}
|
}
|
||||||
|
|
||||||
UserKey userKeys = new UserKey();
|
UserKey userKeys = new UserKey();
|
||||||
userKeys.setId(UUID.randomUUID().toString());
|
userKeys.setId(IDGenerator.nextStr());
|
||||||
userKeys.setCreateUser(userId);
|
userKeys.setCreateUser(userId);
|
||||||
userKeys.setEnable(true);
|
userKeys.setEnable(true);
|
||||||
userKeys.setAccessKey(RandomStringUtils.randomAlphanumeric(16));
|
userKeys.setAccessKey(RandomStringUtils.randomAlphanumeric(16));
|
||||||
|
|
|
@ -7,7 +7,7 @@ import io.metersphere.sdk.dto.LogDTO;
|
||||||
import io.metersphere.system.log.constants.OperationLogModule;
|
import io.metersphere.system.log.constants.OperationLogModule;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.log.service.OperationLogService;
|
import io.metersphere.system.log.service.OperationLogService;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.domain.*;
|
import io.metersphere.system.domain.*;
|
||||||
import io.metersphere.system.mapper.ExtUserRoleRelationMapper;
|
import io.metersphere.system.mapper.ExtUserRoleRelationMapper;
|
||||||
|
@ -87,7 +87,7 @@ public class UserRoleRelationService {
|
||||||
for (String userRoleId : userRoleIdList) {
|
for (String userRoleId : userRoleIdList) {
|
||||||
for (User user : userList) {
|
for (User user : userList) {
|
||||||
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setUserId(user.getId());
|
userRoleRelation.setUserId(user.getId());
|
||||||
userRoleRelation.setRoleId(userRoleId);
|
userRoleRelation.setRoleId(userRoleId);
|
||||||
userRoleRelation.setSourceId(UserRoleScope.SYSTEM);
|
userRoleRelation.setSourceId(UserRoleScope.SYSTEM);
|
||||||
|
@ -117,7 +117,7 @@ public class UserRoleRelationService {
|
||||||
//添加用户组织关系
|
//添加用户组织关系
|
||||||
for (String userRoleId : userRoleIdList) {
|
for (String userRoleId : userRoleIdList) {
|
||||||
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setUserId(user.getId());
|
userRoleRelation.setUserId(user.getId());
|
||||||
userRoleRelation.setRoleId(userRoleId);
|
userRoleRelation.setRoleId(userRoleId);
|
||||||
userRoleRelation.setSourceId(UserRoleScope.SYSTEM);
|
userRoleRelation.setSourceId(UserRoleScope.SYSTEM);
|
||||||
|
@ -187,7 +187,7 @@ public class UserRoleRelationService {
|
||||||
for (String roleId : roleList) {
|
for (String roleId : roleList) {
|
||||||
if (!userSavedRoleIdList.contains(roleId)) {
|
if (!userSavedRoleIdList.contains(roleId)) {
|
||||||
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setUserId(user.getId());
|
userRoleRelation.setUserId(user.getId());
|
||||||
userRoleRelation.setRoleId(roleId);
|
userRoleRelation.setRoleId(roleId);
|
||||||
userRoleRelation.setSourceId(UserRoleScope.SYSTEM);
|
userRoleRelation.setSourceId(UserRoleScope.SYSTEM);
|
||||||
|
|
|
@ -25,7 +25,7 @@ import io.metersphere.system.request.user.UserChangeEnableRequest;
|
||||||
import io.metersphere.system.request.user.UserEditRequest;
|
import io.metersphere.system.request.user.UserEditRequest;
|
||||||
import io.metersphere.system.response.user.UserImportResponse;
|
import io.metersphere.system.response.user.UserImportResponse;
|
||||||
import io.metersphere.system.response.user.UserTableResponse;
|
import io.metersphere.system.response.user.UserTableResponse;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.utils.UserImportEventListener;
|
import io.metersphere.system.utils.UserImportEventListener;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.mail.internet.InternetAddress;
|
import jakarta.mail.internet.InternetAddress;
|
||||||
|
@ -114,7 +114,7 @@ public class UserService {
|
||||||
List<User> saveUserList = new ArrayList<>();
|
List<User> saveUserList = new ArrayList<>();
|
||||||
//添加用户
|
//添加用户
|
||||||
for (UserCreateInfo userInfo : userCreateDTO.getUserInfoList()) {
|
for (UserCreateInfo userInfo : userCreateDTO.getUserInfoList()) {
|
||||||
userInfo.setId(UUID.randomUUID().toString());
|
userInfo.setId(IDGenerator.nextStr());
|
||||||
User user = new User();
|
User user = new User();
|
||||||
BeanUtils.copyBean(user, userInfo);
|
BeanUtils.copyBean(user, userInfo);
|
||||||
user.setCreateUser(operator);
|
user.setCreateUser(operator);
|
||||||
|
@ -471,7 +471,7 @@ public class UserService {
|
||||||
//创建用户
|
//创建用户
|
||||||
long createTime = System.currentTimeMillis();
|
long createTime = System.currentTimeMillis();
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setId(UUID.randomUUID().toString());
|
user.setId(IDGenerator.nextStr());
|
||||||
user.setEmail(userInvite.getEmail());
|
user.setEmail(userInvite.getEmail());
|
||||||
user.setPassword(CodingUtils.md5(RsaUtils.privateDecrypt(request.getPassword(), RsaUtils.getRsaKey().getPrivateKey())));
|
user.setPassword(CodingUtils.md5(RsaUtils.privateDecrypt(request.getPassword(), RsaUtils.getRsaKey().getPrivateKey())));
|
||||||
user.setName(request.getName());
|
user.setName(request.getName());
|
||||||
|
|
|
@ -3,7 +3,7 @@ package io.metersphere.system.uid;
|
||||||
import io.metersphere.system.uid.impl.CachedUidGenerator;
|
import io.metersphere.system.uid.impl.CachedUidGenerator;
|
||||||
import io.metersphere.sdk.util.CommonBeanFactory;
|
import io.metersphere.sdk.util.CommonBeanFactory;
|
||||||
|
|
||||||
public class UUID {
|
public class IDGenerator {
|
||||||
private static final CachedUidGenerator DEFAULT_UID_GENERATOR;
|
private static final CachedUidGenerator DEFAULT_UID_GENERATOR;
|
||||||
|
|
||||||
static {
|
static {
|
|
@ -17,7 +17,7 @@ import io.metersphere.system.domain.UserRolePermissionExample;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.mapper.UserMapper;
|
import io.metersphere.system.mapper.UserMapper;
|
||||||
import io.metersphere.system.mapper.UserRolePermissionMapper;
|
import io.metersphere.system.mapper.UserRolePermissionMapper;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.validation.groups.Created;
|
import io.metersphere.validation.groups.Created;
|
||||||
import io.metersphere.validation.groups.Updated;
|
import io.metersphere.validation.groups.Updated;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
@ -513,7 +513,7 @@ public abstract class BaseTest {
|
||||||
private UserRolePermission initUserRolePermission(String roleId, String permissionId) {
|
private UserRolePermission initUserRolePermission(String roleId, String permissionId) {
|
||||||
UserRolePermission userRolePermission = new UserRolePermission();
|
UserRolePermission userRolePermission = new UserRolePermission();
|
||||||
userRolePermission.setRoleId(roleId);
|
userRolePermission.setRoleId(roleId);
|
||||||
userRolePermission.setId(UUID.randomUUID().toString());
|
userRolePermission.setId(IDGenerator.nextStr());
|
||||||
userRolePermission.setPermissionId(permissionId);
|
userRolePermission.setPermissionId(permissionId);
|
||||||
userRolePermissionMapper.insert(userRolePermission);
|
userRolePermissionMapper.insert(userRolePermission);
|
||||||
return userRolePermission;
|
return userRolePermission;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import io.metersphere.sdk.dto.request.UserRoleUpdateRequest;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.service.BaseUserRolePermissionService;
|
import io.metersphere.system.service.BaseUserRolePermissionService;
|
||||||
import io.metersphere.system.service.BaseUserRoleRelationService;
|
import io.metersphere.system.service.BaseUserRoleRelationService;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.system.utils.SessionUtils;
|
import io.metersphere.system.utils.SessionUtils;
|
||||||
import io.metersphere.system.controller.param.PermissionSettingUpdateRequestDefinition;
|
import io.metersphere.system.controller.param.PermissionSettingUpdateRequestDefinition;
|
||||||
|
@ -349,7 +349,7 @@ class GlobalUserRoleControllerTests extends BaseTest {
|
||||||
UserRole nonGlobalUserRole = userRoleMapper.selectByPrimaryKey(ADMIN.getValue());
|
UserRole nonGlobalUserRole = userRoleMapper.selectByPrimaryKey(ADMIN.getValue());
|
||||||
nonGlobalUserRole.setName("非全局用户组");
|
nonGlobalUserRole.setName("非全局用户组");
|
||||||
nonGlobalUserRole.setScopeId("not global");
|
nonGlobalUserRole.setScopeId("not global");
|
||||||
nonGlobalUserRole.setId(UUID.randomUUID().toString());
|
nonGlobalUserRole.setId(IDGenerator.nextStr());
|
||||||
userRoleMapper.insert(nonGlobalUserRole);
|
userRoleMapper.insert(nonGlobalUserRole);
|
||||||
return nonGlobalUserRole;
|
return nonGlobalUserRole;
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ class GlobalUserRoleControllerTests extends BaseTest {
|
||||||
private UserRoleRelation prepareOneLimitTest(String userRoleId) {
|
private UserRoleRelation prepareOneLimitTest(String userRoleId) {
|
||||||
// 插入一条用户数据
|
// 插入一条用户数据
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setId(UUID.randomUUID().toString());
|
user.setId(IDGenerator.nextStr());
|
||||||
user.setCreateUser(SessionUtils.getUserId());
|
user.setCreateUser(SessionUtils.getUserId());
|
||||||
user.setName("test one user role");
|
user.setName("test one user role");
|
||||||
user.setSource(UserSource.LOCAL.name());
|
user.setSource(UserSource.LOCAL.name());
|
||||||
|
@ -374,7 +374,7 @@ class GlobalUserRoleControllerTests extends BaseTest {
|
||||||
user.setDeleted(false);
|
user.setDeleted(false);
|
||||||
userMapper.insert(user);
|
userMapper.insert(user);
|
||||||
UserRoleRelation roleRelation = new UserRoleRelation();
|
UserRoleRelation roleRelation = new UserRoleRelation();
|
||||||
roleRelation.setId(UUID.randomUUID().toString());
|
roleRelation.setId(IDGenerator.nextStr());
|
||||||
roleRelation.setCreateTime(System.currentTimeMillis());
|
roleRelation.setCreateTime(System.currentTimeMillis());
|
||||||
roleRelation.setRoleId(userRoleId);
|
roleRelation.setRoleId(userRoleId);
|
||||||
roleRelation.setCreateUser(ADMIN.getValue());
|
roleRelation.setCreateUser(ADMIN.getValue());
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.springframework.test.web.servlet.MvcResult;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static io.metersphere.sdk.constants.InternalUserRole.ADMIN;
|
import static io.metersphere.sdk.constants.InternalUserRole.ADMIN;
|
||||||
|
@ -234,12 +234,12 @@ class GlobalUserRoleRelationControllerTests extends BaseTest {
|
||||||
private UserRoleRelation getNonGlobalUserRoleRelation() {
|
private UserRoleRelation getNonGlobalUserRoleRelation() {
|
||||||
UserRole nonGlobalUserRole = getNonGlobalUserRole();
|
UserRole nonGlobalUserRole = getNonGlobalUserRole();
|
||||||
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setRoleId(nonGlobalUserRole.getId());
|
userRoleRelation.setRoleId(nonGlobalUserRole.getId());
|
||||||
userRoleRelation.setCreateUser(ADMIN.getValue());
|
userRoleRelation.setCreateUser(ADMIN.getValue());
|
||||||
userRoleRelation.setUserId(ADMIN.getValue());
|
userRoleRelation.setUserId(ADMIN.getValue());
|
||||||
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
||||||
userRoleRelation.setSourceId(UUID.randomUUID().toString());
|
userRoleRelation.setSourceId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setOrganizationId(UserRoleScope.SYSTEM);
|
userRoleRelation.setOrganizationId(UserRoleScope.SYSTEM);
|
||||||
userRoleRelationMapper.insert(userRoleRelation);
|
userRoleRelationMapper.insert(userRoleRelation);
|
||||||
return userRoleRelation;
|
return userRoleRelation;
|
||||||
|
@ -250,12 +250,12 @@ class GlobalUserRoleRelationControllerTests extends BaseTest {
|
||||||
*/
|
*/
|
||||||
private UserRoleRelation getNonSystemUserRoleRelation() {
|
private UserRoleRelation getNonSystemUserRoleRelation() {
|
||||||
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setRoleId(ORG_ADMIN.getValue());
|
userRoleRelation.setRoleId(ORG_ADMIN.getValue());
|
||||||
userRoleRelation.setUserId(ADMIN.getValue());
|
userRoleRelation.setUserId(ADMIN.getValue());
|
||||||
userRoleRelation.setCreateUser(ADMIN.getValue());
|
userRoleRelation.setCreateUser(ADMIN.getValue());
|
||||||
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
||||||
userRoleRelation.setSourceId(UUID.randomUUID().toString());
|
userRoleRelation.setSourceId(IDGenerator.nextStr());
|
||||||
userRoleRelation.setOrganizationId(UserRoleScope.SYSTEM);
|
userRoleRelation.setOrganizationId(UserRoleScope.SYSTEM);
|
||||||
userRoleRelationMapper.insert(userRoleRelation);
|
userRoleRelationMapper.insert(userRoleRelation);
|
||||||
return userRoleRelation;
|
return userRoleRelation;
|
||||||
|
@ -269,7 +269,7 @@ class GlobalUserRoleRelationControllerTests extends BaseTest {
|
||||||
UserRole nonGlobalUserRole = userRoleMapper.selectByPrimaryKey(ADMIN.getValue());
|
UserRole nonGlobalUserRole = userRoleMapper.selectByPrimaryKey(ADMIN.getValue());
|
||||||
nonGlobalUserRole.setName("非全局用户组");
|
nonGlobalUserRole.setName("非全局用户组");
|
||||||
nonGlobalUserRole.setScopeId("not global");
|
nonGlobalUserRole.setScopeId("not global");
|
||||||
nonGlobalUserRole.setId(UUID.randomUUID().toString());
|
nonGlobalUserRole.setId(IDGenerator.nextStr());
|
||||||
userRoleMapper.insert(nonGlobalUserRole);
|
userRoleMapper.insert(nonGlobalUserRole);
|
||||||
return nonGlobalUserRole;
|
return nonGlobalUserRole;
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ class GlobalUserRoleRelationControllerTests extends BaseTest {
|
||||||
UserRole nonInternalRole = userRoleMapper.selectByPrimaryKey(ADMIN.getValue());
|
UserRole nonInternalRole = userRoleMapper.selectByPrimaryKey(ADMIN.getValue());
|
||||||
nonInternalRole.setName("非内置用户组");
|
nonInternalRole.setName("非内置用户组");
|
||||||
nonInternalRole.setInternal(false);
|
nonInternalRole.setInternal(false);
|
||||||
nonInternalRole.setId(UUID.randomUUID().toString());
|
nonInternalRole.setId(IDGenerator.nextStr());
|
||||||
userRoleMapper.insert(nonInternalRole);
|
userRoleMapper.insert(nonInternalRole);
|
||||||
return nonInternalRole;
|
return nonInternalRole;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import io.metersphere.system.dto.ProjectDTO;
|
||||||
import io.metersphere.system.mapper.UserMapper;
|
import io.metersphere.system.mapper.UserMapper;
|
||||||
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
import io.metersphere.system.mapper.UserRoleRelationMapper;
|
||||||
import io.metersphere.system.service.SystemProjectService;
|
import io.metersphere.system.service.SystemProjectService;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.junit.jupiter.api.MethodOrderer;
|
import org.junit.jupiter.api.MethodOrderer;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -107,7 +107,7 @@ public class LoginControllerTests extends BaseTest {
|
||||||
userRoleRelation.setRoleId("org-member");
|
userRoleRelation.setRoleId("org-member");
|
||||||
userRoleRelation.setCreateUser("test.login");
|
userRoleRelation.setCreateUser("test.login");
|
||||||
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelationMapper.insert(userRoleRelation);
|
userRoleRelationMapper.insert(userRoleRelation);
|
||||||
mockMvc.perform(MockMvcRequestBuilders.post(login)
|
mockMvc.perform(MockMvcRequestBuilders.post(login)
|
||||||
.content(String.format("{\"username\":\"%s\",\"password\":\"%s\"}", "test.login", "test.login@163.com"))
|
.content(String.format("{\"username\":\"%s\",\"password\":\"%s\"}", "test.login", "test.login@163.com"))
|
||||||
|
@ -134,7 +134,7 @@ public class LoginControllerTests extends BaseTest {
|
||||||
userRoleRelation.setRoleId("org-member");
|
userRoleRelation.setRoleId("org-member");
|
||||||
userRoleRelation.setCreateUser("test.login");
|
userRoleRelation.setCreateUser("test.login");
|
||||||
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
userRoleRelation.setCreateTime(System.currentTimeMillis());
|
||||||
userRoleRelation.setId(UUID.randomUUID().toString());
|
userRoleRelation.setId(IDGenerator.nextStr());
|
||||||
userRoleRelationMapper.insert(userRoleRelation);
|
userRoleRelationMapper.insert(userRoleRelation);
|
||||||
user.setLastOrganizationId(DEFAULT_ORGANIZATION_ID);
|
user.setLastOrganizationId(DEFAULT_ORGANIZATION_ID);
|
||||||
user.setLastProjectId(null);
|
user.setLastProjectId(null);
|
||||||
|
|
|
@ -29,7 +29,7 @@ import io.metersphere.system.response.user.UserTableResponse;
|
||||||
import io.metersphere.system.service.GlobalUserRoleRelationService;
|
import io.metersphere.system.service.GlobalUserRoleRelationService;
|
||||||
import io.metersphere.system.service.UserService;
|
import io.metersphere.system.service.UserService;
|
||||||
import io.metersphere.system.service.UserToolService;
|
import io.metersphere.system.service.UserToolService;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.utils.user.UserParamUtils;
|
import io.metersphere.system.utils.user.UserParamUtils;
|
||||||
import io.metersphere.system.utils.user.UserRequestUtils;
|
import io.metersphere.system.utils.user.UserRequestUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
@ -199,7 +199,7 @@ public class UserControllerTests extends BaseTest {
|
||||||
public void testGetByEmailError() throws Exception {
|
public void testGetByEmailError() throws Exception {
|
||||||
//测试使用任意参数,不能获取到任何用户信息
|
//测试使用任意参数,不能获取到任何用户信息
|
||||||
this.checkUserList();
|
this.checkUserList();
|
||||||
String url = UserRequestUtils.URL_USER_GET + UUID.randomUUID();
|
String url = UserRequestUtils.URL_USER_GET + IDGenerator.randomUUID();
|
||||||
MvcResult mvcResult = userRequestUtils.responseGet(url);
|
MvcResult mvcResult = userRequestUtils.responseGet(url);
|
||||||
|
|
||||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
@ -278,7 +278,7 @@ public class UserControllerTests extends BaseTest {
|
||||||
|
|
||||||
//查找不存在的用户
|
//查找不存在的用户
|
||||||
basePageRequest = UserParamUtils.getDefaultPageRequest();
|
basePageRequest = UserParamUtils.getDefaultPageRequest();
|
||||||
basePageRequest.setKeyword(UUID.randomUUID().toString());
|
basePageRequest.setKeyword(IDGenerator.nextStr());
|
||||||
returnPager = userRequestUtils.selectUserPage(basePageRequest);
|
returnPager = userRequestUtils.selectUserPage(basePageRequest);
|
||||||
//返回值不为空
|
//返回值不为空
|
||||||
Assertions.assertNotNull(returnPager);
|
Assertions.assertNotNull(returnPager);
|
||||||
|
@ -1196,7 +1196,7 @@ public class UserControllerTests extends BaseTest {
|
||||||
//400-用户名为空
|
//400-用户名为空
|
||||||
UserRegisterRequest request = new UserRegisterRequest();
|
UserRegisterRequest request = new UserRegisterRequest();
|
||||||
request.setInviteId(inviteId);
|
request.setInviteId(inviteId);
|
||||||
request.setPassword(UUID.randomUUID().toString());
|
request.setPassword(IDGenerator.nextStr());
|
||||||
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, BAD_REQUEST_MATCHER);
|
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, BAD_REQUEST_MATCHER);
|
||||||
request.setName("");
|
request.setName("");
|
||||||
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, BAD_REQUEST_MATCHER);
|
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, BAD_REQUEST_MATCHER);
|
||||||
|
@ -1211,16 +1211,16 @@ public class UserControllerTests extends BaseTest {
|
||||||
//400-邀请ID为空
|
//400-邀请ID为空
|
||||||
request = new UserRegisterRequest();
|
request = new UserRegisterRequest();
|
||||||
request.setName("建国通过邮箱邀请2");
|
request.setName("建国通过邮箱邀请2");
|
||||||
request.setPassword(UUID.randomUUID().toString());
|
request.setPassword(IDGenerator.nextStr());
|
||||||
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, BAD_REQUEST_MATCHER);
|
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, BAD_REQUEST_MATCHER);
|
||||||
request.setInviteId("");
|
request.setInviteId("");
|
||||||
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, BAD_REQUEST_MATCHER);
|
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, BAD_REQUEST_MATCHER);
|
||||||
|
|
||||||
//500-邀请ID不存在
|
//500-邀请ID不存在
|
||||||
request = new UserRegisterRequest();
|
request = new UserRegisterRequest();
|
||||||
request.setInviteId(UUID.randomUUID().toString());
|
request.setInviteId(IDGenerator.nextStr());
|
||||||
request.setName("建国通过邮箱邀请2");
|
request.setName("建国通过邮箱邀请2");
|
||||||
request.setPassword(UUID.randomUUID().toString());
|
request.setPassword(IDGenerator.nextStr());
|
||||||
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, ERROR_REQUEST_MATCHER);
|
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, ERROR_REQUEST_MATCHER);
|
||||||
|
|
||||||
//500-邀请ID已过期,且暂未删除
|
//500-邀请ID已过期,且暂未删除
|
||||||
|
@ -1231,7 +1231,7 @@ public class UserControllerTests extends BaseTest {
|
||||||
request = new UserRegisterRequest();
|
request = new UserRegisterRequest();
|
||||||
request.setInviteId(inviteId);
|
request.setInviteId(inviteId);
|
||||||
request.setName("建国通过邮箱邀请2");
|
request.setName("建国通过邮箱邀请2");
|
||||||
request.setPassword(UUID.randomUUID().toString());
|
request.setPassword(IDGenerator.nextStr());
|
||||||
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, ERROR_REQUEST_MATCHER);
|
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, ERROR_REQUEST_MATCHER);
|
||||||
|
|
||||||
//500-用户邮箱在用户注册之前已经被注册过了
|
//500-用户邮箱在用户注册之前已经被注册过了
|
||||||
|
@ -1256,7 +1256,7 @@ public class UserControllerTests extends BaseTest {
|
||||||
request = new UserRegisterRequest();
|
request = new UserRegisterRequest();
|
||||||
request.setInviteId(inviteId);
|
request.setInviteId(inviteId);
|
||||||
request.setName("建国通过邮箱邀请2");
|
request.setName("建国通过邮箱邀请2");
|
||||||
request.setPassword(UUID.randomUUID().toString());
|
request.setPassword(IDGenerator.nextStr());
|
||||||
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, ERROR_REQUEST_MATCHER);
|
userRequestUtils.requestPost(UserRequestUtils.URL_INVITE_REGISTER, request, ERROR_REQUEST_MATCHER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,7 @@ import io.metersphere.plan.mapper.TestPlanConfigMapper;
|
||||||
import io.metersphere.plan.mapper.TestPlanMapper;
|
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.system.utils.SessionUtils;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.domain.User;
|
|
||||||
import io.metersphere.system.uid.UUID;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
@ -55,7 +53,7 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isBlank(testPlanCreateRequest.getId())) {
|
if (StringUtils.isBlank(testPlanCreateRequest.getId())) {
|
||||||
testPlanCreateRequest.setId(UUID.randomUUID().toString());
|
testPlanCreateRequest.setId(IDGenerator.nextStr());
|
||||||
}
|
}
|
||||||
testPlanCreateRequest.setCreateTime(System.currentTimeMillis());
|
testPlanCreateRequest.setCreateTime(System.currentTimeMillis());
|
||||||
testPlanCreateRequest.setUpdateTime(System.currentTimeMillis());
|
testPlanCreateRequest.setUpdateTime(System.currentTimeMillis());
|
||||||
|
|
|
@ -6,7 +6,7 @@ import io.metersphere.plan.dto.TestPlanDTO;
|
||||||
import io.metersphere.sdk.constants.SessionConstants;
|
import io.metersphere.sdk.constants.SessionConstants;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.controller.handler.ResultHolder;
|
import io.metersphere.system.controller.handler.ResultHolder;
|
||||||
import io.metersphere.system.uid.UUID;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
|
@ -37,7 +37,7 @@ public class TestPlanControllerTests {
|
||||||
|
|
||||||
static List<TestPlanDTO> SAVED_TEST_PLAN_DTO_LIST = new ArrayList<>();
|
static List<TestPlanDTO> SAVED_TEST_PLAN_DTO_LIST = new ArrayList<>();
|
||||||
|
|
||||||
static final String STATIC_UUID = UUID.randomUUID().toString();
|
static final String STATIC_UUID = IDGenerator.nextStr();
|
||||||
|
|
||||||
private TestPlanDTO getSimpleTestPlan() {
|
private TestPlanDTO getSimpleTestPlan() {
|
||||||
TestPlanDTO testPlan = new TestPlanDTO();
|
TestPlanDTO testPlan = new TestPlanDTO();
|
||||||
|
@ -267,7 +267,7 @@ public class TestPlanControllerTests {
|
||||||
|
|
||||||
//测试parentId和id相同
|
//测试parentId和id相同
|
||||||
testPlan = this.getSimpleTestPlan();
|
testPlan = this.getSimpleTestPlan();
|
||||||
testPlan.setId(UUID.randomUUID().toString());
|
testPlan.setId(IDGenerator.nextStr());
|
||||||
testPlan.setParentId(testPlan.getId());
|
testPlan.setParentId(testPlan.getId());
|
||||||
mockMvc.perform(MockMvcRequestBuilders.post("/test-plan/add")
|
mockMvc.perform(MockMvcRequestBuilders.post("/test-plan/add")
|
||||||
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -82,7 +82,7 @@
|
||||||
<frontend-maven-plugin.version>1.12.1</frontend-maven-plugin.version>
|
<frontend-maven-plugin.version>1.12.1</frontend-maven-plugin.version>
|
||||||
<node.version>v16.20.0</node.version>
|
<node.version>v16.20.0</node.version>
|
||||||
<npm.version>8.19.4</npm.version>
|
<npm.version>8.19.4</npm.version>
|
||||||
<pnpm.version>8.6.12</pnpm.version>
|
<pnpm.version>8.9.2</pnpm.version>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<skipAntRunForJenkins>false</skipAntRunForJenkins>
|
<skipAntRunForJenkins>false</skipAntRunForJenkins>
|
||||||
<commons-dbcp2-version>2.9.0</commons-dbcp2-version>
|
<commons-dbcp2-version>2.9.0</commons-dbcp2-version>
|
||||||
|
|
Loading…
Reference in New Issue