Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 92cac16a
authored
Jul 10, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…
…oject.git into develop
2 parents
31675bc4
9240ba9f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
12 deletions
project-order/pom.xml
project-order/src/main/java/com/dituhui/pea/order/common/Distance.java
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
project-order/pom.xml
View file @
92cac16
...
...
@@ -78,9 +78,9 @@
</dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
project-dispatch
</artifactId>
<version>
${revision}
</version>
<groupId>
org.gavaghan
</groupId>
<artifactId>
geodesy
</artifactId>
<version>
1.1.3
</version>
</dependency>
<dependency>
...
...
project-order/src/main/java/com/dituhui/pea/order/common/Distance.java
0 → 100644
View file @
92cac16
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
());
}
}
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
View file @
92cac16
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.OrderAppointmentMPDao
;
import
com.dituhui.pea.order.dao.OrderRequestMPDao
;
...
...
@@ -9,7 +8,6 @@ import com.dituhui.pea.order.entity.EngineerBusiness;
import
com.dituhui.pea.order.entity.OrderAppointment
;
import
com.dituhui.pea.order.entity.OrderRequest
;
import
com.dituhui.pea.order.entity.SkillInfo
;
import
com.dituhui.pea.dispatch.common.GeoDistanceCalculator
;
import
lombok.Data
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -185,16 +183,13 @@ public class OrderAssignCheck {
}
private
Pair
getDistanceAndDuration
(
double
x1
,
double
y1
,
double
x2
,
double
y2
){
Location
from
=
new
Location
(
1
,
"1"
,
"1"
,
x1
,
y1
);
Location
to
=
new
Location
(
2
,
"2"
,
"2"
,
x2
,
y2
);
GeoDistanceCalculator
cal
=
new
GeoDistanceCalculator
();
int
distance
=
(
int
)
cal
.
calculateDistance
(
from
,
to
);
// 单位为米
int
duration
=
distance
/
(
19
*
1000
/
60
);
// 时间为分钟,假设电动车速度为19km/h
return
new
Pair
(
distance
,
duration
);
Distance
cal
=
new
Distance
();
long
distance
=
Math
.
round
(
cal
.
calculateDistance
(
x1
,
y1
,
x2
,
y2
)
*
1.4
);
// 单位为米
long
duration
=
distance
/
(
19
*
1000
/
60
);
// 时间为分钟,假设电动车速度为19km/h
return
new
Pair
((
int
)
distance
,
(
int
)
duration
);
}
}
@Data
class
OrderSegment
{
private
String
orderId
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment