puzhibing
2023-06-21 0ab3b801273b52154d1f9ab88ce7d4e2b1676eee
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java
@@ -44,6 +44,7 @@
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 司机
@@ -463,12 +464,18 @@
            // 构造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);
    }