|
@@ -2,17 +2,15 @@ package com.lc.ibps.components.verification.excel;
|
|
|
|
|
|
|
|
import com.lc.ibps.components.poi.excel.entity.params.ExcelExportEntity;
|
|
import com.lc.ibps.components.poi.excel.entity.params.ExcelExportEntity;
|
|
|
import com.lc.ibps.components.poi.excel.export.ExcelExportServer;
|
|
import com.lc.ibps.components.poi.excel.export.ExcelExportServer;
|
|
|
-import com.lc.ibps.components.poi.util.PoiMergeCellUtil;
|
|
|
|
|
import com.lc.ibps.components.verification.model.FunctionEnum;
|
|
import com.lc.ibps.components.verification.model.FunctionEnum;
|
|
|
import com.lc.ibps.components.verification.model.InspectionItemVO;
|
|
import com.lc.ibps.components.verification.model.InspectionItemVO;
|
|
|
-import com.lc.ibps.components.verification.model.RecordCalcVO;
|
|
|
|
|
-import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
|
|
|
|
+import com.lc.ibps.components.verification.model.ItemCalcVO;
|
|
|
|
|
+import com.lc.ibps.components.verification.model.SpecimensCalcVO;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
-import java.util.Set;
|
|
|
|
|
|
|
|
|
|
public class PVExcelExportReportServer extends ExcelExportServer {
|
|
public class PVExcelExportReportServer extends ExcelExportServer {
|
|
|
private InspectionItemVO item;
|
|
private InspectionItemVO item;
|
|
@@ -22,11 +20,10 @@ public class PVExcelExportReportServer extends ExcelExportServer {
|
|
|
|
|
|
|
|
Row row = sheet.createRow(sheet.getLastRowNum() + 1);
|
|
Row row = sheet.createRow(sheet.getLastRowNum() + 1);
|
|
|
row.setHeight((short) (entity.getHeight() * 50));
|
|
row.setHeight((short) (entity.getHeight() * 50));
|
|
|
- int index = 0;
|
|
|
|
|
for (FunctionEnum func : item.getConfig().getFunc()) {
|
|
for (FunctionEnum func : item.getConfig().getFunc()) {
|
|
|
row = sheet.createRow(sheet.getLastRowNum() + 1);
|
|
row = sheet.createRow(sheet.getLastRowNum() + 1);
|
|
|
row.setHeight((short) (entity.getHeight() * 50));
|
|
row.setHeight((short) (entity.getHeight() * 50));
|
|
|
- index = 0;
|
|
|
|
|
|
|
+ int index = 0;
|
|
|
if (item.getConfig().isConvert()) {
|
|
if (item.getConfig().isConvert()) {
|
|
|
sheet.addMergedRegion(new CellRangeAddress(row.getRowNum(), row.getRowNum(), index,
|
|
sheet.addMergedRegion(new CellRangeAddress(row.getRowNum(), row.getRowNum(), index,
|
|
|
index + 1));
|
|
index + 1));
|
|
@@ -34,22 +31,20 @@ public class PVExcelExportReportServer extends ExcelExportServer {
|
|
|
entity.setKey("statistic");
|
|
entity.setKey("statistic");
|
|
|
createStringCell(row, index++, func.getText(), getStyles(false, entity), null);
|
|
createStringCell(row, index++, func.getText(), getStyles(false, entity), null);
|
|
|
createStringCell(row, index++, "", getStyles(false, entity), null);
|
|
createStringCell(row, index++, "", getStyles(false, entity), null);
|
|
|
- for (int i = 0; i < item.getConfig().getSpecimensNum(); i++) {
|
|
|
|
|
- String s = item.getConfig().getSpecimensName()[i];
|
|
|
|
|
- RecordCalcVO recordCalcVO = item.getRecord().get(s);
|
|
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(row.getRowNum(), row.getRowNum(), index,
|
|
|
|
|
- index + 1));
|
|
|
|
|
- entity.setKey(getCellStyle(func));
|
|
|
|
|
- if (func.equals(FunctionEnum.TARGET)) {
|
|
|
|
|
- recordCalcVO.setTargetValue(item.getConfig().getTargetValue()[i]);
|
|
|
|
|
- }
|
|
|
|
|
- createStringCell(row, index++, getCalcValue(func, recordCalcVO), getStyles(false, entity), null);
|
|
|
|
|
- createStringCell(row, index++, "0", getStyles(false, entity), null);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if (func == FunctionEnum.LRE || func == FunctionEnum.R) {
|
|
|
|
|
+ createItemRow(sheet, entity, row, index, func);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ createSpecimensRow(sheet, entity, row, index, func);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-// row = sheet.createRow(sheet.getLastRowNum() + 1);
|
|
|
|
|
-// row.setHeight((short) (entity.getHeight() * 50));
|
|
|
|
|
|
|
+ createResultRow(sheet, entity, row);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void createResultRow(Sheet sheet, ExcelExportEntity entity, Row row) {
|
|
|
|
|
+ int index = item.getConfig().getSpecimensNum() + 2;
|
|
|
|
|
+ if (item.getConfig().isConvert()) {
|
|
|
|
|
+ index = item.getConfig().getSpecimensNum() * 2 + 2;
|
|
|
|
|
+ }
|
|
|
entity.setKey("statistic");
|
|
entity.setKey("statistic");
|
|
|
sheet.addMergedRegion(new CellRangeAddress(row.getRowNum() + 1, row.getRowNum() + 3, 0,
|
|
sheet.addMergedRegion(new CellRangeAddress(row.getRowNum() + 1, row.getRowNum() + 3, 0,
|
|
|
1));
|
|
1));
|
|
@@ -63,23 +58,65 @@ public class PVExcelExportReportServer extends ExcelExportServer {
|
|
|
createStringCell(row, 2, "PASS", getStyles(false, entity), null);
|
|
createStringCell(row, 2, "PASS", getStyles(false, entity), null);
|
|
|
for (int j = 3; j < index; j++) createStringCell(row, j, "", getStyles(false, entity), null);
|
|
for (int j = 3; j < index; j++) createStringCell(row, j, "", getStyles(false, entity), null);
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ private void createItemRow(Sheet sheet, ExcelExportEntity entity, Row row, int index, FunctionEnum func) {
|
|
|
|
|
+ int i = 0;
|
|
|
|
|
+ if (item.getConfig().isConvert()) {
|
|
|
|
|
+ i = index - 1 + item.getConfig().getSpecimensNum() * 2;
|
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(row.getRowNum(), row.getRowNum(), index, i));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ i = index - 1 + item.getConfig().getSpecimensNum();
|
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(row.getRowNum(), row.getRowNum(), index, i));
|
|
|
|
|
+ }
|
|
|
|
|
+ entity.setKey(getCellStyle(func));
|
|
|
|
|
+ createStringCell(row, index++, getCalcValue(func, item.getItemCalcVO()), getStyles(false, entity), null);
|
|
|
|
|
+ for (int j = index; j <= i; j++) {
|
|
|
|
|
+ createStringCell(row, index++, "0", getStyles(false, entity), null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-// createStringCell(row, 0, "结论", getStyles(false, entity), null);
|
|
|
|
|
|
|
+ private void createSpecimensRow(Sheet sheet, ExcelExportEntity entity, Row row, int index, FunctionEnum func) {
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < item.getConfig().getSpecimensNum(); i++) {
|
|
|
|
|
+ String s = item.getConfig().getSpecimensName()[i];
|
|
|
|
|
+ SpecimensCalcVO specimensCalcVO = item.getRecord().get(s);
|
|
|
|
|
+ if (item.getConfig().isConvert()) {
|
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(row.getRowNum(), row.getRowNum(), index,
|
|
|
|
|
+ index + 1));
|
|
|
|
|
+ }
|
|
|
|
|
+ entity.setKey(getCellStyle(func));
|
|
|
|
|
+ createStringCell(row, index++, getCalcValue(func, specimensCalcVO), getStyles(false, entity), null);
|
|
|
|
|
+ if (item.getConfig().isConvert()) {
|
|
|
|
|
+ createStringCell(row, index++, "0", getStyles(false, entity), null);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public String getCalcValue(FunctionEnum func, RecordCalcVO recordCalcVO) {
|
|
|
|
|
|
|
+ public String getCalcValue(FunctionEnum func, SpecimensCalcVO specimensCalcVO) {
|
|
|
switch (func) {
|
|
switch (func) {
|
|
|
case CV:
|
|
case CV:
|
|
|
- return recordCalcVO.getCv().getStr();
|
|
|
|
|
|
|
+ return specimensCalcVO.getCv().getStr();
|
|
|
case SD:
|
|
case SD:
|
|
|
- return recordCalcVO.getSd().getStr();
|
|
|
|
|
|
|
+ return specimensCalcVO.getSd().getStr();
|
|
|
case AVERAGE:
|
|
case AVERAGE:
|
|
|
- return recordCalcVO.getAverage().getStr();
|
|
|
|
|
|
|
+ return specimensCalcVO.getAverage().getStr();
|
|
|
case TARGET:
|
|
case TARGET:
|
|
|
- return recordCalcVO.getTargetValue().toString();
|
|
|
|
|
|
|
+ return specimensCalcVO.getTargetValue().toString();
|
|
|
case ABSDEV:
|
|
case ABSDEV:
|
|
|
- return Double.toString(recordCalcVO.calcAbsoluteDeviation());
|
|
|
|
|
|
|
+ return Double.toString(specimensCalcVO.calcAbsoluteDeviation());
|
|
|
|
|
+ default:
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getCalcValue(FunctionEnum func, ItemCalcVO itemCalcVO) {
|
|
|
|
|
+ switch (func) {
|
|
|
|
|
+ case R:
|
|
|
|
|
+ return itemCalcVO.getR().getStr();
|
|
|
|
|
+ case LRE:
|
|
|
|
|
+ return itemCalcVO.getLRE();
|
|
|
default:
|
|
default:
|
|
|
return "";
|
|
return "";
|
|
|
}
|
|
}
|
|
@@ -89,6 +126,10 @@ public class PVExcelExportReportServer extends ExcelExportServer {
|
|
|
switch (func) {
|
|
switch (func) {
|
|
|
case CV:
|
|
case CV:
|
|
|
return "statistic-percent";
|
|
return "statistic-percent";
|
|
|
|
|
+ case R:
|
|
|
|
|
+ return "statistic-double4";
|
|
|
|
|
+ case LRE:
|
|
|
|
|
+ return "statistic";
|
|
|
default:
|
|
default:
|
|
|
return "statistic-double";
|
|
return "statistic-double";
|
|
|
}
|
|
}
|