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
3a055eff
Commit
3a055eff
authored
Jun 05, 2023
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
科室详情下载
parent
91f4531a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
13 deletions
+34
-13
performance/Performance.Api/Controllers/ComputeController.cs
+0
-3
performance/Performance.Services/ComputeService.UniteDeptDetail.cs
+34
-10
No files found.
performance/Performance.Api/Controllers/ComputeController.cs
View file @
3a055eff
...
@@ -222,9 +222,6 @@ public IActionResult DownloadUniteDeptdetail([FromBody] UniteDeptDetailRequest r
...
@@ -222,9 +222,6 @@ public IActionResult DownloadUniteDeptdetail([FromBody] UniteDeptDetailRequest r
return
BadRequest
(
"核算组别错误"
);
return
BadRequest
(
"核算组别错误"
);
var
userid
=
_claim
.
GetUserId
();
var
userid
=
_claim
.
GetUserId
();
var
uniteDeptDetail
=
_computeService
.
UniteDeptDetail
(
request
.
AllotId
,
unitType
,
request
.
AccountingUnit
,
userid
);
var
uniteDeptDetail
=
_computeService
.
UniteDeptDetail
(
request
.
AllotId
,
unitType
,
request
.
AccountingUnit
,
userid
);
//var ser = JsonConvert.SerializeObject(response);
//var rows = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(ser);
//Dictionary<string, object> rows = _computeService.ConvertToDictionary(response);
var
filepath
=
_computeService
.
ExcelDownload
(
uniteDeptDetail
,
"科室绩效详情"
,
request
.
AllotId
);
var
filepath
=
_computeService
.
ExcelDownload
(
uniteDeptDetail
,
"科室绩效详情"
,
request
.
AllotId
);
...
...
performance/Performance.Services/ComputeService.UniteDeptDetail.cs
View file @
3a055eff
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
using
Performance.Infrastructure
;
using
Performance.Infrastructure
;
using
Performance.Repository
;
using
Performance.Repository
;
using
static
Performance
.
Services
.
ExtractExcelService
.
WriteDataHelper
;
using
static
Performance
.
Services
.
ExtractExcelService
.
WriteDataHelper
;
using
System.Drawing
;
namespace
Performance.Services
namespace
Performance.Services
{
{
...
@@ -627,10 +628,13 @@ public string ExcelDownload(UniteDeptDetailResponse uniteDeptDetail, string name
...
@@ -627,10 +628,13 @@ public string ExcelDownload(UniteDeptDetailResponse uniteDeptDetail, string name
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
worksheet
.
Cells
[
1
,
1
].
Style
.
Fill
.
PatternType
=
ExcelFillStyle
.
Solid
;
var
rowIndex
=
2
;
worksheet
.
Cells
[
1
,
1
].
Style
.
Fill
.
BackgroundColor
.
SetColor
(
Color
.
GhostWhite
);
var
rowIndex
=
1
;
WriteSheetCells
(
worksheet
,
maxColIndex
,
rowIndex
,
uniteDeptDetail
.
DetailItems
);
WriteSheetCells
(
worksheet
,
maxColIndex
,
rowIndex
,
uniteDeptDetail
.
DetailItems
);
worksheet
.
Cells
.
AutoFitColumns
();
int
lastColumnIndex
=
worksheet
.
Dimension
.
End
.
Column
;
worksheet
.
Column
(
lastColumnIndex
).
Width
=
20
;
package
.
Save
();
package
.
Save
();
}
}
return
filepath
;
return
filepath
;
...
@@ -638,18 +642,20 @@ public string ExcelDownload(UniteDeptDetailResponse uniteDeptDetail, string name
...
@@ -638,18 +642,20 @@ public string ExcelDownload(UniteDeptDetailResponse uniteDeptDetail, string name
int
WriteSheetCells
(
ExcelWorksheet
worksheet
,
int
maxColIndex
,
int
rowIndex
,
List
<
DeptDetailItem
>
detailItems
)
int
WriteSheetCells
(
ExcelWorksheet
worksheet
,
int
maxColIndex
,
int
rowIndex
,
List
<
DeptDetailItem
>
detailItems
)
{
{
foreach
(
var
item
in
detailItems
)
foreach
(
var
item
in
detailItems
.
Where
(
w
=>
w
.
Display
)
)
{
{
worksheet
.
SetValue
(
rowIndex
,
1
,
$"
{
item
.
Title
}
:
{
item
.
TotalFormat
}
"
);
++
rowIndex
;
worksheet
.
SetValue
(
rowIndex
,
1
,
$"
{
item
.
Title
}
:
{
item
.
TotalFormat
}
"
);
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Merge
=
true
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Merge
=
true
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Font
.
Bold
=
true
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Font
.
Bold
=
true
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Font
.
Size
=
18
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Font
.
Size
=
18
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Left
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Fill
.
PatternType
=
ExcelFillStyle
.
Solid
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Fill
.
BackgroundColor
.
SetColor
(
Color
.
GhostWhite
);
if
(
item
.
Children
?.
Any
()
==
true
)
if
(
item
.
Children
?.
Any
()
==
true
)
{
{
rowIndex
=
rowIndex
+
1
;
rowIndex
=
WriteSheetCells
(
worksheet
,
maxColIndex
,
rowIndex
,
item
.
Children
);
rowIndex
=
WriteSheetCells
(
worksheet
,
maxColIndex
,
rowIndex
,
item
.
Children
);
}
}
else
if
(
item
.
Items
?.
Any
()
==
true
)
else
if
(
item
.
Items
?.
Any
()
==
true
)
...
@@ -665,6 +671,8 @@ int WriteSheetCells(ExcelWorksheet worksheet, int maxColIndex, int rowIndex, Lis
...
@@ -665,6 +671,8 @@ int WriteSheetCells(ExcelWorksheet worksheet, int maxColIndex, int rowIndex, Lis
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Fill
.
PatternType
=
ExcelFillStyle
.
Solid
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Fill
.
BackgroundColor
.
SetColor
(
Color
.
GhostWhite
);
if
(
colIndex
+
1
==
headers
.
Count
())
if
(
colIndex
+
1
==
headers
.
Count
())
{
{
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Merge
=
true
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Merge
=
true
;
...
@@ -674,6 +682,8 @@ int WriteSheetCells(ExcelWorksheet worksheet, int maxColIndex, int rowIndex, Lis
...
@@ -674,6 +682,8 @@ int WriteSheetCells(ExcelWorksheet worksheet, int maxColIndex, int rowIndex, Lis
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Fill
.
PatternType
=
ExcelFillStyle
.
Solid
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Fill
.
BackgroundColor
.
SetColor
(
Color
.
GhostWhite
);
}
}
}
}
foreach
(
var
row
in
item
.
Items
)
foreach
(
var
row
in
item
.
Items
)
...
@@ -681,17 +691,31 @@ int WriteSheetCells(ExcelWorksheet worksheet, int maxColIndex, int rowIndex, Lis
...
@@ -681,17 +691,31 @@ int WriteSheetCells(ExcelWorksheet worksheet, int maxColIndex, int rowIndex, Lis
rowIndex
=
rowIndex
+
1
;
rowIndex
=
rowIndex
+
1
;
for
(
int
colIndex
=
0
;
colIndex
<
headers
.
Count
();
colIndex
++)
for
(
int
colIndex
=
0
;
colIndex
<
headers
.
Count
();
colIndex
++)
{
{
worksheet
.
SetValue
(
rowIndex
,
colIndex
+
1
,
row
[
headers
.
ElementAt
(
colIndex
)]);
object
cellValue
=
row
[
headers
.
ElementAt
(
colIndex
)];
// 获取单元格的值
double
numericValue
;
// 用于存储转换后的数值
if
(
cellValue
!=
null
&&
double
.
TryParse
(
cellValue
.
ToString
(),
out
numericValue
))
{
if
(
numericValue
<
0
)
{
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
Fill
.
PatternType
=
ExcelFillStyle
.
Solid
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
Fill
.
BackgroundColor
.
SetColor
(
Color
.
Red
);
}
worksheet
.
SetValue
(
rowIndex
,
colIndex
+
1
,
numericValue
);
}
else
{
worksheet
.
SetValue
(
rowIndex
,
colIndex
+
1
,
row
[
headers
.
ElementAt
(
colIndex
)]);
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Fill
.
PatternType
=
ExcelFillStyle
.
Solid
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Fill
.
BackgroundColor
.
SetColor
(
Color
.
GhostWhite
);
}
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
Font
.
Size
=
16
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
Font
.
Size
=
16
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
if
(
colIndex
+
1
==
headers
.
Count
())
if
(
colIndex
+
1
==
headers
.
Count
())
{
{
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Merge
=
true
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Merge
=
true
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
Font
.
Size
=
16
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
Font
.
Size
=
16
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
maxColIndex
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
...
...
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