|
@@ -117,6 +117,7 @@ public class PostgreSQLWatch {
|
|
|
.eq(FpgGatherData::getDeviceInformationId, point.getDeviceId())
|
|
|
.eq(FpgGatherData::getCreateTime, timestamp)
|
|
|
);
|
|
|
+ FpgGatherData fpgGatherUpdate = new FpgGatherData();
|
|
|
if (fpgGatherData == null) { // 直接新增
|
|
|
FpgGatherData fpgGatherInsert = new FpgGatherData();
|
|
|
fpgGatherInsert.setCreateTime(timestamp);
|
|
@@ -149,6 +150,7 @@ public class PostgreSQLWatch {
|
|
|
fpgGatherInsert.setDeviceRegionId(device.getDeviceRegionId());
|
|
|
log.info("新增----数据处理---");
|
|
|
log.info(JSON.toJSONString(fpgGatherInsert));
|
|
|
+ fpgGatherUpdate = fpgGatherInsert;
|
|
|
fpgGatherDataMapper.insert(fpgGatherInsert);
|
|
|
} else { // 编辑处理
|
|
|
// 处理数据点类型和值的累计
|
|
@@ -177,6 +179,7 @@ public class PostgreSQLWatch {
|
|
|
}
|
|
|
}
|
|
|
fpgGatherData.setId(fpgGatherData.getId());
|
|
|
+ fpgGatherUpdate = fpgGatherData;
|
|
|
fpgGatherDataMapper.updateById(fpgGatherData);
|
|
|
}
|
|
|
// 如果 systemVariable 为空,则不执行后续操作 更新设备状态
|
|
@@ -197,6 +200,14 @@ public class PostgreSQLWatch {
|
|
|
// 只有在 systemVariable 不为空时才进行更新操作
|
|
|
deviceInformationMapper.updateById(deviceInformation);
|
|
|
}
|
|
|
+ // 更新运行电流功率
|
|
|
+ DeviceInformation deviceInformations = deviceInformationMapper.selectOne(
|
|
|
+ new LambdaQueryWrapper<DeviceInformation>()
|
|
|
+ .eq(DeviceInformation::getId, device.getId())
|
|
|
+ );
|
|
|
+ deviceInformations.setRunCurrent(fpgGatherUpdate.getRunCurrent());
|
|
|
+ deviceInformations.setActivePower(fpgGatherUpdate.getActivePower());
|
|
|
+ deviceInformationMapper.updateById(deviceInformations);
|
|
|
}
|
|
|
// 关闭连接
|
|
|
resultSet.close();
|