距离计算异常处理、订单查询问题修复

wxpay
LI-CCONG\李聪聪 8 months ago
parent fcaa3ed258
commit 883fbff5fb

@ -66,6 +66,7 @@ public class CommonUtil {
* @return km * @return km
*/ */
public static BigDecimal getDistance(String lon1, String lat1, String lon2, String lat2) { public static BigDecimal getDistance(String lon1, String lat1, String lon2, String lat2) {
try {
GlobalCoordinates source = new GlobalCoordinates(Double.parseDouble(lat1), Double.parseDouble(lon1)); GlobalCoordinates source = new GlobalCoordinates(Double.parseDouble(lat1), Double.parseDouble(lon1));
GlobalCoordinates target = new GlobalCoordinates(Double.parseDouble(lat2), Double.parseDouble(lon2)); GlobalCoordinates target = new GlobalCoordinates(Double.parseDouble(lat2), Double.parseDouble(lon2));
GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(Ellipsoid.Sphere, source, target); GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(Ellipsoid.Sphere, source, target);
@ -74,6 +75,9 @@ public class CommonUtil {
distanceBig = distanceBig.multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.UP); distanceBig = distanceBig.multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.UP);
// return distanceBig.toString().concat("km"); // return distanceBig.toString().concat("km");
return distanceBig; return distanceBig;
} catch (Exception e) {
return new BigDecimal("99999.99");
}
} }

@ -51,7 +51,7 @@ public class RecycleOrderController {
// 1.解析用户上下文 // 1.解析用户上下文
UserDTO userDTO = UserContext.getUser(); UserDTO userDTO = UserContext.getUser();
// recycleOrderQuery.setUserType(userDTO.getUserType()).setStationId(userDTO.getStationId()); // recycleOrderQuery.setUserType(userDTO.getUserType()).setStationId(userDTO.getStationId());
recycleOrderQuery.setUserType(userDTO.getUserType()); // 默认先从前端获取回收站Id todo recycleOrderQuery.setUserId(userDTO.getId()).setUserType(userDTO.getUserType()); // 默认先从前端获取回收站Id todo
// 2.分页查询 // 2.分页查询
Page<RecycleOrder> result = recycleOrderService.queryOrderByPage(recycleOrderQuery); Page<RecycleOrder> result = recycleOrderService.queryOrderByPage(recycleOrderQuery);
// 3.订单距离计算 // 3.订单距离计算

Loading…
Cancel
Save