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

关于EasyExcel导入数据时表格日期格式识别为数字问题

参考官方地址

自定义日期转字符串转换器

/*** 自定义excel日期转换器** @author li* @date 2024-05-29*/
public class CustomStringDateConverter implements Converter<String> {@Overridepublic Class<?> supportJavaTypeKey() {return String.class;}@Overridepublic CellDataTypeEnum supportExcelTypeKey() {return CellDataTypeEnum.STRING;}/*** 读调用*/@Overridepublic String convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {Date date = null;//单元格格式为 文本类型if (CellDataTypeEnum.STRING.equals(cellData.getType())) {date = DateTimeUtil.parseMatched(cellData.getStringValue());if(date==null){throw new DmeoException("日期数据解析失败,请检查导入模板数据");}}//单元格格式为标准日期类型try {if (CellDataTypeEnum.NUMBER.equals(cellData.getType())) {if (contentProperty == null || contentProperty.getDateTimeFormatProperty() == null) {date = DateUtils.getJavaDate(cellData.getNumberValue().doubleValue(),globalConfiguration.getUse1904windowing());} else {date = DateUtils.getJavaDate(cellData.getNumberValue().doubleValue(),contentProperty.getDateTimeFormatProperty().getUse1904windowing());}}} catch (Exception e) {throw new DmeoException("日期数据解析失败,请检查导入模板数据");}return DateTimeUtil.format(date, FORMAT_SHORT);}/*** 写调用*/@Overridepublic WriteCellData<?> convertToExcelData(WriteConverterContext<String> context) {return new WriteCellData<>(context.getValue());}}
   @ExcelProperty(value = "日期",converter = CustomStringDateConverter.class)

控制层异常捕获,需要使用 e.getCause().getMessage()才能取到自己抛出的异常信息

       catch (ExcelDataConvertException e) {String msg = "第" + e.getRowIndex() + "行,第" + e.getColumnIndex() + "列"+e.getCause().getMessage()+"," +"解析字符数据为:"+ e.getCellData().getStringValue();} 

官方日期工具类

import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Pattern;import com.alibaba.excel.util.BooleanUtils;
import com.alibaba.excel.util.MapUtils;
import org.apache.poi.ss.usermodel.DateUtil;
import org.springframework.util.StringUtils;/*** 官方日期工具类***/
public class DateUtils {/*** Is a cache of dates*/private static final ThreadLocal<Map<Short, Boolean>> DATE_THREAD_LOCAL =new ThreadLocal<>();/*** Is a cache of dates*/private static final ThreadLocal<Map<String, SimpleDateFormat>> DATE_FORMAT_THREAD_LOCAL =new ThreadLocal<>();/*** The following patterns are used in {@link #isADateFormat(Short, String)}*/private static final Pattern date_ptrn1 = Pattern.compile("^\\[\\$\\-.*?\\]");private static final Pattern date_ptrn2 = Pattern.compile("^\\[[a-zA-Z]+\\]");private static final Pattern date_ptrn3a = Pattern.compile("[yYmMdDhHsS]");// add "\u5e74 \u6708 \u65e5" for Chinese/Japanese date format:2017 \u5e74 2 \u6708 7 \u65e5private static final Pattern date_ptrn3b =Pattern.compile("^[\\[\\]yYmMdDhHsS\\-T/\u5e74\u6708\u65e5,. :\"\\\\]+0*[ampAMP/]*$");// elapsed time patterns: [h],[m] and [s]private static final Pattern date_ptrn4 = Pattern.compile("^\\[([hH]+|[mM]+|[sS]+)\\]");// for format which start with "[DBNum1]" or "[DBNum2]" or "[DBNum3]" could be a Chinese dateprivate static final Pattern date_ptrn5 = Pattern.compile("^\\[DBNum(1|2|3)\\]");// for format which start with "年" or "月" or "日" or "时" or "分" or "秒" could be a Chinese dateprivate static final Pattern date_ptrn6 = Pattern.compile("(年|月|日|时|分|秒)+");public static final String DATE_FORMAT_10 = "yyyy-MM-dd";public static final String DATE_FORMAT_14 = "yyyyMMddHHmmss";public static final String DATE_FORMAT_16 = "yyyy-MM-dd HH:mm";public static final String DATE_FORMAT_16_FORWARD_SLASH = "yyyy/MM/dd HH:mm";public static final String DATE_FORMAT_17 = "yyyyMMdd HH:mm:ss";public static final String DATE_FORMAT_19 = "yyyy-MM-dd HH:mm:ss";public static final String DATE_FORMAT_19_FORWARD_SLASH = "yyyy/MM/dd HH:mm:ss";private static final String MINUS = "-";public static String defaultDateFormat = DATE_FORMAT_19;public static String defaultLocalDateFormat = DATE_FORMAT_10;private DateUtils() {}/*** convert string to date** @param dateString* @param dateFormat* @return* @throws ParseException*/public static Date parseDate(String dateString, String dateFormat) throws ParseException {if (StringUtils.isEmpty(dateFormat)) {dateFormat = switchDateFormat(dateString);}return getCacheDateFormat(dateFormat).parse(dateString);}/*** convert string to date** @param dateString* @param dateFormat* @param local* @return*/public static LocalDateTime parseLocalDateTime(String dateString, String dateFormat, Locale local) {if (StringUtils.isEmpty(dateFormat)) {dateFormat = switchDateFormat(dateString);}if (local == null) {return LocalDateTime.parse(dateString, DateTimeFormatter.ofPattern(dateFormat));} else {return LocalDateTime.parse(dateString, DateTimeFormatter.ofPattern(dateFormat, local));}}/*** convert string to date** @param dateString* @param dateFormat* @param local* @return*/public static LocalDate parseLocalDate(String dateString, String dateFormat, Locale local) {if (StringUtils.isEmpty(dateFormat)) {dateFormat = switchDateFormat(dateString);}if (local == null) {return LocalDate.parse(dateString, DateTimeFormatter.ofPattern(dateFormat));} else {return LocalDate.parse(dateString, DateTimeFormatter.ofPattern(dateFormat, local));}}/*** convert string to date** @param dateString* @return* @throws ParseException*/public static Date parseDate(String dateString) throws ParseException {return parseDate(dateString, switchDateFormat(dateString));}/*** switch date format** @param dateString* @return*/public static String switchDateFormat(String dateString) {int length = dateString.length();switch (length) {case 19:if (dateString.contains(MINUS)) {return DATE_FORMAT_19;} else {return DATE_FORMAT_19_FORWARD_SLASH;}case 16:if (dateString.contains(MINUS)) {return DATE_FORMAT_16;} else {return DATE_FORMAT_16_FORWARD_SLASH;}case 17:return DATE_FORMAT_17;case 14:return DATE_FORMAT_14;case 10:return DATE_FORMAT_10;default:throw new IllegalArgumentException("can not find date format for:" + dateString);}}/*** Format date* <p>* yyyy-MM-dd HH:mm:ss** @param date* @return*/public static String format(Date date) {return format(date, null);}/*** Format date** @param date* @param dateFormat* @return*/public static String format(Date date, String dateFormat) {if (date == null) {return null;}if (StringUtils.isEmpty(dateFormat)) {dateFormat = defaultDateFormat;}return getCacheDateFormat(dateFormat).format(date);}/*** Format date** @param date* @param dateFormat* @return*/public static String format(LocalDateTime date, String dateFormat, Locale local) {if (date == null) {return null;}if (StringUtils.isEmpty(dateFormat)) {dateFormat = defaultDateFormat;}if (local == null) {return date.format(DateTimeFormatter.ofPattern(dateFormat));} else {return date.format(DateTimeFormatter.ofPattern(dateFormat, local));}}/*** Format date** @param date* @param dateFormat* @return*/public static String format(LocalDate date, String dateFormat) {return format(date, dateFormat, null);}/*** Format date** @param date* @param dateFormat* @return*/public static String format(LocalDate date, String dateFormat, Locale local) {if (date == null) {return null;}if (StringUtils.isEmpty(dateFormat)) {dateFormat = defaultLocalDateFormat;}if (local == null) {return date.format(DateTimeFormatter.ofPattern(dateFormat));} else {return date.format(DateTimeFormatter.ofPattern(dateFormat, local));}}/*** Format date** @param date* @param dateFormat* @return*/public static String format(LocalDateTime date, String dateFormat) {return format(date, dateFormat, null);}/*** Format date** @param date* @param dateFormat* @return*/public static String format(BigDecimal date, Boolean use1904windowing, String dateFormat) {if (date == null) {return null;}LocalDateTime localDateTime = DateUtil.getLocalDateTime(date.doubleValue(),BooleanUtils.isTrue(use1904windowing), true);return format(localDateTime, dateFormat);}private static DateFormat getCacheDateFormat(String dateFormat) {Map<String, SimpleDateFormat> dateFormatMap = DATE_FORMAT_THREAD_LOCAL.get();if (dateFormatMap == null) {dateFormatMap = new HashMap<String, SimpleDateFormat>();DATE_FORMAT_THREAD_LOCAL.set(dateFormatMap);} else {SimpleDateFormat dateFormatCached = dateFormatMap.get(dateFormat);if (dateFormatCached != null) {return dateFormatCached;}}SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);dateFormatMap.put(dateFormat, simpleDateFormat);return simpleDateFormat;}/*** Given an Excel date with either 1900 or 1904 date windowing,* converts it to a java.util.Date.** Excel Dates and Times are stored without any timezone* information. If you know (through other means) that your file* uses a different TimeZone to the system default, you can use* this version of the getJavaDate() method to handle it.** @param date             The Excel date.* @param use1904windowing true if date uses 1904 windowing,*                         or false if using 1900 date windowing.* @return Java representation of the date, or null if date is not a valid Excel date*/public static Date getJavaDate(double date, boolean use1904windowing) {//To calculate the Date, in the use of `org.apache.poi.ss.usermodel.DateUtil.getJavaDate(double, boolean,// java.util.TimeZone, boolean), Date when similar `2023-01-01 00:00:00.500`, returns the`2023-01-01// 00:00:01`, but excel in fact shows the `2023-01-01 00:00:00`.// `org.apache.poi.ss.usermodel.DateUtil.getLocalDateTime(double, boolean, boolean)` There is no problem.return Date.from(getLocalDateTime(date, use1904windowing).atZone(ZoneId.systemDefault()).toInstant());}/*** Given an Excel date with either 1900 or 1904 date windowing,* converts it to a java.time.LocalDateTime.** Excel Dates and Times are stored without any timezone* information. If you know (through other means) that your file* uses a different TimeZone to the system default, you can use* this version of the getJavaDate() method to handle it.** @param date             The Excel date.* @param use1904windowing true if date uses 1904 windowing,*                         or false if using 1900 date windowing.* @return Java representation of the date, or null if date is not a valid Excel date*/public static LocalDateTime getLocalDateTime(double date, boolean use1904windowing) {return DateUtil.getLocalDateTime(date, use1904windowing, true);}/*** Given an Excel date with either 1900 or 1904 date windowing,* converts it to a java.time.LocalDate.** Excel Dates and Times are stored without any timezone* information. If you know (through other means) that your file* uses a different TimeZone to the system default, you can use* this version of the getJavaDate() method to handle it.** @param date             The Excel date.* @param use1904windowing true if date uses 1904 windowing,*                         or false if using 1900 date windowing.* @return Java representation of the date, or null if date is not a valid Excel date*/public static LocalDate getLocalDate(double date, boolean use1904windowing) {LocalDateTime localDateTime = getLocalDateTime(date, use1904windowing);return localDateTime == null ? null : localDateTime.toLocalDate();}/*** Determine if it is a date format.** @param formatIndex* @param formatString* @return*/public static boolean isADateFormat(Short formatIndex, String formatString) {if (formatIndex == null) {return false;}Map<Short, Boolean> isDateCache = DATE_THREAD_LOCAL.get();if (isDateCache == null) {isDateCache = MapUtils.newHashMap();DATE_THREAD_LOCAL.set(isDateCache);} else {Boolean isDatecachedDataList = isDateCache.get(formatIndex);if (isDatecachedDataList != null) {return isDatecachedDataList;}}boolean isDate = isADateFormatUncached(formatIndex, formatString);isDateCache.put(formatIndex, isDate);return isDate;}/*** Determine if it is a date format.** @param formatIndex* @param formatString* @return*/public static boolean isADateFormatUncached(Short formatIndex, String formatString) {// First up, is this an internal date format?if (isInternalDateFormat(formatIndex)) {return true;}if (StringUtils.isEmpty(formatString)) {return false;}String fs = formatString;final int length = fs.length();StringBuilder sb = new StringBuilder(length);for (int i = 0; i < length; i++) {char c = fs.charAt(i);if (i < length - 1) {char nc = fs.charAt(i + 1);if (c == '\\') {switch (nc) {case '-':case ',':case '.':case ' ':case '\\':// skip current '\' and continue to the next charcontinue;}} else if (c == ';' && nc == '@') {i++;// skip ";@" dupletscontinue;}}sb.append(c);}fs = sb.toString();// short-circuit if it indicates elapsed time: [h], [m] or [s]if (date_ptrn4.matcher(fs).matches()) {return true;}// If it starts with [DBNum1] or [DBNum2] or [DBNum3]// then it could be a Chinese datefs = date_ptrn5.matcher(fs).replaceAll("");// If it starts with [$-...], then could be a date, but// who knows what that starting bit is all aboutfs = date_ptrn1.matcher(fs).replaceAll("");// If it starts with something like [Black] or [Yellow],// then it could be a datefs = date_ptrn2.matcher(fs).replaceAll("");// You're allowed something like dd/mm/yy;[red]dd/mm/yy// which would place dates before 1900/1904 in red// For now, only consider the first onefinal int separatorIndex = fs.indexOf(';');if (0 < separatorIndex && separatorIndex < fs.length() - 1) {fs = fs.substring(0, separatorIndex);}// Ensure it has some date letters in it// (Avoids false positives on the rest of pattern 3)if (!date_ptrn3a.matcher(fs).find()) {return false;}// If we get here, check it's only made up, in any case, of:// y m d h s - \ / , . : [ ] T// optionally followed by AM/PMboolean result = date_ptrn3b.matcher(fs).matches();if (result) {return true;}result = date_ptrn6.matcher(fs).find();return result;}/*** Given a format ID this will check whether the format represents an internal excel date format or not.** @see #isADateFormat(Short, String)*/public static boolean isInternalDateFormat(short format) {switch (format) {// Internal Date Formats as described on page 427 in// Microsoft Excel Dev's Kit...// 14-22case 0x0e:case 0x0f:case 0x10:case 0x11:case 0x12:case 0x13:case 0x14:case 0x15:case 0x16:// 27-36case 0x1b:case 0x1c:case 0x1d:case 0x1e:case 0x1f:case 0x20:case 0x21:case 0x22:case 0x23:case 0x24:// 45-47case 0x2d:case 0x2e:case 0x2f:// 50-58case 0x32:case 0x33:case 0x34:case 0x35:case 0x36:case 0x37:case 0x38:case 0x39:case 0x3a:return true;}return false;}public static void removeThreadLocalCache() {DATE_THREAD_LOCAL.remove();DATE_FORMAT_THREAD_LOCAL.remove();}
}

相关文章:

关于EasyExcel导入数据时表格日期格式识别为数字问题

参考官方地址 自定义日期转字符串转换器 /*** 自定义excel日期转换器** author li* date 2024-05-29*/ public class CustomStringDateConverter implements Converter<String> {Overridepublic Class<?> supportJavaTypeKey() {return String.class;}Overridep…...

高通Android 12/13打开省电模式宏开关

1、添加到SettingsProvider配置项宏开关 默认节电助手自动开启百分比battery saver frameworks\base\packages\SettingsProvider\src\com\android\providers\settings\DatabaseHelper.java private void loadGlobalSettings(SQLiteDatabase db) {在该方法中添加 ......final i…...

2023年西安交通大学校赛(E-雪中楼)

E.雪中楼 如果算出按南北的序列&#xff0c;再转成从低到高的编号序列&#xff0c;岂不是太麻烦了&#xff0c;幸好&#xff0c;没有在这方面费长时间&#xff0c;而是意识到&#xff0c;本质就是要从低到高的编号序列&#xff0c;所以我就按样例模拟了一下&#xff0c;当a[i]0…...

如何在vue2中使用tailwind

查看官方文档&#xff0c;不要去看过时的文章&#xff01; 使用官网推荐的第一个安装方法 Installation - Tailwind CSS vue版本&#xff1a;2.6.10 1. 安装tailwind的包 npm install -D tailwindcss npx tailwindcss init 2. tailwind.config.js 文件中的content是你需要…...

【OrangePi AIpro】开箱初体验以及OAK深度相机测试

1. 简介 Orangepi AIPRO 是一款采用昇腾AI技术路线&#xff0c;集成4核64位处理器AI处理器的单板计算机&#xff0c;集成图形处理器&#xff0c;支持8TOPS AI算力&#xff0c;拥有8GB/16GB LPDDR4X&#xff0c;可以外接eMMC模块&#xff0c;支持双4K高清输出。 Orange Pi AIpr…...

滑动窗口模板(Java)

题目描述 有一个长为 &#x1d45b; 的序列 &#x1d44e;&#xff0c;以及一个大小为 &#x1d458; 的窗口。现在这个从左边开始向右滑动&#xff0c;每次滑动一个单位&#xff0c;求出每次滑动后窗口中的最大值和最小值。 例如&#xff0c;对于序列 [1,3,−1,−3,5,3,6,7] …...

transformers.BertTokenizer入门使用

教程link 示例代码 from transformers import OpenAIGPTLMHeadModel, GPT2LMHeadModel, BertTokenizer import torch tokenizer BertTokenizer.from_pretrained("thu-coai/CDial-GPT_LCCC-large") model OpenAIGPTLMHeadModel.from_pretrained("thu-coai/CD…...

快乐数-力扣

使用一个set来存储遇到的每个数&#xff0c;如果遇到的数在set中&#xff0c;那么说明这个数不是快乐数&#xff0c;否则一直循环下去&#xff0c;直到n 1结束循环&#xff0c;表示这个数是个快乐数。 需要注意的是&#xff0c;给定一个数 n, 怎样对这个数 n 进行每一位求和。…...

Git标签的使用

天行健&#xff0c;君子以自强不息&#xff1b;地势坤&#xff0c;君子以厚德载物。 每个人都有惰性&#xff0c;但不断学习是好好生活的根本&#xff0c;共勉&#xff01; 文章均为学习整理笔记&#xff0c;分享记录为主&#xff0c;如有错误请指正&#xff0c;共同学习进步。…...

【uni-app】Pinia 持久化

小程序端 Pinia 持久化 说明&#xff1a;Pinia 用法与 Vue3 项目完全一致&#xff0c;uni-app 项目仅需解决持久化插件兼容性问题。 持久化存储插件 安装持久化存储插件&#xff1a; pinia-plugin-persistedstate pnpm i pinia-plugin-persistedstate插件默认使用 localStor…...

Flink 窗口

窗口&#xff08;Window&#xff09; 窗口是处理无限流的核心。 窗口将流分割成有限大小的“桶”&#xff0c;我们可以计算窗口中的数据。 窗口程序一般有键控流&#xff08;keyed streams&#xff09;的窗口程序 和 非键控流&#xff08;non-keyed streams&#xff09;的窗口…...

基于大模型和RAG技术实现的开源项目

基于大模型和RAG技术实现的开源项目 为解决大模型的不足&#xff0c;使用RAG技术增强大模型生成内容的针对性和可读性能力&#xff0c;有很多不错的开源项目。例如下面的项目。 1 ragflow 优点&#xff1a;可以对文档和知识库进行管理&#xff0c;构建不同的知识库&#xff…...

mac m1安装homebrew管理工具(brew命令)完整流程

背景 因为mac上的brew很久没用了&#xff0c;版本非常旧&#xff0c;随着mac os的更新&#xff0c;本机的homebrew大部分的功能都无法使用&#xff0c;幸好过去通过brew安装的工具比较少&#xff0c;于是决定重新安装一遍brew。 卸载旧版brew 法一&#xff1a;通过使用线上…...

Liunx学习随笔

Linux学习随笔 Linux学习随笔一.前期准备1.安装Vmware Workstation软件2.下载linux镜像3.安装操作系统4.配置静态ip5.下载安装远程连接工具 二.语法2.1 linux哲学思想(原则)2.2 小命令 夕阳无限好&#xff0c;只是近黄昏&#xff0c;时隔一年&#xff0c;重新提笔 没有比脚更远…...

mac中文件夹怎么显示.git隐藏文件

1. 打开终端应用程序&#xff0c;然后进入到包含.git文件夹的目录&#xff0c;可以使用以下命令来显示隐藏文件和文件夹&#xff1a; defaults write com.apple.finder AppleShowAllFiles YES 2. 然后重启 Finder&#xff1a; killall Finder...

【PB案例学习笔记】-13 徒手做个电子时钟

写在前面 这是PB案例学习笔记系列文章的第11篇&#xff0c;该系列文章适合具有一定PB基础的读者。 通过一个个由浅入深的编程实战案例学习&#xff0c;提高编程技巧&#xff0c;以保证小伙伴们能应付公司的各种开发需求。 文章中设计到的源码&#xff0c;小凡都上传到了gite…...

Java多线程——线程强制执行

Join合并线程&#xff0c;待此线程执行完成后&#xff0c;再执行其他线程&#xff0c;其他线程阻塞。 可以想象成插队。 代码演示&#xff1a; //测试Join方法 //想象为插队 public class TestJoin implements Runnable{Overridepublic void run() {for (int i 0; i < 1…...

虹科Pico汽车示波器 | 免拆诊断案例 | 2017款奔驰E300L车行驶中发动机偶尔无法加速

故障现象 一辆2017款奔驰E300L车&#xff0c;搭载274 920发动机&#xff0c;累计行驶里程约为21万km。车主反映&#xff0c;该车行驶中发动机偶尔无法加速&#xff0c;且车辆发闯。 故障诊断 用故障检测仪检测&#xff0c;发动机控制单元&#xff08;N3/10&#xff09;中存储…...

华发股份:加强业务协同 新政下项目热销

“5.17”楼市政策出台后&#xff0c;各地密集落地执行。5月27—28日&#xff0c;上海、广州、深圳三个一线城市跟进落地“517”新政。上海发布《关于优化本市房地产市场平稳健康发展政策措施的通知》&#xff0c;共计9条调整政策&#xff0c;涵盖外地户籍、人才、单身、婚否、企…...

RedHat9网络配置设计

目录 一、实验目的 二、实验过程 1、配置新网络接口 2、多网卡配置网络 3、网络接口的绑定&#xff0c;进行远程访问 4、配置网络接口的组合 一、实验目的 本次实验的目的是使用nmcli命令工具配置网络&#xff0c;ens160配置多个网卡&#xff0c;进行网络接口的绑定与组合…...

国防科技大学计算机基础课程笔记02信息编码

1.机内码和国标码 国标码就是我们非常熟悉的这个GB2312,但是因为都是16进制&#xff0c;因此这个了16进制的数据既可以翻译成为这个机器码&#xff0c;也可以翻译成为这个国标码&#xff0c;所以这个时候很容易会出现这个歧义的情况&#xff1b; 因此&#xff0c;我们的这个国…...

stm32G473的flash模式是单bank还是双bank?

今天突然有人stm32G473的flash模式是单bank还是双bank&#xff1f;由于时间太久&#xff0c;我真忘记了。搜搜发现&#xff0c;还真有人和我一样。见下面的链接&#xff1a;https://shequ.stmicroelectronics.cn/forum.php?modviewthread&tid644563 根据STM32G4系列参考手…...

(十)学生端搭建

本次旨在将之前的已完成的部分功能进行拼装到学生端&#xff0c;同时完善学生端的构建。本次工作主要包括&#xff1a; 1.学生端整体界面布局 2.模拟考场与部分个人画像流程的串联 3.整体学生端逻辑 一、学生端 在主界面可以选择自己的用户角色 选择学生则进入学生登录界面…...

简易版抽奖活动的设计技术方案

1.前言 本技术方案旨在设计一套完整且可靠的抽奖活动逻辑,确保抽奖活动能够公平、公正、公开地进行,同时满足高并发访问、数据安全存储与高效处理等需求,为用户提供流畅的抽奖体验,助力业务顺利开展。本方案将涵盖抽奖活动的整体架构设计、核心流程逻辑、关键功能实现以及…...

STM32F4基本定时器使用和原理详解

STM32F4基本定时器使用和原理详解 前言如何确定定时器挂载在哪条时钟线上配置及使用方法参数配置PrescalerCounter ModeCounter Periodauto-reload preloadTrigger Event Selection 中断配置生成的代码及使用方法初始化代码基本定时器触发DCA或者ADC的代码讲解中断代码定时启动…...

React Native在HarmonyOS 5.0阅读类应用开发中的实践

一、技术选型背景 随着HarmonyOS 5.0对Web兼容层的增强&#xff0c;React Native作为跨平台框架可通过重新编译ArkTS组件实现85%以上的代码复用率。阅读类应用具有UI复杂度低、数据流清晰的特点。 二、核心实现方案 1. 环境配置 &#xff08;1&#xff09;使用React Native…...

spring:实例工厂方法获取bean

spring处理使用静态工厂方法获取bean实例&#xff0c;也可以通过实例工厂方法获取bean实例。 实例工厂方法步骤如下&#xff1a; 定义实例工厂类&#xff08;Java代码&#xff09;&#xff0c;定义实例工厂&#xff08;xml&#xff09;&#xff0c;定义调用实例工厂&#xff…...

从零开始打造 OpenSTLinux 6.6 Yocto 系统(基于STM32CubeMX)(九)

设备树移植 和uboot设备树修改的内容同步到kernel将设备树stm32mp157d-stm32mp157daa1-mx.dts复制到内核源码目录下 源码修改及编译 修改arch/arm/boot/dts/st/Makefile&#xff0c;新增设备树编译 stm32mp157f-ev1-m4-examples.dtb \stm32mp157d-stm32mp157daa1-mx.dtb修改…...

论文解读:交大港大上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化学习框架(一)

宇树机器人多姿态起立控制强化学习框架论文解析 论文解读&#xff1a;交大&港大&上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化学习框架&#xff08;一&#xff09; 论文解读&#xff1a;交大&港大&上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化…...

Unit 1 深度强化学习简介

Deep RL Course ——Unit 1 Introduction 从理论和实践层面深入学习深度强化学习。学会使用知名的深度强化学习库&#xff0c;例如 Stable Baselines3、RL Baselines3 Zoo、Sample Factory 和 CleanRL。在独特的环境中训练智能体&#xff0c;比如 SnowballFight、Huggy the Do…...