| | |
| | | }}; |
| | | |
| | | /** |
| | | * 水位接近汛限告警 |
| | | */ |
| | | public static List<String> waterComeOverList = new ArrayList<String>() |
| | | {{ |
| | | add("town_nm"); |
| | | add("res_nm"); |
| | | add("rz"); |
| | | add("over_1h"); |
| | | add("over_z"); |
| | | add("drp_24"); |
| | | }}; |
| | | |
| | | /** |
| | | * 水位初次超汛限告警(水库技术责任人、巡查责任人) |
| | | */ |
| | | public static List<String> waterFirstOverList = new ArrayList<String>() |
| | |
| | | }}; |
| | | |
| | | /** |
| | | * 水位初次超汛限告警(水库技术责任人、巡查责任人) |
| | | * 水位超设计洪水位告警处理 |
| | | */ |
| | | public static List<String> waterMoreDesignList = new ArrayList<String>() |
| | | {{ |
| | |
| | | public static final String res_diff_dead_z_api = "/services/1234567890ABCDEFGHIJKLMN/res/diff_dead_z"; |
| | | |
| | | /** |
| | | * 水位接近汛限告警 |
| | | */ |
| | | public static final String res_z_is_warn_over_flse_api = "/services/1234567890ABCDEFGHIJKLMN/res_z_is_warn/over_flse"; |
| | | |
| | | /** |
| | | * 水位初次超汛限告警 |
| | | */ |
| | | public static final String over_z_res_api = "/services/1234567890ABCDEFGHIJKLMN/over_z_res"; |
| | | |
| | | /** |
| | | * 水位小幅超汛限告警 |
| | | */ |
| | | public static final String res_over_z_small_over_api = "/services/1234567890ABCDEFGHIJKLMN/res_over_z/small_over"; |
| | | |
| | | /** |
| | | * 水位大幅超汛限告警 |
| | | */ |
| | | public static final String res_over_z_big_over_api = "/services/1234567890ABCDEFGHIJKLMN/res_over_z/big_over"; |
| | | |
| | | /** |
| | | * 水位超设计洪水位告警处理 |
| | | */ |
| | | public static final String over_des_rz_warn_api = "/services/1234567890ABCDEFGHIJKLMN/over_des_rz/warn"; |
| | |
| | | import cn.gistack.alerts.alarmRule.entity.AlarmRule; |
| | | import cn.gistack.alerts.notice.constant.ZtApiDataColumnConstant; |
| | | import cn.gistack.alerts.notice.constant.ZtApiUrlConstant; |
| | | import cn.gistack.alerts.notice.enums.DangerEnum; |
| | | import cn.gistack.alerts.sms.service.SmsService; |
| | | import cn.gistack.alerts.sms.vo.SmsRequestTemplate; |
| | | import com.alibaba.fastjson.JSONArray; |
| | |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.no_z_last_api_all); |
| | | // 只发短信,将发短信信息组装好 |
| | | SmsRequestTemplate smsRequestTemplate = noticeHandle.getSendSmsTemplate(ztData, templateId,alarmRule, ZtApiDataColumnConstant.waterInfoNotList,false,adCode,uuid); |
| | | SmsRequestTemplate smsRequestTemplate |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId,alarmRule, ZtApiDataColumnConstant.waterInfoNotList,false,adCode,uuid,null); |
| | | smsRequestTemplate.setIsSendStation(isSendStation); |
| | | // 遍历 |
| | | for (List<String> list : smsRequestTemplate.getTemplateContent()) { |
| | | // 保存告警记录信息 |
| | |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.res_z_not_normal_api); |
| | | // 只发短信,将发短信信息组装好 |
| | | SmsRequestTemplate smsRequestTemplate = noticeHandle.getSendSmsTemplate(ztData, templateId,alarmRule, ZtApiDataColumnConstant.waterDataExcList,false,adCode,uuid); |
| | | SmsRequestTemplate smsRequestTemplate |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId,alarmRule, ZtApiDataColumnConstant.waterDataExcList,false,adCode,uuid,null); |
| | | smsRequestTemplate.setIsSendStation(isSendStation); |
| | | // 遍历 |
| | | for (List<String> list : smsRequestTemplate.getTemplateContent()) { |
| | | // 保存告警记录信息 |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.res_diff_dead_z_api); |
| | | // 只发送站内信 |
| | | SmsRequestTemplate smsRequestTemplate = noticeHandle.getSendSmsTemplate(ztData, templateId,alarmRule, ZtApiDataColumnConstant.waterLessDeadList,true,adCode,uuid); |
| | | // 获取需要发送的信息 |
| | | SmsRequestTemplate smsRequestTemplate |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId,alarmRule, ZtApiDataColumnConstant.waterLessDeadList,true,adCode,uuid,null); |
| | | smsRequestTemplate.setIsSendStation(isSendStation); |
| | | // 拼接内容后面的联系方式,当前模板县水利部人员姓名电话 |
| | | if (smsRequestTemplate.getPersonVOList().size()>0) { |
| | | // 遍历,拼接县水利部人员电话 |
| | |
| | | * @param adCode |
| | | */ |
| | | @Async |
| | | public void waterComeOverHandle(String templateId, String uuid, AlarmRule alarmRule, String adCode) { |
| | | public void waterComeOverHandle(String templateId, String uuid, AlarmRule alarmRule, String adCode,Boolean isSendStation) { |
| | | // 调用中台服务接口查询数据 |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.res_diff_dead_z_api); |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.res_z_is_warn_over_flse_api); |
| | | // 只发送站内信 |
| | | SmsRequestTemplate smsRequestTemplate = noticeHandle.getSendSmsTemplate(ztData, templateId,alarmRule, ZtApiDataColumnConstant.waterLessDeadList,true,null,uuid); |
| | | SmsRequestTemplate smsRequestTemplate = noticeHandle.getSendSmsTemplate(ztData, templateId,alarmRule, ZtApiDataColumnConstant.waterComeOverList,true,adCode,uuid, DangerEnum.DISTANCE.getValue()); |
| | | smsRequestTemplate.setIsSendStation(isSendStation); |
| | | // 拼接内容后面的联系方式,当前模板县水利部人员姓名电话 |
| | | if (smsRequestTemplate.getPersonVOList().size()>0) { |
| | | // 遍历,拼接县水利部人员电话 |
| | | for (List<String> list : smsRequestTemplate.getTemplateContent()) { |
| | | // 后面依次拼接 巡查责任人姓名,技术责任人姓名,市县水利部门人员姓名电话(暂时不要) |
| | | // 后面依次拼接 巡查责任人姓名,技术责任人姓名, |
| | | noticeHandle.addPatrolTechnologyInfo(list); |
| | | // 市县水利部门人员姓名电话(暂时不要) |
| | | // list.add("测试:13112341234"); |
| | | // 拼接市县水利部人员姓名及联系方式 |
| | | noticeHandle.addCityCountyBusinessPersonInfo(list); |
| | | // 保存告警记录信息 |
| | | // AlarmRecord alarmRecord = noticeHandle.saveAlarmRecord(list,alarmRule,uuid); |
| | | // if (null != alarmRecord) { |
| | | // list.add(alarmRecord.getId().toString()); |
| | | list.add("999"); |
| | | // } |
| | | AlarmRecord alarmRecord = noticeHandle.saveAlarmRecord(list,alarmRule,uuid); |
| | | if (null != alarmRecord) { |
| | | list.add(alarmRecord.getId().toString()); |
| | | } |
| | | } |
| | | } |
| | | // 保存站内信记录信息 |
| | |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.over_z_res_api); |
| | | // 只发短信,将发短信信息组装好 |
| | | SmsRequestTemplate smsRequestTemplate |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId,alarmRule, ZtApiDataColumnConstant.waterFirstOverList,true,adCode,uuid); |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId,alarmRule, ZtApiDataColumnConstant.waterFirstOverList,true,adCode,uuid,DangerEnum.OVER.getValue()); |
| | | smsRequestTemplate.setIsSendStation(isSendStation); |
| | | |
| | | // 拼接后面内容 |
| | |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.over_des_rz_warn_api); |
| | | // 只发短信,将发短信信息组装好 |
| | | SmsRequestTemplate smsRequestTemplate |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId, alarmRule, ZtApiDataColumnConstant.waterMoreDesignList, true, null,uuid); |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId, alarmRule, ZtApiDataColumnConstant.waterMoreDesignList, true, null,uuid,null); |
| | | // 拼接后面内容 |
| | | if (smsRequestTemplate.getPersonVOList().size() > 0) { |
| | | for (List<String> list : smsRequestTemplate.getTemplateContent()) { |
| | |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.alarm_rain_dy_api); |
| | | // 只发短信,将发短信信息组装好 |
| | | SmsRequestTemplate smsRequestTemplate |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId, alarmRule, ZtApiDataColumnConstant.alreadyHeavyRainList, false, adCode,uuid); |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId, alarmRule, ZtApiDataColumnConstant.alreadyHeavyRainList, false, adCode,uuid,null); |
| | | // 拼接后面内容 |
| | | if (smsRequestTemplate.getPersonVOList().size() > 0) { |
| | | for (List<String> list : smsRequestTemplate.getTemplateContent()) { |
| | |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.alarm_rain_by_api); |
| | | // 只发短信,将发短信信息组装好 |
| | | SmsRequestTemplate smsRequestTemplate |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId, alarmRule, ZtApiDataColumnConstant.alreadyRainstormList, false, adCode,uuid); |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId, alarmRule, ZtApiDataColumnConstant.alreadyRainstormList, false, adCode,uuid,null); |
| | | // 拼接后面内容 |
| | | if (smsRequestTemplate.getPersonVOList().size() > 0) { |
| | | for (List<String> list : smsRequestTemplate.getTemplateContent()) { |
| | |
| | | JSONArray ztData = noticeHandle.getZtData("", ZtApiUrlConstant.alarm_rain_6_over_api); |
| | | // 只发短信,将发短信信息组装好 |
| | | SmsRequestTemplate smsRequestTemplate |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId, alarmRule, ZtApiDataColumnConstant.sixHourRainList, false, adCode,uuid); |
| | | = noticeHandle.getSendSmsTemplate(ztData, templateId, alarmRule, ZtApiDataColumnConstant.sixHourRainList, false, adCode,uuid,null); |
| | | // 拼接后面内容 |
| | | if (smsRequestTemplate.getPersonVOList().size() > 0) { |
| | | for (List<String> list : smsRequestTemplate.getTemplateContent()) { |
| | |
| | | List<String> columnsList, |
| | | Boolean flag, |
| | | String adCode, |
| | | String uuid) { |
| | | String uuid, |
| | | String dangerValue) { |
| | | // 通过模板id 查询模板相关信息 |
| | | SmsTemplate smsTemplate = smsTemplateService.getOne(new QueryWrapper<SmsTemplate>().eq("template_id",templateId).eq("is_deleted",0)); |
| | | if (null != smsTemplate) { |
| | |
| | | // 解析模板并设置 title |
| | | smsRequestTemplate.setTitle(FormatUtil.composeMessage(smsTemplate.getContent())); |
| | | // 列名数据转换 |
| | | getColumnData(jsonArray, columnsList,smsRequestTemplate,alarmRule,flag,adCode,uuid); |
| | | getColumnData(jsonArray, columnsList,smsRequestTemplate,alarmRule,flag,adCode,uuid,dangerValue); |
| | | //返回 |
| | | return smsRequestTemplate; |
| | | } |
| | |
| | | AlarmRule alarmRule, |
| | | Boolean flag, |
| | | String adCode, |
| | | String uuid) { |
| | | String uuid, |
| | | String dangerValue) { |
| | | List<PersonVO> personLists = new ArrayList<>(); |
| | | List<List<String>> lists = new ArrayList<>(); |
| | | Set<String> set = new HashSet<>(); |
| | |
| | | // city_cd,county_cd 过滤数据 |
| | | String county_cd = jsonArray.getJSONObject(i).getString("county_cd"); |
| | | if (null!= county_cd && county_cd.equals(adCode)) { |
| | | jointData(jsonArray, columnsList, alarmRule, flag, personLists, lists, i,uuid,set); |
| | | jointData(jsonArray, columnsList, alarmRule, flag, personLists, lists, i,uuid,set,dangerValue); |
| | | } |
| | | }else { |
| | | jointData(jsonArray, columnsList, alarmRule, flag, personLists, lists, i,uuid,set); |
| | | jointData(jsonArray, columnsList, alarmRule, flag, personLists, lists, i,uuid,set,dangerValue); |
| | | } |
| | | } |
| | | // 设置信息 |
| | |
| | | List<List<String>> lists, |
| | | int i, |
| | | String uuid, |
| | | Set<String> set) { |
| | | Set<String> set, |
| | | String dangerValue) { |
| | | // 根据水库编号,所在区域查询需要发送的人员手机号及设置 |
| | | String res_cd = jsonArray.getJSONObject(i).getString("res_cd"); |
| | | String tempStr = uuid + res_cd; |
| | |
| | | flag = false; |
| | | } |
| | | // 获取告警人员信息 |
| | | getAlarmPersonList(jsonArray, columnsList, alarmRule, flag, personLists, lists, i, res_cd, day, hour, minute, stcd); |
| | | getAlarmPersonList(jsonArray, columnsList, alarmRule, flag, personLists, lists, i, res_cd, day, hour, minute, stcd,dangerValue); |
| | | } |
| | | } |
| | | |
| | |
| | | String day, |
| | | String hour, |
| | | String minute, |
| | | String stcd) { |
| | | String stcd, |
| | | String dangerValue) { |
| | | // 查询告警人员信息 |
| | | List<PersonVO> personVOList = getPersonListByResGuid(res_cd, alarmRule); |
| | | if (personVOList.size() > 0) { |
| | |
| | | if (s.equals("over_z")) { |
| | | String is_danger_res = "is_danger_res"; |
| | | if (jsonArray.getJSONObject(i).getString(is_danger_res).equals("true")) { |
| | | format = format + "超过控制运用水位" + jsonArray.getJSONObject(i).getString(s); |
| | | format = format + dangerValue + "控制运用水位" + jsonArray.getJSONObject(i).getString(s); |
| | | } else if (jsonArray.getJSONObject(i).getString(is_danger_res).equals("false")) { |
| | | format = format + "超过汛限水位" + jsonArray.getJSONObject(i).getString(s); |
| | | format = format + dangerValue + "汛限水位" + jsonArray.getJSONObject(i).getString(s); |
| | | } else { |
| | | format = format + jsonArray.getJSONObject(i).getString(s); |
| | | } |
| | |
| | | } |
| | | // 保存告警记录详情信息 |
| | | if (smsRequestTemplate.getIsSendStation()) { |
| | | saveMessageRecord(messageRecordList); |
| | | // saveMessageRecord(messageRecordList); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(2); |
| | | // 返回 |
| | |
| | | R<List<User>> listR = userClient.userInfoByPhone("000000", messageRecord.getRecipient()); |
| | | messageRecord.setRecipient(listR.getData().get(0).getId().toString()); |
| | | } |
| | | |
| | | // List<MessageRecord> messageRecordList1 = new ArrayList<>(); |
| | | // addSendMsgTest(messageRecordList1); |
| | | //给app推送消息 |
| | | // pushService.pushMessageList(messageRecordList1); |
| | | pushService.pushMessageList(messageRecordList); |
| | | |
| | | // 保存记录 |
| | |
| | | SSEServer.sendMessage("web:"+messageRecord.getRecipient(),new JSONObject(map).toJSONString()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增测试信息 |
| | | * @param messageRecordList |
| | | */ |
| | | private void addSendMsgTest(List<MessageRecord> messageRecordList) { |
| | | MessageRecord messageRecord = new MessageRecord(); |
| | | messageRecord.setRecipient("1654164141753593858"); |
| | | messageRecord.setContent("cs12121212=========="); |
| | | messageRecord.setTheme("接近超汛告警"); |
| | | messageRecord.setSender(AuthUtil.getUserId().toString()); |
| | | messageRecord.setSource("智能告警"); |
| | | messageRecord.setStatus(0); |
| | | // 加入集合 |
| | | messageRecordList.add(messageRecord); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 策略5: 水位接近汛限告警 |
| | | * 策略5: 水位接近汛限告警(站内信) |
| | | * |
| | | * @param arg1 |
| | | * @param arg2 |
| | |
| | | // 查询当前策略对应的告警规则信息 |
| | | AlarmRule alarmRule = alarmRuleService.getOne(new QueryWrapper<AlarmRule>().eq("rule_name", arg1)); |
| | | if (null!=alarmRule) { |
| | | asyncNoticeHandle.waterComeOverHandle(templateId,uuid,alarmRule, null); |
| | | asyncNoticeHandle.waterComeOverHandle(templateId,uuid,alarmRule, adCode,true); |
| | | } |
| | | return "水位接近汛限告警"; |
| | | } |