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 dc969b13
authored
Nov 14, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://gitlab.dituhui.com/bsh/project/project
into develop
2 parents
7087cfaf
d973aa7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
View file @
dc969b1
...
...
@@ -306,13 +306,11 @@ public class DispatchServiceImpl implements DispatchService {
if
(
CollectionUtils
.
isNotEmpty
(
engineerOrders
))
{
Result
<
OrderInfoEntity
>
entityResult
=
orderInfoService
.
insterEngineerOrders
(
engineerOrders
,
entity
,
skill
,
byTeamId
,
engineer
);
if
(!
entityResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
return
Result
.
failed
(
"当前工程师
工单已满
"
);
return
Result
.
failed
(
"当前工程师
无法预约合适时间
"
);
}
entity
=
entityResult
.
getResult
();
}
entity
.
setTakeTime
(
skill
.
getTakeTime
());
entity
.
setPlanStartTime
(
entity
.
getExpectTimeBegin
());
entity
.
setPlanEndTime
(
entity
.
getExpectTimeBegin
().
plusMinutes
(
skill
.
getTakeTime
()));
entity
.
setEngineerCode
(
engineer
.
getEngineerCode
());
entity
.
setEngineerName
(
engineer
.
getName
());
entity
.
setEngineerPhone
(
engineer
.
getPhone
());
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
dc969b1
...
...
@@ -8,6 +8,7 @@ import com.dituhui.pea.common.ResultEnum;
import
com.dituhui.pea.dispatch.IPath
;
import
com.dituhui.pea.enums.StatusCodeEnum
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.common.jackson.JsonUtil
;
import
com.dituhui.pea.order.constant.OrderReschedulingReason
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.MsgDTO
;
...
...
@@ -448,8 +449,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
// 获取团队工作起止时间
String
[]
teamWorkStartTime
=
orgTeam
.
getWorkOn
().
split
(
":"
);
String
[]
teamWorkEndTime
=
orgTeam
.
getWorkOff
().
split
(
":"
);
LocalDateTime
startTeam
=
LocalDate
.
now
().
atTime
(
Integer
.
parseInt
(
teamWorkStartTime
[
0
]),
Integer
.
parseInt
(
teamWorkStartTime
[
1
]),
0
);
LocalDateTime
endTeam
=
LocalDate
.
now
().
atTime
(
Integer
.
parseInt
(
teamWorkEndTime
[
0
]),
Integer
.
parseInt
(
teamWorkEndTime
[
1
]),
0
);
LocalDateTime
startTeam
=
insertOrder
.
getDt
().
atTime
(
Integer
.
parseInt
(
teamWorkStartTime
[
0
]),
Integer
.
parseInt
(
teamWorkStartTime
[
1
]),
0
);
LocalDateTime
endTeam
=
insertOrder
.
getDt
().
atTime
(
Integer
.
parseInt
(
teamWorkEndTime
[
0
]),
Integer
.
parseInt
(
teamWorkEndTime
[
1
]),
0
);
// 计算最早派工和最晚派工时间
LocalDateTime
workStartTime
=
start
.
isAfter
(
startTeam
)
?
start
:
startTeam
;
LocalDateTime
workEndTime
=
end
.
isBefore
(
endTeam
)
?
end
:
endTeam
;
...
...
@@ -480,13 +481,15 @@ public class OrderInfoServiceImpl implements OrderInfoService {
for
(
int
i
=
0
;
i
<
orderSegments
.
size
();
i
++)
{
OrderSegment
orderSegment
=
orderSegments
.
get
(
i
);
Result
<
DistanceDTO
>
roadResult
=
pathService
.
getRoadDistance
(
insertOrder
.
getOrderId
(),
orderSegment
.
getOrderId
(),
engineer
.
getVehicle
());
log
.
info
(
"【getRoadDistance】参数------------->{},{},{}"
,
insertOrder
.
getOrderId
(),
orderSegment
.
getOrderId
(),
engineer
.
getVehicle
());
log
.
info
(
"【getRoadDistance】结果------------->{}"
,
JsonUtil
.
toJson
(
roadResult
));
if
(!
roadResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
continue
;
}
DistanceDTO
distanceDTO
=
roadResult
.
getResult
();
int
roadTime
=
distanceDTO
.
getTime
()
/
1000
;
// 先判断第一单开始时间
if
(
i
==
0
&&
orderSegment
.
getStart
().
minusHours
(
orderSegment
.
getElapsed
()).
compareTo
(
workStartTime
.
plusMinutes
(
takeTime
+
roadTime
))
>=
0
)
{
if
(
i
==
0
&&
orderSegment
.
getStart
().
compareTo
(
workStartTime
.
plusMinutes
(
takeTime
+
roadTime
))
>=
0
)
{
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
// insertOrder.setArriveDistance(roadTime);
// insertOrder.setArriveDistance(Integer.valueOf(String.valueOf(distanceDTO.getDis() * 1000)));
...
...
@@ -500,7 +503,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
return
Result
.
success
(
insertOrder
);
}
// 判断当前是不是最后一单
if
(
i
==
orderSegments
.
size
()
-
1
&&
workEndTime
.
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
takeTime
+
roadTime
))
>=
0
)
{
if
(
i
==
orderSegments
.
size
()
-
1
)
{
// 最后一单如果没有符合条件的则代表没有合适时间
if
(
workEndTime
.
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
takeTime
+
roadTime
))
<
0
)
{
return
Result
.
failed
(
insertOrder
);
}
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setArriveDistance
(
roadTime
);
insertOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()
*
1000
).
intValue
());
...
...
@@ -511,10 +518,12 @@ public class OrderInfoServiceImpl implements OrderInfoService {
// 当前单在中间
OrderSegment
nestOrderSegment
=
orderSegments
.
get
(
i
+
1
);
Result
<
DistanceDTO
>
roadResult2
=
pathService
.
getRoadDistance
(
nestOrderSegment
.
getOrderId
(),
insertOrder
.
getOrderId
(),
engineer
.
getVehicle
());
log
.
info
(
"【getRoadDistance2】参数------------->{},{},{}"
,
nestOrderSegment
.
getOrderId
(),
insertOrder
.
getOrderId
(),
engineer
.
getVehicle
());
log
.
info
(
"【getRoadDistance2】结果------------->{}"
,
JsonUtil
.
toJson
(
roadResult2
));
if
(!
roadResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
continue
;
}
if
(
nestOrderSegment
.
getStart
().
minus
Hour
s
(
roadResult2
.
getResult
().
getTime
()
/
1000
).
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
takeTime
+
roadTime
))
>=
0
)
{
if
(
nestOrderSegment
.
getStart
().
minus
Minute
s
(
roadResult2
.
getResult
().
getTime
()
/
1000
).
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
takeTime
+
roadTime
))
>=
0
)
{
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setArriveDistance
(
roadTime
);
insertOrder
.
setArriveElapsed
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()
*
1000
).
intValue
());
...
...
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