Explorar o código

[性能验证][task-1390] 各个指标中数据公式的计算和结论推导,线性范围

liyuan %!s(int64=2) %!d(string=hai) anos
pai
achega
5750b1d5fc

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

@@ -105,10 +105,10 @@ public class PVTest {
 //        vo.getItem().add(item2);
 //        vo.getItem().add(item3);
         vo.getItem().add(item4);
-//        final String s = JSONObject.toJSONString(vo,SerializerFeature.PrettyFormat,SerializerFeature.DisableCircularReferenceDetect);
-//        InspectionVO voJson = JSON.parseObject(s, InspectionVO.class);
+        final String s = JSONObject.toJSONString(vo,SerializerFeature.PrettyFormat,SerializerFeature.DisableCircularReferenceDetect);
+        InspectionVO voJson = JSON.parseObject(s, InspectionVO.class);
 
-        System.out.println(vo);
+        System.out.println(s);
         final Workbook workbook = vo.exportExcelReport(false);
         FileOutputStream fos = new FileOutputStream(String.format("C:/tmp/%s.xlsx", vo.getName()));
         workbook.write(fos);

+ 13 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/verification/model/InspectionConfigVO.java

@@ -33,6 +33,19 @@ public class InspectionConfigVO {
         this.isConvert = isConvert;
     }
 
+    public InspectionConfigVO(String name, int days, int specimensNum, String[] specimensName, int repeatNum,
+                              boolean convert, FunctionEnum[] func, double[] targetValue, LocalDate startDate) {
+        this.name = name;
+        this.days = days;
+        this.specimensNum = specimensNum;
+        this.specimensName = specimensName;
+        this.repeatNum = repeatNum;
+        this.isConvert = convert;
+        this.func = func;
+        this.targetValue = targetValue;
+        this.startDate = startDate;
+    }
+
     public String getName() {
         return name;
     }

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

@@ -1,6 +1,7 @@
 package com.lc.ibps.components.verification.model;
 
 
+import com.alibaba.fastjson.annotation.JSONField;
 import com.lc.ibps.components.poi.excel.entity.ExportParams;
 import com.lc.ibps.components.poi.excel.entity.ImportParams;
 import com.lc.ibps.components.poi.excel.entity.enmus.ExcelType;
@@ -30,13 +31,20 @@ public class InspectionItemVO {
     private InspectionConfigVO config;
 
     //样本名 : 检查数据
-    private Map<String, SpecimensCalcVO> record;
-
+    @JSONField(serialize = false)
+    private Map<String, SpecimensCalcVO> record = new HashMap<>();;
+    @JSONField(serialize = false)
     private ItemCalcVO itemCalcVO;
-
+    @JSONField(serialize = false)
     private boolean dataPass = false;
+    @JSONField(serialize = false)
     private Map<String, List<String>> errorMessage = new HashMap<>();
-
+    public InspectionItemVO(InspectionConfigVO config,Map<String, double[]> data){
+        this.config = config;
+        this.dataPass = true;
+        setData(data);
+        buildItemCalcVO();
+    }
     public InspectionItemVO(InspectionConfigVO config) {
         this.config = config;
     }
@@ -173,7 +181,6 @@ public class InspectionItemVO {
         } else {
             dataPass = true;
         }
-        record = new HashMap<>();
         for (String sName : config.getSpecimensName()) {
             final xValue[] total = new xValue[config.getRepeatNum() * config.getDays()];
             for (int j = 0; j < list.size(); j++) {
@@ -228,4 +235,23 @@ public class InspectionItemVO {
     public ItemCalcVO getItemCalcVO() {
         return itemCalcVO;
     }
+    public Map<String, double[]> getData(){
+        Map<String, double[]> data = new HashMap<>();
+        for (String name : record.keySet()) {
+            data.put(name,record.get(name).getStoreData());
+        }
+        return data;
+    }
+
+    private void setData(Map<String, double[]> map){
+            for (String name : map.keySet()){
+                final double[] data = map.get(name);
+                xValue[] d = new xValue[data.length];
+                for (int i = 0; i<data.length;i++){
+                    d[i] = new xValue(data[i]);
+                }
+                record.put(name,new SpecimensCalcVO(d,config.isConvert()));
+            }
+    }
+
 }

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

@@ -104,4 +104,13 @@ public class SpecimensCalcVO {
     public void setTargetValue(Double targetValue) {
         this.targetValue = targetValue;
     }
+
+    public double[] getStoreData(){
+        double[] d = new double[data.length];
+        for (int i = 0; i<data.length;i++){
+            d[i] = data[i].getDoub();
+        }
+        return d;
+    }
+
 }