diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java index e87802eb58..a30efbd391 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java @@ -236,7 +236,7 @@ public class PermissionConstants { public static final String WORKSPACE_PROJECT_ENVIRONMENT_GROUP_READ = "WORKSPACE_PROJECT_ENVIRONMENT:READ+CREATE_GROUP"; public static final String WORKSPACE_PROJECT_ENVIRONMENT_GROUP_DELETE = "WORKSPACE_PROJECT_ENVIRONMENT:READ+DELETE_GROUP"; public static final String WORKSPACE_PROJECT_ENVIRONMENT_GROUP_EDIT = "WORKSPACE_PROJECT_ENVIRONMENT:READ+EDIT_GROUP"; - public static final String WORKSPACE_PROJECT_ENVIRONMENT_GROUP_COPY = "WORKSPACE_PROJECT_ENVIRONMENT:READ+COPY_GROU"; + public static final String WORKSPACE_PROJECT_ENVIRONMENT_GROUP_COPY = "WORKSPACE_PROJECT_ENVIRONMENT:READ+COPY_GROUP"; public static final String SYSTEM_PLUGIN_DEL = "SYSTEM_PLUGIN:DEL"; public static final String SYSTEM_PLUGIN_UPLOAD = "SYSTEM_PLUGIN:UPLOAD"; diff --git a/system-setting/backend/src/main/java/io/metersphere/service/EnvironmentGroupService.java b/system-setting/backend/src/main/java/io/metersphere/service/EnvironmentGroupService.java index b55595215d..154f8d8a74 100644 --- a/system-setting/backend/src/main/java/io/metersphere/service/EnvironmentGroupService.java +++ b/system-setting/backend/src/main/java/io/metersphere/service/EnvironmentGroupService.java @@ -11,6 +11,7 @@ import io.metersphere.commons.utils.SessionUtils; import io.metersphere.dto.EnvironmentGroupDTO; import io.metersphere.environment.dto.EnvironmentGroupRequest; import io.metersphere.i18n.Translator; +import jakarta.annotation.Resource; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; @@ -22,7 +23,6 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -184,6 +184,10 @@ public class EnvironmentGroupService { copy.setId(copyId); String copyNameId = copyId.substring(0, 3); + //名字长度大于50 则截取前四十个字符 + if (environmentGroup.getName().length() + 9 > 50) { + environmentGroup.setName(environmentGroup.getName().substring(0, 41)); + } String copyName = environmentGroup.getName() + "_" + copyNameId + "_COPY"; copy.setName(copyName); copy.setWorkspaceId(environmentGroup.getWorkspaceId());