From 54b6c1d53a065ad6a5fe73e95b376fc5e9f8db0d Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Thu, 22 Aug 2024 11:45:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=BC=BA=E9=99=B7=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A8=A1=E6=9D=BF=E7=BC=BA=E9=99=B7=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E9=BB=98=E8=AE=A4=E5=80=BC=E5=B8=A6=E6=9C=89=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=BF=9D=E5=AD=98=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/bug/service/BugService.java | 13 +++++++++++++ .../service/DeleteCaseReviewService.java | 14 +++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java index 2345a926f7..ebb7e5477c 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java @@ -1364,9 +1364,22 @@ public class BugService { * @param currentUser 当前用户 */ private void handleRichTextTmpFile(BugEditRequest request, String bugId, String currentUser) { + filterRichTextTmpFile(request); bugAttachmentService.transferTmpFile(bugId, request.getProjectId(), request.getRichTextTmpFileIds(), currentUser, BugAttachmentSourceType.RICH_TEXT.name()); } + /** + * 过滤富文本临时文件 + * + * @param request 请求参数 + */ + private void filterRichTextTmpFile(BugEditRequest request) { + // 项目模板带过来的图片文件不处理 + if (CollectionUtils.isNotEmpty(request.getRichTextTmpFileIds())) { + request.getRichTextTmpFileIds().removeIf(tmpFileId -> request.getDescription().contains("/project/template/img/preview/" + request.getProjectId() + "/" + tmpFileId)); + } + } + /** * 处理并保存缺陷用例关联关系 * diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/DeleteCaseReviewService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/DeleteCaseReviewService.java index 30e9425a40..88d5233af5 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/DeleteCaseReviewService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/DeleteCaseReviewService.java @@ -34,30 +34,30 @@ public class DeleteCaseReviewService { private CaseReviewCaseProvider caseReviewCaseProvider; public void deleteCaseReviewResource(List ids, String projectId) { - //TODO 删除各种关联关系? 1.关联用例(功能/接口/场景/ui/性能)? 2.评审和评审人 3. 归档的用例 4. 关注人 5.评审历史 6. 操作记录 - //1.刪除评审与功能用例关联关系 + // TODO 删除各种关联关系? 1.关联用例(功能/接口/场景/ui/性能)? 2.评审和评审人 3. 归档的用例 4. 关注人 5.评审历史 6. 操作记录 + // 1.刪除评审与功能用例关联关系 CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample(); caseReviewFunctionalCaseExample.createCriteria().andReviewIdIn(ids); List reviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample); caseReviewFunctionalCaseMapper.deleteByExample(caseReviewFunctionalCaseExample); - //2. 删除评审和评审人 + // 2. 删除评审和评审人 CaseReviewUserExample caseReviewUserExample = new CaseReviewUserExample(); caseReviewUserExample.createCriteria().andReviewIdIn(ids); caseReviewUserMapper.deleteByExample(caseReviewUserExample); - //3. 删除归档的用例 + // 3. 删除归档的用例 CaseReviewFunctionalCaseArchiveExample archiveExample = new CaseReviewFunctionalCaseArchiveExample(); archiveExample.createCriteria().andReviewIdIn(ids); caseReviewFunctionalCaseArchiveMapper.deleteByExample(archiveExample); - //5.删除评审历史 + // 5.删除评审历史 CaseReviewHistoryExample caseReviewHistoryExample = new CaseReviewHistoryExample(); caseReviewHistoryExample.createCriteria().andReviewIdIn(ids); caseReviewHistoryMapper.deleteByExample(caseReviewHistoryExample); - //4.删除关注人 + // 4.删除关注人 CaseReviewFollowerExample caseReviewFollowerExample = new CaseReviewFollowerExample(); caseReviewFollowerExample.createCriteria().andReviewIdIn(ids); caseReviewFollowerMapper.deleteByExample(caseReviewFollowerExample); - //TODO: 6.删除操作记录 + // TODO: 6.删除操作记录 //删除评审 CaseReviewExample caseReviewExample = new CaseReviewExample(); caseReviewExample.createCriteria().andIdIn(ids).andProjectIdEqualTo(projectId);