|
|
@@ -626,18 +626,51 @@ public class IotOpeationFillController {
|
|
|
// 3. 批量执行(MyBatis批量操作)
|
|
|
if (!insertList.isEmpty()) {
|
|
|
System.out.println("执行了插入");
|
|
|
+ // 方式B:带索引遍历(方便定位第几个元素有问题)
|
|
|
+ System.out.println("===== insertList 详细元素(带索引) =====");
|
|
|
+ for (int i = 0; i < insertList.size(); i++) {
|
|
|
+ IotDeviceRunLogDO log = insertList.get(i);
|
|
|
+ System.out.printf("第 %d 个元素:deviceId=%s, pointName=%s, createTime=%s%n",
|
|
|
+ i + 1,
|
|
|
+ log.getDeviceId(),
|
|
|
+ log.getPointName(),
|
|
|
+ log.getCreateTime() // 若为Date类型,建议格式化:sdf.format(log.getCreateTime())
|
|
|
+ );
|
|
|
+ }
|
|
|
TenantUtils.execute(1L, () -> {
|
|
|
iotOpeationFillService.batchInsertLogs(insertList); // 批量插入
|
|
|
});
|
|
|
}
|
|
|
if (!updateList.isEmpty()) {
|
|
|
System.out.println("执行了更新");
|
|
|
+ // 方式B:带索引遍历(方便定位第几个元素有问题)
|
|
|
+ System.out.println("===== insertList 详细元素(带索引) =====");
|
|
|
+ for (int i = 0; i < updateList.size(); i++) {
|
|
|
+ IotDeviceRunLogDO log = updateList.get(i);
|
|
|
+ System.out.printf("第 %d 个元素:deviceId=%s, pointName=%s, createTime=%s%n",
|
|
|
+ i + 1,
|
|
|
+ log.getDeviceId(),
|
|
|
+ log.getPointName(),
|
|
|
+ log.getCreateTime() // 若为Date类型,建议格式化:sdf.format(log.getCreateTime())
|
|
|
+ );
|
|
|
+ }
|
|
|
TenantUtils.execute(1L, () -> {
|
|
|
iotOpeationFillService.batchUpdateLogs(updateList); // 批量更新普通日志
|
|
|
});
|
|
|
}
|
|
|
if (!updateSumList.isEmpty()) {
|
|
|
System.out.println("执行了累计更新");
|
|
|
+ // 方式B:带索引遍历(方便定位第几个元素有问题)
|
|
|
+ System.out.println("===== updateSumList 详细元素(带索引) =====");
|
|
|
+ for (int i = 0; i < updateSumList.size(); i++) {
|
|
|
+ IotDeviceRunLogDO log = updateSumList.get(i);
|
|
|
+ System.out.printf("第 %d 个元素:deviceId=%s, pointName=%s, createTime=%s%n",
|
|
|
+ i + 1,
|
|
|
+ log.getDeviceId(),
|
|
|
+ log.getPointName(),
|
|
|
+ log.getCreateTime() // 若为Date类型,建议格式化:sdf.format(log.getCreateTime())
|
|
|
+ );
|
|
|
+ }
|
|
|
TenantUtils.execute(1L, () -> {
|
|
|
iotOpeationFillService.batchUpdateSumLogs(updateSumList); // 批量更新累计日志
|
|
|
});
|