| | |
| | | import com.influxdb.query.FluxTable; |
| | | import com.influxdb.query.InfluxQLQueryResult; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | Map<String, List<Map<String, Object>>> result = new HashMap<>(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | String start = startTime.getTime() - calendar.getTime().getTime() + "ms"; |
| | | String start = (startTime.getTime() - calendar.getTime().getTime() - pas_ms) + "ms"; |
| | | if (endTime==null){ |
| | | endTime= new Date(); |
| | | } |
| | |
| | | logger.info("CollectTaskNet60定时任务正在执行,参数为:{}", params); |
| | | try { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | pointCollector.collect(calendar.getTime(), NET); |
| | | logger.info("PointCollectTaskNet60定时任务完成时间:" + LocalDateTime.now()); |
| | |
| | | */ |
| | | public void collect(Date collectTime, String minfreq) { |
| | | try { |
| | | log.info("collectTime=" + collectTime.getTime()); |
| | | Map<String, Object> dataMap = new HashMap<>(); |
| | | List<InfluxPointValuePOJO> pointValues = new ArrayList<>(); |
| | | // 记录点位状态 |
| | |
| | | pointValues.addAll(cumulateHandle.handle(collectTime, pointCumulateList, listGood, listBad)); |
| | | |
| | | log.info("存入时序库"); |
| | | log.info("pointValueTimestamp=" + (pointValues.get(0) == null ? 0 : pointValues.get(0).getTimestamp().getNano())); |
| | | influxDBService.asyncWritePointValues(pointValues); |
| | | |
| | | log.info("存入缓存"); |