From 446f42062fe7b575f5435b7e635c7fcbb2c363ed Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 21 Jun 2024 19:32:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=20=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/FunctionalCaseMinderService.java | 6 ++++-- .../notice/sender/impl/DingEnterPriseNoticeSender.java | 4 ++-- .../plan/service/TestPlanCollectionMinderService.java | 4 ++-- frontend/src/api/modules/user/index.ts | 10 ++-------- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java index 5484c815ed..4c2ba8a508 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java @@ -1114,7 +1114,6 @@ public class FunctionalCaseMinderService { caseIds= caseOptionDTOS.stream().map(MinderOptionDTO::getId).toList(); functionalCaseService.handDeleteFunctionalCase(caseIds, false, userId, request.getProjectId()); functionalCaseLogService.batchDeleteFunctionalCaseLogByIds(caseIds, "/functional/mind/case/edit"); - functionalCaseNoticeService.batchSendNotice(request.getProjectId(), caseIds, user, NoticeConstants.Event.DELETE); } List caseModuleOptionDTOS = resourceMap.get(Translator.get("minder_extra_node.module")); @@ -1123,7 +1122,10 @@ public class FunctionalCaseMinderService { List functionalCases = functionalCaseModuleService.deleteModuleByIds(moduleIds, new ArrayList<>(), userId); functionalCaseModuleService.batchDelLog(functionalCases, request.getProjectId()); List finalCaseIds = caseIds; - functionalCaseNoticeService.batchSendNotice(request.getProjectId(), functionalCases.stream().map(FunctionalCase::getId).filter(id ->!finalCaseIds.contains(id)).toList(), user, NoticeConstants.Event.DELETE); + List caseIdList = functionalCases.stream().map(FunctionalCase::getId).filter(id -> !finalCaseIds.contains(id)).toList(); + if (CollectionUtils.isNotEmpty(caseIdList)) { + functionalCaseNoticeService.batchSendNotice(request.getProjectId(), caseIdList, user, NoticeConstants.Event.DELETE); + } } List additionalOptionDTOS = resourceMap.get(ModuleConstants.ROOT_NODE_PARENT_ID); if (CollectionUtils.isNotEmpty(additionalOptionDTOS)) { diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingEnterPriseNoticeSender.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingEnterPriseNoticeSender.java index 192fd3c642..a53e9cfd87 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingEnterPriseNoticeSender.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingEnterPriseNoticeSender.java @@ -8,11 +8,11 @@ import com.aliyun.tea.TeaException; import com.aliyun.teaopenapi.models.Config; import com.aliyun.teautil.Common; import com.aliyun.teautil.models.RuntimeOptions; +import io.metersphere.sdk.util.LogUtils; import io.metersphere.system.notice.MessageDetail; import io.metersphere.system.notice.NoticeModel; import io.metersphere.system.notice.Receiver; import io.metersphere.system.notice.sender.AbstractNoticeSender; -import io.metersphere.sdk.util.LogUtils; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Component; @@ -94,11 +94,11 @@ public class DingEnterPriseNoticeSender extends AbstractNoticeSender { @Override public void send(MessageDetail messageDetail, NoticeModel noticeModel) { + String context = super.getContext(messageDetail, noticeModel); List receivers = super.getReceivers(noticeModel.getReceivers(), noticeModel.isExcludeSelf(), noticeModel.getOperator()); if (CollectionUtils.isEmpty(receivers)) { return; } - String context = super.getContext(messageDetail, noticeModel); try { sendDing(messageDetail, context); LogUtils.debug("发送钉钉内部机器人结束"); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanCollectionMinderService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanCollectionMinderService.java index 6e924f4913..4903b1bc05 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanCollectionMinderService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanCollectionMinderService.java @@ -374,7 +374,7 @@ public class TestPlanCollectionMinderService { testPlanCollection.setId(testPlanCollectionMinderEditDTO.getId()); testPlanCollection.setCreateUser(userId); testPlanCollection.setCreateTime(null); - testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum()); + testPlanCollection.setPos((testPlanCollectionMinderEditDTO.getNum()+1) * 4096); collectionMapper.updateByPrimaryKeySelective(testPlanCollection); return testPlanCollection; } @@ -398,7 +398,7 @@ public class TestPlanCollectionMinderService { testPlanCollection.setTestPlanId(request.getPlanId()); testPlanCollection.setCreateUser(userId); testPlanCollection.setCreateTime(System.currentTimeMillis()); - testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum()); + testPlanCollection.setPos((testPlanCollectionMinderEditDTO.getNum()+1) * 4096); collectionMapper.insert(testPlanCollection); return testPlanCollection; } diff --git a/frontend/src/api/modules/user/index.ts b/frontend/src/api/modules/user/index.ts index 7a10aa02c5..6819165b24 100644 --- a/frontend/src/api/modules/user/index.ts +++ b/frontend/src/api/modules/user/index.ts @@ -79,10 +79,7 @@ export function getWeComInfo() { } export function getWeComCallback(code: string) { - return MSR.get( - { url: GetWeComCallbackUrl, params: { code } }, - { ignoreCancelToken: true, errorMessageMode: 'modal' } - ); + return MSR.get({ url: GetWeComCallbackUrl, params: { code } }); } export function getDingInfo() { @@ -90,10 +87,7 @@ export function getDingInfo() { } export function getDingCallback(code: string) { - return MSR.get( - { url: GetDingCallbackUrl, params: { code } }, - { ignoreCancelToken: true, errorMessageMode: 'modal' } - ); + return MSR.get({ url: GetDingCallbackUrl, params: { code } }); } export function logout() { return MSR.get({ url: LogoutUrl });