feat(消息通知): 接口新建更新删除增加责任人通知

This commit is contained in:
guoyuqi 2024-11-27 16:13:03 +08:00 committed by Craftsman
parent 3cd3ee3cff
commit 5b6614ccab
2 changed files with 65 additions and 3 deletions

View File

@ -175,8 +175,10 @@ public abstract class AbstractNoticeSender implements NoticeSender {
String creator = (String) paramMap.get("creator");
String createUser = (String) paramMap.get("createUser");
String createUserId = (String) paramMap.get("createUserId");
String userId1 = (String) paramMap.get("userId");
String userId1= null;
if (!StringUtils.equalsIgnoreCase(messageDetail.getTaskType(),NoticeConstants.TaskType.API_DEFINITION_TASK)) {
userId1 = (String) paramMap.get("userId");
}
if (StringUtils.isNotBlank(userId1)) {
toUsers.add(new Receiver(userId1, NotificationConstants.Type.SYSTEM_NOTICE.name()));
} else if (StringUtils.isNotBlank(creator)) {
@ -193,7 +195,7 @@ public abstract class AbstractNoticeSender implements NoticeSender {
if (CollectionUtils.isNotEmpty(relatedUsers)) {
List<Receiver> receivers = relatedUsers.stream()
.map(u -> new Receiver(u, NotificationConstants.Type.SYSTEM_NOTICE.name()))
.collect(Collectors.toList());
.toList();
toUsers.addAll(receivers);
}
@ -201,6 +203,16 @@ public abstract class AbstractNoticeSender implements NoticeSender {
toUsers.add(new Receiver((String) paramMap.get("maintainer"), NotificationConstants.Type.SYSTEM_NOTICE.name()));
}
}
if (StringUtils.equalsIgnoreCase(messageDetail.getTaskType(),NoticeConstants.TaskType.API_DEFINITION_TASK)&&(
StringUtils.equals(NoticeConstants.Event.CREATE, event) || StringUtils.equals(NoticeConstants.Event.UPDATE, event) || StringUtils.equals(NoticeConstants.Event.DELETE, event))) {
String maintainerId = (String) paramMap.get("userId");
if (StringUtils.isNotBlank(maintainerId)) {
toUsers.add(new Receiver(maintainerId, NotificationConstants.Type.SYSTEM_NOTICE.name()));
}
if (paramMap.containsKey("maintainer")) {
toUsers.add(new Receiver((String) paramMap.get("maintainer"), NotificationConstants.Type.SYSTEM_NOTICE.name()));
}
}
break;
case NoticeConstants.RelatedUser.FOLLOW_PEOPLE:
try {

View File

@ -403,25 +403,51 @@ export default {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
let i3 = row.userIds.indexOf('MAINTAINER');
switch (row.event) {
case "CREATE":
receiverOptions.unshift({id: 'MAINTAINER', name: this.$t('test_track.case.maintainer')});
if (i2 > -1) {
row.userIds.splice(i2, 1);
}
if (i > -1) {
row.userIds.splice(i, 1);
}
if (row.isSet) {
if (i3 < 0) {
row.userIds.unshift('MAINTAINER');
}
}
break;
case "MOCK_CREATE":
case "CASE_CREATE":
if (i2 > -1) {
row.userIds.splice(i2, 1);
}
if (i > -1) {
row.userIds.splice(i, 1);
}
if (i3 > -1) {
row.userIds = row.userIds.splice(i3, 1);
}
break;
case "UPDATE":
receiverOptions.unshift({id: 'MAINTAINER', name: this.$t('test_track.case.maintainer')});
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
if (i3 < 0) {
row.userIds.unshift('MAINTAINER');
}
}
break;
case "CASE_UPDATE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
@ -433,6 +459,9 @@ export default {
row.userIds.unshift('FOLLOW_PEOPLE');
}
}
if (i3> -1) {
row.userIds.splice(i3, 1);
}
break;
case "MOCK_UPDATE":
case "MOCK_DELETE":
@ -443,8 +472,26 @@ export default {
row.userIds.unshift('CREATOR');
}
}
if (i3> -1) {
row.userIds.splice(i3, 1);
}
break;
case "DELETE":
receiverOptions.unshift({id: 'MAINTAINER', name: this.$t('test_track.case.maintainer')});
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (i3 < 0) {
row.userIds.unshift('MAINTAINER');
}
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break;
case "CASE_DELETE":
case "EXECUTE_SUCCESSFUL":
case "EXECUTE_FAILED":
@ -455,6 +502,9 @@ export default {
row.userIds.unshift('CREATOR');
}
}
if (i3> -1) {
row.userIds.splice(i3, 1);
}
break;
default:
break;