refactor(系统): 日志相关优化
This commit is contained in:
parent
627a63c511
commit
53f2c736f7
|
@ -4,18 +4,19 @@ package io.metersphere.project.controller;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
|
import io.metersphere.system.domain.User;
|
||||||
import io.metersphere.system.log.service.OperationLogService;
|
import io.metersphere.system.log.service.OperationLogService;
|
||||||
import io.metersphere.system.log.vo.OperationLogRequest;
|
|
||||||
import io.metersphere.system.log.vo.OperationLogResponse;
|
import io.metersphere.system.log.vo.OperationLogResponse;
|
||||||
|
import io.metersphere.system.log.vo.ProOperationLogRequest;
|
||||||
|
import io.metersphere.system.log.vo.SystemOperationLogRequest;
|
||||||
|
import io.metersphere.system.service.UserService;
|
||||||
import io.metersphere.system.utils.PageUtils;
|
import io.metersphere.system.utils.PageUtils;
|
||||||
import io.metersphere.system.utils.Pager;
|
import io.metersphere.system.utils.Pager;
|
||||||
import io.metersphere.system.utils.SessionUtils;
|
import io.metersphere.system.utils.SessionUtils;
|
||||||
import io.metersphere.system.domain.User;
|
|
||||||
import io.metersphere.system.service.UserService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -54,14 +55,13 @@ public class ProjectLogController {
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@Operation(summary = "项目管理-日志--操作日志列表查询")
|
@Operation(summary = "项目管理-日志--操作日志列表查询")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_LOG_READ)
|
@RequiresPermissions(PermissionConstants.PROJECT_LOG_READ)
|
||||||
public Pager<List<OperationLogResponse>> projectLogList(@Validated @RequestBody OperationLogRequest request) {
|
public Pager<List<OperationLogResponse>> projectLogList(@Validated @RequestBody ProOperationLogRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
|
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
|
||||||
if (CollectionUtils.isEmpty(request.getProjectIds())) {
|
SystemOperationLogRequest operationLogRequest = new SystemOperationLogRequest();
|
||||||
//未传项目id 获取登录用户当前项目id
|
BeanUtils.copyBean(operationLogRequest, request);
|
||||||
request.setProjectIds(Arrays.asList(SessionUtils.getCurrentProjectId()));
|
operationLogRequest.setProjectIds(Arrays.asList(SessionUtils.getCurrentProjectId()));
|
||||||
}
|
return PageUtils.setPageInfo(page, operationLogService.list(operationLogRequest));
|
||||||
return PageUtils.setPageInfo(page, operationLogService.list(request));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package io.metersphere.project.controller;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.system.base.BaseTest;
|
import io.metersphere.system.base.BaseTest;
|
||||||
import io.metersphere.system.log.vo.OperationLogRequest;
|
import io.metersphere.system.log.vo.ProOperationLogRequest;
|
||||||
import org.junit.jupiter.api.MethodOrderer;
|
import org.junit.jupiter.api.MethodOrderer;
|
||||||
import org.junit.jupiter.api.Order;
|
import org.junit.jupiter.api.Order;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -11,7 +11,6 @@ import org.junit.jupiter.api.TestMethodOrder;
|
||||||
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;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
@ -34,7 +33,7 @@ public class ProjectLogControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(3)
|
@Order(3)
|
||||||
public void testProjectLogList() throws Exception {
|
public void testProjectLogList() throws Exception {
|
||||||
OperationLogRequest request = buildParam(PROJECT);
|
ProOperationLogRequest request = buildParam(PROJECT);
|
||||||
//项目级别 全部
|
//项目级别 全部
|
||||||
this.requestPostWithOkAndReturn(PROJECT_LOG_LIST, request);
|
this.requestPostWithOkAndReturn(PROJECT_LOG_LIST, request);
|
||||||
|
|
||||||
|
@ -43,7 +42,6 @@ public class ProjectLogControllerTests extends BaseTest {
|
||||||
request.setType("add");
|
request.setType("add");
|
||||||
request.setModule("SYSTEM_PARAMETER_SETTING");
|
request.setModule("SYSTEM_PARAMETER_SETTING");
|
||||||
request.setContent("认证配置");
|
request.setContent("认证配置");
|
||||||
request.setProjectIds(Arrays.asList("project_id_001", "project_id_002"));
|
|
||||||
request.setSort(new HashMap<>() {{
|
request.setSort(new HashMap<>() {{
|
||||||
put("createTime", "desc");
|
put("createTime", "desc");
|
||||||
}});
|
}});
|
||||||
|
@ -54,8 +52,8 @@ public class ProjectLogControllerTests extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private OperationLogRequest buildParam(String level) {
|
private ProOperationLogRequest buildParam(String level) {
|
||||||
OperationLogRequest request = new OperationLogRequest();
|
ProOperationLogRequest request = new ProOperationLogRequest();
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
request.setStartTime(1689131059000l);
|
request.setStartTime(1689131059000l);
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.system.log.service.OperationLogService;
|
import io.metersphere.system.log.service.OperationLogService;
|
||||||
import io.metersphere.system.log.vo.OperationLogRequest;
|
import io.metersphere.system.log.vo.SystemOperationLogRequest;
|
||||||
import io.metersphere.system.log.vo.OperationLogResponse;
|
import io.metersphere.system.log.vo.OperationLogResponse;
|
||||||
import io.metersphere.system.utils.PageUtils;
|
import io.metersphere.system.utils.PageUtils;
|
||||||
import io.metersphere.system.utils.Pager;
|
import io.metersphere.system.utils.Pager;
|
||||||
|
@ -65,7 +65,7 @@ public class OperationLogController {
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@Operation(summary = "系统设置-系统-日志-系统操作日志列表查询")
|
@Operation(summary = "系统设置-系统-日志-系统操作日志列表查询")
|
||||||
@RequiresPermissions(PermissionConstants.SYSTEM_LOG_READ)
|
@RequiresPermissions(PermissionConstants.SYSTEM_LOG_READ)
|
||||||
public Pager<List<OperationLogResponse>> list(@Validated @RequestBody OperationLogRequest request) {
|
public Pager<List<OperationLogResponse>> list(@Validated @RequestBody SystemOperationLogRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
|
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
|
||||||
return PageUtils.setPageInfo(page, operationLogService.list(request));
|
return PageUtils.setPageInfo(page, operationLogService.list(request));
|
||||||
|
|
|
@ -4,22 +4,23 @@ package io.metersphere.system.controller;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.system.log.service.OperationLogService;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.system.log.vo.OperationLogRequest;
|
|
||||||
import io.metersphere.system.log.vo.OperationLogResponse;
|
|
||||||
import io.metersphere.system.utils.PageUtils;
|
|
||||||
import io.metersphere.system.utils.Pager;
|
|
||||||
import io.metersphere.system.utils.SessionUtils;
|
|
||||||
import io.metersphere.system.domain.User;
|
import io.metersphere.system.domain.User;
|
||||||
import io.metersphere.system.dto.OrganizationProjectOptionsDTO;
|
import io.metersphere.system.dto.OrganizationProjectOptionsDTO;
|
||||||
import io.metersphere.system.dto.response.OrganizationProjectOptionsResponse;
|
import io.metersphere.system.dto.response.OrganizationProjectOptionsResponse;
|
||||||
|
import io.metersphere.system.log.service.OperationLogService;
|
||||||
|
import io.metersphere.system.log.vo.OperationLogResponse;
|
||||||
|
import io.metersphere.system.log.vo.OrgOperationLogRequest;
|
||||||
|
import io.metersphere.system.log.vo.SystemOperationLogRequest;
|
||||||
import io.metersphere.system.service.SystemProjectService;
|
import io.metersphere.system.service.SystemProjectService;
|
||||||
import io.metersphere.system.service.UserService;
|
import io.metersphere.system.service.UserService;
|
||||||
|
import io.metersphere.system.utils.PageUtils;
|
||||||
|
import io.metersphere.system.utils.Pager;
|
||||||
|
import io.metersphere.system.utils.SessionUtils;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -73,14 +74,13 @@ public class OrganizationLogController {
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@Operation(summary = "系统设置-组织-日志-组织菜单下操作日志列表查询")
|
@Operation(summary = "系统设置-组织-日志-组织菜单下操作日志列表查询")
|
||||||
@RequiresPermissions(PermissionConstants.ORGANIZATION_LOG_READ)
|
@RequiresPermissions(PermissionConstants.ORGANIZATION_LOG_READ)
|
||||||
public Pager<List<OperationLogResponse>> organizationLogList(@Validated @RequestBody OperationLogRequest request) {
|
public Pager<List<OperationLogResponse>> organizationLogList(@Validated @RequestBody OrgOperationLogRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
|
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
|
||||||
if (CollectionUtils.isEmpty(request.getOrganizationIds())) {
|
SystemOperationLogRequest operationLogRequest = new SystemOperationLogRequest();
|
||||||
//未传组织id 获取登录用户当前组织id
|
BeanUtils.copyBean(operationLogRequest, request);
|
||||||
request.setOrganizationIds(Arrays.asList(SessionUtils.getCurrentOrganizationId()));
|
operationLogRequest.setOrganizationIds(Arrays.asList(SessionUtils.getCurrentOrganizationId()));
|
||||||
}
|
return PageUtils.setPageInfo(page, operationLogService.list(operationLogRequest));
|
||||||
return PageUtils.setPageInfo(page, operationLogService.list(request));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import io.metersphere.system.domain.OperationHistoryExample;
|
||||||
import io.metersphere.system.domain.Organization;
|
import io.metersphere.system.domain.Organization;
|
||||||
import io.metersphere.system.dto.sdk.OptionDTO;
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
import io.metersphere.system.log.dto.LogDTO;
|
import io.metersphere.system.log.dto.LogDTO;
|
||||||
import io.metersphere.system.log.vo.OperationLogRequest;
|
import io.metersphere.system.log.vo.SystemOperationLogRequest;
|
||||||
import io.metersphere.system.log.vo.OperationLogResponse;
|
import io.metersphere.system.log.vo.OperationLogResponse;
|
||||||
import io.metersphere.system.mapper.*;
|
import io.metersphere.system.mapper.*;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
@ -90,7 +90,7 @@ public class OperationLogService {
|
||||||
operationLogBlobMapper.insert(getBlob(log));
|
operationLogBlobMapper.insert(getBlob(log));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OperationLogResponse> list(OperationLogRequest request) {
|
public List<OperationLogResponse> list(SystemOperationLogRequest request) {
|
||||||
int compare = Long.compare(request.getStartTime(), request.getEndTime());
|
int compare = Long.compare(request.getStartTime(), request.getEndTime());
|
||||||
if (compare > 0) {
|
if (compare > 0) {
|
||||||
throw new MSException(Translator.get("startTime_must_be_less_than_endTime"));
|
throw new MSException(Translator.get("startTime_must_be_less_than_endTime"));
|
||||||
|
|
|
@ -14,12 +14,11 @@ import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class OperationLogRequest extends BasePageRequest {
|
public class BaseOperationLogRequest extends BasePageRequest {
|
||||||
|
|
||||||
@Schema(description = "操作人")
|
@Schema(description = "操作人")
|
||||||
private String operUser;
|
private String operUser;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "开始日期")
|
@Schema(description = "开始日期")
|
||||||
@NotNull(message = "{start_time_is_null}")
|
@NotNull(message = "{start_time_is_null}")
|
||||||
private Long startTime;
|
private Long startTime;
|
||||||
|
@ -27,12 +26,6 @@ public class OperationLogRequest extends BasePageRequest {
|
||||||
@NotNull(message = "{end_time_is_null}")
|
@NotNull(message = "{end_time_is_null}")
|
||||||
private Long endTime;
|
private Long endTime;
|
||||||
|
|
||||||
@Schema(description = "项目id")
|
|
||||||
private List<String> projectIds;
|
|
||||||
|
|
||||||
@Schema(description = "组织id")
|
|
||||||
private List<String> organizationIds;
|
|
||||||
|
|
||||||
@Schema(description = "操作类型")
|
@Schema(description = "操作类型")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package io.metersphere.system.log.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class OrgOperationLogRequest extends BaseOperationLogRequest {
|
||||||
|
|
||||||
|
@Schema(description = "项目id")
|
||||||
|
private List<String> projectIds;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package io.metersphere.system.log.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class ProOperationLogRequest extends BaseOperationLogRequest {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package io.metersphere.system.log.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class SystemOperationLogRequest extends BaseOperationLogRequest {
|
||||||
|
|
||||||
|
@Schema(description = "项目id")
|
||||||
|
private List<String> projectIds;
|
||||||
|
|
||||||
|
@Schema(description = "组织id")
|
||||||
|
private List<String> organizationIds;
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package io.metersphere.system.mapper;
|
package io.metersphere.system.mapper;
|
||||||
|
|
||||||
|
|
||||||
import io.metersphere.system.log.vo.OperationLogRequest;
|
import io.metersphere.system.log.vo.SystemOperationLogRequest;
|
||||||
import io.metersphere.system.log.vo.OperationLogResponse;
|
import io.metersphere.system.log.vo.OperationLogResponse;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||||
|
|
||||||
public interface BaseOperationLogMapper {
|
public interface BaseOperationLogMapper {
|
||||||
|
|
||||||
List<OperationLogResponse> list(@Param("request") OperationLogRequest request);
|
List<OperationLogResponse> list(@Param("request") SystemOperationLogRequest request);
|
||||||
|
|
||||||
void deleteByTime(@Param("timestamp") long timestamp);
|
void deleteByTime(@Param("timestamp") long timestamp);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="io.metersphere.system.mapper.BaseOperationLogMapper">
|
<mapper namespace="io.metersphere.system.mapper.BaseOperationLogMapper">
|
||||||
|
|
||||||
<select id="list" parameterType="io.metersphere.system.log.vo.OperationLogRequest" resultType="io.metersphere.system.log.vo.OperationLogResponse">
|
<select id="list" parameterType="io.metersphere.system.log.vo.SystemOperationLogRequest" resultType="io.metersphere.system.log.vo.OperationLogResponse">
|
||||||
SELECT
|
SELECT
|
||||||
t.project_id,
|
t.project_id,
|
||||||
t.organization_id,
|
t.organization_id,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import io.metersphere.system.base.BaseTest;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.system.log.dto.LogDTO;
|
import io.metersphere.system.log.dto.LogDTO;
|
||||||
import io.metersphere.system.log.service.OperationLogService;
|
import io.metersphere.system.log.service.OperationLogService;
|
||||||
import io.metersphere.system.log.vo.OperationLogRequest;
|
import io.metersphere.system.log.vo.SystemOperationLogRequest;
|
||||||
import io.metersphere.system.controller.param.OperationLogRequestDefinition;
|
import io.metersphere.system.controller.param.OperationLogRequestDefinition;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.junit.jupiter.api.MethodOrderer;
|
import org.junit.jupiter.api.MethodOrderer;
|
||||||
|
@ -54,7 +54,7 @@ public class OperationLogControllerTests extends BaseTest {
|
||||||
executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
|
executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
|
||||||
public void testSystemOperationLogList() throws Exception {
|
public void testSystemOperationLogList() throws Exception {
|
||||||
//系统级别 全部
|
//系统级别 全部
|
||||||
OperationLogRequest request = buildParam(SYSTEM);
|
SystemOperationLogRequest request = buildParam(SYSTEM);
|
||||||
this.requestPostWithOkAndReturn(OPERATION_LOG_LIST, request);
|
this.requestPostWithOkAndReturn(OPERATION_LOG_LIST, request);
|
||||||
|
|
||||||
//其他查询条件
|
//其他查询条件
|
||||||
|
@ -80,7 +80,7 @@ public class OperationLogControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void testOrganizationOperationLogList() throws Exception {
|
public void testOrganizationOperationLogList() throws Exception {
|
||||||
OperationLogRequest request = buildParam(ORGANIZATION);
|
SystemOperationLogRequest request = buildParam(ORGANIZATION);
|
||||||
//组织级别 全部
|
//组织级别 全部
|
||||||
this.requestPostWithOkAndReturn(OPERATION_LOG_LIST, request);
|
this.requestPostWithOkAndReturn(OPERATION_LOG_LIST, request);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public class OperationLogControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(5)
|
@Order(5)
|
||||||
public void testProjectOperationLogList() throws Exception {
|
public void testProjectOperationLogList() throws Exception {
|
||||||
OperationLogRequest request = buildParam(PROJECT);
|
SystemOperationLogRequest request = buildParam(PROJECT);
|
||||||
//项目级别 全部
|
//项目级别 全部
|
||||||
this.requestPostWithOkAndReturn(OPERATION_LOG_LIST, request);
|
this.requestPostWithOkAndReturn(OPERATION_LOG_LIST, request);
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ public class OperationLogControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(6)
|
@Order(6)
|
||||||
public void testGetOperationLogParamsError() throws Exception {
|
public void testGetOperationLogParamsError() throws Exception {
|
||||||
OperationLogRequest request = buildParam(SYSTEM);
|
SystemOperationLogRequest request = buildParam(SYSTEM);
|
||||||
request.setStartTime(1689149059000l);
|
request.setStartTime(1689149059000l);
|
||||||
request.setEndTime(1689131059000l);
|
request.setEndTime(1689131059000l);
|
||||||
ResultActions resultActions = this.requestPost(OPERATION_LOG_LIST, request);
|
ResultActions resultActions = this.requestPost(OPERATION_LOG_LIST, request);
|
||||||
|
@ -163,8 +163,8 @@ public class OperationLogControllerTests extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private OperationLogRequest buildParam(String level) {
|
private SystemOperationLogRequest buildParam(String level) {
|
||||||
OperationLogRequest request = new OperationLogRequest();
|
SystemOperationLogRequest request = new SystemOperationLogRequest();
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
request.setStartTime(1689131059000l);
|
request.setStartTime(1689131059000l);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package io.metersphere.system.controller;
|
package io.metersphere.system.controller;
|
||||||
|
|
||||||
import io.metersphere.system.base.BaseTest;
|
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.system.log.vo.OperationLogRequest;
|
import io.metersphere.system.base.BaseTest;
|
||||||
import io.metersphere.system.controller.param.OperationLogRequestDefinition;
|
import io.metersphere.system.controller.param.OperationLogRequestDefinition;
|
||||||
|
import io.metersphere.system.log.vo.OrgOperationLogRequest;
|
||||||
import org.junit.jupiter.api.MethodOrderer;
|
import org.junit.jupiter.api.MethodOrderer;
|
||||||
import org.junit.jupiter.api.Order;
|
import org.junit.jupiter.api.Order;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -48,7 +48,7 @@ public class OrganizationLogControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(3)
|
@Order(3)
|
||||||
public void testOrganizationLogList() throws Exception {
|
public void testOrganizationLogList() throws Exception {
|
||||||
OperationLogRequest request = buildParam(ORGANIZATION);
|
OrgOperationLogRequest request = buildParam(ORGANIZATION);
|
||||||
//项目级别 全部
|
//项目级别 全部
|
||||||
this.requestPostWithOkAndReturn(ORGANIZATION_LOG_LIST, request);
|
this.requestPostWithOkAndReturn(ORGANIZATION_LOG_LIST, request);
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ public class OrganizationLogControllerTests extends BaseTest {
|
||||||
request.setType("add");
|
request.setType("add");
|
||||||
request.setModule("SYSTEM_PARAMETER_SETTING");
|
request.setModule("SYSTEM_PARAMETER_SETTING");
|
||||||
request.setContent("认证配置");
|
request.setContent("认证配置");
|
||||||
request.setOrganizationIds(Arrays.asList("organization_id_001", "organization_id_002"));
|
|
||||||
this.requestPostWithOkAndReturn(ORGANIZATION_LOG_LIST, request);
|
this.requestPostWithOkAndReturn(ORGANIZATION_LOG_LIST, request);
|
||||||
|
|
||||||
//项目级别 指定项目查询
|
//项目级别 指定项目查询
|
||||||
|
@ -74,8 +73,8 @@ public class OrganizationLogControllerTests extends BaseTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private OperationLogRequest buildParam(String level) {
|
private OrgOperationLogRequest buildParam(String level) {
|
||||||
OperationLogRequest request = new OperationLogRequest();
|
OrgOperationLogRequest request = new OrgOperationLogRequest();
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
request.setStartTime(1689131059000l);
|
request.setStartTime(1689131059000l);
|
||||||
|
|
Loading…
Reference in New Issue