fix(接口测试): 修复场景记录日志为空的缺陷

--bug=1038392 --user=王孝刚 【接口测试】场景-场景处操作产生的日志(系统/组织/项目)-操作对象都是空的
https://www.tapd.cn/55049933/s/1489367
This commit is contained in:
wxg0103 2024-04-07 17:16:46 +08:00 committed by 刘瑞斌
parent a7b11a91a2
commit c7bc5ed7f5
3 changed files with 17 additions and 3 deletions

View File

@ -120,7 +120,7 @@ public class ApiScenarioController {
@GetMapping("/delete-to-gc/{id}")
@Operation(summary = "接口测试-接口场景管理-删除场景到回收站")
@RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_DELETE)
@Log(type = OperationLogType.DELETE, expression = "#msClass.deleteLog(#id)", msClass = ApiScenarioLogService.class)
@Log(type = OperationLogType.DELETE, expression = "#msClass.moveToGcLog(#id)", msClass = ApiScenarioLogService.class)
@CheckOwner(resourceId = "#id", resourceType = "api_scenario")
@SendNotice(taskType = NoticeConstants.TaskType.API_SCENARIO_TASK, event = NoticeConstants.Event.DELETE, target = "#targetClass.getScenarioDTO(#id)", targetClass = ApiScenarioNoticeService.class)
public void deleteToGc(@PathVariable String id) {

View File

@ -165,6 +165,20 @@ public class ApiScenarioLogService {
}
public LogDTO deleteLog(String id) {
ApiScenario apiScenario = apiScenarioMapper.selectByPrimaryKey(id);
LogDTO dto = new LogDTO(
null,
null,
apiScenario.getId(),
null,
OperationLogType.DELETE.name(),
OperationLogModule.API_SCENARIO_MANAGEMENT_SCENARIO,
apiScenario.getName());
dto.setOriginalValue(JSON.toJSONBytes(apiScenario));
return dto;
}
public LogDTO moveToGcLog(String id) {
ApiScenario apiScenario = apiScenarioMapper.selectByPrimaryKey(id);
LogDTO dto = new LogDTO(
null,

View File

@ -24,8 +24,8 @@ public class OperationLogModule {
public static final String API_TEST_MANAGEMENT_MOCK = "API_TEST_MANAGEMENT_MOCK";
public static final String API_TEST_MANAGEMENT_CASE = "API_TEST_MANAGEMENT_CASE";
// 场景管理
public static final String API_SCENARIO_MANAGEMENT_SCENARIO = "API_SCENARIO_MANAGEMENT_SCENARIO";
public static final String API_SCENARIO_MANAGEMENT_MODULE = "API_SCENARIO_MANAGEMENT_MODULE";
public static final String API_SCENARIO_MANAGEMENT_SCENARIO = "API_TEST_SCENARIO_MANAGEMENT_SCENARIO";
public static final String API_SCENARIO_MANAGEMENT_MODULE = "API_TEST_SCENARIO_MANAGEMENT_MODULE";
public static final String API_TEST_SCENARIO_RECYCLE = "API_TEST_SCENARIO_RECYCLE";
public static final String API_TEST_MANAGEMENT_RECYCLE = "API_TEST_MANAGEMENT_RECYCLE";