初始化influx公共模块项目
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
package com.njcn.influx.service.impl;
|
||||
|
||||
import com.njcn.influx.imapper.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.ArrayList;
|
||||
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_","", this.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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataV> getHarmonicDataV(String lineIndex, String startTime, String endTime) {
|
||||
List<DataV> result1 ;
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.eq(DataV::getLineId, lineIndex)
|
||||
.eq(DataV::getValueType, "CP95")
|
||||
.ne(DataV::getPhasicType, "T")
|
||||
.between(DataV::getTime, startTime, endTime);;
|
||||
result1 = dataVMapper.getStatisticsByWraper(influxQueryWrapper);
|
||||
return result1;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 自定义需要查询的谐波次数
|
||||
* @author xuyang
|
||||
* @param start 起始次数@Min(value = 1) @Max(value = 100)
|
||||
* @param end 结束次数 @Min(value = 1) @Max(value = 100)
|
||||
* @param interval 间隔
|
||||
* @return List<Object>
|
||||
*/
|
||||
public List<Object> harmonicTimesList(Integer start, Integer end, Integer interval) {
|
||||
List<Object> timesList = new ArrayList<>();
|
||||
for (int i = start; i <= end;i = i+interval) {
|
||||
timesList.add(i);
|
||||
}
|
||||
return timesList;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user