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 f241e2af
authored
Nov 01, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop-16542' into 'develop'
feat(单时间片容量): 时间周期负值取正 See merge request !362
2 parents
b2c159d3
65ffbb1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 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 @
f241e2a
...
@@ -80,7 +80,7 @@ public class CapacityUtils {
...
@@ -80,7 +80,7 @@ public class CapacityUtils {
//根据capacity_engineer_calendar和order_info,来确定当天剩下的最大连续时间区块 和已使用容量;
//根据capacity_engineer_calendar和order_info,来确定当天剩下的最大连续时间区块 和已使用容量;
public
static
List
<
OccupyInfo
>
caculate
(
final
LocalDateTime
startTime
,
final
LocalDateTime
endTime
,
List
<
OrderInfoEntity
>
orders
,
public
static
List
<
OccupyInfo
>
caculate
(
final
LocalDateTime
startTime
,
final
LocalDateTime
endTime
,
List
<
OrderInfoEntity
>
orders
,
List
<
CapacityEngineerCalendarEntity
>
configs
)
{
List
<
CapacityEngineerCalendarEntity
>
configs
)
{
//工作日历使用时间片
//工作日历使用时间片
List
<
OccupyInfo
>
calendar
=
Optional
.
ofNullable
(
configs
).
orElse
(
Collections
.
emptyList
())
List
<
OccupyInfo
>
calendar
=
Optional
.
ofNullable
(
configs
).
orElse
(
Collections
.
emptyList
())
...
@@ -110,14 +110,14 @@ public class CapacityUtils {
...
@@ -110,14 +110,14 @@ public class CapacityUtils {
LocalDateTime
preLast
=
startTime
;
LocalDateTime
preLast
=
startTime
;
for
(
OccupyInfo
o
:
occupyInfos
)
{
for
(
OccupyInfo
o
:
occupyInfos
)
{
if
(
o
.
getBeginTime
().
isAfter
(
preLast
))
{
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
();
preLast
=
o
.
getEndTime
();
}
}
if
(
preLast
.
isBefore
(
endTime
))
{
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 @
f241e2a
...
@@ -138,7 +138,7 @@ public class CalcEngineerCapacityScheduler {
...
@@ -138,7 +138,7 @@ public class CalcEngineerCapacityScheduler {
List
<
OccupyInfo
>
occupyInfo
=
CapacityUtils
.
caculate
(
startTime
,
endTime
,
orders
,
configs
);
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
);
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