Bläddra i källkod

新增数据库过滤不是当前表字段名的数据

andy 1 år sedan
förälder
incheckning
f8bf4e07f8
1 ändrade filer med 16 tillägg och 3 borttagningar
  1. 16 3
      src/main/java/com/scbfkj/uni/service/DataProcessService.java

+ 16 - 3
src/main/java/com/scbfkj/uni/service/DataProcessService.java

@@ -270,7 +270,17 @@ public class DataProcessService {
                     throw new RuntimeException(message);
                 }
             }
-            Object data = ((Map<?, ?>) resource.get(resource.size() - 1).get("result")).get("returnData");
+            Object data = null;
+            if (!resource.isEmpty()) {
+                data = resource.get(resource.size() - 1);
+
+                if (Objects.nonNull(data)) {
+                    data = ((Map<?, ?>) data).get("result");
+                }
+                if (Objects.nonNull(data)) {
+                    data = ((Map<?, ?>) data).get("returnData");
+                }
+            }
             return UniReturnUtil.success(data);
         } catch (Exception e) {
             message = e.getMessage();
@@ -281,7 +291,8 @@ public class DataProcessService {
         } finally {
 
 //                    不管成功还是失败都记录日志
-            if (Config.isDebug() || Objects.nonNull(serviceInfo) && Objects.equals("1", serviceInfo.get("enablelog"))) {
+            Object enablelog = serviceInfo.get("enablelog");
+            if (Config.isDebug() || Objects.nonNull(serviceInfo) && Objects.equals("1", Objects.nonNull(enablelog) ? enablelog.toString() : null)) {
                 String finalMessage = message;
                 LocalDateTime finalStartDateTime = startDateTime;
                 String finalServiceId = serviceId;
@@ -298,7 +309,9 @@ public class DataProcessService {
                     logData.put("endtime", dateTime);
                     logData.put("serviceid", finalServiceId);
                     String string = DataFormatUtil.toString(resource);
-                    System.out.println("resources:" + string);
+                    if (Config.isDebug()) {
+                        System.out.println("resources:" + string);
+                    }
                     logData.put("inputdata", string);
                     logData.put("prepesource", DataFormatUtil.toString(preResource));
                     logData.put("returnmessage", finalMessage);