fix(系统设置): 启用项目模板系统日志操作对象有误
This commit is contained in:
parent
01f4631797
commit
1478332df2
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.project.controller;
|
||||
|
||||
import io.metersphere.project.service.ProjectCustomFieldLogService;
|
||||
import io.metersphere.sdk.constants.*;
|
||||
import io.metersphere.system.domain.*;
|
||||
import io.metersphere.system.dto.sdk.CustomFieldDTO;
|
||||
|
@ -8,6 +9,7 @@ import io.metersphere.system.dto.sdk.request.CustomFieldUpdateRequest;
|
|||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.system.base.BaseTest;
|
||||
import io.metersphere.system.controller.param.CustomFieldUpdateRequestDefinition;
|
||||
import io.metersphere.system.log.constants.OperationLogModule;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.system.mapper.CustomFieldMapper;
|
||||
import io.metersphere.system.mapper.OrganizationParameterMapper;
|
||||
|
@ -57,6 +59,8 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
|
|||
private OrganizationParameterMapper organizationParameterMapper;
|
||||
@Resource
|
||||
private TemplateCustomFieldMapper templateCustomFieldMapper;
|
||||
@Resource
|
||||
private ProjectCustomFieldLogService projectCustomFieldLogService;
|
||||
private static CustomField addCustomField;
|
||||
private static CustomField anotherAddCustomField;
|
||||
|
||||
|
@ -314,4 +318,14 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
|
|||
.andFieldIdEqualTo(id);
|
||||
return templateCustomFieldMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(10)
|
||||
public void testLog() {
|
||||
Assertions.assertEquals(projectCustomFieldLogService.getOperationLogModule(TemplateScene.API.name()), OperationLogModule.PROJECT_MANAGEMENT_TEMPLATE_API_FIELD);
|
||||
Assertions.assertEquals(projectCustomFieldLogService.getOperationLogModule(TemplateScene.FUNCTIONAL.name()), OperationLogModule.PROJECT_MANAGEMENT_TEMPLATE_FUNCTIONAL_FIELD);
|
||||
Assertions.assertEquals(projectCustomFieldLogService.getOperationLogModule(TemplateScene.BUG.name()), OperationLogModule.PROJECT_MANAGEMENT_TEMPLATE_BUG_FIELD);
|
||||
Assertions.assertEquals(projectCustomFieldLogService.getOperationLogModule(TemplateScene.TEST_PLAN.name()), OperationLogModule.PROJECT_MANAGEMENT_TEMPLATE_TEST_PLAN_FIELD);
|
||||
Assertions.assertEquals(projectCustomFieldLogService.getOperationLogModule(TemplateScene.UI.name()), OperationLogModule.PROJECT_MANAGEMENT_TEMPLATE_UI_FIELD);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package io.metersphere.project.controller;
|
|||
|
||||
import io.metersphere.project.dto.ProjectTemplateDTO;
|
||||
import io.metersphere.project.dto.ProjectTemplateOptionDTO;
|
||||
import io.metersphere.project.service.ProjectTemplateLogService;
|
||||
import io.metersphere.project.service.ProjectTemplateService;
|
||||
import io.metersphere.sdk.constants.OrganizationParameterConstants;
|
||||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
|
@ -13,11 +14,14 @@ import io.metersphere.system.base.BasePluginTestService;
|
|||
import io.metersphere.system.base.BaseTest;
|
||||
import io.metersphere.system.controller.OrganizationTemplateControllerTests;
|
||||
import io.metersphere.system.controller.param.TemplateUpdateRequestDefinition;
|
||||
import io.metersphere.system.domain.*;
|
||||
import io.metersphere.system.domain.CustomField;
|
||||
import io.metersphere.system.domain.OrganizationParameter;
|
||||
import io.metersphere.system.domain.Template;
|
||||
import io.metersphere.system.domain.TemplateExample;
|
||||
import io.metersphere.system.dto.sdk.TemplateDTO;
|
||||
import io.metersphere.system.dto.sdk.request.CustomFieldUpdateRequest;
|
||||
import io.metersphere.system.dto.sdk.request.TemplateCustomFieldRequest;
|
||||
import io.metersphere.system.dto.sdk.request.TemplateUpdateRequest;
|
||||
import io.metersphere.system.log.constants.OperationLogModule;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.system.mapper.OrganizationParameterMapper;
|
||||
import io.metersphere.system.mapper.TemplateMapper;
|
||||
|
@ -35,7 +39,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
import org.springframework.test.context.jdbc.Sql;
|
||||
import org.springframework.test.context.jdbc.SqlConfig;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.test.web.servlet.ResultActions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -76,6 +79,8 @@ public class ProjectTemplateControllerTests extends BaseTest {
|
|||
@Resource
|
||||
private ProjectTemplateService projectTemplateService;
|
||||
@Resource
|
||||
private ProjectTemplateLogService projectTemplateLogService;
|
||||
@Resource
|
||||
private BasePluginTestService basePluginTestService;
|
||||
|
||||
private static Template addTemplate;
|
||||
|
@ -473,4 +478,14 @@ public class ProjectTemplateControllerTests extends BaseTest {
|
|||
projectTemplateService.getTableCustomField(DEFAULT_PROJECT_ID, TemplateScene.FUNCTIONAL.name());
|
||||
projectTemplateService.getTableCustomField("test_project_id_2", TemplateScene.FUNCTIONAL.name());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(10)
|
||||
public void testLog() {
|
||||
Assertions.assertEquals(projectTemplateLogService.getOperationLogModule(TemplateScene.API.name()), OperationLogModule.PROJECT_MANAGEMENT_TEMPLATE_API_TEMPLATE);
|
||||
Assertions.assertEquals(projectTemplateLogService.getOperationLogModule(TemplateScene.FUNCTIONAL.name()), OperationLogModule.PROJECT_MANAGEMENT_TEMPLATE_FUNCTIONAL_TEMPLATE);
|
||||
Assertions.assertEquals(projectTemplateLogService.getOperationLogModule(TemplateScene.BUG.name()), OperationLogModule.PROJECT_MANAGEMENT_TEMPLATE_BUG_TEMPLATE);
|
||||
Assertions.assertEquals(projectTemplateLogService.getOperationLogModule(TemplateScene.TEST_PLAN.name()), OperationLogModule.PROJECT_MANAGEMENT_TEMPLATE_TEST_PLAN_TEMPLATE);
|
||||
Assertions.assertEquals(projectTemplateLogService.getOperationLogModule(TemplateScene.UI.name()), OperationLogModule.PROJECT_MANAGEMENT_TEMPLATE_UI_TEMPLATE);
|
||||
}
|
||||
}
|
|
@ -74,6 +74,12 @@ public class OperationLogModule {
|
|||
public static final String SETTING_ORGANIZATION_TEMPLATE_UI_FIELD = "SETTING_ORGANIZATION_TEMPLATE_UI_FIELD";
|
||||
public static final String SETTING_ORGANIZATION_TEMPLATE_TEST_PLAN_FIELD = "SETTING_ORGANIZATION_TEMPLATE_TEST_PLAN_FIELD";
|
||||
// 模板管理-模板
|
||||
public static final String SETTING_ORGANIZATION_TEMPLATE_FUNCTIONAL = "SETTING_ORGANIZATION_TEMPLATE_FUNCTIONAL";
|
||||
public static final String SETTING_ORGANIZATION_TEMPLATE_API = "SETTING_ORGANIZATION_TEMPLATE_API";
|
||||
public static final String SETTING_ORGANIZATION_TEMPLATE_UI = "SETTING_ORGANIZATION_TEMPLATE_UI";
|
||||
public static final String SETTING_ORGANIZATION_TEMPLATE_TEST_PLAN = "SETTING_ORGANIZATION_TEMPLATE_TEST_PLAN";
|
||||
public static final String SETTING_ORGANIZATION_TEMPLATE_BUG = "SETTING_ORGANIZATION_TEMPLATE_BUG";
|
||||
// 模板管理-模板管理
|
||||
public static final String SETTING_ORGANIZATION_TEMPLATE_FUNCTIONAL_TEMPLATE = "SETTING_ORGANIZATION_TEMPLATE_FUNCTIONAL_TEMPLATE";
|
||||
public static final String SETTING_ORGANIZATION_TEMPLATE_API_TEMPLATE = "SETTING_ORGANIZATION_TEMPLATE_API_TEMPLATE";
|
||||
public static final String SETTING_ORGANIZATION_TEMPLATE_UI_TEMPLATE = "SETTING_ORGANIZATION_TEMPLATE_UI_TEMPLATE";
|
||||
|
|
|
@ -56,22 +56,6 @@ public class OrganizationTemplateLogService {
|
|||
}
|
||||
}
|
||||
|
||||
public LogDTO setDefaultTemplateLog(TemplateUpdateRequest request) {
|
||||
Template template = organizationTemplateService.getWithCheck(request.getId());
|
||||
LogDTO dto = null;
|
||||
if (template != null) {
|
||||
dto = new LogDTO(
|
||||
OperationLogConstants.ORGANIZATION,
|
||||
null,
|
||||
template.getId(),
|
||||
null,
|
||||
OperationLogType.UPDATE.name(),
|
||||
getOperationLogModule(template.getScene()),
|
||||
String.join(Translator.get("set_default_template"), ":", template.getName()));
|
||||
dto.setOriginalValue(JSON.toJSONBytes(template));
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
public LogDTO disableOrganizationTemplateLog(String organizationId, String scene) {
|
||||
return new LogDTO(
|
||||
|
@ -80,10 +64,33 @@ public class OrganizationTemplateLogService {
|
|||
scene,
|
||||
null,
|
||||
OperationLogType.UPDATE.name(),
|
||||
getOperationLogModule(scene),
|
||||
getDisableOrganizationTemplateModule(scene),
|
||||
Translator.get("project_template_enable"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取启用项目模板的操作对象
|
||||
* @param scene
|
||||
* @return
|
||||
*/
|
||||
public String getDisableOrganizationTemplateModule(String scene) {
|
||||
TemplateScene templateScene = EnumValidator.validateEnum(TemplateScene.class, scene);
|
||||
switch (templateScene) {
|
||||
case API:
|
||||
return OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_API;
|
||||
case FUNCTIONAL:
|
||||
return OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_FUNCTIONAL;
|
||||
case UI:
|
||||
return OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_UI;
|
||||
case BUG:
|
||||
return OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_BUG;
|
||||
case TEST_PLAN:
|
||||
return OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_TEST_PLAN;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public LogDTO updateLog(TemplateUpdateRequest request) {
|
||||
Template template = organizationTemplateService.getWithCheck(request.getId());
|
||||
LogDTO dto = null;
|
||||
|
|
|
@ -11,14 +11,12 @@ import io.metersphere.system.dto.sdk.request.CustomFieldUpdateRequest;
|
|||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.system.base.BaseTest;
|
||||
import io.metersphere.system.controller.param.CustomFieldUpdateRequestDefinition;
|
||||
import io.metersphere.system.log.constants.OperationLogModule;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.system.mapper.CustomFieldMapper;
|
||||
import io.metersphere.system.mapper.OrganizationParameterMapper;
|
||||
import io.metersphere.system.mapper.TemplateCustomFieldMapper;
|
||||
import io.metersphere.system.service.BaseCustomFieldOptionService;
|
||||
import io.metersphere.system.service.BaseCustomFieldService;
|
||||
import io.metersphere.system.service.OrganizationCustomFieldService;
|
||||
import io.metersphere.system.service.UserLoginService;
|
||||
import io.metersphere.system.service.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
|
@ -57,6 +55,8 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
|
|||
@Resource
|
||||
private OrganizationParameterMapper organizationParameterMapper;
|
||||
@Resource
|
||||
private OrganizationCustomFieldLogService organizationCustomFieldLogService;
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
@Resource
|
||||
private OrganizationCustomFieldService organizationCustomFieldService;
|
||||
|
@ -349,4 +349,14 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(10)
|
||||
public void testLog() {
|
||||
Assertions.assertEquals(organizationCustomFieldLogService.getOperationLogModule(TemplateScene.API.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_API_FIELD);
|
||||
Assertions.assertEquals(organizationCustomFieldLogService.getOperationLogModule(TemplateScene.FUNCTIONAL.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_FUNCTIONAL_FIELD);
|
||||
Assertions.assertEquals(organizationCustomFieldLogService.getOperationLogModule(TemplateScene.BUG.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_BUG_FIELD);
|
||||
Assertions.assertEquals(organizationCustomFieldLogService.getOperationLogModule(TemplateScene.TEST_PLAN.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_TEST_PLAN_FIELD);
|
||||
Assertions.assertEquals(organizationCustomFieldLogService.getOperationLogModule(TemplateScene.UI.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_UI_FIELD);
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import io.metersphere.system.base.BaseCustomFieldTestService;
|
|||
import io.metersphere.system.base.BaseTest;
|
||||
import io.metersphere.system.controller.param.TemplateUpdateRequestDefinition;
|
||||
import io.metersphere.system.domain.*;
|
||||
import io.metersphere.system.log.constants.OperationLogModule;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.system.mapper.OrganizationParameterMapper;
|
||||
import io.metersphere.system.mapper.TemplateMapper;
|
||||
|
@ -67,6 +68,8 @@ public class OrganizationTemplateControllerTests extends BaseTest {
|
|||
private OrganizationTemplateService organizationTemplateService;
|
||||
@Resource
|
||||
private BaseCustomFieldTestService baseCustomFieldTestService;
|
||||
@Resource
|
||||
private OrganizationTemplateLogService organizationTemplateLogService;
|
||||
|
||||
private static Template addTemplate;
|
||||
private static Template anotherTemplateField;
|
||||
|
@ -468,4 +471,20 @@ public class OrganizationTemplateControllerTests extends BaseTest {
|
|||
baseCustomFieldTestService.testResolverErrorValidate();
|
||||
baseCustomFieldTestService.testResolverParse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(10)
|
||||
public void testLog() {
|
||||
Assertions.assertEquals(organizationTemplateLogService.getOperationLogModule(TemplateScene.API.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_API_TEMPLATE);
|
||||
Assertions.assertEquals(organizationTemplateLogService.getOperationLogModule(TemplateScene.FUNCTIONAL.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_FUNCTIONAL_TEMPLATE);
|
||||
Assertions.assertEquals(organizationTemplateLogService.getOperationLogModule(TemplateScene.BUG.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_BUG_TEMPLATE);
|
||||
Assertions.assertEquals(organizationTemplateLogService.getOperationLogModule(TemplateScene.TEST_PLAN.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_TEST_PLAN_TEMPLATE);
|
||||
Assertions.assertEquals(organizationTemplateLogService.getOperationLogModule(TemplateScene.UI.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_UI_TEMPLATE);
|
||||
|
||||
Assertions.assertEquals(organizationTemplateLogService.getDisableOrganizationTemplateModule(TemplateScene.API.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_API);
|
||||
Assertions.assertEquals(organizationTemplateLogService.getDisableOrganizationTemplateModule(TemplateScene.FUNCTIONAL.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_FUNCTIONAL);
|
||||
Assertions.assertEquals(organizationTemplateLogService.getDisableOrganizationTemplateModule(TemplateScene.BUG.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_BUG);
|
||||
Assertions.assertEquals(organizationTemplateLogService.getDisableOrganizationTemplateModule(TemplateScene.TEST_PLAN.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_TEST_PLAN);
|
||||
Assertions.assertEquals(organizationTemplateLogService.getDisableOrganizationTemplateModule(TemplateScene.UI.name()), OperationLogModule.SETTING_ORGANIZATION_TEMPLATE_UI);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue