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
c49df31a
Commit
c49df31a
authored
Nov 13, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二次绩效审核
parent
3b92e0f8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
372 additions
and
176 deletions
+372
-176
performance/Performance.Api/Controllers/SecondAllotController.cs
+66
-11
performance/Performance.Api/wwwroot/Performance.Api.xml
+24
-5
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+9
-0
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+5
-0
performance/Performance.DtoModels/Request/SecondAuditRequest.cs
+28
-0
performance/Performance.EntityModels/Entity/ag_secondallot.cs
+5
-0
performance/Performance.Services/SecondAllotService.cs
+235
-160
No files found.
performance/Performance.Api/Controllers/SecondAllotController.cs
View file @
c49df31a
...
...
@@ -27,6 +27,7 @@ public class SecondAllotController : ControllerBase
this
.
secondAllotService
=
secondAllotService
;
}
#
region
二次绩效列表、录入数据展示,保存数据
/// <summary>
/// 二次绩效列表(没有需要初始化)
/// </summary>
...
...
@@ -104,6 +105,31 @@ public ApiResponse SaveCompute([FromBody]List<ag_compute> request)
}
/// <summary>
/// 二次绩效录入页面配置信息
/// </summary>
/// <returns></returns>
[
Route
(
"api/second/detail"
)]
[
HttpPost
]
public
ApiResponse
SecondDetail
([
CustomizeValidator
(
RuleSet
=
"Refresh"
),
FromBody
]
UseTempRequest
request
)
{
var
result
=
secondAllotService
.
GetSecondDetail
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
#
endregion
#
region
模板使用
/// <summary>
/// 选择二次绩效模板
/// </summary>
/// <returns></returns>
[
HttpGet
(
"api/temp/list/{hospitalid}"
)]
public
ApiResponse
<
List
<
SecondTempResponse
>>
Temp
(
int
hospitalid
)
{
var
result
=
secondAllotService
.
GetTemp
(
hospitalid
);
return
new
ApiResponse
<
List
<
SecondTempResponse
>>(
ResponseType
.
OK
,
result
);
}
/// <summary>
/// 保存已选择二次绩效模板
/// </summary>
/// <returns></returns>
...
...
@@ -126,7 +152,9 @@ public ApiResponse RefreshTemp([CustomizeValidator(RuleSet = "Refresh"), FromBod
secondAllotService
.
RefreshTemp
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
#
endregion
#
region
二次绩效工作量配置
/// <summary>
/// 二次绩效工作量列表
/// </summary>
...
...
@@ -174,28 +202,54 @@ public ApiResponse WorkloadDelete([CustomizeValidator(RuleSet = "Delete"), FromB
var
result
=
secondAllotService
.
WorkloadDelete
(
request
.
Id
);
return
new
ApiResponse
(
result
?
ResponseType
.
OK
:
ResponseType
.
Fail
);
}
#
endregion
#
region
二次绩效审核
/// <summary>
///
选择二次绩效模板
///
提交审核
/// </summary>
/// <returns></returns>
[
HttpGet
(
"api/temp/list/{hospitalid}"
)]
public
ApiResponse
<
List
<
SecondTempResponse
>>
Temp
(
int
hospitalid
)
/// <param name="secondid">二次绩效Id</param>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"/api/second/audit/submit/{secondid}"
)]
public
ApiResponse
SubmitAudit
(
int
secondid
)
{
var
result
=
secondAllotService
.
GetTemp
(
hospitalid
);
return
new
ApiResponse
<
List
<
SecondTempResponse
>>(
ResponseType
.
OK
,
result
);
var
second
=
secondAllotService
.
GetSecondallot
(
secondid
);
if
(
second
==
null
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"二次绩效Id无效"
);
if
(
second
.
Status
==
3
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"该绩效已\"审核通过\",无需再次提交"
);
var
userid
=
claimService
.
GetUserId
();
var
result
=
secondAllotService
.
AuditSubmit
(
second
);
return
result
?
new
ApiResponse
(
ResponseType
.
OK
,
"提交成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"提交失败"
);
}
/// <summary>
/// 二次绩效录入页面配置信息
/// 二次绩效审核列表
/// </summary>
/// <returns></returns>
[
HttpGet
]
[
Route
(
"/api/second/audit/list"
)]
public
ApiResponse
<
List
<
ag_secondallot
>>
AuditList
()
{
var
userid
=
claimService
.
GetUserId
();
var
list
=
secondAllotService
.
AuditList
(
userid
);
return
new
ApiResponse
<
List
<
ag_secondallot
>>(
ResponseType
.
OK
,
"审核列表"
,
list
);
}
/// <summary>
/// 二次绩效审核结果;驳回、成功
/// </summary>
/// <returns></returns>
[
Route
(
"api/second/detail"
)]
[
HttpPost
]
public
ApiResponse
SecondDetail
([
CustomizeValidator
(
RuleSet
=
"Refresh"
),
FromBody
]
UseTempRequest
request
)
[
Route
(
"/api/second/audit/result"
)]
public
ApiResponse
AuditResult
([
FromBody
]
SecondAuditRequest
request
)
{
var
result
=
secondAllotService
.
GetSecondDetail
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
var
userid
=
claimService
.
GetUserId
();
var
result
=
secondAllotService
.
ConfirmAudit
(
userid
,
request
);
return
result
?
new
ApiResponse
(
ResponseType
.
OK
,
"操作成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"操作失败"
);
}
#
endregion
}
}
\ No newline at end of file
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
c49df31a
...
...
@@ -757,6 +757,18 @@
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.SecondDetail(Performance.DtoModels.UseTempRequest)"
>
<summary>
二次绩效录入页面配置信息
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.Temp(System.Int32)"
>
<summary>
选择二次绩效模板
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.UseTemp(Performance.DtoModels.UseTempRequest)"
>
<summary>
保存已选择二次绩效模板
...
...
@@ -793,15 +805,22 @@
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.
Temp
(System.Int32)"
>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.
SubmitAudit
(System.Int32)"
>
<summary>
选择二次绩效模板
提交审核
</summary>
<returns></returns>
<param
name=
"secondid"
>
二次绩效Id
</param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.
SecondDetail(Performance.DtoModels.UseTempRequest)
"
>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.
AuditList
"
>
<summary>
二次绩效录入页面配置信息
二次绩效审核列表
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.AuditResult(Performance.DtoModels.SecondAuditRequest)"
>
<summary>
二次绩效审核结果;驳回、成功
</summary>
<returns></returns>
</member>
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
c49df31a
...
...
@@ -1464,6 +1464,15 @@
<member
name=
"P:Performance.DtoModels.ReportRequest.Month"
>
<summary>
月
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SecondAuditRequest.SecondId"
>
<summary>
二次绩效Id
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SecondAuditRequest.IsPass"
>
<summary>
审核结果 1、审核通过 2、驳回
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SecondAuditRequest.Remark"
>
<summary>
备注
</summary>
</member>
<member
name=
"T:Performance.DtoModels.SetDepartmentRequest"
>
<summary>
登录请求
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
c49df31a
...
...
@@ -669,6 +669,11 @@
审核人
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_secondallot.Remark"
>
<summary>
备注
</summary>
</member>
<member
name=
"T:Performance.EntityModels.ag_temp"
>
<summary>
二次绩效模板
...
...
performance/Performance.DtoModels/Request/SecondAuditRequest.cs
0 → 100644
View file @
c49df31a
using
FluentValidation
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
SecondAuditRequest
{
/// <summary> 二次绩效Id </summary>
public
int
SecondId
{
get
;
set
;
}
/// <summary> 审核结果 1、审核通过 2、驳回 </summary>
public
int
IsPass
{
get
;
set
;
}
/// <summary> 备注 </summary>
public
string
Remark
{
get
;
set
;
}
}
public
class
SecondAuditRequestValidator
:
AbstractValidator
<
SecondAuditRequest
>
{
public
SecondAuditRequestValidator
()
{
RuleFor
(
x
=>
x
.
SecondId
).
NotNull
().
NotEmpty
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
IsPass
).
NotNull
().
NotEmpty
().
InclusiveBetween
(
1
,
2
);
RuleFor
(
x
=>
x
.
Remark
).
NotNull
().
NotEmpty
();
}
}
}
performance/Performance.EntityModels/Entity/ag_secondallot.cs
View file @
c49df31a
...
...
@@ -70,5 +70,10 @@ public class ag_secondallot
/// 审核人
/// </summary>
public
Nullable
<
int
>
AuditUser
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
Remark
{
get
;
set
;
}
}
}
performance/Performance.Services/SecondAllotService.cs
View file @
c49df31a
...
...
@@ -59,7 +59,7 @@ public class SecondAllotService : IAutoInjection
this
.
perforAgcomputeRepository
=
perforAgcomputeRepository
;
this
.
perforCofagainRepository
=
perforCofagainRepository
;
}
#
region
二次绩效列表与数据保存
/// <summary>
/// 获取二次绩效列表
/// </summary>
...
...
@@ -128,6 +128,185 @@ public List<SecondListResponse> GetSecondList(int userId)
}
/// <summary>
/// 二次绩效详情
/// </summary>
/// <returns></returns>
public
SecondResponse
GetSecondDetail
(
UseTempRequest
request
)
{
var
usetemp
=
perforAgusetempRepository
.
GetEntity
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
&&
t
.
UnitType
==
request
.
UnitType
);
if
(
usetemp
==
null
)
throw
new
PerformanceException
(
"当前科室暂未配置绩效模板"
);
//获取固定模板列 + 工作量列
var
headItems
=
GetHeadItems
(
usetemp
.
UseTempId
.
Value
,
usetemp
.
HospitalId
.
Value
,
usetemp
.
Department
,
usetemp
.
UnitType
);
var
result
=
new
SecondResponse
{
HeadItems
=
headItems
,
BodyItems
=
new
List
<
BodyItem
>()
};
//获取已录入数据
var
fixatList
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
request
.
SecondId
&&
t
.
RowNumber
.
HasValue
);
if
(
request
.
IsArchive
==
1
)
//归档
{
#
region
已归档数据,根据数据获取
列
if
(
fixatList
==
null
||
fixatList
.
Where
(
t
=>
t
.
RowNumber
!=
-
1
).
Count
()
==
0
)
throw
new
PerformanceException
(
"绩效归档时,尚未添加数据。"
);
else
{
var
existHead
=
fixatList
.
Select
(
t
=>
new
{
FiledName
=
t
.
ItemName
,
Sort
=
t
.
Sort
.
Value
,
SourceType
=
t
.
SourceType
.
Value
,
Type
=
t
.
Type
.
Value
,
FactorValue
=
t
.
FactorValue
.
Value
}).
Distinct
().
ToList
();
headItems
=
existHead
.
Select
(
t
=>
new
HeadItem
{
FiledId
=
headItems
.
FirstOrDefault
(
h
=>
h
.
FiledName
==
t
.
FiledName
&&
h
.
Type
==
t
.
Type
)?.
FiledId
??
"无FiledId"
,
FiledName
=
t
.
FiledName
,
Sort
=
t
.
Sort
,
SourceType
=
t
.
SourceType
,
Type
=
t
.
Type
,
FactorValue
=
t
.
FactorValue
}).
Where
(
t
=>
t
.
FiledId
!=
"无FiledId"
).
ToList
();
result
.
HeadItems
=
headItems
;
}
#
endregion
}
//未归档
if
(
fixatList
!=
null
&&
fixatList
.
Where
(
t
=>
t
.
RowNumber
!=
-
1
).
Count
()
>
0
)
{
var
rows
=
fixatList
.
Select
(
t
=>
t
.
RowNumber
.
Value
).
Distinct
();
foreach
(
var
row
in
rows
)
{
var
header
=
row
==
-
1
?
headItems
.
Where
(
t
=>
t
.
Type
==
1
).
ToList
()
:
headItems
.
Where
(
t
=>
t
.
Type
!=
1
).
ToList
();
result
.
BodyItems
.
AddRange
(
GetBodyItems
(
header
,
2
,
fixatitems
:
fixatList
,
row
:
row
));
}
}
else
if
(
fixatList
==
null
||
(
fixatList
!=
null
&&
fixatList
.
Where
(
t
=>
t
.
RowNumber
!=
-
1
).
Count
()
==
0
))
{
#
region
补充历史绩效需要带出的数据
var
bringhead
=
headItems
.
Where
(
t
=>
t
.
IsBring
==
1
).
ToList
();
if
(
bringhead
!=
null
&&
bringhead
.
Count
>
0
)
{
var
allotList
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
);
var
secondIdList
=
perforAgsecondallotRepository
.
GetEntities
(
t
=>
allotList
.
Select
(
a
=>
a
.
ID
).
Contains
(
t
.
AllotId
.
Value
)).
OrderBy
(
t
=>
t
.
Year
).
ThenBy
(
t
=>
t
.
Month
).
Select
(
t
=>
t
.
Id
).
ToList
();
var
index
=
secondIdList
.
IndexOf
(
request
.
SecondId
);
if
(
index
!=
0
)
fixatList
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondIdList
.
ElementAt
(
index
-
1
)
&&
t
.
RowNumber
.
HasValue
);
fixatList
=
fixatList
?.
Where
(
t
=>
bringhead
.
Select
(
h
=>
h
.
FiledName
).
Contains
(
t
.
ItemName
)).
ToList
();
if
(
fixatList
!=
null
&&
fixatList
.
Count
>
0
)
{
var
rows
=
fixatList
.
Select
(
t
=>
t
.
RowNumber
.
Value
).
Distinct
();
foreach
(
var
row
in
rows
)
{
var
header
=
row
==
-
1
?
bringhead
.
Where
(
t
=>
t
.
Type
==
1
).
ToList
()
:
bringhead
.
Where
(
t
=>
t
.
Type
!=
1
).
ToList
();
result
.
BodyItems
.
AddRange
(
GetBodyItems
(
header
,
2
,
fixatitems
:
fixatList
,
row
:
row
));
}
}
}
#
endregion
}
if
(
fixatList
==
null
||
(
fixatList
!=
null
&&
fixatList
.
Where
(
t
=>
t
.
RowNumber
==
-
1
).
Count
()
==
0
))
{
var
second
=
perforAgsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
SecondId
);
var
config
=
perforCofagainRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
second
.
AllotId
&&
t
.
Department
==
request
.
Department
)
??
new
List
<
cof_again
>();
#
region
补充顶部数据
config
.
Add
(
new
cof_again
{
TypeName
=
"绩效合计(考核后)"
,
Value
=
second
.
RealGiveFee
});
result
.
BodyItems
.
AddRange
(
GetBodyItems
(
headItems
.
Where
(
t
=>
t
.
Type
==
1
).
ToList
(),
1
,
configs
:
config
));
result
.
BodyItems
.
FirstOrDefault
(
t
=>
t
.
FiledName
==
"发放月份"
).
Value
=
$"
{
second
.
Year
}
年
{
second
.
Month
}
月"
;
#
endregion
}
return
new
SecondResponse
{
HeadItems
=
result
.
HeadItems
.
OrderBy
(
t
=>
t
.
Type
).
ThenBy
(
t
=>
t
.
Sort
).
ThenBy
(
t
=>
t
.
FiledName
).
ToList
(),
BodyItems
=
result
.
BodyItems
.
OrderBy
(
t
=>
t
.
RowNumber
).
ThenBy
(
t
=>
t
.
Type
).
ThenBy
(
t
=>
t
.
Sort
).
ToList
(),
};
}
/// <summary>
/// 二次绩效项录入保存
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public
bool
SaveValue
(
List
<
ag_fixatitem
>
request
)
{
var
secondId
=
request
.
First
().
SecondId
;
var
second
=
perforAgsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
if
(
second
==
null
)
throw
new
PerformanceException
(
"二次绩效ID不存在"
);
var
fixatitems
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
foreach
(
var
item
in
request
)
{
if
(
fixatitems
!=
null
&&
fixatitems
.
Any
(
t
=>
t
.
SecondId
==
secondId
&&
t
.
RowNumber
==
item
.
RowNumber
&&
t
.
ItemName
==
item
.
ItemName
))
{
var
cellItem
=
fixatitems
.
First
(
t
=>
t
.
SecondId
==
secondId
&&
t
.
RowNumber
==
item
.
RowNumber
&&
t
.
ItemName
==
item
.
ItemName
);
cellItem
.
ItemValue
=
item
.
ItemValue
;
cellItem
.
Sort
=
item
.
Sort
;
cellItem
.
SourceType
=
item
.
SourceType
;
cellItem
.
Type
=
item
.
Type
;
cellItem
.
UnitType
=
item
.
UnitType
;
perforAgfixatitemRepository
.
Update
(
cellItem
);
}
else
{
perforAgfixatitemRepository
.
Add
(
item
);
}
}
return
DelValue
(
second
.
Id
,
request
);
}
/// <summary>
/// 删除未保存的历史数据
/// </summary>
/// <param name="secondId"></param>
/// <param name="fixatitems"></param>
/// <returns></returns>
public
bool
DelValue
(
int
secondId
,
List
<
ag_fixatitem
>
fixatitems
)
{
if
(
secondId
==
0
)
throw
new
PerformanceException
(
"二次绩效Id无效"
);
var
fixatlist
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
if
(
fixatitems
==
null
||
fixatitems
.
Count
==
0
)
{
return
perforAgfixatitemRepository
.
RemoveRange
(
fixatlist
.
ToArray
());
}
var
saveRows
=
fixatitems
.
Select
(
t
=>
t
.
RowNumber
).
Distinct
();
var
delRows
=
fixatlist
.
Select
(
t
=>
t
.
RowNumber
).
Distinct
().
Except
(
saveRows
);
if
(
delRows
!=
null
&&
delRows
.
Count
()
>
0
)
return
perforAgfixatitemRepository
.
RemoveRange
(
fixatlist
.
Where
(
t
=>
delRows
.
Contains
(
t
.
RowNumber
)).
ToArray
());
return
true
;
}
/// <summary>
/// 二次绩效分配结果保存
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public
bool
SaveCompute
(
List
<
ag_compute
>
request
)
{
var
secondId
=
request
.
First
().
SecondId
;
var
second
=
perforAgsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
if
(
second
==
null
)
throw
new
PerformanceException
(
"二次绩效ID不存在"
);
if
(
second
.
Status
==
2
)
throw
new
PerformanceException
(
"二次绩效已提交,无法重复提交"
);
var
compute
=
perforAgcomputeRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
foreach
(
var
item
in
request
)
{
if
(
compute
!=
null
&&
compute
.
Any
(
t
=>
t
.
SecondId
==
secondId
&&
t
.
Department
==
item
.
Department
&&
t
.
PersonName
==
item
.
PersonName
))
{
var
cellItem
=
compute
.
First
(
t
=>
t
.
SecondId
==
secondId
&&
t
.
Department
==
item
.
Department
&&
t
.
PersonName
==
item
.
PersonName
);
cellItem
.
RealGiveFee
=
item
.
RealGiveFee
;
perforAgcomputeRepository
.
Update
(
cellItem
);
}
else
{
perforAgcomputeRepository
.
Add
(
item
);
}
}
return
true
;
}
#
endregion
#
region
模板
/// <summary>
/// 获取模板列表
/// </summary>
/// <param name="userId"></param>
...
...
@@ -281,7 +460,9 @@ public void RefreshTemp(UseTempRequest request)
if
(
addItems
!=
null
&&
addItems
.
Count
()
>
0
)
perforAgfixatitemRepository
.
AddRange
(
addItems
.
ToArray
());
}
#
endregion
#
region
工作量绩效配置
/// <summary>
/// 获取工作量列表
/// </summary>
...
...
@@ -293,69 +474,6 @@ public List<ag_workload> GetWorkloadList(WorkloadRequest request)
}
/// <summary>
/// 二次绩效项录入保存
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public
bool
SaveValue
(
List
<
ag_fixatitem
>
request
)
{
var
secondId
=
request
.
First
().
SecondId
;
var
second
=
perforAgsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
if
(
second
==
null
)
throw
new
PerformanceException
(
"二次绩效ID不存在"
);
var
fixatitems
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
foreach
(
var
item
in
request
)
{
if
(
fixatitems
!=
null
&&
fixatitems
.
Any
(
t
=>
t
.
SecondId
==
secondId
&&
t
.
RowNumber
==
item
.
RowNumber
&&
t
.
ItemName
==
item
.
ItemName
))
{
var
cellItem
=
fixatitems
.
First
(
t
=>
t
.
SecondId
==
secondId
&&
t
.
RowNumber
==
item
.
RowNumber
&&
t
.
ItemName
==
item
.
ItemName
);
cellItem
.
ItemValue
=
item
.
ItemValue
;
cellItem
.
Sort
=
item
.
Sort
;
cellItem
.
SourceType
=
item
.
SourceType
;
cellItem
.
Type
=
item
.
Type
;
cellItem
.
UnitType
=
item
.
UnitType
;
perforAgfixatitemRepository
.
Update
(
cellItem
);
}
else
{
perforAgfixatitemRepository
.
Add
(
item
);
}
}
return
DelValue
(
second
.
Id
,
request
);
}
/// <summary>
/// 二次绩效分配结果保存
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public
bool
SaveCompute
(
List
<
ag_compute
>
request
)
{
var
secondId
=
request
.
First
().
SecondId
;
var
second
=
perforAgsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
if
(
second
==
null
)
throw
new
PerformanceException
(
"二次绩效ID不存在"
);
if
(
second
.
Status
==
2
)
throw
new
PerformanceException
(
"二次绩效已提交,无法重复提交"
);
var
compute
=
perforAgcomputeRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
foreach
(
var
item
in
request
)
{
if
(
compute
!=
null
&&
compute
.
Any
(
t
=>
t
.
SecondId
==
secondId
&&
t
.
Department
==
item
.
Department
&&
t
.
PersonName
==
item
.
PersonName
))
{
var
cellItem
=
compute
.
First
(
t
=>
t
.
SecondId
==
secondId
&&
t
.
Department
==
item
.
Department
&&
t
.
PersonName
==
item
.
PersonName
);
cellItem
.
RealGiveFee
=
item
.
RealGiveFee
;
perforAgcomputeRepository
.
Update
(
cellItem
);
}
else
{
perforAgcomputeRepository
.
Add
(
item
);
}
}
return
true
;
}
/// <summary>
/// 新增工作量绩效配置
/// </summary>
/// <param name="request"></param>
...
...
@@ -418,118 +536,74 @@ public bool WorkloadDelete(int id)
return
perforAgworkloadRepository
.
Remove
(
workload
);
}
#
endregion
#
region
二次绩效考核
/// <summary>
/// 二次绩效
详情
/// 二次绩效
考核列表
/// </summary>
/// <param name="userId">用户ID</param>
/// <returns></returns>
public
SecondResponse
GetSecondDetail
(
UseTempRequest
request
)
public
List
<
ag_secondallot
>
AuditList
(
int
userId
)
{
var
usetemp
=
perforAgusetempRepository
.
GetEntity
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
&&
t
.
UnitType
==
request
.
UnitType
);
if
(
usetemp
==
null
)
throw
new
PerformanceException
(
"当前科室暂未配置绩效模板"
);
//获取固定模板列 + 工作量列
var
headItems
=
GetHeadItems
(
usetemp
.
UseTempId
.
Value
,
usetemp
.
HospitalId
.
Value
,
usetemp
.
Department
,
usetemp
.
UnitType
);
var
result
=
new
SecondResponse
{
HeadItems
=
headItems
,
BodyItems
=
new
List
<
BodyItem
>()
};
//获取已录入数据
var
fixatList
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
request
.
SecondId
&&
t
.
RowNumber
.
HasValue
);
if
(
request
.
IsArchive
==
1
)
//归档
{
#
region
已归档数据,根据数据获取
列
if
(
fixatList
==
null
||
fixatList
.
Where
(
t
=>
t
.
RowNumber
!=
-
1
).
Count
()
==
0
)
throw
new
PerformanceException
(
"绩效归档时,尚未添加数据。"
);
else
{
var
existHead
=
fixatList
.
Select
(
t
=>
new
{
FiledName
=
t
.
ItemName
,
Sort
=
t
.
Sort
.
Value
,
SourceType
=
t
.
SourceType
.
Value
,
Type
=
t
.
Type
.
Value
,
FactorValue
=
t
.
FactorValue
.
Value
}).
Distinct
().
ToList
();
headItems
=
existHead
.
Select
(
t
=>
new
HeadItem
{
FiledId
=
headItems
.
FirstOrDefault
(
h
=>
h
.
FiledName
==
t
.
FiledName
&&
h
.
Type
==
t
.
Type
)?.
FiledId
??
"无FiledId"
,
FiledName
=
t
.
FiledName
,
Sort
=
t
.
Sort
,
SourceType
=
t
.
SourceType
,
Type
=
t
.
Type
,
FactorValue
=
t
.
FactorValue
}).
Where
(
t
=>
t
.
FiledId
!=
"无FiledId"
).
ToList
();
result
.
HeadItems
=
headItems
;
}
#
endregion
}
//未归档
if
(
fixatList
!=
null
&&
fixatList
.
Where
(
t
=>
t
.
RowNumber
!=
-
1
).
Count
()
>
0
)
var
hospital
=
perforUserhospitalRepository
.
GetEntities
(
t
=>
t
.
UserID
==
userId
);
var
allotList
=
perforPerallotRepository
.
GetEntities
(
t
=>
hospital
.
Select
(
h
=>
h
.
HospitalID
).
Contains
(
t
.
HospitalId
));
if
(
allotList
!=
null
&&
allotList
.
Count
>
0
)
{
var
rows
=
fixatList
.
Select
(
t
=>
t
.
RowNumber
.
Value
).
Distinct
();
foreach
(
var
row
in
rows
)
{
var
header
=
row
==
-
1
?
headItems
.
Where
(
t
=>
t
.
Type
==
1
).
ToList
()
:
headItems
.
Where
(
t
=>
t
.
Type
!=
1
).
ToList
();
result
.
BodyItems
.
AddRange
(
GetBodyItems
(
header
,
2
,
fixatitems
:
fixatList
,
row
:
row
));
}
var
allotIds
=
allotList
.
Select
(
t
=>
t
.
ID
);
return
perforAgsecondallotRepository
.
GetEntities
(
t
=>
allotIds
.
Contains
(
t
.
AllotId
.
Value
)
&&
t
.
Status
==
2
);
}
else
if
(
fixatList
==
null
||
(
fixatList
!=
null
&&
fixatList
.
Where
(
t
=>
t
.
RowNumber
!=
-
1
).
Count
()
==
0
))
{
#
region
补充历史绩效需要带出的数据
var
bringhead
=
headItems
.
Where
(
t
=>
t
.
IsBring
==
1
).
ToList
();
if
(
bringhead
!=
null
&&
bringhead
.
Count
>
0
)
{
var
allotList
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
);
var
secondIdList
=
perforAgsecondallotRepository
.
GetEntities
(
t
=>
allotList
.
Select
(
a
=>
a
.
ID
).
Contains
(
t
.
AllotId
.
Value
)).
OrderBy
(
t
=>
t
.
Year
).
ThenBy
(
t
=>
t
.
Month
).
Select
(
t
=>
t
.
Id
).
ToList
();
var
index
=
secondIdList
.
IndexOf
(
request
.
SecondId
);
if
(
index
!=
0
)
fixatList
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondIdList
.
ElementAt
(
index
-
1
)
&&
t
.
RowNumber
.
HasValue
);
fixatList
=
fixatList
?.
Where
(
t
=>
bringhead
.
Select
(
h
=>
h
.
FiledName
).
Contains
(
t
.
ItemName
)).
ToList
();
if
(
fixatList
!=
null
&&
fixatList
.
Count
>
0
)
{
var
rows
=
fixatList
.
Select
(
t
=>
t
.
RowNumber
.
Value
).
Distinct
();
foreach
(
var
row
in
rows
)
{
var
header
=
row
==
-
1
?
bringhead
.
Where
(
t
=>
t
.
Type
==
1
).
ToList
()
:
bringhead
.
Where
(
t
=>
t
.
Type
!=
1
).
ToList
();
result
.
BodyItems
.
AddRange
(
GetBodyItems
(
header
,
2
,
fixatitems
:
fixatList
,
row
:
row
));
}
}
}
#
endregion
}
if
(
fixatList
==
null
||
(
fixatList
!=
null
&&
fixatList
.
Where
(
t
=>
t
.
RowNumber
==
-
1
).
Count
()
==
0
))
{
var
second
=
perforAgsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
SecondId
);
var
config
=
perforCofagainRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
second
.
AllotId
&&
t
.
Department
==
request
.
Department
)
??
new
List
<
cof_again
>();
#
region
补充顶部数据
config
.
Add
(
new
cof_again
{
TypeName
=
"绩效合计(考核后)"
,
Value
=
second
.
RealGiveFee
});
result
.
BodyItems
.
AddRange
(
GetBodyItems
(
headItems
.
Where
(
t
=>
t
.
Type
==
1
).
ToList
(),
1
,
configs
:
config
));
result
.
BodyItems
.
FirstOrDefault
(
t
=>
t
.
FiledName
==
"发放月份"
).
Value
=
$"
{
second
.
Year
}
年
{
second
.
Month
}
月"
;
#
endregion
}
return
new
SecondResponse
{
HeadItems
=
result
.
HeadItems
.
OrderBy
(
t
=>
t
.
Type
).
ThenBy
(
t
=>
t
.
Sort
).
ThenBy
(
t
=>
t
.
FiledName
).
ToList
(),
BodyItems
=
result
.
BodyItems
.
OrderBy
(
t
=>
t
.
RowNumber
).
ThenBy
(
t
=>
t
.
Type
).
ThenBy
(
t
=>
t
.
Sort
).
ToList
(),
};
return
null
;
}
/// <summary>
///
删除未保存的历史数据
///
提交审核
/// </summary>
/// <param name="
secondId">
</param>
/// <param name="
fixatitems">
</param>
/// <param name="
userId">用户ID
</param>
/// <param name="
secondId">二次绩效ID
</param>
/// <returns></returns>
public
bool
DelValue
(
int
secondId
,
List
<
ag_fixatitem
>
fixatitems
)
public
bool
AuditSubmit
(
ag_secondallot
second
)
{
if
(
secondId
==
0
)
throw
new
PerformanceException
(
"二次绩效Id无效"
);
second
.
Status
=
2
;
second
.
SubmitTime
=
DateTime
.
Now
;
second
.
Remark
=
"已提交审核,等待审核中"
;
return
perforAgsecondallotRepository
.
Update
(
second
);
}
var
fixatlist
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
if
(
fixatitems
==
null
||
fixatitems
.
Count
==
0
)
/// <summary>
/// 审核
/// </summary>
/// <param name="userId">用户ID</param>
/// <param name="secondId">二次绩效ID</param>
/// <param name="ispass">1、审核通过 2、驳回</param>
/// <returns></returns>
public
bool
ConfirmAudit
(
int
userId
,
SecondAuditRequest
request
)
{
var
second
=
perforAgsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
SecondId
);
if
(
second
.
Status
!=
2
)
throw
new
PerformanceException
(
"该绩效未提交至审核,请确认"
);
second
.
Status
=
request
.
IsPass
==
1
?
3
:
4
;
second
.
AuditUser
=
userId
;
second
.
AuditTime
=
DateTime
.
Now
;
second
.
Remark
=
request
.
Remark
;
if
(
string
.
IsNullOrEmpty
(
second
.
Remark
))
{
return
perforAgfixatitemRepository
.
RemoveRange
(
fixatlist
.
ToArray
())
;
second
.
Remark
=
request
.
IsPass
==
1
?
"审核通过"
:
"驳回"
;
}
return
perforAgsecondallotRepository
.
Update
(
second
);
}
#
endregion
var
saveRows
=
fixatitems
.
Select
(
t
=>
t
.
RowNumber
).
Distinct
();
var
delRows
=
fixatlist
.
Select
(
t
=>
t
.
RowNumber
).
Distinct
().
Except
(
saveRows
);
if
(
delRows
!=
null
&&
delRows
.
Count
()
>
0
)
return
perforAgfixatitemRepository
.
RemoveRange
(
fixatlist
.
Where
(
t
=>
delRows
.
Contains
(
t
.
RowNumber
)).
ToArray
());
return
true
;
#
region
common
/// <summary>
/// 获取二次绩效
/// </summary>
/// <param name="secondId">二次绩效Id</param>
/// <returns></returns>
public
ag_secondallot
GetSecondallot
(
int
secondId
)
{
return
perforAgsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
}
/// <summary>
...
...
@@ -586,5 +660,6 @@ public List<BodyItem> GetBodyItems(List<HeadItem> headItems, int source, List<co
}
return
bodyItems
;
}
#
endregion
}
}
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