初始化influx公共模块项目

This commit is contained in:
2024-06-27 11:46:52 +08:00
parent 71394ffdd6
commit 33a36e4f5e
125 changed files with 8117 additions and 4 deletions

View File

@@ -0,0 +1,49 @@
package com.njcn.influx.service.impl;
import com.njcn.influx.imapper.PowerQualityMapper;
import com.njcn.influx.pojo.po.PowerQualityData;
import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.influx.service.PowerQualityService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Description:
* Date: 2023/5/18 16:12【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
public class PowerQualityServiceImpl implements PowerQualityService {
private final PowerQualityMapper powerQualityMapper;
@Override
public List<PowerQualityData> getFirstPowerQuality(List<String> lineIds,String columnName) {
List<PowerQualityData> result1 ;
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PowerQualityData.class);
influxQueryWrapper.or(PowerQualityData::getLineId, lineIds)
.last(columnName,columnName).groupBy(PowerQualityData::getLineId, PowerQualityData::getStatMethod, PowerQualityData::getPhase);
result1 = powerQualityMapper.getFirstPowerQuality(influxQueryWrapper);
return result1;
}
@Override
public List<PowerQualityData> getPowerQuality(List<String> lineIds,String columnName, String startTime, String endTime) {
List<PowerQualityData> result1;
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PowerQualityData.class);
influxQueryWrapper.or(PowerQualityData::getLineId, lineIds)
.percentile(columnName, 95)
.between(PowerQualityData::getTime, startTime, endTime)
.groupBy(PowerQualityData::getLineId,PowerQualityData::getStatMethod,PowerQualityData::getPhase);
result1 = powerQualityMapper.getPowerQuality(influxQueryWrapper);
return result1;
}
}