Browse Source

Merge branch 'master' of http://git.sagacloud.cn/IBMS/ibms-sdk

menglu 3 years ago
parent
commit
4d6e016b05

+ 6 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestApi.java

@@ -128,4 +128,10 @@ public class RestApi {
 		String result = RestUtil.path_array_history_fjd_query(param);
 		String result = RestUtil.path_array_history_fjd_query(param);
 		return result;
 		return result;
 	}
 	}
+
+	@PostMapping(path = { "/getEquipStaticInfo", "/zkt-sdk/getEquipStaticInfo" }, produces = "application/json;charset=UTF-8")
+	public String getEquipStaticInfo(@RequestBody String param){
+		String result = RestUtil.getEquipStaticInfo(param).toJSONString();
+		return result;
+	}
 }
 }

File diff suppressed because it is too large
+ 748 - 740
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestUtil.java


+ 44 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ExeclReadEquipStaticInfoUtil.java

@@ -0,0 +1,44 @@
+package com.persagy.ibms.data.sdk.util;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import java.io.File;
+import java.util.*;
+
+public class ExeclReadEquipStaticInfoUtil {
+
+    public static JSONObject ReadEquipStaticInfo(String firstName, String sheetName) throws Exception {
+        String filepath=Constant.GetPath() + Constant.getSeperator() + firstName+".xlsx";
+        Workbook workbook = WorkbookFactory.create(new File(filepath));
+        Sheet sheet = workbook.getSheet(sheetName);
+        JSONObject object=new JSONObject(new LinkedHashMap());
+        for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
+            //获取合并单元格的值
+            CellRangeAddress ca = sheet.getMergedRegion(i);
+            int firstRow = ca.getFirstRow();
+            Row fRow = sheet.getRow(firstRow);
+            Cell fCell = fRow.getCell(0);
+            String caVal= getCellValue(fCell) ;
+            //获取合并单元格之后的值,形成树形结构
+            List dic = new JSONArray();
+            for (int j=firstRow;j<= ca.getLastRow();j++)
+            {
+                Row row=sheet.getRow(j);
+                JSONObject obj = new JSONObject();
+                obj.put("name", getCellValue(row.getCell(1)));
+                obj.put("code", getCellValue(row.getCell(2)));
+                obj.put("enable", row.getCell(3).getBooleanCellValue());
+                dic.add(obj);
+            }
+            object.put(caVal,dic);
+        }
+        return object;
+    }
+
+    public static String getCellValue(Cell cell){
+        if(cell == null) return "";
+        return cell.getStringCellValue();
+    }
+}

BIN
ibms-data-sdk/src/main/resources/冷源台账.xlsx


BIN
ibms-data-sdk/src/main/resources/末端台账.xlsx


BIN
ibms-data-sdk/src/main/resources/电梯台账.xlsx


BIN
ibms-data-sdk/src/main/resources/给排水台账.xlsx


BIN
ibms-data-sdk/src/main/resources/配电台账.xlsx