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
2f7c8184
Commit
2f7c8184
authored
Apr 07, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二次绩效获取详情、保存数据修改
parent
7252bb9c
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1420 additions
and
8 deletions
+1420
-8
performance/Performance.Api/Controllers/SecondAllotController.cs
+56
-1
performance/Performance.Api/wwwroot/Performance.Api.xml
+38
-1
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+10
-0
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+287
-0
performance/Performance.DtoModels/Response/SecondAllotResponse.cs
+35
-0
performance/Performance.EntityModels/Context/PerformanceDbContext.cs
+8
-0
performance/Performance.EntityModels/Entity/ag_bodysource.cs
+139
-0
performance/Performance.EntityModels/Entity/ag_headsource.cs
+104
-0
performance/Performance.EntityModels/Entity/ag_workload_source.cs
+39
-0
performance/Performance.EntityModels/Entity/ag_worktype_source.cs
+49
-0
performance/Performance.Repository/BaseRepository.cs
+7
-0
performance/Performance.Repository/Repository/PerforAgbodysourceRepository.cs
+20
-0
performance/Performance.Repository/Repository/PerforAgheadsourceRepository.cs
+20
-0
performance/Performance.Repository/Repository/PerforAgworkloadsourceRepository.cs
+20
-0
performance/Performance.Repository/Repository/PerforAgworktypesourceRepository.cs
+20
-0
performance/Performance.Services/SecondAllot/SecondAllotDetails.cs
+0
-0
performance/Performance.Services/SecondAllot/SecondAllotService.cs
+479
-0
performance/Performance.Services/SecondAllotService.cs
+89
-6
No files found.
performance/Performance.Api/Controllers/SecondAllotController.cs
View file @
2f7c8184
using
FluentValidation.AspNetCore
;
using
FluentValidation.AspNetCore
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
using
Performance.DtoModels
;
using
Performance.DtoModels
;
...
@@ -22,18 +23,21 @@ public class SecondAllotController : ControllerBase
...
@@ -22,18 +23,21 @@ public class SecondAllotController : ControllerBase
private
readonly
SecondAllotService
secondAllotService
;
private
readonly
SecondAllotService
secondAllotService
;
private
readonly
ResultComputeService
resultComputeService
;
private
readonly
ResultComputeService
resultComputeService
;
private
readonly
SecondAllotDetails
secondAllotDetails
;
private
readonly
SecondAllotDetails
secondAllotDetails
;
private
readonly
Services
.
SecondAllot
.
SecondAllotService
secondAllot
;
public
SecondAllotController
(
public
SecondAllotController
(
ClaimService
claimService
,
ClaimService
claimService
,
SecondAllotService
secondAllotService
,
SecondAllotService
secondAllotService
,
ResultComputeService
resultComputeService
,
ResultComputeService
resultComputeService
,
SecondAllotDetails
secondAllotDetails
SecondAllotDetails
secondAllotDetails
,
Services
.
SecondAllot
.
SecondAllotService
secondAllot
)
)
{
{
this
.
claimService
=
claimService
;
this
.
claimService
=
claimService
;
this
.
secondAllotService
=
secondAllotService
;
this
.
secondAllotService
=
secondAllotService
;
this
.
resultComputeService
=
resultComputeService
;
this
.
resultComputeService
=
resultComputeService
;
this
.
secondAllotDetails
=
secondAllotDetails
;
this
.
secondAllotDetails
=
secondAllotDetails
;
this
.
secondAllot
=
secondAllot
;
}
}
#
region
二次绩效列表、录入数据展示,保存数据
#
region
二次绩效列表、录入数据展示,保存数据
...
@@ -464,5 +468,56 @@ public ApiResponse DeptComputeDetail(int allotId)
...
@@ -464,5 +468,56 @@ public ApiResponse DeptComputeDetail(int allotId)
var
data
=
secondAllotService
.
DeptComputeDetailList
(
userId
,
allotId
,
out
int
isShowManage
);
var
data
=
secondAllotService
.
DeptComputeDetailList
(
userId
,
allotId
,
out
int
isShowManage
);
return
new
ApiResponse
(
ResponseType
.
OK
,
new
{
isShowManage
,
data
});
return
new
ApiResponse
(
ResponseType
.
OK
,
new
{
isShowManage
,
data
});
}
}
/// <summary>
/// 获取二次绩效详情数据
/// </summary>
/// <param name="secondId"></param>
/// <param name="employeeSource"></param>
/// <returns></returns>
[
HttpPost
(
"api/second/detail/{secondId}/{employeeSource}"
)]
public
ApiResponse
GetSecondAllotDetail
([
FromRoute
]
int
secondId
,
int
employeeSource
)
{
var
detail
=
secondAllot
.
GetSecondSavedData
(
claimService
.
GetUserId
(),
secondId
,
employeeSource
);
return
new
ApiResponse
(
ResponseType
.
OK
,
detail
);
}
/// <summary>
/// 获取工作量类型
/// </summary>
/// <param name="secondId"></param>
/// <returns></returns>
[
HttpPost
(
"api/second/worktype/{secondId}"
)]
public
ApiResponse
GetWorktypeDict
([
FromRoute
]
int
secondId
)
{
var
detail
=
secondAllot
.
GetWorkTypeDict
(
secondId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
detail
);
}
/// <summary>
/// 获取工作量明细项
/// </summary>
/// <param name="secondId"></param>
/// <returns></returns>
[
HttpPost
(
"api/second/workload/{secondId}"
)]
public
ApiResponse
GetWorkloadDict
([
FromRoute
]
int
secondId
)
{
var
detail
=
secondAllot
.
GetWorkloadDict
(
secondId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
detail
);
}
/// <summary>
/// 二次绩效项目内容保存
/// </summary>
/// <param name="secondId"></param>
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
(
"api/second/savedata/{secondId}"
)]
[
AllowAnonymous
]
public
ApiResponse
SaveValue
([
FromRoute
]
int
secondId
,
[
FromBody
]
dynamic
request
)
{
secondAllot
.
SaveSecondAllotData
(
secondId
,
request
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
}
}
}
}
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
2f7c8184
...
@@ -208,7 +208,7 @@
...
@@ -208,7 +208,7 @@
<summary>
<summary>
上传文件
上传文件
</summary>
</summary>
<param
name=
"
form
"
></param>
<param
name=
"
allotId
"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.AllotController.Generate(Performance.DtoModels.AllotRequest)"
>
<member
name=
"M:Performance.Api.Controllers.AllotController.Generate(Performance.DtoModels.AllotRequest)"
>
...
@@ -218,6 +218,13 @@
...
@@ -218,6 +218,13 @@
<param
name=
"request"
></param>
<param
name=
"request"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.AllotController.GenerateReport(Performance.DtoModels.AllotRequest)"
>
<summary>
绩效生成报表
</summary>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AllotController.Recalculation(Performance.DtoModels.RecalculationRequest)"
>
<member
name=
"M:Performance.Api.Controllers.AllotController.Recalculation(Performance.DtoModels.RecalculationRequest)"
>
<summary>
<summary>
重新计算院领导绩效
重新计算院领导绩效
...
@@ -1411,6 +1418,36 @@
...
@@ -1411,6 +1418,36 @@
</summary>
</summary>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.GetSecondAllotDetail(System.Int32,System.Int32)"
>
<summary>
获取二次绩效详情数据
</summary>
<param
name=
"secondId"
></param>
<param
name=
"employeeSource"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.GetWorktypeDict(System.Int32)"
>
<summary>
获取工作量类型
</summary>
<param
name=
"secondId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.GetWorkloadDict(System.Int32)"
>
<summary>
获取工作量明细项
</summary>
<param
name=
"secondId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SecondAllotController.SaveValue(System.Int32,System.Object)"
>
<summary>
二次绩效项目内容保存
</summary>
<param
name=
"secondId"
></param>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.SheetController.SheetList(Performance.DtoModels.SheetRequest)"
>
<member
name=
"M:Performance.Api.Controllers.SheetController.SheetList(Performance.DtoModels.SheetRequest)"
>
<summary>
<summary>
sheet 列表
sheet 列表
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
2f7c8184
...
@@ -3429,6 +3429,16 @@
...
@@ -3429,6 +3429,16 @@
首页地址
首页地址
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.DtoModels.Detail.IsArchive"
>
<summary>
是否归档
</summary>
</member>
<member
name=
"P:Performance.DtoModels.Detail.States"
>
<summary>
0 数据未上传 1 数据已上传 2 正在校验数据 3 数据验证通过
4 数据错误 5 正在生成绩效 6 下发绩效 7 绩效解析失败
8 归档 9 等待生成 10 绩效结果解析成功
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SecondListResponse.IsArchive"
>
<member
name=
"P:Performance.DtoModels.SecondListResponse.IsArchive"
>
<summary>
是否归档
</summary>
<summary>
是否归档
</summary>
</member>
</member>
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
2f7c8184
...
@@ -7,6 +7,9 @@
...
@@ -7,6 +7,9 @@
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_againsituation"
>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_againsituation"
>
<summary>
二次分配概览
</summary>
<summary>
二次分配概览
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_bodysource"
>
<summary>
二次绩效保存数据
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_compute"
>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_compute"
>
<summary>
二次绩效结果表
</summary>
<summary>
二次绩效结果表
</summary>
</member>
</member>
...
@@ -22,6 +25,9 @@
...
@@ -22,6 +25,9 @@
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_header"
>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_header"
>
<summary>
二次分配不固定列头数据
</summary>
<summary>
二次分配不固定列头数据
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_headsource"
>
<summary>
二次绩效顶部数据
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_itemvalue"
>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_itemvalue"
>
<summary>
科室二次绩效录入内容
</summary>
<summary>
科室二次绩效录入内容
</summary>
</member>
</member>
...
@@ -43,9 +49,15 @@
...
@@ -43,9 +49,15 @@
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_workload"
>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_workload"
>
<summary>
二次绩效工作量绩效
</summary>
<summary>
二次绩效工作量绩效
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_workload_source"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_workload_type"
>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_workload_type"
>
<summary>
</summary>
<summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.ag_worktype_source"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.as_assess"
>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.as_assess"
>
<summary>
考核类别
</summary>
<summary>
考核类别
</summary>
</member>
</member>
...
@@ -391,6 +403,131 @@
...
@@ -391,6 +403,131 @@
科室系数人均
科室系数人均
</summary>
</summary>
</member>
</member>
<member
name=
"T:Performance.EntityModels.ag_bodysource"
>
<summary>
二次绩效保存数据
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.Id"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.SecondId"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.RowNumber"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.WorkNumber"
>
<summary>
人员工号
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.Name"
>
<summary>
姓名
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.Department"
>
<summary>
科室
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.Post"
>
<summary>
岗位
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.StaffCoefficient"
>
<summary>
人员系数
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.ActualAttendance"
>
<summary>
出勤
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.JobTitle"
>
<summary>
职称
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.TitleCoefficient"
>
<summary>
职称系数
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.TitlePerformance"
>
<summary>
职称绩效
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.ManagementAllowance"
>
<summary>
管理津贴
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.IndividualReward"
>
<summary>
单项奖励
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.AllocationOfKeySpecialty"
>
<summary>
重点专科分配
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.DeptReward"
>
<summary>
科室单项奖励
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.BasisPerformance"
>
<summary>
主任基础绩效
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.DistPerformance"
>
<summary>
可分配绩效
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.OtherPerformance"
>
<summary>
医院其他绩效
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.NightWorkPerformance"
>
<summary>
夜班工作量绩效
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.RealAmount"
>
<summary>
实发绩效工资金额
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.Signature"
>
<summary>
签字
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.ReservedRatio"
>
<summary>
预留比例
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_bodysource.ReservedAmount"
>
<summary>
预留金额
</summary>
</member>
<member
name=
"T:Performance.EntityModels.ag_compute"
>
<member
name=
"T:Performance.EntityModels.ag_compute"
>
<summary>
<summary>
二次绩效结果表
二次绩效结果表
...
@@ -756,6 +893,96 @@
...
@@ -756,6 +893,96 @@
1 汇总 2原始数据
1 汇总 2原始数据
</summary>
</summary>
</member>
</member>
<member
name=
"T:Performance.EntityModels.ag_headsource"
>
<summary>
二次绩效顶部数据
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.Id"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.SecondId"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.TotalPerformance"
>
<summary>
可分配绩效
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.HosOtherPerformance"
>
<summary>
医院其他绩效
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.NightShiftWorkPerforTotal"
>
<summary>
夜班绩效总和
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.TotalDistPerformance"
>
<summary>
科室总绩效
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.DirectorBasisPerformance"
>
<summary>
主任基础绩效
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.TheTotalAllocationOfPerformanceResults"
>
<summary>
科室单项奖励
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.BasisPerformance"
>
<summary>
业绩分配绩效总额
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.SeniorityTitlesAccountedPerformance"
>
<summary>
年资职称绩效占比
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.SeniorityTitlesPerformance"
>
<summary>
年资职称绩效
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.PerformanceShareTheWorkload"
>
<summary>
工作量绩效占比
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.PerformanceWorkloadDistributionAmount"
>
<summary>
工作量分配绩效金额
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.DaysFullAttendance"
>
<summary>
满勤天数
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.DepartmentsPerCapita"
>
<summary>
科室人均
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.PaymentOfTheMonth"
>
<summary>
发放月份
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_headsource.TheNumberOfAccountingDepartment"
>
<summary>
科室核算人数
</summary>
</member>
<member
name=
"T:Performance.EntityModels.ag_itemvalue"
>
<member
name=
"T:Performance.EntityModels.ag_itemvalue"
>
<summary>
<summary>
科室二次绩效录入内容
科室二次绩效录入内容
...
@@ -1156,6 +1383,31 @@
...
@@ -1156,6 +1383,31 @@
1、单项奖励 2、工作量占比 ..(自定义占比)
1、单项奖励 2、工作量占比 ..(自定义占比)
</summary>
</summary>
</member>
</member>
<member
name=
"T:Performance.EntityModels.ag_workload_source"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_workload_source.Id"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_workload_source.WorkloadId"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_workload_source.BodyId"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_workload_source.Value"
>
<summary>
</summary>
</member>
<member
name=
"T:Performance.EntityModels.ag_workload_type"
>
<member
name=
"T:Performance.EntityModels.ag_workload_type"
>
<summary>
<summary>
...
@@ -1186,6 +1438,41 @@
...
@@ -1186,6 +1438,41 @@
科室类型
科室类型
</summary>
</summary>
</member>
</member>
<member
name=
"T:Performance.EntityModels.ag_worktype_source"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_worktype_source.Id"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_worktype_source.WorkTypeId"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_worktype_source.SecondId"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_worktype_source.FieldId"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_worktype_source.FieldName"
>
<summary>
</summary>
</member>
<member
name=
"P:Performance.EntityModels.ag_worktype_source.Value"
>
<summary>
</summary>
</member>
<member
name=
"T:Performance.EntityModels.as_assess"
>
<member
name=
"T:Performance.EntityModels.as_assess"
>
<summary>
<summary>
考核类别
考核类别
...
...
performance/Performance.DtoModels/Response/SecondAllotResponse.cs
0 → 100644
View file @
2f7c8184
using
Newtonsoft.Json.Linq
;
namespace
Performance.DtoModels
{
public
class
SecondAllotResponse
{
public
Detail
Detail
{
get
;
set
;
}
public
JObject
Head
{
get
;
set
;
}
public
JArray
Body
{
get
;
set
;
}
}
public
class
Detail
{
public
int
TempId
{
get
;
set
;
}
/// <summary> 是否归档 </summary>
public
int
IsArchive
{
get
;
set
;
}
/// <summary>
/// 0 数据未上传 1 数据已上传 2 正在校验数据 3 数据验证通过
/// 4 数据错误 5 正在生成绩效 6 下发绩效 7 绩效解析失败
/// 8 归档 9 等待生成 10 绩效结果解析成功
/// </summary>
public
int
States
{
get
;
set
;
}
public
int
Status
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
public
string
UnitType
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Context/PerformanceDbContext.cs
View file @
2f7c8184
...
@@ -15,6 +15,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
...
@@ -15,6 +15,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> 二次分配概览 </summary>
/// <summary> 二次分配概览 </summary>
public
virtual
DbSet
<
ag_againsituation
>
ag_againsituation
{
get
;
set
;
}
public
virtual
DbSet
<
ag_againsituation
>
ag_againsituation
{
get
;
set
;
}
/// <summary> 二次绩效保存数据 </summary>
public
virtual
DbSet
<
ag_bodysource
>
ag_bodysource
{
get
;
set
;
}
/// <summary> 二次绩效结果表 </summary>
/// <summary> 二次绩效结果表 </summary>
public
virtual
DbSet
<
ag_compute
>
ag_compute
{
get
;
set
;
}
public
virtual
DbSet
<
ag_compute
>
ag_compute
{
get
;
set
;
}
/// <summary> 二次分配不固定数据 </summary>
/// <summary> 二次分配不固定数据 </summary>
...
@@ -25,6 +27,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
...
@@ -25,6 +27,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public
virtual
DbSet
<
ag_fixatitem
>
ag_fixatitem
{
get
;
set
;
}
public
virtual
DbSet
<
ag_fixatitem
>
ag_fixatitem
{
get
;
set
;
}
/// <summary> 二次分配不固定列头数据 </summary>
/// <summary> 二次分配不固定列头数据 </summary>
public
virtual
DbSet
<
ag_header
>
ag_header
{
get
;
set
;
}
public
virtual
DbSet
<
ag_header
>
ag_header
{
get
;
set
;
}
/// <summary> 二次绩效顶部数据 </summary>
public
virtual
DbSet
<
ag_headsource
>
ag_headsource
{
get
;
set
;
}
/// <summary> 科室二次绩效录入内容 </summary>
/// <summary> 科室二次绩效录入内容 </summary>
public
virtual
DbSet
<
ag_itemvalue
>
ag_itemvalue
{
get
;
set
;
}
public
virtual
DbSet
<
ag_itemvalue
>
ag_itemvalue
{
get
;
set
;
}
/// <summary> 二次绩效其他绩效来源 </summary>
/// <summary> 二次绩效其他绩效来源 </summary>
...
@@ -40,7 +44,11 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
...
@@ -40,7 +44,11 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> 二次绩效工作量绩效 </summary>
/// <summary> 二次绩效工作量绩效 </summary>
public
virtual
DbSet
<
ag_workload
>
ag_workload
{
get
;
set
;
}
public
virtual
DbSet
<
ag_workload
>
ag_workload
{
get
;
set
;
}
/// <summary> </summary>
/// <summary> </summary>
public
virtual
DbSet
<
ag_workload_source
>
ag_workload_source
{
get
;
set
;
}
/// <summary> </summary>
public
virtual
DbSet
<
ag_workload_type
>
ag_workload_type
{
get
;
set
;
}
public
virtual
DbSet
<
ag_workload_type
>
ag_workload_type
{
get
;
set
;
}
/// <summary> </summary>
public
virtual
DbSet
<
ag_worktype_source
>
ag_worktype_source
{
get
;
set
;
}
/// <summary> 考核类别 </summary>
/// <summary> 考核类别 </summary>
public
virtual
DbSet
<
as_assess
>
as_assess
{
get
;
set
;
}
public
virtual
DbSet
<
as_assess
>
as_assess
{
get
;
set
;
}
/// <summary> 考核列头 </summary>
/// <summary> 考核列头 </summary>
...
...
performance/Performance.EntityModels/Entity/ag_bodysource.cs
0 → 100644
View file @
2f7c8184
//-----------------------------------------------------------------------
// <copyright file=" ag_bodysource.cs">
// * FileName: 二次绩效保存数据.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Performance.EntityModels
{
/// <summary>
/// 二次绩效保存数据
/// </summary>
[
Table
(
"ag_bodysource"
)]
public
class
ag_bodysource
{
/// <summary>
///
/// </summary>
[
Key
]
public
int
Id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
SecondId
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
int
>
RowNumber
{
get
;
set
;
}
/// <summary>
/// 人员工号
/// </summary>
public
string
WorkNumber
{
get
;
set
;
}
/// <summary>
/// 姓名
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 科室
/// </summary>
public
string
Department
{
get
;
set
;
}
/// <summary>
/// 岗位
/// </summary>
public
string
Post
{
get
;
set
;
}
/// <summary>
/// 人员系数
/// </summary>
public
Nullable
<
decimal
>
StaffCoefficient
{
get
;
set
;
}
/// <summary>
/// 出勤
/// </summary>
public
Nullable
<
decimal
>
ActualAttendance
{
get
;
set
;
}
/// <summary>
/// 职称
/// </summary>
public
string
JobTitle
{
get
;
set
;
}
/// <summary>
/// 职称系数
/// </summary>
public
Nullable
<
decimal
>
TitleCoefficient
{
get
;
set
;
}
/// <summary>
/// 职称绩效
/// </summary>
public
Nullable
<
decimal
>
TitlePerformance
{
get
;
set
;
}
/// <summary>
/// 管理津贴
/// </summary>
public
Nullable
<
decimal
>
ManagementAllowance
{
get
;
set
;
}
/// <summary>
/// 单项奖励
/// </summary>
public
Nullable
<
decimal
>
IndividualReward
{
get
;
set
;
}
/// <summary>
/// 重点专科分配
/// </summary>
public
Nullable
<
decimal
>
AllocationOfKeySpecialty
{
get
;
set
;
}
/// <summary>
/// 科室单项奖励
/// </summary>
public
Nullable
<
decimal
>
DeptReward
{
get
;
set
;
}
/// <summary>
/// 主任基础绩效
/// </summary>
public
Nullable
<
decimal
>
BasisPerformance
{
get
;
set
;
}
/// <summary>
/// 可分配绩效
/// </summary>
public
Nullable
<
decimal
>
DistPerformance
{
get
;
set
;
}
/// <summary>
/// 医院其他绩效
/// </summary>
public
Nullable
<
decimal
>
OtherPerformance
{
get
;
set
;
}
/// <summary>
/// 夜班工作量绩效
/// </summary>
public
Nullable
<
decimal
>
NightWorkPerformance
{
get
;
set
;
}
/// <summary>
/// 实发绩效工资金额
/// </summary>
public
Nullable
<
decimal
>
RealAmount
{
get
;
set
;
}
/// <summary>
/// 签字
/// </summary>
public
string
Signature
{
get
;
set
;
}
/// <summary>
/// 预留比例
/// </summary>
public
Nullable
<
decimal
>
ReservedRatio
{
get
;
set
;
}
/// <summary>
/// 预留金额
/// </summary>
public
Nullable
<
decimal
>
ReservedAmount
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/ag_headsource.cs
0 → 100644
View file @
2f7c8184
//-----------------------------------------------------------------------
// <copyright file=" ag_headsource.cs">
// * FileName: 二次绩效顶部数据.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Performance.EntityModels
{
/// <summary>
/// 二次绩效顶部数据
/// </summary>
[
Table
(
"ag_headsource"
)]
public
class
ag_headsource
{
/// <summary>
///
/// </summary>
[
Key
]
public
int
Id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
SecondId
{
get
;
set
;
}
/// <summary>
/// 可分配绩效
/// </summary>
public
Nullable
<
decimal
>
TotalPerformance
{
get
;
set
;
}
/// <summary>
/// 医院其他绩效
/// </summary>
public
Nullable
<
decimal
>
HosOtherPerformance
{
get
;
set
;
}
/// <summary>
/// 夜班绩效总和
/// </summary>
public
Nullable
<
decimal
>
NightShiftWorkPerforTotal
{
get
;
set
;
}
/// <summary>
/// 科室总绩效
/// </summary>
public
Nullable
<
decimal
>
TotalDistPerformance
{
get
;
set
;
}
/// <summary>
/// 主任基础绩效
/// </summary>
public
Nullable
<
decimal
>
DirectorBasisPerformance
{
get
;
set
;
}
/// <summary>
/// 科室单项奖励
/// </summary>
public
Nullable
<
decimal
>
TheTotalAllocationOfPerformanceResults
{
get
;
set
;
}
/// <summary>
/// 业绩分配绩效总额
/// </summary>
public
Nullable
<
decimal
>
BasisPerformance
{
get
;
set
;
}
/// <summary>
/// 年资职称绩效占比
/// </summary>
public
Nullable
<
decimal
>
SeniorityTitlesAccountedPerformance
{
get
;
set
;
}
/// <summary>
/// 年资职称绩效
/// </summary>
public
Nullable
<
decimal
>
SeniorityTitlesPerformance
{
get
;
set
;
}
/// <summary>
/// 工作量绩效占比
/// </summary>
public
Nullable
<
decimal
>
PerformanceShareTheWorkload
{
get
;
set
;
}
/// <summary>
/// 工作量分配绩效金额
/// </summary>
public
Nullable
<
decimal
>
PerformanceWorkloadDistributionAmount
{
get
;
set
;
}
/// <summary>
/// 满勤天数
/// </summary>
public
Nullable
<
decimal
>
DaysFullAttendance
{
get
;
set
;
}
/// <summary>
/// 科室人均
/// </summary>
public
Nullable
<
decimal
>
DepartmentsPerCapita
{
get
;
set
;
}
/// <summary>
/// 发放月份
/// </summary>
public
string
PaymentOfTheMonth
{
get
;
set
;
}
/// <summary>
/// 科室核算人数
/// </summary>
public
Nullable
<
decimal
>
TheNumberOfAccountingDepartment
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/ag_workload_source.cs
0 → 100644
View file @
2f7c8184
//-----------------------------------------------------------------------
// <copyright file=" ag_workload_source.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Performance.EntityModels
{
/// <summary>
///
/// </summary>
[
Table
(
"ag_workload_source"
)]
public
class
ag_workload_source
{
/// <summary>
///
/// </summary>
[
Key
]
public
int
Id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
WorkloadId
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
BodyId
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
decimal
>
Value
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/ag_worktype_source.cs
0 → 100644
View file @
2f7c8184
//-----------------------------------------------------------------------
// <copyright file=" ag_worktype_source.cs">
// * FileName: ag_worktype_source.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Performance.EntityModels
{
/// <summary>
///
/// </summary>
[
Table
(
"ag_worktype_source"
)]
public
class
ag_worktype_source
{
/// <summary>
///
/// </summary>
[
Key
]
public
int
Id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
WorkTypeId
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
SecondId
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
FieldId
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
FieldName
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
decimal
>
Value
{
get
;
set
;
}
}
}
performance/Performance.Repository/BaseRepository.cs
View file @
2f7c8184
...
@@ -111,6 +111,13 @@ public bool UpdateRange(params TEntity[] entities)
...
@@ -111,6 +111,13 @@ public bool UpdateRange(params TEntity[] entities)
return
context
.
SaveChanges
()
>
0
;
return
context
.
SaveChanges
()
>
0
;
}
}
public
bool
UpdateByState
(
TEntity
entity
)
{
var
entry
=
context
.
Entry
(
entity
);
entry
.
State
=
EntityState
.
Modified
;
return
context
.
SaveChanges
()
>
0
;
}
public
bool
Update
(
TEntity
entity
,
Action
<
TEntity
>
action
)
public
bool
Update
(
TEntity
entity
,
Action
<
TEntity
>
action
)
{
{
action
?.
Invoke
(
entity
);
action
?.
Invoke
(
entity
);
...
...
performance/Performance.Repository/Repository/PerforAgbodysourceRepository.cs
0 → 100644
View file @
2f7c8184
//-----------------------------------------------------------------------
// <copyright file=" ag_bodysource.cs">
// * FileName: ag_bodysource.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// ag_bodysource Repository
/// </summary>
public
partial
class
PerforAgbodysourceRepository
:
PerforRepository
<
ag_bodysource
>
{
public
PerforAgbodysourceRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Repository/Repository/PerforAgheadsourceRepository.cs
0 → 100644
View file @
2f7c8184
//-----------------------------------------------------------------------
// <copyright file=" ag_headsource.cs">
// * FileName: ag_headsource.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// ag_headsource Repository
/// </summary>
public
partial
class
PerforAgheadsourceRepository
:
PerforRepository
<
ag_headsource
>
{
public
PerforAgheadsourceRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Repository/Repository/PerforAgworkloadsourceRepository.cs
0 → 100644
View file @
2f7c8184
//-----------------------------------------------------------------------
// <copyright file=" ag_workload_source.cs">
// * FileName: ag_workload_source.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// ag_workload_source Repository
/// </summary>
public
partial
class
PerforAgworkloadsourceRepository
:
PerforRepository
<
ag_workload_source
>
{
public
PerforAgworkloadsourceRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Repository/Repository/PerforAgworktypesourceRepository.cs
0 → 100644
View file @
2f7c8184
//-----------------------------------------------------------------------
// <copyright file=" ag_worktype_source.cs">
// * FileName: ag_worktype_source.cs
// </copyright>
//-----------------------------------------------------------------------
using
System
;
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// ag_worktype_source Repository
/// </summary>
public
partial
class
PerforAgworktypesourceRepository
:
PerforRepository
<
ag_worktype_source
>
{
public
PerforAgworktypesourceRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Services/
Details
/SecondAllotDetails.cs
→
performance/Performance.Services/
SecondAllot
/SecondAllotDetails.cs
View file @
2f7c8184
File moved
performance/Performance.Services/SecondAllot/SecondAllotService.cs
0 → 100644
View file @
2f7c8184
using
Microsoft.Extensions.Logging
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
namespace
Performance.Services.SecondAllot
{
public
class
SecondAllotService
:
IAutoInjection
{
private
readonly
ILogger
logger
;
private
readonly
PerforPerallotRepository
perallotRepository
;
private
readonly
PerforAgsecondallotRepository
secondallotRepository
;
private
readonly
PerforAgusetempRepository
usetempRepository
;
private
readonly
PerforAgworkloadtypeRepository
workloadtypeRepository
;
private
readonly
PerforAgworkloadRepository
workloadRepository
;
private
readonly
PerforAgheadsourceRepository
headsourceRepository
;
private
readonly
PerforAgworktypesourceRepository
worktypesourceRepository
;
private
readonly
PerforAgbodysourceRepository
bodysourceRepository
;
private
readonly
PerforAgworkloadsourceRepository
workloadsourceRepository
;
private
readonly
PerforPerapramountRepository
perapramountRepository
;
private
readonly
PersonService
personService
;
public
SecondAllotService
(
ILogger
<
SecondAllotService
>
logger
,
PerforPerallotRepository
perallotRepository
,
PerforAgsecondallotRepository
secondallotRepository
,
PerforAgusetempRepository
usetempRepository
,
PerforAgworkloadtypeRepository
workloadtypeRepository
,
PerforAgworkloadRepository
workloadRepository
,
PerforAgheadsourceRepository
headsourceRepository
,
PerforAgworktypesourceRepository
worktypesourceRepository
,
PerforAgbodysourceRepository
bodysourceRepository
,
PerforAgworkloadsourceRepository
workloadsourceRepository
,
PerforPerapramountRepository
perapramountRepositor
,
PersonService
personService
)
{
this
.
logger
=
logger
;
this
.
perallotRepository
=
perallotRepository
;
this
.
secondallotRepository
=
secondallotRepository
;
this
.
usetempRepository
=
usetempRepository
;
this
.
workloadtypeRepository
=
workloadtypeRepository
;
this
.
workloadRepository
=
workloadRepository
;
this
.
headsourceRepository
=
headsourceRepository
;
this
.
worktypesourceRepository
=
worktypesourceRepository
;
this
.
bodysourceRepository
=
bodysourceRepository
;
this
.
workloadsourceRepository
=
workloadsourceRepository
;
this
.
perapramountRepository
=
perapramountRepositor
;
this
.
personService
=
personService
;
}
#
region
二次绩效详情
public
SecondAllotResponse
GetSecondSavedData
(
int
userId
,
int
secondId
,
int
employeeSource
)
{
var
second
=
secondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
if
(
second
==
null
)
throw
new
PerformanceException
(
"参数SecondId无效!"
);
var
allot
=
perallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
second
.
AllotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"绩效记录不存在!"
);
var
detail
=
new
Detail
()
{
TempId
=
GetUsingTempId
(
allot
.
HospitalId
,
second
),
IsArchive
=
allot
.
States
==
8
?
1
:
0
,
States
=
allot
.
States
,
Status
=
second
.
Status
??
1
,
Department
=
second
.
Department
,
UnitType
=
second
.
UnitType
};
SecondAllotResponse
result
=
new
SecondAllotResponse
()
{
Detail
=
detail
};
var
head
=
headsourceRepository
.
GetEntity
(
t
=>
t
.
SecondId
==
secondId
)
??
new
ag_headsource
{
SecondId
=
secondId
,
TotalPerformance
=
second
.
RealGiveFee
,
PaymentOfTheMonth
=
$"
{
allot
.
Year
}
年
{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
月"
};
JObject
jObject
=
JObject
.
Parse
(
JsonConvert
.
SerializeObject
(
head
));
var
headDynamic
=
worktypesourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
if
(
headDynamic
!=
null
&&
headDynamic
.
Any
())
{
foreach
(
var
item
in
headDynamic
.
OrderBy
(
t
=>
t
.
Id
))
jObject
.
Add
(
new
JProperty
(
item
.
FieldId
,
item
.
Value
));
}
result
.
Head
=
jObject
;
if
(
detail
.
IsArchive
==
1
||
new
List
<
int
>
{
(
int
)
SecondAllotStatus
.
WaitReview
,
(
int
)
SecondAllotStatus
.
PassAudit
}.
Contains
(
second
.
Status
??
(
int
)
SecondAllotStatus
.
Uncommitted
))
employeeSource
=
(
int
)
EmployeeSource
.
Initial
;
var
prevSecond
=
GetPreviousSecondAllot
(
allot
.
HospitalId
,
second
);
// 保存过数据,从保存的数据中心带出信息
// 未保存过数据,带入初始数据(首次填写二次绩效,人员信息来自人员字典,有历史二次绩效记录时,人员信息来自上次二次绩效填写记录)
if
(
head
.
Id
==
0
)
employeeSource
=
prevSecond
==
null
?
(
int
)
EmployeeSource
.
EmployeeDict
:
(
int
)
EmployeeSource
.
PrevSecondAllot
;
result
.
Body
=
GetBodyItemsByEmployeeSource
(
userId
,
employeeSource
,
second
,
prevSecond
,
allot
);
return
result
;
}
/// <summary>
/// 根据不同情况获取不同数据
/// </summary>
/// <param name="userId"></param>
/// <param name="employeeSource"></param>
/// <param name="second"></param>
/// <param name="prevSecond"></param>
/// <param name="allot"></param>
/// <returns></returns>
private
JArray
GetBodyItemsByEmployeeSource
(
int
userId
,
int
employeeSource
,
ag_secondallot
second
,
ag_secondallot
prevSecond
,
per_allot
allot
)
{
List
<
ag_bodysource
>
bodysources
=
new
List
<
ag_bodysource
>();
var
employeeList
=
personService
.
GetPersons
(
allot
.
ID
,
userId
);
switch
(
employeeSource
)
{
case
(
int
)
EmployeeSource
.
Initial
:
bodysources
=
bodysourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
second
.
Id
);
break
;
case
(
int
)
EmployeeSource
.
EmployeeDict
:
bodysources
=
GetEmployeeFromEmployeeDict
(
employeeList
);
break
;
case
int
source
when
source
==
(
int
)
EmployeeSource
.
PrevSecondAllot
&&
prevSecond
!=
null
:
bodysources
=
GetEmployeeFromPrevData
(
prevSecond
,
employeeList
);
break
;
default
:
bodysources
=
new
List
<
ag_bodysource
>();
break
;
}
SupplementOtherPerfor
(
second
,
bodysources
,
employeeList
);
JArray
jArray
=
new
JArray
();
if
(
bodysources
==
null
||
!
bodysources
.
Any
())
return
jArray
;
var
bodyDynamic
=
workloadsourceRepository
.
GetEntities
(
t
=>
bodysources
.
Select
(
w
=>
w
.
Id
).
Contains
(
t
.
BodyId
));
var
workloads
=
workloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
t
.
Department
==
second
.
Department
&&
t
.
UnitType
==
second
.
UnitType
);
if
(
workloads
!=
null
&&
workloads
.
Any
())
{
foreach
(
var
item
in
bodysources
.
OrderBy
(
t
=>
t
.
RowNumber
).
ThenBy
(
t
=>
t
.
Id
))
{
JObject
jObj
=
JObject
.
Parse
(
JsonConvert
.
SerializeObject
(
item
));
foreach
(
var
workitem
in
workloads
.
OrderBy
(
t
=>
t
.
WorkTypeId
).
ThenBy
(
t
=>
t
.
Sort
))
{
var
value
=
bodyDynamic
?.
FirstOrDefault
(
w
=>
w
.
BodyId
==
item
.
Id
&&
w
.
WorkloadId
==
workitem
.
Id
)?.
Value
;
jObj
.
Add
(
new
JProperty
(
workitem
.
ItemId
,
value
));
}
jArray
.
Add
(
jObj
);
}
}
return
jArray
;
}
/// <summary>
/// 从人员字典中获取人员信息
/// </summary>
/// <param name="employeeList"></param>
/// <returns></returns>
public
List
<
ag_bodysource
>
GetEmployeeFromEmployeeDict
(
List
<
per_employee
>
employeeList
)
{
if
(
employeeList
==
null
||
!
employeeList
.
Any
())
return
new
List
<
ag_bodysource
>();
List
<
ag_bodysource
>
bodysources
=
new
List
<
ag_bodysource
>();
int
rowNumber
=
1
;
foreach
(
var
employee
in
employeeList
)
{
bodysources
.
Add
(
new
ag_bodysource
{
RowNumber
=
rowNumber
,
WorkNumber
=
employee
.
PersonnelNumber
,
Name
=
employee
.
DoctorName
,
Post
=
(
employee
.
Duty
?.
IndexOf
(
"主任"
)
>
-
1
||
employee
.
Duty
?.
IndexOf
(
"护士长"
)
>
-
1
)
?
"科主任/护士长"
:
"其他"
,
ActualAttendance
=
employee
.
AttendanceDay
,
StaffCoefficient
=
1
,
JobTitle
=
employee
.
JobTitle
,
ReservedRatio
=
employee
.
ReservedRatio
,
OtherPerformance
=
0
});
rowNumber
++;
}
return
bodysources
;
}
/// <summary>
/// 从上一次的保存信息中获取人员信息
/// </summary>
/// <param name="prevSecondAllot"></param>
/// <param name="otherShowColumns"></param>
/// <returns></returns>
public
List
<
ag_bodysource
>
GetEmployeeFromPrevData
(
ag_secondallot
prevSecond
,
List
<
per_employee
>
employeeList
)
{
var
body
=
bodysourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
prevSecond
.
Id
);
if
(
body
==
null
||
!
body
.
Any
())
return
new
List
<
ag_bodysource
>();
foreach
(
var
item
in
body
.
Select
(
t
=>
new
ag_bodysource
{
WorkNumber
=
t
.
WorkNumber
,
Name
=
t
.
Name
,
Post
=
t
.
Post
,
Department
=
t
.
Department
,
StaffCoefficient
=
t
.
StaffCoefficient
,
JobTitle
=
t
.
JobTitle
,
TitleCoefficient
=
t
.
TitleCoefficient
}))
{
item
.
ActualAttendance
=
employeeList
?.
FirstOrDefault
(
w
=>
w
.
PersonnelNumber
==
item
.
WorkNumber
&&
w
.
DoctorName
==
item
.
Name
)?.
AttendanceDay
;
}
return
body
;
}
/// <summary>
/// 补充 医院其他绩效
/// </summary>
/// <param name="result"></param>
private
void
SupplementOtherPerfor
(
ag_secondallot
secondAllot
,
List
<
ag_bodysource
>
bodyItems
,
List
<
per_employee
>
employeeList
)
{
if
(
bodyItems
==
null
||
!
bodyItems
.
Any
(
w
=>
w
.
RowNumber
>
-
1
))
return
;
var
perapramounts
=
perapramountRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
secondAllot
.
AllotId
&&
t
.
Status
==
3
);
if
(
perapramounts
==
null
||
!
perapramounts
.
Any
())
return
;
foreach
(
var
rowitem
in
bodyItems
)
{
var
employee
=
employeeList
.
FirstOrDefault
(
w
=>
w
.
PersonnelNumber
==
rowitem
.
WorkNumber
);
if
(
employee
==
null
)
continue
;
var
hasAmountData
=
perapramounts
?.
Where
(
w
=>
w
.
PersonnelNumber
?.
Trim
()
==
rowitem
.
WorkNumber
?.
Trim
());
if
(
hasAmountData
==
null
||
!
hasAmountData
.
Any
())
continue
;
rowitem
.
OtherPerformance
=
secondAllot
.
Department
==
employee
.
AccountingUnit
?
hasAmountData
.
Sum
(
w
=>
w
.
Amount
)
:
0
;
perapramounts
.
RemoveAll
(
w
=>
w
.
PersonnelNumber
?.
Trim
()
==
rowitem
.
WorkNumber
?.
Trim
());
}
// 补充字典中该科室不存在,但有其它绩效的人员信息
if
(
perapramounts
!=
null
&&
perapramounts
.
Any
(
t
=>
t
.
AccountingUnit
==
secondAllot
.
Department
))
{
var
groupData
=
perapramounts
.
Where
(
t
=>
t
.
AccountingUnit
==
secondAllot
.
Department
).
GroupBy
(
t
=>
t
.
PersonnelNumber
)
.
Select
(
t
=>
new
{
PersonnelNumber
=
t
.
Key
,
DoctorName
=
t
.
FirstOrDefault
(
w
=>
!
string
.
IsNullOrEmpty
(
w
.
DoctorName
))?.
DoctorName
,
Amount
=
t
.
Sum
(
w
=>
w
.
Amount
)
});
// int maxRownumber = bodyItems.Max(t => t.RowNumber ?? 0) + 1;
foreach
(
var
item
in
groupData
)
{
var
employee
=
employeeList
.
FirstOrDefault
(
w
=>
w
.
PersonnelNumber
==
item
.
PersonnelNumber
);
if
(
employee
==
null
)
{
bodyItems
.
Add
(
new
ag_bodysource
{
WorkNumber
=
item
.
PersonnelNumber
,
Name
=
item
.
DoctorName
,
StaffCoefficient
=
1
,
OtherPerformance
=
item
.
Amount
});
}
else
{
bodyItems
.
Add
(
new
ag_bodysource
{
WorkNumber
=
item
.
PersonnelNumber
,
Name
=
item
.
DoctorName
,
Post
=
(
employee
.
Duty
?.
IndexOf
(
"主任"
)
>
-
1
||
employee
.
Duty
?.
IndexOf
(
"护士长"
)
>
-
1
)
?
"科主任/护士长"
:
"其他"
,
ActualAttendance
=
employee
.
AttendanceDay
,
StaffCoefficient
=
1
,
JobTitle
=
employee
.
JobTitle
,
ReservedRatio
=
employee
.
ReservedRatio
,
OtherPerformance
=
item
.
Amount
});
}
}
}
}
/// <summary>
/// 获取当前使用的模板
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="second"></param>
/// <returns></returns>
private
int
GetUsingTempId
(
int
hospitalId
,
ag_secondallot
second
)
{
int
usingTempId
=
(
int
)
Temp
.
other
;
var
usedTemp
=
usetempRepository
.
GetEntity
(
t
=>
t
.
HospitalId
==
hospitalId
&&
t
.
Department
==
second
.
Department
&&
t
.
UnitType
==
second
.
UnitType
);
if
(
usedTemp
==
null
)
return
usingTempId
;
if
(
new
int
[]
{
2
,
3
}.
Contains
(
second
.
Status
??
1
))
usingTempId
=
(
second
.
UseTempId
??
0
)
==
0
?
(
int
)
Temp
.
other
:
second
.
UseTempId
.
Value
;
return
usingTempId
;
}
/// <summary>
/// 获取上一次的二次绩效
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="secondAllot"></param>
/// <returns></returns>
private
ag_secondallot
GetPreviousSecondAllot
(
int
hospitalId
,
ag_secondallot
secondAllot
)
{
// 历史删除绩效时,未删除对应的二次绩效记录
var
allotList
=
perallotRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
)?.
OrderBy
(
s
=>
s
.
Year
).
ThenBy
(
s
=>
s
.
Month
).
ToList
();
if
(
allotList
==
null
||
!
allotList
.
Any
())
throw
new
PerformanceException
(
"未查询到符合的绩效记录"
);
var
allot
=
allotList
.
FirstOrDefault
(
w
=>
w
.
ID
==
secondAllot
.
AllotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"未查询到符合的绩效记录"
);
var
index
=
allotList
.
IndexOf
(
allot
);
if
(
index
==
0
)
return
null
;
var
prevAllot
=
allotList
[
index
-
1
];
var
prevSecondAllot
=
secondallotRepository
.
GetEntity
(
w
=>
w
.
AllotId
==
prevAllot
.
ID
&&
w
.
UnitType
==
secondAllot
.
UnitType
&&
w
.
Department
==
secondAllot
.
Department
);
return
prevSecondAllot
;
}
#
endregion
#
region
动态配置字典
public
dynamic
GetWorkTypeDict
(
int
secondId
)
{
var
worktypeSources
=
worktypesourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
)
??
new
List
<
ag_worktype_source
>();
return
worktypeSources
.
OrderBy
(
t
=>
t
.
Id
).
Select
(
t
=>
new
{
Title
=
t
.
FieldId
,
Value
=
t
.
FieldName
});
}
public
dynamic
GetWorkloadDict
(
int
secondId
)
{
var
second
=
secondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
if
(
second
==
null
)
throw
new
PerformanceException
(
"参数SecondId无效!"
);
var
allot
=
perallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
second
.
AllotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"绩效记录不存在!"
);
var
workloads
=
workloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
t
.
Department
==
second
.
Department
&&
t
.
UnitType
==
second
.
UnitType
)
??
new
List
<
ag_workload
>();
return
workloads
.
OrderBy
(
t
=>
t
.
WorkTypeId
).
ThenBy
(
t
=>
t
.
Sort
).
Select
(
t
=>
new
{
Title
=
t
.
ItemId
,
Value
=
t
.
ItemName
,
Factor
=
t
.
FactorValue
});
}
#
endregion
#
region
保存数据
public
void
SaveSecondAllotData
(
int
secondId
,
dynamic
saveData
)
{
try
{
var
head
=
saveData
[
"head"
];
SaveSecondAllotHeadData
(
secondId
,
JsonHelper
.
Serialize
(
head
));
var
body
=
saveData
[
"body"
];
SaveSecondAllotBodyData
(
secondId
,
body
);
}
catch
(
Exception
ex
)
{
logger
.
LogError
(
ex
.
Message
);
}
}
/// <summary>
/// 保存Head相关数据
/// </summary>
/// <param name="secondId"></param>
/// <param name="json"></param>
private
void
SaveSecondAllotHeadData
(
int
secondId
,
string
json
)
{
if
(
string
.
IsNullOrEmpty
(
json
))
return
;
ag_headsource
headsource
=
JsonHelper
.
Deserialize
<
ag_headsource
>(
json
);
if
(
headsource
==
null
)
return
;
if
(
headsource
.
Id
==
0
)
{
headsource
.
SecondId
=
secondId
;
headsourceRepository
.
Add
(
headsource
);
}
else
{
headsourceRepository
.
UpdateByState
(
headsource
);
}
string
[]
prefix
=
new
string
[]
{
"Workload_Ratio_"
,
"Workload_Amount_"
};
Dictionary
<
string
,
object
>
dict
=
JsonHelper
.
Deserialize
<
Dictionary
<
string
,
object
>>(
json
);
var
keys
=
dict
.
Keys
.
Where
(
t
=>
t
.
StartsWith
(
prefix
[
0
])
||
t
.
StartsWith
(
prefix
[
1
]));
if
(
keys
==
null
||
!
keys
.
Any
())
return
;
List
<
ag_worktype_source
>
insertData
=
new
List
<
ag_worktype_source
>();
var
worktypeSources
=
worktypesourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
if
(
worktypeSources
==
null
||
!
worktypeSources
.
Any
())
return
;
foreach
(
var
key
in
keys
)
{
var
update
=
worktypeSources
.
FirstOrDefault
(
t
=>
t
.
FieldId
==
key
);
if
(
update
!=
null
)
{
update
.
Value
=
ConvertHelper
.
To
<
decimal
>(
dict
[
key
]);
}
}
worktypesourceRepository
.
UpdateRange
(
worktypeSources
.
ToArray
());
}
/// <summary>
/// 保存Body相关数据
/// </summary>
/// <param name="secondId"></param>
/// <param name="body"></param>
private
void
SaveSecondAllotBodyData
(
int
secondId
,
dynamic
body
)
{
// 允许空行数据提交,删除数据库存数数据
var
bodyEntities
=
bodysourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
if
(
bodyEntities
!=
null
&&
bodyEntities
.
Any
())
{
var
workloadEntities
=
workloadsourceRepository
.
GetEntities
(
t
=>
bodyEntities
.
Select
(
w
=>
w
.
Id
).
Contains
(
t
.
BodyId
));
if
(
workloadEntities
!=
null
&&
workloadEntities
.
Any
())
workloadsourceRepository
.
RemoveRange
(
workloadEntities
.
ToArray
());
bodysourceRepository
.
RemoveRange
(
bodyEntities
.
ToArray
());
}
if
(
body
==
null
||
!
body
.
Any
())
return
;
string
[]
prefix
=
new
string
[]
{
"WorkloadScore_"
,
"AssessmentScore_"
,
"WorkPerformance_"
,
$"
{
AgWorkloadType
.
SingleAwards
}
_"
,
$"
{
AgWorkloadType
.
Workload
}
_"
};
List
<
ag_workload_source
>
workloadSources
=
new
List
<
ag_workload_source
>();
foreach
(
var
rowitem
in
body
)
{
ag_bodysource
bodySource
=
JsonHelper
.
Deserialize
<
ag_bodysource
>(
JsonHelper
.
Serialize
(
rowitem
));
var
result
=
bodysourceRepository
.
Add
(
bodySource
);
if
(!
result
)
continue
;
Dictionary
<
string
,
object
>
dict
=
JsonHelper
.
Deserialize
<
Dictionary
<
string
,
object
>>(
rowitem
);
var
keys
=
dict
.
Keys
.
Where
(
t
=>
t
.
StartsWith
(
prefix
[
0
])
||
t
.
StartsWith
(
prefix
[
1
])
||
t
.
StartsWith
(
prefix
[
2
])
||
t
.
StartsWith
(
prefix
[
3
])
||
t
.
StartsWith
(
prefix
[
4
]));
if
(
keys
==
null
||
!
keys
.
Any
())
continue
;
foreach
(
var
key
in
keys
)
{
string
[]
fields
=
key
.
Split
(
'_'
);
if
(
fields
.
Length
!=
3
)
continue
;
var
workloadId
=
ConvertHelper
.
To
<
int
>(
fields
[
3
]);
workloadSources
.
Add
(
new
ag_workload_source
{
WorkloadId
=
workloadId
,
BodyId
=
bodySource
.
Id
,
Value
=
ConvertHelper
.
To
<
decimal
>(
dict
[
key
])
});
;
}
}
if
(
workloadSources
!=
null
&&
workloadSources
.
Any
())
workloadsourceRepository
.
AddRange
(
workloadSources
.
ToArray
());
}
#
endregion
}
}
performance/Performance.Services/SecondAllotService.cs
View file @
2f7c8184
...
@@ -43,6 +43,7 @@ public class SecondAllotService : IAutoInjection
...
@@ -43,6 +43,7 @@ public class SecondAllotService : IAutoInjection
private
readonly
PerforRescomputeRepository
rescomputeRepository
;
private
readonly
PerforRescomputeRepository
rescomputeRepository
;
private
readonly
PerforPeremployeeRepository
peremployeeRepository
;
private
readonly
PerforPeremployeeRepository
peremployeeRepository
;
private
readonly
PerforImemployeeclinicRepository
imemployeeclinicRepository
;
private
readonly
PerforImemployeeclinicRepository
imemployeeclinicRepository
;
private
readonly
PerforAgworktypesourceRepository
worktypesourceRepository
;
private
readonly
List
<
ag_tempitem
>
tempitems
=
new
List
<
ag_tempitem
>();
private
readonly
List
<
ag_tempitem
>
tempitems
=
new
List
<
ag_tempitem
>();
public
SecondAllotService
(
IOptions
<
Application
>
application
,
public
SecondAllotService
(
IOptions
<
Application
>
application
,
...
@@ -70,7 +71,9 @@ public class SecondAllotService : IAutoInjection
...
@@ -70,7 +71,9 @@ public class SecondAllotService : IAutoInjection
ComputeService
computeService
,
ComputeService
computeService
,
PerforRescomputeRepository
rescomputeRepository
,
PerforRescomputeRepository
rescomputeRepository
,
PerforPeremployeeRepository
peremployeeRepository
,
PerforPeremployeeRepository
peremployeeRepository
,
PerforImemployeeclinicRepository
imemployeeclinicRepository
)
PerforImemployeeclinicRepository
imemployeeclinicRepository
,
PerforAgworktypesourceRepository
worktypesourceRepository
)
{
{
this
.
application
=
application
.
Value
;
this
.
application
=
application
.
Value
;
_logger
=
logger
;
_logger
=
logger
;
...
@@ -99,6 +102,7 @@ public class SecondAllotService : IAutoInjection
...
@@ -99,6 +102,7 @@ public class SecondAllotService : IAutoInjection
this
.
peremployeeRepository
=
peremployeeRepository
;
this
.
peremployeeRepository
=
peremployeeRepository
;
this
.
imemployeeclinicRepository
=
imemployeeclinicRepository
;
this
.
imemployeeclinicRepository
=
imemployeeclinicRepository
;
this
.
tempitems
=
perforAgtempitemRepository
.
GetEntities
();
this
.
tempitems
=
perforAgtempitemRepository
.
GetEntities
();
this
.
worktypesourceRepository
=
worktypesourceRepository
;
}
}
#
region
二次绩效列表与数据保存
#
region
二次绩效列表与数据保存
...
@@ -1048,7 +1052,8 @@ public bool WorkloadAdd(WorkloadRequest request)
...
@@ -1048,7 +1052,8 @@ public bool WorkloadAdd(WorkloadRequest request)
var
result
=
perforAgworkloadRepository
.
Add
(
workload
);
var
result
=
perforAgworkloadRepository
.
Add
(
workload
);
if
(
result
)
if
(
result
)
{
{
workload
.
ItemId
=
$"Feild
{
workload
.
Id
}
"
;
string
field
=
request
.
WorkTypeId
==
(
int
)
AgWorkloadType
.
SingleAwards
?
AgWorkloadType
.
SingleAwards
.
ToString
()
:
AgWorkloadType
.
Workload
.
ToString
();
workload
.
ItemId
=
$"
{
field
}
_
{
workload
.
WorkTypeId
}
_
{
workload
.
Id
}
"
;
perforAgworkloadRepository
.
Update
(
workload
);
perforAgworkloadRepository
.
Update
(
workload
);
}
}
...
@@ -1073,7 +1078,8 @@ public bool WorkloadUpdate(WorkloadRequest request)
...
@@ -1073,7 +1078,8 @@ public bool WorkloadUpdate(WorkloadRequest request)
workload
.
FactorValue
=
request
.
FactorValue
;
workload
.
FactorValue
=
request
.
FactorValue
;
workload
.
ItemName
=
request
.
ItemName
;
workload
.
ItemName
=
request
.
ItemName
;
workload
.
Sort
=
request
.
Sort
;
workload
.
Sort
=
request
.
Sort
;
workload
.
ItemId
=
$"Feild
{
workload
.
Id
}
"
;
string
field
=
request
.
WorkTypeId
==
(
int
)
AgWorkloadType
.
SingleAwards
?
AgWorkloadType
.
SingleAwards
.
ToString
()
:
AgWorkloadType
.
Workload
.
ToString
();
workload
.
ItemId
=
$"
{
field
}
_
{
request
.
WorkTypeId
}
_
{
workload
.
Id
}
"
;
workload
.
WorkTypeId
=
request
.
WorkTypeId
;
workload
.
WorkTypeId
=
request
.
WorkTypeId
;
return
perforAgworkloadRepository
.
Update
(
workload
);
return
perforAgworkloadRepository
.
Update
(
workload
);
...
@@ -1151,6 +1157,7 @@ public ag_workload_type SaveWorkType(ag_workload_type request, int userId)
...
@@ -1151,6 +1157,7 @@ public ag_workload_type SaveWorkType(ag_workload_type request, int userId)
};
};
perforAgworkloadtypeRepository
.
Add
(
entity
);
perforAgworkloadtypeRepository
.
Add
(
entity
);
}
}
AddWorkTypeDefaultHeadValue
(
request
.
HospitalId
,
entity
);
AddWorkTypeDefaultValues
(
entity
);
AddWorkTypeDefaultValues
(
entity
);
return
entity
;
return
entity
;
}
}
...
@@ -1178,7 +1185,7 @@ private void AddWorkTypeDefaultValues(ag_workload_type type)
...
@@ -1178,7 +1185,7 @@ private void AddWorkTypeDefaultValues(ag_workload_type type)
HospitalId
=
type
.
HospitalId
,
HospitalId
=
type
.
HospitalId
,
Department
=
type
.
Department
,
Department
=
type
.
Department
,
UnitType
=
type
.
UnitType
,
UnitType
=
type
.
UnitType
,
ItemId
=
t
.
Item2
+
type
.
Id
,
ItemId
=
$"
{
t
.
Item2
}
_
{
type
.
Id
}
"
,
ItemName
=
t
.
Item1
,
ItemName
=
t
.
Item1
,
FactorValue
=
null
,
FactorValue
=
null
,
Sort
=
100
+
t
.
Item3
,
Sort
=
100
+
t
.
Item3
,
...
@@ -1197,7 +1204,7 @@ private void AddWorkTypeDefaultValues(ag_workload_type type)
...
@@ -1197,7 +1204,7 @@ private void AddWorkTypeDefaultValues(ag_workload_type type)
HospitalId
=
type
.
HospitalId
,
HospitalId
=
type
.
HospitalId
,
Department
=
type
.
Department
,
Department
=
type
.
Department
,
UnitType
=
type
.
UnitType
,
UnitType
=
type
.
UnitType
,
ItemId
=
item
.
Item2
+
type
.
Id
,
ItemId
=
$"
{
item
.
Item2
}
_
{
type
.
Id
}
"
,
ItemName
=
item
.
Item1
,
ItemName
=
item
.
Item1
,
FactorValue
=
null
,
FactorValue
=
null
,
Sort
=
100
+
item
.
Item3
,
Sort
=
100
+
item
.
Item3
,
...
@@ -1206,7 +1213,76 @@ private void AddWorkTypeDefaultValues(ag_workload_type type)
...
@@ -1206,7 +1213,76 @@ private void AddWorkTypeDefaultValues(ag_workload_type type)
}
}
}
}
}
}
perforAgworkloadRepository
.
AddRange
(
insertData
.
ToArray
());
var
result
=
perforAgworkloadRepository
.
AddRange
(
insertData
.
ToArray
());
if
(
result
)
{
insertData
.
ForEach
(
t
=>
{
var
prefix
=
defaultValues
.
FirstOrDefault
(
w
=>
w
.
Item1
==
t
.
ItemName
).
Item2
;
if
(!
string
.
IsNullOrEmpty
(
prefix
))
{
t
.
ItemId
=
$"
{
prefix
}
_
{
t
.
WorkTypeId
}
_
{
t
.
Id
}
"
;
}
});
perforAgworkloadRepository
.
UpdateRange
(
insertData
.
ToArray
());
}
}
private
void
AddWorkTypeDefaultHeadValue
(
int
hospitalId
,
ag_workload_type
type
)
{
List
<
ag_worktype_source
>
insertData
=
new
List
<
ag_worktype_source
>();
var
allots
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
if
(
allots
==
null
||
!
allots
.
Any
())
return
;
var
seconds
=
perforAgsecondallotRepository
.
GetEntities
(
t
=>
allots
.
Select
(
w
=>
w
.
ID
).
Contains
(
t
.
AllotId
.
Value
)
&&
t
.
Department
==
type
.
Department
&&
t
.
UnitType
==
type
.
UnitType
);
if
(
seconds
==
null
||
!
seconds
.
Any
())
return
;
var
worktypeSources
=
worktypesourceRepository
.
GetEntities
(
t
=>
t
.
WorkTypeId
==
type
.
Id
);
if
(
worktypeSources
==
null
||
!
worktypeSources
.
Any
())
{
insertData
=
seconds
.
Select
(
t
=>
new
ag_worktype_source
{
WorkTypeId
=
type
.
Id
,
SecondId
=
t
.
Id
,
FieldId
=
$"
{
AgWorkloadType
.
Workload
.
ToString
()}
_Ratio_
{
type
.
Id
}
"
,
FieldName
=
type
.
TypeName
.
EndsWith
(
"占比"
)
?
type
.
TypeName
:
type
.
TypeName
+
"占比"
}).
ToList
();
}
else
{
var
existedSeconds
=
worktypeSources
.
Select
(
t
=>
t
.
SecondId
);
var
except
=
seconds
.
Select
(
t
=>
t
.
Id
).
Except
(
existedSeconds
);
if
(
except
!=
null
&&
except
.
Any
())
{
insertData
=
except
.
Select
(
t
=>
new
ag_worktype_source
{
WorkTypeId
=
type
.
Id
,
SecondId
=
t
,
FieldId
=
$"
{
AgWorkloadType
.
Workload
.
ToString
()}
_Ratio_
{
type
.
Id
}
"
,
FieldName
=
type
.
TypeName
.
EndsWith
(
"占比"
)
?
type
.
TypeName
:
type
.
TypeName
+
"占比"
}).
ToList
();
}
worktypeSources
.
ForEach
(
t
=>
{
t
.
FieldName
=
type
.
TypeName
+
t
.
FieldName
.
Substring
(
t
.
FieldName
.
Length
-
2
);
});
worktypesourceRepository
.
UpdateRange
(
worktypeSources
.
ToArray
());
}
var
amounts
=
insertData
.
Select
(
t
=>
new
ag_worktype_source
{
WorkTypeId
=
type
.
Id
,
SecondId
=
t
.
SecondId
,
FieldId
=
$"
{
AgWorkloadType
.
Workload
.
ToString
()}
_Amount_
{
type
.
Id
}
"
,
FieldName
=
t
.
FieldName
.
Substring
(
0
,
t
.
FieldName
.
Length
-
2
)
+
"金额"
}).
ToList
();
insertData
.
AddRange
(
amounts
);
var
result
=
worktypesourceRepository
.
AddRange
(
insertData
.
OrderBy
(
t
=>
t
.
SecondId
).
ThenBy
(
t
=>
t
.
FieldName
).
ToArray
());
if
(
result
)
{
insertData
.
ForEach
(
t
=>
t
.
FieldId
=
t
.
FieldId
+
"_"
+
t
.
Id
);
worktypesourceRepository
.
UpdateRange
(
insertData
.
ToArray
());
}
}
}
/// <summary>
/// <summary>
...
@@ -1219,6 +1295,13 @@ public bool DeleteWorkType(WorkloadRequest request)
...
@@ -1219,6 +1295,13 @@ public bool DeleteWorkType(WorkloadRequest request)
var
entity
=
perforAgworkloadtypeRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
Id
);
var
entity
=
perforAgworkloadtypeRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
Id
);
if
(
entity
!=
null
)
if
(
entity
!=
null
)
{
{
var
items
=
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
WorkTypeId
==
request
.
Id
);
if
(
items
!=
null
&&
items
.
Any
())
perforAgworkloadRepository
.
RemoveRange
(
items
.
ToArray
());
var
sources
=
worktypesourceRepository
.
GetEntities
(
t
=>
t
.
WorkTypeId
==
request
.
Id
);
if
(
sources
!=
null
&&
sources
.
Any
())
worktypesourceRepository
.
RemoveRange
(
sources
.
ToArray
());
return
perforAgworkloadtypeRepository
.
Remove
(
entity
);
return
perforAgworkloadtypeRepository
.
Remove
(
entity
);
}
}
else
else
...
...
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