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 c3611a0f
authored
Nov 21, 2023
by
Ren Ping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:自动排班结束时间也需要在时间窗内
1 parent
b2ab54aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
project-dispatch/src/main/resources/application-dev.yaml
project-order/src/main/java/com/dituhui/pea/order/service/impl/ScheduleServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/utils/CommonUtil.java
project-dispatch/src/main/resources/application-dev.yaml
View file @
c3611a0
...
...
@@ -3,7 +3,7 @@ server:
dispatch
:
cron
:
expr
:
0
35
8-23 * * ?
expr
:
0
20
8-23 * * ?
next-day-limit
:
2
scheduler
:
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/ScheduleServiceImpl.java
View file @
c3611a0
...
...
@@ -16,6 +16,7 @@ import com.dituhui.pea.order.entity.*;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
import
com.dituhui.pea.order.enums.VehicleEnum
;
import
com.dituhui.pea.order.service.ScheduleService
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
...
...
@@ -149,7 +150,7 @@ public class ScheduleServiceImpl implements ScheduleService {
child
.
setOrderDesc
(
Integer
.
toString
(
orders2
.
size
()));
Integer
distanceSum
=
orders2
.
stream
().
map
(
order
->
Objects
.
nonNull
(
order
.
getArriveDistance
())
?
order
.
getArriveDistance
()
:
0
).
reduce
(
Integer:
:
sum
).
orElse
(
0
);
teamDistance
+=
distanceSum
;
child
.
setDistanceDesc
(
distanceSum
/
1000.0
+
""
);
child
.
setDistanceDesc
(
CommonUtil
.
converMToKm
(
distanceSum
)
);
children
.
add
(
child
);
...
...
@@ -189,8 +190,8 @@ public class ScheduleServiceImpl implements ScheduleService {
teamEngineers
.
size
()
>
0
?
new
BigDecimal
(
teamDistance
)
.
divide
(
new
BigDecimal
(
teamEngineers
.
size
()),
2
,
RoundingMode
.
HALF_UP
)
.
stripTrailingZeros
()
:
0
,
minDistance
/
1000.0
,
maxDistance
/
1000.0
));
CommonUtil
.
converMToKm
(
minDistance
)
,
CommonUtil
.
converMToKm
(
maxDistance
)
));
teams
.
add
(
team
);
}
...
...
@@ -267,7 +268,7 @@ public class ScheduleServiceImpl implements ScheduleService {
.
divide
(
new
BigDecimal
(
60
),
2
,
RoundingMode
.
HALF_UP
)
.
stripTrailingZeros
()
+
"时"
);
dynamics
.
setRoadTotalDistance
(
sumDistance
/
1000.0
+
"公里"
);
dynamics
.
setRoadTotalDistance
(
CommonUtil
.
converMToKm
(
sumDistance
)
+
"公里"
);
if
(
Objects
.
nonNull
(
engineerBusinessEntity
))
{
dynamics
.
setWorkTime
(
engineerBusinessEntity
.
getWorkOn
()
+
"-"
+
engineerBusinessEntity
.
getWorkOff
());
}
else
{
...
...
@@ -289,7 +290,7 @@ public class ScheduleServiceImpl implements ScheduleService {
item
.
setSkill
(
o
.
getSkill
());
item
.
setOrderStatus
(
o
.
getAppointmentStatus
());
item
.
setOrderStatusName
(
""
);
item
.
setDistance
(
Objects
.
nonNull
(
o
.
getArriveDistance
())
?
o
.
getArriveDistance
()
/
1000.0
+
""
:
null
);
item
.
setDistance
(
CommonUtil
.
converMToKm
(
o
.
getArriveDistance
())
);
item
.
setTimeType
(
"auto"
);
if
(
Objects
.
nonNull
(
o
.
getArriveElapsed
()))
{
...
...
project-order/src/main/java/com/dituhui/pea/order/utils/CommonUtil.java
View file @
c3611a0
...
...
@@ -5,6 +5,7 @@ import com.dituhui.pea.util.DateUtil;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
...
...
@@ -112,6 +113,13 @@ public class CommonUtil {
}
}
public
static
String
converMToKm
(
Integer
m
)
{
if
(
Objects
.
isNull
(
m
))
{
return
null
;
}
return
BigDecimal
.
valueOf
(
m
/
1000.0
).
stripTrailingZeros
().
toString
();
}
public
static
void
main
(
String
[]
args
)
{
isCutoff
(
LocalDateTime
.
now
(),
"18:00"
);
}
...
...
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