Pu Zhibing
12 小时以前 954dd6d15ad6a32098f252e7db52459231566b2b
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/DriverServiceImpl.java
@@ -20,6 +20,7 @@
import com.supersavedriving.user.modular.system.util.weChat.WeChatUtil;
import com.supersavedriving.user.modular.system.warpper.DriverRegisterWarpper;
import com.supersavedriving.user.modular.system.warpper.NearbyDriverWarpper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.geo.Circle;
@@ -43,6 +44,7 @@
* @author pzb
* @Date 2023/2/8 18:52
*/
@Slf4j
@Service
public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> implements IDriverService {
@@ -101,6 +103,7 @@
        // 构造query对象
        Query query = Query.query(Criteria.where("location").withinSphere(circle));
        List<Location> locations = mongoTemplate.find(query, Location.class);
        log.info("地理空间检索结果:{}", locations);
        List<Integer> collect = locations.stream().map(Location::getDriverId).collect(Collectors.toList());
        if(collect.size() == 0){
            return list;
@@ -263,8 +266,8 @@
        String pictureName = "driver_" + driverId + ".png";
        File file = FileUtil.writeFromStream(release, new File(filePath + pictureName));
        HttpRequest post = HttpUtil.createPost(adminUrl + "/upload/image");
        HttpRequest form = post.form("file", file);
        HttpResponse execute = form.execute();
        post.form("file", file);
        HttpResponse execute = post.execute();
        int status = execute.getStatus();
        if(200 != status){
            throw new RuntimeException("上传图片异常");