influx查询数据方式调整
This commit is contained in:
@@ -190,6 +190,10 @@ whitelist:
|
||||
- /*/v2/api-docs
|
||||
- /favicon.ico
|
||||
- /system-boot/theme/getTheme
|
||||
- /cs-harmonic-boot/**
|
||||
- /cs-device-boot/**
|
||||
- /cs-system-boot/**
|
||||
- /cs-warn-boot/**
|
||||
|
||||
#- /device-boot/**
|
||||
#- /system-boot/**
|
||||
|
||||
@@ -3,10 +3,7 @@ package com.njcn.influx.pojo.dto;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.njcn.common.utils.serializer.InstantDateSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
import retrofit2.http.Field;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@@ -21,13 +18,23 @@ import java.time.Instant;
|
||||
|
||||
@Data
|
||||
public class StatisticalDataDTO {
|
||||
|
||||
@Column(name = "time")
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
private String LineId;
|
||||
private String Phase;
|
||||
@Column(name = "Stat_Method")
|
||||
private String statMethod;
|
||||
|
||||
@Column(name = "line_id")
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "value_type")
|
||||
private String valueType;
|
||||
|
||||
private Double value;
|
||||
|
||||
private String statisticalName;
|
||||
private Double statisticalData;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package com.njcn.influx.service.impl;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.influx.ano.Select;
|
||||
import com.njcn.influx.imapper.CommonMapper;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.pojo.po.HarmonicRatioData;
|
||||
@@ -31,7 +38,7 @@ public class CommonServiceImpl implements CommonService {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(aClass,StatisticalDataDTO.class);
|
||||
influxQueryWrapper.eq("LineId",lineId).
|
||||
last(columnName,"statisticalData").
|
||||
groupBy(StatisticalDataDTO::getLineId, StatisticalDataDTO::getStatMethod, StatisticalDataDTO::getPhase);
|
||||
groupBy(StatisticalDataDTO::getLineId, StatisticalDataDTO::getValueType, StatisticalDataDTO::getPhaseType);
|
||||
|
||||
List<StatisticalDataDTO> statistical = commonMapper.getStatistical(influxQueryWrapper);
|
||||
|
||||
@@ -41,13 +48,14 @@ public class CommonServiceImpl implements CommonService {
|
||||
|
||||
@Override
|
||||
public StatisticalDataDTO getLineRtData(String lineId, String tableName, String columnName, String phasic, String dataType) {
|
||||
HashMap<String, Class<?>> entityClassesByAnnotation = ReflectUitl.getEntityClassesByAnnotation();
|
||||
Class<?> aClass = entityClassesByAnnotation.get(tableName);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(aClass,StatisticalDataDTO.class);
|
||||
influxQueryWrapper.eq("line_id",lineId)
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class);
|
||||
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||
.select(StatisticalDataDTO::getPhaseType)
|
||||
.select(StatisticalDataDTO::getValueType)
|
||||
.last(columnName)
|
||||
.eq("line_id",lineId)
|
||||
.eq("phasic_type",phasic)
|
||||
.eq("value_type",dataType)
|
||||
.last(columnName,"statisticalData");
|
||||
.eq("value_type",dataType);
|
||||
return commonMapper.getLineRtData(influxQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user