From b0ea50dd24a7ed5ada38dc6c8209f78fc09f0441 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 21 六月 2024 17:45:33 +0800
Subject: [PATCH] 修复bug

---
 server/dmvisit_service/src/main/java/com/doumee/core/erp/ErpTool.java |   42 +++++++++++++++++++-----------------------
 1 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/server/dmvisit_service/src/main/java/com/doumee/core/erp/ErpTool.java b/server/dmvisit_service/src/main/java/com/doumee/core/erp/ErpTool.java
index 17067e0..1d6699c 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/core/erp/ErpTool.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/core/erp/ErpTool.java
@@ -35,27 +35,23 @@
 @Service
 public class ErpTool {
 
-    @Autowired
-    private InterfaceLogService interfaceLogService;
-    @Autowired
-    private SqlSessionFactory sqlSessionFactory;
+    public static  InterfaceLogService interfaceLogService;
     public void saveInterfaceLog(Object param, String path,String result,Integer type) {
-        SqlSession sqlSession2 = sqlSessionFactory.openSession(true);
-        InterfaceLogMapper mapper2 = sqlSession2.getMapper(InterfaceLogMapper.class);
-
-        InterfaceLog interfaceLog=new InterfaceLog();
-        interfaceLog.setType(type);
-        interfaceLog.setCreateDate(new Date());
-        interfaceLog.setIsdeleted(Constants.ZERO);
-        if(param!=null){
-            interfaceLog.setRequest(JSONObject.toJSONString(param));
+        if(interfaceLogService !=null) {
+            InterfaceLog interfaceLog = new InterfaceLog();
+            interfaceLog.setType(type);
+            interfaceLog.setCreateDate(new Date());
+            interfaceLog.setIsdeleted(Constants.ZERO);
+            if (param != null) {
+                interfaceLog.setRequest(JSONObject.toJSONString(param));
+            }
+            interfaceLog.setPlat(Constants.ONE);
+            interfaceLog.setRepose(result);
+            interfaceLog.setName(path);
+            interfaceLog.setUrl(path);
+            interfaceLogService.create(interfaceLog);
         }
-        interfaceLog.setPlat(Constants.ONE);
-        interfaceLog.setRepose(result);
-        interfaceLog.setName(path);
-        interfaceLog.setUrl(path);
-        mapper2.insert(interfaceLog);
-        sqlSession2.commit();
+
     }
 
 
@@ -94,7 +90,7 @@
                 }
             }
         }catch (Exception e){
-            throw e;
+            e.printStackTrace();
         }finally {
             saveInterfaceLog(param,url,JSONArray.toJSONString(list),Constants.ZERO);
         }
@@ -135,7 +131,7 @@
                 }
             }
         }catch (Exception e){
-            throw e;
+            e.printStackTrace();
         }finally {
             saveInterfaceLog(param,url, JSONArray.toJSONString(list),Constants.ZERO);
         }
@@ -166,7 +162,7 @@
                 }
             }
         }catch (Exception e){
-            throw e;
+            e.printStackTrace();
         }finally {
            saveInterfaceLog(param,url,JSONObject.toJSONString(result),Constants.ZERO);
         }
@@ -191,7 +187,7 @@
                 }
             }
         }catch (Exception e){
-            throw e;
+            e.printStackTrace();
         }finally {
             saveInterfaceLog(param,url,JSONObject.toJSONString(result),Constants.ZERO);
         }

--
Gitblit v1.9.3