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
ecbab2d8
Commit
ecbab2d8
authored
May 20, 2021
by
钟博
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://gitlab.suvalue.com/zry/performance
into develop
parents
7f61d645
b56a0203
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
performance/Performance.Api/Controllers/AllotController.cs
+28
-0
No files found.
performance/Performance.Api/Controllers/AllotController.cs
View file @
ecbab2d8
using
FluentValidation.AspNetCore
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http.Internal
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.StaticFiles
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Performance.DtoModels
;
...
...
@@ -16,6 +18,7 @@
using
System.IO
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Web
;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
...
...
@@ -500,5 +503,30 @@ public ApiResponse Reserved([FromBody] ReservedRequest request)
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
/// <summary>
/// 下载当前测算表
/// </summary>
/// <returns></returns>
[
Route
(
"download"
)]
[
HttpPost
]
[
AllowAnonymous
]
public
IActionResult
DownloadCurrentCalculationTable
([
FromBody
]
AllotRequest
request
)
{
var
allot
=
_allotService
.
GetAllot
(
request
.
ID
);
if
(
null
==
allot
)
throw
new
PerformanceException
(
"当前测算表不存在"
);
var
memoryStream
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
allot
.
Path
,
FileMode
.
Open
))
{
stream
.
CopyToAsync
(
memoryStream
).
Wait
();
}
memoryStream
.
Seek
(
0
,
SeekOrigin
.
Begin
);
var
provider
=
new
FileExtensionContentTypeProvider
();
FileInfo
fileInfo
=
new
FileInfo
(
allot
.
Path
);
var
memi
=
provider
.
Mappings
[
".xlsx"
];
return
File
(
memoryStream
,
memi
,
Path
.
GetFileName
(
fileInfo
.
Name
));
}
}
}
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