springboot项目编写发送异常日志到企微工具包

1.创建基础Bean

public final class ThreadFactory implements java.util.concurrent.ThreadFactory {
    private static final AtomicInteger poolNumber = new AtomicInteger(1);
    private final ThreadGroup group;
    private final AtomicInteger threadNumber = new AtomicInteger(1);
    private final String namePrefix;

    public ThreadFactory(String groupFlag, String functionName) {
        SecurityManager s = System.getSecurityManager();
        this.group = s != null ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
        this.namePrefix = this.buildPrefix(groupFlag, functionName, poolNumber);
    }

    private String buildPrefix(String vendorFlag, String functionName, final AtomicInteger poolNumber) {
        StringBuffer sb = (new StringBuffer("pool-")).append(poolNumber.getAndIncrement()).append("-thread-");
        String connChar = "-";
        if (null != vendorFlag && !"".equals(vendorFlag)) {
            sb.append(vendorFlag).append(connChar);
        }

        if (null != functionName && !"".equals(functionName)) {
            sb.append(functionName).append(connChar);
        }

        return sb.toString();
    }

    public Thread newThread(Runnable r) {
        String threadName = this.namePrefix + this.threadNumber.getAndIncrement();
        Thread t = new Thread(this.group, r, threadName, 0L);
        if (t.isDaemon()) {
            t.setDaemon(false);
        }

        if (t.getPriority() != 5) {
            t.setPriority(5);
        }

        return t;
    }
}
public class QiWeiMarkDownMessage<T> {
    private String msgtype;
    private T markdown;

    public QiWeiMarkDownMessage() {
    }

    public String getMsgtype() {
        return this.msgtype;
    }

    public T getMarkdown() {
        return this.markdown;
    }

    public void setMsgtype(final String msgtype) {
        this.msgtype = msgtype;
    }

    public void setMarkdown(final T markdown) {
        this.markdown = markdown;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof QiWeiMarkDownMessage)) {
            return false;
        } else {
            QiWeiMarkDownMessage<?> other = (QiWeiMarkDownMessage)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$msgtype = this.getMsgtype();
                Object other$msgtype = other.getMsgtype();
                if (this$msgtype == null) {
                    if (other$msgtype != null) {
                        return false;
                    }
                } else if (!this$msgtype.equals(other$msgtype)) {
                    return false;
                }

                Object this$markdown = this.getMarkdown();
                Object other$markdown = other.getMarkdown();
                if (this$markdown == null) {
                    if (other$markdown != null) {
                        return false;
                    }
                } else if (!this$markdown.equals(other$markdown)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof QiWeiMarkDownMessage;
    }

    public int hashCode() {
        
        int result = 1;
        Object $msgtype = this.getMsgtype();
        result = result * 59 + ($msgtype == null ? 43 : $msgtype.hashCode());
        Object $markdown = this.getMarkdown();
        result = result * 59 + ($markdown == null ? 43 : $markdown.hashCode());
        return result;
    }

    public String toString() {
        return "QiWeiMarkDownMessage(msgtype=" + this.getMsgtype() + ", markdown=" + this.getMarkdown() + ")";
    }
}
public class QiWeiMessageContext {
    private String content;
    private String mentioned_list;
    private String mentioned_mobile_list;

    public QiWeiMessageContext() {
    }

    public String getContent() {
        return this.content;
    }

    public String getMentioned_list() {
        return this.mentioned_list;
    }

    public String getMentioned_mobile_list() {
        return this.mentioned_mobile_list;
    }

    public void setContent(final String content) {
        this.content = content;
    }

    public void setMentioned_list(final String mentioned_list) {
        this.mentioned_list = mentioned_list;
    }

    public void setMentioned_mobile_list(final String mentioned_mobile_list) {
        this.mentioned_mobile_list = mentioned_mobile_list;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof QiWeiMessageContext)) {
            return false;
        } else {
            QiWeiMessageContext other = (QiWeiMessageContext)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label47: {
                    Object this$content = this.getContent();
                    Object other$content = other.getContent();
                    if (this$content == null) {
                        if (other$content == null) {
                            break label47;
                        }
                    } else if (this$content.equals(other$content)) {
                        break label47;
                    }

                    return false;
                }

                Object this$mentioned_list = this.getMentioned_list();
                Object other$mentioned_list = other.getMentioned_list();
                if (this$mentioned_list == null) {
                    if (other$mentioned_list != null) {
                        return false;
                    }
                } else if (!this$mentioned_list.equals(other$mentioned_list)) {
                    return false;
                }

                Object this$mentioned_mobile_list = this.getMentioned_mobile_list();
                Object other$mentioned_mobile_list = other.getMentioned_mobile_list();
                if (this$mentioned_mobile_list == null) {
                    if (other$mentioned_mobile_list != null) {
                        return false;
                    }
                } else if (!this$mentioned_mobile_list.equals(other$mentioned_mobile_list)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof QiWeiMessageContext;
    }

    public int hashCode() {
       
        int result = 1;
        Object $content = this.getContent();
        result = result * 59 + ($content == null ? 43 : $content.hashCode());
        Object $mentioned_list = this.getMentioned_list();
        result = result * 59 +
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值