| | |
| | | if (alarmRuleDetail.getAlarmMode().equals("短信")) { |
| | | asyncNoticeHandle.damSafetyHandle(alarmRule, alarmRuleDetail, ztData, ZtApiDataColumnConstant.damSafetyList, true, adCode, false, uuid); |
| | | } |
| | | if (alarmRuleDetail.getAlarmMode().equals("站内信")) { |
| | | asyncNoticeHandle.damSafetySyHandle(alarmRule, alarmRuleDetail, ztData, ZtApiDataColumnConstant.damSafetyList, true, adCode, true, uuid); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | return "近1h水位陡降告警"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 变形值大于20mm小于50mm |
| | | * |
| | | * @param arg1 |
| | | * @param arg2 |
| | | * @return |
| | | */ |
| | | public String damSafetyWyOver2Less5Handle(String arg1, String arg2) { |
| | | |
| | | String adCode = null; |
| | | String uuid = UUID.randomUUID().toString(); |
| | | // 查询当前策略对应的告警规则信息 |
| | | AlarmRule alarmRule = alarmRuleService.getOne(new QueryWrapper<AlarmRule>().eq("rule_name", arg1)); |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.alarm_db_wy_value_api); |
| | | |
| | | JSONArray data = judgeDirection(ztData, "1"); |
| | | |
| | | // 获取告警规则详情,判断告警类型(短信,电话,站内信) |
| | | if (null != alarmRule) { |
| | | // 查询告警详情信息 |
| | | List<AlarmRuleDetail> alarmRuleDetailList = alarmRuleDetailService.list(new QueryWrapper<AlarmRuleDetail>().eq("alarm_rule_id", alarmRule.getId())); |
| | | if (alarmRuleDetailList.size() > 0) { |
| | | // 遍历 |
| | | for (AlarmRuleDetail alarmRuleDetail : alarmRuleDetailList) { |
| | | if (alarmRuleDetail.getAlarmMode().equals("短信")) { |
| | | asyncNoticeHandle.damSafetyWyOver2Less5HandleSms(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wyOver2Less5, true, adCode, false, uuid); |
| | | } |
| | | if (alarmRuleDetail.getAlarmMode().equals("站内信")) { |
| | | asyncNoticeHandle.damSafetyWyOver2Less5HandleStation(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wyOver2Less5, true, adCode, true, uuid); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return "变形值大于2cm小于5cm告警"; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 变形值大于50mm小于100mm |
| | | * |
| | | * @param arg1 |
| | | * @param arg2 |
| | | * @return |
| | | */ |
| | | public String damSafetyWyOver5Less10Handle(String arg1, String arg2) { |
| | | |
| | | String adCode = null; |
| | | String uuid = UUID.randomUUID().toString(); |
| | | // 查询当前策略对应的告警规则信息 |
| | | AlarmRule alarmRule = alarmRuleService.getOne(new QueryWrapper<AlarmRule>().eq("rule_name", arg1)); |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.alarm_db_wy_value_api); |
| | | |
| | | JSONArray data = judgeDirection(ztData, "2"); |
| | | |
| | | // 获取告警规则详情,判断告警类型(短信,电话,站内信) |
| | | if (null != alarmRule) { |
| | | // 查询告警详情信息 |
| | | List<AlarmRuleDetail> alarmRuleDetailList = alarmRuleDetailService.list(new QueryWrapper<AlarmRuleDetail>().eq("alarm_rule_id", alarmRule.getId())); |
| | | if (alarmRuleDetailList.size() > 0) { |
| | | // 遍历 |
| | | for (AlarmRuleDetail alarmRuleDetail : alarmRuleDetailList) { |
| | | if (alarmRuleDetail.getAlarmMode().equals("短信")) { |
| | | asyncNoticeHandle.damSafetyWyOver5Less10HandleSms(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wyOver5Less10, true, adCode, false, uuid); |
| | | } |
| | | if (alarmRuleDetail.getAlarmMode().equals("站内信")) { |
| | | asyncNoticeHandle.damSafetyWyOver5Less10HandleStation(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wyOver5Less10, true, adCode, true, uuid); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return "变形值大于5cm小于10cm告警"; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 近1h变形值大于10cm以上 |
| | | * |
| | | * @param arg1 |
| | | * @param arg2 |
| | | * @return |
| | | */ |
| | | public String damSafetyWyOver10Handle(String arg1, String arg2) { |
| | | |
| | | String adCode = null; |
| | | String uuid = UUID.randomUUID().toString(); |
| | | // 查询当前策略对应的告警规则信息 |
| | | AlarmRule alarmRule = alarmRuleService.getOne(new QueryWrapper<AlarmRule>().eq("rule_name", arg1)); |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.alarm_db_wy_value_1h_change_over_10_api); |
| | | JSONArray data = judgeDirection(ztData, "3"); |
| | | // 获取告警规则详情,判断告警类型(短信,电话,站内信) |
| | | if (null != alarmRule) { |
| | | // 查询告警详情信息 |
| | | List<AlarmRuleDetail> alarmRuleDetailList = alarmRuleDetailService.list(new QueryWrapper<AlarmRuleDetail>().eq("alarm_rule_id", alarmRule.getId())); |
| | | if (alarmRuleDetailList.size() > 0) { |
| | | // 遍历 |
| | | for (AlarmRuleDetail alarmRuleDetail : alarmRuleDetailList) { |
| | | if (alarmRuleDetail.getAlarmMode().equals("短信")) { |
| | | asyncNoticeHandle.damSafetyWyOver10HandleSms(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wyOver10, true, adCode, false, uuid); |
| | | } |
| | | if (alarmRuleDetail.getAlarmMode().equals("站内信")) { |
| | | asyncNoticeHandle.damSafetyWyOver10HandleStation(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wyOver10, true, adCode, true, uuid); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return "变形值大于10cm告警"; |
| | | } |
| | | |
| | | /** |
| | | * 近1h变形值大于10cm以上 |
| | | * |
| | | * @param arg1 |
| | | * @param arg2 |
| | | * @return |
| | | */ |
| | | public String damSafetyWy1hChangeOver10Handle(String arg1, String arg2) { |
| | | |
| | | String adCode = null; |
| | | String uuid = UUID.randomUUID().toString(); |
| | | // 查询当前策略对应的告警规则信息 |
| | | AlarmRule alarmRule = alarmRuleService.getOne(new QueryWrapper<AlarmRule>().eq("rule_name", arg1)); |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.alarm_db_wy_value_1h_change_over_10_api); |
| | | JSONArray data = judgeDirectionV2(ztData); |
| | | // 获取告警规则详情,判断告警类型(短信,电话,站内信) |
| | | if (null != alarmRule) { |
| | | // 查询告警详情信息 |
| | | List<AlarmRuleDetail> alarmRuleDetailList = alarmRuleDetailService.list(new QueryWrapper<AlarmRuleDetail>().eq("alarm_rule_id", alarmRule.getId())); |
| | | if (alarmRuleDetailList.size() > 0) { |
| | | // 遍历 |
| | | for (AlarmRuleDetail alarmRuleDetail : alarmRuleDetailList) { |
| | | if (alarmRuleDetail.getAlarmMode().equals("短信")) { |
| | | asyncNoticeHandle.damSafetyWy1hChangeOver10HandleSms(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wy1hChangeOver10, true, adCode, false, uuid); |
| | | } |
| | | if (alarmRuleDetail.getAlarmMode().equals("站内信")) { |
| | | asyncNoticeHandle.damSafetyWy1hChangeOver10HandleStation(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wy1hChangeOver10, true, adCode, true, uuid); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return "近1h变形值大于10cm以上告警"; |
| | | } |
| | | |
| | | public String damSafetySlOver5Less8Handle(String arg1, String arg2) { |
| | | |
| | | String adCode = null; |
| | | String uuid = UUID.randomUUID().toString(); |
| | | // 查询当前策略对应的告警规则信息 |
| | | AlarmRule alarmRule = alarmRuleService.getOne(new QueryWrapper<AlarmRule>().eq("rule_name", arg1)); |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.alarm_db_sl_value_change_api); |
| | | JSONArray data = filterData(ztData,"1"); |
| | | // 获取告警规则详情,判断告警类型(短信,电话,站内信) |
| | | if (null != alarmRule) { |
| | | // 查询告警详情信息 |
| | | List<AlarmRuleDetail> alarmRuleDetailList = alarmRuleDetailService.list(new QueryWrapper<AlarmRuleDetail>().eq("alarm_rule_id", alarmRule.getId())); |
| | | if (alarmRuleDetailList.size() > 0) { |
| | | // 遍历 |
| | | for (AlarmRuleDetail alarmRuleDetail : alarmRuleDetailList) { |
| | | if (alarmRuleDetail.getAlarmMode().equals("短信")) { |
| | | asyncNoticeHandle.damSafetySlOverLessHandleSms(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wy1hChangeOver10, true, adCode, false, uuid); |
| | | } |
| | | if (alarmRuleDetail.getAlarmMode().equals("站内信")) { |
| | | asyncNoticeHandle.damSafetySlOverLessHandleStation(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wy1hChangeOver10, true, adCode, true, uuid); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return "渗流量一日大于5L小于8L,连续3日增加告警"; |
| | | } |
| | | |
| | | |
| | | public String damSafetySlOver8Less10Handle(String arg1, String arg2) { |
| | | |
| | | String adCode = null; |
| | | String uuid = UUID.randomUUID().toString(); |
| | | // 查询当前策略对应的告警规则信息 |
| | | AlarmRule alarmRule = alarmRuleService.getOne(new QueryWrapper<AlarmRule>().eq("rule_name", arg1)); |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.alarm_db_sl_value_change_api); |
| | | JSONArray data = filterData(ztData,"2"); |
| | | // 获取告警规则详情,判断告警类型(短信,电话,站内信) |
| | | if (null != alarmRule) { |
| | | // 查询告警详情信息 |
| | | List<AlarmRuleDetail> alarmRuleDetailList = alarmRuleDetailService.list(new QueryWrapper<AlarmRuleDetail>().eq("alarm_rule_id", alarmRule.getId())); |
| | | if (alarmRuleDetailList.size() > 0) { |
| | | // 遍历 |
| | | for (AlarmRuleDetail alarmRuleDetail : alarmRuleDetailList) { |
| | | if (alarmRuleDetail.getAlarmMode().equals("短信")) { |
| | | asyncNoticeHandle.damSafetySlOverLessHandleSms(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wy1hChangeOver10, true, adCode, false, uuid); |
| | | } |
| | | if (alarmRuleDetail.getAlarmMode().equals("站内信")) { |
| | | asyncNoticeHandle.damSafetySlOverLessHandleStation(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wy1hChangeOver10, true, adCode, true, uuid); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return "渗流量一日大于5L小于8L,连续3日增加告警"; |
| | | } |
| | | |
| | | |
| | | |
| | | public String damSafetySlOver10Handle(String arg1, String arg2) { |
| | | |
| | | String adCode = null; |
| | | String uuid = UUID.randomUUID().toString(); |
| | | // 查询当前策略对应的告警规则信息 |
| | | AlarmRule alarmRule = alarmRuleService.getOne(new QueryWrapper<AlarmRule>().eq("rule_name", arg1)); |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.alarm_db_sl_value_change_api); |
| | | JSONArray data = filterData(ztData,"3"); |
| | | // 获取告警规则详情,判断告警类型(短信,电话,站内信) |
| | | if (null != alarmRule) { |
| | | // 查询告警详情信息 |
| | | List<AlarmRuleDetail> alarmRuleDetailList = alarmRuleDetailService.list(new QueryWrapper<AlarmRuleDetail>().eq("alarm_rule_id", alarmRule.getId())); |
| | | if (alarmRuleDetailList.size() > 0) { |
| | | // 遍历 |
| | | for (AlarmRuleDetail alarmRuleDetail : alarmRuleDetailList) { |
| | | if (alarmRuleDetail.getAlarmMode().equals("短信")) { |
| | | asyncNoticeHandle.damSafetySlOverLessHandleSms(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wy1hChangeOver10, true, adCode, false, uuid); |
| | | } |
| | | if (alarmRuleDetail.getAlarmMode().equals("站内信")) { |
| | | asyncNoticeHandle.damSafetySlOverLessHandleStation(alarmRule, alarmRuleDetail, data, ZtApiDataColumnConstant.wy1hChangeOver10, true, adCode, true, uuid); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return "渗流量一日大于5L小于8L,连续3日增加告警"; |
| | | } |
| | | |
| | | |
| | | |
| | | private JSONArray filterData(JSONArray ztData, String level) { |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < ztData.size(); i++) { |
| | | JSONObject jsonObject = ztData.getJSONObject(i); |
| | | String dataLevel = jsonObject.getString("level"); |
| | | |
| | | if (dataLevel.equals(level)) { |
| | | array.add(jsonObject); |
| | | } |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | /** |
| | | * 判断方向 |
| | | * |
| | | * @param ztData |
| | | * @return |
| | | */ |
| | | private JSONArray judgeDirectionV2(JSONArray ztData) { |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < ztData.size(); i++) { |
| | | JSONObject jsonObject = ztData.getJSONObject(i); |
| | | //上下游方向 |
| | | Double diffDe = jsonObject.getDouble("diff_de"); |
| | | //左右岸方向 |
| | | Double diffDn = jsonObject.getDouble("diff_dn"); |
| | | //垂直 |
| | | Double diffDu = jsonObject.getDouble("diff_du"); |
| | | |
| | | String direction = ""; |
| | | String val = ""; |
| | | //近1h变形值大于10cm以上 |
| | | if (diffDe > 100) { |
| | | direction = "上下游方向"; |
| | | val = diffDe.toString(); |
| | | } else if (diffDn > 100) { |
| | | direction = "左右岸方向"; |
| | | val = diffDn.toString(); |
| | | } else if (diffDu > 100) { |
| | | direction = "垂直"; |
| | | val = diffDu.toString(); |
| | | } |
| | | |
| | | jsonObject.put("direction", direction); |
| | | jsonObject.put("val", val); |
| | | array.add(jsonObject); |
| | | |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断方向 |
| | | * |
| | | * @param ztData |
| | | * @return |
| | | */ |
| | | private JSONArray judgeDirection(JSONArray ztData, String level) { |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < ztData.size(); i++) { |
| | | JSONObject jsonObject = ztData.getJSONObject(i); |
| | | String dataLevel = jsonObject.getString("level"); |
| | | //上下游方向 |
| | | Double deVal = jsonObject.getDouble("de_val"); |
| | | //左右岸方向 |
| | | Double dnVal = jsonObject.getDouble("dn_val"); |
| | | //垂直 |
| | | Double duValue = jsonObject.getDouble("du_value"); |
| | | |
| | | String direction = ""; |
| | | String val = ""; |
| | | |
| | | if (dataLevel.equals(level)) { |
| | | if (level.equals("1")) { |
| | | //变形值大于20mm小于50mm |
| | | if (20 < deVal && deVal < 50) { |
| | | direction = "上下游方向"; |
| | | val = deVal.toString(); |
| | | } else if (20 < dnVal && dnVal < 50) { |
| | | direction = "左右岸方向"; |
| | | val = dnVal.toString(); |
| | | } else if (20 < duValue && duValue < 50) { |
| | | direction = "垂直"; |
| | | val = duValue.toString(); |
| | | } |
| | | } else if (level.equals("2")) { |
| | | //变形值大于50mm小于100mm |
| | | if (50 < deVal && deVal < 100) { |
| | | direction = "上下游方向"; |
| | | val = deVal.toString(); |
| | | } else if (50 < dnVal && dnVal < 100) { |
| | | direction = "左右岸方向"; |
| | | val = dnVal.toString(); |
| | | } else if (50 < duValue && duValue < 100) { |
| | | direction = "垂直"; |
| | | val = duValue.toString(); |
| | | } |
| | | } else if (level.equals("3")) { |
| | | //变形值大于100mm |
| | | |
| | | if (deVal > 100) { |
| | | direction = "上下游方向"; |
| | | val = deVal.toString(); |
| | | } else if (dnVal > 100) { |
| | | direction = "左右岸方向"; |
| | | val = dnVal.toString(); |
| | | } else if (duValue > 100) { |
| | | direction = "垂直"; |
| | | val = duValue.toString(); |
| | | } |
| | | } |
| | | |
| | | jsonObject.put("direction", direction); |
| | | jsonObject.put("val", val); |
| | | array.add(jsonObject); |
| | | } |
| | | |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | |
| | | private JSONArray judgeType(JSONArray ztData) { |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < ztData.size(); i++) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | } |