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
99f87bfd
Commit
99f87bfd
authored
Oct 13, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
控制器返回文件
parent
429480d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
performance/Performance.Api/Controllers/TemplateController.cs
+13
-2
performance/Performance.Services/ExtractIncomeService.cs
+1
-0
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
99f87bfd
...
...
@@ -413,10 +413,20 @@ public ApiResponse Schedule([FromBody] log_dbug request)
[
Route
(
"extract/income/{allotId}"
)]
[
HttpPost
]
public
ApiResponse
ExtractIncome
(
int
allotId
)
public
IActionResult
ExtractIncome
(
int
allotId
)
{
string
filepath
=
extractIncomeService
.
Execture
(
allotId
);
return
new
ApiResponse
(
ResponseType
.
OK
);
var
memoryStream
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
filepath
,
FileMode
.
Open
))
{
stream
.
CopyToAsync
(
memoryStream
).
Wait
();
}
memoryStream
.
Seek
(
0
,
SeekOrigin
.
Begin
);
string
fileExt
=
Path
.
GetExtension
(
filepath
);
var
provider
=
new
FileExtensionContentTypeProvider
();
var
memi
=
provider
.
Mappings
[
fileExt
];
return
File
(
memoryStream
,
memi
,
Path
.
GetFileName
(
filepath
));
}
}
}
\ No newline at end of file
performance/Performance.Services/ExtractIncomeService.cs
View file @
99f87bfd
...
...
@@ -52,6 +52,7 @@ public string Execture(int allotId)
if
(
string
.
IsNullOrEmpty
(
filepath
)
||
!
FileHelper
.
IsExistFile
(
filepath
))
throw
new
PerformanceException
(
"抽取文件错误"
);
logger
.
LogInformation
(
"医生收入文件: "
+
filepath
);
return
filepath
;
}
catch
(
Exception
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