From 58dc66a9d999c7d350e1ee4bf32b8d85b6e20e00 Mon Sep 17 00:00:00 2001
From: ZY <zc857179121@qq.com>
Date: 星期六, 21 九月 2024 10:32:42 +0800
Subject: [PATCH] 逻辑调整

---
 src/main/java/com/zy/asrs/task/kingdee/handler/LoginAuthenticationHandler.java |   74 +++++++++++++++++++++---------------
 1 files changed, 43 insertions(+), 31 deletions(-)

diff --git a/src/main/java/com/zy/asrs/task/kingdee/handler/LoginAuthenticationHandler.java b/src/main/java/com/zy/asrs/task/kingdee/handler/LoginAuthenticationHandler.java
index ab9982b..3530b48 100644
--- a/src/main/java/com/zy/asrs/task/kingdee/handler/LoginAuthenticationHandler.java
+++ b/src/main/java/com/zy/asrs/task/kingdee/handler/LoginAuthenticationHandler.java
@@ -5,11 +5,13 @@
 import com.alibaba.fastjson.JSONObject;
 import com.core.common.Cools;
 import com.core.exception.CoolException;
-import com.zy.asrs.entity.kingdee.*;
+import com.zy.asrs.entity.Order;
 import com.zy.asrs.service.ApiLogService;
 import com.zy.asrs.task.AbstractHandler;
 import com.zy.asrs.task.core.ReturnT;
 import com.zy.common.utils.HttpHandler;
+import com.zy.erp.kingdee.entity.param.LoginParam;
+import com.zy.erp.kingdee.enums.KingDeeUtilType;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -79,54 +81,64 @@
             if (Cools.isEmpty(jsonObject.getString("Message"))) {
                 success = true;
             } else {
+                callApiLogSaveLog(JSON.toJSONString(loginParam),false);
                 log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", URL+loginaddress, JSON.toJSONString(loginParam), response);
-                throw new CoolException("鐧诲綍閲戣澏澶辫触");
+//                throw new CoolException("鐧诲綍閲戣澏澶辫触");
             }
         } catch (Exception e) {
             log.error("fail", e);
+            callApiLogSaveLog(JSON.toJSONString(loginParam),false);
+            log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", URL+loginaddress, JSON.toJSONString(loginParam), response);
 //            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return FAIL.setMsg(e.getMessage());
         } finally {
-            try {
-                // 淇濆瓨鎺ュ彛鏃ュ織
-                apiLogService.save(
-                        "鐧诲綍閲戣澏",
-                        URL + loginaddress,
-                        null,
-                        "127.0.0.1",
-                        JSON.toJSONString(loginParam),
-                        response,
-                        success
-                );
-            } catch (Exception e) { log.error("", e); }
+//            try {
+//                // 淇濆瓨鎺ュ彛鏃ュ織
+//                apiLogService.save(
+//                        "鐧诲綍閲戣澏",
+//                        URL + loginaddress,
+//                        null,
+//                        "127.0.0.1",
+//                        JSON.toJSONString(loginParam),
+//                        response,
+//                        success
+//                );
+//            } catch (Exception e) { log.error("", e); }
         }
         return SUCCESS.setContent(cookie);
     }
 
 
-        public static Object findValueByKey(JSONObject json, String key) {
-            Set<String> keySet = json.keySet();
-            for (String k : keySet) {
-                Object v = json.get(k);
-                if (k.equals(key)) {
-                    return v;
-                } else if (v instanceof JSONArray) {
-                    int size = ((JSONArray) v).size();
-                    for (int i = 0; i <= size - 1; i++) {
-                        Object result = findValueByKey((JSONObject) ((JSONArray) v).get(i), key);
-                        if (result != null){
-                            return result;
-                        }
-                    }
-                } else if (v instanceof JSONObject){
-                    Object result = findValueByKey((JSONObject) v, key);
+    public static Object findValueByKey(JSONObject json, String key) {
+        Set<String> keySet = json.keySet();
+        for (String k : keySet) {
+            Object v = json.get(k);
+            if (k.equals(key)) {
+                return v;
+            } else if (v instanceof JSONArray) {
+                int size = ((JSONArray) v).size();
+                for (int i = 0; i <= size - 1; i++) {
+                    Object result = findValueByKey((JSONObject) ((JSONArray) v).get(i), key);
                     if (result != null){
                         return result;
                     }
                 }
+            } else if (v instanceof JSONObject){
+                Object result = findValueByKey((JSONObject) v, key);
+                if (result != null){
+                    return result;
+                }
             }
-            return null;
         }
+        return null;
+    }
+
+    public void callApiLogSaveLog(String response, Boolean bool) {
+        apiLogService.save("鐧诲綍閲戣澏澶辫触", URL, "null", loginaddress,
+                "濂楄处ID锛�"+acctID+"銆佽处鍙凤細"+username+"銆佸瘑鐮侊細"+password,
+                response, bool);
+    }
+
 
 }
 

--
Gitblit v1.9.1