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
77cc2895
Commit
77cc2895
authored
May 31, 2023
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口(dept/compute)结果统计、下载重写
parent
ce1931bb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
63 deletions
+56
-63
performance/Performance.Api/Controllers/AttendanceController.cs
+8
-62
performance/Performance.Api/wwwroot/Performance.Api.xml
+8
-1
performance/Performance.Services/AttendanceService.cs
+0
-0
performance/Performance.Services/DapperService.cs
+40
-0
No files found.
performance/Performance.Api/Controllers/AttendanceController.cs
View file @
77cc2895
...
...
@@ -667,63 +667,12 @@ public ApiResponse DeptSave(int allotId, string unitType, [FromBody] List<Attend
/// <returns></returns>
[
HttpPost
]
[
Route
(
"dept/compute"
)]
public
ApiResponse
<
List
<
Attendance
Statistics
>>
DeptCompute
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
searchTxet
,
[
FromBody
]
List
<
AttendanceDept
>
datas
)
public
ApiResponse
<
List
<
Attendance
DeptReport
>>
DeptCompute
(
int
allotId
,
string
unitType
,
string
accountingUnit
,
string
searchTxet
)
{
if
(!
Enum
.
TryParse
(
unitType
,
out
UnitType
unitType1
))
throw
new
PerformanceException
(
"核算组别错误"
);
List
<
AttendanceDeptMore
>
deptDetail
=
new
List
<
AttendanceDeptMore
>();
if
(
datas
?.
Any
()
!=
true
)
{
deptDetail
=
_attendanceService
.
DeptDetail
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
)?.
Data
?.
Data
??
new
List
<
AttendanceDeptMore
>();
}
else
{
deptDetail
=
datas
.
Select
(
w
=>
new
AttendanceDeptMore
{
AllotId
=
allotId
,
Code
=
""
,
UnitType
=
unitType
,
AccountingUnit
=
accountingUnit
,
PersonnelNumber
=
w
.
PersonnelNumber
,
PersonnelName
=
w
.
PersonnelName
,
PermanentStaff
=
w
.
PermanentStaff
,
AuditTime
=
DateTime
.
Now
,
AuditUser
=
""
,
Day01
=
w
.
Day01
,
Day02
=
w
.
Day02
,
Day03
=
w
.
Day03
,
Day04
=
w
.
Day04
,
Day05
=
w
.
Day05
,
Day06
=
w
.
Day06
,
Day07
=
w
.
Day07
,
Day08
=
w
.
Day08
,
Day09
=
w
.
Day09
,
Day10
=
w
.
Day10
,
Day11
=
w
.
Day11
,
Day12
=
w
.
Day12
,
Day13
=
w
.
Day13
,
Day14
=
w
.
Day14
,
Day15
=
w
.
Day15
,
Day16
=
w
.
Day16
,
Day17
=
w
.
Day17
,
Day18
=
w
.
Day18
,
Day19
=
w
.
Day19
,
Day20
=
w
.
Day20
,
Day21
=
w
.
Day21
,
Day22
=
w
.
Day22
,
Day23
=
w
.
Day23
,
Day24
=
w
.
Day24
,
Day25
=
w
.
Day25
,
Day26
=
w
.
Day26
,
Day27
=
w
.
Day27
,
Day28
=
w
.
Day28
,
Day29
=
w
.
Day29
,
Day30
=
w
.
Day30
,
Day31
=
w
.
Day31
,
}).
ToList
();
}
return
_attendanceService
.
DeptCompute
(
allotId
,
deptDetail
);
return
_attendanceService
.
DeptComputeReport
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
);
}
/// <summary>
...
...
@@ -749,24 +698,21 @@ public IActionResult DownloadDeptCompute(int allotId, string unitType, string ac
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
type
=
_attendanceService
.
GetAttendanceType
(
allotId
);
foreach
(
var
item
in
type
.
Data
)
var
res
=
_attendanceService
.
DeptComputeReport
(
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
.
AttendanceName
,
Name
=
item
.
AttendanceName
});
excelDownloadHeads
.
Add
(
new
ExcelDownloadHeads
()
{
Alias
=
item
,
Name
=
item
});
}
excelDownloadHeads
.
Add
(
new
ExcelDownloadHeads
()
{
Alias
=
"出勤天数"
,
Name
=
"AttendanceDays"
});
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
);
var
filepath
=
_attendanceService
.
ExcelDownload
(
rows
,
"
科室上报考勤结果
"
,
allotId
,
excelDownloadHeads
);
var
filepath
=
_attendanceService
.
ExcelDownload
(
rows
,
"
考勤上报统计
"
,
allotId
,
excelDownloadHeads
);
var
memoryStream
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
filepath
,
FileMode
.
Open
))
...
...
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
77cc2895
...
...
@@ -779,7 +779,7 @@
<param
name=
"datas"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptCompute(System.Int32,System.String,System.String,System.String
,System.Collections.Generic.List{Performance.DtoModels.Request.AttendanceDept}
)"
>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DeptCompute(System.Int32,System.String,System.String,System.String)"
>
<summary>
科室考勤上报录入结果统计
</summary>
...
...
@@ -1045,6 +1045,13 @@
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.ComputeController.UniteDeptDetail(Performance.DtoModels.DeptDetailRequest)"
>
<summary>
科室绩效详情
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.ComputeController.DeptDetail(Performance.DtoModels.DeptDetailRequest)"
>
<summary>
科室绩效详情
...
...
performance/Performance.Services/AttendanceService.cs
View file @
77cc2895
This diff is collapsed.
Click to expand it.
performance/Performance.Services/DapperService.cs
View file @
77cc2895
...
...
@@ -525,5 +525,45 @@ public IEnumerable<dynamic> QueryAttendanceDeptReport(int allotId, string unitTy
throw
;
}
}
public
IEnumerable
<
dynamic
>
QueryAttendanceDeptReportCompute
(
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_compute_report 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