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
72c8f8e3
Commit
72c8f8e3
authored
Jun 23, 2021
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增颜色返回
parent
f521dec1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
11 deletions
+62
-11
performance/Performance.Api/Controllers/SecondAllotController.cs
+1
-1
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+1
-1
performance/Performance.DtoModels/Second/SecondColumnDictionary.cs
+3
-1
performance/Performance.DtoModels/Second/SecondLoadDto.cs
+1
-1
performance/Performance.Infrastructure/Extensions/Extensions.Color.cs
+15
-0
performance/Performance.Infrastructure/Helper/RandomHelper.cs
+23
-0
performance/Performance.Services/RedistributionService.cs
+18
-7
No files found.
performance/Performance.Api/Controllers/SecondAllotController.cs
View file @
72c8f8e3
...
...
@@ -670,7 +670,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request)
// 重算部分数据
_redistributionService
.
RedistributionCompute
((
ComputeMode
)
request
.
ComputeMode
,
request
.
Head
,
cleanDatas
);
var
dic
=
_redistributionService
.
GetTableHeaderDictionary
((
ComputeMode
)
request
.
ComputeMode
,
second
,
loads
);
var
dic
=
_redistributionService
.
GetTableHeaderDictionary
((
ComputeMode
)
request
.
ComputeMode
,
second
,
loads
,
workloadGroups
);
return
new
ApiResponse
(
ResponseType
.
OK
,
new
{
Head
=
request
.
Head
,
Body
=
cleanDatas
,
Dic
=
dic
});
}
catch
(
Exception
ex
)
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
72c8f8e3
...
...
@@ -3788,7 +3788,7 @@
</member>
<member
name=
"P:Performance.DtoModels.SecondLoadDto.OverrideMode"
>
<summary>
数据加载方式:0 保存,1 上次,2 字典
,3 测算表
数据加载方式:0 保存,1 上次,2 字典
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SelectionOptions.SelectionID"
>
...
...
performance/Performance.DtoModels/Second/SecondColumnDictionary.cs
View file @
72c8f8e3
...
...
@@ -9,12 +9,13 @@ public class SecondColumnDictionary
public
int
Sort
{
get
;
set
;
}
public
string
Site
{
get
;
set
;
}
public
string
Type
{
get
;
set
;
}
public
string
Color
{
get
;
set
;
}
public
SecondColumnDictionary
()
{
}
public
SecondColumnDictionary
(
string
label
,
string
key
,
bool
isTrue
,
int
sort
,
string
site
=
"Table"
,
string
fix
=
""
,
string
type
=
""
)
public
SecondColumnDictionary
(
string
label
,
string
key
,
bool
isTrue
,
int
sort
,
string
site
=
"Table"
,
string
fix
=
""
,
string
type
=
""
,
string
color
=
""
)
{
Label
=
label
;
Key
=
key
;
...
...
@@ -23,6 +24,7 @@ public SecondColumnDictionary(string label, string key, bool isTrue, int sort, s
Site
=
site
;
Fixed
=
fix
;
Type
=
type
;
Color
=
color
;
}
}
}
performance/Performance.DtoModels/Second/SecondLoadDto.cs
View file @
72c8f8e3
...
...
@@ -8,7 +8,7 @@ public class SecondLoadDto
/// </summary>
public
int
ComputeMode
{
get
;
set
;
}
/// <summary>
/// 数据加载方式:0 保存,1 上次,2 字典
,3 测算表
/// 数据加载方式:0 保存,1 上次,2 字典
/// </summary>
public
int
OverrideMode
{
get
;
set
;
}
}
...
...
performance/Performance.Infrastructure/Extensions/Extensions.Color.cs
0 → 100644
View file @
72c8f8e3
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Text
;
namespace
Performance.Infrastructure
{
public
static
partial
class
UtilExtensions
{
public
static
string
ToRGB
(
this
Color
color
)
{
return
$"
{
color
.
R
}
,
{
color
.
G
}
,
{
color
.
B
}
"
;
}
}
}
performance/Performance.Infrastructure/Helper/RandomHelper.cs
View file @
72c8f8e3
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Text
;
using
System.Text.RegularExpressions
;
namespace
Performance.Infrastructure
{
...
...
@@ -17,5 +19,26 @@ public static string GetSmsCode()
return
code
.
ToString
().
PadLeft
(
4
,
'0'
);
}
public
static
List
<
Color
>
Color
(
Color
sColor
,
Color
eColor
,
int
number
)
{
int
sr
=
sColor
.
R
;
int
sg
=
sColor
.
G
;
int
sb
=
sColor
.
B
;
int
er
=
eColor
.
R
;
int
eg
=
eColor
.
G
;
int
eb
=
eColor
.
B
;
var
colorList
=
new
List
<
Color
>();
for
(
int
i
=
0
;
i
<
number
;
i
++)
{
var
rAverage
=
sr
+
(
int
)((
er
-
sr
)
*
i
/
number
);
var
gAverage
=
sg
+
(
int
)((
eg
-
sg
)
*
i
/
number
);
var
bAverage
=
sb
+
(
int
)((
eb
-
sb
)
*
i
/
number
);
colorList
.
Add
(
System
.
Drawing
.
Color
.
FromArgb
(
rAverage
,
gAverage
,
bAverage
));
}
return
colorList
;
}
}
}
performance/Performance.Services/RedistributionService.cs
View file @
72c8f8e3
...
...
@@ -12,6 +12,7 @@
using
Performance.DtoModels.Second
;
using
Microsoft.Extensions.Logging
;
using
System.Diagnostics
;
using
System.Drawing
;
namespace
Performance.Services
{
...
...
@@ -135,7 +136,7 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, EmployeeSourc
/// <param name="second"></param>
/// <param name="loads"></param>
/// <returns></returns>
public
List
<
SecondColumnDictionary
>
GetTableHeaderDictionary
(
ComputeMode
computeMode
,
ag_secondallot
second
,
List
<
TitleValue
<
string
,
decimal
?>>
loads
)
public
List
<
SecondColumnDictionary
>
GetTableHeaderDictionary
(
ComputeMode
computeMode
,
ag_secondallot
second
,
List
<
TitleValue
<
string
,
decimal
?>>
loads
,
List
<
SecondWorkLoadDto
>
workloadGroups
=
null
)
{
var
maps
=
new
List
<
SecondColumnDictionary
>()
{
...
...
@@ -144,10 +145,10 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
new
SecondColumnDictionary
(
"科室"
,
nameof
(
ag_bodysource
.
Department
),
true
,
100
,
fix
:
"Left"
),
new
SecondColumnDictionary
(
"主管"
,
nameof
(
ag_bodysource
.
Post
),
true
,
100
),
new
SecondColumnDictionary
(
"人员系数"
,
nameof
(
ag_bodysource
.
StaffCoefficient
),
false
,
200
),
new
SecondColumnDictionary
(
"出勤"
,
nameof
(
ag_bodysource
.
ActualAttendance
),
false
,
201
),
new
SecondColumnDictionary
(
"职称"
,
nameof
(
ag_bodysource
.
JobTitle
),
false
,
202
),
new
SecondColumnDictionary
(
"职称系数"
,
nameof
(
ag_bodysource
.
TitleCoefficient
),
false
,
203
),
new
SecondColumnDictionary
(
"人员系数"
,
nameof
(
ag_bodysource
.
StaffCoefficient
),
false
,
200
,
color
:
Color
.
DarkTurquoise
.
ToRGB
()
),
new
SecondColumnDictionary
(
"出勤"
,
nameof
(
ag_bodysource
.
ActualAttendance
),
false
,
201
,
color
:
Color
.
DarkTurquoise
.
ToRGB
()
),
new
SecondColumnDictionary
(
"职称"
,
nameof
(
ag_bodysource
.
JobTitle
),
false
,
202
,
color
:
Color
.
DarkTurquoise
.
ToRGB
()
),
new
SecondColumnDictionary
(
"职称系数"
,
nameof
(
ag_bodysource
.
TitleCoefficient
),
false
,
203
,
color
:
Color
.
DarkTurquoise
.
ToRGB
()
),
new
SecondColumnDictionary
(
"职称绩效"
,
nameof
(
ag_bodysource
.
TitlePerformance
),
true
,
299
),
new
SecondColumnDictionary
(
"工作量绩效合计"
,
nameof
(
ag_bodysource
.
WorkPerformance
),
true
,
399
),
...
...
@@ -166,11 +167,21 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
// 工作量
if
(
computeMode
!=
ComputeMode
.
NotCalculate
)
{
if
(
workloadGroups
==
null
)
workloadGroups
=
GetTopWorkloadBodyGroups
(
loads
);
var
colors
=
RandomHelper
.
Color
(
Color
.
LightGreen
,
Color
.
LawnGreen
,
workloadGroups
.
Count
);
var
index
=
0
;
int
workloadSort
=
300
;
foreach
(
var
item
in
loads
.
Where
(
w
=>
!
w
.
Title
.
StartsWithIgnoreCase
(
"SingleAwards_"
)))
{
maps
.
Add
(
new
SecondColumnDictionary
(
item
.
Value
,
item
.
Title
,
false
,
++
workloadSort
,
type
:
"Workload"
));
if
(
workloadGroups
.
Any
(
w
=>
w
.
Items
?.
FirstOrDefault
()
==
item
.
Title
))
index
=
workloadGroups
.
FindIndex
(
w
=>
w
.
Items
?.
FirstOrDefault
()
==
item
.
Title
);
var
color
=
index
<
colors
.
Count
?
colors
[
index
].
ToRGB
()
:
""
;
maps
.
Add
(
new
SecondColumnDictionary
(
item
.
Value
,
item
.
Title
,
false
,
++
workloadSort
,
type
:
"Workload"
,
color
:
color
));
}
// 多工作量加载
var
headDynamic
=
_agworktypesourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
second
.
Id
);
if
(
headDynamic
!=
null
&&
headDynamic
.
Any
())
...
...
@@ -185,7 +196,7 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
int
singleAwardsSort
=
400
;
foreach
(
var
item
in
loads
.
Where
(
w
=>
w
.
Title
.
StartsWithIgnoreCase
(
"SingleAwards_"
)))
{
maps
.
Add
(
new
SecondColumnDictionary
(
item
.
Value
,
item
.
Title
,
false
,
++
singleAwardsSort
,
type
:
"SingleAwards"
));
maps
.
Add
(
new
SecondColumnDictionary
(
item
.
Value
,
item
.
Title
,
false
,
++
singleAwardsSort
,
type
:
"SingleAwards"
,
color
:
Color
.
Cyan
.
ToRGB
()
));
}
return
maps
.
OrderBy
(
w
=>
w
.
Sort
).
ToList
();
}
...
...
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