潘志宝
2 天以前 9112373fa6150563d7667eb503ae1ea07cd83887
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/point/DataPointApiImpl.java
@@ -17,6 +17,7 @@
import com.iailab.module.data.point.vo.DaPointPageReqVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -70,6 +71,24 @@
    }
    @Override
    public Map<String, Object> queryPointMaxValue(ApiPointValueQueryDTO queryDto) {
        Map<String, Object> result = new HashMap<>();
        if (StringUtils.isEmpty(queryDto.getPointNo())) {
            return null;
        }
        if (queryDto.getStart() == null) {
            return null;
        }
        DaPointDTO daPointDTO = daPointService.getByNo(queryDto.getPointNo());
        InfluxPointValuePOJO pojo = new InfluxPointValuePOJO();
        pojo.setPoint(queryDto.getPointNo());
        pojo.setType(daPointDTO.getDataType());
        Object val = influxDBService.queryPointMaxValue(pojo, queryDto.getStart());
        result.put(queryDto.getPointNo(), val);
        return result;
    }
    @Override
    public Map<String, List<Map<String, Object>>> queryPointsHistoryValue(ApiPointsValueQueryDTO queryDto) {
        Map<String, List<Map<String, Object>>> data = new HashMap<>();
        Calendar calendar = Calendar.getInstance();
@@ -112,6 +131,7 @@
            endTime = calendar.getTime();
        }
        if (startTime == null) {
            calendar.setTime(endTime);
            calendar.add(Calendar.HOUR_OF_DAY, -1);
            startTime = calendar.getTime();
        }