数据处理原则-所有值入库数据bug

This commit is contained in:
caozehui
2025-05-15 15:10:09 +08:00
parent 7eb80121a1
commit cb8495fb0d
3 changed files with 34 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
import com.njcn.gather.storage.service.DetectionDataDealService;
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
@@ -1015,7 +1016,23 @@ public class DetectionServiceImpl {
BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()),
BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList());
if (CollUtil.isNotEmpty(qualifiedList)) {
data.setErrorData(devSubtractChannelData(qualifiedList.get(0), channelData, ratedValue, errSysDtl));
switch (dataRule) {
case AT_WILL_VALUE:
case CP95_VALUE:
case AVG_VALUE:
data.setErrorData(devSubtractChannelData(qualifiedList.get(0), channelData, ratedValue, errSysDtl));
break;
case SECTION_VALUE:
case Own_value:
if (qualifiedList.size() == harmDataList.size()) {
data.setErrorData(devSubtractChannelData(qualifiedList.get(0), channelData, ratedValue, errSysDtl));
} else {
List<Double> subtract = CollectionUtils.subtract(harmDataList, qualifiedList).stream().collect(Collectors.toList());
data.setData(subtract.get(0));
data.setErrorData(devSubtractChannelData(subtract.get(0), channelData, ratedValue, errSysDtl));
}
break;
}
} else {
data.setErrorData(devSubtractChannelData(harmDataList.get(0), channelData, ratedValue, errSysDtl));
}
@@ -1041,6 +1058,8 @@ public class DetectionServiceImpl {
if (qualifiedList.size() == harmDataList.size()) {
data.setIsData(1);
} else {
List<Double> subtract = CollectionUtils.subtract(harmDataList, qualifiedList).stream().collect(Collectors.toList());
data.setData(subtract.get(0));
data.setIsData(2);
}
break;

View File

@@ -152,6 +152,18 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataM
wrapper.select(PqScriptCheckData::getScriptIndex)
.eq(PqScriptCheckData::getScriptId, scriptId)
.eq(PqScriptCheckData::getErrorFlag, 0);
return this.list(wrapper).stream().map(PqScriptCheckData::getScriptIndex).distinct().collect(Collectors.toList());
List<Integer> list1 = this.list(wrapper).stream().map(PqScriptCheckData::getScriptIndex).distinct().collect(Collectors.toList());
for (int i = list1.size() - 1; i >= 0; i--) {
wrapper.clear();
wrapper.eq(PqScriptCheckData::getScriptId, scriptId);
wrapper.eq(PqScriptCheckData::getScriptIndex, list1.get(i));
List<PqScriptCheckData> list = this.list(wrapper);
long count = list.stream().filter(x -> x.getErrorFlag() == 1).count();
if (count != 0) {
list1.remove(i);
}
}
return list1;
}
}

View File

@@ -96,7 +96,7 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
@Override
public List<Map<String, Object>> listAllPqSource(String patternId) {
List<PqSource> pqSourceList = this.lambdaQuery().eq(PqSource::getPattern, patternId).eq(PqSource::getState, DataStateEnum.ENABLE.getCode()).list();
List<PqSource> pqSourceList = this.lambdaQuery().eq(PqSource::getPattern, patternId).orderByAsc(PqSource::getCreateTime).eq(PqSource::getState, DataStateEnum.ENABLE.getCode()).list();
List<Map<String, Object>> result = pqSourceList.stream().map(pqSource -> {
Map<String, Object> map = new HashMap<>();
map.put("id", pqSource.getId());