From 9443a6b751ad1cbb9efce8c116b6fb8dae7a56b3 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 05 十月 2023 14:26:47 +0800
Subject: [PATCH] 添加对象序列化

---
 src/main/java/com/smartearth/poiexcel/config/InitConfig.java |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/smartearth/poiexcel/config/InitConfig.java b/src/main/java/com/smartearth/poiexcel/config/InitConfig.java
index 6917ff4..1dc8ce4 100644
--- a/src/main/java/com/smartearth/poiexcel/config/InitConfig.java
+++ b/src/main/java/com/smartearth/poiexcel/config/InitConfig.java
@@ -1,5 +1,9 @@
 package com.smartearth.poiexcel.config;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.smartearth.poiexcel.entity.Result;
+import com.smartearth.poiexcel.entity.TokenResult;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.boot.ApplicationArguments;
@@ -18,9 +22,20 @@
     public void run(ApplicationArguments args) {
         // noinspection AlibabaRemoveCommentedCode
         try {
+            test();
+
             log.info("***************** 绯荤粺鍚姩瀹屾瘯 *****************" + "\n");
         } catch (Exception ex) {
             log.error(ex.getMessage(), ex);
         }
     }
+
+    private void test() {
+        String json = "{\"success\":true,\"code\":200,\"message\":\"鎴愬姛\",\"data\":{\"ctoken\":\"ZmYxZTgyN2QxZTYyNDMxMDhjZjgzNDNiNDZiN2RjMDVAYTc3ZmFlOGE5ZGM0OGQ1Y2ZmODY4ZTFmNWYwZTEzM2E=\",\"userInfo\":{\"loginLogId\":\"1ab1675c3632428a84dc0ebe579cd66f\",\"phoneNumber\":\"\",\"displayName\":\"鏃剁┖涓�寮犲浘\",\"userMail\":\"\",\"departLevel\":\"5-1\",\"id\":\"ff1e827d1e6243108cf8343b46b7dc05\",\"userID\":\"shikong001\",\"uniqueID\":\"\",\"departName\":\"姹借溅鍜屾櫤鑳藉埗閫犱骇涓氫笓鐝璡"},\"expires\":3600,\"roles\":[]}}";
+        Result rs = JSON.parseObject(json, Result.class);
+        // TokenResult tr = JSON.parseObject(rs.getData().toJSONString(), TokenResult.class)
+        TokenResult tr = JSONObject.parseObject(rs.getData(), TokenResult.class);
+
+        int len = json.length();
+    }
 }

--
Gitblit v1.9.3