工业互联网平台2.0版本后端代码
dongyukun
2025-05-26 e690db9517216bea6a19c7c186d35b2ad8d6fd3f
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/CumulateHandle.java
@@ -45,7 +45,7 @@
    @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("累计点处理开始");
@@ -54,9 +54,12 @@
            }
            dtos.forEach(dto -> {
                try {
                    Object value = singleCompute(dto, collectTime, listGood, listBad);
                    InfluxPointValuePOJO pojo = GenInfluxPointValueUtils.getByPoint(dto, value);
                    Object rawValue = singleCompute(dto, collectTime, listGood, listBad);
                    BigDecimal coefficient = dto.getUnittransfactor() == null ? BigDecimal.ONE : dto.getUnittransfactor();
                    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();
@@ -85,7 +88,9 @@
            if (redisTemplate.hasKey(PointCollector.PV + item.getPointNo())) {
                value = redisTemplate.opsForValue().get(PointCollector.PV + item.getPointNo());
            } else {
                value = singleCompute(item, calendar.getTime());
                Object rawValue = singleCompute(item, calendar.getTime());
                BigDecimal coefficient = item.getUnittransfactor() == null ? BigDecimal.ONE : item.getUnittransfactor();
                value = new BigDecimal(rawValue.toString()).multiply(coefficient);
            }
            data.put(item.getPointNo(), value);
        });
@@ -159,7 +164,7 @@
        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());