refactor(测试用例): 优化模块操作日志
This commit is contained in:
parent
173b6c9bfe
commit
290a8d6429
|
@ -6,6 +6,7 @@ import io.metersphere.project.domain.Project;
|
||||||
import io.metersphere.project.mapper.ProjectMapper;
|
import io.metersphere.project.mapper.ProjectMapper;
|
||||||
import io.metersphere.sdk.constants.HttpMethodConstants;
|
import io.metersphere.sdk.constants.HttpMethodConstants;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.dto.builder.LogDTOBuilder;
|
import io.metersphere.system.dto.builder.LogDTOBuilder;
|
||||||
import io.metersphere.system.log.constants.OperationLogModule;
|
import io.metersphere.system.log.constants.OperationLogModule;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
|
@ -79,15 +80,15 @@ public class CaseReviewModuleLogService {
|
||||||
/**
|
/**
|
||||||
* 评审删除模块日志
|
* 评审删除模块日志
|
||||||
*
|
*
|
||||||
* @param caseReviews
|
* @param deleteModule
|
||||||
* @param projectId
|
* @param projectId
|
||||||
* @param userId
|
* @param userId
|
||||||
* @param path
|
* @param path
|
||||||
*/
|
*/
|
||||||
public void batchDelLog(List<CaseReview> caseReviews, String projectId, String userId, String path) {
|
public void batchDelLog(List<CaseReviewModule> deleteModule, String projectId, String userId, String path) {
|
||||||
Project project = projectMapper.selectByPrimaryKey(projectId);
|
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||||
List<LogDTO> dtoList = new ArrayList<>();
|
List<LogDTO> dtoList = new ArrayList<>();
|
||||||
caseReviews.forEach(item -> {
|
deleteModule.forEach(item -> {
|
||||||
LogDTO dto = new LogDTO(
|
LogDTO dto = new LogDTO(
|
||||||
projectId,
|
projectId,
|
||||||
project.getOrganizationId(),
|
project.getOrganizationId(),
|
||||||
|
@ -95,7 +96,7 @@ public class CaseReviewModuleLogService {
|
||||||
userId,
|
userId,
|
||||||
OperationLogType.DELETE.name(),
|
OperationLogType.DELETE.name(),
|
||||||
OperationLogModule.CASE_MANAGEMENT_REVIEW_REVIEW_MODULE,
|
OperationLogModule.CASE_MANAGEMENT_REVIEW_REVIEW_MODULE,
|
||||||
item.getName());
|
item.getName() + " " + Translator.get("log.delete_module"));
|
||||||
dto.setPath(path);
|
dto.setPath(path);
|
||||||
dto.setMethod(HttpMethodConstants.GET.name());
|
dto.setMethod(HttpMethodConstants.GET.name());
|
||||||
dto.setOriginalValue(JSON.toJSONBytes(item));
|
dto.setOriginalValue(JSON.toJSONBytes(item));
|
||||||
|
|
|
@ -119,8 +119,8 @@ public class CaseReviewModuleService extends ModuleTreeService {
|
||||||
public void deleteModule(String moduleId, String userId) {
|
public void deleteModule(String moduleId, String userId) {
|
||||||
CaseReviewModule deleteModule = caseReviewModuleMapper.selectByPrimaryKey(moduleId);
|
CaseReviewModule deleteModule = caseReviewModuleMapper.selectByPrimaryKey(moduleId);
|
||||||
if (deleteModule != null) {
|
if (deleteModule != null) {
|
||||||
List<CaseReview> caseReviews = this.deleteModuleByIds(Collections.singletonList(moduleId), new ArrayList<>(), deleteModule.getProjectId());
|
this.deleteModuleByIds(Collections.singletonList(moduleId), new ArrayList<>(), deleteModule.getProjectId());
|
||||||
caseReviewModuleLogService.batchDelLog(caseReviews, deleteModule.getProjectId(), userId, "/case/review/module/delete/" + moduleId);
|
caseReviewModuleLogService.batchDelLog(List.of(deleteModule), deleteModule.getProjectId(), userId, "/case/review/module/delete/" + moduleId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.project.domain.Project;
|
||||||
import io.metersphere.project.mapper.ProjectMapper;
|
import io.metersphere.project.mapper.ProjectMapper;
|
||||||
import io.metersphere.sdk.constants.HttpMethodConstants;
|
import io.metersphere.sdk.constants.HttpMethodConstants;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.dto.builder.LogDTOBuilder;
|
import io.metersphere.system.dto.builder.LogDTOBuilder;
|
||||||
import io.metersphere.system.log.constants.OperationLogModule;
|
import io.metersphere.system.log.constants.OperationLogModule;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
|
@ -106,6 +107,7 @@ public class FunctionalCaseModuleLogService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能用例模块删除日志
|
* 功能用例模块删除日志
|
||||||
|
*
|
||||||
* @param deleteModule
|
* @param deleteModule
|
||||||
* @param projectId
|
* @param projectId
|
||||||
* @param userId
|
* @param userId
|
||||||
|
@ -122,7 +124,7 @@ public class FunctionalCaseModuleLogService {
|
||||||
userId,
|
userId,
|
||||||
type,
|
type,
|
||||||
OperationLogModule.CASE_MANAGEMENT_CASE_MODULE,
|
OperationLogModule.CASE_MANAGEMENT_CASE_MODULE,
|
||||||
item.getName());
|
item.getName() + " " + Translator.get("log.delete_module"));
|
||||||
dto.setPath(path);
|
dto.setPath(path);
|
||||||
dto.setMethod(HttpMethodConstants.GET.name());
|
dto.setMethod(HttpMethodConstants.GET.name());
|
||||||
dto.setOriginalValue(JSON.toJSONBytes(item));
|
dto.setOriginalValue(JSON.toJSONBytes(item));
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class TestPlanModuleLogService {
|
||||||
.method(requestMethod)
|
.method(requestMethod)
|
||||||
.path(requestUrl)
|
.path(requestUrl)
|
||||||
.sourceId(deleteModule.getId())
|
.sourceId(deleteModule.getId())
|
||||||
.content(deleteModule.getName())
|
.content(deleteModule.getName() + " " + Translator.get("log.delete_module"))
|
||||||
.originalValue(JSON.toJSONBytes(deleteModule))
|
.originalValue(JSON.toJSONBytes(deleteModule))
|
||||||
.createUser(operator)
|
.createUser(operator)
|
||||||
.build().getLogDTO();
|
.build().getLogDTO();
|
||||||
|
|
Loading…
Reference in New Issue