refactor(项目管理): 消息通知优化

This commit is contained in:
guoyuqi 2024-06-21 19:32:43 +08:00 committed by Craftsman
parent 4e46afa5e9
commit 446f42062f
4 changed files with 10 additions and 14 deletions

View File

@ -1114,7 +1114,6 @@ public class FunctionalCaseMinderService {
caseIds= caseOptionDTOS.stream().map(MinderOptionDTO::getId).toList(); caseIds= caseOptionDTOS.stream().map(MinderOptionDTO::getId).toList();
functionalCaseService.handDeleteFunctionalCase(caseIds, false, userId, request.getProjectId()); functionalCaseService.handDeleteFunctionalCase(caseIds, false, userId, request.getProjectId());
functionalCaseLogService.batchDeleteFunctionalCaseLogByIds(caseIds, "/functional/mind/case/edit"); functionalCaseLogService.batchDeleteFunctionalCaseLogByIds(caseIds, "/functional/mind/case/edit");
functionalCaseNoticeService.batchSendNotice(request.getProjectId(), caseIds, user, NoticeConstants.Event.DELETE);
} }
List<MinderOptionDTO> caseModuleOptionDTOS = resourceMap.get(Translator.get("minder_extra_node.module")); List<MinderOptionDTO> caseModuleOptionDTOS = resourceMap.get(Translator.get("minder_extra_node.module"));
@ -1123,7 +1122,10 @@ public class FunctionalCaseMinderService {
List<FunctionalCase> functionalCases = functionalCaseModuleService.deleteModuleByIds(moduleIds, new ArrayList<>(), userId); List<FunctionalCase> functionalCases = functionalCaseModuleService.deleteModuleByIds(moduleIds, new ArrayList<>(), userId);
functionalCaseModuleService.batchDelLog(functionalCases, request.getProjectId()); functionalCaseModuleService.batchDelLog(functionalCases, request.getProjectId());
List<String> finalCaseIds = caseIds; List<String> finalCaseIds = caseIds;
functionalCaseNoticeService.batchSendNotice(request.getProjectId(), functionalCases.stream().map(FunctionalCase::getId).filter(id ->!finalCaseIds.contains(id)).toList(), user, NoticeConstants.Event.DELETE); List<String> 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<MinderOptionDTO> additionalOptionDTOS = resourceMap.get(ModuleConstants.ROOT_NODE_PARENT_ID); List<MinderOptionDTO> additionalOptionDTOS = resourceMap.get(ModuleConstants.ROOT_NODE_PARENT_ID);
if (CollectionUtils.isNotEmpty(additionalOptionDTOS)) { if (CollectionUtils.isNotEmpty(additionalOptionDTOS)) {

View File

@ -8,11 +8,11 @@ import com.aliyun.tea.TeaException;
import com.aliyun.teaopenapi.models.Config; import com.aliyun.teaopenapi.models.Config;
import com.aliyun.teautil.Common; import com.aliyun.teautil.Common;
import com.aliyun.teautil.models.RuntimeOptions; import com.aliyun.teautil.models.RuntimeOptions;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.system.notice.MessageDetail; import io.metersphere.system.notice.MessageDetail;
import io.metersphere.system.notice.NoticeModel; import io.metersphere.system.notice.NoticeModel;
import io.metersphere.system.notice.Receiver; import io.metersphere.system.notice.Receiver;
import io.metersphere.system.notice.sender.AbstractNoticeSender; import io.metersphere.system.notice.sender.AbstractNoticeSender;
import io.metersphere.sdk.util.LogUtils;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -94,11 +94,11 @@ public class DingEnterPriseNoticeSender extends AbstractNoticeSender {
@Override @Override
public void send(MessageDetail messageDetail, NoticeModel noticeModel) { public void send(MessageDetail messageDetail, NoticeModel noticeModel) {
String context = super.getContext(messageDetail, noticeModel);
List<Receiver> receivers = super.getReceivers(noticeModel.getReceivers(), noticeModel.isExcludeSelf(), noticeModel.getOperator()); List<Receiver> receivers = super.getReceivers(noticeModel.getReceivers(), noticeModel.isExcludeSelf(), noticeModel.getOperator());
if (CollectionUtils.isEmpty(receivers)) { if (CollectionUtils.isEmpty(receivers)) {
return; return;
} }
String context = super.getContext(messageDetail, noticeModel);
try { try {
sendDing(messageDetail, context); sendDing(messageDetail, context);
LogUtils.debug("发送钉钉内部机器人结束"); LogUtils.debug("发送钉钉内部机器人结束");

View File

@ -374,7 +374,7 @@ public class TestPlanCollectionMinderService {
testPlanCollection.setId(testPlanCollectionMinderEditDTO.getId()); testPlanCollection.setId(testPlanCollectionMinderEditDTO.getId());
testPlanCollection.setCreateUser(userId); testPlanCollection.setCreateUser(userId);
testPlanCollection.setCreateTime(null); testPlanCollection.setCreateTime(null);
testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum()); testPlanCollection.setPos((testPlanCollectionMinderEditDTO.getNum()+1) * 4096);
collectionMapper.updateByPrimaryKeySelective(testPlanCollection); collectionMapper.updateByPrimaryKeySelective(testPlanCollection);
return testPlanCollection; return testPlanCollection;
} }
@ -398,7 +398,7 @@ public class TestPlanCollectionMinderService {
testPlanCollection.setTestPlanId(request.getPlanId()); testPlanCollection.setTestPlanId(request.getPlanId());
testPlanCollection.setCreateUser(userId); testPlanCollection.setCreateUser(userId);
testPlanCollection.setCreateTime(System.currentTimeMillis()); testPlanCollection.setCreateTime(System.currentTimeMillis());
testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum()); testPlanCollection.setPos((testPlanCollectionMinderEditDTO.getNum()+1) * 4096);
collectionMapper.insert(testPlanCollection); collectionMapper.insert(testPlanCollection);
return testPlanCollection; return testPlanCollection;
} }

View File

@ -79,10 +79,7 @@ export function getWeComInfo() {
} }
export function getWeComCallback(code: string) { export function getWeComCallback(code: string) {
return MSR.get<LoginRes>( return MSR.get<LoginRes>({ url: GetWeComCallbackUrl, params: { code } });
{ url: GetWeComCallbackUrl, params: { code } },
{ ignoreCancelToken: true, errorMessageMode: 'modal' }
);
} }
export function getDingInfo() { export function getDingInfo() {
@ -90,10 +87,7 @@ export function getDingInfo() {
} }
export function getDingCallback(code: string) { export function getDingCallback(code: string) {
return MSR.get<LoginRes>( return MSR.get<LoginRes>({ url: GetDingCallbackUrl, params: { code } });
{ url: GetDingCallbackUrl, params: { code } },
{ ignoreCancelToken: true, errorMessageMode: 'modal' }
);
} }
export function logout() { export function logout() {
return MSR.get<LoginRes>({ url: LogoutUrl }); return MSR.get<LoginRes>({ url: LogoutUrl });