feat: 消息设置
This commit is contained in:
parent
f872fb6692
commit
87f53cbebf
|
@ -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";
|
||||
|
||||
}
|
||||
|
|
|
@ -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<MessageTask> messageTaskLists = new ArrayList<>();
|
||||
List<String> userIds = new ArrayList<>();
|
||||
List<String> events = new ArrayList<>();
|
||||
MessageSettingDetail messageSettingDetail = new MessageSettingDetail();
|
||||
MessageDetail messageDetail = new MessageDetail();
|
||||
List<MessageDetail> MessageDetailList = new ArrayList<>();
|
||||
messageTaskLists = messageTaskMapper.selectByExample(messageTaskExample);
|
||||
Map<String, List<MessageTask>> 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<MessageDetail> jenkinsTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("jenkinsTask")).collect(Collectors.toList());
|
||||
List<MessageDetail> testCasePlanTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("testPlanTask")).collect(Collectors.toList());
|
||||
List<MessageDetail> reviewTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("reviewTask")).collect(Collectors.toList());
|
||||
List<MessageDetail> defectTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals("defect")).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(NoticeConstants.TEST_PLAN_TASK)).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(NoticeConstants.DEFECT_TASK)).collect(Collectors.toList());
|
||||
messageSettingDetail.setJenkinsTask(jenkinsTask);
|
||||
messageSettingDetail.setTestCasePlanTask(testCasePlanTask);
|
||||
messageSettingDetail.setReviewTask(reviewTask);
|
||||
|
|
|
@ -114,13 +114,14 @@ public class TestCaseReviewService {
|
|||
List<MessageDetail> 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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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'),
|
||||
|
|
Loading…
Reference in New Issue