Browse Source

更新

feature_hph_新增rabbitmq_sink
hupenghui@qniao.cn 3 years ago
parent
commit
55d668118c
1 changed files with 17 additions and 2 deletions
  1. 19
      src/main/java/com/qniao/iot/IotMonitoringDataJob.java

19
src/main/java/com/qniao/iot/IotMonitoringDataJob.java

@ -137,14 +137,21 @@ public class IotMonitoringDataJob {
// 上次启动时间
Long lastBootTime = lastDeviceState.getLastBootTime();
Long lastTheDayDuration = lastDeviceState.getTheDayDuration();
lastTheDayDuration = lastTheDayDuration == null ? 0L : lastTheDayDuration;
Long lastTheDayJobDuration = lastDeviceState.getTheDayJobDuration();
lastTheDayJobDuration = lastTheDayJobDuration == null ? 0L : lastTheDayJobDuration;
Long lastJobDurationTotal = lastDeviceState.getJobDurationTotal();
lastJobDurationTotal = lastJobDurationTotal == null ? 0L : lastJobDurationTotal;
Long lastTheDayJobCount = lastDeviceState.getTheDayJobCount();
lastTheDayJobCount = lastTheDayJobCount == null ? 0L : lastTheDayJobCount;
Long lastJobTotal = lastDeviceState.getJobTotal();
lastJobTotal = lastJobTotal == null ? 0L : lastJobTotal;
Integer machinePwrStat = command.getMachinePwrStat();
Integer machineWorkingStat = command.getMachineWorkingStat();
Long currJobDuration = command.getCurrJobDuration();
currJobDuration = currJobDuration == null ? 0L : currJobDuration;
Long currJobCount = command.getCurrJobCount();
currJobCount = currJobCount == null ? 0L : currJobCount;
// 当前数据
DeviceTotalData nowDeviceState = new DeviceTotalData();
nowDeviceState.setMachinePwrStat(machinePwrStat);
@ -299,9 +306,17 @@ public class IotMonitoringDataJob {
if (iotMac.equals(machineIotMac)) {
deviceTotalData = new DeviceTotalData();
Object productionTotal = JSONUtil.getByPath(JSONUtil.parse(o), "productionTotal");
deviceTotalData.setJobTotal(Integer.toUnsignedLong(Integer.parseInt(String.valueOf(productionTotal))));
if(productionTotal == null) {
deviceTotalData.setJobTotal(0L);
}else {
deviceTotalData.setJobTotal(Integer.toUnsignedLong(Integer.parseInt(String.valueOf(productionTotal))));
}
Object workTotalTotal = JSONUtil.getByPath(JSONUtil.parse(o), "workTotalTotal");
deviceTotalData.setJobDurationTotal(Integer.toUnsignedLong(Integer.parseInt(String.valueOf(workTotalTotal))) * 3600);
if(workTotalTotal == null) {
deviceTotalData.setJobDurationTotal(0L);
}else {
deviceTotalData.setJobDurationTotal(Integer.toUnsignedLong(Integer.parseInt(String.valueOf(workTotalTotal))) * 3600);
}
Object startingUpTime = JSONUtil.getByPath(JSONUtil.parse(o), "startingUpTime");
LocalDateTime lastBootTime = LocalDateTime
.parse((String) startingUpTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));

Loading…
Cancel
Save