| | |
| | | */ |
| | | @Override |
| | | public List<SysUser> getNearAppUsers(SchedulingParam param) { |
| | | Double longitude = param.getLongitude(); |
| | | Double latitude = param.getLatitude(); |
| | | if (longitude == null && latitude == null) { |
| | | log.debug("原点坐标为空"); |
| | | return null; |
| | | } |
| | | Integer radius = param.getSealingRadius(); |
| | | |
| | | if (radius == null) { |
| | | log.debug("半径距离为空"); |
| | | return null; |
| | | } |
| | | |
| | | SysUser user = new SysUser(); |
| | | List<SysUser> appUserList = iSysUserService.selectAllAppUserList(user); |
| | | //过滤在线 |
| | | List<SysUser> onLineList = appUserList.stream() |
| | | .filter(sysUser -> (sysUser.getAppOnlineState().equals("1"))) |
| | | .collect(Collectors.toList()); |
| | | //过滤范围 |
| | | List<SysUser> filteredList = new ArrayList<>(); |
| | | for(SysUser sysUser:onLineList) { |
| | | ArdAppPosition ardAppPosition = ardAppPositionMapper.selectLastArdAppPositionByUserId(sysUser.getUserId()); |
| | | if (ardAppPosition != null) { |
| | | Double lon = ardAppPosition.getLongitude(); |
| | | Double lat = ardAppPosition.getLatitude(); |
| | | if(longitude==null||latitude==null) |
| | | { |
| | | continue; |
| | | } |
| | | double distance = GisTool.getDistance(new double[]{ longitude, latitude}, new double[]{ lon, lat}); |
| | | if (distance <= radius) { |
| | | Map<String,Object> params=new HashMap<>(); |
| | | params.put("longitude",lon); |
| | | params.put("latitude",lat); |
| | | sysUser.setParams(params); |
| | | filteredList.add(sysUser); // 将满足条件的用户添加到筛选列表中 |
| | | try { |
| | | Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId(); |
| | | Double longitude = param.getLongitude(); |
| | | Double latitude = param.getLatitude(); |
| | | if (longitude == null && latitude == null) { |
| | | log.debug("原点坐标为空"); |
| | | return null; |
| | | } |
| | | Integer radius = param.getSealingRadius(); |
| | | |
| | | if (radius == null) { |
| | | log.debug("半径距离为空"); |
| | | return null; |
| | | } |
| | | |
| | | SysUser user = new SysUser(); |
| | | user.setDeptId(deptId); |
| | | List<SysUser> appUserList = iSysUserService.selectAllAppUserList(user); |
| | | //过滤在线 |
| | | List<SysUser> onLineList = appUserList.stream() |
| | | .filter(sysUser -> (sysUser.getAppOnlineState().equals("1"))) |
| | | .collect(Collectors.toList()); |
| | | //过滤范围 |
| | | for (SysUser sysUser : onLineList) { |
| | | ArdAppPosition ardAppPosition = ardAppPositionMapper.selectLastArdAppPositionByUserId(sysUser.getUserId()); |
| | | if (ardAppPosition != null) { |
| | | Double lon = ardAppPosition.getLongitude(); |
| | | Double lat = ardAppPosition.getLatitude(); |
| | | if (longitude == null || latitude == null) { |
| | | continue; |
| | | } |
| | | double distance = GisTool.getDistance(new double[]{longitude, latitude}, new double[]{lon, lat}); |
| | | if (distance <= radius) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("longitude", lon); |
| | | params.put("latitude", lat); |
| | | sysUser.setParams(params); |
| | | filteredList.add(sysUser); // 将满足条件的用户添加到筛选列表中 |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("获取封控圈内所有在线app用户异常" + ex.getMessage()); |
| | | } |
| | | return filteredList; |
| | | } |