Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
chnmuseum-party
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liqin
chnmuseum-party
Commits
30c210e7
Commit
30c210e7
authored
Apr 17, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
80e567b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
AssetController.java
...nergy/chnmuseum/party/web/controller/AssetController.java
+5
-8
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/AssetController.java
View file @
30c210e7
...
...
@@ -7,12 +7,12 @@ import cn.wisenergy.chnmuseum.party.common.log.MethodLog;
import
cn.wisenergy.chnmuseum.party.common.log.OperModule
;
import
cn.wisenergy.chnmuseum.party.common.log.OperType
;
import
cn.wisenergy.chnmuseum.party.common.util.RSAUtils
;
import
cn.wisenergy.chnmuseum.party.common.util.TimeUtils
;
import
cn.wisenergy.chnmuseum.party.common.video.VideoEncryptUtil
;
import
cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam
;
import
cn.wisenergy.chnmuseum.party.model.Asset
;
import
cn.wisenergy.chnmuseum.party.model.TBoxOperation
;
import
cn.wisenergy.chnmuseum.party.service.AssetService
;
import
cn.wisenergy.chnmuseum.party.service.TBoxOperationService
;
import
cn.wisenergy.chnmuseum.party.web.controller.base.BaseController
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -36,6 +36,7 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDateTime
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -54,14 +55,9 @@ import java.util.Map;
@Api
(
tags
=
{
"视频文件汇出接口"
})
public
class
AssetController
extends
BaseController
{
private
static
final
String
BASE_STRING
=
"1234567890abcdef"
;
@Resource
private
AssetService
assetService
;
@Resource
private
TBoxOperationService
tBoxOperationService
;
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"_index"
,
value
=
"分页起始偏移量"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"_size"
,
value
=
"返回条数"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
...
...
@@ -131,7 +127,8 @@ public class AssetController extends BaseController {
@MethodLog
(
operModule
=
OperModule
.
VIDEOREMIT
,
operType
=
OperType
.
VIDEO_EXPORT
)
public
void
downloadByGet
(
@RequestParam
(
"idList"
)
List
<
String
>
idList
,
HttpServletResponse
response
)
throws
IOException
{
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
response
.
addHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename="
+
URLEncoder
.
encode
(
"video.zip"
,
"UTF-8"
));
final
String
fileName
=
TimeUtils
.
format
(
LocalDateTime
.
now
(),
TimeUtils
.
FORMAT_ONE
)
+
"视频集.zip"
;
response
.
addHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
final
Map
<
String
,
InputStream
>
map
=
new
LinkedHashMap
<>(
idList
.
size
());
final
List
<
Asset
>
assetList
=
assetService
.
listByIds
(
idList
);
...
...
@@ -156,7 +153,7 @@ public class AssetController extends BaseController {
final
List
<
TBoxOperation
>
tBoxOperationList
=
assetService
.
listBoxByOrgan
();
final
Map
<
String
,
InputStream
>
map
=
new
LinkedHashMap
<>(
tBoxOperationList
.
size
());
for
(
TBoxOperation
tBoxOperation
:
tBoxOperationList
)
{
map
.
put
(
tBoxOperation
.
getOrganName
()
+
".cipher"
,
IoUtil
.
toStream
(
RSAUtils
.
encrypt
(
VideoEncryptUtil
.
cipher
,
tBoxOperation
.
getPublicKey
()),
StandardCharsets
.
UTF_8
));
map
.
put
(
tBoxOperation
.
getOrganName
()
+
"
_"
+
tBoxOperation
.
getMac
()
+
"
.cipher"
,
IoUtil
.
toStream
(
RSAUtils
.
encrypt
(
VideoEncryptUtil
.
cipher
,
tBoxOperation
.
getPublicKey
()),
StandardCharsets
.
UTF_8
));
}
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
String
[]
paths
=
map
.
keySet
().
toArray
(
new
String
[
0
]);
...
...
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