fix: 修复 api case 更新没有发送通知 --bug=1006093 --user=刘瑞斌 【消息通知】接口定义... https://www.tapd.cn/55049933/s/1038210

This commit is contained in:
Captain.B 2021-08-23 18:06:48 +08:00 committed by 刘瑞斌
parent ab9bf52db4
commit 01d03092c2
7 changed files with 18 additions and 7 deletions

View File

@ -309,7 +309,7 @@ public class ApiTestCaseService {
test.setTags(request.getTags()); test.setTags(request.getTags());
} }
apiTestCaseMapper.updateByPrimaryKeySelective(test); apiTestCaseMapper.updateByPrimaryKeySelective(test);
return test; return apiTestCaseMapper.selectByPrimaryKey(request.getId());
} }
private ApiTestCase createTest(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) { private ApiTestCase createTest(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {

View File

@ -133,6 +133,7 @@ public abstract class AbstractNoticeSender implements NoticeSender {
case NoticeConstants.RelatedUser.CREATOR: case NoticeConstants.RelatedUser.CREATOR:
Object creator = paramMap.get("creator"); Object creator = paramMap.get("creator");
Object createUser = paramMap.get("createUser"); Object createUser = paramMap.get("createUser");
Object createUserId = paramMap.get("createUserId");
Object userId1 = paramMap.get("userId"); Object userId1 = paramMap.get("userId");
if (userId1 != null) { if (userId1 != null) {
@ -141,6 +142,8 @@ public abstract class AbstractNoticeSender implements NoticeSender {
toUsers.add(new Receiver(creator.toString(), NotificationConstants.Type.SYSTEM_NOTICE.name())); toUsers.add(new Receiver(creator.toString(), NotificationConstants.Type.SYSTEM_NOTICE.name()));
} else if (createUser != null) { } else if (createUser != null) {
toUsers.add(new Receiver(createUser.toString(), NotificationConstants.Type.SYSTEM_NOTICE.name())); toUsers.add(new Receiver(createUser.toString(), NotificationConstants.Type.SYSTEM_NOTICE.name()));
} else if (createUserId != null) {
toUsers.add(new Receiver(createUserId.toString(), NotificationConstants.Type.SYSTEM_NOTICE.name()));
} }
break; break;
case NoticeConstants.RelatedUser.MAINTAINER: case NoticeConstants.RelatedUser.MAINTAINER:

View File

@ -27,8 +27,8 @@ public class InSiteNoticeSender extends AbstractNoticeSender {
return; return;
} }
LogUtil.info("发送站内通知: {}", messageDetail.getUserIds());
receivers.forEach(receiver -> { receivers.forEach(receiver -> {
LogUtil.debug("发送站内通知: {}, 内容: {}", receiver, context);
Map<String, Object> paramMap = noticeModel.getParamMap(); Map<String, Object> paramMap = noticeModel.getParamMap();
Notification notification = new Notification(); Notification notification = new Notification();

View File

@ -162,7 +162,7 @@ export default {
return; return;
} }
d.user = this.userMap[d.operator]; d.user = this.userMap[d.operator];
let message = d.user.name + getOperation(d.operation) + getResource(d.resourceType) + ": " + d.resourceName; let message = d.user.name + getOperation(d.operation) + getResource(d) + ": " + d.resourceName;
let title = d.type === 'MENTIONED_ME' ? '@提到我的' : '系统通知'; let title = d.type === 'MENTIONED_ME' ? '@提到我的' : '系统通知';
setTimeout(() => { setTimeout(() => {
this.$notify({ this.$notify({

View File

@ -30,7 +30,7 @@
</div> </div>
<span class="username">{{ item.user.name }}</span> <span class="username">{{ item.user.name }}</span>
<span class="operation"> <span class="operation">
{{ getOperation(item.operation) }}{{ getResource(item.resourceType) }}: {{ item.resourceName }} {{ getOperation(item.operation) }}{{ getResource(item) }}: {{ item.resourceName }}
</span> </span>
</el-row> </el-row>
</el-card> </el-card>

View File

@ -30,7 +30,7 @@
</div> </div>
<span class="username">{{ item.user.name }}</span> <span class="username">{{ item.user.name }}</span>
<span class="operation"> <span class="operation">
{{ getOperation(item.operation) }}{{ getResource(item.resourceType) }}: {{ item.resourceName }} {{ getOperation(item.operation) }}{{ getResource(item) }}: {{ item.resourceName }}
</span> </span>
</el-row> </el-row>
</el-card> </el-card>

View File

@ -33,8 +33,16 @@ export function getOperation(operation) {
return operation; return operation;
} }
export function getResource(resourceType) { export function getResource(d) {
switch (resourceType) { switch (d.operation) {
case "CASE_CREATE":
case "CASE_UPDATE":
case "CASE_DELETE":
return "";
}
let resourceType = "";
switch (d.resourceType) {
case "JENKINS_TASK" : case "JENKINS_TASK" :
resourceType = "Jenkins"; resourceType = "Jenkins";
break; break;