|
@@ -10,6 +10,8 @@ import org.jeecg.modules.device.service.IDeviceInformationService;
|
|
|
import org.jeecg.modules.deviceConn.opc.utils.OpcUaServerUtils;
|
|
|
import org.jeecg.modules.devicePoint.entity.DevicePoint;
|
|
|
import org.jeecg.modules.devicePoint.service.IDevicePointService;
|
|
|
+import org.jeecg.modules.gatherData.entity.FpgGatherData;
|
|
|
+import org.jeecg.modules.gatherData.service.IFpgGatherDataService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
@@ -17,6 +19,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -32,6 +36,9 @@ public class OpcGatherWatch {
|
|
|
@Autowired
|
|
|
IDevicePointService devicePointService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ IFpgGatherDataService fpgGatherDataService;
|
|
|
+
|
|
|
@Autowired
|
|
|
MongoTemplate mongoTemplate;
|
|
|
|
|
@@ -74,7 +81,7 @@ public class OpcGatherWatch {
|
|
|
|
|
|
//opc数据采集
|
|
|
public void opc(String freq){
|
|
|
- //获取所有运行中设备
|
|
|
+ // 获取所有运行中设备(峰平谷)
|
|
|
LambdaQueryWrapper<DeviceInformation> opcquery = new LambdaQueryWrapper<DeviceInformation>().eq(DeviceInformation::getStatus, "0").eq(DeviceInformation::getFreq, freq);
|
|
|
List<DeviceInformation> opclist = deviceInformationService.list(opcquery);
|
|
|
//获取当前时间
|
|
@@ -116,6 +123,13 @@ public class OpcGatherWatch {
|
|
|
mongoTemplate.insert(new PointData(opcPoint, freq, readText, curentDate), opcPoint.getId());
|
|
|
//更新数据库点位信息
|
|
|
devicePointService.updateById(opcPoint);
|
|
|
+ // 存入采集设备
|
|
|
+ FpgGatherData fpgGatherData = new FpgGatherData();
|
|
|
+ fpgGatherData.setDeviceInformationId(opcConn.getId()); // 设备ID
|
|
|
+ fpgGatherData.setDeviceRegionId(opcConn.getDeviceRegionId()); // 区域id
|
|
|
+ fpgGatherData.setDevicePointId(opcPoint.getId()); // 采集点ID
|
|
|
+ fpgGatherData.setCreateTime(curentDate); // 创建时间
|
|
|
+ fpgGatherDataService.addC(fpgGatherData);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|