From bc1b3ee367f7e9aef88fc59647a9631f39eca6b5 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 23 四月 2025 09:19:55 +0800
Subject: [PATCH] 1.数采 2.国产网分仪

---
 cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java |  549 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 543 insertions(+), 6 deletions(-)

diff --git a/cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java b/cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java
index 5065c0b..2fda700 100644
--- a/cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java
+++ b/cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java
@@ -15,6 +15,7 @@
 import javax.script.ScriptEngineManager;
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
+import java.text.DecimalFormat;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -48,7 +49,7 @@
             if (device.getFileType().equals(".xlsx")) {
                 String url = device.getCollectUrl() + "\\" + sampleCode.replace("/", "");
                 if (StringUtils.isNotBlank(dataConfig.get(0).getAnotherName())) {
-                    url += dataConfig.get(0).getAnotherName() ;
+                    url += dataConfig.get(0).getAnotherName();
                 }
                 url += ".xlsx";
                 device.setCollectUrl(url);
@@ -86,7 +87,7 @@
         JSONObject jsonObject = JSON.parseObject(result);
         if (Objects.equals(jsonObject.get("code"), 1)) {
             if (ObjectUtils.isEmpty(jsonObject.get("msg"))) {
-                throw new ErrorException("鏈煡璇㈠埌鏂囦欢锛佸彲鑳借璺緞锛�" + device.getCollectUrl() + "锛変笅骞舵病鏈夋墍闇�(" + device.getFileType() +")鏂囦欢锛�");
+                throw new ErrorException("鏈煡璇㈠埌鏂囦欢锛佸彲鑳借璺緞锛�" + device.getCollectUrl() + "锛変笅骞舵病鏈夋墍闇�(" + device.getFileType() + ")鏂囦欢锛�");
             } else {
                 throw new ErrorException(jsonObject.get("msg") + "");
             }
@@ -113,6 +114,9 @@
                 case ".xlsx":
                     map = analysisList(data, userMap, device, entrustCode, sampleCode);
                     break;
+                case ".xls":
+                    map = analysisXlsList(data, userMap, device, entrustCode, sampleCode);
+                    break;
                 case ".txt":
                     map = analysisTxt(data, userMap, device, entrustCode, sampleCode);
                     break;
@@ -133,6 +137,12 @@
                 case ".png":
                     map = readPngString(data, userMap, device);
                     break;
+                case ".pdf":
+                    map = readPdfString(data, userMap, device);
+                    break;
+                case ".et":
+                    map = readEtString(data, userMap, device);
+                    break;
                 default:
                     map = null;
                     break;
@@ -144,6 +154,264 @@
             }
             return map;
         }
+    }
+
+    private static Map<String, Object> readEtString(String data, Map<String, List<DataConfig>> dataConfig, Device device) {
+        Map<String, Object> map = new HashMap<>();
+        // 瀹氫箟 RoHS 鎸囨爣鍒楄〃
+        List<String> rohsIndicators = Arrays.asList("RoHS鎸囨爣,闀夛紙Cd锛�", "RoHS鎸囨爣,鎬绘捍鑱旇嫰锛圔r锛�", "RoHS鎸囨爣,鎬婚摤锛圕r锛�", "RoHS鎸囨爣,姹烇紙Hg锛�", "RoHS鎸囨爣,閾咃紙Pb锛�");
+        dataConfig.forEach((k, v) -> {
+            List<Object> list;
+            boolean containsRoHS = false;
+            for (DataConfig item : v) {
+                if (rohsIndicators.contains(item.getInsProductItem())) {
+                    containsRoHS = true;
+                    break;
+                }
+            }
+            if (containsRoHS) {
+                list = analyzeEt1Data(data, v, splitIdentifier);
+            } else {
+                list = analyzeEtData(data, v, splitIdentifier);
+            }
+            // 杩涜鍏紡璁$畻
+            Object resultValue = calculationFormula(list, v.get(0), k, device);
+            map.put(k, resultValue);
+        });
+        return map;
+    }
+
+    /**
+     * 鑽у厜鍏夎氨浠� .et鏂囦欢
+     *
+     * @param data
+     * @param v
+     * @param splitIdentifier
+     * @return
+     */
+    private static List<Object> analyzeEt1Data(String data, List<DataConfig> v, String splitIdentifier) {
+        List<Object> finalResult = new ArrayList<>();
+        List<String> matchingLines = new ArrayList<>();
+
+        // 閬嶅巻 DataConfig 鍒楄〃
+        for (DataConfig config : v) {
+            String referx = getRefer(config.getReferx());
+            if (ObjectUtils.isEmpty(referx)) {
+                continue;
+            }
+            // 浣跨敤姝e垯琛ㄨ揪寮忔瀯寤哄畬鏁村尮閰嶇殑妯″紡
+            String regex = "\\b" + Pattern.quote(referx) + "\\b";
+            Pattern pattern = Pattern.compile(regex);
+
+            String[] lines = data.replaceAll(" ", "").split("\n");
+            // 绛涢�夊嚭鍖呭惈 referx 鐨勮
+            for (String line : lines) {
+                if (pattern.matcher(line).find()) {
+                    matchingLines.add(line);
+                }
+            }
+        }
+
+        // 閬嶅巻鍖归厤鐨勮锛屾彁鍙� splitIdentifier 绗竷涓拰绗叓涓垎闅旂涓棿鐨勫��
+        for (String line : matchingLines) {
+            int startIndex = -1;
+            int endIndex = -1;
+            int count = 0;
+            int index = 0;
+            while ((index = line.indexOf(splitIdentifier, index)) != -1) {
+                count++;
+                if (count == 7) {
+                    startIndex = index + splitIdentifier.length();
+                } else if (count == 8) {
+                    endIndex = index;
+                    break;
+                }
+                index++;
+            }
+            if (startIndex != -1 && endIndex != -1) {
+                finalResult.add(line.substring(startIndex, endIndex));
+            }
+        }
+
+        // 纭繚杩斿洖鍊间负鏁扮粍鏍煎紡
+        if (finalResult.size() == 1) {
+            List<Object> singleResultAsArray = new ArrayList<>();
+            singleResultAsArray.add(finalResult.get(0));
+            return singleResultAsArray;
+        }
+        return finalResult;
+    }
+
+    /**
+     * 鎷夊姏鏈�.et鏂囦欢
+     *
+     * @param data
+     * @param v
+     * @param splitIdentifier
+     * @return
+     */
+    public static List<Object> analyzeEtData(String data, List<DataConfig> v, String splitIdentifier) {
+        List<Object> finalResult = new ArrayList<>();
+
+        for (DataConfig config : v) {
+            String referx = getRefer(config.getReferx());
+            if (ObjectUtils.isEmpty(referx)) {
+                continue;
+            }
+
+            String[] lines = data.replaceAll(" ", "").split("\n");
+            boolean foundReferx = false;
+            List<String> validLines = new ArrayList<>();
+            int referxColumnIndex = -1; // 鐢ㄤ簬瀛樺偍referx鎵�鍦ㄥ垪绱㈠紩
+
+            // 鍏堟壘鍑簉eferx鎵�鍦ㄥ垪绱㈠紩
+            for (String line : lines) {
+                String[] parts = line.split(splitIdentifier);
+                for (int i = 0; i < parts.length; i++) {
+                    if (parts[i].contains(referx)) {
+                        referxColumnIndex = i;
+                        break;
+                    }
+                }
+                if (referxColumnIndex != -1) {
+                    break;
+                }
+            }
+            // 鑻ユ湭鎵惧埌鍖归厤鐨剅eferx锛屾姏鍑哄紓甯�
+            if (referxColumnIndex == -1) {
+                throw new IllegalArgumentException("璇疯緭鍏ユ纭殑x鍊硷紝鏂囦欢涓湭鎵惧埌涓� " + referx + " 鍖归厤鐨勫�笺��");
+            }
+            for (int i = 0; i < lines.length; i++) {
+                String line = lines[i];
+                String[] parts = line.split(splitIdentifier, 2);
+
+                if (!foundReferx) {
+                    if (containsReferx(parts, referx)) {
+                        foundReferx = true;
+                    }
+                    continue;
+                }
+
+                if (i > 0 && foundReferx) {
+                    if (parts.length > 0 && isNumeric(parts[0])) {
+                        validLines.add(line);
+                    }
+                }
+            }
+            for (String line : validLines) {
+                String[] parts = line.split(splitIdentifier);
+                if (referxColumnIndex < parts.length) {
+                    String value = parts[referxColumnIndex].trim();
+                    if (value.isEmpty()) {
+                        value = "";
+                    }
+                    finalResult.add(value);
+                } else {
+                    finalResult.add("");
+                }
+            }
+        }
+        return finalResult;
+    }
+
+    private static boolean containsReferx(String[] parts, String referx) {
+        for (String part : parts) {
+            if (part.contains(referx)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static boolean isNumeric(String str) {
+        try {
+            Double.parseDouble(str);
+            return true;
+        } catch (NumberFormatException e) {
+            return false;
+        }
+    }
+
+    /**
+     * 鑹茶氨pdf鏂囦欢闇�瑕佸畾浣峹,y
+     *
+     * @param data
+     * @param dataConfig
+     * @param device
+     * @return
+     */
+    private static Map<String, Object> readPdfString(String data, Map<String, List<DataConfig>> dataConfig, Device device) {
+        Map<String, Object> map = new HashMap<>();
+        dataConfig.forEach((k, v) -> {
+            List<Object> list = new ArrayList<>();
+            for (int config = 0; config < v.size(); config++) {
+                String referX = getRefer(v.get(config).getReferx());
+                String referY = getRefer(v.get(config).getRefery());
+                String[] aColumnY = data.split("\n");
+                for (String line : aColumnY) {
+                    if (line.contains(referX) || line.contains(referY)) {
+                        list.add(line);
+                    }
+                }
+
+                int referYColumnIndex = -1;
+                for (Object item : list) {
+                    // 浣跨敤姝e垯琛ㄨ揪寮� \\s+ 鍒嗗壊瀛楃涓�
+                    String[] columns = ((String) item).split("\\s+");
+                    for (int i = 0; i < columns.length; i++) {
+                        if (columns[i].equals(referY)) {
+                            referYColumnIndex = i;
+                            break;
+                        }
+                    }
+                    if (referYColumnIndex != -1) {
+                        break;
+                    }
+                }
+
+                List<Object> targetColumnValues = new ArrayList<>();
+                if (referYColumnIndex != -1) {
+                    for (Object item : list) {
+                        String line = (String) item;
+                        // 杩囨护鎺夊寘鍚� referY 鐨勮
+                        if (!line.contains(referY)) {
+                            String[] columns = line.split("\\s+");
+                            if (columns.length > referYColumnIndex) {
+                                targetColumnValues.add(columns[referYColumnIndex]);
+                            }
+                        }
+                    }
+                }
+                Object resultValue = calculationFormula(targetColumnValues, v.get(0), k, device);
+                map.put(k, resultValue);
+            }
+        });
+        return map;
+    }
+
+    public static List<Object> extractColumnValues(List<Object> list, String columnName) {
+        List<Object> columnValues = new ArrayList<>();
+        if (list.isEmpty()) {
+            return columnValues;
+        }
+        String[] headers = ((String) list.get(0)).split(",");
+        int columnIndex = -1;
+        for (int i = 0; i < headers.length; i++) {
+            if (headers[i].equals(columnName)) {
+                columnIndex = i;
+                break;
+            }
+        }
+        if (columnIndex == -1) {
+            return columnValues;
+        }
+        for (int i = 1; i < list.size(); i++) {
+            String[] columns = ((String) list.get(i)).split(",");
+            if (columnIndex < columns.length) {
+                columnValues.add(columns[columnIndex]);
+            }
+        }
+        return columnValues;
     }
 
     public static Map<String, Object> createFrequency(String entrustCode, String sampleCode, Map<String, Object> map) {
@@ -423,7 +691,7 @@
         ArrayList<Object> listResult = new ArrayList<>();
         Map<String, Object> hashMap = new HashMap<>();
         // 濡傛灉涓嶄负绌猴紝杩涜鍏紡璁$畻
-        if (ObjectUtils.isNotEmpty(dataConfig.getFormula())) {
+        if (ObjectUtils.isNotEmpty(dataConfig.getFormula()) && !"(null)".equals(dataConfig.getFormula())) {
             // 鍚﹀垯锛氭病鏈夊叕寮忎唬琛ㄤ笉闇�瑕佽绠楋紝鐩存帴鎻愬彇List閲岄潰鐨勬暟鎹�
             if (ObjectUtils.isEmpty(device.getEntrustCode()) && ObjectUtils.isEmpty(device.getSampleCode())) {
                 String s = calculationFormulaList(list, dataConfig.getFormula());
@@ -526,9 +794,211 @@
         Map<String, Object> map = new HashMap<>();
         dataConfig.forEach((k, v) -> {
             List<Object> list = new ArrayList<>();
+//            // 濮旀墭缂栧彿涓庢牱鍝佺紪鍙蜂笉瀛樺湪锛屽畾锛�1銆乊瀹氳寖鍥达紝X瀹氭í鍧愭爣锛�2銆佸彧瀛樺湪Y锛�3銆佸彧瀛樺湪X
+//            if (ObjectUtils.isEmpty(device.getEntrustCode()) && ObjectUtils.isEmpty(device.getSampleCode())) {
+//                list = analyzeXlsData(data, v, k, splitIdentifier);
+//                // 濮旀墭缂栧彿涓庢牱鍝佺紪鍙峰瓨鍦�
+//            } else if (ObjectUtils.isNotEmpty(device.getEntrustCode()) && ObjectUtils.isNotEmpty(device.getSampleCode())) {
+//                list = analyzeDataEntrustCodAndSampleCode(data, v, k, splitIdentifier, device, entrustCode, sampleCode);
+//            }
+            list = analyzeXlsx1Data(data, v, k, splitIdentifier);
+            // 杩涜鍏紡璁$畻
+            Object resultValue = calculationFormula(list, v.get(0), k, device);
+            map.put(k, resultValue);
+        });
+        return map;
+    }
+
+    private static List<Object> analyzeXlsx1Data(String data, List<DataConfig> v, String k, String splitIdentifier) {
+        List<Object> finalResult = new ArrayList<>();
+
+        if (data == null || data.isEmpty()) {
+            throw new IllegalArgumentException("杈撳叆鐨勬暟鎹负绌猴紝璇锋鏌ヨ緭鍏ャ��");
+        }
+
+        // 鍒嗗壊鏁版嵁涓鸿
+        String[] lines = data.replaceAll(" ", "").split("\n");
+        if (lines.length == 0) {
+            throw new IllegalArgumentException("杈撳叆鐨勬暟鎹病鏈夋湁鏁堢殑琛岋紝璇锋鏌ヨ緭鍏ャ��");
+        }
+
+        // 鑾峰彇琛ㄥご
+        String[] headers = lines[0].split("\\s+");
+        if (headers.length == 0) {
+            throw new IllegalArgumentException("琛ㄥご鏁版嵁涓虹┖锛岃妫�鏌ヨ緭鍏ユ牸寮忋��");
+        }
+
+        // 鏌ユ壘娴嬭瘯鏃堕棿鍒楃殑绱㈠紩
+        int testTimeIndex = -1;
+        for (int i = 0; i < headers.length; i++) {
+            if (headers[i].contains("娴嬭瘯鏃堕棿")) {
+                testTimeIndex = i;
+                break;
+            }
+        }
+
+        // 鑻ユ湭鎵惧埌娴嬭瘯鏃堕棿鍒楋紝鎶涘嚭寮傚父
+        if (testTimeIndex == -1) {
+            throw new IllegalArgumentException("鏈壘鍒板寘鍚� '娴嬭瘯鏃堕棿' 鐨勫垪锛岃妫�鏌ヨ〃澶淬��");
+        }
+
+        // 鐢ㄤ簬瀛樺偍娴嬭瘯鏃堕棿涓� 2400 鐨勮鏁版嵁
+        String[] targetLine = null;
+
+        // 鏌ユ壘娴嬭瘯鏃堕棿涓� 2400 鐨勮
+        for (int i = 1; i < lines.length; i++) {
+            try {
+                String[] lineData = lines[i].split("\\s+");
+                double testTime = Double.parseDouble(lineData[testTimeIndex]);
+                if (testTime == 2400) {
+                    targetLine = lineData;
+                    break;
+                }
+            } catch (NumberFormatException e) {
+                throw new RuntimeException("绗� " + (i + 1) + " 琛岀殑 '娴嬭瘯鏃堕棿' 鍒楁暟鎹棤娉曡浆鎹负鏁板瓧锛岃妫�鏌ユ暟鎹牸寮忋��", e);
+            } catch (ArrayIndexOutOfBoundsException e) {
+                throw new RuntimeException("绗� " + (i + 1) + " 琛岀殑鏁版嵁鍒楁暟涓嶈冻锛屾棤娉曡幏鍙� '娴嬭瘯鏃堕棿' 鍒楋紝璇锋鏌ユ暟鎹牸寮忋��", e);
+            }
+        }
+
+        // 鑻ユ湭鎵惧埌娴嬭瘯鏃堕棿涓� 2400 鐨勮锛屾姏鍑哄紓甯�
+        if (targetLine == null) {
+            throw new RuntimeException("鏈壘鍒版祴璇曟椂闂翠负 2400 鐨勬暟鎹紝璇锋鏌ユ暟鎹唴瀹广��");
+        }
+
+        for (DataConfig config : v) {
+            String referx = getRefer(config.getReferx());
+            if (ObjectUtils.isEmpty(referx)) {
+                continue;
+            }
+
+            // 鏌ユ壘 referx 鍒楃殑绱㈠紩
+            int referxIndex = -1;
+            for (int i = 0; i < headers.length; i++) {
+                if (headers[i].trim().contains(referx.trim())) {
+                    referxIndex = i;
+                    break;
+                }
+            }
+
+            // 鑻ユ湭鎵惧埌 referx 鍒楋紝鎶涘嚭寮傚父
+            if (referxIndex == -1) {
+                throw new IllegalArgumentException("鏈壘鍒� '" + referx + "' 鍒楋紝璇锋鏌ヨ〃澶村拰閰嶇疆銆�");
+            }
+
+            try {
+                double value = Double.parseDouble(targetLine[referxIndex]);
+                // 鍥涜垗浜斿叆淇濈暀涓や綅灏忔暟
+                DecimalFormat df = new DecimalFormat("#.00");
+                String formattedValue = df.format(value);
+                finalResult.add(Double.parseDouble(formattedValue));
+            } catch (NumberFormatException e) {
+                throw new RuntimeException("'娴嬭瘯鏃堕棿' 涓� 2400 鐨勮涓紝'" + referx + "' 鍒楃殑鏁版嵁鏃犳硶杞崲涓烘暟瀛楋紝璇锋鏌ユ暟鎹牸寮忋��", e);
+            } catch (ArrayIndexOutOfBoundsException e) {
+                throw new RuntimeException("'娴嬭瘯鏃堕棿' 涓� 2400 鐨勮鐨勬暟鎹垪鏁颁笉瓒筹紝鏃犳硶鑾峰彇 '" + referx + "' 鍒楋紝璇锋鏌ユ暟鎹牸寮忋��", e);
+            }
+        }
+        return finalResult;
+    }
+
+    private static List<Object> analyzeXlsxData(String data, List<DataConfig> v, String k, String splitIdentifier) {
+
+        List<Object> finalResult = new ArrayList<>();
+        String ss = k;
+
+        // 瀛樺偍绗﹀悎娴嬭瘯鏃堕棿鑼冨洿鐨勬暟鎹
+        List<String[]> validLines = new ArrayList<>();
+        String[] lines = data.replaceAll(" ", "").split("\n");
+        String[] headers = lines[0].split("\\s+");
+        int testTimeIndex = -1;
+        for (int i = 0; i < headers.length; i++) {
+            if ("娴嬭瘯鏃堕棿".equals(headers[i])) {
+                testTimeIndex = i;
+                break;
+            }
+        }
+
+        if (testTimeIndex == -1) {
+            return finalResult;
+        }
+
+        // 绛涢�夊嚭娴嬭瘯鏃堕棿鍦� 300 鍒� 1500 涔嬮棿鐨勬暟鎹
+        for (int i = 1; i < lines.length; i++) {
+            String[] lineData = lines[i].split("\\s+");
+            try {
+                double testTime = Double.parseDouble(lineData[testTimeIndex]);
+                if (testTime > 300 && testTime <= 1500) {
+                    validLines.add(lineData);
+                } else if (testTime > 1500) {
+                    break;
+                }
+            } catch (NumberFormatException e) {
+                continue;
+            }
+        }
+
+        for (DataConfig config : v) {
+            String referx = getRefer(config.getReferx());
+            if (ObjectUtils.isEmpty(referx)) {
+                continue;
+            }
+
+            int referxIndex = -1;
+            for (int i = 0; i < headers.length; i++) {
+                if (referx.equals(headers[i])) {
+                    referxIndex = i;
+                    break;
+                }
+            }
+
+            if (referxIndex == -1) {
+                continue;
+            }
+
+            List<Double> values = new ArrayList<>();
+            for (String[] lineData : validLines) {
+                try {
+                    double value = Double.parseDouble(lineData[referxIndex]);
+                    values.add(value);
+                } catch (NumberFormatException e) {
+                    continue;
+                }
+            }
+
+            Object result;
+            if ("HRR".equals(referx) || "SPR".equals(referx) || "FIGRA".equals(referx)) {
+                result = values.stream().mapToDouble(Double::doubleValue).max().orElse(0);
+            } else if ("THR".equals(referx) || "TSP".equals(referx)) {
+                result = values.stream().mapToDouble(Double::doubleValue).sum();
+            } else {
+                continue;
+            }
+
+            if (result != null) {
+                // 鍥涜垗浜斿叆淇濈暀涓や綅灏忔暟
+                DecimalFormat df = new DecimalFormat("#.00");
+                result = Double.parseDouble(df.format(result));
+                finalResult.add(result);
+            }
+        }
+        return finalResult;
+    }
+
+    /**
+     * 鍙朮瀹氫綅
+     *
+     * @param data       閲囬泦鍒扮殑鏂囦欢瀛楃涓�
+     * @param dataConfig 鐢ㄦ埛閰嶇疆濂界殑x瀹氫綅鏁版嵁涓庡弬鐓х墿
+     * @return
+     */
+    public static Map<String, Object> analysisXlsList(String data, Map<String, List<DataConfig>> dataConfig,
+                                                      Device device, String entrustCode, String sampleCode) {
+        Map<String, Object> map = new HashMap<>();
+        dataConfig.forEach((k, v) -> {
+            List<Object> list = new ArrayList<>();
             // 濮旀墭缂栧彿涓庢牱鍝佺紪鍙蜂笉瀛樺湪锛屽畾锛�1銆乊瀹氳寖鍥达紝X瀹氭í鍧愭爣锛�2銆佸彧瀛樺湪Y锛�3銆佸彧瀛樺湪X
             if (ObjectUtils.isEmpty(device.getEntrustCode()) && ObjectUtils.isEmpty(device.getSampleCode())) {
-                list = analyzeData(data, v, k, splitIdentifier);
+                list = analyzeXlsData(data, v, k, splitIdentifier);
                 // 濮旀墭缂栧彿涓庢牱鍝佺紪鍙峰瓨鍦�
             } else if (ObjectUtils.isNotEmpty(device.getEntrustCode()) && ObjectUtils.isNotEmpty(device.getSampleCode())) {
                 list = analyzeDataEntrustCodAndSampleCode(data, v, k, splitIdentifier, device, entrustCode, sampleCode);
@@ -569,7 +1039,7 @@
                         if (aLine[j].contains(entrustCode)) {
                             entrustCodeY = j;
                         }
-                        if (aLine[j].contains(sampleCode) ) {
+                        if (aLine[j].contains(sampleCode)) {
                             sampleCodeY = j;
                         }
                         if (aLine[j].contains(refery)) {
@@ -588,7 +1058,8 @@
                                 list.add(result);
                             }
                         }
-                    } catch (Exception e) {}
+                    } catch (Exception e) {
+                    }
                 }
             }
         }
@@ -720,6 +1191,72 @@
         return list;
     }
 
+    public static List<Object> analyzeXlsData(String data, List<DataConfig> v, String k, String split) {
+        List<Object> finalResult = new ArrayList<>(); // 鏈�缁堣繑鍥炵殑缁撴灉鍒楄〃
+
+        for (DataConfig config : v) {
+            // 鍙栫敤鎴烽厤缃殑鍙傜収鐗�
+            String referx = getRefer(config.getReferx());
+            if (ObjectUtils.isEmpty(referx)) {
+                continue;
+            }
+
+            // 绗竴姝ワ細瑙f瀽鏁版嵁锛屾壘鍒扮鍚堟潯浠剁殑琛岋紙绗簩涓垎闅旂鍓嶅拰鍐掑彿鍚庝负鏁板瓧锛�
+            List<String> validLines = new ArrayList<>();
+            String[] lines = data.replaceAll(" ", "").split("\n");
+            for (String line : lines) {
+                String[] parts = line.split(split);
+                if (parts.length > 1) {
+                    // 妫�鏌ョ浜屼釜鍒嗛殧绗﹀墠闈㈠拰鍐掑彿鍚庨潰鏄惁涓烘暟瀛�
+                    String beforeSplit = parts[1];
+                    String afterColon = "";
+                    if (beforeSplit.contains(":")) {
+                        String[] colonParts = beforeSplit.split(":");
+                        if (colonParts.length > 1) {
+                            afterColon = colonParts[1].trim();
+                        }
+                    }
+                    try {
+                        Double.parseDouble(afterColon); // 鍐掑彿鍚庢槸鍚︿负鏁板瓧
+                        validLines.add(line); // 濡傛灉绗﹀悎鏉′欢锛屾坊鍔犲埌涓存椂鍒楄〃涓�
+                    } catch (NumberFormatException e) {
+                        // 涓嶇鍚堟暟瀛楁潯浠讹紝蹇界暐
+                    }
+                }
+            }
+
+            // 绗簩姝ワ細浠庝复鏃跺垪琛ㄤ腑鎻愬彇鍖呭惈 referx 鐨勮锛屽苟鑾峰彇鍏跺悗闈㈢殑鏁板瓧鍊�
+            List<Object> result = new ArrayList<>();
+            for (String line : validLines) {
+                if (line.contains(referx)) {
+                    String[] parts = line.split(referx);
+                    if (parts.length > 1) {
+                        String xValue = parts[1].trim();
+                        // 鎻愬彇 referx 鍚庨潰鍒颁笅涓�涓垎闅旂涔嬮棿鐨勬暟瀛�
+                        String[] splitParts = xValue.split(split);
+                        if (splitParts.length > 0) {
+                            try {
+                                String trim = splitParts[0].trim();
+                                if (trim.contains(":")) {
+                                    trim = trim.replaceAll(":", "");
+                                }
+                                Double.parseDouble(trim); // 鍒ゆ柇鏄惁涓烘暟瀛�
+                                result.add(trim);
+                            } catch (NumberFormatException e) {
+                                // 涓嶆槸鏁板瓧锛屽拷鐣�
+                            }
+                        }
+                    }
+                }
+            }
+            // 闃叉璁$畻鍏紡鐨勬椂鍊欏嚭鐜帮細[null] 杩欑鏁版嵁
+            if (!result.isEmpty()) {
+                finalResult.addAll(result);
+            }
+        }
+        return finalResult;
+    }
+
     public static String getFormatProcessing(String value) {
         value = value.replaceAll("%", "");
         if (value.contains("=")) {

--
Gitblit v1.9.3