| | |
| | | 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; |
| | |
| | | * @author pzb |
| | | * @Date 2023/2/8 18:52 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> implements IDriverService { |
| | | |
| | |
| | | // 构造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; |
| | |
| | | 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("上传图片异常"); |