| | |
| | | if (alarm.getAlarmTime() != null && alarm.getAlarmTime().equals("")){ |
| | | alarm.setAlarmTime(null); |
| | | } |
| | | if (alarm.getCid() != null && alarm.getCid().equals("")){ |
| | | alarm.setCid("0"); |
| | | } |
| | | |
| | | |
| | | //警情分发测试代码 |
| | | //查询所有在线的接警员 |
| | | List<Map<String, Object>> policeList = alarmService.queryPolice(); |
| | | List<Map<String, Object>> online_police = new ArrayList<>(); |
| | | for (int i = 0; i < policeList.size(); i++) { |
| | | if (policeList.get(i).get("work_status").equals(0)){ |
| | | System.out.println(policeList.get(i).get("real_name")); |
| | | online_police.add(policeList.get(i)); |
| | | } |
| | | } |
| | | |
| | | int size = 0; |
| | | if (online_police.size() == 0){ |
| | | online_police = policeList; |
| | | size = policeList.size(); |
| | | }else { |
| | | size = online_police.size(); |
| | | } |
| | | |
| | | int num=(int)(Math.random()*(size)); |
| | | String name = (String) online_police.get(num).get("real_name"); |
| | | String id = (String) online_police.get(num).get("id"); |
| | | |
| | | alarm.setAlarmPeople(name); |
| | | alarm.setAlarmId(name); |
| | | |
| | | |
| | | return R.status(alarmService.saveOrUpdate(alarm)); |
| | | } |
| | | |