Commit 141fe74b authored by liqin's avatar liqin :speech_balloon:

bug fixed

parent 08acd05b
......@@ -104,7 +104,7 @@ public class AssetController extends BaseController {
return getResult(asset);
}
@ApiOperation(value = "视频文件汇出", notes = "视频文件汇出")
@ApiOperation(value = "视频文件汇出POST", notes = "视频文件汇出POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "idList", value = "视频文件标识ID集合", dataType = "String", paramType = "query")
})
......@@ -136,5 +136,37 @@ public class AssetController extends BaseController {
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);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment