fix(测试计划): 修复测试计划删除关注人收不到消息通知问题
--bug=1040946 --user=王旭 【项目管理】消息设置-测试计划-删除测试计划和更新测试计划,通知接受人为创建人或关注人收不到通知 https://www.tapd.cn/55049933/s/1532107
This commit is contained in:
parent
ff91f4b77d
commit
bfdff00cce
|
@ -155,8 +155,15 @@ public abstract class AbstractNoticeSender implements NoticeSender {
|
|||
}
|
||||
case NoticeConstants.RelatedUser.FOLLOW_PEOPLE -> {
|
||||
try {
|
||||
List<String> followUser = (List) paramMap.get("followUsers");
|
||||
if (CollectionUtils.isNotEmpty(followUser)) {
|
||||
followUser.forEach(item ->{
|
||||
toUsers.add(new Receiver(item, NotificationConstants.Type.SYSTEM_NOTICE.name()));
|
||||
});
|
||||
} else {
|
||||
List<Receiver> follows = handleFollows(messageDetail, noticeModel);
|
||||
toUsers.addAll(follows);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtils.error("查询关注人失败:{}", e);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author wx
|
||||
|
@ -55,4 +57,6 @@ public class TestPlanDTO {
|
|||
@Schema(description = "message.domain.test_plan_description")
|
||||
private String description;
|
||||
|
||||
private List<String> followUsers;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,13 +2,12 @@ package io.metersphere.plan.service;
|
|||
|
||||
import io.metersphere.functional.domain.FunctionalCase;
|
||||
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
||||
import io.metersphere.plan.domain.TestPlan;
|
||||
import io.metersphere.plan.domain.TestPlanConfig;
|
||||
import io.metersphere.plan.domain.TestPlanExample;
|
||||
import io.metersphere.plan.domain.*;
|
||||
import io.metersphere.plan.dto.TestPlanDTO;
|
||||
import io.metersphere.plan.dto.request.TestPlanCreateRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanUpdateRequest;
|
||||
import io.metersphere.plan.mapper.TestPlanConfigMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanFollowerMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||
import io.metersphere.sdk.constants.ReportStatus;
|
||||
import io.metersphere.sdk.constants.TestPlanConstants;
|
||||
|
@ -49,6 +48,8 @@ public class TestPlanSendNoticeService {
|
|||
private CommonNoticeSendService commonNoticeSendService;
|
||||
@Resource
|
||||
private TestPlanConfigMapper testPlanConfigMapper;
|
||||
@Resource
|
||||
private TestPlanFollowerMapper testPlanFollowerMapper;
|
||||
|
||||
public void sendNoticeCase(List<String> relatedUsers, String userId, String caseId, String task, String event, String testPlanId) {
|
||||
FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey(caseId);
|
||||
|
@ -155,10 +156,15 @@ public class TestPlanSendNoticeService {
|
|||
public TestPlanDTO sendDeleteNotice(String id) {
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(id);
|
||||
TestPlanConfig testPlanConfig = testPlanConfigMapper.selectByPrimaryKey(id);
|
||||
TestPlanFollowerExample example = new TestPlanFollowerExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(id);
|
||||
List<TestPlanFollower> testPlanFollowers = testPlanFollowerMapper.selectByExample(example);
|
||||
List<String> followUsers = testPlanFollowers.stream().map(TestPlanFollower::getUserId).toList();
|
||||
TestPlanDTO dto = new TestPlanDTO();
|
||||
if (testPlan != null) {
|
||||
BeanUtils.copyBean(dto, testPlan);
|
||||
BeanUtils.copyBean(dto, testPlanConfig);
|
||||
dto.setFollowUsers(followUsers);
|
||||
return dto;
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue