| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.google.common.collect.Lists; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | |
| | | set.add(tempStr); |
| | | String stcd = jsonArray.getJSONObject(i).getString("stcd"); |
| | | if (StringUtil.isBlank(stcd)) { |
| | | stcd = jsonArray.getJSONObject(i).getString("rain_stcd"); |
| | | } |
| | | if (StringUtil.isBlank(stcd)) { |
| | | stcd = jsonArray.getJSONObject(i).getString("cd"); |
| | | } |
| | | //如果stcd是空的就设置为-1 |
| | |
| | | // 加入集合 |
| | | list.add(format); |
| | | } |
| | | lists.add(list); |
| | | //处理重复发送手机号 |
| | | boolean isAdd = true; |
| | | for (List<String> listStr : lists) { |
| | | if (listStr.contains(res_cd) && listStr.contains(personVO.getPhone())) { |
| | | isAdd = false; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (isAdd) |
| | | lists.add(list); |
| | | } |
| | | } |
| | | personLists.addAll(personVOList); |
| | |
| | | return format; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存告警记录信息 |
| | | * |
| | |
| | | */ |
| | | public AlarmRecord saveAlarmRecord(List<String> list, AlarmRule alarmRule, String uuid) { |
| | | AlarmRecord alarmRecord = alarmRecordService.getOne(new QueryWrapper<AlarmRecord>() |
| | | // .eq("temp_code", uuid) |
| | | .eq("temp_code", uuid) |
| | | .eq("alarm_rule_id", alarmRule.getId()) |
| | | .eq("reservoir_number", list.get(1)) |
| | | .eq("alarm_survey_station_code",list.get(0)) |
| | | // .eq("alarm_survey_station_code",list.get(0)) |
| | | ); |
| | | if (null != alarmRecord) { |
| | | |
| | | if (null!=alarmRecord) { |
| | | //删除测值 |
| | | list.remove(3); |
| | | // 删除测站编号 |
| | |
| | | alarm.setAlarmCondition(alarmRule.getRuleRemark()); |
| | | alarm.setTempCode(uuid); |
| | | alarm.setMonitorData(list.get(3)); |
| | | //删除测值 |
| | | list.remove(3); |
| | | // 新增 |
| | | boolean save = alarmRecordService.save(alarm); |
| | | // 删除测站编号 |
| | | list.remove(0); |
| | | if (save) { |
| | | return alarm; |
| | | } |
| | | } |
| | | // 返回 |
| | | return null; |
| | | } |
| | | |
| | | public AlarmRecord saveAlarmRecord(List<String> list, AlarmRule alarmRule, String uuid, String remark) { |
| | | AlarmRecord alarmRecord = alarmRecordService.getOne(new QueryWrapper<AlarmRecord>() |
| | | .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; |
| | | } else { |
| | | AlarmRecord alarm = new AlarmRecord(); |
| | | // 设置相关信息 |
| | | alarm.setAlarmRuleId(alarmRule.getId().toString()); |
| | | // 分别设置测站编号和水库编码 |
| | | alarm.setAlarmSurveyStationCode(list.get(0)); |
| | | alarm.setReservoirNumber(list.get(1)); |
| | | alarm.setAlarmCondition(alarmRule.getRuleRemark()); |
| | | alarm.setTempCode(uuid); |
| | | alarm.setMonitorData(list.get(3)); |
| | | alarm.setRemark(remark); |
| | | //删除测值 |
| | | list.remove(3); |
| | | // 新增 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 依次添加巡查责任人,技术责任人信息,主管部门责任人 |
| | | * |
| | | * @param list |
| | | * @param isPhone 是否保护电话 |
| | | */ |
| | | public void addPatrolTechnologyInfoNew(List<String> list, Boolean isPhone) { |
| | | // 根据水库id查询巡查责任人姓名,技术责任人姓名信息 |
| | | List<PersonVO> personVOList = attResManagePersonClient.getPersonListByResGuid(list.get(1), "4,5,2"); |
| | | if (personVOList.size() > 0) { |
| | | String xczrr = "-"; |
| | | String jszrr = "-"; |
| | | String jgzrr = "-"; |
| | | for (PersonVO personVO : personVOList) { |
| | | if (personVO.getType().equals("5")) { |
| | | xczrr = isPhone ? personVO.getName() + ":" + personVO.getPhone() : personVO.getName(); |
| | | } |
| | | if (personVO.getType().equals("4")) { |
| | | jszrr = isPhone ? personVO.getName() + ":" + personVO.getPhone() : personVO.getName(); |
| | | } |
| | | if (personVO.getType().equals("2")) { |
| | | jgzrr = isPhone ? personVO.getName() + ":" + personVO.getPhone() : personVO.getName(); |
| | | } |
| | | } |
| | | // 巡查责任人姓名 |
| | | list.add(xczrr); |
| | | // 技术责任人姓名 |
| | | list.add(jszrr); |
| | | list.add(jgzrr); |
| | | } else { |
| | | // 巡查责任人姓名 |
| | | list.add("-"); |
| | | // 技术责任人姓名 |
| | | list.add("-"); |
| | | list.add("-"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 拼接市县水利部人员姓名及联系方式 |
| | | * |
| | | * @param list |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 依次添加行政责任人,主管部门责任人,技术责任人,巡查责任人信息 |
| | | * |
| | | * @param list |
| | | * @param personTypes |
| | | */ |
| | | public void addWaterMoreDesignPatrolTechnologyInfoNew(List<String> list, String personTypes) { |
| | | String[] split = personTypes.split(","); |
| | | // 查询巡查责任人姓名,技术责任人姓名信息 |
| | | List<PersonVO> personVOList = attResManagePersonClient.getPersonListByResGuid(list.get(1), personTypes); |
| | | if (personVOList.size() > 0) { |
| | | String zgzrr = "-"; |
| | | String jszrr = "-"; |
| | | String xczrr = "-"; |
| | | for (PersonVO personVO : personVOList) { |
| | | String str = null != personVO.getPhone() ? ":" + personVO.getPhone() : "-"; |
| | | if (personVO.getType().equals(split[0])) { |
| | | zgzrr = personVO.getName() + str; |
| | | } |
| | | if (personVO.getType().equals(split[1])) { |
| | | jszrr = personVO.getName() + str; |
| | | } |
| | | if (personVO.getType().equals(split[2])) { |
| | | xczrr = personVO.getName() + str; |
| | | } |
| | | } |
| | | |
| | | // 主管 |
| | | list.add(zgzrr); |
| | | // 技术责任人姓名 |
| | | list.add(jszrr); |
| | | // 巡查责任人姓名 |
| | | list.add(xczrr); |
| | | } else { |
| | | for (String type : split) { |
| | | list.add("-"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 调用中台接口查询数据 |
| | |
| | | return null; |
| | | } |
| | | |
| | | public Map<String, String> jsonObjectToMap(JSONObject jsonObject) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | for (String key : jsonObject.keySet()) { |
| | | map.put(key, jsonObject.get(key).toString()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 调用中台接口查询数据,返回结果不同处理 |
| | |
| | | } |
| | | map.put("list", mapList); |
| | | map.put("scenesId", smsRequestTemplate.getSmsTemplate().getTemplateId()); |
| | | String taskName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss")) + smsRequestTemplate.getAlarmRule().getRuleName() + "智能外呼"; |
| | | String taskName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss")) +"-"+ smsRequestTemplate.getAlarmRule().getRuleName() + "-智能外呼"; |
| | | map.put("taskName", taskName); |
| | | String taskScheduleTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("taskScheduleTime", taskScheduleTime); |