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

This commit is contained in:
caozehui
2025-05-15 15:10:09 +08:00
parent 7eb80121a1
commit 8f8d3d38cc
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.storage.service.DetectionDataDealService;
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum; import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@@ -1015,7 +1016,23 @@ public class DetectionServiceImpl {
BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()), BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()),
BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList()); BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList());
if (CollUtil.isNotEmpty(qualifiedList)) { if (CollUtil.isNotEmpty(qualifiedList)) {
switch (dataRule) {
case AT_WILL_VALUE:
case CP95_VALUE:
case AVG_VALUE:
case SECTION_VALUE:
data.setErrorData(devSubtractChannelData(qualifiedList.get(0), channelData, ratedValue, errSysDtl)); data.setErrorData(devSubtractChannelData(qualifiedList.get(0), channelData, ratedValue, errSysDtl));
break;
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 { } else {
data.setErrorData(devSubtractChannelData(harmDataList.get(0), channelData, ratedValue, errSysDtl)); data.setErrorData(devSubtractChannelData(harmDataList.get(0), channelData, ratedValue, errSysDtl));
} }
@@ -1041,6 +1058,8 @@ public class DetectionServiceImpl {
if (qualifiedList.size() == harmDataList.size()) { if (qualifiedList.size() == harmDataList.size()) {
data.setIsData(1); data.setIsData(1);
} else { } else {
List<Double> subtract = CollectionUtils.subtract(harmDataList, qualifiedList).stream().collect(Collectors.toList());
data.setData(subtract.get(0));
data.setIsData(2); data.setIsData(2);
} }
break; break;

View File

@@ -152,6 +152,18 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataM
wrapper.select(PqScriptCheckData::getScriptIndex) wrapper.select(PqScriptCheckData::getScriptIndex)
.eq(PqScriptCheckData::getScriptId, scriptId) .eq(PqScriptCheckData::getScriptId, scriptId)
.eq(PqScriptCheckData::getErrorFlag, 0); .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 @Override
public List<Map<String, Object>> listAllPqSource(String patternId) { 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 -> { List<Map<String, Object>> result = pqSourceList.stream().map(pqSource -> {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id", pqSource.getId()); map.put("id", pqSource.getId());