|
|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.dongjian.dashboard.back.service.impl; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.net.URLDecoder; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.time.LocalDate; |
|
|
|
@ -28,6 +29,7 @@ import com.dongjian.dashboard.back.util.DateUtil; |
|
|
|
import com.dongjian.dashboard.back.vo.data.DeviceAccumulateData; |
|
|
|
import com.dongjian.dashboard.back.vo.device.DeviceIncrement; |
|
|
|
import com.dongjian.dashboard.back.vo.device.LineData; |
|
|
|
import com.dongjian.dashboard.back.vo.record.RecordAccumulateDto; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
|
@ -146,10 +148,17 @@ public class DeviceDataAccumulateServiceImpl implements DeviceDataAccumulateServ |
|
|
|
// 批量查询增量数据并构建 Map
|
|
|
|
Map<String, DeviceIncrement> todayMap = dashboardRecordAccumulateMapperExt.selectTodayIncrement(todayDeviceIds, today.getYear(), today.getMonthValue(), today.getDayOfMonth()) |
|
|
|
.stream().collect(Collectors.toMap(di -> di.getDeviceId().toLowerCase(), Function.identity())); |
|
|
|
Map<String, DeviceIncrement> yesterdayMap = dashboardRecordAccumulateMapperExt.selectYesterdayIncrement(deviceIds, yesterday.getYear(), yesterday.getMonthValue(), yesterday.getDayOfMonth(), targetSeconds) |
|
|
|
.stream().collect(Collectors.toMap(di -> di.getDeviceId().toLowerCase(), Function.identity())); |
|
|
|
Map<String, DeviceIncrement> lastYearMap = dashboardRecordAccumulateMapperExt.selectLastYearIncrement(deviceIds, lastYear.getYear(), lastYear.getMonthValue(), lastYear.getDayOfMonth(), targetSeconds) |
|
|
|
.stream().collect(Collectors.toMap(di -> di.getDeviceId().toLowerCase(), Function.identity())); |
|
|
|
|
|
|
|
// Map<String, DeviceIncrement> yesterdayMap = dashboardRecordAccumulateMapperExt.selectYesterdayIncrement(deviceIds, yesterday.getYear(), yesterday.getMonthValue(), yesterday.getDayOfMonth(), targetSeconds)
|
|
|
|
// .stream().collect(Collectors.toMap(di -> di.getDeviceId().toLowerCase(), Function.identity()));
|
|
|
|
List<RecordAccumulateDto> yesterdayRecords = dashboardRecordAccumulateMapperExt.selectByDay(deviceIds, yesterday.getYear(), yesterday.getMonthValue(), yesterday.getDayOfMonth()); |
|
|
|
Map<String, DeviceIncrement> yesterdayMap = commonOpt.toDeviceIncrementMap(yesterdayRecords, targetSeconds, "yesterday"); |
|
|
|
|
|
|
|
// Map<String, DeviceIncrement> lastYearMap = dashboardRecordAccumulateMapperExt.selectLastYearIncrement(deviceIds, lastYear.getYear(), lastYear.getMonthValue(), lastYear.getDayOfMonth(), targetSeconds)
|
|
|
|
// .stream().collect(Collectors.toMap(di -> di.getDeviceId().toLowerCase(), Function.identity()));
|
|
|
|
List<RecordAccumulateDto> lastYearRecords = dashboardRecordAccumulateMapperExt.selectByDay(deviceIds, lastYear.getYear(), lastYear.getMonthValue(), lastYear.getDayOfMonth()); |
|
|
|
Map<String, DeviceIncrement> lastYearMap = commonOpt.toDeviceIncrementMap(lastYearRecords, targetSeconds, "lastYear"); |
|
|
|
|
|
|
|
|
|
|
|
resultList.forEach(data -> { |
|
|
|
String deviceId = data.getDeviceId().toLowerCase(); |
|
|
|
|