数据清除 修正索引错误与空值判断逻辑

This commit is contained in:
wr
2025-03-24 10:54:35 +08:00
parent 65f4066dd4
commit 90a5a27db0
10 changed files with 113 additions and 77 deletions

View File

@@ -125,6 +125,8 @@ public class ExecutionCenter extends BaseController {
CalculatedParam calculatedParam = judgeExecuteParam(baseParam); CalculatedParam calculatedParam = judgeExecuteParam(baseParam);
// 测点索引 // 测点索引
if (CollectionUtils.isEmpty(calculatedParam.getIdList())) { if (CollectionUtils.isEmpty(calculatedParam.getIdList())) {
// calculatedParam.setIdList(Arrays.asList("c5f4925dbe333230810fe1a6afc51dfb","293178e56cd207e6e33586090f5034be","2df0cb6a87ef523b726c0a9ff6cfd288","43a1391b503bcd7f1b9a2f8f90e53e0f"
// ));
calculatedParam.setIdList(commTerminalGeneralClient.getRunMonitorIds().getData()); calculatedParam.setIdList(commTerminalGeneralClient.getRunMonitorIds().getData());
} }
LiteflowResponse liteflowResponse; LiteflowResponse liteflowResponse;

View File

@@ -1289,7 +1289,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setI47(getData(type,valueType.getValueList().get(46),scheme)); dto.setI47(getData(type,valueType.getValueList().get(46),scheme));
dto.setI48(getData(type,valueType.getValueList().get(47),scheme)); dto.setI48(getData(type,valueType.getValueList().get(47),scheme));
dto.setI49(getData(type,valueType.getValueList().get(48),scheme)); dto.setI49(getData(type,valueType.getValueList().get(48),scheme));
dto.setI50(getData(type,valueType.getValueList().get(50),scheme)); dto.setI50(getData(type,valueType.getValueList().get(49),scheme));
} }
public void channelDataHarmRateVHandler(CommonMinuteDto.ValueType pojo1, CommonMinuteDto.ValueType pojo2, DataHarmRateVDto dto, boolean scheme) { public void channelDataHarmRateVHandler(CommonMinuteDto.ValueType pojo1, CommonMinuteDto.ValueType pojo2, DataHarmRateVDto dto, boolean scheme) {
@@ -1356,7 +1356,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setV47(getData(type,valueType.getValueList().get(46),scheme)); dto.setV47(getData(type,valueType.getValueList().get(46),scheme));
dto.setV48(getData(type,valueType.getValueList().get(47),scheme)); dto.setV48(getData(type,valueType.getValueList().get(47),scheme));
dto.setV49(getData(type,valueType.getValueList().get(48),scheme)); dto.setV49(getData(type,valueType.getValueList().get(48),scheme));
dto.setV50(getData(type,valueType.getValueList().get(50),scheme)); dto.setV50(getData(type,valueType.getValueList().get(49),scheme));
} }
public void channelDataInHarmIHandler(CommonMinuteDto.ValueType pojo1, CommonMinuteDto.ValueType pojo2, DataInHarmIDto dto, boolean scheme) { public void channelDataInHarmIHandler(CommonMinuteDto.ValueType pojo1, CommonMinuteDto.ValueType pojo2, DataInHarmIDto dto, boolean scheme) {
@@ -1423,7 +1423,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setI47(getData(type,valueType.getValueList().get(46),scheme)); dto.setI47(getData(type,valueType.getValueList().get(46),scheme));
dto.setI48(getData(type,valueType.getValueList().get(47),scheme)); dto.setI48(getData(type,valueType.getValueList().get(47),scheme));
dto.setI49(getData(type,valueType.getValueList().get(48),scheme)); dto.setI49(getData(type,valueType.getValueList().get(48),scheme));
dto.setI50(getData(type,valueType.getValueList().get(50),scheme)); dto.setI50(getData(type,valueType.getValueList().get(49),scheme));
} }
public void channelDataInHarmVHandler(CommonMinuteDto.ValueType pojo1, CommonMinuteDto.ValueType pojo2, DataInHarmVDto dto, boolean scheme) { public void channelDataInHarmVHandler(CommonMinuteDto.ValueType pojo1, CommonMinuteDto.ValueType pojo2, DataInHarmVDto dto, boolean scheme) {
@@ -1490,7 +1490,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setV47(getData(type,valueType.getValueList().get(46),scheme)); dto.setV47(getData(type,valueType.getValueList().get(46),scheme));
dto.setV48(getData(type,valueType.getValueList().get(47),scheme)); dto.setV48(getData(type,valueType.getValueList().get(47),scheme));
dto.setV49(getData(type,valueType.getValueList().get(48),scheme)); dto.setV49(getData(type,valueType.getValueList().get(48),scheme));
dto.setV50(getData(type,valueType.getValueList().get(50),scheme)); dto.setV50(getData(type,valueType.getValueList().get(49),scheme));
} }
public void channelDataPltHandler(CommonMinuteDto.ValueType pojo1, DataPltDto dto, String valueType, boolean scheme) { public void channelDataPltHandler(CommonMinuteDto.ValueType pojo1, DataPltDto dto, String valueType, boolean scheme) {

View File

@@ -201,20 +201,21 @@ public class IDataCrossingServiceImpl implements IDataCrossingService {
.collect(Collectors.groupingBy(DataPltDto::getLineId)); .collect(Collectors.groupingBy(DataPltDto::getLineId));
for (String item : list) { for (String item : list) {
result.addAll(getData(calculatedParam.getDataDate(), if(ObjectUtil.isNotNull(overLimitMap.get(item))){
overLimitMap.get(item), result.addAll(getData(calculatedParam.getDataDate(),
allTime.get(item), overLimitMap.get(item),
flickerAllTime.get(item), allTime.get(item),
harmRateV.get(item), flickerAllTime.get(item),
dataI.get(item), harmRateV.get(item),
inHarmV.get(item), dataI.get(item),
dataVThd.get(item), inHarmV.get(item),
dataVUnbalance.get(item), dataVThd.get(item),
dataINeg.get(item), dataVUnbalance.get(item),
dataVFreq.get(item), dataINeg.get(item),
dataVDev.get(item), dataVFreq.get(item),
dataPlt.get(item))); dataVDev.get(item),
dataPlt.get(item)));
}
} }
}); });

View File

@@ -12,7 +12,6 @@ import com.njcn.dataProcess.util.TimeUtils;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO; import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO; import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;

View File

@@ -144,12 +144,21 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
influxQueryWrapper.lt(lineParam.getColumnName(), Double.parseDouble(lineParam.getLt())); influxQueryWrapper.lt(lineParam.getColumnName(), Double.parseDouble(lineParam.getLt()));
} }
List<DataFlicker> result = new ArrayList<>(); List<DataFlicker> result = new ArrayList<>();
quality(result, influxQueryWrapper, lineParam); List<DataFlicker> list = dataFlickerMapper.selectByQueryWrapper(influxQueryWrapper);
if (CollUtil.isNotEmpty(list)) {
Map<String, List<String>> abnormalTime = lineParam.getAbnormalTime();
if (abnormalTime.containsKey(lineParam.getLineId().get(0))) {
List<String> timeList = abnormalTime.get(lineParam.getLineId().get(0));
//有异常数据,当前监测点自身的异常数据
if (CollectionUtil.isNotEmpty(timeList)) {
result.addAll(list.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList()));
}
}
}
return result.size(); return result.size();
} }
private void quality(List<DataFlicker> result, InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam lineParam) { private void quality(List<DataFlicker> result, InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam lineParam) {
List<DataFlicker> list = dataFlickerMapper.selectByQueryWrapper(influxQueryWrapper); List<DataFlicker> list = dataFlickerMapper.selectByQueryWrapper(influxQueryWrapper);
Map<String, List<DataFlicker>> lineMap = list.stream().collect(Collectors.groupingBy(DataFlicker::getLineId)); Map<String, List<DataFlicker>> lineMap = list.stream().collect(Collectors.groupingBy(DataFlicker::getLineId));
//有异常数据 //有异常数据

View File

@@ -181,8 +181,18 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
if (ObjectUtil.isNotEmpty(lineParam.getLt())) { if (ObjectUtil.isNotEmpty(lineParam.getLt())) {
influxQueryWrapper.lt(lineParam.getColumnName(), Double.parseDouble(lineParam.getLt())); influxQueryWrapper.lt(lineParam.getColumnName(), Double.parseDouble(lineParam.getLt()));
} }
List<DataV> result=new ArrayList<>(); List<DataV> result = new ArrayList<>();
quality(result, influxQueryWrapper,lineParam); List<DataV> list = dataVMapper.selectByQueryWrapper(influxQueryWrapper);
if (CollUtil.isNotEmpty(list)) {
Map<String, List<String>> abnormalTime = lineParam.getAbnormalTime();
if (abnormalTime.containsKey(lineParam.getLineId().get(0))) {
List<String> timeList = abnormalTime.get(lineParam.getLineId().get(0));
//有异常数据,当前监测点自身的异常数据
if (CollectionUtil.isNotEmpty(timeList)) {
result.addAll(list.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList()));
}
}
}
return result.size(); return result.size();
} }
@@ -339,7 +349,8 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
} }
@Override @Override
public List<MeasurementCountDTO> getMeasurementCount(List<String> lineIndex, String startTime, String endTime) { 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) influxQueryWrapper.regular(DataV::getLineId, lineIndex)
.eq(DataV::getValueType, InfluxDbSqlConstant.MAX) .eq(DataV::getValueType, InfluxDbSqlConstant.MAX)
@@ -388,40 +399,43 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) { if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
influxQueryWrapper.regular(DataV::getPhasicType, lineParam.getPhasicType()); influxQueryWrapper.regular(DataV::getPhasicType, lineParam.getPhasicType());
} }
quality(result, influxQueryWrapper,lineParam); quality(result, influxQueryWrapper, lineParam);
return result; return result;
} }
private void quality(List<DataV> result,InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam lineParam) { private void quality(List<DataV> result, InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam
lineParam) {
List<DataV> list = dataVMapper.selectByQueryWrapper(influxQueryWrapper); List<DataV> list = dataVMapper.selectByQueryWrapper(influxQueryWrapper);
Map<String, List<DataV>> lineMap = list.stream().collect(Collectors.groupingBy(DataV::getLineId)); if (CollUtil.isNotEmpty(list)) {
//有异常数据 Map<String, List<DataV>> lineMap = list.stream().collect(Collectors.groupingBy(DataV::getLineId));
Map<String, List<String>> timeMap = lineParam.getAbnormalTime(); //有异常数据
if (CollectionUtil.isNotEmpty(timeMap)) { Map<String, List<String>> timeMap = lineParam.getAbnormalTime();
lineMap.forEach((k, v) -> { if (CollectionUtil.isNotEmpty(timeMap)) {
List<String> timeList = timeMap.get(k); lineMap.forEach((k, v) -> {
//有异常数据,当前监测点自身的异常数据 List<String> timeList = timeMap.get(k);
if (CollectionUtil.isNotEmpty(timeList)) { //有异常数据,当前监测点自身的异常数据
List<DataV> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(timeList)) {
//1.过滤掉异常数据后还有正常数据,则用正常数据计算 List<DataV> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(filterList)) { //1.过滤掉异常数据后还有正常数据,则用正常数据计算
result.addAll(filterList); if (CollectionUtil.isNotEmpty(filterList)) {
result.addAll(filterList);
}
//2.过滤掉异常数据后没有正常数据,则用所有异常数据计算,但是需要标记数据为异常的
else {
v.parallelStream().forEach(item -> item.setQualityFlag("1"));
result.addAll(v);
}
} }
//2.过滤掉异常数据后没有常数据,则用所有异常数据计算,但是需要标记数据为异常的 //没有常数据,则使用原数据
else { else {
v.parallelStream().forEach(item -> item.setQualityFlag("1"));
result.addAll(v); result.addAll(v);
} }
} });
//没有异常数据,则使用原数据 }
else { //没有异常数据,则使用原数据
result.addAll(v); else {
} result.addAll(list);
}); }
}
//没有异常数据,则使用原数据
else {
result.addAll(list);
} }
} }
} }

View File

@@ -3,6 +3,7 @@ package com.njcn.dataProcess.service.impl.relation;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.dataProcess.dao.relation.mapper.DataHarmrateVRelationMapper; import com.njcn.dataProcess.dao.relation.mapper.DataHarmrateVRelationMapper;
@@ -52,13 +53,12 @@ public class RelationDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
} }
@Override @Override
public void batchInsertion(List<DataHarmrateVDTO> dataHarmrateVDTOList) { public void batchInsertion(List<DataHarmrateVDTO> dataHarmrateVDTOList) {
int totalCount = dataHarmrateVDTOList.size(); int totalCount = dataHarmrateVDTOList.size();
int minSize = Math.min(120, totalCount); int minSize = Math.min(120, totalCount);
if(totalCount<=0){ if (totalCount <= 0) {
return; return;
} }
List<DataHarmrateV> collect = dataHarmrateVDTOList.stream().map(temp -> { List<DataHarmrateV> collect = dataHarmrateVDTOList.stream().map(temp -> {
@@ -87,7 +87,7 @@ public class RelationDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
@Override @Override
public void addList(List<DataHarmRateVDto> list) { public void addList(List<DataHarmRateVDto> list) {
List<RStatDataHarmRateVD> result = new ArrayList<>(); List<RStatDataHarmRateVD> result = new ArrayList<>();
list.forEach(item->{ list.forEach(item -> {
RStatDataHarmRateVD data = new RStatDataHarmRateVD(); RStatDataHarmRateVD data = new RStatDataHarmRateVD();
data.setTime(TimeUtils.LocalDataTimeToLocalDate2(item.getTime())); data.setTime(TimeUtils.LocalDataTimeToLocalDate2(item.getTime()));
data.setPhasicType(item.getPhasicType()); data.setPhasicType(item.getPhasicType());
@@ -107,18 +107,20 @@ public class RelationDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
public List<DataHarmDto> getHarmRateVData(LineCountEvaluateParam lineParam) { public List<DataHarmDto> getHarmRateVData(LineCountEvaluateParam lineParam) {
List<DataHarmDto> result = new ArrayList<>(); List<DataHarmDto> result = new ArrayList<>();
List<RStatDataHarmRateVD> rStatDataHarmRateVDList = dataHarmRateV.list(new LambdaQueryWrapper<RStatDataHarmRateVD>() List<RStatDataHarmRateVD> rStatDataHarmRateVDList = dataHarmRateV.list(new LambdaQueryWrapper<RStatDataHarmRateVD>()
.in(RStatDataHarmRateVD::getLineId,lineParam.getLineId()) .in(RStatDataHarmRateVD::getLineId, lineParam.getLineId())
.in(RStatDataHarmRateVD::getValueType, lineParam.getValueType()) .in(RStatDataHarmRateVD::getValueType, lineParam.getValueType())
.in(RStatDataHarmRateVD::getPhasicType, lineParam.getPhasicType()) .in(RStatDataHarmRateVD::getPhasicType, lineParam.getPhasicType())
.ge(RStatDataHarmRateVD::getTime, lineParam.getStartTime()) .ge(RStatDataHarmRateVD::getTime, lineParam.getStartTime())
.le(RStatDataHarmRateVD::getTime, lineParam.getEndTime()) .le(RStatDataHarmRateVD::getTime, lineParam.getEndTime())
); );
for(RStatDataHarmRateVD rStatDataHarmRateVD : rStatDataHarmRateVDList){ for (RStatDataHarmRateVD rStatDataHarmRateVD : rStatDataHarmRateVDList) {
DataHarmDto dto = BeanUtil.copyProperties(rStatDataHarmRateVD,DataHarmDto.class); DataHarmDto dto = BeanUtil.copyProperties(rStatDataHarmRateVD, DataHarmDto.class);
dto.setTime(rStatDataHarmRateVD.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN))); if (ObjectUtil.isNotNull(rStatDataHarmRateVD.getTime())) {
dto.setTime(rStatDataHarmRateVD.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
}
result.add(dto); result.add(dto);
} }
return quality(result,lineParam); return quality(result, lineParam);
} }
private List<DataHarmDto> quality(List<DataHarmDto> list, LineCountEvaluateParam lineParam) { private List<DataHarmDto> quality(List<DataHarmDto> list, LineCountEvaluateParam lineParam) {

View File

@@ -3,6 +3,7 @@ package com.njcn.dataProcess.service.impl.relation;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -49,9 +50,9 @@ public class RelationDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
@Override @Override
public void batchInsertion(List<DataIDTO> dataIDTOList) { public void batchInsertion(List<DataIDTO> dataIDTOList) {
int totalCount = dataIDTOList.size(); int totalCount = dataIDTOList.size();
int minSize = Math.min(120, totalCount); int minSize = Math.min(120, totalCount);
if(totalCount<=0){ if (totalCount <= 0) {
return; return;
} }
List<DataI> collect = dataIDTOList.stream().map(temp -> { List<DataI> collect = dataIDTOList.stream().map(temp -> {
@@ -84,7 +85,7 @@ public class RelationDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
@Override @Override
public void addList(List<DataIDto> dataIDtoList) { public void addList(List<DataIDto> dataIDtoList) {
List<RStatDataID> result = new ArrayList<>(); List<RStatDataID> result = new ArrayList<>();
dataIDtoList.forEach(item->{ dataIDtoList.forEach(item -> {
RStatDataID dataI = new RStatDataID(); RStatDataID dataI = new RStatDataID();
dataI.setTime(TimeUtils.LocalDataTimeToLocalDate2(item.getTime())); dataI.setTime(TimeUtils.LocalDataTimeToLocalDate2(item.getTime()));
dataI.setPhasicType(item.getPhasicType()); dataI.setPhasicType(item.getPhasicType());
@@ -100,7 +101,7 @@ public class RelationDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
List<DataIDto> result = new ArrayList<>(); List<DataIDto> result = new ArrayList<>();
QueryWrapper<RStatDataID> queryWrapper = new QueryWrapper<>(); QueryWrapper<RStatDataID> queryWrapper = new QueryWrapper<>();
if(StrUtil.isNotBlank(lineParam.getColumnName())){ if (StrUtil.isNotBlank(lineParam.getColumnName())) {
queryWrapper.select(lineParam.getColumnName()); queryWrapper.select(lineParam.getColumnName());
} }
queryWrapper.lambda() queryWrapper.lambda()
@@ -108,15 +109,17 @@ public class RelationDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
.in(RStatDataID::getPhasicType, lineParam.getPhasicType()) .in(RStatDataID::getPhasicType, lineParam.getPhasicType())
.ge(RStatDataID::getTime, lineParam.getStartTime()) .ge(RStatDataID::getTime, lineParam.getStartTime())
.le(RStatDataID::getTime, lineParam.getEndTime()) .le(RStatDataID::getTime, lineParam.getEndTime())
.in(RStatDataID::getLineId,lineParam.getLineId()); .in(RStatDataID::getLineId, lineParam.getLineId());
List<RStatDataID> list = this.list(queryWrapper); List<RStatDataID> list = this.list(queryWrapper);
for(RStatDataID rStatDataID:list){ for (RStatDataID rStatDataID : list) {
DataIDto dto =BeanUtil.copyProperties(rStatDataID,DataIDto.class); DataIDto dto = BeanUtil.copyProperties(rStatDataID, DataIDto.class);
dto.setTime(rStatDataID.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN))); if (ObjectUtil.isNotNull(rStatDataID.getTime())) {
dto.setTime(rStatDataID.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
}
result.add(dto); result.add(dto);
} }
return quality(result,lineParam); return quality(result, lineParam);
} }
private List<DataIDto> quality(List<DataIDto> list, LineCountEvaluateParam lineParam) { private List<DataIDto> quality(List<DataIDto> list, LineCountEvaluateParam lineParam) {

View File

@@ -3,6 +3,7 @@ package com.njcn.dataProcess.service.impl.relation;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
@@ -46,9 +47,9 @@ public class RelationDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
@Override @Override
public void batchInsertion(List<DataPltDTO> dataPltDTOList) { public void batchInsertion(List<DataPltDTO> dataPltDTOList) {
int totalCount = dataPltDTOList.size(); int totalCount = dataPltDTOList.size();
int minSize = Math.min(120, totalCount); int minSize = Math.min(120, totalCount);
if(totalCount<=0){ if (totalCount <= 0) {
return; return;
} }
List<DataPlt> collect = dataPltDTOList.stream().map(temp -> { List<DataPlt> collect = dataPltDTOList.stream().map(temp -> {
@@ -82,7 +83,7 @@ public class RelationDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
@Override @Override
public void addList(List<DataPltDto> list) { public void addList(List<DataPltDto> list) {
List<RStatDataPltD> result = new ArrayList<>(); List<RStatDataPltD> result = new ArrayList<>();
list.forEach(item->{ list.forEach(item -> {
RStatDataPltD data = new RStatDataPltD(); RStatDataPltD data = new RStatDataPltD();
data.setTime(TimeUtils.LocalDataTimeToLocalDate2(item.getTime())); data.setTime(TimeUtils.LocalDataTimeToLocalDate2(item.getTime()));
data.setPhasicType(item.getPhasicType()); data.setPhasicType(item.getPhasicType());
@@ -97,7 +98,7 @@ public class RelationDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
public List<DataPltDto> getDataPlt(LineCountEvaluateParam lineParam) { public List<DataPltDto> getDataPlt(LineCountEvaluateParam lineParam) {
List<DataPltDto> result = new ArrayList<>(); List<DataPltDto> result = new ArrayList<>();
QueryWrapper<RStatDataPltD> queryWrapper = new QueryWrapper<>(); QueryWrapper<RStatDataPltD> queryWrapper = new QueryWrapper<>();
if(StrUtil.isNotBlank(lineParam.getColumnName())){ if (StrUtil.isNotBlank(lineParam.getColumnName())) {
queryWrapper.select(lineParam.getColumnName()); queryWrapper.select(lineParam.getColumnName());
} }
queryWrapper.lambda() queryWrapper.lambda()
@@ -107,12 +108,14 @@ public class RelationDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
.le(RStatDataPltD::getTime, lineParam.getEndTime()); .le(RStatDataPltD::getTime, lineParam.getEndTime());
List<RStatDataPltD> rStatDataVDList = this.list(queryWrapper); List<RStatDataPltD> rStatDataVDList = this.list(queryWrapper);
for(RStatDataPltD rStatDataPltD : rStatDataVDList){ for (RStatDataPltD rStatDataPltD : rStatDataVDList) {
DataPltDto dto = BeanUtil.copyProperties(rStatDataPltD,DataPltDto.class); DataPltDto dto = BeanUtil.copyProperties(rStatDataPltD, DataPltDto.class);
dto.setTime(rStatDataPltD.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN))); if (ObjectUtil.isNotNull(rStatDataPltD.getTime())) {
dto.setTime(rStatDataPltD.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
}
result.add(dto); result.add(dto);
} }
return quality(result,lineParam); return quality(result, lineParam);
} }
private List<DataPltDto> quality(List<DataPltDto> list, LineCountEvaluateParam lineParam) { private List<DataPltDto> quality(List<DataPltDto> list, LineCountEvaluateParam lineParam) {

View File

@@ -3,6 +3,7 @@ package com.njcn.dataProcess.service.impl.relation;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
@@ -153,10 +154,12 @@ public class RelationDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
List<RStatDataVD> rStatDataVDList = this.list(queryWrapper); List<RStatDataVD> rStatDataVDList = this.list(queryWrapper);
for (RStatDataVD rStatDataVD : rStatDataVDList) { for (RStatDataVD rStatDataVD : rStatDataVDList) {
DataVDto dto = BeanUtil.copyProperties(rStatDataVD, DataVDto.class); DataVDto dto = BeanUtil.copyProperties(rStatDataVD, DataVDto.class);
dto.setTime(rStatDataVD.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN))); if (ObjectUtil.isNotNull(rStatDataVD.getTime())) {
dto.setTime(rStatDataVD.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
}
info.add(dto); info.add(dto);
} }
return quality(info,lineParam); return quality(info, lineParam);
} }
private List<DataVDto> quality(List<DataVDto> list, LineCountEvaluateParam lineParam) { private List<DataVDto> quality(List<DataVDto> list, LineCountEvaluateParam lineParam) {