| | |
| | | String county_nm = jsonObject.getString("county_nm"); |
| | | String city_nm = jsonObject.getString("city_nm"); |
| | | log.info("当前为第{}个水库,行政区划:{}-{}-{},水库编码:{},水库名称:{}", i + 1, city_nm, county_nm, town_nm, res_cd, res_nm); |
| | | // 取出测站编码 |
| | | // 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 tempStr = uuid + res_cd; |
| | | // 去重水库操作,如果有重复的水库则不操作 |
| | | if (!set.contains(tempStr)) { |
| | | set.add(tempStr); |
| | | // 取出测站编码 |
| | | String stcd = jsonArray.getJSONObject(i).getString("stcd"); |
| | | if (StringUtil.isBlank(stcd)) { |
| | | stcd = jsonArray.getJSONObject(i).getString("cd"); |
| | |
| | | } |
| | | // 获取告警人员信息 |
| | | // getAlarmPersonList(jsonArray, columnsList, alarmRuleDetail,flag, personLists, lists, i, res_cd, day, hour, minute, stcd); |
| | | getAlarmPersonListV2(jsonArray, columnsList, alarmRuleDetail, roles, flag, personLists, lists, i, res_cd, day, hour, minute, stcd); |
| | | JSONObject jsonData = jsonArray.getJSONObject(i); |
| | | //这里把jsonObject传过去 |
| | | getAlarmPersonListV2(jsonArray, columnsList, alarmRuleDetail, roles, flag, personLists, lists, i, res_cd, day, hour, minute, stcd,jsonData); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void getAlarmPersonListV2(JSONArray jsonArray, List<String> columnsList, AlarmRuleDetail alarmRuleDetail, List<String> roles, Boolean flag, List<PersonVO> personLists, List<List<String>> lists, int i, String res_cd, String day, String hour, String minute, String stcd) { |
| | | private void getAlarmPersonListV2(JSONArray jsonArray, List<String> columnsList, AlarmRuleDetail alarmRuleDetail, List<String> roles, Boolean flag, List<PersonVO> personLists, List<List<String>> lists, int i, String res_cd, String day, String hour, String minute, String stcd,JSONObject jsonData) { |
| | | // 查询告警人员信息 |
| | | // List<PersonVO> personVOList = getPersonListByResGuid(res_cd, alarmRuleDetail.getAlarmPerson()); |
| | | List<PersonVO> personVOList = getPersonListByResGuidV2(res_cd, roles); |
| | |
| | | String format = ""; |
| | | // 内容处理 |
| | | format = addAlarmContent(jsonArray, i, split, format); |
| | | // format = addAlarmContentV2(jsonData,split,format); |
| | | // 加入集合 |
| | | list.add(format); |
| | | } |
| | |
| | | return format; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 告警内容拼接处理 |
| | | * |
| | | * @param split key 值 |
| | | * @param format 值结果 |
| | | * @return |
| | | */ |
| | | private String addAlarmContentV2(JSONObject jsonObject, String[] split, String format) { |
| | | for (String s : split) { |
| | | // 超汛限水位 |
| | | if (s.equals("over_z")) { |
| | | String is_danger_res = "is_danger_res"; |
| | | if (null != jsonObject.getString(is_danger_res) && jsonObject.getString(is_danger_res).equals("true")) { |
| | | format = format + "控制运用水位" + jsonObject.getString(s); |
| | | } else if (null != jsonObject.getString(is_danger_res) && jsonObject.getString(is_danger_res).equals("false")) { |
| | | format = format + "汛限水位" + jsonObject.getString(s); |
| | | } else { |
| | | format = format + jsonObject.getString(s); |
| | | } |
| | | } else if (s.equals("rz")) { |
| | | // 水位 |
| | | String rz = "rz"; |
| | | if (null == jsonObject.getString(rz)) { |
| | | format = format + "无数据"; |
| | | } else { |
| | | format = format + jsonObject.getString(s) + "米"; |
| | | } |
| | | } else if (s.equals("alarm_val")) { |
| | | // 小时雨量 |
| | | String alarm_type = "alarm_type"; |
| | | if (null != jsonObject.getString(alarm_type) && !jsonObject.getString(alarm_type).equals("")) { |
| | | format = format + jsonObject.getString(alarm_type) + "小时坝前点雨量" + jsonObject.getString(s); |
| | | } else { |
| | | format = format + jsonObject.getString(s); |
| | | } |
| | | } else if (s.equals("diff_dam")) { |
| | | String over_chec_fl_stag = "over_chec_fl_stag"; |
| | | // 如果是超校核的需要判断超值 |
| | | if (null != jsonObject.getString(over_chec_fl_stag) && !jsonObject.getString(over_chec_fl_stag).equals("")) { |
| | | // 校核,是否漫过坝顶(正数代表未漫过坝顶,负数则反之) |
| | | String diff_dam = jsonObject.getString(s); |
| | | double parseDouble = Double.parseDouble(diff_dam); |
| | | if (parseDouble > 0) { |
| | | format = format + "距离大坝坝顶仅" + jsonObject.getString(s); |
| | | } else { |
| | | format = format + "已漫过坝顶" + (-parseDouble); |
| | | } |
| | | } else { |
| | | format = format + jsonObject.getString(s); |
| | | } |
| | | } else if (s.equals("ms_flag")) { |
| | | // 水位 |
| | | String ms_flag = "ms_flag"; |
| | | if (null != jsonObject.getString(ms_flag) && jsonObject.getString(ms_flag).equals("sy")) { |
| | | format = format + "渗压"; |
| | | } else if (null != jsonObject.getString(ms_flag) && jsonObject.getString(ms_flag).equals("sl")) { |
| | | format = format + "渗流"; |
| | | } else if (null != jsonObject.getString(ms_flag) && jsonObject.getString(ms_flag).equals("by")) { |
| | | format = format + "白蚁"; |
| | | } else if (null != jsonObject.getString(ms_flag) && jsonObject.getString(ms_flag).equals("bx")) { |
| | | format = format + "变形"; |
| | | } else { |
| | | format = format + jsonObject.getString(s); |
| | | } |
| | | } else { |
| | | format = format + jsonObject.getString(s); |
| | | } |
| | | } |
| | | // 返回 |
| | | return format; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存告警记录信息 |
| | | * |