完成监测点稳态指标合格率(天、月、季和年)
This commit is contained in:
@@ -66,6 +66,15 @@ public class DataFlickerController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getColumnNameCountRawData")
|
||||
@ApiOperation("时间分组获取条目数量")
|
||||
public HttpResult<Integer> getColumnNameCountRawData(@RequestBody LineCountEvaluateParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("getColumnNameCountRawData");
|
||||
Integer data = dataFlickerQuery.getColumnNameCountRawData(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
|
||||
@PostMapping("/getBaseData")
|
||||
@ApiOperation("获取算法基础数据")
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.njcn.dataProcess.controller;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.dataProcess.annotation.InsertBean;
|
||||
import com.njcn.dataProcess.annotation.QueryBean;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataQualifiedDetail;
|
||||
import com.njcn.dataProcess.service.IDataLimitQualified;
|
||||
import com.njcn.dataProcess.service.IDataLimitRate;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/6 19:48
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RestController
|
||||
@RequestMapping("/dataLimitQualified")
|
||||
@Api(tags = "监测点稳态指标合格率获取")
|
||||
public class DataLimitQualifiedController extends BaseController {
|
||||
|
||||
@QueryBean
|
||||
private IDataLimitQualified limitQualifiedQuery;
|
||||
|
||||
@InsertBean
|
||||
private IDataLimitQualified limitQualifiedInsert;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/batchInsertion")
|
||||
@ApiOperation("批量插入")
|
||||
public HttpResult<String> batchInsertion(@RequestBody List<DataQualifiedDetail> dataVDTOList) {
|
||||
String methodDescribe = getMethodDescribe("batchInsertion");
|
||||
limitQualifiedInsert.batchInsertion(dataVDTOList);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getRawData")
|
||||
@ApiOperation("获取原始数据")
|
||||
public HttpResult<List<DataQualifiedDetail>> getRawData(@RequestBody LineCountEvaluateParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("getRawData");
|
||||
List<DataQualifiedDetail> rawData = limitQualifiedInsert.getRawData(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rawData, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class DataVController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getCountRawData")
|
||||
@ApiOperation("获取总条目数量")
|
||||
public HttpResult<Integer> getCountRawData(@RequestBody LineCountEvaluateParam lineParam) {
|
||||
@@ -105,7 +105,16 @@ public class DataVController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getColumnNameCountRawData")
|
||||
@ApiOperation("时间分组获取条目数量")
|
||||
public HttpResult<Integer> getColumnNameCountRawData(@RequestBody LineCountEvaluateParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("getColumnNameCountRawData");
|
||||
Integer data = dataVQuery.getColumnNameCountRawData(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getBaseData")
|
||||
@ApiOperation("获取算法基础数据")
|
||||
public HttpResult<List<CommonMinuteDto>> getBaseData(@RequestBody LineCountEvaluateParam lineParam) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.dataProcess.dao.relation.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.dataProcess.pojo.po.RStatLimitQualifiedD;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
* @author web2023
|
||||
*/
|
||||
public interface RStatLimitQualifiedRelationMapper extends MppBaseMapper<RStatLimitQualifiedD> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.dataProcess.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.dataProcess.pojo.dto.DataComassesDPO;
|
||||
import com.njcn.dataProcess.pojo.po.RStatComassesDPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/6 10:22
|
||||
*/
|
||||
public interface IDataComAss extends IMppService<RStatComassesDPO> {
|
||||
|
||||
/**
|
||||
* 批量插入数据
|
||||
* @param limitQualifiedList
|
||||
*/
|
||||
void batchInsertion(List<DataComassesDPO> limitQualifiedList);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -36,4 +36,11 @@ public interface IDataFlicker extends IMppService<RStatDataFlickerD> {
|
||||
* 批量插入数据
|
||||
*/
|
||||
void addList(List<DataFlickerDto> dataIDtoList);
|
||||
|
||||
/**
|
||||
* 时间分组获取条目数量
|
||||
* @param lineParam
|
||||
* @return
|
||||
*/
|
||||
Integer getColumnNameCountRawData(LineCountEvaluateParam lineParam);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.njcn.dataProcess.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataQualifiedDetail;
|
||||
import com.njcn.dataProcess.pojo.po.RStatLimitQualifiedD;
|
||||
import com.njcn.dataProcess.pojo.po.RStatLimitRateD;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/6 10:22
|
||||
*/
|
||||
public interface IDataLimitQualified extends IMppService<RStatLimitQualifiedD> {
|
||||
|
||||
/**
|
||||
* 批量插入数据
|
||||
* @param limitQualifiedList
|
||||
*/
|
||||
void batchInsertion(List<DataQualifiedDetail> limitQualifiedList);
|
||||
|
||||
|
||||
/**
|
||||
* 获取原始数据
|
||||
* @param lineParam
|
||||
*/
|
||||
List<DataQualifiedDetail> getRawData(LineCountEvaluateParam lineParam);
|
||||
}
|
||||
@@ -46,6 +46,13 @@ public interface IDataV extends IMppService<RStatDataVD> {
|
||||
*/
|
||||
Integer getCountRawData(LineCountEvaluateParam lineParam);
|
||||
|
||||
/**
|
||||
* 时间分组获取条目数量
|
||||
* @param lineParam
|
||||
* @return
|
||||
*/
|
||||
Integer getColumnNameCountRawData(LineCountEvaluateParam lineParam);
|
||||
|
||||
/**
|
||||
* 获取监测点原始数据
|
||||
* @param lineParam 监测点参数
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.njcn.dataProcess.service.impl.influxdb;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.dataProcess.dao.imapper.DataFlickerMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataFlickerRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataFlickerDTO;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.influx.DataFlicker;
|
||||
import com.njcn.dataProcess.po.influx.DataV;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataFlickerDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatDataFlickerD;
|
||||
@@ -122,6 +125,29 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getColumnNameCountRawData(LineCountEvaluateParam lineParam) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
|
||||
influxQueryWrapper
|
||||
.count(lineParam.getColumnName())
|
||||
.regular(DataFlicker::getLineId, lineParam.getLineId())
|
||||
.groupBy("time(1m) fill(none)")
|
||||
.eq(DataFlicker::getQualityFlag, "0")
|
||||
.between(DataFlicker::getTime, lineParam.getStartTime(), lineParam.getEndTime());
|
||||
|
||||
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||
influxQueryWrapper.regular(DataFlicker::getPhasicType, lineParam.getPhasicType());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(lineParam.getGe())) {
|
||||
influxQueryWrapper.ge(lineParam.getColumnName(), lineParam.getGe());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(lineParam.getLt())) {
|
||||
influxQueryWrapper.lt(lineParam.getColumnName(), lineParam.getLt());
|
||||
}
|
||||
List<DataFlicker> dataFlickers = dataFlickerMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
return dataFlickers.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 按监测点集合、时间条件获取分钟数据
|
||||
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.dataProcess.service.impl.influxdb;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatLimitQualifiedRelationMapper;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.DataQualifiedDetail;
|
||||
import com.njcn.dataProcess.pojo.po.RStatLimitQualifiedD;
|
||||
import com.njcn.dataProcess.service.IDataLimitQualified;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/7 10:13
|
||||
*/
|
||||
@Service("InfluxdbDataLimitQualifiedImpl")
|
||||
@RequiredArgsConstructor
|
||||
public class InfluxdbDataLimitQualifiedImpl extends MppServiceImpl<RStatLimitQualifiedRelationMapper, RStatLimitQualifiedD> implements IDataLimitQualified {
|
||||
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataQualifiedDetail> limitQualifiedList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataQualifiedDetail> getRawData(LineCountEvaluateParam lineParam) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.njcn.dataProcess.service.impl.influxdb;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
||||
@@ -49,35 +50,36 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
|
||||
/**
|
||||
* 注意:influxdb不推荐采用in函数的方式批量查询监测点的数据,效率很低,容易造成崩溃,故每次单测点查询
|
||||
*
|
||||
* @param lineParam 监测点参数
|
||||
*/
|
||||
@Override
|
||||
public Map<String, List<DataVFiveItemDTO>> getLineCountEvaluate(LineCountEvaluateParam lineParam) {
|
||||
Map<String, List<DataVFiveItemDTO>> result = new HashMap<>();
|
||||
List<String> lineId = lineParam.getLineId();
|
||||
InfluxQueryWrapper dataVQueryWrapper = new InfluxQueryWrapper(DataV.class, LineDataVFiveItemDTO.class);
|
||||
if(CollectionUtil.isNotEmpty(lineId)){
|
||||
InfluxQueryWrapper dataVQueryWrapper = new InfluxQueryWrapper(DataV.class, LineDataVFiveItemDTO.class);
|
||||
if (CollectionUtil.isNotEmpty(lineId)) {
|
||||
for (String line : lineId) {
|
||||
List<DataVFiveItemDTO> dataVFiveItemDTOS = new ArrayList<>();
|
||||
// 准备查freq,v_thd,v_unbalance 取T项数据
|
||||
dataVQueryWrapper.initSql();
|
||||
dataVQueryWrapper
|
||||
.select(DataV::getTime,DataV::getFreq,DataV::getVThd,DataV::getVUnbalance,DataV::getValueType)
|
||||
.between(DataV::getTime,lineParam.getStartTime(),lineParam.getEndTime())
|
||||
.eq(DataV::getLineId,line)
|
||||
.select(DataV::getTime, DataV::getFreq, DataV::getVThd, DataV::getVUnbalance, DataV::getValueType)
|
||||
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataV::getLineId, line)
|
||||
.eq(DataV::getPhasicType, PhaseType.PHASE_T)
|
||||
.or(DataV::getValueType, ListUtil.of(InfluxDBTableConstant.MAX,InfluxDBTableConstant.MIN));
|
||||
.or(DataV::getValueType, ListUtil.of(InfluxDBTableConstant.MAX, InfluxDBTableConstant.MIN));
|
||||
List<LineDataVFiveItemDTO> lineDataVFiveItemDTOSByT = dataVMapper.queryDataValue(dataVQueryWrapper);
|
||||
|
||||
|
||||
// 准备查rms,rms_lvr 取ABC项数据任意一个数据
|
||||
dataVQueryWrapper.initSql();
|
||||
dataVQueryWrapper
|
||||
.select(DataV::getTime,DataV::getRms,DataV::getRmsLvr)
|
||||
.between(DataV::getTime,lineParam.getStartTime(),lineParam.getEndTime())
|
||||
.eq(DataV::getLineId,line)
|
||||
.eq(DataV::getPhasicType,PhaseType.PHASE_A)
|
||||
.or(DataV::getValueType, ListUtil.of(InfluxDBTableConstant.MAX,InfluxDBTableConstant.MIN));
|
||||
.select(DataV::getTime, DataV::getRms, DataV::getRmsLvr)
|
||||
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataV::getLineId, line)
|
||||
.eq(DataV::getPhasicType, PhaseType.PHASE_A)
|
||||
.or(DataV::getValueType, ListUtil.of(InfluxDBTableConstant.MAX, InfluxDBTableConstant.MIN));
|
||||
List<LineDataVFiveItemDTO> lineDataVFiveItemDTOSByA = dataVMapper.queryDataValue(dataVQueryWrapper);
|
||||
|
||||
System.out.println(123);
|
||||
@@ -90,8 +92,6 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println("InfluxdbDataVImpl");
|
||||
return result;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
@Override
|
||||
public void batchInsertion(List<DataVDTO> dataVDTOList) {
|
||||
int totalCount = dataVDTOList.size();
|
||||
if(totalCount<=0){
|
||||
if (totalCount <= 0) {
|
||||
return;
|
||||
}
|
||||
List<DataV> collect = dataVDTOList.stream().flatMap(temp -> DataV.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||
@@ -117,13 +117,13 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
@Override
|
||||
public List<LocalDateTime> monitoringTime(String lineId, String localData) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
String startTime = localData+ InfluxDBTableConstant.START_TIME;
|
||||
String endTime = localData+ InfluxDBTableConstant.END_TIME;
|
||||
influxQueryWrapper.eq(DataV::getLineId,lineId).between(DataV::getTime, startTime, endTime);
|
||||
String startTime = localData + InfluxDBTableConstant.START_TIME;
|
||||
String endTime = localData + InfluxDBTableConstant.END_TIME;
|
||||
influxQueryWrapper.eq(DataV::getLineId, lineId).between(DataV::getTime, startTime, endTime);
|
||||
|
||||
List<DataV> dataVS = dataVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
List<LocalDateTime> result = dataVS.stream().map(temp->{
|
||||
return LocalDateTime.ofInstant(temp.getTime(), ZoneId.systemDefault());
|
||||
List<LocalDateTime> result = dataVS.stream().map(temp -> {
|
||||
return LocalDateTime.ofInstant(temp.getTime(), ZoneId.systemDefault());
|
||||
}).distinct().collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
@@ -132,9 +132,9 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
public List<DataVDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataVDto> result = new ArrayList<>();
|
||||
List<DataV> list = getMinuteDataV(lineParam);
|
||||
list.forEach(item->{
|
||||
list.forEach(item -> {
|
||||
DataVDto dto = new DataVDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
BeanUtils.copyProperties(item, dto);
|
||||
dto.setMinTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||
result.add(dto);
|
||||
});
|
||||
@@ -145,7 +145,7 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
public Integer getCountRawData(LineCountEvaluateParam lineParam) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.regular(DataV::getLineId,lineParam.getLineId())
|
||||
influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
|
||||
.select(DataV::getLineId)
|
||||
.select(DataV::getPhasicType)
|
||||
.select(DataV::getValueType)
|
||||
@@ -161,6 +161,7 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
.select(DataV::getVlDev)
|
||||
.select(DataV::getVuDev)
|
||||
.select(DataV::getQualityFlag)
|
||||
.eq(DataV::getQualityFlag, "0")
|
||||
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.limit(1)
|
||||
;
|
||||
@@ -168,6 +169,32 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
return dataVS.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getColumnNameCountRawData(LineCountEvaluateParam lineParam) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper
|
||||
.count(lineParam.getColumnName())
|
||||
.regular(DataV::getLineId, lineParam.getLineId())
|
||||
.groupBy("time(1m) fill(none)")
|
||||
.eq(DataV::getQualityFlag, "0")
|
||||
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime());
|
||||
|
||||
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||
influxQueryWrapper.regular(DataV::getPhasicType, lineParam.getPhasicType());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(lineParam.getValueType())) {
|
||||
influxQueryWrapper.regular(DataV::getValueType, lineParam.getValueType());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(lineParam.getGe())) {
|
||||
influxQueryWrapper.ge(lineParam.getColumnName(), lineParam.getGe());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(lineParam.getLt())) {
|
||||
influxQueryWrapper.lt(lineParam.getColumnName(), lineParam.getLt());
|
||||
}
|
||||
List<DataV> dataVS = dataVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
return dataVS.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
@@ -175,22 +202,22 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
if (CollectionUtil.isNotEmpty(dataVList)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
Map<String,List<DataV>> lineMap = dataVList.stream().collect(Collectors.groupingBy(DataV::getLineId));
|
||||
lineMap.forEach((line,lineList)->{
|
||||
Map<String, List<DataV>> lineMap = dataVList.stream().collect(Collectors.groupingBy(DataV::getLineId));
|
||||
lineMap.forEach((line, lineList) -> {
|
||||
CommonMinuteDto dto = new CommonMinuteDto();
|
||||
dto.setLineId(line);
|
||||
dto.setTime(time);
|
||||
dto.setQualityFlag(lineList.get(0).getQualityFlag());
|
||||
//以相别分组
|
||||
Map<String,List<DataV>> phasicTypeMap = lineList.stream().collect(Collectors.groupingBy(DataV::getPhasicType));
|
||||
Map<String, List<DataV>> phasicTypeMap = lineList.stream().collect(Collectors.groupingBy(DataV::getPhasicType));
|
||||
List<CommonMinuteDto.PhasicType> phasicTypes = new ArrayList<>();
|
||||
phasicTypeMap.forEach((phasicType,phasicTypeList)->{
|
||||
phasicTypeMap.forEach((phasicType, phasicTypeList) -> {
|
||||
CommonMinuteDto.PhasicType type = new CommonMinuteDto.PhasicType();
|
||||
type.setPhasicType(phasicType);
|
||||
//以数据类型分组
|
||||
Map<String,List<DataV>> valueTypeMap = phasicTypeList.stream().collect(Collectors.groupingBy(DataV::getValueType));
|
||||
Map<String, List<DataV>> valueTypeMap = phasicTypeList.stream().collect(Collectors.groupingBy(DataV::getValueType));
|
||||
List<CommonMinuteDto.ValueType> valueTypes = new ArrayList<>();
|
||||
valueTypeMap.forEach((valueType,valueTypeList)->{
|
||||
valueTypeMap.forEach((valueType, valueTypeList) -> {
|
||||
CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType();
|
||||
value.setValueType(valueType);
|
||||
//规定好集合指标参数
|
||||
@@ -257,13 +284,13 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
List<Double> data60 = valueTypeList.stream().map(DataV::getV49).collect(Collectors.toList());
|
||||
List<Double> data61 = valueTypeList.stream().map(DataV::getV50).collect(Collectors.toList());
|
||||
|
||||
List<List<Double>> lists = Arrays.asList(data1,data2,data3,data4,data5,data6,data7,data8,data9,data10
|
||||
,data11,data12,data13,data14,data15,data16,data17,data18,data19,data20
|
||||
,data21,data22,data23,data24,data25,data26,data27,data28,data29,data30
|
||||
,data31,data32,data33,data34,data35,data36,data37,data38,data39,data40
|
||||
,data41,data42,data43,data44,data45,data46,data47,data48,data49,data50
|
||||
,data51,data52,data53,data54,data55,data56,data57,data58,data59,data60
|
||||
,data61);
|
||||
List<List<Double>> lists = Arrays.asList(data1, data2, data3, data4, data5, data6, data7, data8, data9, data10
|
||||
, data11, data12, data13, data14, data15, data16, data17, data18, data19, data20
|
||||
, data21, data22, data23, data24, data25, data26, data27, data28, data29, data30
|
||||
, data31, data32, data33, data34, data35, data36, data37, data38, data39, data40
|
||||
, data41, data42, data43, data44, data45, data46, data47, data48, data49, data50
|
||||
, data51, data52, data53, data54, data55, data56, data57, data58, data59, data60
|
||||
, data61);
|
||||
value.setValueList(lists);
|
||||
valueTypes.add(value);
|
||||
});
|
||||
@@ -285,7 +312,7 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
@Override
|
||||
public void addInfluxDbList(List<DataVDto> dataVList) {
|
||||
List<DataV> result = new ArrayList<>();
|
||||
dataVList.forEach(item->{
|
||||
dataVList.forEach(item -> {
|
||||
DataV dataV = new DataV();
|
||||
BeanUtils.copyProperties(item, dataV);
|
||||
dataV.setTime(LocalDateTime.parse(item.getMinTime(), DATE_TIME_FORMATTER).atZone(ZoneId.systemDefault()).toInstant());
|
||||
@@ -297,13 +324,13 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
@Override
|
||||
public void batchInsertionCvtDTO(List<DataVCvtDto> cvtDTOList) {
|
||||
int totalCount = cvtDTOList.size();
|
||||
if(totalCount<=0){
|
||||
if (totalCount <= 0) {
|
||||
return;
|
||||
}
|
||||
List<DataV> collect = cvtDTOList.stream().map(temp ->
|
||||
{
|
||||
DataV dataV = new DataV();
|
||||
BeanUtils.copyProperties(temp,dataV);
|
||||
BeanUtils.copyProperties(temp, dataV);
|
||||
dataV.setTime(LocalDateTime.parse(temp.getMinTime(), DATE_TIME_FORMATTER).atZone(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
return dataV;
|
||||
@@ -322,7 +349,7 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
|
||||
@Override
|
||||
public List<MeasurementCountDTO> getMeasurementCount(List<String> lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class,MeasurementCountDTO.class);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class, MeasurementCountDTO.class);
|
||||
influxQueryWrapper.regular(DataV::getLineId, lineIndex)
|
||||
.eq(DataV::getValueType, InfluxDbSqlConstant.MAX)
|
||||
.eq(DataV::getPhasicType, InfluxDBTableConstant.PHASE_TYPE_A)
|
||||
@@ -349,7 +376,7 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
List<DataV> result = new ArrayList<>();
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.regular(DataV::getLineId,lineParam.getLineId())
|
||||
influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
|
||||
.select(DataV::getLineId)
|
||||
.select(DataV::getPhasicType)
|
||||
.select(DataV::getValueType)
|
||||
@@ -366,15 +393,15 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
.select(DataV::getVuDev)
|
||||
.select(DataV::getQualityFlag)
|
||||
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataV::getQualityFlag,"0");
|
||||
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
|
||||
influxQueryWrapper.regular(DataV::getPhasicType,lineParam.getPhasicType());
|
||||
.eq(DataV::getQualityFlag, "0");
|
||||
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||
influxQueryWrapper.regular(DataV::getPhasicType, lineParam.getPhasicType());
|
||||
}
|
||||
List<DataV> list = dataVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
Map<String,List<DataV>> lineMap = list.stream().collect(Collectors.groupingBy(DataV::getLineId));
|
||||
Map<String, List<DataV>> lineMap = list.stream().collect(Collectors.groupingBy(DataV::getLineId));
|
||||
//有异常数据
|
||||
if (CollectionUtil.isNotEmpty(lineParam.getAbnormalTime())) {
|
||||
lineMap.forEach((k,v)->{
|
||||
lineMap.forEach((k, v) -> {
|
||||
List<String> timeList = lineParam.getAbnormalTime().get(k);
|
||||
//有异常数据,是自身异常数据
|
||||
if (CollectionUtil.isNotEmpty(timeList)) {
|
||||
|
||||
@@ -89,4 +89,9 @@ public class RelationDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
||||
});
|
||||
dataFlicker.saveOrUpdateBatchByMultiId(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getColumnNameCountRawData(LineCountEvaluateParam lineParam) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.njcn.dataProcess.service.impl.relation;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatLimitQualifiedRelationMapper;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.DataQualifiedDetail;
|
||||
import com.njcn.dataProcess.pojo.po.RStatLimitQualifiedD;
|
||||
import com.njcn.dataProcess.service.IDataLimitQualified;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/7 10:13
|
||||
*/
|
||||
@Service("RelationDataLimitQualifiedImpl")
|
||||
@RequiredArgsConstructor
|
||||
public class RelationDataLimitQualifiedImpl extends MppServiceImpl<RStatLimitQualifiedRelationMapper, RStatLimitQualifiedD> implements IDataLimitQualified {
|
||||
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataQualifiedDetail> limitQualifiedList) {
|
||||
List<RStatLimitQualifiedD> result = new ArrayList<>();
|
||||
limitQualifiedList.forEach(item->{
|
||||
RStatLimitQualifiedD limitRate = new RStatLimitQualifiedD();
|
||||
BeanUtils.copyProperties(item, limitRate);
|
||||
result.add(limitRate);
|
||||
});
|
||||
this.saveOrUpdateBatchByMultiId(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataQualifiedDetail> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataQualifiedDetail> result = new ArrayList<>();
|
||||
LambdaQueryWrapper<RStatLimitQualifiedD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(CollUtil.isNotEmpty(lineParam.getLineId()),RStatLimitQualifiedD::getLineId,lineParam.getLineId())
|
||||
.ge(RStatLimitQualifiedD::getTime,lineParam.getStartTime())
|
||||
.le(RStatLimitQualifiedD::getTime,lineParam.getEndTime());
|
||||
List<RStatLimitQualifiedD> list = this.list(lambdaQueryWrapper);
|
||||
|
||||
list.forEach(item->{
|
||||
DataQualifiedDetail dto = new DataQualifiedDetail();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
result.add(dto);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,13 @@ public class RelationDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getColumnNameCountRawData(LineCountEvaluateParam lineParam) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
return Collections.emptyList();
|
||||
|
||||
@@ -56,7 +56,7 @@ data:
|
||||
source:
|
||||
query: Influxdb
|
||||
# insert: Influxdb
|
||||
insert: Influxdb
|
||||
insert: Relation
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
|
||||
Reference in New Issue
Block a user