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
6be8cabb
Commit
6be8cabb
authored
Jun 19, 2024
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
审核医院其他绩效时,使用异步/加载上月调整/考勤上报添加排序
parent
cbeef790
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
126 additions
and
53 deletions
+126
-53
performance/Performance.Api/Controllers/EmployeeController.cs
+3
-2
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+5
-0
performance/Performance.EntityModels/Entity/per_attendance_dept.cs
+4
-1
performance/Performance.Services/AttendanceService.cs
+12
-11
performance/Performance.Services/CopyService.cs
+74
-34
performance/Performance.Services/DapperService.cs
+21
-1
performance/Performance.Services/EmployeeService.cs
+7
-4
No files found.
performance/Performance.Api/Controllers/EmployeeController.cs
View file @
6be8cabb
...
...
@@ -2,6 +2,7 @@
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
FluentValidation.AspNetCore
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Http
;
...
...
@@ -422,10 +423,10 @@ public ApiResponse CommitResult([FromBody] AprAmountAuditRequest request)
/// <returns></returns>
[
HttpPost
]
[
Route
(
"apr/audit"
)]
public
ApiResponse
AuditResult
([
FromBody
]
AprAmountAuditRequest
request
)
public
async
Task
<
ApiResponse
>
AuditResult
([
FromBody
]
AprAmountAuditRequest
request
)
{
var
userid
=
claim
.
GetUserId
();
return
employeeService
.
ConfirmAudit
(
userid
,
request
);
return
await
employeeService
.
ConfirmAudit
(
userid
,
request
);
}
/// <summary>
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
6be8cabb
...
...
@@ -6308,6 +6308,11 @@
状态(未提交 = 1,提交 =2,通过 = 3,驳回 = 4)
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept.Sort"
>
<summary>
科室(考勤上报)排序
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept.SubmitUser"
>
<summary>
提交用户
...
...
performance/Performance.EntityModels/Entity/per_attendance_dept.cs
View file @
6be8cabb
...
...
@@ -57,7 +57,10 @@ public class per_attendance_dept
/// 状态(未提交 = 1,提交 =2,通过 = 3,驳回 = 4)
/// </summary>
public
int
State
{
get
;
set
;
}
/// <summary>
/// 科室(考勤上报)排序
/// </summary>
public
int
Sort
{
get
;
set
;
}
/// <summary>
/// 提交用户
/// </summary>
...
...
performance/Performance.Services/AttendanceService.cs
View file @
6be8cabb
...
...
@@ -727,9 +727,6 @@ public ApiResponse AttendanceTypeBatch(int allotId, int hospitalId, SaveCollectD
return
new
ApiResponse
(
ResponseType
.
OK
,
""
);
}
/// <summary>
/// 加载默认考勤类型
/// </summary>
...
...
@@ -1662,15 +1659,17 @@ public ApiResponse DeptLoad(int allotId, int userid, string userName)
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
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
userInfo
=
_userRepository
.
GetUser
(
userid
);
if
(
userInfo
?.
User
==
null
)
throw
new
NotImplementedException
(
"当前用户不存在"
);
if
(
userInfo
?
.
URole
==
null
)
throw
new
NotImplementedException
(
"当前用户暂未分配角色"
);
if
(
userInfo
.
URole
==
null
)
throw
new
NotImplementedException
(
"当前用户暂未分配角色"
);
var
queryUnitTypes
=
UnitTypeUtil
.
GetMaps
(
userInfo
?
.
URole
.
Type
??
0
);
var
queryUnitTypes
=
UnitTypeUtil
.
GetMaps
(
userInfo
.
URole
.
Type
??
0
);
var
queryAccountingUnit
=
userInfo
.
User
.
Department
;
Expression
<
Func
<
per_attendance_dept
,
bool
>>
deptExpression
=
(
w
)
=>
w
.
AllotId
==
allotId
;
...
...
@@ -1708,6 +1707,7 @@ public ApiResponse DeptLoad(int allotId, int userid, string userName)
List
<
Dictionary
<
string
,
object
>>
datas
=
new
List
<
Dictionary
<
string
,
object
>>();
if
(
attendances
.
Any
())
{
attendances
=
attendances
.
OrderBy
(
w
=>
w
.
Sort
).
ToList
();
foreach
(
var
item
in
attendances
)
{
Dictionary
<
string
,
object
>
row
=
new
Dictionary
<
string
,
object
>();
...
...
@@ -1940,7 +1940,8 @@ public ApiResponse DeptSave(int allotId, List<AttendanceDept> datas, string unit
AccountingUnit
=
accountingUnit
,
PersonnelNumber
=
row
.
PersonnelNumber
,
PersonnelName
=
row
.
PersonnelName
,
PermanentStaff
=
row
.
PermanentStaff
??
emp
?.
PermanentStaff
PermanentStaff
=
row
.
PermanentStaff
??
emp
?.
PermanentStaff
,
Sort
=
item
.
ind
};
for
(
int
day
=
1
;
day
<=
31
;
day
++)
{
...
...
@@ -1955,7 +1956,7 @@ public ApiResponse DeptSave(int allotId, List<AttendanceDept> datas, string unit
attendance
.
PersonnelNumber
=
row
.
PersonnelNumber
;
attendance
.
PersonnelName
=
row
.
PersonnelName
;
attendance
.
PermanentStaff
=
row
.
PermanentStaff
??
emp
?.
PermanentStaff
;
attendance
.
Sort
=
item
.
ind
;
for
(
int
day
=
1
;
day
<=
31
;
day
++)
{
string
dayPropertyName
=
$"Day
{
day
:
00
}
"
;
...
...
@@ -2563,7 +2564,7 @@ public ApiResponse<AttendanceDeptDetail> DeptDetail(int allotId, string unitType
var
types
=
perfoPperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
)
??
new
List
<
per_attendance_type
>();
Func
<
int
?,
string
>
getAattendanceType
=
(
typeId
)
=>
typeId
>
0
?
types
.
FirstOrDefault
(
w
=>
w
.
Id
==
typeId
)?.
AttendanceName
??
"考勤类型缺失"
:
""
;
foreach
(
var
row
in
attendances
)
foreach
(
var
row
in
attendances
.
OrderBy
(
w
=>
w
.
Sort
).
ToList
()
)
{
var
accounting
=
cofaccounting
.
FirstOrDefault
(
p
=>
p
.
UnitType
==
unitType
&&
p
.
AccountingUnit
==
accountingUnit
);
var
attendance
=
new
AttendanceDeptMore
...
...
@@ -2646,7 +2647,7 @@ public ApiResponse<List<AttendanceDeptReport>> DeptReport(int allotId, string un
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
attendances
=
_attendanceDeptRepository
.
GetEntities
(
deptExpression
)
.
OrderBy
(
w
=>
w
.
Sort
).
ToList
()
??
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
??
"考勤类型缺失"
:
""
;
...
...
@@ -2785,7 +2786,7 @@ public ApiResponse<List<AttendanceDeptReport>> DeptComputeReport(int allotId, st
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
attendances
=
_attendanceDeptRepository
.
GetEntities
(
deptExpression
)
.
OrderBy
(
w
=>
w
.
Sort
).
ToList
()
??
new
List
<
per_attendance_dept
>();
var
names
=
typeof
(
per_attendance_dept_report
).
GetProperties
().
Select
(
w
=>
w
.
Name
);
var
rows
=
_service
.
QueryAttendanceDeptReportCompute
(
allotId
,
unitType
,
accountingUnit
,
searchTxet
);
Func
<
int
?,
string
>
getAattendanceType
=
(
typeId
)
=>
typeId
>
0
?
types
.
FirstOrDefault
(
w
=>
w
.
Id
==
typeId
)?.
AttendanceName
??
"考勤类型缺失"
:
""
;
...
...
performance/Performance.Services/CopyService.cs
View file @
6be8cabb
using
GraphQL
;
using
Microsoft.Extensions.Logging
;
using
OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
;
using
Performance.DtoModels
;
using
Performance.DtoModels.Request
;
using
Performance.EntityModels
;
...
...
@@ -364,49 +365,88 @@ public void Copy_AttendanceType(per_allot allot, int prevAllotId)
var
successfulType
=
_pperAttendanceTypeRepository
.
AddRange
(
perAttendanceTypeList
.
ToArray
());
if
(
successfulType
)
{
var
prevPerEmployee
=
_perforPeremployeeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
prevAllotId
&&
g
.
IsVerify
==
1
);
if
(!
prevPerEmployee
.
Any
())
return
;
// 当月的考勤上报
var
attDepts
=
_perforPerAttendanceDeptRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(!
attDepts
.
Any
())
var
attDepts
=
_perforPerAttendanceDeptRepository
.
GetEntities
();
if
(!
attDepts
.
Exists
(
w
=>
w
.
AllotId
==
allot
.
ID
))
{
//查询默认考勤类型
var
typeDefault
=
_pperAttendanceTypeRepository
.
GetEntity
(
g
=>
g
.
AllotId
==
allot
.
ID
&&
g
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
)?.
Id
??
null
;
var
cofaccounting
=
_cofaccountingRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
prevAllotId
);
var
typeDefault
=
_pperAttendanceTypeRepository
.
GetEntity
(
g
=>
g
.
AllotId
==
allot
.
ID
&&
g
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
)?.
Id
;
int
currentMonth
=
DateTime
.
DaysInMonth
(
allot
.
Year
,
allot
.
Month
);
var
newAttDepts
=
prevPerEmployee
.
Select
(
t
=>
var
updateAttDepts
=
new
List
<
per_attendance_dept
>();
var
previousAttDepts
=
attDepts
.
Where
(
w
=>
w
.
AllotId
==
prevAllotId
).
ToList
();
foreach
(
var
item
in
previousAttDepts
)
{
var
code
=
cofaccounting
.
Where
(
p
=>
p
.
UnitType
==
t
.
UnitType
&&
p
.
AccountingUnit
==
t
.
AccountingUnit
)
.
Select
(
p
=>
p
.
Code
)
.
FirstOrDefault
()
??
""
;
var
newDept
=
new
per_attendance_dept
var
updateAttDept
=
new
per_attendance_dept
{
HospitalId
=
t
.
HospitalId
,
HospitalId
=
item
.
HospitalId
,
AllotId
=
allot
.
ID
,
PersonnelName
=
t
.
DoctorName
,
PersonnelNumber
=
t
.
PersonnelNumber
,
PermanentStaff
=
t
.
PermanentStaff
??
0
,
Code
=
code
,
UnitType
=
t
.
UnitType
,
AccountingUnit
=
t
.
AccountingUnit
,
State
=
(
int
)
Attendance
.
Report
.
未提交
PersonnelNumber
=
item
.
PersonnelNumber
,
PersonnelName
=
item
.
PersonnelName
,
PermanentStaff
=
item
.
PermanentStaff
,
Code
=
item
.
Code
,
UnitType
=
item
.
UnitType
,
AccountingUnit
=
item
.
AccountingUnit
,
State
=
(
int
)
Attendance
.
Report
.
未提交
,
Sort
=
item
.
Sort
};
for
(
int
i
=
1
;
i
<=
currentMonth
;
i
++)
for
(
int
day
=
1
;
day
<=
currentMonth
;
day
++)
{
typeof
(
per_attendance_dept
).
GetProperty
(
$"Day
{
i
:
d2
}
"
)?.
SetValue
(
newDept
,
typeDefault
);
var
property
=
typeof
(
per_attendance_dept
).
GetProperty
(
$"Day
{
day
:
d2
}
"
);
if
(
property
!=
null
)
{
property
.
SetValue
(
updateAttDept
,
typeDefault
);
}
}
return
newDept
;
}).
ToList
();
_perforPerAttendanceDeptRepository
.
AddRange
(
newAttDepts
.
ToArray
());
updateAttDepts
.
Add
(
updateAttDept
);
}
_perforPerAttendanceDeptRepository
.
AddRange
(
updateAttDepts
.
ToArray
());
}
}
#
region
(旧)考勤上报加载上月
//if (successfulType)
//{
// var prevPerEmployee = _perforPeremployeeRepository.GetEntities(g => g.AllotId == prevAllotId && g.IsVerify == 1);
// if (!prevPerEmployee.Any()) return;
// // 当月的考勤上报
// var attDepts = _perforPerAttendanceDeptRepository.GetEntities(w => w.AllotId == allot.ID).ToList();
// if (!attDepts.Any())
// {
// //查询默认考勤类型
// var typeDefault = _pperAttendanceTypeRepository.GetEntity(g => g.AllotId == allot.ID && g.IsDefault == (int)Attendance.Default.默认)?.Id ?? null;
// var cofaccounting = _cofaccountingRepository.GetEntities(g => g.AllotId == prevAllotId);
// int currentMonth = DateTime.DaysInMonth(allot.Year, allot.Month);
// var newAttDepts = prevPerEmployee.Select(t =>
// {
// var code = cofaccounting
// .Where(p => p.UnitType == t.UnitType && p.AccountingUnit == t.AccountingUnit)
// .Select(p => p.Code)
// .FirstOrDefault() ?? "";
// var newDept = new per_attendance_dept
// {
// HospitalId = t.HospitalId,
// AllotId = allot.ID,
// PersonnelName = t.DoctorName,
// PersonnelNumber = t.PersonnelNumber,
// PermanentStaff = t.PermanentStaff ?? 0,
// Code = code,
// UnitType = t.UnitType,
// AccountingUnit = t.AccountingUnit,
// State = (int)Attendance.Report.未提交
// };
// for (int i = 1; i <= currentMonth; i++)
// {
// typeof(per_attendance_dept).GetProperty($"Day{i:d2}")?.SetValue(newDept, typeDefault);
// }
// return newDept;
// }).ToList();
// _perforPerAttendanceDeptRepository.AddRange(newAttDepts.ToArray());
// }
//}
#
endregion
}
/// <summary>
/// 加载上月绩效考核
...
...
@@ -415,7 +455,7 @@ public void Copy_AttendanceType(per_allot allot, int prevAllotId)
/// <param name="prevAllotId"></param>
public
void
Copy_AssessType
(
per_allot
allot
,
int
prevAllotId
)
{
_logger
.
LogInformation
(
$
"copy assessType"
);
_logger
.
LogInformation
(
"copy assessType"
);
var
operatingTime
=
DateTime
.
Now
;
#
region
考核类型加载上月
//查询本月和上月的类型
...
...
performance/Performance.Services/DapperService.cs
View file @
6be8cabb
...
...
@@ -31,7 +31,7 @@ public DapperService(IOptions<AppConnection> options, ILogger<DapperService> log
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public
void
FreezeAllotSync
(
int
allotId
)
public
void
FreezeAllotSync
(
int
allotId
)
{
Task
.
Factory
.
StartNew
(()
=>
{
...
...
@@ -43,6 +43,26 @@ public void FreezeAllotSync(int allotId)
}
});
}
/// <summary>
/// 审核医院其他绩效时,使用异步
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public
async
Task
FreezeAllotSyncAsync
(
int
allotId
)
{
await
Task
.
Run
(
async
()
=>
{
using
(
var
connection
=
new
MySqlConnection
(
_options
.
Value
.
PerformanceConnectionString
))
{
if
(
connection
.
State
!=
ConnectionState
.
Open
)
await
connection
.
OpenAsync
();
string
sql
=
$@"call proc_freeze_allot(
{
allotId
}
)"
;
await
connection
.
ExecuteAsync
(
sql
,
commandTimeout
:
60
*
60
);
}
});
}
/// <summary>
/// 数据静态存储
...
...
performance/Performance.Services/EmployeeService.cs
View file @
6be8cabb
...
...
@@ -19,6 +19,7 @@
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text.RegularExpressions
;
using
System.Threading.Tasks
;
namespace
Performance.Services
...
...
@@ -451,7 +452,9 @@ public bool Audit(int allotId)
/// </summary>
/// <param name="allotId"></param>
/// <param name="userId"></param>
/// <param name="isAudit"></param>
/// <returns></returns>
/// <exception cref="PerformanceException"></exception>
public
List
<
OhterAmountAuditResponse
>
GetAprList
(
int
allotId
,
int
userId
,
int
isAudit
)
{
var
userrole
=
userroleRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userId
);
...
...
@@ -493,7 +496,7 @@ public List<OhterAmountAuditResponse> GetAprList(int allotId, int userId, int is
};
});
if
(
result
!=
null
&&
result
.
Any
())
if
(
result
.
Any
())
result
=
result
.
OrderByDescending
(
o
=>
o
.
CreateDate
).
ToList
();
return
result
.
ToList
();
...
...
@@ -637,7 +640,7 @@ public bool CommitApr(int allotId, string department, int status, DateTime date)
/// <param name="userid"></param>
/// <param name="request"></param>
/// <returns></returns>
public
ApiResponse
ConfirmAudit
(
int
userid
,
AprAmountAuditRequest
request
)
public
async
Task
<
ApiResponse
>
ConfirmAudit
(
int
userid
,
AprAmountAuditRequest
request
)
{
List
<
Dictionary
<
string
,
string
>>
error
=
new
List
<
Dictionary
<
string
,
string
>>();
...
...
@@ -659,7 +662,7 @@ public ApiResponse ConfirmAudit(int userid, AprAmountAuditRequest request)
.
Where
(
w
=>
w
!=
null
);
error
.
AddRange
(
err
);
if
(
error
.
Count
>
0
)
if
(
error
.
Any
()
)
return
new
ApiResponse
(
ResponseType
.
WarningTable
,
"验证不通过,当前操作已拒绝"
,
error
);
var
allApramounts
=
request
.
IsPass
==
1
...
...
@@ -679,7 +682,7 @@ public ApiResponse ConfirmAudit(int userid, AprAmountAuditRequest request)
}
}
}
_service
.
FreezeAllotS
ync
(
request
.
AllotId
);
await
_service
.
FreezeAllotSyncAs
ync
(
request
.
AllotId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
""
);
}
...
...
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