Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
0dd00ae3
Commit
0dd00ae3
authored
Apr 01, 2022
by
纪旭 韦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考勤统计
parent
89c2166a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
8 deletions
+102
-8
performance/Performance.Api/Controllers/AttendanceController.cs
+1
-1
performance/Performance.EntityModels/Other/view_attendance.cs
+25
-1
performance/Performance.Services/AttendanceService.cs
+76
-6
No files found.
performance/Performance.Api/Controllers/AttendanceController.cs
View file @
0dd00ae3
...
...
@@ -5,7 +5,7 @@
namespace
Performance.Api.Controllers
{
[
Route
(
"api"
)]
[
Route
(
"api
/[controller]
"
)]
[
ApiController
]
public
class
AttendanceController
:
ControllerBase
{
...
...
performance/Performance.EntityModels/Other/view_attendance.cs
View file @
0dd00ae3
...
...
@@ -39,7 +39,7 @@ public class InitialAttendanceJoin : InitialAttendance
public
Nullable
<
DateTime
>
bEndDate
{
get
;
set
;
}
//结束时间
}
public
class
RecordAttendcance
:
per_attendance_vacation
public
class
RecordAttendcance
:
per_attendance_vacation
{
public
int
Days
{
get
;
set
;
}
public
string
AttendanceName
{
get
;
set
;
}
...
...
@@ -66,4 +66,28 @@ public class AttendanceResponse<T>
public
T
Datas
{
get
;
set
;
}
}
public
class
AttendancesJoinVacatione
{
public
string
AccountingUnit
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
public
string
PersonnelName
{
get
;
set
;
}
public
string
PersonnelNumber
{
get
;
set
;
}
public
string
UnitType
{
get
;
set
;
}
public
DateTime
?
StartDate
{
get
;
set
;
}
public
DateTime
?
EndDate
{
get
;
set
;
}
public
List
<
Detail
>
Detail
{
get
;
set
;
}
public
int
AttendanceDays
{
get
;
set
;
}
}
public
class
Detail
{
public
string
Title
{
get
;
set
;
}
public
DateTime
?
BegDate
{
get
;
set
;
}
public
DateTime
EndDate
{
get
;
set
;
}
public
int
IsDeduction
{
get
;
set
;
}
public
int
VacationDays
{
get
;
set
;
}
}
}
performance/Performance.Services/AttendanceService.cs
View file @
0dd00ae3
...
...
@@ -53,7 +53,6 @@ public AttendanceResponse<List<InitialAttendance>> GetAttendance(int allotId)
if
(
attendanceData
==
null
||
!
attendanceData
.
Any
())
return
new
AttendanceResponse
<
List
<
InitialAttendance
>>();
var
attendances
=
new
List
<
InitialAttendance
>();
foreach
(
var
item
in
attendanceData
)
{
if
(!
item
.
Source
.
Contains
(
"结束"
))
...
...
@@ -79,6 +78,7 @@ public AttendanceResponse<List<InitialAttendance>> GetAttendance(int allotId)
temp
.
StartDate
=
item
.
AttendanceDate
;
temp
.
EndDate
=
endDate
.
AttendanceDate
;
temp
.
Department
=
endDate
.
Department
;
}
else
{
...
...
@@ -87,6 +87,7 @@ public AttendanceResponse<List<InitialAttendance>> GetAttendance(int allotId)
}
attendances
.
Add
(
temp
);
}
}
AttendanceResponse
<
List
<
InitialAttendance
>>
attendanceResponse
=
new
AttendanceResponse
<
List
<
InitialAttendance
>>()
...
...
@@ -535,7 +536,7 @@ public ApiResponse GetAttendanceStatistics(int allotId, int hospitalId)
bEndDate
=
aleftjoinb
?.
EndDate
};
var
result
=
attendancesJoinVacatione
.
GroupBy
(
t
=>
new
{
t
.
PersonnelNumber
,
t
.
PersonnelName
,
t
.
AccountingUnit
,
t
.
Department
,
t
.
UnitType
}).
Select
(
t
=>
new
var
result
=
attendancesJoinVacatione
.
GroupBy
(
t
=>
new
{
t
.
PersonnelNumber
,
t
.
PersonnelName
,
t
.
AccountingUnit
,
t
.
Department
,
t
.
UnitType
}).
Select
(
t
=>
new
AttendancesJoinVacatione
{
AccountingUnit
=
t
.
Key
.
AccountingUnit
,
Department
=
t
.
Key
.
Department
,
...
...
@@ -544,17 +545,74 @@ public ApiResponse GetAttendanceStatistics(int allotId, int hospitalId)
UnitType
=
t
.
Key
.
UnitType
,
StartDate
=
t
.
FirstOrDefault
().
StartDate
,
EndDate
=
t
.
FirstOrDefault
().
EndDate
,
Detail
=
t
.
GroupBy
(
group
=>
group
.
AttendanceName
).
Select
(
group
=>
new
Detail
=
t
.
GroupBy
(
group
=>
group
.
AttendanceName
).
Select
(
group
=>
new
EntityModels
.
Other
.
Detail
{
Title
=
group
.
Key
,
//Value = Convert.ToInt32(new TimeSpan(Convert.ToDateTime(group.FirstOrDefault().BegDate).Ticks).Subtract(new TimeSpan(Convert.ToDateTime(group.FirstOrDefault().EndDate).Ticks)).Duration().Days) + 1,
BegDate
=
group
.
FirstOrDefault
().
BegDate
,
EndDate
=
group
.
FirstOrDefault
().
bEndDate
,
EndDate
=
Convert
.
ToDateTime
(
group
.
FirstOrDefault
().
bEndDate
)
,
IsDeduction
=
group
.
FirstOrDefault
().
IsDeduction
,
VacationDays
=
0
})
})
.
ToList
(),
});
return
new
ApiResponse
(
ResponseType
.
OK
,
"ok"
,
result
);
List
<
AttendancesJoinVacatione
>
list
=
new
List
<
AttendancesJoinVacatione
>();
foreach
(
var
item
in
result
)
{
AttendancesJoinVacatione
temp
=
new
AttendancesJoinVacatione
()
{
AccountingUnit
=
item
.
AccountingUnit
,
Department
=
item
.
Department
,
PersonnelName
=
item
.
PersonnelName
,
PersonnelNumber
=
item
.
PersonnelNumber
,
UnitType
=
item
.
UnitType
,
StartDate
=
item
.
StartDate
,
EndDate
=
item
.
EndDate
,
Detail
=
new
List
<
EntityModels
.
Other
.
Detail
>(),
AttendanceDays
=
0
,
};
foreach
(
var
detail
in
item
.
Detail
)
{
if
(
item
.
PersonnelName
.
Contains
(
"夏东"
))
{
if
(
item
.
StartDate
>=
detail
.
BegDate
&&
detail
.
EndDate
<=
item
.
EndDate
)
{
if
(
item
.
StartDate
>=
detail
.
BegDate
&&
detail
.
EndDate
<=
item
.
EndDate
)
detail
.
BegDate
=
item
.
StartDate
;
detail
.
VacationDays
=
Convert
.
ToInt32
(
new
TimeSpan
(
Convert
.
ToDateTime
(
detail
.
BegDate
).
Ticks
).
Subtract
(
new
TimeSpan
(
Convert
.
ToDateTime
(
detail
.
EndDate
).
Ticks
)).
Duration
().
Days
)
+
1
;
temp
.
Detail
.
Add
(
detail
);
}
else
if
(
detail
.
BegDate
<=
item
.
EndDate
&&
detail
.
EndDate
>
item
.
EndDate
)
{
detail
.
EndDate
=
Convert
.
ToDateTime
(
item
.
EndDate
);
detail
.
VacationDays
=
Convert
.
ToInt32
(
new
TimeSpan
(
Convert
.
ToDateTime
(
detail
.
BegDate
).
Ticks
).
Subtract
(
new
TimeSpan
(
Convert
.
ToDateTime
(
detail
.
EndDate
).
Ticks
)).
Duration
().
Days
)
+
1
;
temp
.
Detail
.
Add
(
detail
);
}
}
}
temp
.
AttendanceDays
=
Convert
.
ToInt32
(
new
TimeSpan
(
Convert
.
ToDateTime
(
temp
.
StartDate
).
Ticks
).
Subtract
(
new
TimeSpan
(
Convert
.
ToDateTime
(
temp
.
EndDate
).
Ticks
)).
Duration
().
Days
)
+
1
;
var
vacationDays
=
temp
.
Detail
.
Where
(
t
=>
t
.
IsDeduction
==
1
).
Select
(
t
=>
t
.
VacationDays
).
ToArray
();
for
(
int
i
=
0
;
i
<
vacationDays
.
Count
();
i
++)
{
temp
.
AttendanceDays
=
temp
.
AttendanceDays
-
vacationDays
[
i
];
}
list
.
Add
(
temp
);
}
AttendanceResponse
<
List
<
AttendancesJoinVacatione
>>
attendanceResponse
=
new
AttendanceResponse
<
List
<
AttendancesJoinVacatione
>>()
{
Heads
=
AttendanceConfig
.
StatisticsAttendcanceHeads
,
Datas
=
list
};
return
new
ApiResponse
(
ResponseType
.
OK
,
"ok"
,
attendanceResponse
);
}
...
...
@@ -629,6 +687,18 @@ public class AttendanceConfig
new
AttendaceHeads
{
Column
=
"调入组别"
,
Name
=
nameof
(
per_attendance
.
CallInUnitType
)},
new
AttendaceHeads
{
Column
=
"调入时间"
,
Name
=
nameof
(
per_attendance
.
CallInDate
)},
};
public
static
List
<
AttendaceHeads
>
StatisticsAttendcanceHeads
{
get
;
}
=
new
List
<
AttendaceHeads
>
{
new
AttendaceHeads
{
Column
=
"核算单元名称"
,
Name
=
nameof
(
AttendancesJoinVacatione
.
AccountingUnit
)},
new
AttendaceHeads
{
Column
=
"科室名称"
,
Name
=
nameof
(
AttendancesJoinVacatione
.
Department
)},
new
AttendaceHeads
{
Column
=
"姓名"
,
Name
=
nameof
(
AttendancesJoinVacatione
.
PersonnelName
)},
new
AttendaceHeads
{
Column
=
"人员工号"
,
Name
=
nameof
(
AttendancesJoinVacatione
.
PersonnelNumber
)},
new
AttendaceHeads
{
Column
=
"人员组别"
,
Name
=
nameof
(
AttendancesJoinVacatione
.
UnitType
)},
new
AttendaceHeads
{
Column
=
"在科开始日期"
,
Name
=
nameof
(
AttendancesJoinVacatione
.
StartDate
)},
new
AttendaceHeads
{
Column
=
"在科结束日期"
,
Name
=
nameof
(
AttendancesJoinVacatione
.
EndDate
)},
new
AttendaceHeads
{
Column
=
"详细"
,
Name
=
nameof
(
AttendancesJoinVacatione
.
Detail
)},
new
AttendaceHeads
{
Column
=
"出勤天数"
,
Name
=
nameof
(
AttendancesJoinVacatione
.
AttendanceDays
)},
};
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment