Răsfoiți Sursa

[task-1766] 性能验证模块 开发 (二期) / 【后端】验证报告的接口开发

Li Yuan 2 ani în urmă
părinte
comite
1619214fb1

+ 1 - 1
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/excel/PVExcelExportReportServer.java

@@ -110,7 +110,7 @@ public class PVExcelExportReportServer extends ExcelExportServer {
             case SD:
                 return specimensCalcVO.getSd().getStr();
             case AVERAGE:
-                return specimensCalcVO.getAverage().getStr();
+                return specimensCalcVO.getMean().getStr();
             case TARGET:
                 return specimensCalcVO.getTargetValue().toString();
             case ABSDEV:

+ 33 - 18
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/InspectionItemVO.java

@@ -32,7 +32,12 @@ public class InspectionItemVO {
 
     //样本名 : 检查数据
     @JSONField(serialize = false)
-    private Map<String, SpecimensCalcVO> record = new HashMap<>();;
+    private Map<String, SpecimensCalcVO> record = new HashMap<>();
+
+    @JSONField(serialize = false)
+    private Map<String, EP15CalcVO> record2 = new HashMap<>();
+
+
     @JSONField(serialize = false)
     private ItemCalcVO itemCalcVO;
     @JSONField(serialize = false)
@@ -80,12 +85,10 @@ public class InspectionItemVO {
             list.add(map);
         }
         List<ExportParams> exportParamsList = new ArrayList<ExportParams>();
-        LocalDate startDate = config.getStartDate();
-        for (int i = 0; i < config.getDays(); i++) {
-            ExportParams exportParams = new ExportParams(config.getName() + " 数据导入模板", startDate.toString());
+        for (int i = 1; i < config.getDays()+1; i++) {
+            ExportParams exportParams = new ExportParams(config.getName() + " 数据导入模板", String.format("第 %d 天",i));
             exportParams.setStyle(PVExcelExportStyler.class);
             exportParamsList.add(exportParams);
-            startDate = startDate.plusDays(1);
             exportParams.setType(ExcelType.XSSF);
         }
         Workbook workbook = PVExcelUtil.exportExcelTemplateWithMultiSheet(exportParamsList, entity, list);
@@ -168,30 +171,42 @@ public class InspectionItemVO {
         params.setHeadRows(1);
         params.setSheetNum(config.getDays());
         List<ExcelSheetRecord> list = PVExcelUtil.importExcel(inputstream, Map.class, params);
-        LocalDate startDate = config.getStartDate();
+        int i = 1;
         for (ExcelSheetRecord record : list) {
-            record.convert(config, startDate.toString());
+            record.convert(config, String.format("第 %d 天",i));
             if (record.getErrors().size() > 0) {
-                errorMessage.put(startDate.toString(), record.getErrors());
+                errorMessage.put(String.format("第 %d 天",i), record.getErrors());
             }
-            startDate = startDate.plusDays(1);
+            i++;
         }
         if (errorMessage.size() > 0) {
             return;
         } else {
             dataPass = true;
         }
-        for (String sName : config.getSpecimensName()) {
-            final xValue[] total = new xValue[config.getRepeatNum() * config.getDays()];
-            for (int j = 0; j < list.size(); j++) {
-                final xValue[] xValues = list.get(j).getConvertedData().get(sName);
-                for (int k = 0; k < xValues.length; k++) {
-                    total[j * xValues.length + k] = xValues[k];
+
+        if(config.getName().toLowerCase().contains("ep15")){
+            for (String sName : config.getSpecimensName()) {
+                SpecimensCalcVO[] data = new SpecimensCalcVO[config.getDays()];
+                for (int j = 0; j < list.size(); j++) {
+                    final xValue[] xValues = list.get(j).getConvertedData().get(sName);
+                    data[j] = new SpecimensCalcVO(xValues, config.isConvert());
                 }
+                record2.put(sName, new EP15CalcVO(data,config.getDays()));
             }
-            record.put(sName, new SpecimensCalcVO(total, config.isConvert()));
+        }else {
+            for (String sName : config.getSpecimensName()) {
+                final xValue[] total = new xValue[config.getRepeatNum() * config.getDays()];
+                for (int j = 0; j < list.size(); j++) {
+                    final xValue[] xValues = list.get(j).getConvertedData().get(sName);
+                    for (int k = 0; k < xValues.length; k++) {
+                        total[j * xValues.length + k] = xValues[k];
+                    }
+                }
+                record.put(sName, new SpecimensCalcVO(total, config.isConvert()));
+            }
+            buildItemCalcVO();
         }
-        buildItemCalcVO();
     }
 
     private void buildItemCalcVO() {
@@ -202,7 +217,7 @@ public class InspectionItemVO {
         for (int i = 0; i < config.getSpecimensNum(); i++) {
             String sName = config.getSpecimensName()[i];
             record.get(sName).setTargetValue(config.getTargetValue()[i]);
-            specimens[i] = record.get(sName).getAverage();
+            specimens[i] = record.get(sName).getMean();
             target[i] = new xValue(config.getTargetValue()[i]);
         }
         itemCalcVO = new ItemCalcVO(specimens, target);

+ 15 - 8
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/SpecimensCalcVO.java

@@ -19,9 +19,11 @@ public class SpecimensCalcVO {
 
     ////////////////////
     //均值
-    private xValue average;
+    private xValue mean;
     //标准差
     private xValue sd;
+    //差异  = sd * sd
+    private xValue variance;
     //变异系数百分比 = sd/average
     private xValue cv;
     //绝对偏倚  average - targetValue;
@@ -39,9 +41,9 @@ public class SpecimensCalcVO {
         else convert();
     }
 
-    public xValue getAverage() {
-        if (average == null) average = xAverage.eval(convertedData);
-        return average;
+    public xValue getMean() {
+        if (mean == null) mean = xAverage.eval(convertedData);
+        return mean;
     }
 
     public xValue getSd() {
@@ -49,11 +51,16 @@ public class SpecimensCalcVO {
         return sd;
     }
 
+    public xValue getVariance() {
+        if (variance == null) variance = new xValue(Math.pow(getSd().getDoub(),2));
+        return variance;
+    }
+
     public xValue getCv() {
         if (cv != null) return cv;
         cv = new xValue();
-        if (getSd().isErr() || getAverage().isErr()) cv.setErrNa();
-        else cv.setVal(sd.getDoub() / average.getDoub());
+        if (getSd().isErr() || getMean().isErr()) cv.setErrNa();
+        else cv.setVal(sd.getDoub() / mean.getDoub());
         return cv;
     }
 
@@ -66,7 +73,7 @@ public class SpecimensCalcVO {
         if (targetValue == null) {
             return new xValue();
         }
-        absDev = new xValue( getAverage().getDoub() - targetValue );
+        absDev = new xValue( getMean().getDoub() - targetValue );
         return absDev;
     }
 
@@ -84,7 +91,7 @@ public class SpecimensCalcVO {
         if (targetValue == null) {
             return new xValue();
         }
-        rvalue = new xValue( getAverage().getDoub()/targetValue );
+        rvalue = new xValue( getMean().getDoub()/targetValue );
         return rvalue;
     }