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
f7c427b1
Commit
f7c427b1
authored
Jun 08, 2022
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合并冲突
parent
97a487e5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
+1
-0
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
+12
-6
No files found.
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
View file @
f7c427b1
...
@@ -77,6 +77,7 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
...
@@ -77,6 +77,7 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
// }
// }
//}
//}
var
sheetNames
=
workbook
.
GetAllNames
().
Select
(
w
=>
w
.
SheetName
);
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
new
int
[]
{
(
int
)
SheetType
.
Income
,
(
int
)
SheetType
.
OtherIncome
}.
Contains
(
t
.
SheetType
.
Value
))?.
OrderBy
(
t
=>
t
.
ModuleName
))
foreach
(
var
module
in
modulesList
.
Where
(
t
=>
new
int
[]
{
(
int
)
SheetType
.
Income
,
(
int
)
SheetType
.
OtherIncome
}.
Contains
(
t
.
SheetType
.
Value
))?.
OrderBy
(
t
=>
t
.
ModuleName
))
{
{
var
no
=
module
.
ModuleName
.
GetNo
();
var
no
=
module
.
ModuleName
.
GetNo
();
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
View file @
f7c427b1
...
@@ -157,15 +157,12 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
...
@@ -157,15 +157,12 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
if
(
row
==
null
)
continue
;
if
(
row
==
null
)
continue
;
string
department
=
row
.
GetOrCreate
(
dataFirstCellNum
-
1
).
GetDecodeEscapes
();
string
department
=
row
.
GetOrCreate
(
dataFirstCellNum
-
1
).
GetDecodeEscapes
();
if
(
string
.
IsNullOrEmpty
(
department
))
continue
;
if
(
rowIndex
>=
dataFirstRowNum
)
dataFirstRowNum
=
rowIndex
+
1
;
var
deptData
=
data
.
Where
(
t
=>
t
.
Department
.
NoBlank
()
==
department
);
if
(
rowIndex
>
dataFirstRowNum
)
dataFirstRowNum
=
rowIndex
+
1
;
if
(
deptData
==
null
||
!
deptData
.
Any
(
t
=>
t
.
Value
.
HasValue
&&
t
.
Value
!=
0
))
continue
;
#
region
写入数据
#
region
写入数据
if
(
sheetType
==
SheetType
.
Income
)
if
(
sheetType
==
SheetType
.
Income
&&
!
string
.
IsNullOrEmpty
(
department
)
)
{
{
if
(!
incomes
.
Any
(
t
=>
t
.
Department
==
department
))
if
(!
incomes
.
Any
(
t
=>
t
.
Department
==
department
))
incomes
.
Add
(
GetIncomeRowMessage
(
row
,
dataFirstCellNum
,
department
,
rowIndex
));
incomes
.
Add
(
GetIncomeRowMessage
(
row
,
dataFirstCellNum
,
department
,
rowIndex
));
...
@@ -178,7 +175,15 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
...
@@ -178,7 +175,15 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var
cell
=
row
.
GetOrCreate
(
cellIndex
);
var
cell
=
row
.
GetOrCreate
(
cellIndex
);
if
(
string
.
IsNullOrEmpty
(
column
))
continue
;
if
(
string
.
IsNullOrEmpty
(
column
))
continue
;
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
;
decimal
?
value
=
0
m
;
if
(!
string
.
IsNullOrEmpty
(
department
))
{
var
deptData
=
data
.
Where
(
t
=>
t
.
Department
.
NoBlank
()
==
department
);
if
(
deptData
!=
null
&&
deptData
.
Any
(
t
=>
t
.
Value
.
HasValue
&&
t
.
Value
!=
0
))
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
;
}
//数据为空,且单元格值不为空,不写入数据(保留原始值)
//数据为空,且单元格值不为空,不写入数据(保留原始值)
// 22.3.29 ry 只要是提取的列头全部覆盖数据
// 22.3.29 ry 只要是提取的列头全部覆盖数据
if
(
headers
!=
null
&&
headers
.
Contains
(
column
)
&&
value
.
HasValue
&&
value
!=
0
)
if
(
headers
!=
null
&&
headers
.
Contains
(
column
)
&&
value
.
HasValue
&&
value
!=
0
)
...
@@ -186,6 +191,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
...
@@ -186,6 +191,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
cell
.
SetCellValue
<
decimal
>(
value
);
cell
.
SetCellValue
<
decimal
>(
value
);
cell
.
CellStyle
=
cellStyle
;
cell
.
CellStyle
=
cellStyle
;
}
}
}
#
endregion
#
endregion
...
...
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