|
|
|
@ -58,7 +58,8 @@ public class DataAndPowerSave { |
|
|
|
|
String date1 = timestamp.split("T")[0]; |
|
|
|
|
String samDate = date1.split("-")[0] + date1.split("-")[1] + date1.split("-")[2]; |
|
|
|
|
String time1 = timestamp.split("T")[1]; |
|
|
|
|
int hour = Integer.parseInt(time1.substring(0, 8).split(":")[0]); |
|
|
|
|
String time2 = time1.substring(0, 8).split(":")[0]; |
|
|
|
|
int hour = Integer.parseInt(time2); |
|
|
|
|
int min = Integer.parseInt(time1.substring(0, 8).split(":")[1]); |
|
|
|
|
String begin = date1 + " " + time1.substring(0,5) + ":00"; |
|
|
|
|
String end = date1 + " " + time1.substring(0,5) + ":59"; |
|
|
|
@ -116,8 +117,8 @@ public class DataAndPowerSave { |
|
|
|
|
electricHtDataMapper.insert(peht); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Long devCountDay = statisticsDayMapper.count(deviceId, date1); |
|
|
|
|
if (devCountDay < 1){ |
|
|
|
|
Integer devCountDay = statisticsDayMapper.count(deviceId, date1); |
|
|
|
|
if (devCountDay <= 0){ |
|
|
|
|
PsdcStatisticsDay statisticsDay = new PsdcStatisticsDay(); |
|
|
|
|
statisticsDay.setDayDate(date1); |
|
|
|
|
statisticsDay.setDeviceId(deviceId); |
|
|
|
@ -125,7 +126,7 @@ public class DataAndPowerSave { |
|
|
|
|
statisticsDayMapper.insertDay(statisticsDay); |
|
|
|
|
} |
|
|
|
|
Double hourUse = electricHtDataMapper.selTodayUseEnergy(deviceId, begin, end); |
|
|
|
|
String hourNo = "hour_" + hour; |
|
|
|
|
String hourNo = "hour_" + time2; |
|
|
|
|
statisticsDayMapper.updateTodayDevEnergy(hourNo, hourUse, deviceId, date1); |
|
|
|
|
|
|
|
|
|
// 根据设备id查询设备功率表中该设备的条数
|
|
|
|
|