class WeWorkAppAlertNotifyHandlerImpl extends AbstractAlertNotifyHandlerImpl {

    /**
     * send weChat app message url
     */
    private static final String APP_MESSAGE_URL = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=%s";

    /**
     * get access_token url
     */
    private static final String SECRET_URL = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=%s&corpsecret=%s";

    /**
     * 应用消息发送对象
     */
    private static final String DEFAULT_ALL = "@all";

    private final RestTemplate restTemplate;

    @Override
    public void send(NoticeReceiver receiver, NoticeTemplate noticeTemplate, Alert alert) throws AlertNoticeException {<FILL_FUNCTION_BODY>}

    @Override
    public byte type() {
        return 10;
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    private static class WeChatAppReq {

        @JsonProperty(value = "errcode")
        private Integer errCode;

        @JsonProperty(value = "errmsg")
        private String errMsg;

        @JsonProperty(value = "access_token")
        private String accessToken;
    }

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    private static class WeChatAppDTO {

        /**
         * markdown格式
         */
        public static final String MARKDOWN = "markdown";

        @JsonProperty(value = "touser")
        private String toUser;

        @JsonProperty(value = "toparty")
        private String toParty;

        @JsonProperty(value = "totag")
        private String toTag;

        @JsonProperty(value = "msgtype")
        private String msgType;

        @JsonProperty(value = "agentid")
        private Integer agentId;

        /**
         * text message
         */
        private TextDTO text;

        /**
         * markdown消息
         */
        private MarkdownDTO markdown;

        @Data
        private static class MarkdownDTO {
            /**
             * 消息内容
             */
            private String content;
        }

        @Data
        private static class TextDTO {
            /**
             * 消息内容
             */
            private String content;
        }

    }
}

        String corpId = receiver.getCorpId();
        Integer agentId = receiver.getAgentId();
        String appSecret = receiver.getAppSecret();

        try {
            ResponseEntity<WeChatAppReq> entityResponse = restTemplate.getForEntity(String.format(SECRET_URL, corpId, appSecret), WeChatAppReq.class);
            if (Objects.nonNull(entityResponse.getBody())) {
                String accessToken = entityResponse.getBody().getAccessToken();
                WeChatAppDTO.MarkdownDTO markdown = new WeChatAppDTO.MarkdownDTO();
                markdown.setContent(renderContent(noticeTemplate, alert));
                WeChatAppDTO weChatAppDTO = WeChatAppDTO.builder()
                        .toUser(DEFAULT_ALL)
                        .msgType(WeChatAppDTO.MARKDOWN)
                        .markdown(markdown)
                        .agentId(agentId)
                        .build();
                HttpHeaders headers = new HttpHeaders();
                headers.setContentType(MediaType.APPLICATION_JSON);
                HttpEntity<WeChatAppDTO> weChatAppEntity = new HttpEntity<>(weChatAppDTO, headers);
                ResponseEntity<WeChatAppReq> response = restTemplate.postForEntity(String.format(APP_MESSAGE_URL, accessToken), weChatAppEntity, WeChatAppReq.class);
                if (Objects.nonNull(response.getBody()) && !Objects.equals(response.getBody().getErrCode(), 0)) {
                    log.warn("Send Enterprise WeChat App Error: {}", response.getBody().getErrMsg());
                    throw new AlertNoticeException("Http StatusCode " + response.getStatusCode() + " Error: " + response.getBody().getErrMsg());
                }
            }
        } catch (Exception e) {
            throw new AlertNoticeException("[Enterprise WeChat Notify Error] " + e.getMessage());
        }
    
<methods>public void onEvent(org.apache.hertzbeat.common.support.event.SystemConfigChangeEvent) <variables>protected static final java.time.format.DateTimeFormatter DTF,private static final java.lang.String NUMBER_FORMAT,protected org.apache.hertzbeat.alert.AlerterProperties alerterProperties,protected java.util.ResourceBundle bundle,protected org.apache.hertzbeat.manager.service.NoticeConfigService noticeConfigService,protected RestTemplate restTemplate