From 34b0c36cf609ba295c8f66a85d479f740964a864 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期一, 03 十一月 2025 08:11:34 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/BasMapController.java |   63 +++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/BasMapController.java b/src/main/java/com/zy/asrs/controller/BasMapController.java
index 16ca989..9df3f27 100644
--- a/src/main/java/com/zy/asrs/controller/BasMapController.java
+++ b/src/main/java/com/zy/asrs/controller/BasMapController.java
@@ -20,11 +20,15 @@
 import com.zy.common.utils.RedisUtil;
 import com.zy.common.web.BaseController;
 import com.zy.core.enums.RedisKeyType;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFColor;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.*;
 
@@ -172,4 +176,63 @@
         return R.ok();
     }
 
+    @PostMapping("/basMap/crn/upload")
+    public R uploadExcel2(@RequestParam("file") MultipartFile file) throws IOException {
+        // 淇濆瓨涓婁紶鐨勬枃浠跺埌涓存椂浣嶇疆
+        String filePath = System.getProperty("java.io.tmpdir") + file.getOriginalFilename();
+        file.transferTo(new File(filePath));
+
+        HashMap<Integer, List<List<HashMap<String, Object>>>> dataMap = mapExcelUtils.readExcel(filePath);
+
+        List<List<HashMap<String, Object>>> dataList = new ArrayList<>();
+        for (Map.Entry<Integer, List<List<HashMap<String, Object>>>> entry : dataMap.entrySet()) {
+            Integer key = entry.getKey();
+            List<List<HashMap<String, Object>>> list = entry.getValue();
+
+            for (int i = 0; i < list.size(); i++) {
+                List<HashMap<String, Object>> bayList = list.get(i);
+                List<HashMap<String, Object>> arrayList = new ArrayList<>();
+                for (int j = 0; j < bayList.size(); j++) {
+                    HashMap<String, Object> map = bayList.get(j);
+
+                    HashMap<String, Object> nodeData = new HashMap<>();
+                    nodeData.put("value", map.get("value"));
+
+                    String nodeType = map.get("bgColor").toString();
+                    if (nodeType.equals("RGB(0,176,80)")) {
+                        //璐ф灦
+                        nodeData.put("type", "shelf");
+                    }else if (nodeType.equals("RGB(255,192,0)")) {
+                        //鍫嗗灈鏈�
+                        nodeData.put("type", "crn");
+                    }else if (nodeType.equals("RGB(0,112,192)")) {
+                        //杈撻�佺嚎
+                        nodeData.put("type", "devp");
+                        nodeData.put("value", (int) Double.parseDouble(map.get("value").toString()));
+                    }else if (nodeType.equals("RGB(0,176,240)")) {
+                        //RGV
+                        nodeData.put("type", "rgv");
+                    } else if (nodeType.equals("none")) {
+                        //绌虹櫧鍖哄煙
+                        nodeData.put("type", "none");
+                    } else if (nodeType.equals("merge")) {
+                        //鍚堝苟鍖哄煙
+                        nodeData.put("type", "merge");
+                    }
+
+                    nodeData.put("cellWidth", map.get("cellWidth"));
+                    nodeData.put("cellHeight", map.get("cellHeight"));
+                    nodeData.put("rowSpan", map.get("rowSpan"));
+                    nodeData.put("colSpan", map.get("colSpan"));
+
+                    arrayList.add(nodeData);
+                }
+                dataList.add(arrayList);
+            }
+        }
+
+
+        return R.ok().add(JSON.toJSONString(dataList));
+    }
+
 }

--
Gitblit v1.9.1