你们看吧,一看一个不吱声

本来能及时返回,就是无限嵌套

public Result<JSONObject> schedulerClusterSendNotes() {//执行获取集群ID的逻辑//获取集群Result<List<Map>> result = bigdataCommonFegin.selectClusterList();if (null != result && null != result.getData()) {//JSONArray data = JSONObject.parseArray(result.getData().toString());for (Map dataMap : result.getData()) {Integer clusterId = (Integer) (dataMap.get("clusterId"));SdpsNoteAndNoteConfigReq noteAndConfigReq = new SdpsNoteAndNoteConfigReq();noteAndConfigReq.setClusterId(clusterId);List<SdpsNoteAndConfigDTO> noteAndConfigs = sdpsNoteAndNoteConfigMapper.findNotesAndConfig(noteAndConfigReq);AmbariUtil ambariUtil = new AmbariUtil(clusterId);Result<SysGlobalArgs> args = bigdataCommonFegin.getGlobalParam("ambari", "warningCnt");JSONObject warnResult = ambariUtil.getAmbariApi(args.getData().getArgValue(), args.getData().getArgValueDesc(),getClusterNameParam(ambariUtil));//查询群组Result<SysGlobalArgs> argsGroup = bigdataCommonFegin.getGlobalParam("ambari", "warningGroups");JSONObject warnGroupsResult = ambariUtil.getAmbariApi(argsGroup.getData().getArgValue(), argsGroup.getData().getArgValueDesc(),getClusterNameParam(ambariUtil));try {if (null != warnResult) {JSONArray items = warnResult.getJSONArray("items");if (items.size() > 0) {for (int w = 0; w < items.size(); w++) {JSONObject item = items.getJSONObject(w);JSONObject alertJO = item.getJSONObject("Alert");String state = alertJO.getString("state");String text = alertJO.getString("text");String serviceName = alertJO.getString("service_name");String label = alertJO.getString("label");Integer id = alertJO.getInteger("id");String hostName = alertJO.getString("host_name");String componentName = alertJO.getString("component_name");String clusterName = alertJO.getString("cluster_name");//是否在每个群组包括的组件子服务中有一个对应子服务(即含告警的)JSONArray warnGItem = warnGroupsResult.getJSONArray("items");for (int g = 0; g < warnGItem.size(); g++) {JSONObject alertGroup = warnGItem.getJSONObject(g).getJSONObject("AlertGroup");String name = warnGItem.getJSONObject(g).getString("name");Integer noteId = warnGItem.getJSONObject(g).getInteger("id");if(null==alertGroup)continue;JSONArray definitions = alertGroup.getJSONArray("definitions");if(null==definitions)continue;JSONArray targets = alertGroup.getJSONArray("targets");if(null==targets)continue;for (int d = 0; d < definitions.size(); d++) {/*{"name" : "ams_metrics_monitor_process","label" : "Metrics Monitor Status","description" : "This alert indicates the status of the Metrics Monitor process as determined by the monitor status script.","enabled" : false,"service_name" : "AMBARI_METRICS","component_name" : "METRICS_MONITOR","id" : 1,"source_type" : "SCRIPT"},*/String description = definitions.getJSONObject(d).getString("description");boolean cnEnabled = definitions.getJSONObject(d).getBoolean("enabled");if (!cnEnabled) continue;String gComponentName = definitions.getJSONObject(d).getString("component_name");if (StringUtil.isNotBlank(componentName)&&StringUtil.isNotBlank(gComponentName)&&componentName.equals(gComponentName)) {//警告组件在该群组 下一步 寻找目标/*targets" : [{"enabled" : true,"name" : "ambari_notice","properties" : null,"id" : 3,"description" : "ambari_notice","global" : true,"notification_type" : "EMAIL"}*/for (int t = 0; t < targets.size(); t++) {//邮件方式时群组不可用 不让其影响短信群组是否可用// if (!targets.getJSONObject(t).getBoolean("enabled")) continue;String tname = targets.getJSONObject(t).getString("name");Integer idTarget = targets.getJSONObject(t).getInteger("id");//判断通知方 和严重程度for (SdpsNoteAndConfigDTO noteAndConfig : noteAndConfigs) {if (noteAndConfig.getNote().contains(tname)&& 1 == noteAndConfig.getIsEnable()&& noteAndConfig.getComponentName().contains(componentName)&& noteAndConfig.getStatus().contains(state)) {if(StringUtil.isNotBlank(noteAndConfig.getSignature())&&StringUtil.isNotBlank(noteAndConfig.getTemplate())&&StringUtil.isNotBlank(noteAndConfig.getMobile())&&StringUtil.isNotBlank(noteAndConfig.getAccessKeyId())&&StringUtil.isNotBlank(noteAndConfig.getKeysecret())){//发短信SmsParamsDTO smsParamsDTO = new SmsParamsDTO();smsParamsDTO.setSign(noteAndConfig.getSignature());smsParamsDTO.setTemplateId(noteAndConfig.getTemplate());StringBuffer strParams =new StringBuffer();if(StringUtil.isNotBlank(noteAndConfig.getParams()))strParams.append(noteAndConfig.getParams());strParams.append(componentName).append(",").append(text);smsParamsDTO.setParams(strParams.toString());smsParamsDTO.setMobiles(noteAndConfig.getMobile());smsParamsDTO.setAccessKeyId(noteAndConfig.getAccessKeyId());smsParamsDTO.setSecretKey(noteAndConfig.getKeysecret());smsParamsDTO.setTimestamp(String.valueOf(System.currentTimeMillis()));//参数校验序列//signature+template+timestamp+accessKeyId+accessKeySecretStringBuffer encodeEncryption=new StringBuffer();encodeEncryption.append(smsParamsDTO.getSign()).append(smsParamsDTO.getTemplateId()).append(smsParamsDTO.getTimestamp()).append(smsParamsDTO.getAccessKeyId()).append(smsParamsDTO.getSecretKey());//进行MD5(32位小写)2次加密String digest = DigestUtils.md5DigestAsHex(DigestUtils.md5DigestAsHex((encodeEncryption.toString().getBytes())).getBytes());smsParamsDTO.setEncryption(digest);String jsonString = JSON.toJSONString(smsParamsDTO);//BASE64编String encode = Base64.getEncoder().encodeToString(jsonString.getBytes());try{SmsProperties smspro = SpringUtil.getBean(SmsProperties.class);HttpUtil.post(HttpUtil.ContentType_JSON_UTF8,smspro.getUrl(),encode.getBytes());//发完短信追加历史表记录SdpsNoteSendHistory sendHistory = new SdpsNoteSendHistory();sendHistory.setClusterId(clusterId);sendHistory.setClusterName(clusterName);sendHistory.setComponentName(componentName);//Date day=new Date();//SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");sendHistory.setCreateTime(new Date());sendHistory.setNote(noteAndConfig.getNote());sendHistory.setText(text);sendHistory.setHistoryId( (int)System.currentTimeMillis());sendHistory.setIsSend(1);sdpsNoteSendHistoryMapper.insert(sendHistory);}catch (Exception e){SdpsNoteSendHistory sendHistory = new SdpsNoteSendHistory();sendHistory.setClusterId(clusterId);sendHistory.setClusterName(clusterName);sendHistory.setComponentName(componentName);//Date day=new Date();//SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");sendHistory.setCreateTime(new Date());sendHistory.setNote(noteAndConfig.getNote());sendHistory.setText(text);sendHistory.setHistoryId( (int)System.currentTimeMillis());sendHistory.setIsSend(2);sdpsNoteSendHistoryMapper.insert(sendHistory);throw new BusinessException("集群id:"+clusterId+"  短信发送失败:"+smsParamsDTO.getMobiles());}}}}}}}}}//return Result.succeed(null, "集群警告短信通知成功");}}return Result.succeed(null, "集群警告短信通知成功");} catch (Exception e) {log.info("集群警告短信通知失败:", e);return Result.failed("集群警告短信通知失败");}}}return Result.succeed(null, "集群警告短信通知成功");
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/109614.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

TODO Vue typescript forEach的bug,需要再核實

forEach 一個string[]&#xff0c;只有最後一個匹配條件有效&#xff0c;其它條件無效。 所以&#xff0c;只能替換成普通的for循環。 console.log(taskList)// for (const _task of taskList.value) {// if (_task invoiceSendEmail) {// form.value.invoiceSendEmail…

Hadoop3教程(十五):MapReduce中的Combiner

文章目录 &#xff08;103&#xff09;Combiner概述什么是CombinerCombiner有什么用处Combiner有什么特点如何自定义Combiner &#xff08;104&#xff09;Combiner合并案例实操如何从日志里查看Combiner如果不存在Reduce阶段&#xff0c;会发生什么自定义Combiner的两种方式 参…

【SA8295P 源码分析 (二)】68 - Android 侧用户层 输入子系统获取 /dev/input/event0 节点数据 代码流程分析

【SA8295P 源码分析】68 - Android 侧用户层 输入子系统获取 /dev/input/event0 节点数据 代码流程分析 一、EventHub.cpp 监听 /dev/input/event0 节点流程二、EventHub.cpp 读取 /dev/input/event0 节点数据流程系列文章汇总见:《【SA8295P 源码分析 (二)】Display 模块 文章…

【非root用户、CentOS系统】中使用源码安装gcc/g++的教程

1.引言 系统&#xff1a;CentOS-7.9 显卡驱动版本&#xff1a;460 CUDA Version: 11.2 &#x1f33c;基于本地环境选择安装gcc-10.1.0 &#x1f449; gcc下载网址 2.安装说明 下载好对应的gcc的安装包并解压&#xff1a; 打开gcc-10.1.0/contrib/download_prerequisites&#…

Huffman算法

介绍 求解最优二叉树问题通常使用动态规划算法中的一种称为"Huffman算法"或者"Huffman编码"。 Huffman算法的基本思想&#xff1a; 根据节点的频率或者权重构建一棵最优二叉树。最小频率的节点会被放置在树的底部&#xff0c;而较大频率的节点则放置在较…

关于gt_sampling的理解

pcdet/datasets/augmentor/data_augmentor.py def gt_sampling(self, configNone):db_sampler database_sampler.DataBaseSampler(root_pathself.root_path,sampler_cfgconfig,class_namesself.class_names,loggerself.logger)return db_sampler此函数指向DataBaseSampler类&a…

0基础学习VR全景平台篇第109篇:认识拼接软件PTGui Pro

上课&#xff01;全体起立~ 大家好&#xff0c;欢迎观看蛙色官方系列全景摄影课程&#xff01;今天给大家讲解我们全景后期拼接软件PTgui pro&#xff0c;下面我们开始吧&#xff01; &#xff08;PTgui pro软件课程大纲&#xff09; 1.PTGui这个软件是什么 发明人 &#xf…

【网络编程】从网络编程、TCP/IP开始到BIO、NIO入门知识(未完待续...)

目录 前言前置知识一、计算机网络体系结构二、TCP/IP协议族2.1 简介*2.2 TCP/IP网络传输中的数据2.3 地址和端口号2.4 小总结 三、TCP/UDP特性3.1 TCP特性TCP 3次握手TCP 4次挥手TCP头部结构体 3.2 UDP特性 四、总结 课程内容一、网络通信编程基础知识1.1 什么是Socket1.2 长连…

【15】基础知识:React扩展知识

一、setState 1. setState 更新状态的 2 种写法 对象式的 setState 语法&#xff1a;setState(stateChange, [callback]) &#xff08;1&#xff09;stateChange 为状态改变对象&#xff08;该对象可以体现出状态的更改&#xff09; &#xff08;2&#xff09;callback 是…

Python之旅----判断语句

布尔类型和比较运算符 布尔类型 布尔类型的定义 布尔类型的字面量&#xff1a; True 表示真&#xff08;是、肯定&#xff09; False 表示假 &#xff08;否、否定&#xff09; 也就是布尔类型进行判断&#xff0c;只会有2个结果&#xff1a;是或否 定义变量存储布尔类型…

天猫店铺商品评论数据采集,天猫商品评论数据接口,天猫API接口

天猫店铺商品评论数据接口可以获取到商品ID&#xff0c;商品标题&#xff0c;商品优惠券&#xff0c;商品到手价&#xff0c;商品价格&#xff0c;商品优惠价&#xff0c;商品sku属性&#xff0c;商品图片&#xff0c;商品视频&#xff0c;商品sku属性图片&#xff0c;商品属性…

【esp32】arduino-数码管

一、数码管类型 按发光二极管单元连接方式分为共阳型数码管和共阴型数码管&#xff0c; 区分:1、可通过查看数码管引脚类型 2、观察数码管点亮状态 3、查询数码管规格表 二、共阳型数码管 是指将所有发光二极管的阳极接到一起形成公共阳极&#xff08;COM)的数码管 三、共…

Chrome跨域访问网络请求Cookies丢失的解决办法

为了保障网络安全,Chrome对跨域访问有一定的限制。一般分为三级: cookies带有“SameSite=Strict”时,只允许访问同一个域名下的网络请求;cookies带有“SameSite=Lax”时,允许访问同一个域名下的网络请求和同一个根域名下的网络请求;cookies带有“SameSite=None”时,允许…

ant中的environment属性

在ant的配置文件中&#xff0c;可以设置属性environment的值&#xff0c;设置的这个值就作为访问环境变量的前缀。例如声明了environment“env”&#xff0c;那么就可以通过env.<环境变量名称>来访问环境变量。 例如创建了一个Java工程&#xff0c;在工程目录下有一个bu…

HCIA --- VLAN实验配置

一、各交换机上配置&#xff1a; 1、各交换机上创建VLAN 2、交换机上的各个接口划分到对应的VLAN中 3、将与交换机、路由器相连的接口创建trunk干道 SW1&#xff1a; [sw1]vlan batch 2 to 3 批量创建VLAN2-3 [sw1]interface Ethernet0/0/1 单独将某个接口划分到对应…

信息保卫战:揭秘迅软DSE护航企业免受泄密之害

随着网络技术的发展&#xff0c;通过网络应用如网盘、网页、邮件、即时通讯工具传输分享文件变得越来越多&#xff0c;这些工具传输速度快&#xff0c;能够将大容量的文档快速传送给他人&#xff0c;在工作中受到许多人的青睐。 然而由这些传输工具引发的泄密事件也不断增多&am…

【农业生产系统模型】基于R语言APSIM模型进阶应用与参数优化、批量模拟实践技术

随着数字农业和智慧农业的发展&#xff0c;基于过程的农业生产系统模型在模拟作物对气候变化的响应与适应、农田管理优化、作物品种和株型筛选、农田固碳和温室气体排放等领域扮演着越来越重要的作用。APSIM (Agricultural Production Systems sIMulator)模型是世界知名的作物生…

SQL Server 修改、删除表中数据

SQL Server 修改、删除表中数据 修改 SQL Server修改表中数据的关键字是update&#xff08;更新;使现代化;向…提供最新信息;给…增加最新信息&#xff09; 修改表中信息 语法 update 表名 set 字段1值1&#xff0c;字段值2 where 条件1 and 条件2给表中所有人加工资&…

前后端交互—Ajax基础

Ajax 代码下载 URL地址 URL(全称是UniformResourceLocator)中文叫统一资源定位符&#xff0c;用于标识互联网上每个资源的唯一存放位置。 浏览器只有通过URL地址&#xff0c;才能正确定位资源的存放位置&#xff0c;从而成功访问到对应的资源。常见的URL举例: http://www.ba…

视频怎么压缩?视频太大这样处理变小

在当今时代&#xff0c;视频已经成为了我们日常生活中不可或缺的一部分&#xff0c;然而&#xff0c;视频文件往往非常大&#xff0c;给我们的存储和传输带来了很大的不便&#xff0c;那么&#xff0c;如何有效地压缩视频呢&#xff1f; 一、使用压缩软件 首先我们给大家分享一…