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

记一个带批注、表头样式的导入导出excel方法(基于easyexcel)

技术栈:easyexcel-2.2.10,poi-4.1.2,lombok,hutool-5.8.19;公司自用导入导出方法,可能不是那么的优雅,但胜在稳定实用。

/*** @Author 955* @Date 2023-10-10 11:52* @Description 错误批注信息对象*/
@Data
public class ErrorTypeNewVo implements Serializable {public ErrorTypeNewVo(String name, String message) {this.name = name;this.errors = message;}public ErrorTypeNewVo(String message, String name, int rownum, int cellnum) {this.name = name;this.errors = message;this.lineNum = rownum;this.cellnum = cellnum;}private String name;private String errors;private int lineNum;private int cellnum;}

一些要用到的工具类或方法

    /*** 取得cell内的值** @param cell* @return*/public static String getStrByCell(Cell cell) {if (cell == null)return null;String temp = null;switch (cell.getCellType()) {case BLANK:case STRING:temp = cell.getStringCellValue();break;case FORMULA:try {temp = cell.getStringCellValue();} catch (IllegalStateException e) {temp = cell.getNumericCellValue() + "";}break;case NUMERIC:boolean remar = false;try {remar = DateUtil.isCellDateFormatted(cell);} catch (Exception e) {// TODO: handle exception}if (remar) {double d = cell.getNumericCellValue();Date date = DateUtil.getJavaDate(d);SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd");temp = a.format(date);} else {temp = String.valueOf(cell.getNumericCellValue());}break;default:temp = cell.getStringCellValue();break;}if (temp.trim().equals(""))temp = null;elsetemp = temp.trim();return temp;}/*** 设置单元格样式** @param workbook* @param cell* @param col* @param fg*/public void setStyle(XSSFWorkbook workbook, Cell cell, String col, XSSFColor fg) {XSSFCellStyle style = workbook.createCellStyle();style.setFillForegroundColor(fg);// style.setFillPattern(CellStyle.SOLID_FOREGROUND);cell.setCellStyle(style);cell.setCellValue(col);}/*** 表头样式** @return*/public static WriteCellStyle getHeadWriteCellStyle() {WriteCellStyle headWriteCellStyle = new WriteCellStyle();headWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);headWriteCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index);headWriteCellStyle.setBottomBorderColor(IndexedColors.BLACK.index);headWriteCellStyle.setLeftBorderColor(IndexedColors.BLACK.index);headWriteCellStyle.setRightBorderColor(IndexedColors.BLACK.index);headWriteCellStyle.setTopBorderColor(IndexedColors.BLACK.index);return headWriteCellStyle;}/*** 内容样式** @return*/public static WriteCellStyle getContentWriteCellStyle() {WriteCellStyle contentWriteCellStyle = new WriteCellStyle();contentWriteCellStyle.setWrapped(true);
//        contentWriteCellStyle.setFillForegroundColor(IndexedColors.LEMON_CHIFFON.index);
//        contentWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
//        contentWriteCellStyle.setWriteFont();contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);return contentWriteCellStyle;}/*** 设置表头数据** @return*/private List<List<String>> head(List<String> titleName) {List<List<String>> list = new ArrayList<List<String>>();if (CollUtil.isNotEmpty(titleName)) {for (String s : titleName) {List<String> head = new ArrayList<String>();head.add(s);list.add(head);}}return list;}/*** @content 得到不同的时间类型* @author liuxd* @time 2011/07/24 22:00*/public static String getNow(int type) {SimpleDateFormat sdf = null;switch (type) {case 0:sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");break;case 1:sdf = new SimpleDateFormat("yyyyMMdd");break;case 2:sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");break;case 3:sdf = new SimpleDateFormat("yyyyMM");break;case 4:sdf = new SimpleDateFormat("yyyy年MM月dd日");break;case 5:sdf = new SimpleDateFormat("yyyy-MM-dd");break;case 6:sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); //取到毫秒break;case 7:sdf = new SimpleDateFormat("yyyyMMddHHmmss"); //取到秒break;default:sdf = new SimpleDateFormat("yyyy-M-D");break;}return sdf.format(new Date());}

导出方法体

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.excel.write.builder.ExcelWriterBuilder;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.AbstractHeadColumnWidthStyleStrategy;
import lombok.AllArgsConstructor;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.stereotype.Service;import java.io.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;private static int index = 500000;/*** * @param titleName sheet名称* @param tittleNames 标题集合* @param vos 内容详情集合* @param errorListVo 错误批注集合* @return*/public String newCreateExcelTemple_Object(String titleName, List<String> tittleNames, List<List<Object>> vos, List<ErrorTypeNewVo> errorListVo) {String fileName = OrgTools.getNow(6) + ".xlsx";//本地文件名随意取String locaPath = path + fileName;OutputStream out = null;try {out = new FileOutputStream(locaPath);} catch (FileNotFoundException e) {e.printStackTrace();}try {// 设置数据集合List<List<String>> dataList = new ArrayList<List<String>>();if (CollUtil.isNotEmpty(vos)) {for (List<Object> objects : vos) {List<String> strs = new ArrayList<>();for (Object obj : objects) {String str = null;if (obj != null) {if (obj instanceof Date) {SimpleDateFormat ff = new SimpleDateFormat("yyyy-MM-dd");str = ff.format(obj);} else {str = obj.toString();}}strs.add(str);}dataList.add(strs);}ExcelWriterBuilder writerBuilder = EasyExcel.write();writerBuilder.file(out);writerBuilder.excelType(ExcelTypeEnum.XLSX);writerBuilder.head(head(tittleNames));ExcelWriter excelWriter = writerBuilder.build();// 写第一个sheet, sheet1 数据全是List<String> 无模型映射关系long total = dataList.size();long count = total / 500000;if (total % 500000 > 0) {count++;}WriteCellStyle headWriteCellStyle = getHeadWriteCellStyle();WriteCellStyle contentWriteCellStyle = getContentWriteCellStyle();//这个策略是 头是头的样式 内容是内容的样式HorizontalCellStyleStrategy horizontalCellStyleStrategy =new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);for (int i = 0; i < count; i++) {List<List<String>> temp = new ArrayList<List<String>>();if (i == count - 1) {temp = dataList.subList(i * index, dataList.size());} else {temp = dataList.subList(i * index, (i + 1) * index);}WriteSheet sheet1 = EasyExcel.writerSheet(i, titleName + i).registerWriteHandler(horizontalCellStyleStrategy).registerWriteHandler(new AbstractHeadColumnWidthStyleStrategy() {@Overrideprotected Integer columnWidth(Head head, Integer columnIndex) {if (head == null) {return 17;}// 简单根据列头名称长度进行调整列的宽度// 当遍历完所有指定的head列头后// 第一行数据的第一列也会进入到这个逻辑, 此时head 为 nullreturn head.getHeadNameList().get(0).length() * 10;}}).build();excelWriter.write(temp, sheet1);}excelWriter.finish();}} catch (Exception e) {e.printStackTrace();} finally {try {if (out != null) {out.close();}} catch (IOException e) {e.printStackTrace();}}InputStream inputStream = null;try {inputStream = new FileInputStream(locaPath);XSSFWorkbook wb = new XSSFWorkbook(inputStream);XSSFSheet sheet = wb.getSheetAt(0);for (ErrorTypeNewVo errorTypevo : errorListVo) {Row row = sheet.getRow(errorTypevo.getLineNum());Cell cell = row.getCell(errorTypevo.getCellnum());if (cell == null) {cell = row.getCell(errorTypevo.getCellnum() - 1);}String name = errorTypevo.getName();String messageAll = errorTypevo.getErrors();String message = "";if (StrUtil.isNotEmpty(name)) {message += "错误类型:" + name;}if (StrUtil.isNotEmpty(messageAll)) {message += ",详细错误:" + messageAll;}String t1 = "";try {t1 = getStrByCell(cell);} catch (Exception e) {e.printStackTrace();}XSSFColor color = new XSSFColor(java.awt.Color.red);if (t1 != null) {setStyle(wb, cell, t1, color);} else {t1 = "";if (StrUtil.isNotEmpty(name)) {t1 += "错误类型:" + name;}if (StrUtil.isNotEmpty(messageAll)) {t1 += ",详细错误:" + messageAll;}setStyle(wb, cell, t1, color);}if (cell != null) {//设置批注:能解决Multiple cell comments in one cell are not allowed, cell: xx问题Comment mainComment = cell.getCellComment();if (ObjectUtil.isEmpty(mainComment)) {mainComment = sheet.createDrawingPatriarch().createCellComment(new XSSFClientAnchor(0, 0, 0, 0, cell.getColumnIndex(), cell.getRowIndex(), cell.getColumnIndex() + 2, cell.getRowIndex() + 3));mainComment.setString(new XSSFRichTextString(message));cell.setCellComment(mainComment);sheet.autoSizeColumn(cell.getColumnIndex());}}}// 临时缓冲区ByteArrayOutputStream out2 = new ByteArrayOutputStream();// 创建临时文件wb.write(out2);byte[] bookByteAry = out2.toByteArray();inputStream = new ByteArrayInputStream(bookByteAry);try {//只需替换这里的系统文件导出方法即可fileTemplate.putObject("桶名", fileName, inputStream);} catch (Exception e) {e.printStackTrace();}} catch (FileNotFoundException e1) {e1.printStackTrace();} catch (IOException e) {e.printStackTrace();} finally {if (inputStream != null) {try {inputStream.close();} catch (IOException e) {e.printStackTrace();} finally {File file1 = new File(locaPath);if (file1.exists() && file1.isFile()) {file1.delete();}}}}return fileName;}

导入vo对象示例

@Data
@ColumnWidth(value = 30)
public class ExamExcelVo {@ExcelProperty(value = "考试题目", index = 0)private String questionStem;@ExcelProperty(value = "答题类型", converter = EasyExcelTopicTypeConverter.class, index = 1)private String questionType;@ExcelProperty(value = "正确答案", index = 2)private String answer;@ExcelProperty(value = "考题标签", index = 3)private String major;@ExcelProperty(value = "题要求", converter = EasyExcelDemandConverter.class, index = 4)private String demand;@ExcelProperty(value = "选项A", index = 5)private String optionA;@ExcelProperty(value = "选项B", index = 6)private String optionB;@ExcelProperty(value = "选项C", index = 7)private String optionC;@ExcelProperty(value = "选项D", index = 8)private String optionD;@ExcelProperty(value = "选项E", index = 9)private String optionE;/*** 判断正确选项,反射得到字段值(非必要)** @return*/public List<String> concatenateFields() {List<String> values = new ArrayList<>();try {if (StrUtil.isNotEmpty(answer)) {answer = answer.replaceAll(" ", "");// 使用 HashSet 来存储不重复的字母Set<Character> uniqueLetters = new HashSet<>();// 使用正则表达式匹配 A 到 Z 和 a 到 z 的字母Pattern pattern = Pattern.compile("[a-zA-Z]");Matcher matcher = pattern.matcher(answer);while (matcher.find()) {char letter = matcher.group().charAt(0);// 使用大写字母存储,以忽略大小写uniqueLetters.add(Character.toUpperCase(letter));}List<String> r = new ArrayList<>();for (char letter : uniqueLetters) {r.add(letter + "");}for (String fieldName : r) {Field field = this.getClass().getDeclaredField("option" + fieldName);String value = (String) field.get(this);values.add(value);}}} catch (Exception e) {}return values;}
}

字段处理示例

/*** @Author 955* @Date 2023-09-21 18:28* @Description 字段处理*/
public class EasyExcelTopicTypeConverter implements Converter<String> {@Overridepublic Class<String> supportJavaTypeKey() {return String.class;}@Overridepublic CellDataTypeEnum supportExcelTypeKey() {return CellDataTypeEnum.STRING;}@Overridepublic String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {if (StrUtil.isNotEmpty(cellData.getStringValue())) {//处理逻辑。。。//最终返回的值return xxx;}return null;}@Overridepublic CellData convertToExcelData(String value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {if (StrUtil.isNotEmpty(value)) {String name = CourseBaseEnum.ExamType.getNameById(value);return new CellData(name);}return new CellData("");}
}

工具方法

    /*** 剔除全部字段为null数据对象** @param excelVo*/private void eliminateNullList(List<ExamExcelVo> excelVo) {if (excelVo != null) {Iterator<ExamExcelVo> iterator = excelVo.iterator();while (iterator.hasNext()) {ExamExcelVo next = iterator.next();if (isAllFieldNull(next)) {iterator.remove();}}}}/***  获取表头集合* @param t* @param objmap* @return*/public Map<String, Integer> getFieldAnnotations(Class t, Map<String, Integer> objmap) {try {Map<String, Integer> heads = new LinkedHashMap<>();Field[] fields = t.getDeclaredFields();for (Field field : fields) {ExcelProperty excelpro = (ExcelProperty) field.getAnnotation(ExcelProperty.class);heads.put(excelpro.value()[0], excelpro.index());
//                heads.add(excelpro.value()[0]);objmap.put(field.getName(), excelpro.index());}return heads;} catch (Exception e) {e.printStackTrace();}return null;}

模版导入返回带批注的错误信息方法

    public R<?> importExams(List<ExamExcelVo> excelVo) {List<List<Object>> errorList = new ArrayList<List<Object>>();eliminateNullList(excelVo);try {List<ErrorTypeNewVo> errorListVo = new ArrayList<>();Map<String, Integer> objmap = new LinkedHashMap<>();Map<String, Integer> heads = getFieldAnnotations(ExamExcelVo.class, objmap);for (int i = 0; i < excelVo.size(); i++) {List<ErrorTypeNewVo> errorTypeVos = new ArrayList<ErrorTypeNewVo>();ExamExcelVo vo = excelVo.get(i);String questionStem = vo.getQuestionStem();ExaminationQuestion question = new ExaminationQuestion();if (StrUtil.isEmpty(questionStem)) {errorTypeVos.add(new ErrorTypeNewVo("题目内容为空", "请重新填写", errorList.size() + 1, heads.get("考试题目")));} else {question.setQuestionStem(questionStem);}//.......等等等等判断if (CollUtil.isEmpty(errorTypeVos)) {//没有错误信息操作.......} else {//有错误信息操作List<Object> o = new ArrayList<>();Map<String, Object> map = BeanUtil.beanToMap(vo);for (Map.Entry<String, Integer> entry : objmap.entrySet()) {if (map.get(entry.getKey()) != null) {o.add(map.get(entry.getKey()));} else {o.add("");}}errorList.add(o);errorListVo.addAll(errorTypeVos);}}if (errorListVo.size() > 0) {//生成错误文件String XSSFSheetName = "导入错误信息" + System.currentTimeMillis();List<String> collect = heads.keySet().stream().collect(Collectors.toList());//调用上方导出方法String BUCKET_NAME = newCreateExcelTemple_Object(XSSFSheetName, collect, errorList, errorListVo);return 导入有错误信息;}} catch (Exception e) {e.printStackTrace();}return 导入成功信息;}

导入接口示例:

    @ApiOperation("批量导入试题")@PostMapping(value = "/importExams")public 返回参数 importExams(@RequestExcel List<ExamExcelVo> excelVo) {return importExams(excelVo);}

相关文章:

记一个带批注、表头样式的导入导出excel方法(基于easyexcel)

技术栈&#xff1a;easyexcel-2.2.10&#xff0c;poi-4.1.2&#xff0c;lombok&#xff0c;hutool-5.8.19&#xff1b;公司自用导入导出方法&#xff0c;可能不是那么的优雅&#xff0c;但胜在稳定实用。 /*** Author 955* Date 2023-10-10 11:52* Description 错误批注信息对…...

二叉搜索树--新增节点-力扣 701 题

例题细节二叉搜索树的基础操作-CSDN博客也讲过了&#xff08;put&#xff09;&#xff0c;下面给出递归实现 public TreeNode insertIntoBST(TreeNode node, int val) {//找到空位了if(node null) {return new TreeNode(val);}if(val < node.val) {//一直找到有null的位置…...

C++ - 智能指针 - auto_ptr - unique_ptr - std::shared_ptr - weak_ptr

前言 C当中的内存管理机制需要我们自己来进行控制&#xff0c;比如 在堆上 new 了一块空间&#xff0c;那么当这块空间不需要再使用的时候。我们需要手动 delete 掉这块空间&#xff0c;我们不可能每一次都会记得&#xff0c;而且在很大的项目程序当中&#xff0c;造成内存泄漏…...

【快速入门】JVM之类加载机制与Native

感慨&#xff1a; 如何定义一个合格的Java程序员&#xff0c;Java程序员要了解掌握哪些知识点&#xff0c;网上的面试题太多了&#xff0c;后端需要了解掌握的知识点太多太多了&#xff0c;Java基础、数据结构、异常、多线程、Spring、Spring boot、事务、算法、数据库&#xf…...

R实现数据分布特征的视觉化——多笔数据之间的比较

大家好&#xff0c;我是带我去滑雪&#xff01; 如果要对两笔数据或者多笔数据的分布情况进行比较&#xff0c;Q-Q图、柱状图、星形图都是非常好的选择&#xff0c;下面开始实战。 &#xff08;1&#xff09;绘制Q-Q图 首先导入数据bankwage.csv文件&#xff0c;该数据集…...

TCPUDP

TCP 1.什么是TCP TCP是处于运输层的通信协议&#xff0c;该协议能够实现数据的可靠性传输。 2.TCP报文格式 源端口和目的端口&#xff1a;各占两个字节&#xff0c;发送进程的端口和接收进程的端口号。 序号&#xff1a;占4个字节,序号如果增加到溢出&#xff0c;则下一个序…...

设计模式 - 备忘录模式

目录 一. 前言 二. 实现 三. 优缺点 一. 前言 备忘录模式又称快照模式&#xff0c;是一种行为型设计模式。它可以在不破坏封装性的前提下捕获一个对象的内部状态&#xff0c;并在对象之外保存这个状态&#xff0c;以便在需要的时候恢复到原先保存的状态。在不违反封装的情况…...

OpenCV4(C++)—— 几何图形的绘制

文章目录 一、基本图形1、线2、线圆3、线椭圆4、矩形 二、多边形 一、基本图形 1、线 绘制线&#xff0c;要给出两个点坐标 void cv::line(InputOutputArray img, Point pt1, Point pt2, const Scalar& color, int thickness 1, int lineType LINE_8, int shift 0);…...

智能优化算法常用指标一键导出为EXCEL,CEC2017函数集最优值,平均值,标准差,最差值,中位数,秩和检验,箱线图...

声明&#xff1a;对于作者的原创代码&#xff0c;禁止转售倒卖&#xff0c;违者必究&#xff01; 之前出了一篇关于CEC2005函数集的智能算法指标一键统计&#xff0c;然而后台有很多小伙伴在询问其他函数集该怎么调用。今天采用CEC2017函数集为例&#xff0c;进行展示。 为了突…...

python文件打包方式汇总

在Python中&#xff0c;你可以使用多种方法来打包你的项目&#xff0c;以下是最常见的两种方式&#xff1a; 使用PyInstaller&#xff1a; PyInstaller是一个非常实用的工具&#xff0c;可以将Python程序打包成独立的可执行文件。这样&#xff0c;你就可以在没有Python环境的…...

基于ChatGPT+词向量/词嵌入实现相似商品推荐系统

最近一个项目有个业务场景是相似商品推荐&#xff0c;给一个商品描述(比如 WIENER A/B 7IN 5/LB FZN )&#xff0c;系统给出商品库中最相似的TOP 5种商品&#xff0c;这种单纯的推荐系统用词向量就可以实现&#xff0c;不过&#xff0c;这个项目特点是商品库巨大&#xff0c;有…...

虾皮商品链接获取虾皮商品详情数据(用 Python实现虾皮商品信息抓取)

在网页抓取方面&#xff0c;可以使用 Python、Java 等编程语言编写程序&#xff0c;通过模拟 HTTP 请求&#xff0c;获取虾皮网站上的商品页面。在数据提取方面&#xff0c;可以使用正则表达式、XPath 等方式从 HTML 代码中提取出有用的信息。值得注意的是&#xff0c;虾皮网站…...

【数据库系统概论】数据查询之单表查询。详细解释WHERE、OEDER BY、GROUP BY 和 HAVING

前言 ❓单表查询选择表中的若干列查询经过计算的值选择表中的若干元组&#xff08;行&#xff09;消除取值重复的行查询满足条件的元组&#xff08;WHERE&#xff09; 对查询结果排序&#xff08;ORDER BY&#xff09;聚集函数对查询结果分组&#xff08;GROUP BY&#xff09; …...

2023年医药商业行业发展研究报告

第一章 行业概况 1.1 定义 医药商业行业&#xff0c;作为医药领域的重要组成部分&#xff0c;扮演着至关重要的角色。这一行业专注于医药商品的经营与流通&#xff0c;确保药品能够有效、安全地到达消费者手中。随着医药科技的进步和市场需求的增长&#xff0c;医药商业行业在…...

Android 消息机制

Android 消息机制 Android 的消息机制也是Handler机制&#xff0c;主要作用是用来在不同线程之间通信&#xff0c;通常使用在子线程执行完成一些儿耗时操作&#xff0c;需要回到主线程更新UI时&#xff0c;通过Handler将有关UI操作切换到主线程。由于Android中主线程不可进行耗…...

QT计时器QTime的使用举例

Qt 中的计时器&#xff08;QTimer&#xff09;是一种用于执行定时操作的机制。您可以使用 QTimer 来执行周期性任务、在一段时间后执行操作或创建间隔定时器。以下是使用 QTimer 的基本步骤以及一个简单的示例&#xff1a; **包含头文件&#xff1a;**首先&#xff0c;确保您的…...

js中await用法

在JavaScript中&#xff0c;await用于暂停异步函数执行&#xff0c;等待Promise对象的解决。当Promise对象解决时&#xff0c;await将返回被解决的值&#xff0c;否则它将抛出一个被拒绝的Promise错误。 下面是一些使用await的例子&#xff1a; 使用await等待一个Promise对象…...

Qt多工程同名字段自动翻译工具

开发背景 项目里不同工程经常会引用同一批公共类&#xff0c;这些类里如果有字段需要翻译&#xff0c;需要在不同的项目里都翻译一遍&#xff0c;比较麻烦冗余。 特此开发了这个小翻译工具&#xff0c;能读取程序目录下的所有ts文件&#xff0c;以类名归类&#xff0c;不同项目…...

vue3+elementui实现表格样式可配置

后端接口传回的数据格式如下图 需要依靠后端传回的数据控制表格样式 实现代码 <!-- 可视化配置-表格 --> <template><div class"tabulation_main" ref"myDiv"><!-- 尝试过在mounted中使用this.$refs.myDiv.offsetHeight,获取父元素…...

x11截屏源码(ubuntu18.04)

使用x11库实现截屏并保存为png图片 【shot.c】 // filename: shot.c #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xatom.h> #include <X11/cursorfont.h> #include <png.h> #include <stdio.h> #include <stdlib.h>…...

谷歌浏览器插件

项目中有时候会用到插件 sync-cookie-extension1.0.0&#xff1a;开发环境同步测试 cookie 至 localhost&#xff0c;便于本地请求服务携带 cookie 参考地址&#xff1a;https://juejin.cn/post/7139354571712757767 里面有源码下载下来&#xff0c;加在到扩展即可使用FeHelp…...

MPNet:旋转机械轻量化故障诊断模型详解python代码复现

目录 一、问题背景与挑战 二、MPNet核心架构 2.1 多分支特征融合模块(MBFM) 2.2 残差注意力金字塔模块(RAPM) 2.2.1 空间金字塔注意力(SPA) 2.2.2 金字塔残差块(PRBlock) 2.3 分类器设计 三、关键技术突破 3.1 多尺度特征融合 3.2 轻量化设计策略 3.3 抗噪声…...

RocketMQ延迟消息机制

两种延迟消息 RocketMQ中提供了两种延迟消息机制 指定固定的延迟级别 通过在Message中设定一个MessageDelayLevel参数&#xff0c;对应18个预设的延迟级别指定时间点的延迟级别 通过在Message中设定一个DeliverTimeMS指定一个Long类型表示的具体时间点。到了时间点后&#xf…...

脑机新手指南(八):OpenBCI_GUI:从环境搭建到数据可视化(下)

一、数据处理与分析实战 &#xff08;一&#xff09;实时滤波与参数调整 基础滤波操作 60Hz 工频滤波&#xff1a;勾选界面右侧 “60Hz” 复选框&#xff0c;可有效抑制电网干扰&#xff08;适用于北美地区&#xff0c;欧洲用户可调整为 50Hz&#xff09;。 平滑处理&…...

Debian系统简介

目录 Debian系统介绍 Debian版本介绍 Debian软件源介绍 软件包管理工具dpkg dpkg核心指令详解 安装软件包 卸载软件包 查询软件包状态 验证软件包完整性 手动处理依赖关系 dpkg vs apt Debian系统介绍 Debian 和 Ubuntu 都是基于 Debian内核 的 Linux 发行版&#xff…...

多模态商品数据接口:融合图像、语音与文字的下一代商品详情体验

一、多模态商品数据接口的技术架构 &#xff08;一&#xff09;多模态数据融合引擎 跨模态语义对齐 通过Transformer架构实现图像、语音、文字的语义关联。例如&#xff0c;当用户上传一张“蓝色连衣裙”的图片时&#xff0c;接口可自动提取图像中的颜色&#xff08;RGB值&…...

基于 TAPD 进行项目管理

起因 自己写了个小工具&#xff0c;仓库用的Github。之前在用markdown进行需求管理&#xff0c;现在随着功能的增加&#xff0c;感觉有点难以管理了&#xff0c;所以用TAPD这个工具进行需求、Bug管理。 操作流程 注册 TAPD&#xff0c;需要提供一个企业名新建一个项目&#…...

Go语言多线程问题

打印零与奇偶数&#xff08;leetcode 1116&#xff09; 方法1&#xff1a;使用互斥锁和条件变量 package mainimport ("fmt""sync" )type ZeroEvenOdd struct {n intzeroMutex sync.MutexevenMutex sync.MutexoddMutex sync.Mutexcurrent int…...

【SpringBoot自动化部署】

SpringBoot自动化部署方法 使用Jenkins进行持续集成与部署 Jenkins是最常用的自动化部署工具之一&#xff0c;能够实现代码拉取、构建、测试和部署的全流程自动化。 配置Jenkins任务时&#xff0c;需要添加Git仓库地址和凭证&#xff0c;设置构建触发器&#xff08;如GitHub…...

【Linux手册】探秘系统世界:从用户交互到硬件底层的全链路工作之旅

目录 前言 操作系统与驱动程序 是什么&#xff0c;为什么 怎么做 system call 用户操作接口 总结 前言 日常生活中&#xff0c;我们在使用电子设备时&#xff0c;我们所输入执行的每一条指令最终大多都会作用到硬件上&#xff0c;比如下载一款软件最终会下载到硬盘上&am…...