| | |
| | | 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); |
| | | } |
| | | } |