//package com.mcli.filter;
//
//import cn.hutool.core.util.ObjectUtil;
//import com.alibaba.fastjson.JSONObject;
//import com.mcli.com.mcli.mcli.utils.UtilDateTime;
//import com.mcli.service.common.McConf;
//import com.mcli.service.common.McException;
//import com.mcli.service.dingtalk.DDConf;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.Date;
//
///**
// * 报错消息: 发送钉钉工作通知
// */
//@Slf4j
//@Component
//public class ExceptionNotice {
//
//    @Autowired
//    private DDClient ddClient;
//
//    @Autowired
//    private DDConf ddConf;
//
//    @Autowired
//    private McConf mcConf;
//
//    /**
//     * 上报错误日志 [未知错误]
//     */
//    public void noticeErrorByDingtalk(Exception e) {
//        // 通知人为空为空则忽略
//        if (ObjectUtil.isNull(mcConf.getEngineers()) || mcConf.getEngineers().isEmpty()) {
//            return;
//        }
//        String content = e.getMessage();
//        if (e instanceof McException) {
//            McException mcE = (McException) e;
//            content = mcE.toString();
//        }
//        log.warn("上报错误日志, {}, {}", mcConf.getEngineers(), content);
//        content += " --> " + UtilDateTime.formatDateTime(new Date());
//        JSONObject message = new JSONObject();
//        message.put("msgtype", "text");
//        JSONObject info = new JSONObject();
//        info.put("content", content);
//        message.put("text", info);
//        ddClient.sendCorpConversationMessage(ddConf.getAgentId(), mcConf.getEngineers(), null, false, message);
//    }
//}
