From 4da067bc33fa39f158b154f5069e248e55de593a Mon Sep 17 00:00:00 2001 From: "1049970895@qniao.cn" <1049970895> Date: Wed, 17 Aug 2022 11:36:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/qniao/iot/IotMonitoringDataJob.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/qniao/iot/IotMonitoringDataJob.java b/src/main/java/com/qniao/iot/IotMonitoringDataJob.java index bfa36a2..91f7d13 100644 --- a/src/main/java/com/qniao/iot/IotMonitoringDataJob.java +++ b/src/main/java/com/qniao/iot/IotMonitoringDataJob.java @@ -242,22 +242,29 @@ public class IotMonitoringDataJob { // 树根(今日当前数 + 这次信息点距离上次信息点生产的数量) nowDeviceState.setTheDayJobCount(onData.getTheDayJobCount() + receivedEvent.getCurrJobCount()); nowDeviceState.setJobTotal(onData.getJobTotal() + receivedEvent.getCurrJobCount()); + nowDeviceState.setTheDayJobDuration(lastedDeviceState.getTheDayJobDuration() + workingDuration); + nowDeviceState.setJobDurationTotal(lastedDeviceState.getJobDurationTotal() + workingDuration); } else { // 机智云 nowDeviceState.setTheDayJobCount(lastedDeviceState.getTheDayJobCount() + receivedEvent.getCurrJobCount()); nowDeviceState.setJobTotal(lastedDeviceState.getJobTotal() + receivedEvent.getCurrJobCount()); + nowDeviceState.setTheDayJobDuration(lastedDeviceState.getTheDayJobDuration() + receivedEvent.getCurrJobDuration()); + nowDeviceState.setJobDurationTotal(lastedDeviceState.getJobDurationTotal() + receivedEvent.getCurrJobDuration()); } nowDeviceState.setCurrLocalDate(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); nowDeviceState.setLastBootTime(onData.getReportTime()); - nowDeviceState.setTheDayJobDuration(lastedDeviceState.getTheDayJobDuration() + workingDuration); - nowDeviceState.setJobDurationTotal(lastedDeviceState.getJobDurationTotal() + workingDuration); + /*nowDeviceState.setTheDayJobDuration(lastedDeviceState.getTheDayJobDuration() + workingDuration); + nowDeviceState.setJobDurationTotal(lastedDeviceState.getJobDurationTotal() + workingDuration);*/ nowDeviceState.setReportTime(reportTime); } else { // 待机或开机 nowDeviceState = lastedDeviceState; } - deviceTotalDataStat.update(nowDeviceState); - nowDeviceState.setTheDayDuration(lastedDeviceState.getTheDayDuration() + workingDuration); + if (dataSource == 1) { + nowDeviceState.setTheDayDuration(lastedDeviceState.getTheDayDuration() + workingDuration); + }else { + nowDeviceState.setTheDayDuration(lastedDeviceState.getTheDayDuration() + receivedEvent.getCurrJobDuration()); + } if (lastPwStat == 0) { // 如果上次是关机消息,那么这次就是开机消息 // 记录本次开机作为上次开机时间 @@ -266,6 +273,7 @@ public class IotMonitoringDataJob { onDataState.update(nowDeviceState); onData = nowDeviceState; } + deviceTotalDataStat.update(nowDeviceState); } // 如果上次是待机,并且这次也是待机,那么就不需要发送了 if (((!(lastWorkingStat == 2 && machineWorkingStat == 2))