diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugLogService.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugLogService.java index f2eb78a93c..cf99ad6cda 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugLogService.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugLogService.java @@ -15,6 +15,7 @@ import io.metersphere.sdk.util.JSON; import io.metersphere.system.log.constants.OperationLogModule; import io.metersphere.system.log.constants.OperationLogType; import io.metersphere.system.log.dto.LogDTO; +import io.metersphere.system.log.service.OperationLogService; import jakarta.annotation.Resource; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -35,6 +36,8 @@ public class BugLogService { private BugService bugService; @Resource private BugContentMapper bugContentMapper; + @Resource + private OperationLogService operationLogService; /** @@ -168,4 +171,15 @@ public class BugLogService { BugCustomFieldDTO titleField = find.orElseGet(BugCustomFieldDTO::new); return StringUtils.isNotBlank(request.getTitle()) ? request.getTitle() : titleField.getValue(); } + + + @SuppressWarnings("unused") + public void minderAddLog(BugEditRequest request, List files, String orgId, String bugId, String userId) { + LogDTO dto = new LogDTO(request.getProjectId(), orgId, bugId, userId, OperationLogType.ADD.name(), OperationLogModule.BUG_MANAGEMENT_INDEX, getPlatformTitle(request)); + dto.setHistory(true); + dto.setPath("/test-plan/functional/case/minder/batch/add-bug"); + dto.setMethod(HttpMethodConstants.POST.name()); + dto.setModifiedValue(JSON.toJSONBytes(request)); + operationLogService.add(dto); + } } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanFunctionalCaseMinderController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanFunctionalCaseMinderController.java index 427534bd71..c86ab1cedd 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanFunctionalCaseMinderController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanFunctionalCaseMinderController.java @@ -2,6 +2,7 @@ package io.metersphere.plan.controller; import io.metersphere.bug.domain.Bug; import io.metersphere.bug.dto.request.BugEditRequest; +import io.metersphere.bug.service.BugLogService; import io.metersphere.bug.service.BugService; import io.metersphere.plan.dto.request.TestPlanCaseBatchAddBugRequest; import io.metersphere.plan.dto.request.TestPlanCaseBatchAssociateBugRequest; @@ -29,6 +30,8 @@ public class TestPlanFunctionalCaseMinderController { private BugService bugService; @Resource private TestPlanFunctionalCaseMinderService testPlanFunctionalCaseMinderService; + @Resource + private BugLogService bugLogService; @PostMapping("/batch/add-bug") @Operation(summary = "测试计划-功能用例-脑图-批量添加缺陷") @@ -39,6 +42,7 @@ public class TestPlanFunctionalCaseMinderController { BugEditRequest bugEditRequest = new BugEditRequest(); BeanUtils.copyBean(bugEditRequest, request); Bug bug = bugService.addOrUpdate(bugEditRequest, files, SessionUtils.getUserId(), SessionUtils.getCurrentOrganizationId(), false); + bugLogService.minderAddLog(bugEditRequest, files, SessionUtils.getCurrentOrganizationId(), bug.getId(), SessionUtils.getUserId()); testPlanFunctionalCaseMinderService.minderBatchAssociateBug(request, bug.getId(), SessionUtils.getUserId()); }