Commit 77516475 authored by liqin's avatar liqin 💬

bug fixed

parent 247fbba6
...@@ -36,7 +36,7 @@ public interface AssetMapper extends BaseMapper<Asset> { ...@@ -36,7 +36,7 @@ public interface AssetMapper extends BaseMapper<Asset> {
@Select("<script>" + @Select("<script>" +
"SELECT b.*, o.code as organ_code, o.`name` as organ_name " + "SELECT b.*, o.code as organ_code, o.`name` as organ_name " +
"FROM t_box_operation b, t_organ o " + "FROM t_box_operation b, t_organ o " +
"where b.organ_id = o.id and b.private_key IS NOT NULL" + "where b.organ_id = o.id and b.public_key IS NOT NULL" +
"</script>") "</script>")
List<TBoxOperation> selectBoxListByOrgan(); List<TBoxOperation> selectBoxListByOrgan();
......
package cn.chnmuseum.party.web.controller; package cn.chnmuseum.party.web.controller;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.ZipUtil;
import cn.chnmuseum.party.common.dfs.FastDFSUtils; import cn.chnmuseum.party.common.dfs.FastDFSUtils;
import cn.chnmuseum.party.common.log.MethodLog; import cn.chnmuseum.party.common.log.MethodLog;
import cn.chnmuseum.party.common.log.OperModule; import cn.chnmuseum.party.common.log.OperModule;
...@@ -14,6 +12,8 @@ import cn.chnmuseum.party.model.Asset; ...@@ -14,6 +12,8 @@ import cn.chnmuseum.party.model.Asset;
import cn.chnmuseum.party.model.TBoxOperation; import cn.chnmuseum.party.model.TBoxOperation;
import cn.chnmuseum.party.service.AssetService; import cn.chnmuseum.party.service.AssetService;
import cn.chnmuseum.party.web.controller.base.BaseController; import cn.chnmuseum.party.web.controller.base.BaseController;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.ZipUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -28,7 +28,6 @@ import org.springframework.http.MediaType; ...@@ -28,7 +28,6 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
...@@ -137,9 +136,7 @@ public class AssetController extends BaseController { ...@@ -137,9 +136,7 @@ public class AssetController extends BaseController {
FastDFSUtils.downloadFile(asset.getFileUrlCrypto(), byteOutputStream); FastDFSUtils.downloadFile(asset.getFileUrlCrypto(), byteOutputStream);
map.put(asset.getMd5() + ".chnmuseum", VideoEncryptUtil.encrypt(new ByteArrayInputStream(byteOutputStream.toByteArray()), VideoEncryptUtil.cipher)); map.put(asset.getMd5() + ".chnmuseum", VideoEncryptUtil.encrypt(new ByteArrayInputStream(byteOutputStream.toByteArray()), VideoEncryptUtil.cipher));
} }
String[] paths = map.keySet().toArray(new String[0]); ZipUtil.zip(response.getOutputStream(), map.keySet().toArray(new String[0]), map.values().toArray(new InputStream[0]));
InputStream[] ins = map.values().toArray(new InputStream[0]);
ZipUtil.zip(response.getOutputStream(), paths, ins);
} }
@ApiOperation(value = "导出所有机顶盒的文件加密密钥", notes = "导出所有机顶盒的文件加密密钥") @ApiOperation(value = "导出所有机顶盒的文件加密密钥", notes = "导出所有机顶盒的文件加密密钥")
...@@ -155,10 +152,7 @@ public class AssetController extends BaseController { ...@@ -155,10 +152,7 @@ public class AssetController extends BaseController {
for (TBoxOperation tBoxOperation : tBoxOperationList) { for (TBoxOperation tBoxOperation : tBoxOperationList) {
map.put(tBoxOperation.getOrganName() + "-" + tBoxOperation.getMac().replaceAll(":|-", "_") + ".cipher", IoUtil.toStream(RSAUtils.encrypt(VideoEncryptUtil.cipher, tBoxOperation.getPublicKey()), StandardCharsets.UTF_8)); map.put(tBoxOperation.getOrganName() + "-" + tBoxOperation.getMac().replaceAll(":|-", "_") + ".cipher", IoUtil.toStream(RSAUtils.encrypt(VideoEncryptUtil.cipher, tBoxOperation.getPublicKey()), StandardCharsets.UTF_8));
} }
ServletOutputStream outputStream = response.getOutputStream(); ZipUtil.zip(response.getOutputStream(), map.keySet().toArray(new String[0]), map.values().toArray(new InputStream[0]));
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