|
|
@@ -3,14 +3,15 @@ package com.lc.ibps.components.verification.model2;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.lc.ibps.components.verification.model.InspectionConfigVO;
|
|
|
-import com.lc.ibps.components.verification.report.ChartDTO;
|
|
|
import com.lc.ibps.components.verification.report.ReportDataDTO;
|
|
|
-import com.lc.ibps.components.verification.report.SheetDTO;
|
|
|
+import com.lc.ibps.components.verification.report.ReportFactory;
|
|
|
import com.lc.ibps.components.verification.report.TableDTO;
|
|
|
+import org.apache.commons.math3.linear.MatrixUtils;
|
|
|
+import org.apache.commons.math3.linear.RealMatrix;
|
|
|
+import org.apache.commons.math3.linear.RealMatrixFormat;
|
|
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.time.LocalDate;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
public class LinearRangeRecoveryMethod extends LinearRangeAverageSlope {
|
|
|
|
|
|
@@ -23,7 +24,7 @@ public class LinearRangeRecoveryMethod extends LinearRangeAverageSlope {
|
|
|
|
|
|
@Override
|
|
|
public void calculate() {
|
|
|
-
|
|
|
+ super.calculate();
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -32,11 +33,8 @@ public class LinearRangeRecoveryMethod extends LinearRangeAverageSlope {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public SheetDTO[] buildSheetDTO() {
|
|
|
- SheetDTO sheet = new SheetDTO("线性稀释回收法");
|
|
|
- sheet.setReportDataDTO(buildReportTableDTO());
|
|
|
- sheet.setChartDataDTO(buildChartDTO());
|
|
|
- return new SheetDTO[]{sheet};
|
|
|
+ public String[] sheetNames() {
|
|
|
+ return new String[]{"线性稀释回收法"};
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -44,39 +42,25 @@ public class LinearRangeRecoveryMethod extends LinearRangeAverageSlope {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public Map<String, TableDTO> buildReportTableDTO() {
|
|
|
- Map<String, TableDTO> reports = new HashMap<>();
|
|
|
-// reports.put("表1: 重复性差异检测结果", buildTable1DTO());
|
|
|
-// reports.put("表2: 多项式回归分析结果", buildTable2DTO());
|
|
|
-// reports.put("表3: 线性偏离计算结果", buildTable3DTO());
|
|
|
- return reports;
|
|
|
- }
|
|
|
-
|
|
|
- public Map<String, ChartDTO> buildChartDTO() {
|
|
|
- Map<String, ChartDTO> charts = new HashMap<>();
|
|
|
-// charts.put("图1: 线性实验", buildChart1DTO());
|
|
|
-// charts.put("图2: 线性评价差值点图", buildChart2DTO());
|
|
|
- return charts;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
InspectionConfigVO config = new InspectionConfigVO("线性稀释回收法", 1, 6,
|
|
|
null, 2, LocalDate.now(), true);
|
|
|
config.setTargetValue(new double[]{0, 24.56});
|
|
|
+ config.setKey(ModelEnum.LinearRangeRecoveryMethod.getKey());
|
|
|
double[][] data = {{-0.01, -0.01}, {5.00, 4.99}, {10.18, 10.05}, {14.65, 14.65}, {19.57, 19.65}, {24.02, 24.09}};
|
|
|
- LinearRangeRecoveryMethod ep6 = new LinearRangeRecoveryMethod(data, config);
|
|
|
- TableDTO tableDTO = ep6.buildDataTableDTO();
|
|
|
- Map<String, TableDTO> stringTableDTOMap = ep6.buildReportTableDTO();
|
|
|
- final Map<String, ChartDTO> stringChartDTOMap = ep6.buildChartDTO();
|
|
|
- ReportDataDTO report = new ReportDataDTO();
|
|
|
-
|
|
|
-
|
|
|
- report.setDataDTO(tableDTO);
|
|
|
-// report.setReportDataDTO(stringTableDTOMap);
|
|
|
- String s = JSONObject.toJSONString(report, SerializerFeature.DisableCircularReferenceDetect);
|
|
|
-
|
|
|
+ RealMatrix matrix = MatrixUtils.createRealMatrix(data);
|
|
|
+ RealMatrixFormat matrixFormat = new RealMatrixFormat("", "", "", "\n",
|
|
|
+ "", ",", new DecimalFormat("0.00"));
|
|
|
+ System.out.println(matrixFormat.format(matrix));
|
|
|
+
|
|
|
+ PVItemBuilder pvItemBuilder = PVItemBuilder.getInstance(config);
|
|
|
+ pvItemBuilder.buildPVModel(data);
|
|
|
+ ReportDataDTO dataDTO = ReportFactory.build(pvItemBuilder);
|
|
|
+ String s = JSONObject.toJSONString(dataDTO, SerializerFeature.DisableCircularReferenceDetect);
|
|
|
+ String s1 = pvItemBuilder.getPvModel().generateResult();
|
|
|
System.out.println(s);
|
|
|
+ System.out.println(s1);
|
|
|
|
|
|
}
|
|
|
}
|