fix(消息设置):消息设置修改

This commit is contained in:
wenyann 2020-10-23 14:52:53 +08:00
parent f64d7a21b0
commit 10b258a9b0
6 changed files with 33 additions and 23 deletions

View File

@ -168,11 +168,11 @@ public class MailService {
} }
} }
/*新建评审*/
public void sendReviewerNotice(MessageDetail messageDetail, List<String> userIds, SaveTestCaseReviewRequest reviewRequest, String eventType) { public void sendReviewerNotice(MessageDetail messageDetail, List<String> userIds, SaveTestCaseReviewRequest reviewRequest, String eventType) {
Map<String, String> context = getReviewContext(reviewRequest); Map<String, String> context = getReviewContext(reviewRequest);
try { try {
String reviewerTemplate = IOUtils.toString(this.getClass().getResource("/mail/end.html"), StandardCharsets.UTF_8); String reviewerTemplate = IOUtils.toString(this.getClass().getResource("/mail/reviewer.html"), StandardCharsets.UTF_8);
sendReviewNotice(addresseeIdList(messageDetail, userIds, eventType), context, reviewerTemplate); sendReviewNotice(addresseeIdList(messageDetail, userIds, eventType), context, reviewerTemplate);
} catch (Exception e) { } catch (Exception e) {
LogUtil.error(e); LogUtil.error(e);
@ -385,6 +385,8 @@ public class MailService {
for (String k : context.keySet()) { for (String k : context.keySet()) {
if (StringUtils.isNotBlank(context.get(k))) { if (StringUtils.isNotBlank(context.get(k))) {
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", context.get(k)); template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", context.get(k));
}else{
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", "");
} }
} }
} }

View File

@ -459,7 +459,7 @@ public class TestCaseReviewService {
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.UPDATE); wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.UPDATE);
break; break;
case NoticeConstants.EMAIL: case NoticeConstants.EMAIL:
mailService.sendReviewerNotice(r, userIds, testCaseReviewRequest, NoticeConstants.UPDATE); mailService.sendEndNotice(r, userIds, testCaseReviewRequest, NoticeConstants.UPDATE);
break; break;
} }
}); });

View File

@ -568,6 +568,9 @@ export default {
handleAddTask(index, data) { handleAddTask(index, data) {
let list = [] let list = []
if (data.event && data.userIds.length > 0 && data.type) { if (data.event && data.userIds.length > 0 && data.type) {
if (data.type === 'NAIL_ROBOT' || data.type === 'NAIL_ROBOT') {
this.$warning(this.$t('organization.message.message_webhook'));
} else {
data.isSet = false data.isSet = false
list.push(data) list.push(data)
let param = {}; let param = {};
@ -576,6 +579,7 @@ export default {
this.initForm() this.initForm()
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
}) })
}
} else { } else {
this.$warning(this.$t('organization.message.message')); this.$warning(this.$t('organization.message.message'));
} }

View File

@ -234,7 +234,8 @@ export default {
'\n' + '\n' +
'3. Robots are selected as swarm robots, and "custom keyword" is selected for security verification: "task notification"', '3. Robots are selected as swarm robots, and "custom keyword" is selected for security verification: "task notification"',
message: 'Event, receiver and receiving method are required\n' + message: 'Event, receiver and receiving method are required\n' +
'\n' '\n',
message_webhook: 'Webhook is required when the receiving mode is nail or enterprise robot'
}, },
integration: { integration: {
select_defect_platform: 'Please select the defect management platform to be integrated:', select_defect_platform: 'Please select the defect management platform to be integrated:',

View File

@ -232,7 +232,8 @@ export default {
notes: '注意: 1.事件,接收方式,接收人为必填项;\n' + notes: '注意: 1.事件,接收方式,接收人为必填项;\n' +
' 2.接收方式除邮件外webhook为必填\n' + ' 2.接收方式除邮件外webhook为必填\n' +
' 3.机器人选择为群机器人,安全验证选择“自定义关键词” "任务通知"', ' 3.机器人选择为群机器人,安全验证选择“自定义关键词” "任务通知"',
message: '事件,接收人,接收方式为必填项' message: '事件,接收人,接收方式为必填项',
message_webhook: '接收方式为钉钉和企业机器人时webhook为必填项'
}, },

View File

@ -229,6 +229,8 @@ export default {
mail: '郵件', mail: '郵件',
nail_robot: '釘釘機器人', nail_robot: '釘釘機器人',
enterprise_wechat_robot: '企業微信機器人', enterprise_wechat_robot: '企業微信機器人',
message_webhook: '接收管道為釘釘和企業機器人時webhook為必填項\n' +
'\n'
}, },
integration: { integration: {
select_defect_platform: '請選擇要集成的缺陷管理平臺:', select_defect_platform: '請選擇要集成的缺陷管理平臺:',