diff --git a/backend/src/main/java/io/metersphere/commons/constants/NoticeConstants.java b/backend/src/main/java/io/metersphere/commons/constants/NoticeConstants.java index 427d75630a..f2d33539d7 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/NoticeConstants.java +++ b/backend/src/main/java/io/metersphere/commons/constants/NoticeConstants.java @@ -9,5 +9,9 @@ public interface NoticeConstants { String CREATE = "CREATE"; String UPDATE = "CREATE"; String DELETE = "DELETE"; + String JENKINS_TASK = "jenkinsTask"; + String TEST_PLAN_TASK = "testPlanTask"; + String REVIEW_TASK = "reviewTask"; + String DEFECT_TASK = "defectTask"; } diff --git a/backend/src/main/java/io/metersphere/notice/service/NoticeService.java b/backend/src/main/java/io/metersphere/notice/service/NoticeService.java index a46f49964e..7fbe8e01e1 100644 --- a/backend/src/main/java/io/metersphere/notice/service/NoticeService.java +++ b/backend/src/main/java/io/metersphere/notice/service/NoticeService.java @@ -6,6 +6,7 @@ import io.metersphere.base.domain.Notice; import io.metersphere.base.domain.NoticeExample; import io.metersphere.base.mapper.MessageTaskMapper; import io.metersphere.base.mapper.NoticeMapper; +import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.notice.controller.request.MessageRequest; import io.metersphere.notice.controller.request.NoticeRequest; import io.metersphere.notice.domain.MessageDetail; @@ -15,10 +16,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; import java.util.stream.Collectors; import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_FAILED; @@ -113,30 +111,30 @@ public class NoticeService { MessageTaskExample messageTaskExample = new MessageTaskExample(); messageTaskExample.createCriteria(); List messageTaskLists = new ArrayList<>(); - List userIds = new ArrayList<>(); - List events = new ArrayList<>(); MessageSettingDetail messageSettingDetail = new MessageSettingDetail(); - MessageDetail messageDetail = new MessageDetail(); List MessageDetailList = new ArrayList<>(); messageTaskLists = messageTaskMapper.selectByExample(messageTaskExample); Map> MessageTaskMap = messageTaskLists.stream().collect(Collectors.groupingBy(e -> fetchGroupKey(e))); MessageTaskMap.forEach((k, v) -> { + Set userIds = new HashSet(); + Set events = new HashSet(); + MessageDetail messageDetail = new MessageDetail(); for (MessageTask m : v) { - userIds.add(m.getId()); + userIds.add(m.getUserId()); events.add(m.getEvent()); messageDetail.setTaskType(m.getTaskType()); messageDetail.setWebhook(m.getWebhook()); messageDetail.setIdentification(m.getIdentification()); messageDetail.setType(m.getType()); } - messageDetail.setEvents(events); - messageDetail.setUserIds(userIds); + messageDetail.setEvents(new ArrayList(events)); + messageDetail.setUserIds(new ArrayList(userIds)); MessageDetailList.add(messageDetail); }); - List jenkinsTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("jenkinsTask")).collect(Collectors.toList()); - List testCasePlanTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("testPlanTask")).collect(Collectors.toList()); - List reviewTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("reviewTask")).collect(Collectors.toList()); - List defectTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("defect")).collect(Collectors.toList()); + List jenkinsTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.JENKINS_TASK)).collect(Collectors.toList()); + List testCasePlanTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.TEST_PLAN_TASK)).collect(Collectors.toList()); + List reviewTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.REVIEW_TASK)).collect(Collectors.toList()); + List defectTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.DEFECT_TASK)).collect(Collectors.toList()); messageSettingDetail.setJenkinsTask(jenkinsTask); messageSettingDetail.setTestCasePlanTask(testCasePlanTask); messageSettingDetail.setReviewTask(reviewTask); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java index cfa95c4f88..d2e899d700 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java @@ -114,13 +114,14 @@ public class TestCaseReviewService { List reviewTasklist = messageSettingDetail.getReviewTask(); try { - if (StringUtils.equals(NoticeConstants.NAIL_ROBOT, "NAIL_ROBOT")) { + mailService.sendReviewerNotice(userIds, reviewRequest); + /* if (StringUtils.equals(NoticeConstants.NAIL_ROBOT, "NAIL_ROBOT")) { dingTaskService.sendDingTask(context, userIds); } else if (StringUtils.equals(NoticeConstants.WECHAT_ROBOT, "WECHAT_ROBOT")) { wxChatTaskService.enterpriseWechatTask(); } else { mailService.sendReviewerNotice(userIds, reviewRequest); - } + }*/ } catch (Exception e) { LogUtil.error(e); } diff --git a/frontend/src/business/components/settings/organization/TaskNotification.vue b/frontend/src/business/components/settings/organization/TaskNotification.vue index 1ce4d535b8..38b1b360cb 100644 --- a/frontend/src/business/components/settings/organization/TaskNotification.vue +++ b/frontend/src/business/components/settings/organization/TaskNotification.vue @@ -389,49 +389,53 @@ export default { taskType: "jenkinsTask", events: [], userIds: [], - type: [], + type:[], webhook: "", result: { showSave: true, showCancel: true, showDelete: false - } + }, + identification:"", }], testPlanTask: [{ taskType: "testPlanTask", events: [], userIds: [], - type: [], + type:[], webhook: "", result: { showSave: true, showCancel: true, showDelete: false - } + }, + identification:"", }], reviewTask: [{ taskType: "reviewTask", events: [], userIds: [], - type: [], + type:[], webhook: "", result: { showSave: true, showCancel: true, showDelete: false - } + }, + identification:"", }], defectTask: [{ - taskType: "defect", + taskType: "defectTask", events: [], userIds: [], - type: [], + type:[], webhook: "", result: { showSave: true, showCancel: true, showDelete: false - } + }, + identification:"", }], }, jenkinsEventOptions: [ @@ -506,7 +510,7 @@ export default { Task.taskType = 'reviewTask' this.form.reviewTask.unshift(Task) } else { - Task.taskType = 'defect' + Task.taskType = 'defectTask' this.form.defectTask.unshift(Task) } }, diff --git a/frontend/src/business/components/settings/router.js b/frontend/src/business/components/settings/router.js index 93da75f536..f95be7a5a7 100644 --- a/frontend/src/business/components/settings/router.js +++ b/frontend/src/business/components/settings/router.js @@ -48,11 +48,11 @@ export default { component: () => import('@/business/components/settings/organization/ServiceIntegration'), meta: {organization: true, title: 'organization.service_integration'} }, - { + /*{ path: 'messagesettings', component: () => import('@/business/components/settings/organization/MessageSettings'), meta: {organization: true, title: 'organization.message_settings'} - }, + },*/ { path: 'member', component: () => import('@/business/components/settings/workspace/WorkspaceMember'),