influxDB测试
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.njcn.influx.mapper;
|
||||
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
import com.njcn.influx.pojo.po.DataV;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/5 14:39
|
||||
*/
|
||||
|
||||
public interface DataVMapper extends InfluxDbBaseMapper<DataV> {
|
||||
|
||||
List<DataV> getStatisticsByWraper(InfluxQueryWrapper influxQueryWrapper);
|
||||
|
||||
}
|
||||
@@ -213,12 +213,12 @@ public class DataV{
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
private String phaseType;
|
||||
private String phasicType;
|
||||
|
||||
@Column(name = "value_type")
|
||||
private String valueType;
|
||||
|
||||
//自定义字段-总计算次数
|
||||
@Column(name = "all_time")
|
||||
private Integer allTime;
|
||||
//@Column(name = "all_time")
|
||||
//private Integer allTime;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.njcn.influx.service;
|
||||
|
||||
import com.njcn.influx.pojo.po.DataV;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IDataVService {
|
||||
|
||||
List<DataV> getDataV(String lineIndex, String startTime, String endTime);
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.njcn.influx.service.DataFlickerService;
|
||||
import com.njcn.influx.utils.InfluxDbUtil;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.influx.service.impl;
|
||||
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.influx.mapper.DataVMapper;
|
||||
import com.njcn.influx.pojo.po.DataV;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.influx.service.IDataVService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/5 14:38
|
||||
*/
|
||||
@Service
|
||||
public class DataVServiceImpl implements IDataVService {
|
||||
|
||||
@Resource
|
||||
private DataVMapper dataVMapper;
|
||||
|
||||
@Override
|
||||
public List<DataV> getDataV(String lineIndex, String startTime, String endTime) {
|
||||
//最小值
|
||||
List<DataV> result1 ;
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.minSamePrefixAndSuffix("v_","", HarmonicTimesUtil.harmonicTimesList(1,50,1));
|
||||
influxQueryWrapper.eq(DataV::getLineId, lineIndex)
|
||||
.eq(DataV::getValueType, "MIN")
|
||||
.min(DataV::getFreq)
|
||||
.min(DataV::getFreqDev)
|
||||
.min(DataV::getRms)
|
||||
.min(DataV::getRmsLvr)
|
||||
.min(DataV::getVNeg)
|
||||
.min(DataV::getVPos)
|
||||
.min(DataV::getVThd)
|
||||
.min(DataV::getVUnbalance)
|
||||
.min(DataV::getVZero)
|
||||
.min(DataV::getVlDev)
|
||||
.min(DataV::getVuDev)
|
||||
.groupBy(DataV::getLineId,DataV::getPhasicType,DataV::getQualityFlag,DataV::getValueType)
|
||||
.between(DataV::getTime, startTime, endTime);
|
||||
result1 = dataVMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
System.out.println("result1==:" + result1);
|
||||
return result1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user