From 8688bfa3bba72f0e89520014a67454493b25e416 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期四, 20 三月 2025 10:46:54 +0800
Subject: [PATCH] Merge branch 'master' of http://dlindusit.com:53929/r/iailab-plat

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java |    2 +-
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/Readtxt.java         |   18 +++++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java
index 5910cdc..9478194 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java
@@ -66,7 +66,7 @@
             case DATAPOINT:
             case PLAN:
                 // 设置时间偏移量
-                mins = calMins(start, end, granularity);
+                mins = calMins(start, end, granularity) + 1;
                 break;
             case IND:
             case IND_ASCII:
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/Readtxt.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/Readtxt.java
index 8bbb43a..6efe3b1 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/Readtxt.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/Readtxt.java
@@ -1,8 +1,8 @@
 package com.iailab.module.model.mpk.common.utils;
 
 
+import com.iailab.module.model.common.utils.ASCIIUtil;
 import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.ss.util.CellRangeAddress;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.*;
@@ -132,14 +132,26 @@
                     for (int k = 0; k < cells; k++) {
                         //获取每一个单元格的数据
                         Cell cell = row.getCell(k, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
-                        doubles1[k] = cell.getNumericCellValue();
+                        CellType cellType = cell.getCellType();
+                        if (cellType.equals(CellType.NUMERIC)) {
+                            doubles1[k] = cell.getNumericCellValue();
+                        } else if (cellType.equals(CellType.STRING)) {
+                            // 校验数据格式
+                            if (k != 0) {
+                                throw new RuntimeException();
+                            }
+                            String stringCellValue = cell.getStringCellValue();
+                            doubles1 = ASCIIUtil.stringToAsciiArray(stringCellValue);
+                            break;
+                        }
+
                     }
                     doubles2[j] = doubles1;
                 }
                 datas.add(doubles2);
             }
         } catch (Exception e) {
-            throw new RuntimeException("解析Excel异常",e);
+            throw new RuntimeException("解析Excel异常", e);
         }
 
         return datas;

--
Gitblit v1.9.3