| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 累计点处理 |
| | |
| | | @Autowired |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | public List<InfluxPointValuePOJO> handle(Date collectTime, List<DaPointDTO> dtos, List<String> listGood, List<String> listBad) { |
| | | public List<InfluxPointValuePOJO> handle(Date collectTime, List<DaPointDTO> dtos, Map<String, Object> dataMap, List<String> listGood, List<String> listBad) { |
| | | List<InfluxPointValuePOJO> result = new ArrayList<>(); |
| | | try { |
| | | log.info("累计点处理开始"); |
| | |
| | | BigDecimal calValue = new BigDecimal(rawValue.toString()).multiply(coefficient); |
| | | InfluxPointValuePOJO pojo = GenInfluxPointValueUtils.getByPoint(dto, calValue); |
| | | pojo.setTimestamp(GenInfluxPointValueUtils.getByMin(collectTime, DataPointFreqEnum.getEumByCode(dto.getMinfreqid()))); |
| | | dataMap.put(dto.getPointNo(), calValue); |
| | | result.add(pojo); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | |
| | | Object rawValue = singleCompute(item, calendar.getTime()); |
| | | BigDecimal coefficient = item.getUnittransfactor() == null ? BigDecimal.ONE : item.getUnittransfactor(); |
| | | value = new BigDecimal(rawValue.toString()).multiply(coefficient); |
| | | // 写入缓存 |
| | | redisTemplate.opsForValue().set(PointCollector.PV + item.getPointNo(), |
| | | new BigDecimal(value.toString()).doubleValue(), PointCollector.offset, TimeUnit.SECONDS); |
| | | } |
| | | data.put(item.getPointNo(), value); |
| | | }); |
| | |
| | | long start = startTime.getTime(); |
| | | long end = endTime.getTime(); |
| | | long oneMin = 1000L * DataPointFreqEnum.getEumByCode(minfreqid).getValue(); |
| | | long mins = (end - start) / oneMin; |
| | | long mins = ((end - start) / oneMin) + 1; |
| | | |
| | | //找出缺少项 |
| | | Map<Long, Double> sourceDataMap = new HashMap<>(dataList.size()); |