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 64b5e191
authored
Jul 13, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化获取技术员发出位置,若从bussiness表没有配置,从小组/分站中去获取
1 parent
2068103e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
12 deletions
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
View file @
64b5e19
package
com
.
dituhui
.
pea
.
order
.
common
;
import
com.dituhui.pea.order.dao.EngineerBusinessMPDao
;
import
com.dituhui.pea.order.dao.OrderAppointmentMPDao
;
import
com.dituhui.pea.order.dao.OrderRequestMPDao
;
import
com.dituhui.pea.order.dao.SkillInfoMPDao
;
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.order.dao.*
;
import
com.dituhui.pea.order.entity.*
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -38,6 +33,12 @@ public class OrderAssignCheck {
@Autowired
EngineerBusinessMPDao
engineerBusinessMPDao
;
@Autowired
EngineerInfoMPDao
engineerInfoMPDao
;
@Autowired
OrgGroupMPDao
orgGroupMPDao
;
@Data
public
class
Result
{
private
Boolean
canAssign
;
...
...
@@ -89,8 +90,11 @@ public class OrderAssignCheck {
// 计算距离 & 时间
if
(
index
==
0
&&
orderSegments
.
isEmpty
())
{
// 第一订单为出发地, 没有其他订单
EngineerBusiness
b
=
engineerBusinessMPDao
.
getByEngineerCode
(
engineerCode
);
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
Double
.
parseDouble
(
b
.
getX
()),
Double
.
parseDouble
(
b
.
getY
()));
double
[]
location
=
this
.
getEngineerDepartureLocation
(
engineerCode
);
double
preX
=
location
[
0
];
double
preY
=
location
[
1
];
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
preX
,
preY
);
Pair
p
=
this
.
getDistanceAndDuration
(
pre
.
getX
(),
pre
.
getY
(),
curX
,
curY
);
// 最早可插入位置为技术员出发时间+行程时间
...
...
@@ -105,9 +109,12 @@ public class OrderAssignCheck {
}
else
if
(
index
==
0
&&
!
orderSegments
.
isEmpty
())
{
// 第一订单为出发地, 且有其他订单
EngineerBusiness
b
=
engineerBusinessMPDao
.
getByEngineerCode
(
engineerCode
);
double
[]
location
=
this
.
getEngineerDepartureLocation
(
engineerCode
);
double
preX
=
location
[
0
];
double
preY
=
location
[
1
];
OrderSegment
post
=
orderSegments
.
get
(
0
);
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
Double
.
parseDouble
(
b
.
getX
()),
Double
.
parseDouble
(
b
.
getY
())
);
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
preX
,
preY
);
return
this
.
getResult
(
curX
,
curY
,
pre
,
post
,
takeTime
,
order
.
getDt
());
}
else
if
(
index
==
orderSegments
.
size
())
{
...
...
@@ -196,6 +203,20 @@ public class OrderAssignCheck {
return
new
Result
(
true
,
"success"
,
minuteAddition
,
distanceAddition
,
startDateTime
,
endDateTime
);
}
private
double
[]
getEngineerDepartureLocation
(
String
engineerCode
){
// 获取技术员出发坐标
// 从技术员配置中获取
EngineerBusiness
b
=
engineerBusinessMPDao
.
getByEngineerCode
(
engineerCode
);
if
(
b
!=
null
&&
StringUtils
.
isNotEmpty
(
b
.
getX
())
&&
StringUtils
.
isNotEmpty
(
b
.
getY
())){
return
new
double
[]{
Double
.
parseDouble
(
b
.
getX
()),
Double
.
parseDouble
(
b
.
getY
())};
}
//从org_group中获取
EngineerInfo
e
=
engineerInfoMPDao
.
getByEngineerCode
(
engineerCode
);
OrgGroup
g
=
orgGroupMPDao
.
getByGroupId
(
e
.
getGroupId
());
return
new
double
[]{
Double
.
parseDouble
(
g
.
getX
()),
Double
.
parseDouble
(
g
.
getY
())};
}
private
int
timestamp2Point
(
Timestamp
t
)
{
LocalDateTime
dt
=
t
.
toLocalDateTime
();
return
dt
.
getHour
()
*
60
+
dt
.
getMinute
();
...
...
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