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 23e192c9
authored
Nov 20, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(工作日历):新增 判定工程师是否全天请假(非派工时间)或者全天休息接口
1 parent
2cb745ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
project-order/src/main/java/com/dituhui/pea/order/service/EngineerCalendarService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/EngineerCalendarService.java
View file @
23e192c
...
...
@@ -92,4 +92,14 @@ public interface EngineerCalendarService {
* @return 时间窗格式
*/
List
<
OccupyInfoDetail
>
timeWindowsSlice
(
String
engineerCode
,
String
teamId
,
LocalDate
targetDate
);
/**
* 判定工程师是否全天请假(非派工时间)或者全天休息
*
* @param engineerCode 工程师编号
* @param targetDate 目标日期
* @return 全天休息(含请假)返回true, 否则false
*/
boolean
engineerTargetLeave
(
String
engineerCode
,
LocalDate
targetDate
);
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
View file @
23e192c
...
...
@@ -716,6 +716,31 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
return
CapacityUtils
.
intervalTime
(
workStartTime
,
workEndTime
,
usedTimeInfo
);
}
@Override
public
boolean
engineerTargetLeave
(
String
engineerCode
,
LocalDate
targetDate
)
{
Set
<
OrgTeamEntity
>
teams
=
orgTeamDao
.
selectTeamByEngineerCode
(
engineerCode
);
List
<
String
>
teamCommonWorkdaysOfWeek
=
Optional
.
ofNullable
(
teams
).
orElse
(
Collections
.
emptySet
()).
stream
()
.
map
(
team
->
Arrays
.
asList
(
team
.
getWorkdays
().
split
(
","
)))
.
flatMap
(
Collection:
:
stream
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
// 求多个工作队的公共空闲时间
final
int
dayOfWeek
=
targetDate
.
getDayOfWeek
().
getValue
();
List
<
String
>
commonLeisureDayOfWeek
=
ALL_WORK_DAY_OF_WEEK
.
stream
()
.
filter
(
day
->
teamCommonWorkdaysOfWeek
.
stream
().
noneMatch
(
tDay
->
Objects
.
equals
(
day
,
tDay
)))
.
collect
(
Collectors
.
toList
());
if
(!
commonLeisureDayOfWeek
.
contains
(
String
.
valueOf
(
dayOfWeek
)))
{
//日程表事件记录时间
List
<
CapacityEngineerCalendarEntity
>
configs
=
capacityEngineerCalendarDao
.
findCalendarByWorkdayAndEngineerCode
(
DateTimeUtil
.
formatDate
(
targetDate
),
engineerCode
);
return
Optional
.
ofNullable
(
configs
).
orElse
(
Collections
.
emptyList
())
.
stream
()
.
anyMatch
(
t
->
Objects
.
equals
(
Boolean
.
TRUE
,
t
.
getWholeDay
()));
}
return
true
;
}
private
EngineerCalendarDTO
.
Calendar
getEmptyCalendar
(
String
teamId
,
String
date
)
{
// 初始化一天的日历
EngineerCalendarDTO
.
Calendar
calendar
=
new
EngineerCalendarDTO
.
Calendar
();
...
...
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