spring - 如何使用弹簧批处理在不同的文件中写入 csv,具体取决于时间
问题描述
我有一个非常大的 csv 文件,这使我的作业运行到 30 分钟。我的数据来自纯云。我需要根据时间字段 (2021-03-10T11:44:01.781Z) 的值在三个不同的时间段内编写它:00-10、10-14、14-23 小时。
这是文件中的一行:
b1df888d-bebe-4a0b-a44a-0b891c660586;tAlert;205;2021-03-10T11:44:01.781Z
我使用这样的 tasklet 块运行:
<step id="step1">
<tasklet>
<chunk reader="itemReader" writer="testCompositeWriter"
commit-interval="1">
</chunk>
</tasklet>
</step>
在阅读器中,我正在做这样的事情:
fecha = obtenerFechaFin(i).split("T"); //2021-03-07T07:19:18.051Z string DATE
horas = fecha[1]; //07:19:18.051Z string HOURS
horaIntervalo = horas.split(":");
hora = horaIntervalo[0]; //07 string
horaInt = Integer.parseInt(hora); //07 int HOUR
if (horaInt >= 00 && horaInt < 10){
lisConversationOutBackup.addAll(generarSalida(conversationsOut.getConversations()));
}
if (horaInt >= 10 && horaInt < 14){
}
if (horaInt >= 14 && horaInt < 23){
}
“commit-interval”或任何其他句子可以做到这一点吗?
解决方案
推荐阅读
- angular - 从 HttpInterceptor 中的 catchError 返回可观察到的已捕获错误会导致错误循环
- html - Flexbox 内容在表格中有一个像素偏移
- sql-server - 在 SQL 中获取具有连续月份范围的行
- javascript - 转换表单编号字段值结构
- python - 如何使 Django 数据库缓存的条目过期?
- python - 试图制作函数来获取最大行数 Pygame
- javascript - 如何从 React 组件中提取通用逻辑(但通用逻辑是使用 setState)
- ios - 滚动时电子节目指南视图如何更新?
- javascript - 所需的功能是 javascriptenabled 已弃用。我们如何使用 Internet Explorer 驱动程序 selenium 中启用的 java 脚本
- jsgrid - jsGrid不显示表格