当前位置: 首页 > news >正文

我公司想做网站建设网站物业经理上岗证陈俊华

我公司想做网站,建设网站物业经理上岗证陈俊华,西安网站制作开发公司哪家好,品牌建设与营销的关系前言#xff1a;之前实现的需求由于导出时需要的时间过于长#xff0c;需要优化采用多线程的方式进行导出 更改之后的代码#xff1a; 首先创建excel的临时文件#xff0c;并写入。然后创建线程池#xff0c;调用zipArchiveOutputStream来写入图片和excel PostMapping(之前实现的需求由于导出时需要的时间过于长需要优化采用多线程的方式进行导出 更改之后的代码 首先创建excel的临时文件并写入。然后创建线程池调用zipArchiveOutputStream来写入图片和excel PostMapping(/export3)public void exportZip(HttpServletResponse response,RequestParam(value startTime,required false)String startTime,RequestParam(value endTime,required false)String endTime,RequestParam(value deviceName,required false)String deviceName) throws IOException {ListCutterImageVO cutterImageVOList cutterImageService.getCutterImageList(startTime,endTime,deviceName);long start System.currentTimeMillis();String zipFileName 豁口图片数据;response.setCharacterEncoding(utf-8);response.setContentType(application/zip);response.setHeader(Content-Disposition, attachment;filename URLEncoder.encode(zipFileName .zip, UTF-8));//创建excel临时文件final File tempFile File.createTempFile(tempExcel, .xls);EasyExcel.write(tempFile.getCanonicalPath(),CutterImageVO.class).excelType(ExcelTypeEnum.XLS).registerWriteHandler(new ExcelHyperlinkHandler(1, new int[]{7})).sheet(豁口图片数据).doWrite(cutterImageVOList);logger.info(临时文件所在的本地路径 tempFile.getCanonicalPath());ExecutorService executor new ThreadPoolExecutor(5, 10, 60, TimeUnit.SECONDS, new LinkedBlockingQueue(20), new MyRejectedExecutionHandler());ParallelScatterZipCreator parallelScatterZipCreator new ParallelScatterZipCreator(executor);OutputStream outputStream response.getOutputStream();ZipArchiveOutputStream zipArchiveOutputStream new ZipArchiveOutputStream(outputStream);zipArchiveOutputStream.setEncoding(UTF-8);try {for (int i 0; i cutterImageVOList.size(); i) {int finalI i;String fileName null;if (finalI cutterImageVOList.size()) {fileName 豁口图片数据.xls;} else {fileName cutterImageVOList.get(i).getImageUrl();}String finalFileName fileName;final InputStreamSupplier inputStreamSupplier () - {try {InputStream inputStream null;if (finalI cutterImageVOList.size()) {inputStream new FileInputStream(tempFile.getCanonicalPath());} else {inputStream minioUtil.getDownloadInputStream(finalFileName);}return inputStream;} catch (Exception e) {e.printStackTrace();return new NullInputStream(0);}};ZipArchiveEntry zipArchiveEntry new ZipArchiveEntry(fileName);zipArchiveEntry.setMethod(ZipArchiveEntry.DEFLATED);zipArchiveEntry.setUnixMode(UnixStat.FILE_FLAG | 436);parallelScatterZipCreator.addArchiveEntry(zipArchiveEntry, inputStreamSupplier);}parallelScatterZipCreator.writeTo(zipArchiveOutputStream);}catch(Exception e){log.error(文件流读取失败,e);e.printStackTrace();}finally {IOUtils.closeQuietly(zipArchiveOutputStream);IOUtils.closeQuietly(outputStream);}//程序退出时删除临时文件tempFile.deleteOnExit();long end System.currentTimeMillis();log.info(耗时:(end-start));} Minio工具类 public InputStream getDownloadInputStream(String fileName) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {InputStream is client.getObject(GetObjectArgs.builder().bucket(minioConfig.getBucketName()).object(fileName).build());return is;}
http://www.zqtcl.cn/news/472261/

相关文章:

  • 长沙 网站设计 公司价格江苏专业网站建设费用
  • 做的好的手机网站有哪些内容手机怎么做app详细步骤
  • net网站开发参考文献c++能不能作为网页开发语言
  • 我公司让别人做网站了怎么办厦门logo设计公司
  • 闸北专业做网站怎么判断网站优化过度
  • 搭建网站seowordpress重新安装如何做
  • 网站设计优化重庆教育建设有限公司网站
  • 域名注册网站查询手工制作视频教程简单又漂亮
  • 书画院网站源码网站百度指数
  • 网页设计与网站开发第三版课后答案网络运营商是干嘛的
  • wordpress分类目录网站主题自己做营销型网站
  • 简述网站推广的五要素seo排名软件怎么做
  • 做网站能做职业吗织梦如何做几种语言的网站
  • 手机网站定制咨询如何修改网站
  • 长沙大型网站建设公司建站工作室源码
  • 找设计方案的网站专注南昌网站建设
  • UE做的比较好的网站汕头网站关键词优化教程
  • 做羞羞的事情网站广州番禺招聘网最新招聘信息
  • 网站基础开发成本网站建设策划包括哪些内容
  • 商务网站建设哪家好绍兴网站建设做网站
  • 网站域名管理东莞网页设计和网页制作
  • 网站建设与制作报价网站app制作
  • 下载可以做动漫的我的世界视频网站长沙网站seo技巧
  • 汕头网站制作推荐制作影视视频的软件
  • 定制程序网站宁波英文网站建设
  • 安康公司做网站网页设计怎么设计
  • 小型企业网站系统南京seo外包平台
  • 曲靖网站制作邢台网站制作那家便宜
  • wordpress中portfolio重庆网站seo按天计费
  • 做淘客网站需要多大的空间工程公司名称大全简单大气