| | |
| | | import com.iailab.module.data.common.enums.DataSourceType; |
| | | import com.iailab.module.data.common.utils.R; |
| | | import com.iailab.module.data.channel.kio.collector.KingIOCollector; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValueBoolPOJO; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValueDigPOJO; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValueSimPOJO; |
| | | import com.iailab.module.data.point.collection.handler.CalculateHandle; |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | @Autowired |
| | | private DaPointCollectStatusService daPointCollectStatusService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | public static final String PV = "PV_"; |
| | | |
| | | public static final int offset = 60 * 3; |
| | | |
| | | /** |
| | | * 采集 |
| | | * |
| | |
| | | List<DaPointDTO> pointCumulateList = daPointService.getCumulatePoint(minfreq); |
| | | pointValues.addAll(cumulateHandle.handle(collectTime, pointCumulateList)); |
| | | |
| | | log.info("存入数据库"); |
| | | log.info("存入时序库"); |
| | | influxDBService.asyncWritePointValues(pointValues); |
| | | |
| | | log.info("存入缓存"); |
| | | for (InfluxPointValuePOJO pointValue : pointValues) { |
| | | if (pointValue instanceof InfluxPointValueSimPOJO) { |
| | | InfluxPointValueSimPOJO simPOJO = (InfluxPointValueSimPOJO) pointValue; |
| | | redisTemplate.opsForValue().set(PV + simPOJO.getPoint(), simPOJO.getValue(), offset); |
| | | } else if (pointValue instanceof InfluxPointValueDigPOJO) { |
| | | InfluxPointValueDigPOJO digPOJO = (InfluxPointValueDigPOJO) pointValue; |
| | | redisTemplate.opsForValue().set(PV + digPOJO.getPoint(), digPOJO.getValue(), offset); |
| | | } else if (pointValue instanceof InfluxPointValueBoolPOJO) { |
| | | InfluxPointValueBoolPOJO boolPOJO = (InfluxPointValueBoolPOJO) pointValue; |
| | | redisTemplate.opsForValue().set(PV + boolPOJO.getPoint(), boolPOJO.getValue(), offset); |
| | | } |
| | | } |
| | | log.info("更新采集状态"); |
| | | daPointCollectStatusService.recordStatusList(pointValues, collectTime); |
| | | log.info("采集完成"); |