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
141fe74b
Commit
141fe74b
authored
Apr 16, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
08acd05b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
AssetController.java
...nergy/chnmuseum/party/web/controller/AssetController.java
+33
-1
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/AssetController.java
View file @
141fe74b
...
@@ -104,7 +104,7 @@ public class AssetController extends BaseController {
...
@@ -104,7 +104,7 @@ public class AssetController extends BaseController {
return
getResult
(
asset
);
return
getResult
(
asset
);
}
}
@ApiOperation
(
value
=
"视频文件汇出
"
,
notes
=
"视频文件汇出
"
)
@ApiOperation
(
value
=
"视频文件汇出
POST"
,
notes
=
"视频文件汇出POST
"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"idList"
,
value
=
"视频文件标识ID集合"
,
dataType
=
"String"
,
paramType
=
"query"
)
@ApiImplicitParam
(
name
=
"idList"
,
value
=
"视频文件标识ID集合"
,
dataType
=
"String"
,
paramType
=
"query"
)
})
})
...
@@ -136,5 +136,37 @@ public class AssetController extends BaseController {
...
@@ -136,5 +136,37 @@ public class AssetController extends BaseController {
ZipUtil
.
zip
(
outputStream
,
paths
,
ins
);
ZipUtil
.
zip
(
outputStream
,
paths
,
ins
);
}
}
@ApiOperation
(
value
=
"视频文件汇出GET"
,
notes
=
"视频文件汇出GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"idList"
,
value
=
"视频文件标识ID集合"
,
dataType
=
"String"
,
paramType
=
"query"
)
})
@GetMapping
(
"/download"
)
@RequiresAuthentication
@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
(
"file.zip"
,
"UTF-8"
));
final
Map
<
String
,
InputStream
>
map
=
new
LinkedHashMap
<>(
idList
.
size
()
+
1
);
final
List
<
Asset
>
assetList
=
assetService
.
listByIds
(
idList
);
final
String
cipher
=
RandomUtil
.
randomString
(
BASE_STRING
,
16
);
for
(
final
Asset
asset
:
assetList
)
{
final
String
fileUrl
=
asset
.
getFileUrl
();
ByteArrayOutputStream
byteOutputStream
=
new
ByteArrayOutputStream
();
FastDFSUtils
.
downloadFile
(
fileUrl
,
byteOutputStream
);
final
Set
<
MetaData
>
fileMetaData
=
FastDFSUtils
.
getFileMetaData
(
fileUrl
);
//String fileName = fileMetaData.stream().filter(x -> "MD5".equals(x.getName())).map(MetaData::getValue).findFirst().get() + ".chnmuseum";
map
.
put
(
asset
.
getFileName
(),
new
ByteArrayInputStream
(
byteOutputStream
.
toByteArray
()));
}
final
TUser
user
=
getcurUser
();
final
TBoxOperation
tBoxOperation
=
this
.
tBoxOperationService
.
getOne
(
Wrappers
.<
TBoxOperation
>
lambdaQuery
().
eq
(
TBoxOperation:
:
getOrganId
,
user
.
getOrgId
()));
map
.
put
(
"cipher.txt"
,
IoUtil
.
toStream
(
RSAUtils
.
encrypt
(
cipher
,
tBoxOperation
.
getPublicKey
()),
StandardCharsets
.
UTF_8
));
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
String
[]
paths
=
map
.
keySet
().
toArray
(
new
String
[
0
]);
InputStream
[]
ins
=
map
.
values
().
toArray
(
new
InputStream
[
0
]);
ZipUtil
.
zip
(
outputStream
,
paths
,
ins
);
}
}
}
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