zss
2025-02-27 032e88451cc03c781401e3feef14057f9cff6f94
近场报告解析添加指标+平均值保留两位小数+检测依据不加9410
已修改2个文件
129 ■■■■■ 文件已修改
inspect-server/src/main/java/com/yuanchu/mom/utils/FuSheUtils.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/utils/WordUtils.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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()) {
@@ -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();
@@ -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);
@@ -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 @@
            }
        }
    }
}
inspect-server/src/main/java/com/yuanchu/mom/utils/WordUtils.java
@@ -845,8 +845,7 @@
                                    cells.add(cellRenderData);
                                }
                            }
                        }
                        else {
                        } else {
                            //电调版本(复杂版)
                            if (inspectionItemSubclass.contains("电压驻波比") && i <= (angles + 1) * portRow) {
                                cc = (angles + 1) * portRow;
@@ -1946,7 +1945,7 @@
                                int k = (angles + 1) * portRow2;
                                int rr = qq == 0 ? (pp == 0 ? (nn == 0 ? (mm == 0 ? (hh == 0 ? (gg == 0 ? (ff == 0 ? (ee == 0 ? ((dd == 0 ? cc : dd)) : ee) : ff) : gg) : hh) : mm) : nn) : pp) : qq;
                                if (i > rr && i <= rr + k) {
                                    ss = (rr + k) ;
                                    ss = (rr + k);
                                    if (itemSet.add("最大相位偏差")) {
                                        index.getAndIncrement();
                                    }
@@ -2051,7 +2050,7 @@
                                int length = result2s.get(0).getPort().split(",").length;
                                int portRow2 = (length % 8 == 0 ? length / 8 : length / 8 + 1);
                                int k = (angles + 1) * portRow2;
                                int rr =ss==0?( qq == 0 ? (pp == 0 ? (nn == 0 ? (mm == 0 ? (hh == 0 ? (gg == 0 ? (ff == 0 ? (ee == 0 ? ((dd == 0 ? cc : dd)) : ee) : ff) : gg) : hh) : mm) : nn) : pp) : qq) : ss;
                                int rr = ss == 0 ? (qq == 0 ? (pp == 0 ? (nn == 0 ? (mm == 0 ? (hh == 0 ? (gg == 0 ? (ff == 0 ? (ee == 0 ? ((dd == 0 ? cc : dd)) : ee) : ff) : gg) : hh) : mm) : nn) : pp) : qq) : ss;
                                if (i > ss) {
                                    if (itemSet.add("相位绝对值")) {
                                        index.getAndIncrement();
@@ -2598,11 +2597,10 @@
        String[] monthNames = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
        SampleProductDto s = insSample;
        models.add(s.getModel());
        standardMethod.addAll(standardMethodListMapper.selectList(Wrappers.<StandardMethodList>lambdaQuery()
                .in(StandardMethodList::getId, Arrays.stream(s.getStandardMethodListId().replaceAll("[\\[\\]]", "").split(","))
                        .map(String::trim).map(Integer::parseInt).collect(Collectors.toList()))).stream().map(aa -> {
            return aa.getCode() + " " + aa.getName();
        }).distinct().collect(Collectors.toList()));
        /*查询标准方法*/
        standardMethod.addAll(insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                .eq(InsProduct::getInsSampleId, insSample.getId())
                .eq(InsProduct::getState, 1)).stream().map(InsProduct::getMethodS).distinct().collect(Collectors.toList()));
        //总数
        Long productCount = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
                .eq(InsProduct::getInsSampleId, s.getId()));
@@ -2623,7 +2621,7 @@
                .eq(InsProduct::getInsSampleId, s.getId())
                .eq(InsProduct::getInsResult, 1));
//        productSize3.set(productSize3.get() + Integer.parseInt(productCount3 + ""));
        productSize3.set(productSize3.get() + Integer.parseInt(productCount3+productCount1 + ""));
        productSize3.set(productSize3.get() + Integer.parseInt(productCount3 + productCount1 + ""));
        //将项目按照站点进行分类
        Map<String, List<InsProduct>> listMap = s.getInsProduct().stream().collect(Collectors.groupingBy(InsProduct::getSonLaboratory));
        // 创建一个 Map 将站点和项目ID的映射关系
@@ -3076,7 +3074,6 @@
        for (String s1 : standardMethod) {
            standardMethod2.append(";\n").append(s1);
        }
        standardMethod2.append(";\n").append("GB/T 9410-2008 《移动通信天线通用技术规范》");
        standardMethod2.replace(0, 1, "");
        List<Map<String, String>> deviceList = null;
        if (deviceSet.size() != 0) {
@@ -4058,8 +4055,7 @@
                                    cells.add(cellRenderData);
                                }
                            }
                        }
                        else {
                        } else {
                            //电调版本(复杂版)
                            if (inspectionItemSubclass.contains("电压驻波比") && i <= (angles + 1) * portRow) {
                                cc = (angles + 1) * portRow;
@@ -5159,7 +5155,7 @@
                                int k = (angles + 1) * portRow2;
                                int rr = qq == 0 ? (pp == 0 ? (nn == 0 ? (mm == 0 ? (hh == 0 ? (gg == 0 ? (ff == 0 ? (ee == 0 ? ((dd == 0 ? cc : dd)) : ee) : ff) : gg) : hh) : mm) : nn) : pp) : qq;
                                if (i > rr && i <= rr + k) {
                                    ss = (rr + k) ;
                                    ss = (rr + k);
                                    if (itemSet.add("最大相位偏差")) {
                                        index.getAndIncrement();
                                    }
@@ -5264,7 +5260,7 @@
                                int length = result2s.get(0).getPort().split(",").length;
                                int portRow2 = (length % 8 == 0 ? length / 8 : length / 8 + 1);
                                int k = (angles + 1) * portRow2;
                                int rr =ss==0?( qq == 0 ? (pp == 0 ? (nn == 0 ? (mm == 0 ? (hh == 0 ? (gg == 0 ? (ff == 0 ? (ee == 0 ? ((dd == 0 ? cc : dd)) : ee) : ff) : gg) : hh) : mm) : nn) : pp) : qq) : ss;
                                int rr = ss == 0 ? (qq == 0 ? (pp == 0 ? (nn == 0 ? (mm == 0 ? (hh == 0 ? (gg == 0 ? (ff == 0 ? (ee == 0 ? ((dd == 0 ? cc : dd)) : ee) : ff) : gg) : hh) : mm) : nn) : pp) : qq) : ss;
                                if (i > ss) {
                                    if (itemSet.add("相位绝对值")) {
                                        index.getAndIncrement();