Browse Source

保存取值修改

wangming 1 year ago
parent
commit
6088b8d349

+ 43 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxProjectManageServiceImpl.java

@@ -965,7 +965,11 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
             }
 
             //显示值
-            String m1 = v.getString("m");
+            String m1 = getCellValueByV(v);
+
+            if(ObjectUtil.isEmpty(m1)) {
+                continue;
+            }
 
             //列下标
             String colIndex = cellData.getString("c");
@@ -1001,6 +1005,44 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
         return rows;
     }
 
+    /**
+     * 获取单元值
+     *
+     * @param v
+     * @return
+     */
+    private String getCellValueByV(JSONObject v) {
+
+        /* 处理以下数据结构
+             {
+                "celldata": [{
+                    "c": 0,
+                    "r": 8,
+                    "v": {
+                        "ct": {
+                            "s": [{
+                                "v": "sdsdgdf\r\ndfgdfg\r\ndsfgdfgdf\r\ndsfgdfg"
+                            }],
+                            "t": "inlineStr",
+                            "fa": "General"
+                        }
+                    }
+                }]
+            }
+             */
+        if(!v.containsKey("v") && v.containsKey("ct")) {
+            JSONObject ct = v.getJSONObject("ct");
+            JSONArray s = ct.getJSONArray("s");
+
+            if(ObjectUtil.isNotNull(s)) {
+                JSONObject s0 = s.getJSONObject(0);
+                return s0.getString("v");
+            }
+        }
+
+        return v.getString("m");
+    }
+
     /**
      * 保存数据封装
      *