| | |
| | | // jointData(jsonArray, columnsList, alarmRuleDetail, flag, personLists, lists, i,uuid,set); |
| | | jointDataV2(jsonArray, columnsList, alarmRuleDetail, roles, flag, personLists, lists, i, uuid, set); |
| | | } |
| | | log.info("告警人员信息:{}", personLists.toString()); |
| | | } |
| | | // 设置信息 |
| | | smsRequestTemplate.setPersonVOList(personLists); |
| | |
| | | String stcd = jsonArray.getJSONObject(i).getString("stcd"); |
| | | if (StringUtil.isBlank(stcd)) { |
| | | stcd = jsonArray.getJSONObject(i).getString("cd"); |
| | | } |
| | | //如果stcd是空的就设置为-1 |
| | | if (StringUtil.isBlank(stcd)){ |
| | | stcd = "-1"; |
| | | } |
| | | // 判断时间是否存在 |
| | | String tm = jsonArray.getJSONObject(i).getString("tm"); |
| | |
| | | list.add(stcd); |
| | | list.add(res_cd); |
| | | list.add(personVO.getPhone()); |
| | | |
| | | //拿测点值 |
| | | String val = ""; |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | val = jsonObject.getString("monitorData"); |
| | | list.add(val); |
| | | if (flag) { |
| | | // 如果是电话告警,需要把日期拼到一起 |
| | | if (alarmRuleDetail.getAlarmMode().equals("电话")) { |
| | |
| | | .eq("temp_code", uuid) |
| | | .eq("alarm_rule_id", alarmRule.getId()) |
| | | .eq("reservoir_number", list.get(1)) |
| | | .eq("alarm_survey_station_code",list.get(0)) |
| | | ); |
| | | if (null != alarmRecord) { |
| | | //删除测值 |
| | | list.remove(3); |
| | | // 删除测站编号 |
| | | list.remove(0); |
| | | return alarmRecord; |
| | |
| | | alarm.setReservoirNumber(list.get(1)); |
| | | alarm.setAlarmCondition(alarmRule.getRuleRemark()); |
| | | alarm.setTempCode(uuid); |
| | | alarm.setMonitorData(list.get(3)); |
| | | //删除测值 |
| | | list.remove(3); |
| | | // 新增 |
| | | boolean save = alarmRecordService.save(alarm); |
| | | // 删除测站编号 |
| | |
| | | messageRecord.setSender(AuthUtil.getUserId().toString()); |
| | | messageRecord.setSource("智能告警"); |
| | | messageRecord.setStatus(0); |
| | | |
| | | // 设置告警记录信息 |
| | | AlarmRecordDetail alarmRecordDetail = new AlarmRecordDetail(); |
| | | alarmRecordDetail.setReservoirNumber(list.get(0)); |
| | |
| | | alarmRecordDetail.setStatus(1); |
| | | // 删除 最后一个 告警记录id |
| | | list.remove(list.size() - 1); |
| | | messageRecord.setResGuid(list.get(0)); |
| | | // 删除 0 水库编码 |
| | | list.remove(0); |
| | | |
| | |
| | | // 按手机号分组 |
| | | Map<String, List<Temp>> listMap = tempList.stream().collect(Collectors.groupingBy(Temp::getPhone)); |
| | | |
| | | |
| | | listMap.forEach((phone, temps) -> { |
| | | List<String> resCdList = new ArrayList<>(); |
| | | MessageRecord messageRecord = new MessageRecord(); |
| | | |
| | | messageRecord.setTheme(alarmRule.getRuleName()); |
| | |
| | | Map<String, List<Temp>> resCollect = temps.stream().collect(Collectors.groupingBy(Temp::getReservoirCode)); |
| | | List<String> contentList = new ArrayList<>(); |
| | | resCollect.forEach((resCode, contentTemp) -> { |
| | | resCdList.add(resCode); |
| | | List<String> cdNmList = new ArrayList<>(); |
| | | //凤凰水库(测点12170062992),大新众水库(测点12170063012、测点12170062998) |
| | | //因为只能按编号分组,名称会有重复,所以拿第一条数据的名称就行 |
| | |
| | | fillList.add(contentListStr); |
| | | String sendContent = contentConvert(smsTemplate.getContent(), fillList); |
| | | messageRecord.setContent(sendContent); |
| | | |
| | | messageRecord.setResGuid(String.join(",",resCdList)); |
| | | messageRecordList.add(messageRecord); |
| | | }); |
| | | |
| | |
| | | messageRecord.setStatus(0); |
| | | messageRecord.setRecipient(phone); |
| | | |
| | | |
| | | StringBuilder builder = new StringBuilder(); |
| | | List<String> resCdList = new ArrayList<>(); |
| | | Map<String, List<Temp>> resCollect = temps.stream().collect(Collectors.groupingBy(Temp::getReservoirCode)); |
| | | List<String> contentList = new ArrayList<>(); |
| | | resCollect.forEach((resCode, contentTemp) -> { |
| | | resCdList.add(resCode); |
| | | |
| | | List<String> cdNmList = new ArrayList<>(); |
| | | //凤凰水库(测点12170062992),大新众水库(测点12170063012、测点12170062998) |
| | | //因为只能按编号分组,名称会有重复,所以拿第一条数据的名称就行 |
| | |
| | | fillList.add(contentListStr); |
| | | String sendContent = contentConvert(smsTemplate.getContent(), fillList); |
| | | messageRecord.setContent(sendContent); |
| | | |
| | | messageRecord.setResGuid(String.join(",",resCdList)); |
| | | messageRecordList.add(messageRecord); |
| | | }); |
| | | |
| | |
| | | // 按手机号分组 |
| | | Map<String, List<Temp>> listMap = tempList.stream().collect(Collectors.groupingBy(Temp::getPhone)); |
| | | |
| | | |
| | | List<String> resCdList = new ArrayList<>(); |
| | | listMap.forEach((phone, temps) -> { |
| | | MessageRecord messageRecord = new MessageRecord(); |
| | | |
| | |
| | | List<String> contentList = new ArrayList<>(); |
| | | //因为只能按编号分组,名称会有重复,所以拿第一条数据的名称就行 |
| | | temps.forEach(info -> { |
| | | resCdList.add(info.getReservoirCode()); |
| | | //把水库加进集合 |
| | | contentList.add(info.getReservoirName()); |
| | | }); |
| | |
| | | fillList.add(contentListStr); |
| | | String sendContent = contentConvert(smsTemplate.getContent(), fillList); |
| | | messageRecord.setContent(sendContent); |
| | | |
| | | messageRecord.setResGuid(String.join(",",resCdList)); |
| | | messageRecordList.add(messageRecord); |
| | | }); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public String getNoAlertRes(String ruleName) { |
| | | return messageClient.getNoAlertRes(ruleName); |
| | | } |
| | | } |