feat: 消息设置
This commit is contained in:
parent
f872fb6692
commit
87f53cbebf
|
@ -9,5 +9,9 @@ public interface NoticeConstants {
|
||||||
String CREATE = "CREATE";
|
String CREATE = "CREATE";
|
||||||
String UPDATE = "CREATE";
|
String UPDATE = "CREATE";
|
||||||
String DELETE = "DELETE";
|
String DELETE = "DELETE";
|
||||||
|
String JENKINS_TASK = "jenkinsTask";
|
||||||
|
String TEST_PLAN_TASK = "testPlanTask";
|
||||||
|
String REVIEW_TASK = "reviewTask";
|
||||||
|
String DEFECT_TASK = "defectTask";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.base.domain.Notice;
|
||||||
import io.metersphere.base.domain.NoticeExample;
|
import io.metersphere.base.domain.NoticeExample;
|
||||||
import io.metersphere.base.mapper.MessageTaskMapper;
|
import io.metersphere.base.mapper.MessageTaskMapper;
|
||||||
import io.metersphere.base.mapper.NoticeMapper;
|
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.MessageRequest;
|
||||||
import io.metersphere.notice.controller.request.NoticeRequest;
|
import io.metersphere.notice.controller.request.NoticeRequest;
|
||||||
import io.metersphere.notice.domain.MessageDetail;
|
import io.metersphere.notice.domain.MessageDetail;
|
||||||
|
@ -15,10 +16,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_FAILED;
|
import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_FAILED;
|
||||||
|
@ -113,30 +111,30 @@ public class NoticeService {
|
||||||
MessageTaskExample messageTaskExample = new MessageTaskExample();
|
MessageTaskExample messageTaskExample = new MessageTaskExample();
|
||||||
messageTaskExample.createCriteria();
|
messageTaskExample.createCriteria();
|
||||||
List<MessageTask> messageTaskLists = new ArrayList<>();
|
List<MessageTask> messageTaskLists = new ArrayList<>();
|
||||||
List<String> userIds = new ArrayList<>();
|
|
||||||
List<String> events = new ArrayList<>();
|
|
||||||
MessageSettingDetail messageSettingDetail = new MessageSettingDetail();
|
MessageSettingDetail messageSettingDetail = new MessageSettingDetail();
|
||||||
MessageDetail messageDetail = new MessageDetail();
|
|
||||||
List<MessageDetail> MessageDetailList = new ArrayList<>();
|
List<MessageDetail> MessageDetailList = new ArrayList<>();
|
||||||
messageTaskLists = messageTaskMapper.selectByExample(messageTaskExample);
|
messageTaskLists = messageTaskMapper.selectByExample(messageTaskExample);
|
||||||
Map<String, List<MessageTask>> MessageTaskMap = messageTaskLists.stream().collect(Collectors.groupingBy(e -> fetchGroupKey(e)));
|
Map<String, List<MessageTask>> MessageTaskMap = messageTaskLists.stream().collect(Collectors.groupingBy(e -> fetchGroupKey(e)));
|
||||||
MessageTaskMap.forEach((k, v) -> {
|
MessageTaskMap.forEach((k, v) -> {
|
||||||
|
Set userIds = new HashSet();
|
||||||
|
Set events = new HashSet();
|
||||||
|
MessageDetail messageDetail = new MessageDetail();
|
||||||
for (MessageTask m : v) {
|
for (MessageTask m : v) {
|
||||||
userIds.add(m.getId());
|
userIds.add(m.getUserId());
|
||||||
events.add(m.getEvent());
|
events.add(m.getEvent());
|
||||||
messageDetail.setTaskType(m.getTaskType());
|
messageDetail.setTaskType(m.getTaskType());
|
||||||
messageDetail.setWebhook(m.getWebhook());
|
messageDetail.setWebhook(m.getWebhook());
|
||||||
messageDetail.setIdentification(m.getIdentification());
|
messageDetail.setIdentification(m.getIdentification());
|
||||||
messageDetail.setType(m.getType());
|
messageDetail.setType(m.getType());
|
||||||
}
|
}
|
||||||
messageDetail.setEvents(events);
|
messageDetail.setEvents(new ArrayList(events));
|
||||||
messageDetail.setUserIds(userIds);
|
messageDetail.setUserIds(new ArrayList(userIds));
|
||||||
MessageDetailList.add(messageDetail);
|
MessageDetailList.add(messageDetail);
|
||||||
});
|
});
|
||||||
List<MessageDetail> jenkinsTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("jenkinsTask")).collect(Collectors.toList());
|
List<MessageDetail> jenkinsTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.JENKINS_TASK)).collect(Collectors.toList());
|
||||||
List<MessageDetail> testCasePlanTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("testPlanTask")).collect(Collectors.toList());
|
List<MessageDetail> testCasePlanTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.TEST_PLAN_TASK)).collect(Collectors.toList());
|
||||||
List<MessageDetail> reviewTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("reviewTask")).collect(Collectors.toList());
|
List<MessageDetail> reviewTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.REVIEW_TASK)).collect(Collectors.toList());
|
||||||
List<MessageDetail> defectTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("defect")).collect(Collectors.toList());
|
List<MessageDetail> defectTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.DEFECT_TASK)).collect(Collectors.toList());
|
||||||
messageSettingDetail.setJenkinsTask(jenkinsTask);
|
messageSettingDetail.setJenkinsTask(jenkinsTask);
|
||||||
messageSettingDetail.setTestCasePlanTask(testCasePlanTask);
|
messageSettingDetail.setTestCasePlanTask(testCasePlanTask);
|
||||||
messageSettingDetail.setReviewTask(reviewTask);
|
messageSettingDetail.setReviewTask(reviewTask);
|
||||||
|
|
|
@ -114,13 +114,14 @@ public class TestCaseReviewService {
|
||||||
List<MessageDetail> reviewTasklist = messageSettingDetail.getReviewTask();
|
List<MessageDetail> reviewTasklist = messageSettingDetail.getReviewTask();
|
||||||
|
|
||||||
try {
|
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);
|
dingTaskService.sendDingTask(context, userIds);
|
||||||
} else if (StringUtils.equals(NoticeConstants.WECHAT_ROBOT, "WECHAT_ROBOT")) {
|
} else if (StringUtils.equals(NoticeConstants.WECHAT_ROBOT, "WECHAT_ROBOT")) {
|
||||||
wxChatTaskService.enterpriseWechatTask();
|
wxChatTaskService.enterpriseWechatTask();
|
||||||
} else {
|
} else {
|
||||||
mailService.sendReviewerNotice(userIds, reviewRequest);
|
mailService.sendReviewerNotice(userIds, reviewRequest);
|
||||||
}
|
}*/
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,49 +389,53 @@ export default {
|
||||||
taskType: "jenkinsTask",
|
taskType: "jenkinsTask",
|
||||||
events: [],
|
events: [],
|
||||||
userIds: [],
|
userIds: [],
|
||||||
type: [],
|
type:[],
|
||||||
webhook: "",
|
webhook: "",
|
||||||
result: {
|
result: {
|
||||||
showSave: true,
|
showSave: true,
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
showDelete: false
|
showDelete: false
|
||||||
}
|
},
|
||||||
|
identification:"",
|
||||||
}],
|
}],
|
||||||
testPlanTask: [{
|
testPlanTask: [{
|
||||||
taskType: "testPlanTask",
|
taskType: "testPlanTask",
|
||||||
events: [],
|
events: [],
|
||||||
userIds: [],
|
userIds: [],
|
||||||
type: [],
|
type:[],
|
||||||
webhook: "",
|
webhook: "",
|
||||||
result: {
|
result: {
|
||||||
showSave: true,
|
showSave: true,
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
showDelete: false
|
showDelete: false
|
||||||
}
|
},
|
||||||
|
identification:"",
|
||||||
}],
|
}],
|
||||||
reviewTask: [{
|
reviewTask: [{
|
||||||
taskType: "reviewTask",
|
taskType: "reviewTask",
|
||||||
events: [],
|
events: [],
|
||||||
userIds: [],
|
userIds: [],
|
||||||
type: [],
|
type:[],
|
||||||
webhook: "",
|
webhook: "",
|
||||||
result: {
|
result: {
|
||||||
showSave: true,
|
showSave: true,
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
showDelete: false
|
showDelete: false
|
||||||
}
|
},
|
||||||
|
identification:"",
|
||||||
}],
|
}],
|
||||||
defectTask: [{
|
defectTask: [{
|
||||||
taskType: "defect",
|
taskType: "defectTask",
|
||||||
events: [],
|
events: [],
|
||||||
userIds: [],
|
userIds: [],
|
||||||
type: [],
|
type:[],
|
||||||
webhook: "",
|
webhook: "",
|
||||||
result: {
|
result: {
|
||||||
showSave: true,
|
showSave: true,
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
showDelete: false
|
showDelete: false
|
||||||
}
|
},
|
||||||
|
identification:"",
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
jenkinsEventOptions: [
|
jenkinsEventOptions: [
|
||||||
|
@ -506,7 +510,7 @@ export default {
|
||||||
Task.taskType = 'reviewTask'
|
Task.taskType = 'reviewTask'
|
||||||
this.form.reviewTask.unshift(Task)
|
this.form.reviewTask.unshift(Task)
|
||||||
} else {
|
} else {
|
||||||
Task.taskType = 'defect'
|
Task.taskType = 'defectTask'
|
||||||
this.form.defectTask.unshift(Task)
|
this.form.defectTask.unshift(Task)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -48,11 +48,11 @@ export default {
|
||||||
component: () => import('@/business/components/settings/organization/ServiceIntegration'),
|
component: () => import('@/business/components/settings/organization/ServiceIntegration'),
|
||||||
meta: {organization: true, title: 'organization.service_integration'}
|
meta: {organization: true, title: 'organization.service_integration'}
|
||||||
},
|
},
|
||||||
{
|
/*{
|
||||||
path: 'messagesettings',
|
path: 'messagesettings',
|
||||||
component: () => import('@/business/components/settings/organization/MessageSettings'),
|
component: () => import('@/business/components/settings/organization/MessageSettings'),
|
||||||
meta: {organization: true, title: 'organization.message_settings'}
|
meta: {organization: true, title: 'organization.message_settings'}
|
||||||
},
|
},*/
|
||||||
{
|
{
|
||||||
path: 'member',
|
path: 'member',
|
||||||
component: () => import('@/business/components/settings/workspace/WorkspaceMember'),
|
component: () => import('@/business/components/settings/workspace/WorkspaceMember'),
|
||||||
|
|
Loading…
Reference in New Issue