代码提交
This commit is contained in:
@@ -19,4 +19,6 @@ public interface CommonMapper extends InfluxDbBaseMapper<PowerQualityData> {
|
|||||||
|
|
||||||
List<StatisticalDataDTO> getStatistical(InfluxQueryWrapper influxQueryWrapper);
|
List<StatisticalDataDTO> getStatistical(InfluxQueryWrapper influxQueryWrapper);
|
||||||
|
|
||||||
|
StatisticalDataDTO getLineRtData(InfluxQueryWrapper influxQueryWrapper);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.njcn.influx.pojo.dto;
|
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.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.influxdb.annotation.Column;
|
import org.influxdb.annotation.Column;
|
||||||
import org.influxdb.annotation.Measurement;
|
import org.influxdb.annotation.Measurement;
|
||||||
import retrofit2.http.Field;
|
import retrofit2.http.Field;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* Date: 2023/6/5 10:23【需求编号】
|
* Date: 2023/6/5 10:23【需求编号】
|
||||||
@@ -17,6 +21,9 @@ import retrofit2.http.Field;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class StatisticalDataDTO {
|
public class StatisticalDataDTO {
|
||||||
|
@Column(name = "time")
|
||||||
|
@JsonSerialize(using = InstantDateSerializer.class)
|
||||||
|
private Instant time;
|
||||||
private String LineId;
|
private String LineId;
|
||||||
private String Phase;
|
private String Phase;
|
||||||
@Column(name = "Stat_Method")
|
@Column(name = "Stat_Method")
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.njcn.influx.pojo.po.cs;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.njcn.common.utils.serializer.InstantDateSerializer;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.influxdb.annotation.Column;
|
||||||
|
import org.influxdb.annotation.Measurement;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/6/5 16:09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Measurement(name = "data_harmpower_p")
|
||||||
|
public class CsDataHarmPowerP {
|
||||||
|
|
||||||
|
@Column(name = "time")
|
||||||
|
@JsonSerialize(using = InstantDateSerializer.class)
|
||||||
|
private Instant time;
|
||||||
|
|
||||||
|
@Column(name = "line_id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
@Column(name = "phasic_type")
|
||||||
|
private String phaseType;
|
||||||
|
|
||||||
|
@Column(name = "value_type")
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "W")
|
||||||
|
private Double w;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,4 +13,15 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface CommonService {
|
public interface CommonService {
|
||||||
List<StatisticalDataDTO> commonquery(String lineId, String tableName, String columnName);
|
List<StatisticalDataDTO> commonquery(String lineId, String tableName, String columnName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件获取监测点数据
|
||||||
|
* @param lineId 监测点Id
|
||||||
|
* @param tableName 表名
|
||||||
|
* @param columnName 字段名
|
||||||
|
* @param phasic 相别
|
||||||
|
* @param dataType 数据类型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
StatisticalDataDTO getLineRtData(String lineId, String tableName, String columnName, String phasic, String dataType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,4 +38,16 @@ public class CommonServiceImpl implements CommonService {
|
|||||||
return statistical;
|
return statistical;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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)
|
||||||
|
.eq("phasic_type",phasic)
|
||||||
|
.eq("value_type",dataType)
|
||||||
|
.last(columnName,"statisticalData");
|
||||||
|
return commonMapper.getLineRtData(influxQueryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class ReflectUitl {
|
|||||||
*/
|
*/
|
||||||
public static HashMap<String,Class<?>> getEntityClassesByAnnotation() {
|
public static HashMap<String,Class<?>> getEntityClassesByAnnotation() {
|
||||||
HashMap<String,Class<?>> result = new HashMap<>();
|
HashMap<String,Class<?>> result = new HashMap<>();
|
||||||
List<Class<?>> classes = ReflectUitl.getClasses("com.njcn.influx.pojo.po");
|
List<Class<?>> classes = ReflectUitl.getClasses("com.njcn.influx.pojo.po.cs");
|
||||||
for (Class<?> clazz : classes) {
|
for (Class<?> clazz : classes) {
|
||||||
if (clazz.isAnnotationPresent(Measurement.class)) {
|
if (clazz.isAnnotationPresent(Measurement.class)) {
|
||||||
Measurement annotation = (Measurement) clazz.getAnnotation(Measurement.class);
|
Measurement annotation = (Measurement) clazz.getAnnotation(Measurement.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user