潘志宝
2024-10-29 a2aa90efc5d75798b0b3dc3255c33c53983dce86
ApiDataController
已修改3个文件
14 ■■■■■ 文件已修改
iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/util/date/DateUtils.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/point/DataPointApiImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/influxdb/service/impl/InfluxDBServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/util/date/DateUtils.java
@@ -198,7 +198,7 @@
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(startDate);
        while (calendar.getTime().compareTo(endDate) <= 0) {
            days.add(DateUtils.format(calendar.getTime(), FORMAT_YEAR_MONTH_DAY));
            days.add(DateUtils.format(calendar.getTime(), FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
            calendar.add(Calendar.SECOND, seconds);
        }
        return days;
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/point/DataPointApiImpl.java
@@ -1,9 +1,11 @@
package com.iailab.module.data.api.point;
import com.iailab.framework.common.util.date.DateUtils;
import com.iailab.framework.common.util.object.ConvertUtils;
import com.iailab.module.data.api.point.dto.*;
import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO;
import com.iailab.module.data.influxdb.service.InfluxDBService;
import com.iailab.module.data.influxdb.service.impl.InfluxDBServiceImpl;
import com.iailab.module.data.point.collection.PointCollector;
import com.iailab.module.data.point.dto.DaPointDTO;
import com.iailab.module.data.point.dto.DaPointWriteValueDTO;
@@ -86,8 +88,8 @@
        List<ApiPointValueDTO> pointValueList = new ArrayList<>();
        for (int i = 0; list.size() - i >= 1; i++) {
            ApiPointValueDTO pointValue = new ApiPointValueDTO();
            pointValue.setDataValue(Double.parseDouble(list.get(i).get("value").toString()));
            pointValue.setDataTime((Date) (list.get(i).get("time")));
            pointValue.setDataValue(Double.parseDouble(list.get(i).get(InfluxDBServiceImpl.VALUE).toString()));
            pointValue.setDataTime(DateUtils.parse(list.get(i).get(InfluxDBServiceImpl.TIME).toString(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
            pointValueList.add(pointValue);
        }
        return pointValueList;
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/influxdb/service/impl/InfluxDBServiceImpl.java
@@ -62,9 +62,9 @@
    private InfluxQLQueryApi influxQLQueryApi;
    private String VALUE = "value";
    public static final String VALUE = "value";
    private String TIME = "time";
    public static final String TIME = "time";
    private int rawOffset = TimeZone.getDefault().getRawOffset();
@@ -369,7 +369,7 @@
            InfluxPointValuePOJO point = influxParams.get(i);
            String measurement = PointValueUtils.getMeasurement(point.getType());
            StringBuilder sb = new StringBuilder();
            sb.append("from(bucket:\"" + influxDBInstance.bucket + "\") ");
            sb.append("from(bucket:\"" + influxDBInstance.getBucket() + "\") ");
            sb.append("|> range(start: ").append(start).append(", stop: ").append(stop).append(") ");
            sb.append("|> filter(fn: (r) => r[\"_measurement\"] == \"" + measurement + "\")");
            sb.append("|> filter(fn: (r) => r[\"_field\"] == \"value\")");