src/main/kotlin/com/flightfeather/uav/common/utils/FileExchange.kt
@@ -8,7 +8,6 @@
import com.flightfeather.uav.domain.entity.RealTimeDataVehicle
import com.flightfeather.uav.socket.bean.AirData
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import org.apache.poi.ss.usermodel.Cell
import org.apache.poi.ss.usermodel.CellType
import org.apache.poi.ss.util.CellAddress
import org.apache.poi.xssf.streaming.SXSSFWorkbook
@@ -166,23 +165,24 @@
                                this.pm25 = it.getCell(1)?.numericCellValue?.toFloat()
                            }
                            else -> {
                                throw BizException("单元格[${pm25CellPosStr}]不是数字类型")
                                throw BizException("单元格[${pm25CellPosStr}]不是数字类型或者文本类型")
                            }
                        }
                    }
                    result.add(data)
                })
        } catch (e: BizException) {
            throw e
        } catch (e: Exception) {
            e.printStackTrace()
            throw BizException("excel文件内容错误,数据转换失败!", e)
        }
        // 判断网格单元格编号是否在正确的范围内
        val resultCellIdSet = result.asSequence().map { it.cellId ?: -1 }.toSet()
        val resultCellIdSet = result.map { it.cellId ?: -1 }.toSet()
        // 用户导入中缺少的的单元格
        val shortCells = correctRangeGridCells - resultCellIdSet
        val lackCells = correctRangeGridCells - resultCellIdSet
        // excel 中多出的的单元格
        val outCells = resultCellIdSet - correctRangeGridCells
        if (shortCells.isNotEmpty()) {
            throw BizException("导入数据中缺少以下网格单元格:${shortCells.joinToString(",")}")
        if (lackCells.isNotEmpty()) {
            throw BizException("导入数据中缺少以下网格单元格:${lackCells.joinToString(",")}")
        }
        if (outCells.isNotEmpty()) {
            throw BizException("导入数据中有多余网格单元格:${outCells.joinToString(",")}")
@@ -265,17 +265,18 @@
                    }
                    result.add(data)
                })
        } catch (e: BizException) {
            throw e
        } catch (e: Exception) {
            e.printStackTrace()
            throw BizException("excel文件内容错误,数据转换失败!", e)
        }
        // 判断网格单元格编号是否在正确的范围内
        val resultCellIdSet = result.asSequence().map { it.cellId ?: -1 }.toSet()
        val resultCellIdSet = result.map { it.cellId ?: -1 }.toSet()
        // 用户导入中缺少的的单元格
        val shortCells = correctRangeGridCells - resultCellIdSet
        val lackCells = correctRangeGridCells - resultCellIdSet
        // excel 中多出的的单元格
        val outCells = resultCellIdSet - correctRangeGridCells
        if (shortCells.isNotEmpty()) {
            throw BizException("导入数据中缺少以下网格单元格:${shortCells.joinToString(",")}")
        if (lackCells.isNotEmpty()) {
            throw BizException("导入数据中缺少以下网格单元格:${lackCells.joinToString(",")}")
        }
        if (outCells.isNotEmpty()) {
            throw BizException("导入数据中有多余网格单元格:${outCells.joinToString(",")}")