refactor(系统设置): 日志接口-组织日志调整

This commit is contained in:
WangXu10 2023-08-23 11:31:16 +08:00 committed by 刘瑞斌
parent 1012e9879d
commit 2aba451d92
5 changed files with 15 additions and 6 deletions

View File

@ -57,10 +57,11 @@ public class OperationLogModule {
public static final String SETTING = "SETTING";
public static final String SETTING_SYSTEM = "SETTING_SYSTEM";
public static final String SETTING_SYSTEM_USER = "SETTING_SYSTEM_USER";
public static final String SETTING_SYSTEM_USER_SINGLE = "SETTING_SYSTEM_USER";
public static final String SETTING_SYSTEM_USER_GROUP = "SETTING_SYSTEM_USER_GROUP";
public static final String SETTING_SYSTEM_ORGANIZATION = "SETTING_SYSTEM_ORGANIZATION";
public static final String SETTING_SYSTEM_PARAMETER = "SETTING_SYSTEM_PARAMETER";
public static final String SETTING_SYSTEM_PARAMETER_BASE_CONFIG = "SETTING_SYSTEM_PARAMETER_BASE_CONFIG";
public static final String SETTING_SYSTEM_PARAMETER_PAGE_CONFIG = "SETTING_SYSTEM_PARAMETER_PAGE_CONFIG";
public static final String SETTING_SYSTEM_PARAMETER_AUTH_CONFIG = "SETTING_SYSTEM_PARAMETER_AUTH_CONFIG";
//系统设置-系统-资源池

View File

@ -225,10 +225,10 @@ public class SystemParameterService {
LogDTO dto = new LogDTO(
OperationLogConstants.SYSTEM,
OperationLogConstants.SYSTEM,
"system-parameter",
OperationLogConstants.SYSTEM,
null,
OperationLogType.ADD.name(),
OperationLogModule.SETTING_SYSTEM_PARAMETER,
OperationLogModule.SETTING_SYSTEM_PARAMETER_BASE_CONFIG,
"基础设置");
dto.setPath("/system/parameter/save/base-info");
@ -242,10 +242,10 @@ public class SystemParameterService {
LogDTO dto = new LogDTO(
OperationLogConstants.SYSTEM,
OperationLogConstants.SYSTEM,
"system-parameter",
OperationLogConstants.SYSTEM,
null,
OperationLogType.ADD.name(),
OperationLogModule.SETTING_SYSTEM_PARAMETER,
OperationLogModule.SETTING_SYSTEM_PARAMETER_BASE_CONFIG,
"基础设置");
dto.setPath("/system/parameter/edit/email-info");

View File

@ -62,7 +62,7 @@ public class OperationLogController {
@PostMapping("/list")
@Operation(summary = "组织操作日志列表查询")
@Operation(summary = "系统操作日志列表查询")
@RequiresPermissions(PermissionConstants.SYSTEM_OPERATING_LOG_READ)
public Pager<List<OperationLogResponse>> list(@Validated @RequestBody OperationLogRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),

View File

@ -9,6 +9,7 @@ import io.metersphere.sdk.log.vo.OperationLogRequest;
import io.metersphere.sdk.log.vo.OperationLogResponse;
import io.metersphere.sdk.util.PageUtils;
import io.metersphere.sdk.util.Pager;
import io.metersphere.sdk.util.SessionUtils;
import io.metersphere.system.domain.User;
import io.metersphere.system.dto.OrganizationProjectOptionsDTO;
import io.metersphere.system.dto.response.OrganizationProjectOptionsResponse;
@ -17,11 +18,13 @@ import io.metersphere.system.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
@ -70,6 +73,10 @@ public class OrganizationLogController {
public Pager<List<OperationLogResponse>> organizationLogList(@Validated @RequestBody OperationLogRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
if (CollectionUtils.isEmpty(request.getOrganizationIds())) {
//未传组织id 获取登录用户当前组织id
request.setOrganizationIds(Arrays.asList(SessionUtils.getCurrentOrganizationId()));
}
return PageUtils.setPageInfo(page, operationLogService.list(request));
}

View File

@ -56,6 +56,7 @@ public class OrganizationLogControllerTests extends BaseTest {
request.setType("add");
request.setModule("SYSTEM_PARAMETER_SETTING");
request.setContent("认证配置");
request.setOrganizationIds(Arrays.asList("organization_id_001", "organization_id_002"));
this.requestPostWithOkAndReturn(ORGANIZATION_LOG_LIST, request);
//项目级别 指定项目查询