From 8b4e6b116eec50dc8997e04251b3fb1ba5b36c04 Mon Sep 17 00:00:00 2001 From: yanyang Date: Tue, 3 Jan 2023 16:25:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E6=80=A7=E7=B1=BB=E5=9E=8B=E6=A0=B7?= =?UTF-8?q?=E6=9C=AC=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/InspectionSheetServiceImpl.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java index dc16d93..0190e5e 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java @@ -156,10 +156,20 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl inspectionSheetFeaturesList = getInspectionSheetFeaturesList(params); if (inspectionSheetFeaturesList != null && inspectionSheetFeaturesList.size() != 0) { //分组样本数=样本大小=检验特性分组数的最大值 - Integer numbersOfSamples = inspectionSheetFeaturesList.stream().max(Comparator.comparing(ProductFeaturesDTO::getSampleSize)).get().getSampleSize(); - if (numbersOfSamples != null) { - dto.setNumberOfGroupedSamples(numbersOfSamples); - dto.setNumberOfSamples(numbersOfSamples); + //Integer numbersOfSamples = inspectionSheetFeaturesList.stream().max(Comparator.comparing(ProductFeaturesDTO::getSampleSize)).get().getSampleSize(); + //过滤计量型特性 + List featuresList = inspectionSheetFeaturesList.stream().filter(s->s.getType()==1).collect(Collectors.toList()); + if(featuresList != null && featuresList.size() != 0) { + Integer numbersOfSamples = featuresList.stream().max(Comparator.comparing(ProductFeaturesDTO::getSampleSize)).get().getSampleSize(); + if (numbersOfSamples != null) { + dto.setNumberOfGroupedSamples(numbersOfSamples); + dto.setNumberOfSamples(numbersOfSamples); + } + } + //若只有计数型特性,样本大小默认为1 + else{ + dto.setNumberOfGroupedSamples(1); + dto.setNumberOfSamples(1); } } /*