数据完整性部分代码提交

This commit is contained in:
2025-03-13 10:16:37 +08:00
parent 7d503a42b1
commit dc178ff920
28 changed files with 919 additions and 33 deletions

View File

@@ -92,4 +92,13 @@ public class DataHarmRateVController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "", methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getHarmRateVData")
@ApiOperation("获取谐波含有率数据")
public HttpResult<List<DataHarmDto>> getHarmRateVData(@RequestBody LineCountEvaluateParam lineParam) {
String methodDescribe = getMethodDescribe("getHarmRateVData");
List<DataHarmDto> data = dataHarmRateVInsert.getHarmRateVData(lineParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
}
}

View File

@@ -83,4 +83,13 @@ public class DataIController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "", methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getDataI")
@ApiOperation("关系型数据库插入数据")
public HttpResult<String> getDataI(@RequestBody LineCountEvaluateParam lineParam) {
String methodDescribe = getMethodDescribe("getDataI");
// dataIInsert.getDataI(dataIDtoList);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "", methodDescribe);
}
}

View File

@@ -0,0 +1,48 @@
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.pojo.dto.DataIntegrityDto;
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
import com.njcn.dataProcess.pojo.po.RStatIntegrityD;
import com.njcn.dataProcess.service.IDataIntegrity;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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: cdf
* @CreateTime: 2025-03-12
* @Description: 数据完整性
*/
@RestController
@RequestMapping("/dataIntegrity")
@Api(tags = "数据完整性")
@RequiredArgsConstructor
public class DataIntegrityController extends BaseController {
@InsertBean
private IDataIntegrity iDataIntegrity;
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@PostMapping("/batchInsertion")
@ApiOperation("批量插入")
public HttpResult<String> batchInsertion(@RequestBody List<RStatIntegrityD> poList) {
String methodDescribe = getMethodDescribe("batchInsertion");
iDataIntegrity.batchInsertion(poList);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -10,6 +10,7 @@ import com.njcn.dataProcess.annotation.InsertBean;
import com.njcn.dataProcess.annotation.QueryBean;
import com.njcn.dataProcess.dto.DataVDTO;
import com.njcn.dataProcess.dto.DataVFiveItemDTO;
import com.njcn.dataProcess.dto.MeasurementCountDTO;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
import com.njcn.dataProcess.pojo.dto.DataVCvtDto;
@@ -133,4 +134,15 @@ public class DataVController extends BaseController {
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getMeasurementCount")
@ApiOperation("获取算法基础数据")
public HttpResult<List<MeasurementCountDTO>> getMeasurementCount(List<String> lineIndex, String startTime, String endTime) {
String methodDescribe = getMethodDescribe("getMeasurementCount");
List<MeasurementCountDTO> data = dataVQuery.getMeasurementCount(lineIndex,startTime,endTime);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
}
}

View File

@@ -1,10 +1,12 @@
package com.njcn.dataProcess.dao.imapper;
import com.njcn.dataProcess.dto.LineDataVFiveItemDTO;
import com.njcn.dataProcess.dto.MeasurementCountDTO;
import com.njcn.dataProcess.po.influx.DataV;
import com.njcn.influx.base.InfluxDbBaseMapper;
import com.njcn.influx.query.InfluxQueryWrapper;
import java.util.List;
/**
@@ -17,4 +19,10 @@ public interface DataVMapper extends InfluxDbBaseMapper<DataV> {
List<LineDataVFiveItemDTO> queryDataValue(InfluxQueryWrapper dataVQueryWrapper);
List<MeasurementCountDTO> getMeasurementCount(InfluxQueryWrapper influxQueryWrapper);
}

View File

@@ -37,4 +37,7 @@ IDataHarmRateV extends IMppService<RStatDataHarmRateVD> {
void addList(List<DataHarmRateVDto> list);
DataHarmDto getTopData();
List<DataHarmDto> getHarmRateVData(LineCountEvaluateParam lineParam);
}

View File

@@ -18,6 +18,6 @@ public interface IDataIntegrity extends IMppService<RStatIntegrityD>{
* 批量插入数据
* @param onlineRateList
*/
void batchInsertion(List<DataIntegrityDto> onlineRateList);
void batchInsertion(List<RStatIntegrityD> onlineRateList);
}

View File

@@ -3,6 +3,7 @@ package com.njcn.dataProcess.service;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.dataProcess.dto.DataVDTO;
import com.njcn.dataProcess.dto.DataVFiveItemDTO;
import com.njcn.dataProcess.dto.MeasurementCountDTO;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
import com.njcn.dataProcess.pojo.dto.DataVCvtDto;
@@ -59,4 +60,10 @@ public interface IDataV extends IMppService<RStatDataVD> {
void addInfluxDbList(List<DataVDto> dataVList);
void batchInsertionCvtDTO(List<DataVCvtDto> cvtDTOList);
List<MeasurementCountDTO> getMeasurementCount(List<String> lineIndex, String startTime, String endTime);
List<DataVDto> getDataV(LineCountEvaluateParam lineParam);
}

View File

@@ -26,10 +26,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -193,6 +190,11 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
return dto;
}
@Override
public List<DataHarmDto> getHarmRateVData(LineCountEvaluateParam lineParam) {
return Collections.emptyList();
}
/**
* 按监测点集合、时间条件获取分钟数据
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理

View File

@@ -23,7 +23,7 @@ public class InfluxdbDataIntegrityImpl extends MppServiceImpl<RStatIntegrityDMap
@Override
public void batchInsertion(List<DataIntegrityDto> onlineRateList) {
public void batchInsertion(List<RStatIntegrityD> onlineRateList) {
}
}

View File

@@ -12,6 +12,7 @@ import com.njcn.dataProcess.dao.relation.mapper.RStatDataVRelationMapper;
import com.njcn.dataProcess.dto.DataVDTO;
import com.njcn.dataProcess.dto.DataVFiveItemDTO;
import com.njcn.dataProcess.dto.LineDataVFiveItemDTO;
import com.njcn.dataProcess.dto.MeasurementCountDTO;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.po.influx.DataV;
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
@@ -319,6 +320,23 @@ 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.regular(DataV::getLineId, lineIndex)
.eq(DataV::getValueType, InfluxDbSqlConstant.MAX)
.eq(DataV::getPhasicType, InfluxDBTableConstant.PHASE_TYPE_A)
.count(DataV::getFreq)
.groupBy(DataV::getLineId)
.between(DataV::getTime, startTime, endTime);
return dataVMapper.getMeasurementCount(influxQueryWrapper);
}
@Override
public List<DataVDto> getDataV(LineCountEvaluateParam lineParam) {
return Collections.emptyList();
}
/**
* 按监测点集合、时间条件获取dataV分钟数据
* timeMap参数来判断是否进行数据出来 timeMap为空则不进行数据处理

View File

@@ -0,0 +1,9 @@
package com.njcn.dataProcess.service.impl.relation;
/**
* @Author: cdf
* @CreateTime: 2025-03-12
* @Description: 数据完整性
*/
public class RStatIntegrityDImpl {
}

View File

@@ -1,5 +1,8 @@
package com.njcn.dataProcess.service.impl.relation;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.dataProcess.dao.relation.mapper.DataHarmrateVRelationMapper;
import com.njcn.dataProcess.dao.relation.mapper.DataIRelationMapper;
@@ -10,7 +13,9 @@ import com.njcn.dataProcess.po.relation.DataHarmrateV;
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
import com.njcn.dataProcess.pojo.dto.DataHarmRateVDto;
import com.njcn.dataProcess.pojo.dto.DataVDto;
import com.njcn.dataProcess.pojo.po.RStatDataHarmRateVD;
import com.njcn.dataProcess.pojo.po.RStatDataVD;
import com.njcn.dataProcess.service.IDataHarmRateV;
import com.njcn.dataProcess.util.BeanFeildUtils;
import com.njcn.dataProcess.util.TimeUtils;
@@ -20,6 +25,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -94,4 +100,22 @@ public class RelationDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
public DataHarmDto getTopData() {
return null;
}
@Override
public List<DataHarmDto> getHarmRateVData(LineCountEvaluateParam lineParam) {
List<DataHarmDto> result = new ArrayList<>();
List<RStatDataHarmRateVD> rStatDataHarmRateVDList = dataHarmRateV.list(new LambdaQueryWrapper<RStatDataHarmRateVD>()
.in(RStatDataHarmRateVD::getLineId,lineParam.getLineId())
.in(RStatDataHarmRateVD::getValueType, lineParam.getValueType())
.in(RStatDataHarmRateVD::getPhasicType, lineParam.getPhasicType())
.ge(RStatDataHarmRateVD::getTime, lineParam.getStartTime())
.le(RStatDataHarmRateVD::getTime, lineParam.getEndTime())
);
for(RStatDataHarmRateVD rStatDataHarmRateVD : rStatDataHarmRateVDList){
DataHarmDto dto = BeanUtil.copyProperties(rStatDataHarmRateVD,DataHarmDto.class);
dto.setTime(rStatDataHarmRateVD.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
result.add(dto);
}
return result;
}
}

View File

@@ -1,6 +1,7 @@
package com.njcn.dataProcess.service.impl.relation;
import cn.hutool.core.bean.BeanUtil;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.dataProcess.dao.relation.mapper.RStatIntegrityDMapper;
import com.njcn.dataProcess.pojo.dto.DataIntegrityDto;
@@ -23,7 +24,7 @@ public class RelationDataIntegrityImpl extends MppServiceImpl<RStatIntegrityDMap
@Override
public void batchInsertion(List<DataIntegrityDto> onlineRateList) {
public void batchInsertion(List<RStatIntegrityD> dataIntegrityDtoList) {
this.saveOrUpdateBatchByMultiId(dataIntegrityDtoList);
}
}

View File

@@ -1,11 +1,18 @@
package com.njcn.dataProcess.service.impl.relation;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
import com.njcn.dataProcess.dao.relation.mapper.DataVRelationMapper;
import com.njcn.dataProcess.dao.relation.mapper.RStatDataVRelationMapper;
import com.njcn.dataProcess.dto.DataVDTO;
import com.njcn.dataProcess.dto.DataVFiveItemDTO;
import com.njcn.dataProcess.dto.MeasurementCountDTO;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.po.relation.DataV;
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
@@ -15,17 +22,19 @@ import com.njcn.dataProcess.pojo.po.RStatDataVD;
import com.njcn.dataProcess.service.IDataV;
import com.njcn.dataProcess.util.BeanFeildUtils;
import com.njcn.dataProcess.util.TimeUtils;
import com.njcn.influx.constant.InfluxDbSqlConstant;
import com.njcn.influx.query.InfluxQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.ehcache.core.util.CollectionUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -125,5 +134,27 @@ public class RelationDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
}
@Override
public List<MeasurementCountDTO> getMeasurementCount(List<String> lineIndex, String startTime, String endTime) {
return Collections.emptyList();
}
@Override
public List<DataVDto> getDataV(LineCountEvaluateParam lineParam) {
List<DataVDto> result = new ArrayList<>();
List<RStatDataVD> rStatDataVDList = iDataV.list(new LambdaQueryWrapper<RStatDataVD>()
.in(RStatDataVD::getValueType, lineParam.getValueType())
.in(RStatDataVD::getPhasicType, lineParam.getPhasicType())
.ge(RStatDataVD::getTime, lineParam.getStartTime())
.le(RStatDataVD::getTime, lineParam.getEndTime())
);
for(RStatDataVD rStatDataVD : rStatDataVDList){
DataVDto dto = BeanUtil.copyProperties(rStatDataVD,DataVDto.class);
dto.setTime(rStatDataVD.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
result.add(dto);
}
return result;
}
}