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
12a13c86
Commit
12a13c86
authored
Jun 02, 2023
by
ruyun.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加备注说明
parent
d10419c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
17 deletions
+30
-17
performance/Performance.Services/ComputeService.UniteDeptDetail.cs
+30
-17
No files found.
performance/Performance.Services/ComputeService.UniteDeptDetail.cs
View file @
12a13c86
...
...
@@ -274,19 +274,7 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
{
"工作量倾斜"
,
""
},
{
"金额"
,
ValueFormating
(
postDatas
.
Sum
(
w
=>
w
.
IsFactor
==
1
?
(
w
.
CellValue
*
(
w
.
FactorValue
??
0
))
:
w
.
CellValue
),
""
)
},
});
// 保证Key数量一致
var
keys
=
items
.
SelectMany
(
dict
=>
dict
.
Keys
).
Distinct
();
foreach
(
var
k
in
keys
)
{
var
values
=
items
.
SelectMany
(
dict
=>
dict
.
Where
(
kvp
=>
kvp
.
Key
==
k
).
Select
(
kvp
=>
kvp
.
Value
));
if
(!
values
.
Any
(
w
=>
!
string
.
IsNullOrEmpty
(
w
?.
ToString
())))
{
foreach
(
var
item
in
items
)
{
item
.
Remove
(
k
);
}
}
}
DeleteBlankColumn
(
items
);
var
amount
=
basicData
.
Where
(
t
=>
t
.
SheetID
==
sheet
.
ID
&&
t
.
UnitType
==
(
int
)
type
&&
t
.
IsTotal
!=
1
)?.
Sum
(
t
=>
t
.
IsFactor
==
1
?
t
.
CellValue
*
(
t
.
FactorValue
??
0
)
:
t
.
CellValue
)
??
0
;
detailItemWorkloads
.
Add
(
new
DeptDetailItem
{
Title
=
sheetName
,
Total
=
amount
,
Items
=
items
});
...
...
@@ -348,18 +336,22 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
var
settingItem
=
settings
.
FirstOrDefault
(
w
=>
w
.
Title
==
detail
.
Title
)
??
new
UniteDeptDetailItem
()
{
Children
=
new
List
<
UniteDeptDetailItem
>()
};
var
gs
=
settingItem
.
Children
.
FirstOrDefault
(
w
=>
w
.
Title
==
post
.
Key
.
TypeName
)
??
new
UniteDeptDetailItem
{
Format
=
""
};
if
(
string
.
IsNullOrEmpty
(
gs
.
Display
))
gs
.
Display
=
UniteDept
.
DisplayRule
.
始终显示
.
ToString
();
if
(!
userInfo
.
IsSecondAdmin
||
allot
.
States
==
(
int
)
AllotStates
.
绩效下发
||
allot
.
States
==
(
int
)
AllotStates
.
归档
)
if
(
gs
.
Display
==
UniteDept
.
DisplayRule
.
始终显示
.
ToString
()
||
!
userInfo
.
IsSecondAdmin
||
allot
.
States
==
(
int
)
AllotStates
.
绩效下发
||
allot
.
States
==
(
int
)
AllotStates
.
归档
)
{
var
fz
=
post
.
Sum
(
group
=>
group
.
IsFactor
==
1
?
(
group
.
CellValue
*
(
group
.
FactorValue
??
0
))
:
group
.
CellValue
);
var
row
=
new
Dictionary
<
string
,
object
>
{
{
"指标"
,
post
.
Key
.
TypeName
},
{
"分值"
,
ValueFormating
(
fz
,
gs
.
Format
)
}
{
"分值"
,
ValueFormating
(
fz
,
gs
.
Format
)
},
{
"说明"
,
gs
.
Remark
},
};
items
.
Add
(
row
);
}
}
DeleteBlankColumn
(
items
);
var
amount
=
basicData
?.
Where
(
t
=>
t
.
SheetID
==
sheet
.
ID
&&
t
.
UnitType
==
(
int
)
type
&&
t
.
IsTotal
==
1
)?.
FirstOrDefault
()?.
CellValue
??
0
;
detail
.
Total
=
amount
;
detail
.
Items
=
items
;
...
...
@@ -398,6 +390,27 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
return
response
;
}
/// <summary>
/// 删除空白列
/// </summary>
/// <param name="items"></param>
private
static
void
DeleteBlankColumn
(
List
<
Dictionary
<
string
,
object
>>
items
)
{
// 保证Key数量一致
var
keys
=
items
.
SelectMany
(
dict
=>
dict
.
Keys
).
Distinct
();
foreach
(
var
k
in
keys
)
{
var
values
=
items
.
SelectMany
(
dict
=>
dict
.
Where
(
kvp
=>
kvp
.
Key
==
k
).
Select
(
kvp
=>
kvp
.
Value
));
if
(!
values
.
Any
(
w
=>
!
string
.
IsNullOrEmpty
(
w
?.
ToString
())))
{
foreach
(
var
item
in
items
)
{
item
.
Remove
(
k
);
}
}
}
}
// 详情页面数值格式化
private
string
ValueFormating
(
decimal
?
value
,
string
format
)
{
...
...
@@ -550,7 +563,7 @@ public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId)
var
temp1
=
cofDeptDetail
.
FirstOrDefault
(
w
=>
w
.
Title
==
detail
.
Title
);
if
(
temp1
!=
null
)
{
detail
.
Remark
=
temp1
.
Remark
;
detail
.
Remark
=
temp1
.
Remark
;
detail
.
Format
=
temp1
.
Format
;
detail
.
Sort
=
temp1
.
Sort
;
detail
.
Display
=
temp1
.
Display
;
...
...
@@ -559,7 +572,7 @@ public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId)
var
temp2
=
temp1
.
Children
.
FirstOrDefault
(
w
=>
w
.
Title
==
item
.
Title
);
if
(
temp2
!=
null
)
{
item
.
Remark
=
temp2
.
Remark
;
item
.
Remark
=
temp2
.
Remark
;
item
.
Format
=
temp2
.
Format
;
item
.
Sort
=
temp2
.
Sort
;
item
.
Display
=
temp2
.
Display
;
...
...
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