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
673ca699
Commit
673ca699
authored
Jun 17, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
划拨数据写入
parent
0cb685da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
performance/Performance.Services/ExtractExcelService/SheetDataWrite/CostTransferDataWrite.cs
+69
-0
No files found.
performance/Performance.Services/ExtractExcelService/SheetDataWrite/CostTransferDataWrite.cs
0 → 100644
View file @
673ca699
using
Microsoft.Extensions.Logging
;
using
NPOI.SS.UserModel
;
using
Performance.DtoModels
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
namespace
Performance.Services.ExtractExcelService.SheetDataWrite
{
public
class
CostTransferDataWrite
{
private
readonly
ILogger
logger
;
private
readonly
PerforCosttransferRepository
costtransferRepository
;
private
readonly
PerforCosttransferitemRepository
costtransferitemRepository
;
public
CostTransferDataWrite
(
ILogger
<
CostTransferDataWrite
>
logger
,
PerforCosttransferRepository
costtransferRepository
,
PerforCosttransferitemRepository
costtransferitemRepository
)
{
this
.
logger
=
logger
;
this
.
costtransferRepository
=
costtransferRepository
;
this
.
costtransferitemRepository
=
costtransferitemRepository
;
}
public
void
WriteSheetData
(
ISheet
sheet
,
PerSheetPoint
point
,
SheetType
sheetType
,
ExcelStyle
style
,
int
allotId
)
{
try
{
var
costTransfers
=
costtransferRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
);
if
(
costTransfers
==
null
||
!
costTransfers
.
Any
())
return
;
var
costTransferItems
=
costtransferitemRepository
.
GetEntities
(
t
=>
costTransfers
.
Select
(
c
=>
c
.
Id
).
Contains
(
t
.
TransferId
));
if
(
costTransferItems
==
null
||
!
costTransferItems
.
Any
())
return
;
var
header
=
sheet
.
GetRow
(
point
.
HeaderFirstRowNum
.
Value
);
if
(
header
==
null
)
return
;
List
<
string
>
fixedColumns
=
new
List
<
string
>
{
"划拨(出)收入"
,
"划拨(入)收入"
,
"划拨收入(医技)"
,
"划拨收入(医生)"
,
"划拨收入(护理)"
};
for
(
int
i
=
point
.
HeaderFirstCellNum
.
Value
;
i
<
header
.
LastCellNum
;
i
++)
{
var
column
=
header
.
GetCell
(
i
)?.
GetDecodeEscapes
().
Replace
(
"("
,
"("
).
Replace
(
")"
,
")"
);
if
(!
string
.
IsNullOrEmpty
(
column
)
&&
fixedColumns
.
Any
(
t
=>
t
==
column
))
{
fixedColumns
.
Remove
(
column
);
}
}
if
(
fixedColumns
!=
null
&&
fixedColumns
.
Any
())
{
var
index
=
point
.
HeaderFirstCellNum
.
Value
+
1
;
foreach
(
var
column
in
fixedColumns
)
{
var
cell
=
header
.
CreateCell
(
index
);
cell
.
SetCellValue
(
column
);
}
}
var
columns
=
header
.
GetCellValues
();
}
catch
(
Exception
ex
)
{
logger
.
LogError
(
"写入划拨数据异常:"
+
ex
);
}
}
}
}
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