REQ-3345: 添加告警

This commit is contained in:
yanglin 2025-02-07 09:36:43 +08:00
parent 58c560ee03
commit 3c64e82a5c
3 changed files with 21 additions and 13 deletions

View File

@ -13,7 +13,6 @@ import cn.axzo.im.service.domain.ImAccounts;
import cn.axzo.im.utils.BizAssertions;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.stereotype.Component;
import java.util.Collections;
@ -102,11 +101,7 @@ public class GroupSupport implements GroupLogger {
}
public void log(String message, Object... args) {
try {
chatGroupService.sendDingRobot(MessageFormatter.arrayFormat(message, args).getMessage());
} catch (Exception e) {
log.warn("发送钉钉机器人消息失败", e);
}
chatGroupService.log(message, args);
}
}

View File

@ -18,6 +18,7 @@ import cn.axzo.im.center.api.vo.resp.HistoryMsgQueryResp;
import cn.axzo.im.center.common.enums.ChatGroupUserDataSourceEnum;
import cn.axzo.im.entity.ChatGroup;
import cn.axzo.im.entity.dto.OrganizationalNodeUserDTO;
import cn.axzo.im.group.GroupLogger;
import cn.hutool.core.lang.Pair;
import com.baomidou.mybatisplus.extension.service.IService;
@ -29,7 +30,7 @@ import java.util.Set;
* @date 2024/11/05
* @desc 群聊
*/
public interface ChatGroupService extends IService<ChatGroup> {
public interface ChatGroupService extends IService<ChatGroup>, GroupLogger {
/**
* 创建群聊
@ -79,9 +80,10 @@ public interface ChatGroupService extends IService<ChatGroup> {
/**
* 拉人进群
* @param tid 群Id
* @param owner 群主
* @param members im账号集合
*
* @param tid 群Id
* @param owner 群主
* @param members im账号集合
* @param groupName 群名称
*/
boolean userAddChatGroup(Long chatGroupId, String tid, String owner, Set<String> members, String groupName, ChatGroupUserDataSourceEnum dataSource, Integer executeCount);
@ -93,15 +95,17 @@ public interface ChatGroupService extends IService<ChatGroup> {
/**
* 踢出群
* @param tid 群Id
* @param owner 群主
*
* @param tid 群Id
* @param owner 群主
* @param imAccount im账号
*/
boolean kickChatGroup(Long chatGroupId, String tid, String owner, String imAccount);
/**
* 更改群主
* @param chatGroupId 群聊Id
*
* @param chatGroupId 群聊Id
* @param oldAccIdOwner 原群主账号
* @param newAccIdOwner 新群主账号
*/

View File

@ -77,6 +77,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.BooleanUtils;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
@ -766,6 +767,14 @@ public class ChatGroupServiceImpl extends ServiceImpl<ChatGroupMapper, ChatGrou
return userAccountRespList;
}
@Override
public void log(String message, Object... args) {
try {
sendDingRobot(MessageFormatter.arrayFormat(message, args).getMessage());
} catch (Exception e) {
log.warn("发送钉钉机器人消息失败", e);
}
}
}
@Data