|
@@ -444,10 +444,11 @@ public class IotOpeationFillController {
|
|
|
// 累加:从缓存获取历史最大值
|
|
// 累加:从缓存获取历史最大值
|
|
|
String key = fill.getDeviceId() + "_" + fill.getPointName();
|
|
String key = fill.getDeviceId() + "_" + fill.getPointName();
|
|
|
BigDecimal maxHistory = maxDataMap.getOrDefault(key, BigDecimal.ZERO);
|
|
BigDecimal maxHistory = maxDataMap.getOrDefault(key, BigDecimal.ZERO);
|
|
|
- total = maxHistory.add(currentValue);
|
|
|
|
|
- } else if (fill.getSumId() == 0) {
|
|
|
|
|
- // 直接赋值
|
|
|
|
|
- total = currentValue;
|
|
|
|
|
|
|
+ if(maxHistory!=null) {
|
|
|
|
|
+ total = maxHistory.add(currentValue);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ total = fill.getTotalRunTime().add(new BigDecimal(fill.getFillContent()));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
fill.setTotalRunTime(total);
|
|
fill.setTotalRunTime(total);
|
|
@@ -603,16 +604,19 @@ public class IotOpeationFillController {
|
|
|
|
|
|
|
|
// 3. 批量执行(MyBatis批量操作)
|
|
// 3. 批量执行(MyBatis批量操作)
|
|
|
if (!insertList.isEmpty()) {
|
|
if (!insertList.isEmpty()) {
|
|
|
|
|
+ System.out.println("执行了插入");
|
|
|
TenantUtils.execute(1L, () -> {
|
|
TenantUtils.execute(1L, () -> {
|
|
|
iotOpeationFillService.batchInsertLogs(insertList); // 批量插入
|
|
iotOpeationFillService.batchInsertLogs(insertList); // 批量插入
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
if (!updateList.isEmpty()) {
|
|
if (!updateList.isEmpty()) {
|
|
|
|
|
+ System.out.println("执行了更新");
|
|
|
TenantUtils.execute(1L, () -> {
|
|
TenantUtils.execute(1L, () -> {
|
|
|
iotOpeationFillService.batchUpdateLogs(updateList); // 批量更新普通日志
|
|
iotOpeationFillService.batchUpdateLogs(updateList); // 批量更新普通日志
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
if (!updateSumList.isEmpty()) {
|
|
if (!updateSumList.isEmpty()) {
|
|
|
|
|
+ System.out.println("执行了累计更新");
|
|
|
TenantUtils.execute(1L, () -> {
|
|
TenantUtils.execute(1L, () -> {
|
|
|
iotOpeationFillService.batchUpdateSumLogs(updateSumList); // 批量更新累计日志
|
|
iotOpeationFillService.batchUpdateSumLogs(updateSumList); // 批量更新累计日志
|
|
|
});
|
|
});
|