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 65ffbb1c
authored
Nov 01, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(单时间片容量): 时间周期负值取正
1 parent
185fa736
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
project-order/src/main/java/com/dituhui/pea/order/common/CapacityUtils.java
project-order/src/main/java/com/dituhui/pea/order/scheduler/CalcEngineerCapacityScheduler.java
project-order/src/main/java/com/dituhui/pea/order/common/CapacityUtils.java
View file @
65ffbb1
...
...
@@ -110,14 +110,14 @@ public class CapacityUtils {
LocalDateTime
preLast
=
startTime
;
for
(
OccupyInfo
o
:
occupyInfos
)
{
if
(
o
.
getBeginTime
().
isAfter
(
preLast
))
{
idlePeriods
.
add
(
Duration
.
between
(
startTime
,
o
.
getBeginTime
()).
toMinutes
());
idlePeriods
.
add
(
Duration
.
between
(
startTime
,
o
.
getBeginTime
()).
abs
().
toMinutes
());
}
preLast
=
o
.
getEndTime
();
}
if
(
preLast
.
isBefore
(
endTime
))
{
idlePeriods
.
add
(
Duration
.
between
(
preLast
,
endTime
).
toMinutes
());
idlePeriods
.
add
(
Duration
.
between
(
preLast
,
endTime
).
abs
().
toMinutes
());
}
return
org
.
springframework
.
util
.
CollectionUtils
.
isEmpty
(
idlePeriods
)
?
Duration
.
between
(
startTime
,
endTime
).
toMinutes
()
:
Collections
.
max
(
idlePeriods
);
return
org
.
springframework
.
util
.
CollectionUtils
.
isEmpty
(
idlePeriods
)
?
Duration
.
between
(
startTime
,
endTime
).
abs
().
toMinutes
()
:
Collections
.
max
(
idlePeriods
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/scheduler/CalcEngineerCapacityScheduler.java
View file @
65ffbb1
...
...
@@ -138,7 +138,7 @@ public class CalcEngineerCapacityScheduler {
List
<
OccupyInfo
>
occupyInfo
=
CapacityUtils
.
caculate
(
startTime
,
endTime
,
orders
,
configs
);
//已用容量
long
totalUseTime
=
occupyInfo
.
stream
().
mapToLong
(
t
->
Duration
.
between
(
t
.
getEndTime
(),
t
.
getBeginTime
()).
toMinutes
()).
sum
();
long
totalUseTime
=
occupyInfo
.
stream
().
mapToLong
(
t
->
Duration
.
between
(
t
.
getEndTime
(),
t
.
getBeginTime
()).
abs
().
toMinutes
()).
sum
();
//最大连续时长
Long
maxRemainBlock
=
CapacityUtils
.
getMaxRemainBlock
(
startTime
,
endTime
,
occupyInfo
);
...
...
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