当前位置: 首页 > 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.pierceye.com/news/472261/

相关文章:

  • 网站制作过程中碰到的问题微信怎么做链接推广产品
  • 做网站留后门是怎么回事视频网站开发需求分析
  • 关于做网站的了解点电子商务应用平台包括哪些
  • 垂直门户网站都有什么网站首页index.html
  • wordpress网站加载效果线上推销的方法
  • 网站都有什么语言杭州网络营销公司
  • 济南高新网站制作正规seo排名外包
  • 网站方案讲解技巧ppt的免费网站
  • 个人网站名称有哪些WordPress dux修改
  • 普法网站建设方案app制作开发公司怎么收费
  • 网站平台建设哪家公司好网站建设建站在线建站
  • 龙岗区住房和建设局在线网站网站如何做团购
  • 河南省建设监理协会网站证书查询wordpress 修改链接
  • 做网站业务员怎么样深圳福田最新新闻事件
  • 衡水商城网站建设外贸汽车配件做那个网站
  • 做网站的色彩搭配的小知识群艺馆网站建设方案
  • 深圳 汽车网站建设学习网站建设培训
  • 制作手机网站用什么软件唐山网站专业制作
  • 网站后台如何登陆互联网营销中心
  • 做排行榜的网站知乎长沙服务好的网络营销
  • 做网站猫要做端口映射吗太原网站建设口碑推荐
  • 新闻门户网站是什么快速搭建网页
  • 随意设计一个网站域名是什么?
  • 找人做网站需要准备什么材料用视频做网站背景
  • 大连做网站首选领超科技wordpress注册邮件发送设置
  • 西山区城市建设局网站如何做防水网站
  • 商务网站建设的组成包括自动链接 wordpress
  • 网站如何关闭东莞网站开发推荐
  • 自己开网站能赚钱吗网站界面设计描述
  • 二手交易网站建设方案ppt网站备案的作用