Commit 92cac16a by chamberone

Merge branch 'develop' of https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…

…oject.git into develop
2 parents 31675bc4 9240ba9f
...@@ -78,9 +78,9 @@ ...@@ -78,9 +78,9 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>org.gavaghan</groupId>
<artifactId>project-dispatch</artifactId> <artifactId>geodesy</artifactId>
<version>${revision}</version> <version>1.1.3</version>
</dependency> </dependency>
<dependency> <dependency>
......
package com.dituhui.pea.order.common;
import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GeodeticCurve;
import org.gavaghan.geodesy.GlobalCoordinates;
public class Distance {
public long calculateDistance(double lat1, double lnt1, double lat2, double lnt2) {
GlobalCoordinates source = new GlobalCoordinates(lat1, lnt1);
GlobalCoordinates target = new GlobalCoordinates(lat2, lnt2);
GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(Ellipsoid.WGS84, source, target);
return Math.round(geoCurve.getEllipsoidalDistance());
}
}
package com.dituhui.pea.order.common; package com.dituhui.pea.order.common;
import com.dituhui.pea.dispatch.pojo.Location;
import com.dituhui.pea.order.dao.EngineerBusinessMPDao; import com.dituhui.pea.order.dao.EngineerBusinessMPDao;
import com.dituhui.pea.order.dao.OrderAppointmentMPDao; import com.dituhui.pea.order.dao.OrderAppointmentMPDao;
import com.dituhui.pea.order.dao.OrderRequestMPDao; import com.dituhui.pea.order.dao.OrderRequestMPDao;
...@@ -9,7 +8,6 @@ import com.dituhui.pea.order.entity.EngineerBusiness; ...@@ -9,7 +8,6 @@ import com.dituhui.pea.order.entity.EngineerBusiness;
import com.dituhui.pea.order.entity.OrderAppointment; import com.dituhui.pea.order.entity.OrderAppointment;
import com.dituhui.pea.order.entity.OrderRequest; import com.dituhui.pea.order.entity.OrderRequest;
import com.dituhui.pea.order.entity.SkillInfo; import com.dituhui.pea.order.entity.SkillInfo;
import com.dituhui.pea.dispatch.common.GeoDistanceCalculator;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -185,16 +183,13 @@ public class OrderAssignCheck { ...@@ -185,16 +183,13 @@ public class OrderAssignCheck {
} }
private Pair getDistanceAndDuration(double x1, double y1, double x2, double y2){ private Pair getDistanceAndDuration(double x1, double y1, double x2, double y2){
Location from = new Location(1, "1", "1", x1, y1); Distance cal= new Distance();
Location to = new Location(2, "2", "2", x2, y2); long distance = Math.round(cal.calculateDistance(x1, y1, x2, y2) * 1.4); // 单位为米
GeoDistanceCalculator cal= new GeoDistanceCalculator(); long duration = distance / (19 * 1000 / 60); // 时间为分钟,假设电动车速度为19km/h
int distance = (int) cal.calculateDistance(from, to); // 单位为米 return new Pair((int)distance, (int)duration);
int duration = distance / (19 * 1000 / 60); // 时间为分钟,假设电动车速度为19km/h
return new Pair(distance, duration);
} }
} }
@Data @Data
class OrderSegment{ class OrderSegment{
private String orderId; private String orderId;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!