fix(消息通知): 修复发送自定义webhook的消息时空指针的问题

This commit is contained in:
CaptainB 2022-06-24 16:20:29 +08:00 committed by f2c-ci-robot[bot]
parent 0dfb89007c
commit 5f20dd00e8
1 changed files with 9 additions and 7 deletions

View File

@ -61,13 +61,15 @@ public abstract class AbstractNoticeSender implements NoticeSender {
if (noticeModel.getParamMap().containsKey("customFields")) {
String customFields = (String) noticeModel.getParamMap().get("customFields");
JSONArray array = JSON.parseArray(customFields);
for (Object o : array) {
JSONObject jsonObject = JSON.parseObject(o.toString());
String name = jsonObject.getString("name");
Object value = jsonObject.getObject("value", Object.class);
noticeModel.getParamMap().put(name, value); // 处理人
if (StringUtils.equals(jsonObject.getString("name"), "处理人")) {
noticeModel.getParamMap().put("processor", value); // 处理人
if (CollectionUtils.isNotEmpty(array)) {
for (Object o : array) {
JSONObject jsonObject = JSON.parseObject(o.toString());
String name = jsonObject.getString("name");
Object value = jsonObject.getObject("value", Object.class);
noticeModel.getParamMap().put(name, value); // 处理人
if (StringUtils.equals(jsonObject.getString("name"), "处理人")) {
noticeModel.getParamMap().put("processor", value); // 处理人
}
}
}
}