超级实用导出各种excel,简单粗暴,无需多言

1、加入准备的工具类

package com.ly.cloud.utils.exportUtil;import java.util.Map;public interface TemplateRenderer {Writable render(Map<String, Object> dataSource) throws Throwable;}
package com.ly.cloud.utils.exportUtil;import java.util.Map;public interface ExportedFileNameFactory {String getName(Map<String, Object> dataSource);}
package com.ly.cloud.utils.exportUtil;import java.io.IOException;
import java.io.OutputStream;public interface Writable {void write(OutputStream outputStream) throws IOException;}
package com.ly.cloud.utils.exportUtil;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import java.io.File;
import java.io.FileOutputStream;
import java.util.Map;public abstract class AbsExporter implements TemplateRenderer {private static final Logger LOGGER = LoggerFactory.getLogger(AbsExporter.class);public void doExport(Map<String, Object> dataSource, File exportedFile) throws Throwable {try(FileOutputStream fos = new FileOutputStream(exportedFile)) {Writable writable = this.render(dataSource);writable.write(fos);}}public abstract String getTargetFileSuffix();public void afterExport() {}
}
package com.ly.cloud.utils.exportUtil;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.zip.ZipOutputStream;public class ExportProcess {private static final Logger LOGGER = LoggerFactory.getLogger(ExportProcess.class);/*** 要导出的数据源*/private List<Map<String, Object>> dataSourceList = new ArrayList<>();/*** 是否为多文件导出*/private boolean multiFile;/*** 导出器*/private AbsExporter exporter;/*** 导出文件名*/private String exportedFilename;/*** 导出为多文件时的文件名命名工厂*/private ExportedFileNameFactory nameFactory;private ExportProcess(Map<String, Object> dataSource, AbsExporter exporter, String exportedFilename) {this.dataSourceList.add(dataSource);this.multiFile = false;this.exporter = exporter;this.exportedFilename = exportedFilename;}private ExportProcess(List<Map<String, Object>> dataSourceList, AbsExporter exporter, String exportedFilename, ExportedFileNameFactory nameFactory) {this.dataSourceList.addAll(dataSourceList);this.multiFile = true;this.exporter = exporter;this.exportedFilename = exportedFilename;this.nameFactory = nameFactory;}public static ExportProcess newProcess(Map<String, Object> dataSource, AbsExporter exporter, String exportedFilename) {return new ExportProcess(dataSource, exporter, exportedFilename);}public static ExportProcess newProcess(List<Map<String, Object>> dataSourceList, AbsExporter exporter, String exportedFilename, ExportedFileNameFactory nameFactory) {return new ExportProcess(dataSourceList, exporter, exportedFilename, nameFactory);}public ExportResult export() {ExportResult exportResult = new ExportResult(this.multiFile ? exportAsZipFile() : exportAsSingleFile());this.exporter.afterExport();return exportResult;}/*** 导出为单文件* @return 导出结果*/private File exportAsSingleFile() {Map<String, Object> dataSource = this.dataSourceList.get(0);// 导出文件所在目录路径String exportedFileDirPath = FileUtils.filePathJoin(FileUtils.TEMP_FILE_PATH, "exportedFileDir" + UUID.randomUUID().toString());// 创建导出文件所在目录File exportedFileDir = FileUtils.createDir(exportedFileDirPath);String exportedFilePath = FileUtils.filePathJoin(exportedFileDirPath, this.exportedFilename + this.exporter.getTargetFileSuffix());File exportedFile = new File(exportedFilePath);try {this.exporter.doExport(dataSource, exportedFile);return exportedFile;} catch (Throwable t) {LOGGER.error(t.getMessage(), t);FileUtils.deleteDir(exportedFileDir);}return null;}/*** 导出为压缩文件* @return 导出结果*/private File exportAsZipFile() {String tempFileDirPath = FileUtils.filePathJoin(FileUtils.TEMP_FILE_PATH, "tempFile" + UUID.randomUUID().toString());File tempFileDir = FileUtils.createDir(tempFileDirPath);// 导出文件所在目录路径String exportedFileDirPath = FileUtils.filePathJoin(FileUtils.TEMP_FILE_PATH, "exportedFileDir" + UUID.randomUUID().toString());// 创建导出文件所在目录File exportedFileDir = FileUtils.createDir(exportedFileDirPath);File exportedFile = new File(FileUtils.filePathJoin(exportedFileDirPath, this.exportedFilename + ".zip"));try {for (Map<String, Object> dataSource : this.dataSourceList) {this.exporter.doExport(dataSource, new File(FileUtils.filePathJoin(tempFileDirPath, this.nameFactory.getName(dataSource) + this.exporter.getTargetFileSuffix())));}try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(exportedFile));BufferedOutputStream bos = new BufferedOutputStream(out)) {FileUtils.zipDir(tempFileDirPath, out, bos);}return exportedFile;} catch (Throwable t) {LOGGER.error(t.getMessage(), t);FileUtils.deleteDir(exportedFileDir);} finally {FileUtils.deleteDir(tempFileDir);}return null;}
}
package com.ly.cloud.utils.exportUtil;import eu.bitwalker.useragentutils.Browser;
import eu.bitwalker.useragentutils.UserAgent;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;public class ExportResult {private static final Logger LOGGER = LoggerFactory.getLogger(ExportResult.class);private File exportedFile;ExportResult(File exportedFile) {this.exportedFile = exportedFile;}public File getExportedFile() {if (null == this.exportedFile) {throw new NullPointerException("exportedFile 为 null");}return exportedFile;}public void download(HttpServletRequest request, HttpServletResponse response) {File exportedFile = getExportedFile();// 用于清除首部的空白行response.reset();response.setContentType("application/x-download; charset=utf-8");setFileDownloadHeader(request, response, this.exportedFile.getName());doDownload(response, exportedFile);}private void setFileDownloadHeader(HttpServletRequest request, HttpServletResponse response, String filename) {//获取浏览器信息String ua = request.getHeader("USER-AGENT");//转成UserAgent对象UserAgent userAgent = UserAgent.parseUserAgentString(ua);//获取浏览器信息Browser browser = userAgent.getBrowser();//浏览器名称String browserName = browser.getName();String encodedFilename;try {encodedFilename = URLEncoder.encode(filename, "UTF8");if (StringUtils.contains(browserName, "Internet Explorer")) {response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedFilename + "\"");} else if (StringUtils.contains(browserName, "Chrome") || StringUtils.contains(browserName, "Firefox")) {response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encodedFilename);} else {// 其他浏览器response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedFilename + "\"");}} catch (UnsupportedEncodingException e) {LOGGER.error(e.getMessage(), e);}}private void doDownload(HttpServletResponse response, File exportedFile) {OutputStream os = null;byte[] buffer = new byte[1024];BufferedInputStream bis = null;FileInputStream exportedFileInputStream = null;try {exportedFileInputStream = new FileInputStream(exportedFile);response.addHeader("content-length", exportedFileInputStream.available() + "");os = response.getOutputStream();bis = new BufferedInputStream(exportedFileInputStream);int i = bis.read(buffer);while (i != -1) {os.write(buffer, 0, i);i = bis.read(buffer);}os.flush();} catch (IOException e) {LOGGER.error(e.getMessage(), e);} finally {if (exportedFileInputStream != null) {try {exportedFileInputStream.close();} catch (IOException e) {LOGGER.error(e.getMessage(), e);}}if (bis != null) {try {bis.close();} catch (IOException e) {LOGGER.error(e.getMessage(), e);}}if (os != null) {try {os.close();} catch (IOException e) {LOGGER.error(e.getMessage(), e);}}// 下载完成后删除临时文件if (exportedFile.exists()) {File exportedFileDir = exportedFile.getParentFile();FileUtils.deleteDir(exportedFileDir);}}}
}
package com.ly.cloud.utils.exportUtil;import org.apache.commons.lang3.StringUtils;import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;public class FileUtils {static {// 当文件系统中没有nhtemp文件夹的时候,创建File sf = new File(FileUtils.filePathJoin(System.getProperty("java.io.tmpdir"), "nhtemp"));if (!sf.exists()) {sf.mkdirs();}}/*** 临时文件夹,在临时文件夹中创建nhtemp,用来保存所有使用本工具类创建的文件,以便于统一清空临时文件夹,并且已经包含了文件分割符号,请注意*/public static final String TEMP_FILE_PATH = FileUtils.filePathJoin(System.getProperty("java.io.tmpdir"), "nhtemp");/*** 向文件写入数据** @param is* @param file* @throws IOException*/public static void writeToFile(InputStream is, File file) throws IOException {FileOutputStream fs = null;try {fs = new FileOutputStream(file);byte[] buffer = new byte[1024];int byteread = 0;while ((byteread = is.read(buffer)) != -1) {fs.write(buffer, 0, byteread);}} catch (IOException e) {throw e;} finally {if (fs != null) {fs.close();}is.close();}}/*** 删除文件夹(会删除文件夹下所有的文件)** @param dir* @return*/public static boolean deleteDir(File dir) {if (dir.isDirectory()) {String[] children = dir.list();//递归删除目录中的子目录下for (int i = 0; i < children.length; i++) {boolean success = deleteDir(new File(dir, children[i]));if (!success) {return false;}}}// 目录此时为空,可以删除return dir.delete();}public static File createDir(String dirPath) {File dir = new File(dirPath);//如果文件夹不存在if (!dir.exists()) {//创建文件夹dir.mkdir();}return dir;}public static void zipDir(String directoryName, ZipOutputStream zos, BufferedOutputStream bos) {File file = new File(directoryName);if (file.exists()) {File[] fileList = file.listFiles();assert fileList != null;for (File f : fileList) {// 压缩单个文件到 zosString zipName = f.getName();try {zos.putNextEntry(new ZipEntry(zipName));int len;FileInputStream is = new FileInputStream(f);BufferedInputStream bis = new BufferedInputStream(is);byte[] bytes = new byte[1024];while ((len = bis.read(bytes)) != -1) {bos.write(bytes, 0, len);}bos.flush();zos.flush();//                    结束当前压缩文件的添加bis.close();is.close();} catch (IOException e) {e.printStackTrace();}}}}/*** 路径拼接工具方法* @param filePath 文件路径* @return 拼接结果*/public static String filePathJoin(String... filePath) {return StringUtils.join(filePath, File.separator);}}
package com.ly.cloud.utils.exportUtil;import cn.afterturn.easypoi.excel.ExcelXorHtmlUtil;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import java.util.Map;public class VelocityTemplateExporter extends AbsExporter {private static final Logger LOGGER = LoggerFactory.getLogger(VelocityTemplateExporter.class);private String templateFilename;public VelocityTemplateExporter(String templateFilename) {this.templateFilename = templateFilename;}@Overridepublic String getTargetFileSuffix() {return ".xlsx";}@Overridepublic Writable render(Map<String, Object> dataSource) {String html = VelocityUtils.render(this.templateFilename + ".vm", dataSource);LOGGER.trace("渲染的html为:\n{}", html);Workbook workbook = ExcelXorHtmlUtil.htmlToExcel(html, ExcelType.XSSF);if (null == workbook) {throw new NullPointerException("workbook 为 null");}return new WorkbookWrapper(workbook);}
}
package com.ly.cloud.utils.exportUtil;import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.exception.VelocityException;import java.io.StringWriter;
import java.util.Map;
import java.util.Properties;public class VelocityUtils {/*** 模板文件所在目录*/private static final String TEMPLATE_FILE_DIR = FileUtils.filePathJoin("file", "velocityTemp");static {//初始化参数Properties properties = new Properties();//设置 velocity 资源加载方式为 classproperties.setProperty("resource.loader", "class");//设置 velocity 资源加载方式为 class 时的处理类properties.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");// 执行初始化Velocity.init(properties);}/*** 渲染对应模板,并输出渲染结果* @param templateFileName 模板文件名* @param velocityContext 上下文对象,即渲染使用的数据源* @return 渲染结果*/public static String render(String templateFileName, VelocityContext velocityContext) throws VelocityException {StringWriter writer = new StringWriter();Velocity.mergeTemplate(FileUtils.filePathJoin(TEMPLATE_FILE_DIR, templateFileName), "UTF-8", velocityContext, writer);return writer.toString();}/*** 渲染对应模板,并输出渲染结果* @param templateFileName 模板文件名* @param renderDataSource 渲染使用的数据源* @return 渲染结果*/public static String render(String templateFileName, Map<String, Object> renderDataSource) throws VelocityException {VelocityContext velocityContext = new VelocityContext(renderDataSource);return render(templateFileName, velocityContext);}
}
package com.ly.cloud.utils.exportUtil;import org.apache.poi.ss.usermodel.Workbook;import java.io.IOException;
import java.io.OutputStream;public class WorkbookWrapper implements Writable {private Workbook workbook;public WorkbookWrapper(Workbook workbook) {this.workbook = workbook;}@Overridepublic void write(OutputStream outputStream) throws IOException {this.workbook.write(outputStream);}
}
package com.ly.cloud.utils.exportUtil;import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import org.apache.poi.ss.usermodel.Workbook;import java.util.Map;
import java.util.function.Function;public class ExcelTemplateExporter extends AbsExporter {private TemplateExportParams templateExportParams;private Function<Workbook, Workbook> afterRender;public ExcelTemplateExporter(String templateFilename) {this(templateFilename, null);}public ExcelTemplateExporter(String templateFilename, Function<Workbook, Workbook> afterRender) {this.templateExportParams = new TemplateExportParams("file/excelTemp/" + templateFilename + ".xlsx");this.afterRender = afterRender;}@Overridepublic Writable render(Map<String, Object> dataSource) {Workbook workbook = ExcelExportUtil.exportExcel(this.templateExportParams, dataSource);if (null == workbook) {throw new NullPointerException("workbook 为 null");}if (this.afterRender != null) {workbook = this.afterRender.apply(workbook);}return new WorkbookWrapper(workbook);}@Overridepublic String getTargetFileSuffix() {return ".xlsx";}
}

2、引入依赖

		<dependency><groupId>org.jsoup</groupId><artifactId>jsoup</artifactId><version>1.12.1</version></dependency>

3、方式1 (适用于一成不变的excel)。例如需要导出如下excel

直接将需要填充用变量表示,然后放入文件夹下面:

然后编写接口即可

访问接口即可下载,结果如下

方式2 .编写vm文件。(自己可以做出导出的excel的样子,随心所欲。里面支持foreach循环,动态导出也不怕,适用于动态导出,导出内容不固定的)

下面这是文件存放位置和文件路径设置

注意:文件放的位置可以通过工具类上面设置的而改变。比较灵活

4、简单vm文件示例

5、请求示例:

6、下载结果

7.总结

这个vm文件可自行扩展。非常灵活。下面是我用过的几个vm实战例子

## 二级列(等级)标题 list
#set($subColumnTitleList = [])
## 数据索引 list
#set($dataIndexList = [])
## 各个列的样式,主要是加上边框
#set($style = 'style="border: 1"')
#set($styleW = 'style="border: 1 solid black; width: 25;"')
#set($fontSize = 'style="border: 1 solid black; font-size: 20;"')
#set($bgck = 'style="border: 1 solid black; background-color: yellow;"')
#set($colspanValue = $lbmc.size() + 1)
## sheetName 必须存在
<table sheetName="columnsExportTest"><tr><th colspan="$num" $fontSize>$title</th></tr><tr><th colspan="$num" $style style="font-weight: bold">单位:XXX技术学院</th></tr><tr><th rowspan="2" $style>院系</th><th colspan="$colspanValue" $style>学校总人数</th>#foreach($column in $columns)#if($column.children)
##                <th colspan="$column.children.size()" $style>$column.title</th>#foreach($subColumn in $column.children)<th rowspan="1" colspan="2" $style>$subColumn.title</th>## 因为 add 方法有返回值,所以这里需要用 html 的方式注释一下,下面同理<!--$subColumnTitleList.add("人数")--><!--$subColumnTitleList.add("金额")--><!--$dataIndexList.add($subColumn.dataIndex)--><!--$dataIndexList.add($subColumn.dataIndexTemp)-->#end#else<th rowspan="1" colspan="2" $style>$column.title</th><!--$subColumnTitleList.add("人数")--><!--$subColumnTitleList.add("金额")--><!--$dataIndexList.add($column.dataIndex)--><!--$dataIndexList.add($column.dataIndexTemp)-->#end#end<th colspan="2" $style>合计</th></tr><tr>#foreach($mc in $lbmc)<th $style>$mc</th>#end<th $style>合计</th>#if($subColumnTitleList)#set($count = 1)#foreach($subColumnTitle in $subColumnTitleList)#if ($count % 2 == 0)<th $bgck>$subColumnTitle</th>#else<th $style>$subColumnTitle</th>#end#set($count = $count + 1)#end#end<th $style>人数</th><th $bgck>发放金额</th></tr>#foreach($record in $dataSource)<tr><td $styleW>$record.BMMC</td>#set($sum = 0)#foreach($dm in $lbdm)<td $style>$record.get($dm)</td>#set($currentValue = $record.get($dm))  ## 获取当前值#set($sum = $sum + $currentValue)  ## 累加值到 $sum 变量#end<td $style>$sum</td>#set($count = 1)#foreach($dataIndex in $dataIndexList)#if($count % 2 == 0)<td $bgck>$record.get($dataIndex)</td>#else<td $style>$record.get($dataIndex)</td>#end#set($count = $count + 1)#end#if($record.BMMC == "合计")<td colspan="1" $style>$record.HJRC</td><td colspan="1" $bgck>$record.HJJE</td>#else<td $style>$record.HJRC</td><td $bgck>$record.HJJE</td>#end</tr>#end
</table>
## 各个列的样式,主要是加上边框
#set($style = 'style="border: 1; height:50;width:18"')
#set($bold = 'style="border: 1; height:50;width:18;font-weight: bold;"')
#set($fontSize = 'style="font-size: 20;"')
#macro(displayValue $value)#if($value)$value#else#end
#end
## sheetName 必须存在
<table sheetName="心理咨询个案记录表"><tr><th colspan="6" $fontSize>心理咨询个案记录表</th></tr><tr><th $style>咨询师</th><th $style>#displayValue($ZXS)</th><th $style>咨询次数</th><th $style>#displayValue($dataSource.size())</th><th $style>来访日期</th><th $style>#displayValue($dataSource.get(0).ZXSJ)</th></tr><tr><th $style>来访者</th><th $style>#displayValue($LFZ)</th><th $style>性别</th><th $style>#displayValue($XB)</th><th $style>年龄</th><th $style>#displayValue($AGE)</th></tr><tr><th $style>系部班级</th><th $style>#displayValue($XBBJ)</th><th $style>辅导员/班主任</th><th $style>#displayValue($FDYXM)</th><th $style>联系人及联系方式</th><th $style>#displayValue($JJLXR)</th></tr>#foreach($record in $dataSource)<tr><th  rowspan="11" $bold>#displayValue($record.title)</th><th $bold colspan="5">表现出的问题</th></tr><tr><th $style>来访者自述</th><th colspan="4" $style>#displayValue($record.LFZZS)</th></tr><tr><th $bold colspan="5">问题原因</th></tr><tr><th $style>促使因素</th><th colspan="4" $style>#displayValue($record.CSYS)</th></tr><tr><th $style>先前因素</th><th colspan="4" $style>#displayValue($record.XQYS)</th></tr><tr><th $style>社会因素</th><th colspan="4" $style>#displayValue($record.SHYS)</th></tr><tr><th $style>健康状况及治疗史</th><th colspan="4" $style>#displayValue($record.JKZTJZLS)</th></tr><tr><th $bold colspan="5">分析、评估与咨询方案</th></tr><tr><th $style>评估诊断</th><th colspan="4" $style>#displayValue($record.PGZD)</th></tr><tr><th $style>咨询目标</th><th colspan="4" $style>#displayValue($record.ZXMB)</th></tr><tr><th $style>咨询方法</th><th colspan="4" $style>#displayValue($record.ZXFF)</th></tr>#end
</table>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/739499.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Python之禅——跟老吕学Python编程

Python之禅——跟老吕学Python编程 Python之禅1.**Beautiful is better than ugly.**2.**Explicit is better than implicit.**3.**Simple is better than complex.**4.**Complex is better than complicated.**5.**Flat is better than nested.**6.**Spare is better than den…

【Tailwind + Vue3】100行代码手写一个客服组件

【Tailwind Vue3】100行代码手写一个客服组件 通常在官网页面上&#xff0c;都会有一个在右下角的客服小组件&#xff0c;有几个按钮&#xff0c;显示电话&#xff0c;微信等信息&#xff1a; 主要有以下几个难点&#xff1a; 动态类名绑定&#xff1a; 在迭代生成的每个工具…

AI绘画怎么用?详细教程在这里!

AI绘画是一种利用人工智能技术来创作艺术作品的方式。以下是一个详细的AI绘画的详细教程&#xff0c;介绍AI绘画怎么用? 1. 选择合适的AI绘画工具&#xff1a;市面上有许多AI绘画工具供用户选择&#xff0c;如建e网AI、DeepArt、DALL-E等。用户可以根据自己的需求和兴趣&#…

Python 导入Excel三维坐标数据 生成三维曲面地形图(面) 1、线条折线曲面

环境和包: 环境 python:python-3.12.0-amd64包: matplotlib 3.8.2 pandas 2.1.4 openpyxl 3.1.2 代码: import pandas as pd import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import ListedColor…

Tab组件的编写与动态日期的函数封装

src\components\Tab\Icon.vue 底部导航栏子组件。 <template><router-link :to"path" class"tab-icon"><i class"icon">{{iconText}}</i><p class"text"><slot>{{ tabText }}</slot></…

2024.3.12 C++

1、自己封装一个矩形类(Rect)&#xff0c;拥有私有属性:宽度(width)、高度(height) 定义公有成员函数初始化函数:void init(int w, int h)更改宽度的函数:set w(int w)更改高度的函数:set h(int h)输出该矩形的周长和面积函数:void show() #include <iostream>using nam…

高项-项目整合管理

项目整合管理的目标 资源分配平衡竞争性需求研究各种备选方法裁剪过程以实现项目目标管理各个项目管理知识域之间的依赖关系 项目整合管理的过程 制定项目章程制定项目管理计划指导与管理项目工作管理项目知识监控项目工作实施整体变更控制结束项目或阶段 七个过程和五大过…

Servlet的book图书表格实现(使用原生js实现)

作业内容&#xff1a; 1 建立一个book.html,实现图书入库提交 整体参考效果如下: 数据提交后&#xff0c;以窗口弹出数据结果&#xff0c;如: 2 使用正则表达式验证ISBN为x-x-x格式&#xff0c;图书名不低于2个字符&#xff0c;作者不能为空&#xff0c;单价在【10-100】之间…

NASA和IBM联合开发的 2022 年多时相土地分类数据集

简介 美国国家航空航天局&#xff08;NASA&#xff09;和国际商业机器公司&#xff08;IBM&#xff09;合作&#xff0c;利用大规模卫星和遥感数据&#xff0c;包括大地遥感卫星和哨兵-2 号&#xff08;HLS&#xff09;数据&#xff0c;创建了地球观测人工智能基础模型。通过奉…

光电容积脉搏波PPG信号分析笔记

1.脉搏波信号的PRV分析 各类分析参数记参数 意义 公式 参数意义 线性分析 时域分析 均值MEAN 反应RR间期的平均水平 总体标准差SDNN 评估24小时长程HRV的总体变化&#xff0c; SDNN &#xff1c; 50ms 为异常&#xff0c;SDNN&#xff1e;100ms 为正常&#xff1b;…

Python 导入Excel三维坐标数据 生成三维曲面地形图(体) 5-1、线条平滑曲面且可通过面观察柱体变化(一)

环境和包: 环境 python:python-3.12.0-amd64包: matplotlib 3.8.2 pandas 2.1.4 openpyxl 3.1.2 scipy 1.12.0 代码: import pandas as pd import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from scipy.interpolate import griddata fro…

【Java探索之旅】数据类型与变量 浮点型,字符型,布尔型,字符串型

&#x1f3a5; 屿小夏 &#xff1a; 个人主页 &#x1f525;个人专栏 &#xff1a; Java成长日志 &#x1f304; 莫道桑榆晚&#xff0c;为霞尚满天&#xff01; 文章目录 &#x1f4d1;前言一、变量1.1 浮点型1.2 字符型变量1.3 布尔类型 二、字符串类型2.1 转化 &#x1f324…

建造家庭泳池位置选择尤为重要

建造家庭泳池位置选择尤为重要 在自家别墅庭院中建造一座游泳池是很多人的梦想&#xff0c;因为有泳池家人健身起来是非常方便的&#xff0c;但是建造泳池选择合适的位置显得尤为关键&#xff0c;因为合适的选址可以带来美观性及在泳池的日常使用维护中也起到了很重要的作用。…

Failed to load local image resource the server responded with a status of 500

在微信小程序里使用van-image时&#xff0c;加载本地图片加载不出来&#xff0c;报错信息如下 Failed to load local image resource /miniprogram_npm/vant/weapp/image/require(/images/xztp.jpg) the server responded with a status of 500 (HTTP/1.1 500 Internal Server …

python 通过代理服务器 连接 huggingface下载模型,并运行 pipeline

想在Python 代码中运行时下载模型&#xff0c;启动代理服务器客户端后 1. 检查能否科学上网 $ curl -x socks5h://127.0.0.1:1080 https://www.example.com <!doctype html> <html> <head><title>Example Domain</title><meta charset"…

前端css 纯数字或者字母 溢出不换行

问题&#xff1a;一个div元素盒子 宽度固定 内容是中文到达盒子宽度放不下时会自动换行&#xff0c;但是如果输入的事纯数字或者字母 会发现内容区会溢出 异常现象&#xff1a;11111超出div盒子 解决方案&#xff1a;添加属性 word-break: break-all; 原理&#xff1a;浏览器…

13年老鸟整理,性能测试技术知识体系总结,从零开始打通...

目录&#xff1a;导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结&#xff08;尾部小惊喜&#xff09; 前言 从个人的实践经验…

多线程案例及常用模式

一.单例模式——经典的设计模式 什么是单例模式&#xff1a;就是规定一个类只能创建一个对象&#xff0c;也就是保证某个类在程序中只存在唯一一个实例&#xff0c;而不会创建出多个实例 根据对象创建的时机不同&#xff0c;可以分为饿汉模式和懒汉模式 1.饿汉模式 在类加载…

Cloudflare Tunnel:无惧DDOS_随时随地安全访问局域网Web应用

利用此方法&#xff0c;您可以在局域网&#xff08;尤其是NAS&#xff09;上搭建的Web应用支持公网访问&#xff0c;成本低而且操作简单&#xff01; 如果这是博客的话&#xff0c;它还可以有效防止DDOS攻击&#xff01; 准备工作&#xff1a; 需要一个域名&#xff08;推荐N…

【微服务学习笔记(二)】Docker、RabbitMQ、SpringAMQP、Elasticseach

【微服务学习笔记&#xff08;二&#xff09;】Docker、RabbitMQ、SpringAMQP、Elasticseach Docker镜像和容器安装基础命令Dockerfile自定义镜像 MQ&#xff08;服务异步通讯&#xff09;RabbitMQ安装使用消息模型 SpringAMQP消息发送消息接收Work Queue 工作队列发布订阅Fano…