| | |
| | | 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.InfluxPointValueDigPOJO; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValueSimPOJO; |
| | | import com.iailab.module.data.point.collection.handler.CalculateHandle; |
| | | import com.iailab.module.data.point.collection.handler.CumulateHandle; |
| | | import com.iailab.module.data.point.common.PointTypeEnum; |
| | | import com.iailab.module.data.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.service.DaPointCollectStatusService; |
| | | import com.iailab.module.data.point.service.DaPointService; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO; |
| | | import com.iailab.module.data.channel.modbus.collector.ModBusCollector; |
| | |
| | | import com.iailab.module.data.point.dto.DaPointWriteValueDTO; |
| | | import com.iailab.module.data.influxdb.service.InfluxDBService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | @Resource |
| | | private CumulateHandle cumulateHandle; |
| | | |
| | | @Autowired |
| | | private DaPointCollectStatusService daPointCollectStatusService; |
| | | |
| | | /** |
| | | * 采集 |
| | | * |
| | |
| | | log.info("存入数据库"); |
| | | influxDBService.asyncWritePointValues(pointValues); |
| | | |
| | | log.info("更新采集状态"); |
| | | updateCollectStatus(pointValues, collectTime); |
| | | log.info("采集完成"); |
| | | } catch (Exception ex) { |
| | | } catch (Exception ex) { |
| | | log.info("采集异常!"); |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private void updateCollectStatus(List<InfluxPointValuePOJO> pointValues, Date collectTime) { |
| | | try { |
| | | for (InfluxPointValuePOJO pointValue : pointValues) { |
| | | if (pointValue instanceof InfluxPointValueSimPOJO) { |
| | | InfluxPointValueSimPOJO pvo = (InfluxPointValueSimPOJO) pointValue; |
| | | daPointCollectStatusService.recordStatus(pvo.getPoint(), pvo.getValue().toString(), collectTime); |
| | | } else if (pointValue instanceof InfluxPointValueDigPOJO) { |
| | | InfluxPointValueDigPOJO pvo = (InfluxPointValueDigPOJO) pointValue; |
| | | daPointCollectStatusService.recordStatus(pvo.getPoint(), pvo.getValue().toString(), collectTime); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public Map<String, Object> getCurrentValue(List<String> pointNos) { |
| | | try { |
| | | Map<String, Object> data = new HashMap<>(); |