From e776dcaa5aa2416634644c2c7ac333ee95738b95 Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期一, 17 三月 2025 15:57:31 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/tx-lims-after
---
inspect-server/src/main/java/com/yuanchu/mom/utils/FuSheUtils.java | 115 +++++++++++++++++++++++++--------------------------------
1 files changed, 51 insertions(+), 64 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/utils/FuSheUtils.java b/inspect-server/src/main/java/com/yuanchu/mom/utils/FuSheUtils.java
index 919a9ca..e764498 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/utils/FuSheUtils.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/utils/FuSheUtils.java
@@ -96,47 +96,50 @@
switch (cell.getCellType()) {
case STRING:
if (cell.getColumnIndex() == 1) {
+ if (cell.getStringCellValue().equals("鎸囨爣")) {
+ for (Cell cell1 : row) {
+ switch (cell1.getCellType()) {
+ case STRING:
+ biaozhun.put(project.get(cell1.getColumnIndex()).toString(), cell1.getStringCellValue());
+ break;
+ case NUMERIC:
+ System.out.print(cell1.getNumericCellValue() + "\t");
+ break;
+ case BOOLEAN:
+ System.out.print(cell1.getBooleanCellValue() + "\t");
+ break;
+ case FORMULA:
+ System.out.print(cell1.getCellFormula() + "\t");
+ break;
+ default:
+ System.out.print("NULL\t");
+ }
+ }
+ }
exitLoop = true;
break;
}
-// if (cell.getColumnIndex() == 1) {
-// if (cell.getStringCellValue().equals("鎸囨爣")) {
-// for (Cell cell1 : row) {
-// switch (cell1.getCellType()) {
-// case STRING:
-// biaozhun.put(project.get(cell1.getColumnIndex()).toString(), cell1.getStringCellValue());
-// break;
-// case NUMERIC:
-// System.out.print(cell1.getNumericCellValue() + "\t");
-// break;
-// case BOOLEAN:
-// System.out.print(cell1.getBooleanCellValue() + "\t");
-// break;
-// case FORMULA:
-// System.out.print(cell1.getCellFormula() + "\t");
-// break;
-// default:
-// System.out.print("NULL\t");
-// }
-// }
-// }else {
-// exitLoop = true;
-// }
-// break;
-// }
- if (StringUtils.isNotEmpty(s)) {
- datas.put(s, list);
+ String value = "zss";
+ switch (row.getCell(1).getCellType()){
+ case STRING:
+ value = cell.getStringCellValue();
+ break;
}
- list = new ArrayList<>();
- s = cell.getStringCellValue();
- datas.put(s, cell.getStringCellValue());
- System.out.print(cell.getStringCellValue() + "\t");
+ if (value.equals("zss")){
+ if (StringUtils.isNotEmpty(s)) {
+ datas.put(s, list);
+ }
+ list = new ArrayList<>();
+ s = cell.getStringCellValue();
+ datas.put(s, cell.getStringCellValue());
+ System.out.print(cell.getStringCellValue() + "\t");
+ }
break;
case NUMERIC:
- int columnIndex = cell.getColumnIndex();
- Object o = project.get(columnIndex);
- map.put(o.toString(), cell.getNumericCellValue());
- System.out.print(cell.getNumericCellValue() + "\t");
+ int columnIndex = cell.getColumnIndex();
+ Object o = project.get(columnIndex);
+ map.put(o.toString(), cell.getNumericCellValue());
+ System.out.print(cell.getNumericCellValue() + "\t");
break;
case BOOLEAN:
System.out.print(cell.getBooleanCellValue() + "\t");
@@ -158,6 +161,7 @@
}
}
}
+ list=list.stream().filter(map -> !map.isEmpty()).collect(Collectors.toList());
datas.put(s, list);
map1.put(sheetName, datas);
datas1.putAll(map1);
@@ -238,8 +242,6 @@
fileInputStream = new FileInputStream(new File(excelFilePath));
workbook = new XSSFWorkbook(fileInputStream); // 瀵逛簬 .xlsx 鏂囦欢
XWPFDocument document = new XWPFDocument();
-
- Boolean exitLoop = false;
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Exceldata exceldata = new Exceldata();
HashMap<Integer, Object> project = new HashMap<>();
@@ -255,14 +257,10 @@
Boolean biaoji = false;
int lastRowNum = sheet.getLastRowNum();
for (Row row : sheet) {
-
count++;
HashMap<String, Object> map1 = new HashMap<>();
HashMap<String, Object> pingjun = new HashMap<>();
-
- HashMap<String, Object> map = new HashMap<>();
for (Cell cell : row) {
-
if (row.getRowNum() == 0) {
switch (cell.getCellType()) {
case STRING:
@@ -281,8 +279,7 @@
default:
System.out.print("NULL\t");
}
- }
- else if (row.getRowNum() > 2) {
+ } else if (row.getRowNum() > 2) {
if (cell.getColumnIndex() == 0 && StringUtils.isNotEmpty(cell.getStringCellValue())) {
if (map2.size() != 0) {
map2.put(port, list);
@@ -327,8 +324,7 @@
}
}
- }
- else if (value.equals("鎸囨爣")) {
+ } else if (value.equals("鎸囨爣")) {
for (Cell cell1 : row) {
switch (cell1.getCellType()) {
case STRING:
@@ -347,8 +343,7 @@
System.out.print("NULL\t");
}
}
- }
- else {
+ } else {
biaoji = true;
}
break;
@@ -365,7 +360,6 @@
default:
System.out.print("NULL\t");
}
-
}
}
if (biaoji) {
@@ -373,7 +367,6 @@
break;
}
}
-
if (map1.size() != 0) {
list.add(map1);
}
@@ -415,17 +408,12 @@
}
}
-
System.out.println(map);
-
- int size = map.size();
for (String s1 : map.keySet()) {
String o = map.get(s1).toString();
-
List<String> collect = Arrays.stream(o.split(",")).collect(Collectors.toList());
int size1 = -1;
-
for (String s : datas1.keySet()) {
Map<String, List<HashMap<String, Object>>> o1 = (Map<String, List<HashMap<String, Object>>>) datas1.get(s);
for (String s3 : o1.keySet()) {
@@ -537,7 +525,7 @@
XWPFParagraph paragraph18 = table1.getRow(1).getCell(0).getParagraphArray(0);
paragraph18.setAlignment(ParagraphAlignment.CENTER);
XWPFRun run18 = paragraph18.createRun();
- run18.setText("棰戞锛� " + result1 + "MHz " + "涓嬪�捐" + result);
+ run18.setText("涓嬪�捐" + result);
List<String> collect = Arrays.stream(split).collect(Collectors.toList());
List<Map<String, Object>> list = new ArrayList<>();
// 瀵规墍鏈夌殑閿仛鍚�
@@ -613,7 +601,7 @@
XWPFRun run3 = paragraph3.createRun();
if (bz.get(s2) != null) {
run3.setText(bz.get(s2).toString());
- }else run3.setText("");
+ } else run3.setText("");
XWPFParagraph paragraph4 = table.getRow(0).getCell(4).getParagraphArray(0);
paragraph4.setAlignment(ParagraphAlignment.CENTER);
XWPFRun run4 = paragraph4.createRun();
@@ -625,7 +613,7 @@
XWPFParagraph paragraph6 = table.getRow(0).getCell(cell - 1).getParagraphArray(0);
paragraph6.setAlignment(ParagraphAlignment.CENTER);
XWPFRun run6 = paragraph6.createRun();
- run6.setText("/");
+ run6.setText("鍒ゅ畾");
XWPFParagraph paragraph7 = table.getRow(2).getCell(cell - 1).getParagraphArray(0);
paragraph7.setAlignment(ParagraphAlignment.CENTER);
XWPFRun run7 = paragraph7.createRun();
@@ -637,7 +625,7 @@
XWPFParagraph paragraph9 = table.getRow(row - 1).getCell(cell - 1).getParagraphArray(0);
paragraph9.setAlignment(ParagraphAlignment.CENTER);
XWPFRun run9 = paragraph9.createRun();
- run9.setText("/");
+ run9.setText("");
for (int i = 0; i < collect.size(); i++) {
String s3 = collect.get(i);
if (s3.contains("绔彛")) {
@@ -752,7 +740,7 @@
XWPFParagraph paragraph18 = table1.getRow(1).getCell(0).getParagraphArray(0);
XWPFRun run18 = paragraph18.createRun();
- run18.setText("棰戞锛� " + result1 + "MHz " + "涓嬪�捐" + result);
+ run18.setText("涓嬪�捐" + result);
List<String> collect = Arrays.stream(split).collect(Collectors.toList());
@@ -836,7 +824,7 @@
XWPFRun run3 = paragraph3.createRun();
if (bz.get(s2) != null) {
run3.setText(bz.get(s2).toString());
- }else run3.setText("");
+ } else run3.setText("");
XWPFParagraph paragraph4 = table.getRow(0).getCell(4).getParagraphArray(0);
@@ -850,7 +838,7 @@
XWPFParagraph paragraph6 = table.getRow(0).getCell(cell - 1).getParagraphArray(0);
XWPFRun run6 = paragraph6.createRun();
- run6.setText("/");
+ run6.setText("鍒ゅ畾");
XWPFParagraph paragraph7 = table.getRow(1).getCell(cell - 1).getParagraphArray(0);
XWPFRun run7 = paragraph7.createRun();
@@ -863,7 +851,7 @@
XWPFParagraph paragraph9 = table.getRow(row - 1).getCell(cell - 1).getParagraphArray(0);
XWPFRun run9 = paragraph9.createRun();
- run9.setText("/");
+ run9.setText("");
for (int i = 0; i < collect.size(); i++) {
String s3 = collect.get(i);
@@ -909,7 +897,7 @@
XWPFParagraph paragraph11 = table.getRow(row - 1).getCell(5).getParagraphArray(0);
XWPFRun run11 = paragraph11.createRun();
double v = count / (Double.parseDouble(s1.toString()) * Double.parseDouble(i1.toString()));
- run11.setText(o2.get(s2).toString());
+ run11.setText(String.format("%.2f",(double)o2.get(s2)));
size++;
}
@@ -940,6 +928,5 @@
}
}
}
-
}
--
Gitblit v1.9.3