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
43e9ea87
Commit
43e9ea87
authored
Apr 21, 2023
by
ruyun.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载BUG修复
parent
b8299bfe
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
734 additions
and
46 deletions
+734
-46
performance/Performance.Api/Controllers/AttendanceController.cs
+98
-17
performance/Performance.Api/wwwroot/Performance.Api.xml
+36
-4
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+70
-0
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+75
-0
performance/Performance.DtoModels/Response/AttendanceDeptReport.cs
+72
-0
performance/Performance.EntityModels/Context/PerformanceDbContext.cs
+1
-0
performance/Performance.EntityModels/Entity/per_attendance_dept_report.cs
+73
-0
performance/Performance.Repository/Repository/PerforPerAttendanceDeptReportRepository.cs
+15
-0
performance/Performance.Services/AttendanceService.cs
+248
-23
performance/Performance.Services/DapperService.cs
+46
-2
No files found.
performance/Performance.Api/Controllers/AttendanceController.cs
View file @
43e9ea87
...
...
@@ -486,14 +486,14 @@ public IActionResult DownloadAuditDetail(int allotId, string unitType, string ac
new
ExcelDownloadHeads
{
Alias
=
"在科结束时间"
,
Name
=
nameof
(
AttendanceStatistics
.
EndDate
)
},
new
ExcelDownloadHeads
{
Alias
=
"人员系数"
,
Name
=
nameof
(
AttendanceStatistics
.
PermanentStaff
)
},
};
var
type
=
_attendanceService
.
GetAttendanceType
(
allotId
);
foreach
(
var
item
in
type
.
Data
)
var
userid
=
claim
.
GetUserId
();
var
result
=
_attendanceService
.
AuditDetail
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
,
userid
).
Data
;
foreach
(
var
item
in
result
.
SelectMany
(
w
=>
w
.
Detial
).
Select
(
w
=>
w
.
Title
).
Distinct
())
{
excelDownloadHeads
.
Add
(
new
ExcelDownloadHeads
()
{
Alias
=
item
.
AttendanceName
,
Name
=
item
.
AttendanceName
});
excelDownloadHeads
.
Add
(
new
ExcelDownloadHeads
()
{
Alias
=
item
,
Name
=
item
});
}
excelDownloadHeads
.
Add
(
new
ExcelDownloadHeads
()
{
Alias
=
"出勤天数"
,
Name
=
"AttendanceDays"
});
var
userid
=
claim
.
GetUserId
();
var
result
=
_attendanceService
.
AuditDetail
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
,
userid
).
Data
;
var
ser
=
JsonConvert
.
SerializeObject
(
result
);
var
rows
=
JsonConvert
.
DeserializeObject
<
List
<
Dictionary
<
string
,
object
>>>(
ser
);
...
...
@@ -661,17 +661,19 @@ public ApiResponse DeptSave(int allotId, string unitType, [FromBody] List<Attend
/// <param name="allotId">绩效月ID</param>
/// <param name="unitType">核算组别</param>
/// <param name="accountingUnit">核算单元</param>
/// <param name="searchTxet">工号/姓名</param>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"dept/compute"
)]
public
ApiResponse
<
List
<
AttendanceStatistics
>>
DeptCompute
(
int
allotId
,
string
unitType
,
string
accountingUnit
)
public
ApiResponse
<
List
<
AttendanceStatistics
>>
DeptCompute
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
searchTxet
)
{
if
(!
Enum
.
TryParse
(
unitType
,
out
UnitType
unitType1
))
throw
new
PerformanceException
(
"核算组别错误"
);
if
(
string
.
IsNullOrEmpty
(
accountingUnit
))
throw
new
PerformanceException
(
"核算单元错误"
);
return
_attendanceService
.
DeptCompute
(
allotId
,
unitType
,
accountingUnit
);
var
deptDetail
=
_attendanceService
.
DeptDetail
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
)?.
Data
?.
Data
??
new
List
<
AttendanceDeptMore
>();
return
_attendanceService
.
DeptCompute
(
allotId
,
deptDetail
);
}
/// <summary>
...
...
@@ -680,10 +682,11 @@ public ApiResponse<List<AttendanceStatistics>> DeptCompute(int allotId, string u
/// <param name="allotId">绩效月ID</param>
/// <param name="unitType">核算组别</param>
/// <param name="accountingUnit">核算单元</param>
/// <param name="searchTxet">工号/姓名</param>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"dept/download/compute"
)]
public
IActionResult
DownloadDeptCompute
(
int
allotId
,
string
unitType
,
string
accountingUnit
)
public
IActionResult
DownloadDeptCompute
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
searchTxet
)
{
if
(!
Enum
.
TryParse
(
unitType
,
out
UnitType
unitType1
))
throw
new
PerformanceException
(
"核算组别错误"
);
...
...
@@ -706,10 +709,10 @@ public IActionResult DownloadDeptCompute(int allotId, string unitType, string ac
excelDownloadHeads
.
Add
(
new
ExcelDownloadHeads
()
{
Alias
=
item
.
AttendanceName
,
Name
=
item
.
AttendanceName
});
}
excelDownloadHeads
.
Add
(
new
ExcelDownloadHeads
()
{
Alias
=
"出勤天数"
,
Name
=
"AttendanceDays"
});
var
userid
=
claim
.
GetUserId
();
var
res
=
_attendanceService
.
DeptCompute
(
allotId
,
unitType
,
accountingUnit
);
var
result
=
(
res
?.
Data
==
null
)
?
new
List
<
AttendanceStatistics
>()
:
res
.
Data
;
var
deptDetail
=
_attendanceService
.
DeptDetail
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
)?.
Data
?.
Data
??
new
List
<
AttendanceDeptMore
>();
var
res
=
_attendanceService
.
DeptCompute
(
allotId
,
deptDetail
);
var
result
=
(
res
?.
Data
==
null
)
?
new
List
<
AttendanceStatistics
>()
:
res
.
Data
;
var
ser
=
JsonConvert
.
SerializeObject
(
result
);
var
rows
=
JsonConvert
.
DeserializeObject
<
List
<
Dictionary
<
string
,
object
>>>(
ser
);
...
...
@@ -727,7 +730,6 @@ public IActionResult DownloadDeptCompute(int allotId, string unitType, string ac
return
File
(
memoryStream
,
memi
,
Path
.
GetFileName
(
fileInfo
.
Name
));
}
/// <summary>
/// 科室考勤上报录入提交
/// </summary>
...
...
@@ -794,33 +796,34 @@ public ApiResponse DeptAudit(int allotId, string unitType, string accountingUnit
/// <param name="allotId">绩效月ID</param>
/// <param name="unitType">核算组别</param>
/// <param name="accountingUnit">核算单元</param>
/// <param name="searchTxet">工号/姓名</param>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"dept/detail"
)]
public
ApiResponse
<
AttendanceDeptDetail
>
DeptDetail
(
int
allotId
,
string
unitType
,
string
accountingUnit
)
public
ApiResponse
<
AttendanceDeptDetail
>
DeptDetail
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
searchTxet
)
{
return
_attendanceService
.
DeptDetail
(
allotId
,
unitType
,
accountingUnit
);
return
_attendanceService
.
DeptDetail
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
);
}
/// <summary>
/// 科室考勤上报结果详情下载
/// </summary>
/// <param name="allotId">绩效月ID</param>
/// <param name="unitType">核算组别</param>
/// <param name="accountingUnit">核算单元</param>
/// <param name="searchTxet">工号/姓名</param>
/// <param name="fileName"></param>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"dept/detail/download"
)]
public
IActionResult
DeptDetailDownload
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
?
fileName
)
public
IActionResult
DeptDetailDownload
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
searchTxet
,
string
?
fileName
)
{
fileName
=
string
.
IsNullOrWhiteSpace
(
fileName
)
?
"考勤上报审核结果"
:
Path
.
GetFileNameWithoutExtension
(
fileName
);
var
dpath
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"Files"
);
if
(!
Directory
.
Exists
(
dpath
))
Directory
.
CreateDirectory
(
dpath
);
string
filepath
=
Path
.
Combine
(
dpath
,
$"
{
fileName
}{
DateTime
.
Now
:
yyyy
年
MM
月
dd
日
}
.xlsx"
);
var
res
=
_attendanceService
.
DeptDetail
(
allotId
,
unitType
,
accountingUnit
);
var
res
=
_attendanceService
.
DeptDetail
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
);
var
config
=
new
ExcelDownloadRequest
()
{
Name
=
"考勤上报审核结果"
};
if
(
res
.
State
==
ResponseType
.
OK
)
{
...
...
@@ -845,6 +848,83 @@ public IActionResult DeptDetailDownload(int allotId, string unitType, string acc
return
File
(
memoryStream
,
memi
,
Path
.
GetFileName
(
fileInfo
.
Name
));
}
/// <summary>
/// 科室考勤上报汇总统计
/// </summary>
/// <param name="allotId">绩效月ID</param>
/// <param name="unitType">核算组别</param>
/// <param name="accountingUnit">核算单元</param>
/// <param name="searchTxet">工号/姓名</param>
/// <returns></returns>
/// <exception cref="PerformanceException"></exception>
[
HttpPost
]
[
Route
(
"dept/report"
)]
public
ApiResponse
<
List
<
AttendanceDeptReport
>>
DeptReport
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
searchTxet
)
{
return
_attendanceService
.
DeptReport
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
);
}
/// <summary>
/// 科室考勤上报汇总数据刷新
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"dept/report/refresh"
)]
public
ApiResponse
DeptReportRefresh
(
int
allotId
)
{
_attendanceService
.
DeptReportRefresh
(
allotId
,
(
int
)
Attendance
.
Report
.
通过
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"刷新成功"
);
}
/// <summary>
/// 科室考勤上报汇总统计下载
/// </summary>
/// <param name="allotId">绩效月ID</param>
/// <param name="unitType">核算组别</param>
/// <param name="accountingUnit">核算单元</param>
/// <param name="searchTxet">工号/姓名</param>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"dept/download/report"
)]
public
IActionResult
DownloadDeptReport
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
searchTxet
)
{
List
<
ExcelDownloadHeads
>
excelDownloadHeads
=
new
List
<
ExcelDownloadHeads
>()
{
new
ExcelDownloadHeads
{
Alias
=
"核算组别"
,
Name
=
nameof
(
AttendanceStatistics
.
UnitType
)
},
new
ExcelDownloadHeads
{
Alias
=
"核算单元名称"
,
Name
=
nameof
(
AttendanceStatistics
.
AccountingUnit
)
},
new
ExcelDownloadHeads
{
Alias
=
"姓名"
,
Name
=
nameof
(
AttendanceStatistics
.
PersonnelName
)
},
new
ExcelDownloadHeads
{
Alias
=
"员工号"
,
Name
=
nameof
(
AttendanceStatistics
.
PersonnelNumber
)
},
new
ExcelDownloadHeads
{
Alias
=
"在科开始时问"
,
Name
=
nameof
(
AttendanceStatistics
.
BeginDate
)
},
new
ExcelDownloadHeads
{
Alias
=
"在科结束时间"
,
Name
=
nameof
(
AttendanceStatistics
.
EndDate
)
},
new
ExcelDownloadHeads
{
Alias
=
"人员系数"
,
Name
=
nameof
(
AttendanceStatistics
.
PermanentStaff
)
},
};
var
res
=
_attendanceService
.
DeptReport
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
);
var
result
=
(
res
?.
Data
==
null
)
?
new
List
<
AttendanceDeptReport
>()
:
res
.
Data
;
foreach
(
var
item
in
result
.
SelectMany
(
w
=>
w
.
Detial
).
Select
(
w
=>
w
.
Title
).
Distinct
())
{
excelDownloadHeads
.
Add
(
new
ExcelDownloadHeads
()
{
Alias
=
item
,
Name
=
item
});
}
excelDownloadHeads
.
Add
(
new
ExcelDownloadHeads
()
{
Alias
=
"出勤天数"
,
Name
=
"AttendanceDays"
});
var
ser
=
JsonConvert
.
SerializeObject
(
result
);
var
rows
=
JsonConvert
.
DeserializeObject
<
List
<
Dictionary
<
string
,
object
>>>(
ser
);
var
filepath
=
_attendanceService
.
ExcelDownload
(
rows
,
"科室上报考勤结果统计"
,
allotId
,
excelDownloadHeads
);
var
memoryStream
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
filepath
,
FileMode
.
Open
))
{
stream
.
CopyToAsync
(
memoryStream
).
Wait
();
}
memoryStream
.
Seek
(
0
,
SeekOrigin
.
Begin
);
var
provider
=
new
FileExtensionContentTypeProvider
();
FileInfo
fileInfo
=
new
FileInfo
(
filepath
);
var
memi
=
provider
.
Mappings
[
".xlsx"
];
return
File
(
memoryStream
,
memi
,
Path
.
GetFileName
(
fileInfo
.
Name
));
}
#
endregion
}
}
\ No newline at end of file
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
43e9ea87
...
...
@@ -544,22 +544,24 @@
<param
name=
"datas"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptCompute(System.Int32,System.String,System.String)"
>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptCompute(System.Int32,System.String,System.String
,System.String
)"
>
<summary>
科室考勤上报录入结果统计
</summary>
<param
name=
"allotId"
>
绩效月ID
</param>
<param
name=
"unitType"
>
核算组别
</param>
<param
name=
"accountingUnit"
>
核算单元
</param>
<param
name=
"searchTxet"
>
工号/姓名
</param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DownloadDeptCompute(System.Int32,System.String,System.String)"
>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DownloadDeptCompute(System.Int32,System.String,System.String
,System.String
)"
>
<summary>
科室考勤上报录入结果统计下载
</summary>
<param
name=
"allotId"
>
绩效月ID
</param>
<param
name=
"unitType"
>
核算组别
</param>
<param
name=
"accountingUnit"
>
核算单元
</param>
<param
name=
"searchTxet"
>
工号/姓名
</param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptSubmit(System.Int32,System.String,System.Collections.Generic.List{Performance.DtoModels.Request.AttendanceDept})"
>
...
...
@@ -589,25 +591,55 @@
<param
name=
"audit"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptDetail(System.Int32,System.String,System.String)"
>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptDetail(System.Int32,System.String,System.String
,System.String
)"
>
<summary>
科室考勤上报结果详情
</summary>
<param
name=
"allotId"
>
绩效月ID
</param>
<param
name=
"unitType"
>
核算组别
</param>
<param
name=
"accountingUnit"
>
核算单元
</param>
<param
name=
"searchTxet"
>
工号/姓名
</param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptDetailDownload(System.Int32,System.String,System.String,System.String)"
>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptDetailDownload(System.Int32,System.String,System.String,System.String
,System.String
)"
>
<summary>
科室考勤上报结果详情下载
</summary>
<param
name=
"allotId"
>
绩效月ID
</param>
<param
name=
"unitType"
>
核算组别
</param>
<param
name=
"accountingUnit"
>
核算单元
</param>
<param
name=
"searchTxet"
>
工号/姓名
</param>
<param
name=
"fileName"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptReport(System.Int32,System.String,System.String,System.String)"
>
<summary>
科室考勤上报汇总统计
</summary>
<param
name=
"allotId"
>
绩效月ID
</param>
<param
name=
"unitType"
>
核算组别
</param>
<param
name=
"accountingUnit"
>
核算单元
</param>
<param
name=
"searchTxet"
>
工号/姓名
</param>
<returns></returns>
<exception
cref=
"T:Performance.DtoModels.PerformanceException"
></exception>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptReportRefresh(System.Int32)"
>
<summary>
科室考勤上报汇总数据刷新
</summary>
<param
name=
"allotId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DownloadDeptReport(System.Int32,System.String,System.String,System.String)"
>
<summary>
科室考勤上报汇总统计下载
</summary>
<param
name=
"allotId"
>
绩效月ID
</param>
<param
name=
"unitType"
>
核算组别
</param>
<param
name=
"accountingUnit"
>
核算单元
</param>
<param
name=
"searchTxet"
>
工号/姓名
</param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.BudgetController.Query(Performance.DtoModels.Request.BudgetRequest)"
>
<summary>
预算管理查询(包含金额、占比)
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
43e9ea87
...
...
@@ -3363,6 +3363,76 @@
是否附带上次绩效 0 不附带 1 附带
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.Code"
>
<summary>
核算单元编码
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.AllotID"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.UnitType"
>
<summary>
核算组别
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.AccountingUnit"
>
<summary>
核算单元
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.Department"
>
<summary>
科室名称
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.PersonnelNumber"
>
<summary>
工号
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.PersonnelName"
>
<summary>
姓名
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.PermanentStaff"
>
<summary>
人员系数
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.BeginDate"
>
<summary>
在科开始时间
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.EndDate"
>
<summary>
在科结束时间
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReport.AttendanceDays"
>
<summary>
出勤天数
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReportItem.Value"
>
<summary>
请假天数
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReportItem.Title"
>
<summary>
考勤类型
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceDeptReportItem.Remark"
>
<summary>
备注
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AttendanceStatistics.Code"
>
<summary>
核算单元编码
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
43e9ea87
...
...
@@ -6203,6 +6203,81 @@
01日
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.HospitalId"
>
<summary>
医院Id
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.AllotId"
>
<summary>
绩效Id
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.Code"
>
<summary>
核算单元编码
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.UnitType"
>
<summary>
人员类别
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.AccountingUnit"
>
<summary>
核算单元
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.PersonnelNumber"
>
<summary>
工号
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.PersonnelName"
>
<summary>
姓名
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.PermanentStaff"
>
<summary>
人员系数
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.BeginDate"
>
<summary>
在科开始时间
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.EndDate"
>
<summary>
在科结束时间
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.WorkFullDays"
>
<summary>
全勤天数
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.AttendanceDays"
>
<summary>
出勤天数
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.DeductionDays"
>
<summary>
核减天数
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.NoDeductionDays"
>
<summary>
不核减天数
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept_report.CreateTime"
>
<summary>
创建时间
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_issue.HospitalId"
>
<summary>
医院Id
...
...
performance/Performance.DtoModels/Response/AttendanceDeptReport.cs
0 → 100644
View file @
43e9ea87
using
System
;
using
System.Collections.Generic
;
namespace
Performance.DtoModels
{
public
class
AttendanceDeptReport
{
/// <summary>
/// 核算单元编码
/// </summary>
public
string
Code
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
AllotID
{
get
;
set
;
}
/// <summary>
/// 核算组别
/// </summary>
public
string
UnitType
{
get
;
set
;
}
/// <summary>
/// 核算单元
/// </summary>
public
string
AccountingUnit
{
get
;
set
;
}
/// <summary>
/// 科室名称
/// </summary>
public
string
Department
{
get
;
set
;
}
/// <summary>
/// 工号
/// </summary>
public
string
PersonnelNumber
{
get
;
set
;
}
/// <summary>
/// 姓名
/// </summary>
public
string
PersonnelName
{
get
;
set
;
}
/// <summary>
/// 人员系数
/// </summary>
public
decimal
?
PermanentStaff
{
get
;
set
;
}
/// <summary>
/// 在科开始时间
/// </summary>
public
DateTime
BeginDate
{
get
;
set
;
}
/// <summary>
/// 在科结束时间
/// </summary>
public
DateTime
EndDate
{
get
;
set
;
}
public
List
<
AttendanceDeptReportItem
>
Detial
{
get
;
set
;
}
/// <summary>
/// 出勤天数
/// </summary>
public
int
AttendanceDays
{
get
;
set
;
}
}
public
class
AttendanceDeptReportItem
{
/// <summary>
/// 请假天数
/// </summary>
public
object
Value
{
get
;
set
;
}
/// <summary>
/// 考勤类型
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
Remark
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Context/PerformanceDbContext.cs
View file @
43e9ea87
...
...
@@ -255,6 +255,7 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public
virtual
DbSet
<
sys_version
>
sys_version
{
get
;
set
;
}
public
virtual
DbSet
<
per_attendance
>
per_attendance
{
get
;
set
;
}
public
virtual
DbSet
<
per_attendance_dept
>
per_attendance_dept
{
get
;
set
;
}
public
virtual
DbSet
<
per_attendance_dept_report
>
per_attendance_dept_report
{
get
;
set
;
}
public
virtual
DbSet
<
per_attendance_issue
>
per_attendance_issue
{
get
;
set
;
}
public
virtual
DbSet
<
per_attendance_type
>
per_attendance_type
{
get
;
set
;
}
public
virtual
DbSet
<
per_attendance_vacation
>
per_attendance_vacation
{
get
;
set
;
}
...
...
performance/Performance.EntityModels/Entity/per_attendance_dept_report.cs
0 → 100644
View file @
43e9ea87
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Performance.EntityModels.Entity
{
[
Table
(
"per_attendance_dept_report"
)]
public
class
per_attendance_dept_report
{
[
Key
]
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 医院Id
/// </summary>
public
int
HospitalId
{
get
;
set
;
}
/// <summary>
/// 绩效Id
/// </summary>
public
int
AllotId
{
get
;
set
;
}
/// <summary>
/// 核算单元编码
/// </summary>
public
string
Code
{
get
;
set
;
}
/// <summary>
/// 人员类别
/// </summary>
public
string
UnitType
{
get
;
set
;
}
/// <summary>
/// 核算单元
/// </summary>
public
string
AccountingUnit
{
get
;
set
;
}
/// <summary>
/// 工号
/// </summary>
public
string
PersonnelNumber
{
get
;
set
;
}
/// <summary>
/// 姓名
/// </summary>
public
string
PersonnelName
{
get
;
set
;
}
/// <summary>
/// 人员系数
/// </summary>
public
decimal
?
PermanentStaff
{
get
;
set
;
}
/// <summary>
/// 在科开始时间
/// </summary>
public
DateTime
?
BeginDate
{
get
;
set
;
}
/// <summary>
/// 在科结束时间
/// </summary>
public
DateTime
?
EndDate
{
get
;
set
;
}
/// <summary>
/// 全勤天数
/// </summary>
public
int
WorkFullDays
{
get
;
set
;
}
/// <summary>
/// 出勤天数
/// </summary>
public
int
AttendanceDays
{
get
;
set
;
}
/// <summary>
/// 核减天数
/// </summary>
public
int
DeductionDays
{
get
;
set
;
}
/// <summary>
/// 不核减天数
/// </summary>
public
int
NoDeductionDays
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
?
CreateTime
{
get
;
set
;
}
}
}
performance/Performance.Repository/Repository/PerforPerAttendanceDeptReportRepository.cs
0 → 100644
View file @
43e9ea87
using
Performance.EntityModels
;
using
Performance.EntityModels.Entity
;
namespace
Performance.Repository.Repository
{
public
partial
class
PerforPerAttendanceDeptReportRepository
:
PerforRepository
<
per_attendance_dept_report
>
{
/// <summary>
/// per_attendance Repository
/// </summary>
public
PerforPerAttendanceDeptReportRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Services/AttendanceService.cs
View file @
43e9ea87
using
AutoMapper
;
using
GraphQL
;
using
K4os.Compression.LZ4.Internal
;
using
MassTransit
;
using
MassTransit.Internals.Extensions
;
using
Microsoft.AspNetCore.Routing
;
using
Microsoft.EntityFrameworkCore.Metadata.Internal
;
using
Microsoft.Extensions.Logging
;
using
MySqlX.XDevAPI.Common
;
using
Newtonsoft.Json
;
...
...
@@ -53,6 +55,7 @@ public class AttendanceService : IAutoInjection
private
readonly
PerforPeremployeeRepository
perforPeremployeeRepository
;
private
readonly
PerforCofaccountingRepository
cofaccountingRepository
;
private
readonly
PerforPerAttendanceDeptRepository
_attendanceDeptRepository
;
private
readonly
PerforPerAttendanceDeptReportRepository
_perforPerAttendanceDeptReportRepository
;
private
readonly
RoleService
roleService
;
private
readonly
UserService
userService
;
public
AttendanceService
(
...
...
@@ -69,6 +72,7 @@ public class AttendanceService : IAutoInjection
PerforPeremployeeRepository
perforPeremployeeRepository
,
PerforCofaccountingRepository
cofaccountingRepository
,
PerforPerAttendanceDeptRepository
attendanceDeptRepository
,
PerforPerAttendanceDeptReportRepository
perforPerAttendanceDeptReportRepository
,
RoleService
roleService
,
UserService
userService
)
...
...
@@ -86,6 +90,7 @@ UserService userService
this
.
perforPeremployeeRepository
=
perforPeremployeeRepository
;
this
.
cofaccountingRepository
=
cofaccountingRepository
;
_attendanceDeptRepository
=
attendanceDeptRepository
;
_perforPerAttendanceDeptReportRepository
=
perforPerAttendanceDeptReportRepository
;
this
.
roleService
=
roleService
;
this
.
userService
=
userService
;
}
...
...
@@ -1793,7 +1798,16 @@ public ApiResponse DeptSave(int allotId, List<AttendanceDept> datas, string unit
return
new
ApiResponse
(
ResponseType
.
OK
,
"保存成功"
);
}
public
ApiResponse
<
List
<
AttendanceStatistics
>>
DeptCompute
(
int
allotId
,
string
unitType
,
string
accountingUnit
)
/// <summary>
/// 考勤上报结果统计
/// </summary>
/// <param name="allotId"></param>
/// <param name="unitType"></param>
/// <param name="accountingUnit"></param>
/// <param name="datas"></param>
/// <returns></returns>
/// <exception cref="PerformanceException"></exception>
public
ApiResponse
<
List
<
AttendanceStatistics
>>
DeptCompute
(
int
allotId
,
List
<
AttendanceDeptMore
>
datas
)
{
var
allot
=
perforPerallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
);
if
(
allot
==
null
)
...
...
@@ -1803,16 +1817,7 @@ public ApiResponse<List<AttendanceStatistics>> DeptCompute(int allotId, string u
var
endMonthDate
=
begMonthDate
.
AddMonths
(
1
).
AddDays
(-
1
);
var
statistics
=
new
List
<
AttendanceStatistics
>();
var
deptDetail
=
DeptDetail
(
allotId
,
unitType
,
accountingUnit
);
if
(
deptDetail
?.
Data
?.
Data
==
null
)
return
new
ApiResponse
<
List
<
AttendanceStatistics
>>(
ResponseType
.
OK
,
""
,
statistics
);
var
datas
=
deptDetail
.
Data
.
Data
;
var
types
=
perfoPperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
)
??
new
List
<
per_attendance_type
>();
var
cofaccounting
=
cofaccountingRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
allotId
);
//var employees = perforPeremployeeRepository.GetEntities(g => g.AllotId == allotId);
//var attendances = _attendanceDeptRepository.GetEntities((w) => w.AllotId == allotId && queryUnitTypes.Contains(w.UnitType) && queryAccountingUnit.Equals(w.AccountingUnit));
foreach
(
var
item
in
datas
)
{
...
...
@@ -1864,9 +1869,9 @@ public ApiResponse<List<AttendanceStatistics>> DeptCompute(int allotId, string u
var
stat
=
new
AttendanceStatistics
{
AllotID
=
allotId
,
Code
=
cofaccounting
.
FirstOrDefault
(
p
=>
p
.
UnitType
==
unitType
&&
p
.
AccountingUnit
==
accountingUnit
)?
.
Code
??
""
,
UnitType
=
u
nitType
,
AccountingUnit
=
a
ccountingUnit
,
Code
=
item
.
Code
??
""
,
UnitType
=
item
.
U
nitType
,
AccountingUnit
=
item
.
A
ccountingUnit
,
PersonnelNumber
=
item
.
PersonnelNumber
,
PersonnelName
=
item
.
PersonnelName
,
...
...
@@ -1881,7 +1886,7 @@ public ApiResponse<List<AttendanceStatistics>> DeptCompute(int allotId, string u
{
Title
=
w
.
Key
,
Value
=
w
.
Count
(),
Remark
=
""
,
//item
.IsDeduction == (int)Attendance.Deduction.核减 ? "核减" : "不核减",
Remark
=
types
.
FirstOrDefault
(
p
=>
p
.
AttendanceName
==
w
.
Key
)?
.
IsDeduction
==
(
int
)
Attendance
.
Deduction
.
核减
?
"核减"
:
"不核减"
,
}).
ToList
();
foreach
(
var
tp
in
types
)
...
...
@@ -1896,6 +1901,8 @@ public ApiResponse<List<AttendanceStatistics>> DeptCompute(int allotId, string u
});
}
}
int
vacationesDays
=
stat
.
Detial
.
Where
(
w
=>
!
w
.
Remark
.
Contains
(
"不核减"
)).
Sum
(
w
=>
w
.
Value
);
stat
.
AttendanceDays
=
SplitEveryDay
(
stat
.
BeginDate
,
stat
.
EndDate
).
Where
(
date
=>
date
>=
stat
.
BeginDate
&&
date
<=
stat
.
EndDate
).
Count
()
-
vacationesDays
;
statistics
.
Add
(
stat
);
vaildBegDate
=
nextDate
;
...
...
@@ -2031,16 +2038,17 @@ public ApiResponse DeptAudit(int allotId, string unitType, string accountingUnit
if
(
allot
==
null
)
throw
new
PerformanceException
(
"当前绩效记录不存在"
);
var
begMonthDate
=
allot
.
Month
>=
1
&&
allot
.
Month
<=
12
?
new
DateTime
(
allot
.
Year
,
allot
.
Month
,
1
)
:
new
DateTime
(
allot
.
Year
,
12
,
1
);
var
endMonthDate
=
begMonthDate
.
AddMonths
(
1
).
AddDays
(-
1
);
var
attendances
=
_attendanceDeptRepository
.
GetEntities
((
w
)
=>
w
.
AllotId
==
allotId
&&
unitType
.
Equals
(
w
.
UnitType
)
&&
accountingUnit
.
Equals
(
w
.
AccountingUnit
))
??
new
List
<
per_attendance_dept
>();
if
(
attendances
.
Count
()
==
0
)
throw
new
PerformanceException
(
"当前考勤暂无数据,无法审核!"
);
if
(
attendances
.
Count
()
!=
attendances
.
Count
(
w
=>
w
.
State
==
(
int
)
Attendance
.
Report
.
提交
))
throw
new
PerformanceException
(
"当前考勤尚未提交,请勿审核!"
);
//if (attendances.Count() == attendances.Count(w => w.State == (int)Attendance.Report.通过))
// throw new PerformanceException("当前考勤已审核通过,无需审核!");
//if (attendances.Count() != attendances.Count(w => w.State == (int)Attendance.Report.提交))
// throw new PerformanceException("当前考勤尚未提交,请勿审核!");
var
optTime
=
DateTime
.
Now
;
foreach
(
var
item
in
attendances
)
...
...
@@ -2053,10 +2061,117 @@ public ApiResponse DeptAudit(int allotId, string unitType, string accountingUnit
if
(
attendances
.
Any
())
{
_attendanceDeptRepository
.
UpdateRange
(
attendances
.
ToArray
());
DeptReportRefresh
(
allot
,
state
,
attendances
);
}
return
new
ApiResponse
(
ResponseType
.
OK
,
"审核成功"
);
}
/// <summary>
/// 通过或驳回后存储删除数据
/// </summary>
/// <param name="allotId"></param>
/// <param name="state"></param>
public
void
DeptReportRefresh
(
int
allotId
,
int
state
)
{
var
allot
=
perforPerallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"当前绩效记录不存在"
);
var
attendances
=
_attendanceDeptRepository
.
GetEntities
((
w
)
=>
w
.
AllotId
==
allot
.
ID
)
??
new
List
<
per_attendance_dept
>();
DeptReportRefresh
(
allot
,
state
,
attendances
);
}
/// <summary>
/// 通过或驳回后存储删除数据
/// </summary>
/// <param name="allot"></param>
/// <param name="state"></param>
/// <param name="attendances"></param>
public
void
DeptReportRefresh
(
per_allot
allot
,
int
state
,
List
<
per_attendance_dept
>
attendances
)
{
attendances
??=
new
List
<
per_attendance_dept
>();
var
types
=
perfoPperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
)
??
new
List
<
per_attendance_type
>();
Func
<
int
?,
string
>
getAattendanceType
=
(
typeId
)
=>
typeId
>
0
?
types
.
FirstOrDefault
(
w
=>
w
.
Id
==
typeId
)?.
AttendanceName
??
"考勤类型缺失"
:
""
;
List
<
AttendanceDeptMore
>
datas
=
attendances
.
Select
(
w
=>
new
AttendanceDeptMore
{
AllotId
=
allot
.
ID
,
Code
=
w
.
Code
,
UnitType
=
w
.
UnitType
,
AccountingUnit
=
w
.
AccountingUnit
,
PersonnelNumber
=
w
.
PersonnelNumber
,
PersonnelName
=
w
.
PersonnelName
,
PermanentStaff
=
w
.
PermanentStaff
,
AuditTime
=
DateTime
.
Now
,
AuditUser
=
""
,
Day01
=
getAattendanceType
(
w
.
Day01
),
Day02
=
getAattendanceType
(
w
.
Day02
),
Day03
=
getAattendanceType
(
w
.
Day03
),
Day04
=
getAattendanceType
(
w
.
Day04
),
Day05
=
getAattendanceType
(
w
.
Day05
),
Day06
=
getAattendanceType
(
w
.
Day06
),
Day07
=
getAattendanceType
(
w
.
Day07
),
Day08
=
getAattendanceType
(
w
.
Day08
),
Day09
=
getAattendanceType
(
w
.
Day09
),
Day10
=
getAattendanceType
(
w
.
Day10
),
Day11
=
getAattendanceType
(
w
.
Day11
),
Day12
=
getAattendanceType
(
w
.
Day12
),
Day13
=
getAattendanceType
(
w
.
Day13
),
Day14
=
getAattendanceType
(
w
.
Day14
),
Day15
=
getAattendanceType
(
w
.
Day15
),
Day16
=
getAattendanceType
(
w
.
Day16
),
Day17
=
getAattendanceType
(
w
.
Day17
),
Day18
=
getAattendanceType
(
w
.
Day18
),
Day19
=
getAattendanceType
(
w
.
Day19
),
Day20
=
getAattendanceType
(
w
.
Day20
),
Day21
=
getAattendanceType
(
w
.
Day21
),
Day22
=
getAattendanceType
(
w
.
Day22
),
Day23
=
getAattendanceType
(
w
.
Day23
),
Day24
=
getAattendanceType
(
w
.
Day24
),
Day25
=
getAattendanceType
(
w
.
Day25
),
Day26
=
getAattendanceType
(
w
.
Day26
),
Day27
=
getAattendanceType
(
w
.
Day27
),
Day28
=
getAattendanceType
(
w
.
Day28
),
Day29
=
getAattendanceType
(
w
.
Day29
),
Day30
=
getAattendanceType
(
w
.
Day30
),
Day31
=
getAattendanceType
(
w
.
Day31
),
}).
ToList
();
var
computeResult
=
DeptCompute
(
allot
.
ID
,
datas
)?.
Data
??
new
List
<
AttendanceStatistics
>();
var
newEntities
=
computeResult
.
Select
(
item
=>
{
var
deductionDays
=
item
.
Detial
.
Where
(
w
=>
w
.
Remark
.
Equals
(
Attendance
.
Deduction
.
核减
)).
Sum
(
w
=>
w
.
Value
);
var
noDeductionDays
=
item
.
Detial
.
Where
(
w
=>
!
w
.
Remark
.
Equals
(
Attendance
.
Deduction
.
核减
)).
Sum
(
w
=>
w
.
Value
);
return
new
per_attendance_dept_report
{
AllotId
=
allot
.
ID
,
HospitalId
=
allot
.
HospitalId
,
Code
=
item
.
Code
,
UnitType
=
item
.
UnitType
,
AccountingUnit
=
item
.
AccountingUnit
,
PersonnelNumber
=
item
.
PersonnelNumber
,
PersonnelName
=
item
.
PersonnelName
,
PermanentStaff
=
item
.
PermanentStaff
,
BeginDate
=
item
.
BeginDate
,
EndDate
=
item
.
EndDate
,
DeductionDays
=
deductionDays
,
NoDeductionDays
=
noDeductionDays
,
AttendanceDays
=
item
.
AttendanceDays
,
WorkFullDays
=
item
.
AttendanceDays
+
deductionDays
,
CreateTime
=
DateTime
.
Now
,
};
});
var
unitTypes
=
attendances
.
Select
(
w
=>
w
.
UnitType
).
Distinct
().
ToList
();
var
accountingUnits
=
attendances
.
Select
(
w
=>
w
.
AccountingUnit
).
Distinct
().
ToList
();
var
oldEntities
=
_perforPerAttendanceDeptReportRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allot
.
ID
&&
unitTypes
.
Contains
(
w
.
UnitType
)
&&
accountingUnits
.
Contains
(
w
.
AccountingUnit
));
if
(
oldEntities
?.
Any
()
==
true
)
{
_perforPerAttendanceDeptReportRepository
.
RemoveRange
(
oldEntities
.
ToArray
());
}
if
(
state
==
(
int
)
Attendance
.
Report
.
通过
&&
newEntities
?.
Any
()
==
true
)
{
_perforPerAttendanceDeptReportRepository
.
AddRange
(
newEntities
.
ToArray
());
}
}
/// <summary>
/// 科室考勤上报结果详情
...
...
@@ -2065,7 +2180,7 @@ public ApiResponse DeptAudit(int allotId, string unitType, string accountingUnit
/// <param name="unitType"></param>
/// <param name="accountingUnit"></param>
/// <returns></returns>
public
ApiResponse
<
AttendanceDeptDetail
>
DeptDetail
(
int
allotId
,
string
unitType
,
string
accountingUnit
)
public
ApiResponse
<
AttendanceDeptDetail
>
DeptDetail
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
searchTxet
)
{
var
allot
=
perforPerallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
);
if
(
allot
==
null
)
...
...
@@ -2079,6 +2194,8 @@ public ApiResponse<AttendanceDeptDetail> DeptDetail(int allotId, string unitType
deptExpression
=
deptExpression
.
And
(
w
=>
w
.
UnitType
.
Equals
(
unitType
));
if
(!
string
.
IsNullOrEmpty
(
accountingUnit
))
deptExpression
=
deptExpression
.
And
(
w
=>
w
.
AccountingUnit
.
Equals
(
accountingUnit
));
if
(!
string
.
IsNullOrEmpty
(
searchTxet
))
deptExpression
=
deptExpression
.
And
(
w
=>
w
.
PersonnelNumber
.
Contains
(
searchTxet
)
||
w
.
PersonnelName
.
Contains
(
searchTxet
));
var
attendances
=
_attendanceDeptRepository
.
GetEntities
(
deptExpression
)
??
new
List
<
per_attendance_dept
>();
...
...
@@ -2159,7 +2276,113 @@ public ApiResponse<AttendanceDeptDetail> DeptDetail(int allotId, string unitType
}
return
new
ApiResponse
<
AttendanceDeptDetail
>(
ResponseType
.
OK
,
"操作成功"
,
detail
);
}
/// <summary>
/// 科室考勤上报汇总统计
/// </summary>
/// <param name="allotId"></param>
/// <param name="unitType"></param>
/// <param name="accountingUnit"></param>
/// <param name="searchTxet"></param>
/// <returns></returns>
/// <exception cref="PerformanceException"></exception>
public
ApiResponse
<
List
<
AttendanceDeptReport
>>
DeptReport
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
searchTxet
)
{
var
allot
=
perforPerallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"当前绩效记录不存在"
);
var
begMonthDate
=
allot
.
Month
>=
1
&&
allot
.
Month
<=
12
?
new
DateTime
(
allot
.
Year
,
allot
.
Month
,
1
)
:
new
DateTime
(
allot
.
Year
,
12
,
1
);
var
endMonthDate
=
begMonthDate
.
AddMonths
(
1
).
AddDays
(-
1
);
Expression
<
Func
<
per_attendance_dept
,
bool
>>
deptExpression
=
(
w
)
=>
w
.
AllotId
==
allotId
;
if
(!
string
.
IsNullOrEmpty
(
unitType
))
deptExpression
=
deptExpression
.
And
(
w
=>
w
.
UnitType
.
Equals
(
unitType
));
if
(!
string
.
IsNullOrEmpty
(
accountingUnit
))
deptExpression
=
deptExpression
.
And
(
w
=>
w
.
AccountingUnit
.
Equals
(
accountingUnit
));
if
(!
string
.
IsNullOrEmpty
(
searchTxet
))
deptExpression
=
deptExpression
.
And
(
w
=>
w
.
PersonnelNumber
.
Contains
(
searchTxet
)
||
w
.
PersonnelName
.
Contains
(
searchTxet
));
var
types
=
perfoPperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
)
??
new
List
<
per_attendance_type
>();
var
attendances
=
_attendanceDeptRepository
.
GetEntities
(
deptExpression
)
??
new
List
<
per_attendance_dept
>();
var
names
=
typeof
(
per_attendance_dept_report
).
GetProperties
().
Select
(
w
=>
w
.
Name
);
var
rows
=
_service
.
QueryAttendanceDeptReport
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
);
Func
<
int
?,
string
>
getAattendanceType
=
(
typeId
)
=>
typeId
>
0
?
types
.
FirstOrDefault
(
w
=>
w
.
Id
==
typeId
)?.
AttendanceName
??
"考勤类型缺失"
:
""
;
List
<
AttendanceDeptReport
>
items
=
new
List
<
AttendanceDeptReport
>();
foreach
(
var
row
in
rows
)
{
AttendanceDeptReport
item
=
JsonHelper
.
Deserialize
<
AttendanceDeptReport
>(
JsonHelper
.
Serialize
(
row
));
item
.
Detial
=
new
List
<
AttendanceDeptReportItem
>();
var
atte
=
attendances
.
FirstOrDefault
(
w
=>
w
.
UnitType
==
item
.
UnitType
&&
w
.
AccountingUnit
==
item
.
AccountingUnit
&&
w
.
PersonnelNumber
==
item
.
PersonnelNumber
)
??
new
per_attendance_dept
();
var
days
=
new
[]
{
new
{
Date
=
begMonthDate
.
AddDays
(
00
),
TypeId
=
atte
.
Day01
},
new
{
Date
=
begMonthDate
.
AddDays
(
01
),
TypeId
=
atte
.
Day02
},
new
{
Date
=
begMonthDate
.
AddDays
(
02
),
TypeId
=
atte
.
Day03
},
new
{
Date
=
begMonthDate
.
AddDays
(
03
),
TypeId
=
atte
.
Day04
},
new
{
Date
=
begMonthDate
.
AddDays
(
04
),
TypeId
=
atte
.
Day05
},
new
{
Date
=
begMonthDate
.
AddDays
(
05
),
TypeId
=
atte
.
Day06
},
new
{
Date
=
begMonthDate
.
AddDays
(
06
),
TypeId
=
atte
.
Day07
},
new
{
Date
=
begMonthDate
.
AddDays
(
07
),
TypeId
=
atte
.
Day08
},
new
{
Date
=
begMonthDate
.
AddDays
(
08
),
TypeId
=
atte
.
Day09
},
new
{
Date
=
begMonthDate
.
AddDays
(
09
),
TypeId
=
atte
.
Day10
},
new
{
Date
=
begMonthDate
.
AddDays
(
10
),
TypeId
=
atte
.
Day11
},
new
{
Date
=
begMonthDate
.
AddDays
(
11
),
TypeId
=
atte
.
Day12
},
new
{
Date
=
begMonthDate
.
AddDays
(
12
),
TypeId
=
atte
.
Day13
},
new
{
Date
=
begMonthDate
.
AddDays
(
13
),
TypeId
=
atte
.
Day14
},
new
{
Date
=
begMonthDate
.
AddDays
(
14
),
TypeId
=
atte
.
Day15
},
new
{
Date
=
begMonthDate
.
AddDays
(
15
),
TypeId
=
atte
.
Day16
},
new
{
Date
=
begMonthDate
.
AddDays
(
16
),
TypeId
=
atte
.
Day17
},
new
{
Date
=
begMonthDate
.
AddDays
(
17
),
TypeId
=
atte
.
Day18
},
new
{
Date
=
begMonthDate
.
AddDays
(
18
),
TypeId
=
atte
.
Day19
},
new
{
Date
=
begMonthDate
.
AddDays
(
19
),
TypeId
=
atte
.
Day20
},
new
{
Date
=
begMonthDate
.
AddDays
(
20
),
TypeId
=
atte
.
Day21
},
new
{
Date
=
begMonthDate
.
AddDays
(
21
),
TypeId
=
atte
.
Day22
},
new
{
Date
=
begMonthDate
.
AddDays
(
22
),
TypeId
=
atte
.
Day23
},
new
{
Date
=
begMonthDate
.
AddDays
(
23
),
TypeId
=
atte
.
Day24
},
new
{
Date
=
begMonthDate
.
AddDays
(
24
),
TypeId
=
atte
.
Day25
},
new
{
Date
=
begMonthDate
.
AddDays
(
25
),
TypeId
=
atte
.
Day26
},
new
{
Date
=
begMonthDate
.
AddDays
(
26
),
TypeId
=
atte
.
Day27
},
new
{
Date
=
begMonthDate
.
AddDays
(
27
),
TypeId
=
atte
.
Day28
},
new
{
Date
=
begMonthDate
.
AddDays
(
28
),
TypeId
=
atte
.
Day29
},
new
{
Date
=
begMonthDate
.
AddDays
(
29
),
TypeId
=
atte
.
Day30
},
new
{
Date
=
begMonthDate
.
AddDays
(
30
),
TypeId
=
atte
.
Day31
},
};
var
arr
=
days
.
Where
(
w
=>
w
.
Date
.
Date
>=
item
.
BeginDate
.
Date
&&
w
.
Date
.
Date
<=
item
.
EndDate
.
Date
)
.
GroupBy
(
w
=>
w
.
TypeId
)
.
Select
(
w
=>
new
{
TypeId
=
w
.
Key
,
TypeName
=
getAattendanceType
(
w
.
Key
),
Value
=
w
.
Count
()
})
.
ToList
();
foreach
(
var
d
in
arr
)
{
item
.
Detial
.
Add
(
new
AttendanceDeptReportItem
{
Title
=
d
.
TypeName
,
Value
=
d
.
Value
,
Remark
=
types
.
FirstOrDefault
(
w
=>
w
.
Id
==
d
.
TypeId
)?.
IsDeduction
==
(
int
)
Attendance
.
Deduction
.
核减
?
"核减"
:
"不核减"
,
});
}
foreach
(
var
t
in
types
)
{
if
(!
item
.
Detial
.
Any
(
w
=>
w
.
Title
==
t
.
AttendanceName
))
{
item
.
Detial
.
Add
(
new
AttendanceDeptReportItem
{
Title
=
t
.
AttendanceName
,
Value
=
0
,
Remark
=
t
.
IsDeduction
==
(
int
)
Attendance
.
Deduction
.
核减
?
"核减"
:
"不核减"
,
});
}
}
var
dic
=
new
RouteValueDictionary
(
row
);
foreach
(
var
dicItem
in
dic
.
Where
(
w
=>
!
names
.
Any
(
name
=>
name
.
Equals
(
w
.
Key
,
StringComparison
.
OrdinalIgnoreCase
))))
{
item
.
Detial
.
Add
(
new
AttendanceDeptReportItem
{
Title
=
dicItem
.
Key
,
Remark
=
""
,
Value
=
dicItem
.
Value
??
""
});
}
items
.
Add
(
item
);
}
items
=
items
.
OrderBy
(
w
=>
w
.
PersonnelNumber
).
ThenBy
(
w
=>
w
.
BeginDate
).
ToList
();
return
new
ApiResponse
<
List
<
AttendanceDeptReport
>>(
ResponseType
.
OK
,
items
);
}
#
endregion
#
region
拆分请假时间段为每个日期
...
...
@@ -2197,11 +2420,13 @@ public string ExcelDownload(List<Dictionary<string, object>> rows, string name,
var
detRows
=
JsonConvert
.
DeserializeObject
<
List
<
Dictionary
<
string
,
object
>>>(
item
.
Value
.
ToString
());
foreach
(
var
detlist
in
detRows
)
{
string
value
=
""
;
object
value
=
null
;
foreach
(
var
detitem
in
detlist
)
{
if
(
detitem
.
Key
==
"Value"
)
value
=
detitem
.
Value
.
ToString
();
if
(
detitem
.
Key
==
"Title"
)
nobj
[
detitem
.
Value
.
ToString
()]
=
value
;
if
(
detitem
.
Key
.
Equals
(
"Value"
,
StringComparison
.
OrdinalIgnoreCase
))
value
=
detitem
.
Value
;
if
(
detitem
.
Key
.
Equals
(
"Title"
,
StringComparison
.
OrdinalIgnoreCase
))
nobj
[
detitem
.
Value
.
ToString
()]
=
value
;
}
}
...
...
performance/Performance.Services/DapperService.cs
View file @
43e9ea87
...
...
@@ -441,8 +441,7 @@ public int UpdateAllotStates(int allotId, int states, string remark, int generat
/// <param name="allotId"></param>
/// <param name="unitType"></param>
/// <param name="accountingUnit"></param>
/// <param name="personnelName"></param>
/// <param name="personnelNumber"></param>
/// <param name="personnelNameOrNumber"></param>
/// <returns></returns>
public
IEnumerable
<
dynamic
>
QueryAttendanceIssue
(
int
allotId
,
List
<
string
>
unitType
,
string
accountingUnit
,
string
personnelNameOrNumber
)
{
...
...
@@ -481,5 +480,50 @@ public IEnumerable<dynamic> QueryAttendanceIssue(int allotId, List<string> unitT
throw
;
}
}
/// <summary>
/// 查询考勤下发绩效视图(运行视图定义)
/// </summary>
/// <param name="allotId"></param>
/// <param name="unitType"></param>
/// <param name="accountingUnit"></param>
/// <param name="personnelNameOrNumber"></param>
/// <returns></returns>
public
IEnumerable
<
dynamic
>
QueryAttendanceDeptReport
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
personnelNameOrNumber
)
{
try
{
using
(
var
connection
=
new
MySqlConnection
(
_options
.
Value
.
PerformanceConnectionString
))
{
if
(
connection
.
State
!=
ConnectionState
.
Open
)
connection
.
Open
();
string
sql
=
$@"select * from view_attendance_dept where allotID = @allotId"
;
DynamicParameters
parameters
=
new
DynamicParameters
();
parameters
.
Add
(
"@allotId"
,
allotId
);
if
(
unitType
?.
Any
()
==
true
)
{
sql
+=
" and unitType = @unitType"
;
parameters
.
Add
(
"@unitType"
,
unitType
);
}
if
(!
string
.
IsNullOrEmpty
(
accountingUnit
))
{
sql
+=
" and accountingUnit = @accountingUnit"
;
parameters
.
Add
(
"@accountingUnit"
,
accountingUnit
);
}
if
(!
string
.
IsNullOrEmpty
(
personnelNameOrNumber
))
{
sql
+=
" and (personnelNumber like @personnelNameOrNumber or personnelName like @personnelNameOrNumber)"
;
parameters
.
Add
(
"@personnelNameOrNumber"
,
$"%
{
personnelNameOrNumber
}
%"
);
}
return
connection
.
Query
(
sql
,
parameters
,
commandTimeout
:
60
*
60
);
}
}
catch
(
Exception
ex
)
{
_logger
.
LogError
(
$"SQL执行异常:
{
ex
}
"
);
throw
;
}
}
}
}
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