| | |
| | | import java.net.InetAddress; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 司机 |
| | |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | locations.forEach(s -> { |
| | | String value1 = redisUtil.getValue("DRIVER" + s.getDriverId()); |
| | | if(s.getDriverId().compareTo(uid) != 0 && ToolUtil.isNotEmpty(value1)){ |
| | | list.add(s.getLocation().getX() + "," + s.getLocation().getY()); |
| | | List<Integer> collect = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | List<Driver> drivers = this.selectBatchIds(collect); |
| | | for (Driver driver : drivers) { |
| | | String value1 = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(ToolUtil.isEmpty(value1)){ |
| | | continue; |
| | | } |
| | | }); |
| | | if(driver.getId().compareTo(uid) == 0){ |
| | | continue; |
| | | } |
| | | list.add(value1 + "," + driver.getServerStatus()); |
| | | } |
| | | } |
| | | return ResultUtil.success(list); |
| | | } |