Commit 42083042 by chamberone

fix: 修复坐标为空bug

1 parent b9959e7d
...@@ -25,7 +25,7 @@ public class PathController implements IPath { ...@@ -25,7 +25,7 @@ public class PathController implements IPath {
@Autowired @Autowired
OrderInfoRepository orderInfoRepository; OrderInfoRepository orderInfoRepository;
@Autowired @Autowired
RoadDistanceUtils roadDistanceUtils; RoadDistanceUtils roadDistanceUtils;
...@@ -58,8 +58,8 @@ public class PathController implements IPath { ...@@ -58,8 +58,8 @@ public class PathController implements IPath {
} }
// 获取距离 // 获取距离
Distance distance = roadDistanceUtils.getDistance2(new Location(0L, fromX, fromY), Distance distance = roadDistanceUtils.getDistance2(new Location(0L, null, null, fromX, fromY),
new Location(0L, toX, toY), vehicleType); new Location(0L, null, null, fromX, fromY), vehicleType);
DistanceDTO dto = new DistanceDTO(); DistanceDTO dto = new DistanceDTO();
dto.setDis(distance.getDis()); dto.setDis(distance.getDis());
dto.setTime(distance.getTime()); dto.setTime(distance.getTime());
......
...@@ -13,7 +13,6 @@ import java.util.Map; ...@@ -13,7 +13,6 @@ import java.util.Map;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.dituhui.pea.dispatch.pojo.Location; import com.dituhui.pea.dispatch.pojo.Location;
import com.dituhui.pea.dispatch.service.impl.SolveServiceImpl;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gson.Gson; import com.google.gson.Gson;
...@@ -137,7 +136,7 @@ public class RoadDistanceUtils { ...@@ -137,7 +136,7 @@ public class RoadDistanceUtils {
} }
String text = requestGetAK(url, params); String text = requestGetAK(url, params);
System.out.println(url + " : " + gson.toJson(params) + " : " + text); // System.out.println(url + " : " + gson.toJson(params) + " : " + text);
BDResult webResult = gson.fromJson(text, BDResult.class); BDResult webResult = gson.fromJson(text, BDResult.class);
float dis = webResult.getResult().get(0).getDistance().getValue() / 1000F; float dis = webResult.getResult().get(0).getDistance().getValue() / 1000F;
int time = webResult.getResult().get(0).getDuration().getValue(); int time = webResult.getResult().get(0).getDuration().getValue();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!