diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionScheduleController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionScheduleController.java index f903f6f72b..315679108b 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionScheduleController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionScheduleController.java @@ -8,7 +8,6 @@ import io.metersphere.api.service.definition.ApiDefinitionScheduleService; import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.system.log.annotation.Log; import io.metersphere.system.log.constants.OperationLogType; -import io.metersphere.system.security.CheckOwner; import io.metersphere.system.utils.SessionUtils; import io.metersphere.validation.groups.Created; import io.metersphere.validation.groups.Updated; @@ -31,7 +30,6 @@ public class ApiDefinitionScheduleController { @Operation(summary = "接口测试-接口管理-定时同步-创建") @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_IMPORT) @Log(type = OperationLogType.ADD, expression = "#msClass.scheduleLog(#request)", msClass = ApiDefinitionLogService.class) - @CheckOwner(resourceId = "#request.getScenarioId()", resourceType = "api_scenario") public String createSchedule(@RequestBody @Validated({Created.class}) ApiScheduleRequest request) { return apiDefinitionScheduleService.createSchedule(request, SessionUtils.getUserId()); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/FakeErrorService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/FakeErrorService.java index 9e3033bcf3..92d1a1704b 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/FakeErrorService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/FakeErrorService.java @@ -20,6 +20,7 @@ import io.metersphere.system.log.constants.OperationLogModule; import io.metersphere.system.log.constants.OperationLogType; import io.metersphere.system.log.dto.LogDTO; import io.metersphere.system.log.service.OperationLogService; +import io.metersphere.system.service.UserLoginService; import io.metersphere.system.uid.IDGenerator; import jakarta.annotation.Resource; import org.apache.commons.collections.CollectionUtils; @@ -46,6 +47,8 @@ public class FakeErrorService { @Resource private ExtFakeErrorMapper extFakeErrorMapper; + @Resource + private UserLoginService userLoginService; private static final String ADD_TYPE = "ADD"; @@ -124,7 +127,18 @@ public class FakeErrorService { if (StringUtils.isNotBlank(request.getKeyword())) { criteria.andNameLike("%" + request.getKeyword() + "%"); } - return fakeErrorMapper.selectByExample(example); + List fakeErrors = fakeErrorMapper.selectByExample(example); + //把createUser和updateUser提取出来生成新的set + List userIds = new ArrayList<>(); + userIds.addAll(fakeErrors.stream().map(FakeError::getCreateUser).toList()); + userIds.addAll(fakeErrors.stream().map(FakeError::getUpdateUser).toList()); + Map userMap = userLoginService.getUserNameMap(userIds.stream().filter(StringUtils::isNotBlank).distinct().toList()); + fakeErrors.forEach(fakeError -> { + fakeError.setCreateUser(userMap.get(fakeError.getCreateUser())); + fakeError.setUpdateUser(userMap.get(fakeError.getUpdateUser())); + }); + + return fakeErrors; }