dataV分钟数据转日表
This commit is contained in:
@@ -11,6 +11,8 @@ import com.njcn.dataProcess.dto.DataVFiveItemDTO;
|
||||
import com.njcn.dataProcess.annotation.InsertBean;
|
||||
import com.njcn.dataProcess.annotation.QueryBean;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataVDto;
|
||||
import com.njcn.dataProcess.service.IDataV;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -73,9 +75,23 @@ public class DataVController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, localDateTimeList, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
|
||||
@PostMapping("/getBaseData")
|
||||
@ApiOperation("获取算法基础数据")
|
||||
public HttpResult<List<CommonMinuteDto>> getBaseData(@RequestBody LineCountEvaluateParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("getBaseData");
|
||||
List<CommonMinuteDto> data = dataVQuery.getBaseData(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/addList")
|
||||
@ApiOperation("批量插入数据")
|
||||
public HttpResult<String> addList(@RequestBody List<DataVDto> dataVDtoList) {
|
||||
String methodDescribe = getMethodDescribe("addList");
|
||||
dataVInsert.addList(dataVDtoList);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "", methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.dataProcess.dao.relation.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.dataProcess.pojo.po.RStatDataVD;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*/
|
||||
public interface RStatDataVRelationMapper extends MppBaseMapper<RStatDataVD> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
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.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataVDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatDataVD;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@@ -13,7 +17,7 @@ import java.util.Map;
|
||||
* @version 1.0
|
||||
* @data 2024/11/7 10:54
|
||||
*/
|
||||
public interface IDataV {
|
||||
public interface IDataV extends IMppService<RStatDataVD> {
|
||||
|
||||
/**
|
||||
* 根据监测点时间范围获取监测点统计数据
|
||||
@@ -25,4 +29,15 @@ public interface IDataV {
|
||||
void batchInsertion(List<DataVDTO> dataVDTOList );
|
||||
|
||||
List<LocalDateTime> monitoringTime(String lineId, String localData);
|
||||
|
||||
/**
|
||||
* 获取监测点原始数据
|
||||
* @param lineParam 监测点参数
|
||||
*/
|
||||
List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam);
|
||||
|
||||
/**
|
||||
* 批量插入数据
|
||||
*/
|
||||
void addList(List<DataVDto> dataVDtoList);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ package com.njcn.dataProcess.service.impl.influxdb;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
||||
import com.njcn.dataProcess.constant.PhaseType;
|
||||
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;
|
||||
@@ -12,17 +15,19 @@ import com.njcn.dataProcess.dto.LineDataVFiveItemDTO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataVMapper;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.influx.DataV;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataVDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatDataVD;
|
||||
import com.njcn.dataProcess.service.IDataV;
|
||||
import com.njcn.dataProcess.util.TimeUtils;
|
||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -31,7 +36,7 @@ import java.util.stream.Collectors;
|
||||
* @data 2024/11/7 11:02
|
||||
*/
|
||||
@Service("InfluxdbDataVImpl")
|
||||
public class InfluxdbDataVImpl implements IDataV {
|
||||
public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper, RStatDataVD> implements IDataV {
|
||||
|
||||
@Resource
|
||||
private DataVMapper dataVMapper;
|
||||
@@ -108,4 +113,143 @@ public class InfluxdbDataVImpl implements IDataV {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataV> dataVList = getMinuteDataV(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime());
|
||||
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)->{
|
||||
CommonMinuteDto dto = new CommonMinuteDto();
|
||||
dto.setLineId(line);
|
||||
dto.setTime(time);
|
||||
//以相别分组
|
||||
Map<String,List<DataV>> phasicTypeMap = lineList.stream().collect(Collectors.groupingBy(DataV::getPhasicType));
|
||||
List<CommonMinuteDto.PhasicType> phasicTypes = new ArrayList<>();
|
||||
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));
|
||||
List<CommonMinuteDto.ValueType> valueTypes = new ArrayList<>();
|
||||
valueTypeMap.forEach((valueType,valueTypeList)->{
|
||||
CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType();
|
||||
value.setValueType(valueType);
|
||||
//todo 规定好集合指标参数
|
||||
List<Double> data1 = valueTypeList.stream().map(DataV::getFreq).collect(Collectors.toList());
|
||||
List<Double> data2 = valueTypeList.stream().map(DataV::getFreqDev).collect(Collectors.toList());
|
||||
List<Double> data3 = valueTypeList.stream().map(DataV::getRms).collect(Collectors.toList());
|
||||
List<Double> data4 = valueTypeList.stream().map(DataV::getRmsLvr).collect(Collectors.toList());
|
||||
List<Double> data5 = valueTypeList.stream().map(DataV::getVNeg).collect(Collectors.toList());
|
||||
List<Double> data6 = valueTypeList.stream().map(DataV::getVPos).collect(Collectors.toList());
|
||||
List<Double> data7 = valueTypeList.stream().map(DataV::getVThd).collect(Collectors.toList());
|
||||
List<Double> data8 = valueTypeList.stream().map(DataV::getVUnbalance).collect(Collectors.toList());
|
||||
List<Double> data9 = valueTypeList.stream().map(DataV::getVZero).collect(Collectors.toList());
|
||||
List<Double> data10 = valueTypeList.stream().map(DataV::getVlDev).collect(Collectors.toList());
|
||||
List<Double> data11 = valueTypeList.stream().map(DataV::getVuDev).collect(Collectors.toList());
|
||||
|
||||
List<Double> data12 = valueTypeList.stream().map(DataV::getV1).collect(Collectors.toList());
|
||||
List<Double> data13 = valueTypeList.stream().map(DataV::getV2).collect(Collectors.toList());
|
||||
List<Double> data14 = valueTypeList.stream().map(DataV::getV3).collect(Collectors.toList());
|
||||
List<Double> data15 = valueTypeList.stream().map(DataV::getV4).collect(Collectors.toList());
|
||||
List<Double> data16 = valueTypeList.stream().map(DataV::getV5).collect(Collectors.toList());
|
||||
List<Double> data17 = valueTypeList.stream().map(DataV::getV6).collect(Collectors.toList());
|
||||
List<Double> data18 = valueTypeList.stream().map(DataV::getV7).collect(Collectors.toList());
|
||||
List<Double> data19 = valueTypeList.stream().map(DataV::getV8).collect(Collectors.toList());
|
||||
List<Double> data20 = valueTypeList.stream().map(DataV::getV9).collect(Collectors.toList());
|
||||
List<Double> data21 = valueTypeList.stream().map(DataV::getV10).collect(Collectors.toList());
|
||||
List<Double> data22 = valueTypeList.stream().map(DataV::getV11).collect(Collectors.toList());
|
||||
List<Double> data23 = valueTypeList.stream().map(DataV::getV12).collect(Collectors.toList());
|
||||
List<Double> data24 = valueTypeList.stream().map(DataV::getV13).collect(Collectors.toList());
|
||||
List<Double> data25 = valueTypeList.stream().map(DataV::getV14).collect(Collectors.toList());
|
||||
List<Double> data26 = valueTypeList.stream().map(DataV::getV15).collect(Collectors.toList());
|
||||
List<Double> data27 = valueTypeList.stream().map(DataV::getV16).collect(Collectors.toList());
|
||||
List<Double> data28 = valueTypeList.stream().map(DataV::getV17).collect(Collectors.toList());
|
||||
List<Double> data29 = valueTypeList.stream().map(DataV::getV18).collect(Collectors.toList());
|
||||
List<Double> data30 = valueTypeList.stream().map(DataV::getV19).collect(Collectors.toList());
|
||||
List<Double> data31 = valueTypeList.stream().map(DataV::getV20).collect(Collectors.toList());
|
||||
List<Double> data32 = valueTypeList.stream().map(DataV::getV21).collect(Collectors.toList());
|
||||
List<Double> data33 = valueTypeList.stream().map(DataV::getV22).collect(Collectors.toList());
|
||||
List<Double> data34 = valueTypeList.stream().map(DataV::getV23).collect(Collectors.toList());
|
||||
List<Double> data35 = valueTypeList.stream().map(DataV::getV24).collect(Collectors.toList());
|
||||
List<Double> data36 = valueTypeList.stream().map(DataV::getV25).collect(Collectors.toList());
|
||||
List<Double> data37 = valueTypeList.stream().map(DataV::getV26).collect(Collectors.toList());
|
||||
List<Double> data38 = valueTypeList.stream().map(DataV::getV27).collect(Collectors.toList());
|
||||
List<Double> data39 = valueTypeList.stream().map(DataV::getV28).collect(Collectors.toList());
|
||||
List<Double> data40 = valueTypeList.stream().map(DataV::getV29).collect(Collectors.toList());
|
||||
List<Double> data41 = valueTypeList.stream().map(DataV::getV30).collect(Collectors.toList());
|
||||
List<Double> data42 = valueTypeList.stream().map(DataV::getV31).collect(Collectors.toList());
|
||||
List<Double> data43 = valueTypeList.stream().map(DataV::getV32).collect(Collectors.toList());
|
||||
List<Double> data44 = valueTypeList.stream().map(DataV::getV33).collect(Collectors.toList());
|
||||
List<Double> data45 = valueTypeList.stream().map(DataV::getV34).collect(Collectors.toList());
|
||||
List<Double> data46 = valueTypeList.stream().map(DataV::getV35).collect(Collectors.toList());
|
||||
List<Double> data47 = valueTypeList.stream().map(DataV::getV36).collect(Collectors.toList());
|
||||
List<Double> data48 = valueTypeList.stream().map(DataV::getV37).collect(Collectors.toList());
|
||||
List<Double> data49 = valueTypeList.stream().map(DataV::getV38).collect(Collectors.toList());
|
||||
List<Double> data50 = valueTypeList.stream().map(DataV::getV39).collect(Collectors.toList());
|
||||
List<Double> data51 = valueTypeList.stream().map(DataV::getV40).collect(Collectors.toList());
|
||||
List<Double> data52 = valueTypeList.stream().map(DataV::getV41).collect(Collectors.toList());
|
||||
List<Double> data53 = valueTypeList.stream().map(DataV::getV42).collect(Collectors.toList());
|
||||
List<Double> data54 = valueTypeList.stream().map(DataV::getV43).collect(Collectors.toList());
|
||||
List<Double> data55 = valueTypeList.stream().map(DataV::getV44).collect(Collectors.toList());
|
||||
List<Double> data56 = valueTypeList.stream().map(DataV::getV45).collect(Collectors.toList());
|
||||
List<Double> data57 = valueTypeList.stream().map(DataV::getV46).collect(Collectors.toList());
|
||||
List<Double> data58 = valueTypeList.stream().map(DataV::getV47).collect(Collectors.toList());
|
||||
List<Double> data59 = valueTypeList.stream().map(DataV::getV48).collect(Collectors.toList());
|
||||
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);
|
||||
value.setValueList(lists);
|
||||
valueTypes.add(value);
|
||||
});
|
||||
type.setValueTypeList(valueTypes);
|
||||
phasicTypes.add(type);
|
||||
});
|
||||
dto.setPhasicTypeList(phasicTypes);
|
||||
result.add(dto);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addList(List<DataVDto> dataVDtoList) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 按监测点集合、时间条件获取dataV分钟数据
|
||||
*/
|
||||
public List<DataV> getMinuteDataV(List<String> lineList, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.regular(DataV::getLineId, lineList)
|
||||
.select(DataV::getLineId)
|
||||
.select(DataV::getPhasicType)
|
||||
.select(DataV::getValueType)
|
||||
.select(DataV::getFreq)
|
||||
.select(DataV::getFreqDev)
|
||||
.select(DataV::getRms)
|
||||
.select(DataV::getRmsLvr)
|
||||
.select(DataV::getVNeg)
|
||||
.select(DataV::getVPos)
|
||||
.select(DataV::getVThd)
|
||||
.select(DataV::getVUnbalance)
|
||||
.select(DataV::getVZero)
|
||||
.select(DataV::getVlDev)
|
||||
.select(DataV::getVuDev)
|
||||
.between(DataV::getTime, startTime, endTime);
|
||||
System.out.println(influxQueryWrapper.generateSql());
|
||||
return dataVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
package com.njcn.dataProcess.service.impl.relation;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataVRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataVDTO;
|
||||
import com.njcn.dataProcess.dto.DataVFiveItemDTO;
|
||||
|
||||
import com.njcn.dataProcess.dao.relation.mapper.DataVRelationMapper;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.relation.DataV;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataVDto;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -16,6 +22,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -27,9 +35,11 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service("RelationDataVImpl")
|
||||
@RequiredArgsConstructor
|
||||
public class RelationDataVImpl implements IDataV {
|
||||
public class RelationDataVImpl extends MppServiceImpl<RStatDataVRelationMapper, RStatDataVD> implements IDataV {
|
||||
@Resource
|
||||
private DataVRelationMapper dataVRelationMapper;
|
||||
@Resource
|
||||
private IDataV iDataV;
|
||||
@Override
|
||||
public Map<String, List<DataVFiveItemDTO>> getLineCountEvaluate(LineCountEvaluateParam lineParam) {
|
||||
|
||||
@@ -73,4 +83,22 @@ public class RelationDataVImpl implements IDataV {
|
||||
List<LocalDateTime> result = dataVS.stream().map(DataV::getTimeid).distinct().collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addList(List<DataVDto> dataVDtoList) {
|
||||
List<RStatDataVD> result = new ArrayList<>();
|
||||
dataVDtoList.forEach(item->{
|
||||
RStatDataVD dataV = new RStatDataVD();
|
||||
dataV.setTime(TimeUtils.LocalDataTimeToLocalDate2(item.getTime()));
|
||||
dataV.setPhasicType(item.getPhasicType());
|
||||
BeanUtils.copyProperties(item, dataV);
|
||||
result.add(dataV);
|
||||
});
|
||||
iDataV.saveOrUpdateBatchByMultiId(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ mqtt:
|
||||
|
||||
data:
|
||||
source:
|
||||
query: Relation
|
||||
query: Influxdb
|
||||
insert: Relation
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
|
||||
Reference in New Issue
Block a user