Quellcode durchsuchen

调整 峰平谷 采集

guoqiang vor 5 Monaten
Ursprung
Commit
e194bf43e2

+ 8 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/device/entity/DeviceInformation.java

@@ -69,6 +69,14 @@ public class DeviceInformation implements Serializable {
     @Excel(name = "备注", width = 15)
     @ApiModelProperty(value = "备注")
     private String deviceRemark;
+    /**运行电流*/
+    @Excel(name = "运行电流", width = 15)
+    @ApiModelProperty(value = "运行电流")
+    private BigDecimal runCurrent;
+    /**有功功率*/
+    @Excel(name = "有功功率", width = 15)
+    @ApiModelProperty(value = "有功功率")
+    private BigDecimal activePower;
     /**
      * 设备类型(1棒一2棒二3棒三4高线5板带)
      * */

+ 11 - 0
jeecg-module-gather/src/main/java/org/jeecg/modules/watch/PostgreSQLWatch.java

@@ -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();