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
dddb73c3
Commit
dddb73c3
authored
Aug 23, 2021
by
钟博
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://gitlab.suvalue.com/zry/performance
into develop
parents
d85d1415
46afbe62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
16 deletions
+51
-16
performance/Performance.Api/Controllers/SecondAllotController.cs
+3
-0
performance/Performance.Services/RedistributionService.cs
+48
-16
No files found.
performance/Performance.Api/Controllers/SecondAllotController.cs
View file @
dddb73c3
...
...
@@ -575,6 +575,8 @@ public ApiResponse RedistributionLoad([FromBody] SecondLoadDto request)
overrideMode
=
(
EmployeeSource
)
request
.
OverrideMode
;
var
result
=
_redistributionService
.
Load
(
request
.
SecondId
,
(
ComputeMode
)
request
.
ComputeMode
,
overrideMode
);
_redistributionService
.
ClearInvalidValue
(
result
.
Body
?.
Data
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
catch
(
PerformanceException
ex
)
...
...
@@ -702,6 +704,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request)
// 重算部分数据
_redistributionService
.
RedistributionCompute
((
ComputeMode
)
request
.
ComputeMode
,
request
.
Head
,
cleanDatas
);
_redistributionService
.
ClearInvalidValue
(
cleanDatas
);
var
dic
=
_redistributionService
.
GetTableHeaderDictionary
((
ComputeMode
)
request
.
ComputeMode
,
allot
,
second
,
loads
,
workloadGroups
);
return
new
ApiResponse
(
ResponseType
.
OK
,
new
{
Head
=
request
.
Head
,
Body
=
cleanDatas
,
Dic
=
dic
});
}
...
...
performance/Performance.Services/RedistributionService.cs
View file @
dddb73c3
...
...
@@ -14,6 +14,7 @@
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Linq.Expressions
;
using
System.Text.RegularExpressions
;
namespace
Performance.Services
{
...
...
@@ -401,6 +402,30 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
}
/// <summary>
/// 清理 将所有0赋空
/// </summary>
/// <param name="datas"></param>
public
void
ClearInvalidValue
(
List
<
Dictionary
<
string
,
object
>>
datas
)
{
if
(
datas
!=
null
)
{
foreach
(
var
row
in
datas
)
{
foreach
(
var
key
in
row
.
Keys
.
ToArray
())
{
if
(
key
.
StartsWithIgnoreCase
(
"SingleAwards_"
)
||
key
.
StartsWithIgnoreCase
(
"Workload_"
))
{
var
value
=
row
[
key
]?.
ToString
()
??
""
;
if
(
value
==
"0"
||
Regex
.
IsMatch
(
value
,
"^0.[0]+$"
))
row
[
key
]
=
""
;
}
}
}
}
}
/// <summary>
/// 按指定方式加载人员数据
/// </summary>
/// <param name="allot"></param>
...
...
@@ -884,8 +909,8 @@ private void deptRewardCalculate(List<Dictionary<string, object>> rows)
{
foreach
(
var
row
in
rows
)
{
decimal
total_deptReward
=
row
.
Where
(
w
=>
w
.
Key
.
StartsWithIgnoreCase
(
"SingleAwards_"
)).
Sum
(
r
=>
GetDecimal
2
(
row
,
r
.
Key
));
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
DeptReward
),
total_deptReward
);
decimal
total_deptReward
=
row
.
Where
(
w
=>
w
.
Key
.
StartsWithIgnoreCase
(
"SingleAwards_"
)).
Sum
(
r
=>
GetDecimal
(
row
,
r
.
Key
));
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
DeptReward
),
GetDecimal2
(
total_deptReward
)
);
}
}
/// <summary>
...
...
@@ -960,10 +985,10 @@ private void basisPerformanceCalculate(Dictionary<string, object> head, List<Dic
var
post
=
row
.
GetString
(
nameof
(
ag_bodysource
.
Post
));
if
(
specialPostName
.
Contains
(
post
))
{
var
daysFullAttendance
=
GetDecimal
2
(
head
,
nameof
(
ag_headsource
.
DaysFullAttendance
));
var
daysFullAttendance
=
GetDecimal
(
head
,
nameof
(
ag_headsource
.
DaysFullAttendance
));
var
departmentsPerCapita
=
GetDecimal2
(
head
,
nameof
(
ag_headsource
.
DepartmentsPerCapita
));
var
staffCoefficient
=
GetDecimal
2
(
row
,
nameof
(
ag_bodysource
.
StaffCoefficient
));
var
actualAttendance
=
GetDecimal
2
(
row
,
nameof
(
ag_bodysource
.
ActualAttendance
));
var
staffCoefficient
=
GetDecimal
(
row
,
nameof
(
ag_bodysource
.
StaffCoefficient
));
var
actualAttendance
=
GetDecimal
(
row
,
nameof
(
ag_bodysource
.
ActualAttendance
));
var
basisPerformance
=
daysFullAttendance
==
0
?
0
:
departmentsPerCapita
*
staffCoefficient
*
actualAttendance
/
daysFullAttendance
;
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
BasisPerformance
),
basisPerformance
);
...
...
@@ -988,10 +1013,10 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
{
var
post
=
row
.
GetString
(
nameof
(
ag_bodysource
.
Post
));
if
(!
specialPostName
.
Contains
(
post
))
total_titleCoefficient
+=
GetDecimal
2
(
row
,
nameof
(
ag_bodysource
.
ActualAttendance
))
*
GetDecimal2
(
row
,
nameof
(
ag_bodysource
.
TitleCoefficient
));
total_titleCoefficient
+=
GetDecimal
(
row
,
nameof
(
ag_bodysource
.
ActualAttendance
))
*
GetDecimal
(
row
,
nameof
(
ag_bodysource
.
TitleCoefficient
));
}
var
seniorityTitlesPerformance
=
GetDecimal
2
(
head
,
nameof
(
ag_headsource
.
SeniorityTitlesPerformance
));
var
seniorityTitlesPerformance
=
GetDecimal
(
head
,
nameof
(
ag_headsource
.
SeniorityTitlesPerformance
));
foreach
(
var
row
in
rows
)
{
var
post
=
row
.
GetString
(
nameof
(
ag_bodysource
.
Post
));
...
...
@@ -999,8 +1024,8 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
if
(
specialPostName
.
Contains
(
post
))
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
TitleCoefficient
),
0
m
);
// 职称得分 = 当前行实际出勤 * 当前行职称系数
var
titlePerformanceScore
=
GetDecimal
2
(
row
,
nameof
(
ag_bodysource
.
ActualAttendance
))
*
GetDecimal2
(
row
,
nameof
(
ag_bodysource
.
TitleCoefficient
));
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
TitlePerformanceScore
),
GetDecimal2
(
titlePerformanceScore
)
);
var
titlePerformanceScore
=
GetDecimal
(
row
,
nameof
(
ag_bodysource
.
ActualAttendance
))
*
GetDecimal
(
row
,
nameof
(
ag_bodysource
.
TitleCoefficient
));
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
TitlePerformanceScore
),
titlePerformanceScore
);
//个人职称绩效 = ( 当前行实际出勤 * 当前行职称系数 ) / 职称系数总和* 年资职称绩效总和
var
titlePerformance
=
total_titleCoefficient
==
0
?
0
:
titlePerformanceScore
/
total_titleCoefficient
*
seniorityTitlesPerformance
;
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
TitlePerformance
),
GetDecimal2
(
titlePerformance
));
...
...
@@ -1036,14 +1061,14 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
break
;
}
// 工作量得分
row
.
AddOrUpdate
(
gp
.
WorkloadScore
,
GetDecimal2
(
workload_score
)
);
row
.
AddOrUpdate
(
gp
.
WorkloadScore
,
workload_score
);
}
}
// 工作量每分价格计算
foreach
(
var
gp
in
workloadGroups
)
{
// 汇总行内工作量总得分
var
total_score
=
rows
.
Sum
(
row
=>
GetDecimal
2
(
row
,
gp
.
WorkloadScore
)
*
GetDecimal2
(
row
,
gp
.
AssessmentScore
));
var
total_score
=
rows
.
Sum
(
row
=>
GetDecimal
(
row
,
gp
.
WorkloadScore
)
*
GetDecimal
(
row
,
gp
.
AssessmentScore
));
// 计算每分价格
gp
.
Unit_Price
=
total_score
==
0
?
0
:
head
.
GetDecimal
(
$"Workload_Amount_
{
gp
.
Name
}
"
)
/
total_score
;
}
...
...
@@ -1061,12 +1086,12 @@ private void titleCoefficientCalculate(Dictionary<string, object> head, List<Dic
row
.
AddOrUpdate
(
gp
.
AssessmentScore
,
0
m
);
}
// 工作量绩效 = 工作量得分 * 每分价格 * 考核得分
var
workload_fee
=
GetDecimal2
(
row
.
GetDecimal
(
gp
.
WorkloadScore
)
*
gp
.
Unit_Price
*
row
.
GetDecimal
(
gp
.
AssessmentScore
)
);
row
.
AddOrUpdate
(
gp
.
WorkPerformance
,
workload_fee
);
var
workload_fee
=
row
.
GetDecimal
(
gp
.
WorkloadScore
)
*
gp
.
Unit_Price
*
row
.
GetDecimal
(
gp
.
AssessmentScore
);
row
.
AddOrUpdate
(
gp
.
WorkPerformance
,
GetDecimal2
(
workload_fee
)
);
workPerformance
+=
workload_fee
;
}
// 行内工作量汇总到一起
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
WorkPerformance
),
workPerformance
);
row
.
AddOrUpdate
(
nameof
(
ag_bodysource
.
WorkPerformance
),
GetDecimal2
(
workPerformance
)
);
}
}
...
...
@@ -1095,7 +1120,7 @@ decimal ComputeMode_3(Dictionary<string, object> row, List<TitleValue<string, de
// 科主任/护士长 不参与工作量考核
if
(
specialPostName
.
Contains
(
post
))
row
.
AddOrUpdate
(
item
.
ToLower
(),
0
);
return
GetDecimal2
(
row
.
GetDecimal
(
item
.
ToLower
())
*
getFactorValue
(
loads
,
item
)
);
return
row
.
GetDecimal
(
item
.
ToLower
())
*
getFactorValue
(
loads
,
item
);
});
return
workload_score
;
}
...
...
@@ -1122,7 +1147,7 @@ decimal ComputeMode_2(Dictionary<string, object> row, SecondWorkLoadDto gp, stri
row
.
AddOrUpdate
(
gp
.
Items
[
i
+
1
],
0
m
);
}
var
amount
=
row
.
GetDecimal
(
gp
.
Items
[
i
])
*
row
.
GetDecimal
(
gp
.
Items
[
i
+
1
]);
workload_score
+=
GetDecimal2
(
amount
)
;
workload_score
+=
amount
;
}
}
return
workload_score
;
...
...
@@ -1205,6 +1230,13 @@ private void realAmountCalculate(List<Dictionary<string, object>> rows)
/// <param name="key"></param>
/// <returns></returns>
private
decimal
GetDecimal2
(
Dictionary
<
string
,
object
>
pairs
,
string
key
)
=>
GetDecimal2
(
pairs
.
GetDecimal
(
key
));
/// <summary>
/// 从键值对中获取decimal,默认:0,返回原始值
/// </summary>
/// <param name="pairs"></param>
/// <param name="key"></param>
/// <returns></returns>
private
decimal
GetDecimal
(
Dictionary
<
string
,
object
>
pairs
,
string
key
)
=>
pairs
.
GetDecimal
(
key
);
/// <summary>
/// decimal?类型转换decimal 默认:0,保留2位小数
...
...
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