| | |
| | | package com.yuanchu.mom.utils; |
| | | |
| | | import cn.hutool.core.lang.UUID; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.deepoove.poi.data.*; |
| | | import com.deepoove.poi.data.style.*; |
| | | import com.yuanchu.mom.dto.Exceldata; |
| | |
| | | for (Map<String, Object> number : hashMaps) { |
| | | number.put("端口", s1); |
| | | Double o = (Double) number.get("测试频率(MHZ)"); |
| | | if (ObjectUtils.isNull(o)){ |
| | | o = (Double) number.get("测量频率(MHz)"); |
| | | } |
| | | floatList.add(o.intValue()); |
| | | } |
| | | Integer maxValue = Collections.max(floatList); |
| | |
| | | // 初始化行数 |
| | | int rowNum = 2; |
| | | for (String s2 : aggregatedMap.keySet()) { |
| | | if (s2.equals("端口") || s2.equals("测试频率(MHZ)")) { |
| | | if (s2.equals("端口") || s2.equals("测试频率(MHZ)") || s2.equals("测量频率(MHz)")) { |
| | | continue; |
| | | } |
| | | List<Map<String, Object>> mapList = aggregatedMap.get(s2); |
| | |
| | | run4.setText("频率(MHz)"); |
| | | |
| | | XWPFParagraph paragraph5 = table1.getRow(rowNum).getCell(5).getParagraphArray(0); |
| | | paragraph5.setAlignment(ParagraphAlignment.CENTER); |
| | | XWPFRun run5 = paragraph5.createRun(); |
| | | run5.setText("端口"); |
| | | |
| | | XWPFParagraph paragraph6 = table1.getRow(rowNum).getCell(cell - 1).getParagraphArray(0); |
| | | paragraph6.setAlignment(ParagraphAlignment.CENTER); |
| | | XWPFRun run6 = paragraph6.createRun(); |
| | | run6.setText("判定"); |
| | | |
| | | XWPFParagraph paragraph7 = table1.getRow(rowNum+1).getCell(cell - 1).getParagraphArray(0); |
| | | paragraph7.setAlignment(ParagraphAlignment.CENTER); |
| | | XWPFRun run7 = paragraph7.createRun(); |
| | | run7.setText("合格"); |
| | | |
| | | |
| | | XWPFParagraph paragraph8 = table1.getRow(rowNum+checkItemRowNum - 1).getCell(4).getParagraphArray(0); |
| | | paragraph8.setAlignment(ParagraphAlignment.CENTER); |
| | | XWPFRun run8 = paragraph8.createRun(); |
| | | run8.setText("平均值"); |
| | | |
| | | XWPFParagraph paragraph9 = table1.getRow(rowNum + checkItemRowNum - 1).getCell(cell - 1).getParagraphArray(0); |
| | | paragraph9.setAlignment(ParagraphAlignment.CENTER); |
| | | XWPFRun run9 = paragraph9.createRun(); |
| | | run9.setText(""); |
| | | |
| | |
| | | String s3 = collect.get(i); |
| | | if (s3.contains("端口") || s3.contains("P")) { |
| | | XWPFParagraph paragraph10 = table1.getRow(rowNum+1).getCell(5 + i).getParagraphArray(0); |
| | | paragraph10.setAlignment(ParagraphAlignment.CENTER); |
| | | XWPFRun run10 = paragraph10.createRun(); |
| | | run10.setText(s3); |
| | | } |
| | |
| | | |
| | | Map<BigDecimal, List<Map<String, Object>>> group = mapList.stream() |
| | | .collect(Collectors.groupingBy(item -> { |
| | | BigDecimal value = new BigDecimal(String.valueOf(item.get("测试频率(MHZ)"))); |
| | | BigDecimal value=BigDecimal.ZERO; |
| | | if (item.containsKey("测试频率(MHZ)")) { |
| | | value = new BigDecimal(String.valueOf(item.get("测试频率(MHZ)"))); |
| | | } |
| | | else if (item.containsKey("测量频率(MHz)")){ |
| | | value = new BigDecimal(String.valueOf(item.get("测量频率(MHz)"))); |
| | | } |
| | | if (value.scale() <= 0 || value.stripTrailingZeros().scale() <= 0) { |
| | | // 没有小数部分,返回整数字符串 |
| | | return new BigDecimal(value.intValue()); |
| | |
| | | double firstParam = 0.0; |
| | | double secondParam = 0.0 ; |
| | | checkItemStandardStr = checkItemStandardStr.trim(); |
| | | if(checkItemStandardStr.contains("~") ){ |
| | | if(checkItemStandardStr.contains("~") || checkItemStandardStr.contains("~") ){ |
| | | checkType = 1; |
| | | String[] params = checkItemStandardStr.split("~"); |
| | | if (checkItemStandardStr.contains("~")) { |
| | | params = checkItemStandardStr.split("~"); |
| | | } |
| | | if(null != params && params.length == 2){ |
| | | firstParam = Double.valueOf(params[0]); |
| | | secondParam = Double.valueOf(params[1]); |