6 Commits f3df549942 ... 9f42f68fa3

Author SHA1 Message Date
  andy 9f42f68fa3 update 1 year ago
  andy 28b96594a8 update 1 year ago
  andy dd55d0f75e update 1 year ago
  andy 6d4dd2e44f update 1 year ago
  andy dfbc7f8ed0 update 1 year ago
  andy 159433c432 update 1 year ago
37 changed files with 2138 additions and 450 deletions
  1. 1 0
      license
  2. 35 0
      src/main/java/com/scbfkj/uni/api/FileApi.java
  3. 7 13
      src/main/java/com/scbfkj/uni/api/GenericApi.java
  4. 29 8
      src/main/java/com/scbfkj/uni/api/LogAop.java
  5. 16 2
      src/main/java/com/scbfkj/uni/api/WebSocketServer.java
  6. 1 1
      src/main/java/com/scbfkj/uni/config/CorsConfig.java
  7. 0 105
      src/main/java/com/scbfkj/uni/dtos/Expression.java
  8. 87 19
      src/main/java/com/scbfkj/uni/library/DataFormatUtil.java
  9. 11 2
      src/main/java/com/scbfkj/uni/library/FileUtil.java
  10. 10 0
      src/main/java/com/scbfkj/uni/library/script/JavaScriptEngineUtil.java
  11. 66 31
      src/main/java/com/scbfkj/uni/library/script/JsScriptEngineUtil.java
  12. 79 77
      src/main/java/com/scbfkj/uni/process/DataBase.java
  13. 8 5
      src/main/java/com/scbfkj/uni/process/Http.java
  14. 39 38
      src/main/java/com/scbfkj/uni/process/IBMMQ.java
  15. 12 17
      src/main/java/com/scbfkj/uni/process/JMS.java
  16. 4 0
      src/main/java/com/scbfkj/uni/process/Kafka.java
  17. 12 13
      src/main/java/com/scbfkj/uni/process/RabbitMQ.java
  18. 3 17
      src/main/java/com/scbfkj/uni/service/DataProcessService.java
  19. 16 15
      src/main/java/com/scbfkj/uni/service/LoggerService.java
  20. 78 5
      src/main/java/com/scbfkj/uni/service/SecurityService.java
  21. 0 1
      src/main/java/com/scbfkj/uni/system/Config.java
  22. 444 0
      src/main/java/com/scbfkj/uni/system/ProcessUtil.java
  23. 1 2
      src/main/java/com/scbfkj/uni/system/ScheduleTask.java
  24. 11 0
      src/main/java/com/scbfkj/uni/system/ScheduleUtil.java
  25. 155 56
      src/main/java/com/scbfkj/uni/system/SystemInit.java
  26. 43 6
      src/main/java/com/scbfkj/uni/utils/Util.java
  27. 1 1
      src/main/resources/application-dev.yml
  28. 7 1
      src/main/resources/application.yml
  29. 28 0
      src/main/resources/sql/mysql/systemset/V0.0__drop_table.sql
  30. 195 0
      src/main/resources/sql/mysql/systemset/V1.0__create_table.sql
  31. 28 0
      src/main/resources/sql/mysql/uniauth/V0.0__drop_table.sql
  32. 236 0
      src/main/resources/sql/mysql/uniauth/V1.0__create_table.sql
  33. 6 0
      src/main/resources/sql/mysql/uniauth/v1.1__init_data.sql
  34. 57 0
      src/main/resources/sql/sqlite/V0.0__drop_table.sql
  35. 388 0
      src/main/resources/sql/sqlite/V1.0__create_table.sql
  36. 6 0
      src/main/resources/sql/sqlite/v1.1__init_data.sql
  37. 18 15
      src/test/java/com/scbfkj/uni/library/JsonPathTest.java

+ 1 - 0
license

@@ -0,0 +1 @@
+DAeCLMulHH/CISfb8yIT5Y/WPvQjcE12NqTnWXngN2k6BIlHWgMoVjwX1KzZ/cqV/aQ9yykOfNJvpiwlRXuOvhIlCTiUFalkXcdAUOgCi5HIiG56mGxi2gtsklYEZiiQSRKOEZbju01KBgwdiOWmI979teHmnJZOxKM6YKSyIH42XEzlMp9ecEuxS0gYVgcLq0XHKQpemreWasUBRGJgfxNum51HeQdufPYF1REwCS2fq0UE4Xhf+cMFYK1LOugP8hfB+mgguUG9tnOC1GIMqNB0SoZZTzOsOLeLss4wKWMRJgxX2LqTTpe2KduR9mG/tKwLR34Yfiiictye6kjnPQ==

+ 35 - 0
src/main/java/com/scbfkj/uni/api/FileApi.java

@@ -0,0 +1,35 @@
+package com.scbfkj.uni.api;
+
+import com.scbfkj.uni.library.FileUtil;
+import com.scbfkj.uni.library.UniReturnUtil;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+@RestController
+@RequestMapping("/file")
+public class FileApi {
+
+    private static final Set<String> CONTENT_TYPES = Set.of("application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+
+    @PostMapping("/upload")
+    public ResponseEntity<Map<String, Object>> uploadFiles(@RequestParam("file") MultipartFile file) throws IOException {
+        // 处理多个文件上传逻辑
+        if (CONTENT_TYPES.contains(file.getContentType())) {
+            Map<String, List<List<String>>> excelToMap = FileUtil.readExcelToMap(file.getInputStream());
+
+            return ResponseEntity.ok(UniReturnUtil.success("Files uploaded successfully"));
+        }else{
+        return ResponseEntity.ok(UniReturnUtil.fail("Please upload an Excel file"));
+
+        }
+    }
+}

+ 7 - 13
src/main/java/com/scbfkj/uni/api/GenericApi.java

@@ -1,29 +1,23 @@
 package com.scbfkj.uni.api;
 package com.scbfkj.uni.api;
 
 
-import com.scbfkj.uni.library.DataFormatUtil;
 import com.scbfkj.uni.library.RequestUtil;
 import com.scbfkj.uni.library.RequestUtil;
 import com.scbfkj.uni.process.DataBase;
 import com.scbfkj.uni.process.DataBase;
-import com.scbfkj.uni.service.DataProcessService;
 import com.scbfkj.uni.system.Config;
 import com.scbfkj.uni.system.Config;
+import com.scbfkj.uni.system.ProcessUtil;
 import org.springframework.http.HttpStatusCode;
 import org.springframework.http.HttpStatusCode;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.ResponseEntity;
-import org.springframework.messaging.handler.annotation.MessageMapping;
-import org.springframework.messaging.handler.annotation.SendTo;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 @RestController
 @RestController
-@RequestMapping("openApi")
+@RequestMapping
 public class GenericApi {
 public class GenericApi {
 
 
     private static final DataBase DATA_BASE = new DataBase();
     private static final DataBase DATA_BASE = new DataBase();
 
 
-    @PostMapping({"newdata", "modifydata", "movedata", "query"})
+    @PostMapping({"/openApi/newdata", "/openApi/modifydata", "/openApi/movedata", "/openApi/query"})
     public ResponseEntity<Map<String, Object>> base(@RequestBody Map<String, Object> body) {
     public ResponseEntity<Map<String, Object>> base(@RequestBody Map<String, Object> body) {
         String uri = RequestUtil.getUri();
         String uri = RequestUtil.getUri();
         String event = "0";
         String event = "0";
@@ -40,7 +34,7 @@ public class GenericApi {
         body.put("event", event);
         body.put("event", event);
         body.put("headers", RequestUtil.getHeaders());
         body.put("headers", RequestUtil.getHeaders());
 
 
-        Map<String, Object> process = new DataProcessService().process(body);
+        Map<String, Object> process = new ProcessUtil().process(body);
         return ResponseEntity.ok(process);
         return ResponseEntity.ok(process);
     }
     }
 
 
@@ -52,7 +46,7 @@ public class GenericApi {
      * @throws Exception
      * @throws Exception
      */
      */
 
 
-    @PostMapping("*")
+    @PostMapping("/**")
     public ResponseEntity<Map<String, Object>> matchService(@RequestBody Map<String, Object> body) throws Exception {
     public ResponseEntity<Map<String, Object>> matchService(@RequestBody Map<String, Object> body) throws Exception {
         String uri = RequestUtil.getUri();
         String uri = RequestUtil.getUri();
         List<Map<String, Object>> serviceinfoList = DATA_BASE.query(Config.getCenterConnectionStr(), """
         List<Map<String, Object>> serviceinfoList = DATA_BASE.query(Config.getCenterConnectionStr(), """
@@ -64,7 +58,7 @@ public class GenericApi {
         }
         }
         Object serviceid = serviceinfoList.get(0).get("serviceid");
         Object serviceid = serviceinfoList.get(0).get("serviceid");
         body.put("serviceid", serviceid);
         body.put("serviceid", serviceid);
-        return ResponseEntity.ok(new DataProcessService().process(body));
+        return ResponseEntity.ok(new ProcessUtil().process(body));
     }
     }
 
 
 }
 }

+ 29 - 8
src/main/java/com/scbfkj/uni/api/LogAop.java

@@ -30,7 +30,7 @@ public class LogAop {
     private Util util;
     private Util util;
 
 
     @Around(value = "within(com.scbfkj.uni.api.*Api)")
     @Around(value = "within(com.scbfkj.uni.api.*Api)")
-    public ResponseEntity<Map<String, Object>> invokeAround(ProceedingJoinPoint joinPoint) {
+    public ResponseEntity<Object> invokeAround(ProceedingJoinPoint joinPoint) {
         LocalDateTime requestTime = LocalDateTime.now();
         LocalDateTime requestTime = LocalDateTime.now();
 //        请求
 //        请求
         String uri = RequestUtil.getUri();
         String uri = RequestUtil.getUri();
@@ -56,14 +56,21 @@ public class LogAop {
         try {
         try {
             Map body = null;
             Map body = null;
 
 
-//            判断服务状态是否为健康状态 runstate!=0
-            if (args.length > 0) {
+//            判断服务状态是否为健康状态 runstate!=0 只判断openApi接口
+            if (args.length > 0 && (!uri.startsWith("/controlApi")&&!uri.startsWith("/file")&&!uri.startsWith("/user")&&!uri.startsWith("/foxlibc")&&!uri.startsWith("/ws"))) {
                 Object arg = args[0];
                 Object arg = args[0];
                 if (arg instanceof Map map) {
                 if (arg instanceof Map map) {
 //                    查找serviceid
 //                    查找serviceid
                     body = map;
                     body = map;
+                    Util.addFilter(body, serviceid, uri, true);
                     serviceid = DataAliasGetUtil.getValue("serviceid", map);
                     serviceid = DataAliasGetUtil.getValue("serviceid", map);
-                    if (serviceid.isPresent() && uri.startsWith("/openApi")) {
+                    if (serviceid.isEmpty()) {
+                        List<Map<String, Object>> query = DATA_BASE.query(Config.getCenterConnectionStr(), "select * from serviceinfo where urilist=?", uri);
+                        if (!query.isEmpty()) {
+                            serviceid = DataAliasGetUtil.getValue("serviceid", query.get(0));
+                        }
+                    }
+                    if (serviceid.isPresent()) {
 //                        查找状态
 //                        查找状态
                         List<Map<String, Object>> mapList = DATA_BASE.query(Config.getCenterConnectionStr(), """
                         List<Map<String, Object>> mapList = DATA_BASE.query(Config.getCenterConnectionStr(), """
                                 select runstate from servicestate where stoptime is null and  serviceid=? and containercode = ?""", serviceid.get(), Config.getContainerCode());
                                 select runstate from servicestate where stoptime is null and  serviceid=? and containercode = ?""", serviceid.get(), Config.getContainerCode());
@@ -87,16 +94,30 @@ public class LogAop {
                 return ResponseEntity.ok(UniReturnUtil.fail(message));
                 return ResponseEntity.ok(UniReturnUtil.fail(message));
             }
             }
 
 
-            util.addFilter(body, serviceid,uri,true);
 
 
             ResponseEntity<Map<String, Object>> responseEntity = (ResponseEntity<Map<String, Object>>) joinPoint.proceed(args);
             ResponseEntity<Map<String, Object>> responseEntity = (ResponseEntity<Map<String, Object>>) joinPoint.proceed(args);
-            if (!responseEntity.getStatusCode().is2xxSuccessful()) {
+            Map<String, Object> responseEntityBody = responseEntity.getBody();
+            if (responseEntity.getStatusCode().is2xxSuccessful()) {
                 if (Config.isDebug()) {
                 if (Config.isDebug()) {
                     System.out.println("返回值:" + DataFormatUtil.toString(returnData));
                     System.out.println("返回值:" + DataFormatUtil.toString(returnData));
                 }
                 }
-                return responseEntity;
+                if ("0".equals(responseEntityBody.get("code")) && serviceid.isPresent()) {
+                    List<Map<String, Object>> serviceInfoes = DATA_BASE.query(Config.getCenterConnectionStr(), "select * from serviceinfo where serviceid=?", serviceid.get());
+                    if (!serviceInfoes.isEmpty()) {
+                        Map<String, Object> serviceInfo = serviceInfoes.get(0);
+                        Object raw = serviceInfo.get("raw");
+                        if (raw != null && raw.toString().equalsIgnoreCase("1")) {
+                            Object data = responseEntityBody.getOrDefault("returnData", responseEntityBody);
+                            if (data instanceof List<?> d && d.size() == 1) {
+                                data = d.get(0);
+                            }
+                            return ResponseEntity.ok(data);
+                        }
+                    }
+                }
+                return ResponseEntity.ok(responseEntityBody);
             } else {
             } else {
-                returnData = responseEntity.getBody();
+                returnData = responseEntityBody;
             }
             }
 
 
         } catch (Throwable e) {
         } catch (Throwable e) {

+ 16 - 2
src/main/java/com/scbfkj/uni/api/WebSocketServer.java

@@ -2,13 +2,14 @@ package com.scbfkj.uni.api;
 
 
 import com.scbfkj.uni.library.DataFormatUtil;
 import com.scbfkj.uni.library.DataFormatUtil;
 import com.scbfkj.uni.library.UniReturnUtil;
 import com.scbfkj.uni.library.UniReturnUtil;
-import com.scbfkj.uni.service.DataProcessService;
+import com.scbfkj.uni.system.ProcessUtil;
 import jakarta.websocket.*;
 import jakarta.websocket.*;
 import jakarta.websocket.server.ServerEndpoint;
 import jakarta.websocket.server.ServerEndpoint;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.io.IOException;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Map;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 
@@ -37,6 +38,13 @@ public class WebSocketServer {
         sessions.add(session);
         sessions.add(session);
         // 建立连接
         // 建立连接
         this.session = session;
         this.session = session;
+
+        HashSet<Session> sessions1 = new HashSet<>(sessions);
+        for (Session session1 : sessions1) {
+            if (!session1.isOpen()) {
+                sessions.remove(session1);
+            }
+        }
     }
     }
 
 
     /**
     /**
@@ -55,6 +63,12 @@ public class WebSocketServer {
     @OnClose
     @OnClose
     public void onClose() {
     public void onClose() {
         sessions.remove(session);
         sessions.remove(session);
+        HashSet<Session> sessions1 = new HashSet<>(sessions);
+        for (Session session1 : sessions1) {
+            if (!session1.isOpen()) {
+                sessions.remove(session1);
+            }
+        }
     }
     }
 
 
     /**
     /**
@@ -70,7 +84,7 @@ public class WebSocketServer {
             Map<?, ?> body = DataFormatUtil.toMap(message);
             Map<?, ?> body = DataFormatUtil.toMap(message);
             try {
             try {
 
 
-                result = new DataProcessService().process((Map<String, Object>) body);
+                result = new ProcessUtil().process((Map<String, Object>) body);
             } catch (Exception e) {
             } catch (Exception e) {
                 result = UniReturnUtil.fail(e);
                 result = UniReturnUtil.fail(e);
             }
             }

+ 1 - 1
src/main/java/com/scbfkj/uni/config/CorsConfig.java

@@ -11,7 +11,7 @@ public class CorsConfig implements WebMvcConfigurer {
         registry.addMapping("/**") // 所有接口
         registry.addMapping("/**") // 所有接口
                 .allowCredentials(true) // 是否发送 Cookie
                 .allowCredentials(true) // 是否发送 Cookie
                 .allowedOriginPatterns("*") // 支持域
                 .allowedOriginPatterns("*") // 支持域
-                .allowedMethods("GET", "POST", "PUT", "DELETE") // 支持方法
+                .allowedMethods("GET", "POST") // 支持方法
                 .allowedHeaders("*")
                 .allowedHeaders("*")
                 .exposedHeaders("*");
                 .exposedHeaders("*");
     }
     }

+ 0 - 105
src/main/java/com/scbfkj/uni/dtos/Expression.java

@@ -1,105 +0,0 @@
-package com.scbfkj.uni.dtos;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import java.util.Objects;
-import java.util.UUID;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class Expression {
-
-    private String valuekey;
-    private String expression;
-    private String opt;
-
-    private Object comparevalue;
-    private Object returnvalue;
-    private Object elsevalue;
-    private Long algorithmlibraryid;
-
-    public Long getAlgorithmlibraryid() {
-        return algorithmlibraryid;
-    }
-
-    public void setAlgorithmlibraryid(Long algorithmlibraryid) {
-        this.algorithmlibraryid = algorithmlibraryid;
-    }
-
-    public String getExpression() {
-        return expression;
-    }
-
-    public void setExpression(String expression) {
-        this.expression = expression;
-    }
-
-    public String getOpt() {
-        return opt;
-    }
-
-    public void setOpt(String opt) {
-        this.opt = opt;
-    }
-
-    public Object getComparevalue() {
-        return comparevalue;
-    }
-
-    public void setComparevalue(Object comparevalue) {
-        this.comparevalue = comparevalue;
-    }
-
-    public Object getReturnvalue() {
-        return returnvalue;
-    }
-
-    public void setReturnvalue(Object returnvalue) {
-        this.returnvalue = returnvalue;
-    }
-
-    public Object getElsevalue() {
-        return elsevalue;
-    }
-
-    public void setElsevalue(Object elsevalue) {
-        this.elsevalue = elsevalue;
-    }
-
-    public String getValuekey() {
-        return valuekey;
-    }
-
-    public void setValuekey(String valuekey) {
-        this.valuekey = valuekey;
-    }
-
-    public String toScript() {
-        String randKey = (Objects.isNull(valuekey) || valuekey.trim().isEmpty()) ? ("a" + UUID.randomUUID().toString().replaceAll("-", "")) : valuekey;
-        if (Objects.nonNull(expression) && Objects.nonNull(opt) && (Objects.nonNull(returnvalue) || Objects.nonNull(elsevalue))) {
-            return """
-                    var %s = ( %s %s %s ) ? %s : %s;
-                    %s;
-                    """.formatted(randKey, expression, opt, Objects.isNull(comparevalue) ? "null" : comparevalue, Objects.isNull(returnvalue) ? "null" : returnvalue, Objects.isNull(elsevalue) ? "null" : elsevalue, randKey);
-        } else if (Objects.nonNull(expression) && Objects.isNull(opt) && (Objects.nonNull(returnvalue) || Objects.nonNull(elsevalue))) {
-            return """
-                    var %s = ( %s ) ? %s : %s;
-                    %s;
-                    """.formatted(randKey, expression, Objects.isNull(returnvalue) ? "null" : returnvalue, Objects.isNull(elsevalue) ? "null" : elsevalue, randKey);
-
-        } else if (Objects.isNull(opt) && Objects.nonNull(expression)) {
-            return """
-                    var %s = %s;
-                    """.formatted(randKey, expression);
-        } else if (Objects.isNull(opt) && Objects.nonNull(returnvalue)) {
-            return """
-                    var %s = %s;
-                    """.formatted(randKey, returnvalue);
-        } else {
-            return """
-                    var %s = null;
-                    %s;
-                    """.formatted(randKey, randKey);
-
-        }
-    }
-}

+ 87 - 19
src/main/java/com/scbfkj/uni/library/DataFormatUtil.java

@@ -5,7 +5,9 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.LongNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.databind.node.TextNode;
 import com.fasterxml.jackson.dataformat.xml.XmlMapper;
 import com.fasterxml.jackson.dataformat.xml.XmlMapper;
 import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
 import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
 import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
@@ -57,6 +59,12 @@ public final class DataFormatUtil {
         if (source instanceof String || source instanceof Number) {
         if (source instanceof String || source instanceof Number) {
             return source.toString();
             return source.toString();
         }
         }
+        if (source instanceof TextNode jsonNode) {
+            return jsonNode.asText();
+        }
+        if (source instanceof JsonNode jsonNode) {
+            return jsonNode.toString();
+        }
         if (source instanceof LocalDate result) {
         if (source instanceof LocalDate result) {
             return result.format(dateTimeFormatter);
             return result.format(dateTimeFormatter);
         }
         }
@@ -78,8 +86,8 @@ public final class DataFormatUtil {
         } else if (dateObj instanceof Date date) {
         } else if (dateObj instanceof Date date) {
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:dd:ss");
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:dd:ss");
             String formatDate = simpleDateFormat.format(date);
             String formatDate = simpleDateFormat.format(date);
-            return LocalDate.parse(formatDate.replace(" ","T"));
-        }  else {
+            return LocalDate.parse(formatDate.replace(" ", "T"));
+        } else {
             return null;
             return null;
         }
         }
     }
     }
@@ -92,7 +100,7 @@ public final class DataFormatUtil {
         } else if (dateTimeObj instanceof Date date) {
         } else if (dateTimeObj instanceof Date date) {
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:dd:ss");
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:dd:ss");
             String formatDate = simpleDateFormat.format(date);
             String formatDate = simpleDateFormat.format(date);
-            return LocalDateTime.parse(formatDate.replace(" ","T"));
+            return LocalDateTime.parse(formatDate.replace(" ", "T"));
         } else {
         } else {
             return null;
             return null;
         }
         }
@@ -110,14 +118,19 @@ public final class DataFormatUtil {
         if (Objects.isNull(value)) {
         if (Objects.isNull(value)) {
             return null;
             return null;
         }
         }
-        ArrayList<Object> result = new ArrayList<>();
         if (value instanceof Iterable<?> iterable) {
         if (value instanceof Iterable<?> iterable) {
+            ArrayList<Object> result = new ArrayList<>();
             iterable.forEach(result::add);
             iterable.forEach(result::add);
             return result;
             return result;
         }
         }
         if (value.getClass().isArray()) {
         if (value.getClass().isArray()) {
-            result.addAll(Arrays.asList(((Object[]) value)));
-            return result;
+            return Arrays.stream(((Object[]) value)).map(it -> {
+                if (it instanceof JsonNode) {
+                    return it.toString();
+                } else {
+                    return it;
+                }
+            }).toList();
         }
         }
         if (value instanceof String) {
         if (value instanceof String) {
             try {
             try {
@@ -133,6 +146,9 @@ public final class DataFormatUtil {
         if (Objects.isNull(value)) {
         if (Objects.isNull(value)) {
             return null;
             return null;
         }
         }
+        if (value.getClass().isArray()) {
+            return (Object[]) value;
+        }
         return Objects.requireNonNull(toList(value)).toArray();
         return Objects.requireNonNull(toList(value)).toArray();
     }
     }
 
 
@@ -143,20 +159,19 @@ public final class DataFormatUtil {
         if (value instanceof Map<?, ?> map) {
         if (value instanceof Map<?, ?> map) {
             return map;
             return map;
         }
         }
-        if (value instanceof String str) {
+        String str = DataFormatUtil.toString(value);
+        try {
+            return DataFormatUtil.stringToMap(str);
+        } catch (JsonProcessingException ignored) {
             try {
             try {
-                return DataFormatUtil.stringToMap(str);
-            } catch (JsonProcessingException ignored) {
+                return stringToMap(str);
+            } catch (JsonProcessingException e) {
                 try {
                 try {
-                    return stringToMap(str);
-                } catch (JsonProcessingException e) {
-                    try {
-                        HashMap<Object, Object> data = new HashMap<>();
-                        data.put("root", toJsonNode(str));
-                        return data;
-                    } catch (JsonProcessingException ex) {
+                    HashMap<Object, Object> data = new HashMap<>();
+                    data.put("root", toJsonNode(str));
+                    return data;
+                } catch (JsonProcessingException ex) {
 
 
-                    }
                 }
                 }
             }
             }
         }
         }
@@ -265,11 +280,64 @@ public final class DataFormatUtil {
     }
     }
 
 
     public static boolean isJson(String data) {
     public static boolean isJson(String data) {
-        try{
+        try {
             JsonNode jsonNode = getObjectMapper().readTree(data);
             JsonNode jsonNode = getObjectMapper().readTree(data);
             return true;
             return true;
-        }catch (Exception e){
+        } catch (Exception e) {
             return false;
             return false;
         }
         }
     }
     }
+
+    public static <T> T castType(Object node, Class<T> parameterType) {
+
+        if (node == null) {
+            return null;
+        }
+        String type = parameterType.getSimpleName();
+        Object result = null;
+        if ("String".equalsIgnoreCase(type)) {
+            if (node instanceof JsonNode jsonNode) {
+                result = jsonNode.asText();
+            } else {
+                result = node.toString();
+            }
+        } else if ("List".equalsIgnoreCase(type) || "Collection".equalsIgnoreCase(type)) {
+            result = DataFormatUtil.toList(node);
+        } else if ("Array".equalsIgnoreCase(type)) {
+            result = DataFormatUtil.toArray(node);
+        } else if ("Map".equalsIgnoreCase(type)) {
+            result = DataFormatUtil.toMap(node);
+        } else if ("Long".equalsIgnoreCase(type)) {
+            if (node instanceof JsonNode jsonNode) {
+                result = jsonNode.asLong();
+            } else {
+                result = Long.valueOf(node.toString());
+            }
+        } else if ("Integer".equalsIgnoreCase(type)) {
+            if (node instanceof JsonNode jsonNode) {
+                result = jsonNode.asInt();
+            } else {
+                result = Integer.valueOf(node.toString());
+            }
+        } else if ("Double".equalsIgnoreCase(type)) {
+            if (node instanceof JsonNode jsonNode) {
+                result = jsonNode.doubleValue();
+            } else {
+                result = Double.valueOf(node.toString());
+            }
+        } else if ("Float".equalsIgnoreCase(type)) {
+            if (node instanceof JsonNode jsonNode) {
+                result = jsonNode.floatValue();
+            } else {
+                result = Float.valueOf(node.toString());
+            }
+        } else if ("Boolean".equalsIgnoreCase(type)) {
+            if (node instanceof JsonNode jsonNode) {
+                result = jsonNode.asBoolean();
+            } else {
+                result = Boolean.valueOf(node.toString());
+            }
+        }
+        return (T) result;
+    }
 }
 }

+ 11 - 2
src/main/java/com/scbfkj/uni/library/FileUtil.java

@@ -5,6 +5,7 @@ import org.apache.poi.ss.usermodel.*;
 import java.io.File;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
@@ -12,11 +13,19 @@ import java.util.Map;
 
 
 public class FileUtil {
 public class FileUtil {
 
 
+
     public static Map<String, List<List<String>>> readExcelToMap(File file) throws IOException {
     public static Map<String, List<List<String>>> readExcelToMap(File file) throws IOException {
+
+        try (FileInputStream fis = new FileInputStream(file)) {
+            return readExcelToMap(fis);
+        }
+    }
+
+    public static Map<String, List<List<String>>> readExcelToMap(InputStream fis) throws IOException {
         Map<String, List<List<String>>> dataMap = new HashMap<>();
         Map<String, List<List<String>>> dataMap = new HashMap<>();
 
 
-        try (FileInputStream fis = new FileInputStream(file);
-             Workbook workbook = WorkbookFactory.create(fis)) {
+        try (
+                Workbook workbook = WorkbookFactory.create(fis)) {
             for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
             for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
                 Sheet sheet = workbook.getSheetAt(i);
                 Sheet sheet = workbook.getSheetAt(i);
 
 

+ 10 - 0
src/main/java/com/scbfkj/uni/library/script/JavaScriptEngineUtil.java

@@ -138,7 +138,17 @@ public class JavaScriptEngineUtil {
         }
         }
 
 
         public Object invokeApply(Object... args) throws InvocationTargetException, IllegalAccessException {
         public Object invokeApply(Object... args) throws InvocationTargetException, IllegalAccessException {
+            Class<?>[] parameterTypes = apply.getParameterTypes();
+            for (int i = 0; i < parameterTypes.length; i++) {
+                Object arg = args[i];
+                if (!parameterTypes[i].isInstance(arg)) {
+                    if (arg != null) {
+                        args[i] = DataFormatUtil.castType(arg, parameterTypes[i]);
+                    }
+                }
+            }
             return apply.invoke(instance, args);
             return apply.invoke(instance, args);
+
         }
         }
     }
     }
 }
 }

+ 66 - 31
src/main/java/com/scbfkj/uni/library/script/JsScriptEngineUtil.java

@@ -3,19 +3,11 @@ package com.scbfkj.uni.library.script;
 import com.scbfkj.uni.library.DataFormatUtil;
 import com.scbfkj.uni.library.DataFormatUtil;
 import com.scbfkj.uni.library.UniReturnUtil;
 import com.scbfkj.uni.library.UniReturnUtil;
 import com.scbfkj.uni.system.Config;
 import com.scbfkj.uni.system.Config;
-import org.apache.commons.pool2.BaseKeyedPooledObjectFactory;
-import org.apache.commons.pool2.KeyedObjectPool;
-import org.apache.commons.pool2.PooledObject;
-import org.apache.commons.pool2.impl.DefaultPooledObject;
-import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
-import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig;
 import org.graalvm.polyglot.Context;
 import org.graalvm.polyglot.Context;
 import org.graalvm.polyglot.Source;
 import org.graalvm.polyglot.Source;
 import org.graalvm.polyglot.Value;
 import org.graalvm.polyglot.Value;
 
 
-import java.util.List;
 import java.util.Map;
 import java.util.Map;
-import java.util.Objects;
 
 
 public final class JsScriptEngineUtil {
 public final class JsScriptEngineUtil {
 
 
@@ -31,45 +23,51 @@ public final class JsScriptEngineUtil {
             args =JSON.parse(paramsArgsObject)
             args =JSON.parse(paramsArgsObject)
             }
             }
             """;
             """;
-    private static final KeyedObjectPool<String, Source> sourcePool = new GenericKeyedObjectPool<>(new BaseKeyedPooledObjectFactory<>() {
-        @Override
-        public Source create(String script) {
-            return Source.create("js", script);
-        }
-
-        @Override
-        public PooledObject<Source> wrap(Source value) {
-            return new DefaultPooledObject<>(value);
-        }
-
-        @Override
-        public void destroyObject(String key, PooledObject<Source> p) throws Exception {
-            super.destroyObject(key, p);
-        }
-    }, new GenericKeyedObjectPoolConfig<>());
-
 
 
+    /**
+     * 执行脚本并返回执行结果。
+     *
+     * @param script 要执行的脚本代码。
+     * @param args   脚本执行时传递的参数。
+     * @return 执行结果,是一个包含执行结果的Map对象。
+     * @throws Exception 如果执行过程中发生异常,则抛出Exception。
+     */
     public static Map<String, Object> eval(String script, Object args) throws Exception {
     public static Map<String, Object> eval(String script, Object args) throws Exception {
 
 
         try {
         try {
+            // 尝试执行脚本并返回结果
             return UniReturnUtil.success(exec(script, args));
             return UniReturnUtil.success(exec(script, args));
         } catch (Exception e) {
         } catch (Exception e) {
+            // 当处于调试模式时,输出脚本和参数信息以及异常栈跟踪
             if (Config.isDebug()) {
             if (Config.isDebug()) {
+                System.out.println(script + "\n" + DataFormatUtil.toString(args));
                 e.printStackTrace();
                 e.printStackTrace();
             }
             }
+            // 重新抛出捕获到的异常
             throw e;
             throw e;
         }
         }
     }
     }
 
 
+    /**
+     * 执行指定的JavaScript脚本并返回执行结果。
+     *
+     * @param script 要执行的JavaScript脚本代码。
+     * @param args   传递给脚本的参数,可以是任意类型。
+     * @return 执行脚本后的结果,类型为Object,具体返回值取决于脚本的执行结果。
+     * @throws Exception 如果执行过程中发生错误,则抛出Exception。
+     */
     public static Object exec(String script, Object args) throws Exception {
     public static Object exec(String script, Object args) throws Exception {
 
 
-        String sc = ARGS + script;
-
-        Source source = Source.create("js", sc);
+        Source source = Source.create("js", script);
         try (Context context = Context.create("js")) {
         try (Context context = Context.create("js")) {
             Value bindings = context.getBindings("js");
             Value bindings = context.getBindings("js");
             bindings.putMember("paramsArgsObject", DataFormatUtil.toString(args));
             bindings.putMember("paramsArgsObject", DataFormatUtil.toString(args));
+
+            context.eval("js", ARGS);
+            // 执行源代码并获取结果
             Value function = context.eval(source);
             Value function = context.eval(source);
+
+            // 判断结果是否可执行,若可执行则执行并返回结果,否则直接返回结果对象
             if (function.canExecute()) {
             if (function.canExecute()) {
                 Value result = function.execute();
                 Value result = function.execute();
                 return toHostObject(result);
                 return toHostObject(result);
@@ -79,20 +77,57 @@ public final class JsScriptEngineUtil {
         }
         }
     }
     }
 
 
-    public static Object toHostObject(Value result) throws Exception {
 
 
+    /**
+     * 将 Value 对象转换为宿主对象。
+     *
+     * @param result Value对象,表示待转换的数据。
+     * @return 返回转换后的宿主对象。如果result是字符串,则返回对应的字符串对象;否则,将result转换为JSON节点对象。
+     * @throws Exception 如果转换过程中发生错误,则抛出异常。
+     */
+    private static Object toHostObject(Value result) throws Exception {
+        if (result.isNull()) {
+            return null;
+        }
+        if (result.isBoolean()) {
+            return (Boolean) result.asBoolean();
+        }
+        if (result.fitsInLong()) {
+            return (Long) result.asLong();
+        }
+        if (result.fitsInDouble()) {
+            return (Double) result.asDouble();
+        }
+        if (result.isDate()) {
+            return result.asDate();
+        }
+        if (result.isHostObject()) {
+            return result.asHostObject();
+        }
         if (result.isString()) {
         if (result.isString()) {
             return result.asString();
             return result.asString();
         }
         }
-        String string = toString(result);
+
+        // 将result转换为字符串,并进一步转换为JSON节点对象
+        String string = jsToString(result);
         return DataFormatUtil.toJsonNode(string);
         return DataFormatUtil.toJsonNode(string);
     }
     }
 
 
-    private static String toString(Value value) throws Exception {
+    /**
+     * 将JavaScript类型的值转换为字符串。
+     *
+     * @param value 需要转换的JavaScript值。
+     * @return 转换后的字符串。
+     * @throws Exception 如果执行JavaScript脚本或转换过程中发生错误,则抛出异常。
+     */
+    private static String jsToString(Value value) throws Exception {
+        // 创建一个包含转换逻辑的JavaScript源码
         Source source = Source.create("js", TO_STRING_SCRIPT);
         Source source = Source.create("js", TO_STRING_SCRIPT);
         try (Context context = Context.create("js")) {
         try (Context context = Context.create("js")) {
+            // 在JavaScript环境中评估该源码,得到一个函数
             Value function = context.eval(source);
             Value function = context.eval(source);
 
 
+            // 使用该函数执行给定的JavaScript值,并将结果转换为字符串
             return function.execute(value).asString();
             return function.execute(value).asString();
         }
         }
     }
     }

+ 79 - 77
src/main/java/com/scbfkj/uni/process/DataBase.java

@@ -22,59 +22,60 @@ public class DataBase {
 
 
 //        缓存数据 connectionStr + sql
 //        缓存数据 connectionStr + sql
 
 
-        String key = "%s;%s;%s".formatted(connectionStr, sql, DataFormatUtil.toString(argsList));
-        String effectivedurationColumnName = "effectiveduration";
-        if (cacheDatas.containsKey(key)) {
-            Map<String, Object> cacheData = cacheDatas.get(key);
-
-            Object effectiveduration = cacheData.get(effectivedurationColumnName);
-            if (Objects.isNull(effectiveduration) || ((LocalDateTime) effectiveduration).isBefore(LocalDateTime.now())) {
-                cacheDatas.remove(key);
-            } else {
-                return ((List<Map<String, Object>>) cacheData.get("data"));
-            }
-        }
-
-        HikariPool dataSourcePool = getDataSourcePool(connectionStr);
-        List<Map<String, Object>> result = argsList.parallelStream().flatMap(args -> {
-            Connection connection = null;
-            try {
-                synchronized (dataSourcePool) {
-                    connection = dataSourcePool.getConnection();
+            String key = "%s;%s;%s".formatted(connectionStr, sql, DataFormatUtil.toString(argsList));
+            String effectivedurationColumnName = "effectiveduration";
+            if (cacheDatas.containsKey(key)) {
+                Map<String, Object> cacheData = cacheDatas.get(key);
+
+                Object effectiveduration = cacheData.get(effectivedurationColumnName);
+                if (Objects.isNull(effectiveduration) || ((LocalDateTime) effectiveduration).isBefore(LocalDateTime.now())) {
+                    cacheDatas.remove(key);
+                } else {
+                    return ((List<Map<String, Object>>) cacheData.get("data"));
                 }
                 }
-            } catch (SQLException e) {
-                throw new RuntimeException("数据库连接异常: %s\n sql: %s ;\n args: %s ".formatted(e.getMessage(), sql, DataFormatUtil.toString(args)));
             }
             }
-            try (
-                    PreparedStatement preparedStatement = connection.prepareStatement(sql)
-            ) {
-                for (int i = 0; i < args.length; i++) {
-                    preparedStatement.setObject(i + 1, args[i]);
-                }
-                ResultSet resultSet = preparedStatement.executeQuery();
-                return getResult(connectionStr, sql, resultSet).stream();
-            } catch (Exception exception) {
-                throw new RuntimeException("数据异常: %s\n sql: %s ;\n args: %s ".formatted(exception.getMessage(), sql, DataFormatUtil.toString(args)));
-            } finally {
+
+            HikariPool dataSourcePool = getDataSourcePool(connectionStr);
+            List<Map<String, Object>> result = argsList.parallelStream().flatMap(args -> {
+                Connection connection = null;
                 try {
                 try {
-                    connection.close();
+                    synchronized (dataSourcePool) {
+                        connection = dataSourcePool.getConnection();
+                    }
                 } catch (SQLException e) {
                 } catch (SQLException e) {
-                    if (Config.isDebug()) {
-                        e.printStackTrace();
+                    throw new RuntimeException("数据库连接异常: %s\n sql: %s ;\n args: %s ".formatted(e.getMessage(), sql, DataFormatUtil.toString(args)));
+                }
+                try (
+                        PreparedStatement preparedStatement = connection.prepareStatement(sql)
+                ) {
+                    for (int i = 0; i < args.length; i++) {
+                        preparedStatement.setObject(i + 1, args[i]);
+                    }
+                    ResultSet resultSet = preparedStatement.executeQuery();
+                    return getResult(connectionStr, sql, resultSet).stream();
+                } catch (Exception exception) {
+                    throw new RuntimeException("数据异常: %s\n sql: %s ;\n args: %s ".formatted(exception.getMessage(), sql, DataFormatUtil.toString(args)));
+                } finally {
+                    try {
+                        connection.close();
+                    } catch (SQLException e) {
+                        if (Config.isDebug()) {
+                            e.printStackTrace();
+                        }
                     }
                     }
                 }
                 }
+            }).toList();
+            String querySql = """
+                    select
+                        datacacheid, connectset, querysql, querytable, effectiveduration, datacachedescribe
+                    from datacache""";
+            if (!Objects.equals(querySql, sql)) {
+                cacheConfigList = query(Config.getCenterConnectionStr(), querySql);
             }
             }
-        }).toList();
-        String querySql = """
-                select
-                    datacacheid, connectset, querysql, querytable, effectiveduration, datacachedescribe
-                from datacache""";
-        if (!Objects.equals(querySql, sql)) {
-            cacheConfigList = query(Config.getCenterConnectionStr(), querySql);
-        }
-        List<Map<String, Object>> finalResult = result;
-        saveCacheData(connectionStr, sql, key, effectivedurationColumnName, finalResult);
-        return result;
+            List<Map<String, Object>> finalResult = result;
+            saveCacheData(connectionStr, sql, key, effectivedurationColumnName, finalResult);
+            return result;
+
     }
     }
 
 
     private void saveCacheData(String connectionStr, String sql, String key, String effectivedurationColumnName, List<Map<String, Object>> finalResult) {
     private void saveCacheData(String connectionStr, String sql, String key, String effectivedurationColumnName, List<Map<String, Object>> finalResult) {
@@ -92,43 +93,44 @@ public class DataBase {
 
 
 //        缓存数据 connectionStr + sql
 //        缓存数据 connectionStr + sql
 
 
-        String key = "%s;%s;%s".formatted(connectionStr, sql, DataFormatUtil.toString(args));
-        String effectivedurationColumnName = "effectiveduration";
-        if (cacheDatas.containsKey(key)) {
-            Map<String, Object> cacheData = cacheDatas.get(key);
+            String key = "%s;%s;%s".formatted(connectionStr, sql, DataFormatUtil.toString(args));
+            String effectivedurationColumnName = "effectiveduration";
+            if (cacheDatas.containsKey(key)) {
+                Map<String, Object> cacheData = cacheDatas.get(key);
+
+                Object effectiveduration = cacheData.get(effectivedurationColumnName);
+                if (Objects.isNull(effectiveduration) || ((LocalDateTime) effectiveduration).isBefore(LocalDateTime.now())) {
+                    cacheDatas.remove(key);
+                } else {
+                    return ((List<Map<String, Object>>) cacheData.get("data"));
+                }
 
 
-            Object effectiveduration = cacheData.get(effectivedurationColumnName);
-            if (Objects.isNull(effectiveduration) || ((LocalDateTime) effectiveduration).isBefore(LocalDateTime.now())) {
-                cacheDatas.remove(key);
-            } else {
-                return ((List<Map<String, Object>>) cacheData.get("data"));
             }
             }
 
 
-        }
+            HikariPool dataSourcePool = getDataSourcePool(connectionStr);
+            List<Map<String, Object>> result;
+            try (Connection connection = dataSourcePool.getConnection();
+                 PreparedStatement preparedStatement = connection.prepareStatement(sql)
+            ) {
+                for (int i = 0; i < args.length; i++) {
+                    preparedStatement.setObject(i + 1, args[i]);
+                }
+                ResultSet resultSet = preparedStatement.executeQuery();
+                result = getResult(connectionStr, sql, resultSet);
+            } catch (Exception exception) {
+                throw new RuntimeException("数据异常: %s\n sql: %s ;\n args: %s ".formatted(exception.getMessage(), sql, DataFormatUtil.toDate(args)));
+            }
 
 
-        HikariPool dataSourcePool = getDataSourcePool(connectionStr);
-        List<Map<String, Object>> result;
-        try (Connection connection = dataSourcePool.getConnection();
-             PreparedStatement preparedStatement = connection.prepareStatement(sql)
-        ) {
-            for (int i = 0; i < args.length; i++) {
-                preparedStatement.setObject(i + 1, args[i]);
+            String querySql = """
+                    select
+                        datacacheid, connectset, querysql, querytable, effectiveduration, datacachedescribe
+                    from datacache""";
+            if (!Objects.equals(querySql, sql)) {
+                cacheConfigList = query(Config.getCenterConnectionStr(), querySql);
             }
             }
-            ResultSet resultSet = preparedStatement.executeQuery();
-            result = getResult(connectionStr, sql, resultSet);
-        } catch (Exception exception) {
-            throw new RuntimeException("数据异常: %s\n sql: %s ;\n args: %s ".formatted(exception.getMessage(), sql, DataFormatUtil.toDate(args)));
-        }
+            saveCacheData(connectionStr, sql, key, effectivedurationColumnName, result);
+            return result;
 
 
-        String querySql = """
-                select
-                    datacacheid, connectset, querysql, querytable, effectiveduration, datacachedescribe
-                from datacache""";
-        if (!Objects.equals(querySql, sql)) {
-            cacheConfigList = query(Config.getCenterConnectionStr(), querySql);
-        }
-        saveCacheData(connectionStr, sql, key, effectivedurationColumnName, result);
-        return result;
     }
     }
 
 
     public int[] updateBatch(String connectionStr, String sql, List<Object[]> argsList) throws Exception {
     public int[] updateBatch(String connectionStr, String sql, List<Object[]> argsList) throws Exception {

+ 8 - 5
src/main/java/com/scbfkj/uni/process/Http.java

@@ -11,7 +11,6 @@ import org.apache.http.impl.client.HttpClients;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 import org.apache.http.util.EntityUtils;
 import org.apache.http.util.EntityUtils;
 
 
-import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
@@ -53,7 +52,7 @@ public class Http {
         return execWebApi(headers, method, defaultBody, host);
         return execWebApi(headers, method, defaultBody, host);
     }
     }
 
 
-    public Map<String, Object> execWebApi(Object headers, String method, Object defaultBody, String url) throws IOException {
+    public Map<String, Object> execWebApi(Object headers, String method, Object defaultBody, String url) {
 
 
         if (Config.isDebug()) {
         if (Config.isDebug()) {
             System.out.println("url: " + DataFormatUtil.toString(url));
             System.out.println("url: " + DataFormatUtil.toString(url));
@@ -90,14 +89,18 @@ public class Http {
 
 
         try {
         try {
             HttpResponse response = httpClient.execute(request);
             HttpResponse response = httpClient.execute(request);
+            String contentType = response.getEntity().getContentType().getValue();
             int statusCode = response.getStatusLine().getStatusCode();
             int statusCode = response.getStatusLine().getStatusCode();
-            String responseBody = EntityUtils.toString(response.getEntity());
+            if (contentType.equalsIgnoreCase("application/octet-stream")) {
+                return UniReturnUtil.success(EntityUtils.toByteArray(response.getEntity()));
+            }
+            Object responseBody = EntityUtils.toString(response.getEntity());
             if (statusCode >= 200 && statusCode < 300) {
             if (statusCode >= 200 && statusCode < 300) {
                 return UniReturnUtil.success(responseBody);
                 return UniReturnUtil.success(responseBody);
             } else {
             } else {
-                return UniReturnUtil.fail(responseBody);
+                return UniReturnUtil.fail(responseBody.toString());
             }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             return UniReturnUtil.fail(e);
             return UniReturnUtil.fail(e);
         }
         }
 
 

+ 39 - 38
src/main/java/com/scbfkj/uni/process/IBMMQ.java

@@ -4,6 +4,7 @@ package com.scbfkj.uni.process;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.ibm.mq.MQException;
 import com.ibm.mq.MQException;
 import com.ibm.mq.jakarta.jms.MQQueueConnectionFactory;
 import com.ibm.mq.jakarta.jms.MQQueueConnectionFactory;
+import com.scbfkj.uni.library.DataFormatUtil;
 import com.scbfkj.uni.system.Config;
 import com.scbfkj.uni.system.Config;
 import jakarta.jms.ConnectionFactory;
 import jakarta.jms.ConnectionFactory;
 import jakarta.jms.JMSException;
 import jakarta.jms.JMSException;
@@ -14,10 +15,7 @@ import org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapte
 import org.springframework.jms.core.JmsTemplate;
 import org.springframework.jms.core.JmsTemplate;
 
 
 import java.io.IOException;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 
 
 
 
 public class IBMMQ {
 public class IBMMQ {
@@ -27,27 +25,27 @@ public class IBMMQ {
 
 
     private final ObjectMapper mapper = new ObjectMapper();
     private final ObjectMapper mapper = new ObjectMapper();
 
 
-    public List<String> receptionMessageByDataSourceId( String dataSourceId, String channel, String queueManager, String queueName, Long ccsid, Long receiveTimeout, Long pollSize, Long retry) throws Exception {
-        Map<String,Object> config = queryConnectionStr(dataSourceId);
+    public List<String> receptionMessageByDataSourceId(String dataSourceId, String channel, String queueManager, String queueName, Long ccsid, Long receiveTimeout, Long pollSize, Long retry) throws Exception {
+        Map<String, Object> config = queryConnectionStr(dataSourceId);
 
 
         long port = 1414L;
         long port = 1414L;
         String host = Objects.toString(config.get("host"));
         String host = Objects.toString(config.get("host"));
-        if(host.contains(":")){
+        if (host.contains(":")) {
             String[] split = host.split(":");
             String[] split = host.split(":");
             port = Long.parseLong(split[1]);
             port = Long.parseLong(split[1]);
             host = split[0];
             host = split[0];
         }
         }
-        String username =null;
-        String password =null;
+        String username = null;
+        String password = null;
         Object username1 = config.get("username");
         Object username1 = config.get("username");
-        if(Objects.nonNull(username1)){
+        if (Objects.nonNull(username1)) {
             username = username1.toString();
             username = username1.toString();
         }
         }
         Object password1 = config.get("password");
         Object password1 = config.get("password");
-        if(Objects.nonNull(password1)){
+        if (Objects.nonNull(password1)) {
             password = password1.toString();
             password = password1.toString();
         }
         }
-        return receptionMessage(host,port,channel,queueManager,queueName,ccsid,username,password,receiveTimeout,pollSize,retry);
+        return receptionMessage(host, port, channel, queueManager, queueName, ccsid, username, password, receiveTimeout, pollSize, retry);
 
 
     }
     }
 
 
@@ -96,52 +94,57 @@ public class IBMMQ {
     }
     }
 
 
 
 
-    public void sendMessageByDataSourceId(
+    public void sendSingletonMessageByDataSourceId(
             String dataSourceId, String channel, String queueManager, String queueName, Long ccsid,
             String dataSourceId, String channel, String queueManager, String queueName, Long ccsid,
             Object data
             Object data
     ) throws Exception {
     ) throws Exception {
-        Map<String,Object> config = queryConnectionStr(dataSourceId);
+        sendMessageByDataSourceId(dataSourceId, channel, queueManager, queueName, ccsid, Collections.singletonList(data));
+    }
+
+    public void sendMessageByDataSourceId(
+            String dataSourceId, String channel, String queueManager, String queueName, Long ccsid,
+            List<Object> data
+    ) throws Exception {
+        Map<String, Object> config = queryConnectionStr(dataSourceId);
 
 
         long port = 1414L;
         long port = 1414L;
         String host = Objects.toString(config.get("host"));
         String host = Objects.toString(config.get("host"));
-        if(host.contains(":")){
+        if (host.contains(":")) {
             String[] split = host.split(":");
             String[] split = host.split(":");
             port = Long.parseLong(split[1]);
             port = Long.parseLong(split[1]);
             host = split[0];
             host = split[0];
         }
         }
-        String username =null;
-        String password =null;
+        String username = null;
+        String password = null;
         Object username1 = config.get("username");
         Object username1 = config.get("username");
-        if(Objects.nonNull(username1)){
+        if (Objects.nonNull(username1)) {
             username = username1.toString();
             username = username1.toString();
         }
         }
         Object password1 = config.get("password");
         Object password1 = config.get("password");
-        if(Objects.nonNull(password1)){
+        if (Objects.nonNull(password1)) {
             password = password1.toString();
             password = password1.toString();
         }
         }
-        sendMessage(host,port,channel,queueManager,queueName,ccsid,username,password,data);
+        sendMessage(host, port, channel, queueManager, queueName, ccsid, username, password, data);
     }
     }
-    public void sendMessage(
+
+    public void sendSingletonMessage(
             String host, Long port, String channel, String queueManager, String queueName, Long ccsid, String username, String password,
             String host, Long port, String channel, String queueManager, String queueName, Long ccsid, String username, String password,
             Object data
             Object data
     ) throws JMSException {
     ) throws JMSException {
+        sendMessage(host, port, channel, queueManager, queueName, ccsid, username, password, Collections.singletonList(data));
+    }
+
+    public void sendMessage(
+            String host, Long port, String channel, String queueManager, String queueName, Long ccsid, String username, String password,
+            List<Object> data
+    ) throws JMSException {
 
 
         JmsTemplate template = getJmsTemplate(host, port.intValue(), ccsid.intValue(), queueManager, channel, username, password);
         JmsTemplate template = getJmsTemplate(host, port.intValue(), ccsid.intValue(), queueManager, channel, username, password);
 
 
         try {
         try {
-            if (data instanceof Object[] datas) {
-                for (Object it : datas) {
-
-                    execSend(template, it, queueName);
-                }
-            } else if (data instanceof Iterable<?> datas) {
+            for (Object it : data) {
 
 
-                for (Object it : datas) {
-
-                    execSend(template, it, queueName);
-                }
-            } else {
-                execSend(template, data, queueName);
+                execSend(template, it, queueName);
             }
             }
 
 
         } catch (Exception e) {
         } catch (Exception e) {
@@ -160,9 +163,8 @@ public class IBMMQ {
             JmsTemplate template,
             JmsTemplate template,
             Object data,
             Object data,
             String queueName
             String queueName
-    ) throws IOException, MQException {
-        String message = mapper.writeValueAsString(data);
-
+    ) {
+        String message = DataFormatUtil.toString(data);
         template.send(queueName, session -> session.createTextMessage(message));
         template.send(queueName, session -> session.createTextMessage(message));
     }
     }
 
 
@@ -212,8 +214,7 @@ public class IBMMQ {
     }
     }
 
 
 
 
-
-    private static Map<String,Object> queryConnectionStr(String datasourceId) throws Exception {
+    private static Map<String, Object> queryConnectionStr(String datasourceId) throws Exception {
         List<Map<String, Object>> result = DATA_BASE.query(Config.getCenterConnectionStr(), """
         List<Map<String, Object>> result = DATA_BASE.query(Config.getCenterConnectionStr(), """
                 select host,
                 select host,
                 password,
                 password,

+ 12 - 17
src/main/java/com/scbfkj/uni/process/JMS.java

@@ -16,10 +16,7 @@ import java.lang.reflect.InvocationTargetException;
 import java.net.MalformedURLException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 
 
 public class JMS {
 public class JMS {
 
 
@@ -74,29 +71,27 @@ public class JMS {
     }
     }
 
 
 
 
+    public void sendSingletonMessage(String path, String className,
+                                     String queueName,
+                                     Object data, String... args
+    ) throws JMSException, MalformedURLException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
+        sendMessage(path, className, queueName, Collections.singletonList(data), args);
+    }
+
     public void sendMessage(String path, String className,
     public void sendMessage(String path, String className,
                             String queueName,
                             String queueName,
-                            Object data, String... args
+                            List<Object> data, String... args
     ) throws JMSException, MalformedURLException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
     ) throws JMSException, MalformedURLException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
 
 
         JmsTemplate template = getJmsTemplate(path, className, (Object[]) args);
         JmsTemplate template = getJmsTemplate(path, className, (Object[]) args);
 
 
         try {
         try {
-            if (data instanceof Object[] datas) {
-                for (Object it : datas) {
-
-                    execSend(template, it, queueName);
-                }
-            } else if (data instanceof Iterable<?> datas) {
-
-                for (Object it : datas) {
+            for (Object it : data) {
 
 
-                    execSend(template, it, queueName);
-                }
-            } else {
-                execSend(template, data, queueName);
+                execSend(template, it, queueName);
             }
             }
 
 
+
         } catch (Exception e) {
         } catch (Exception e) {
             if (Config.isDebug()) {
             if (Config.isDebug()) {
                 e.printStackTrace();
                 e.printStackTrace();

+ 4 - 0
src/main/java/com/scbfkj/uni/process/Kafka.java

@@ -41,6 +41,10 @@ public class Kafka {
         }
         }
     });
     });
 
 
+    public static Map<String, Object> sendSingletonMessage(String connection, String topic, Object datas) throws Exception {
+        return sendMessage(connection, topic, Collections.singletonList(datas));
+    }
+
     public static Map<String, Object> sendMessage(String connection, String topic, List<Object> datas) throws Exception {
     public static Map<String, Object> sendMessage(String connection, String topic, List<Object> datas) throws Exception {
 
 
         if (Objects.isNull(datas) || datas.isEmpty()) {
         if (Objects.isNull(datas) || datas.isEmpty()) {

+ 12 - 13
src/main/java/com/scbfkj/uni/process/RabbitMQ.java

@@ -11,6 +11,7 @@ import org.springframework.jms.core.JmsTemplate;
 
 
 import java.io.IOException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.List;
 
 
 public class RabbitMQ {
 public class RabbitMQ {
@@ -66,29 +67,27 @@ public class RabbitMQ {
     }
     }
 
 
 
 
-    public void sendMessage(
+    public void sendSingletonMessage(
             String host, Long port, String username, String password, String virtualHost, String queueName,
             String host, Long port, String username, String password, String virtualHost, String queueName,
             Object data
             Object data
     ) throws JMSException {
     ) throws JMSException {
+        sendMessage(host, port, username, password, virtualHost, queueName, Collections.singletonList(data));
+    }
+
+    public void sendMessage(
+            String host, Long port, String username, String password, String virtualHost, String queueName,
+            List<Object> data
+    ) throws JMSException {
 
 
         JmsTemplate template = getJmsTemplate(host, port.intValue(), username, password, virtualHost);
         JmsTemplate template = getJmsTemplate(host, port.intValue(), username, password, virtualHost);
 
 
         try {
         try {
-            if (data instanceof Object[] datas) {
-                for (Object it : datas) {
 
 
-                    execSend(template, it, queueName);
-                }
-            } else if (data instanceof Iterable<?> datas) {
-
-                for (Object it : datas) {
-
-                    execSend(template, it, queueName);
-                }
-            } else {
-                execSend(template, data, queueName);
+            for (Object datum : data) {
+                execSend(template, datum, queueName);
             }
             }
 
 
+
         } catch (Exception e) {
         } catch (Exception e) {
             if (Config.isDebug()) {
             if (Config.isDebug()) {
                 e.printStackTrace();
                 e.printStackTrace();

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

@@ -1,8 +1,6 @@
 package com.scbfkj.uni.service;
 package com.scbfkj.uni.service;
 
 
-import com.fasterxml.jackson.core.JsonProcessingException;
 import com.jayway.jsonpath.JsonPath;
 import com.jayway.jsonpath.JsonPath;
-import com.scbfkj.uni.dtos.Expression;
 import com.scbfkj.uni.library.DataAliasGetUtil;
 import com.scbfkj.uni.library.DataAliasGetUtil;
 import com.scbfkj.uni.library.DataFormatUtil;
 import com.scbfkj.uni.library.DataFormatUtil;
 import com.scbfkj.uni.library.UniReturnUtil;
 import com.scbfkj.uni.library.UniReturnUtil;
@@ -27,7 +25,7 @@ public class DataProcessService {
 // 创建一个固定大小的线程池,包含2个线程
 // 创建一个固定大小的线程池,包含2个线程
     private static final ExecutorService executor = Executors.newWorkStealingPool();
     private static final ExecutorService executor = Executors.newWorkStealingPool();
     private final DataBase DATA_BASE = new DataBase();
     private final DataBase DATA_BASE = new DataBase();
-    private final DatabaseScriptUtil DATABASE_SCRIPT_UTIL = new DatabaseScriptUtil();
+    private static final DatabaseScriptUtil DATABASE_SCRIPT_UTIL = new DatabaseScriptUtil();
 
 
     public Map<String, Object> process(Map<String, Object> inData) {
     public Map<String, Object> process(Map<String, Object> inData) {
         String lifecycleid = null;
         String lifecycleid = null;
@@ -112,22 +110,10 @@ public class DataProcessService {
                 data.put("algorithmlibraryid", algorithmlibraryid);
                 data.put("algorithmlibraryid", algorithmlibraryid);
                 source.put("args", resource);
                 source.put("args", resource);
                 source.put("algorithm", algorithmLibrary);
                 source.put("algorithm", algorithmLibrary);
-//                计算前置算法
-                List<Map<String, Object>> preScriptExpressions = DATA_BASE.query(Config.getCenterConnectionStr(), "select * from scriptexpression where algorithmlibraryid=?", algorithmlibraryid);
                 Map<String, Object> eval = null;
                 Map<String, Object> eval = null;
 
 
 
 
-                if (!preScriptExpressions.isEmpty()) {
-                    List<String> expressions = preScriptExpressions.stream().map(DataFormatUtil::toString).map(it -> {
-                        try {
-                            return DataFormatUtil.getObjectMapper().readValue(it, Expression.class);
-                        } catch (JsonProcessingException e) {
-                            throw new RuntimeException(e);
-                        }
-                    }).map(Expression::toScript).toList();
-                    String preExpression = String.join("\n", expressions);
-                    eval = JsScriptEngineUtil.eval(preExpression, resource);
-                } else if (Objects.nonNull(preConditions)) {
+                if (Objects.nonNull(preConditions)) {
                     eval = JsScriptEngineUtil.eval(preConditions.toString(), resource);
                     eval = JsScriptEngineUtil.eval(preConditions.toString(), resource);
                 }
                 }
 
 
@@ -358,7 +344,7 @@ public class DataProcessService {
      * @return 处理结果
      * @return 处理结果
      * @throws Exception
      * @throws Exception
      */
      */
-    public Map<String, Object> processByAlgorithm(Object type, List<Object> parameters) throws Exception {
+    public static Map<String, Object> processByAlgorithm(Object type, List<Object> parameters) throws Exception {
 
 
         switch (type.toString().toUpperCase()) {
         switch (type.toString().toUpperCase()) {
             // java反射
             // java反射

+ 16 - 15
src/main/java/com/scbfkj/uni/service/LoggerService.java

@@ -43,7 +43,7 @@ public class LoggerService {
                 if (!new File(filePath).exists()) {
                 if (!new File(filePath).exists()) {
                     try {
                     try {
                         DATA_BASE.exec(connectionStr, """
                         DATA_BASE.exec(connectionStr, """
-                                create table logs
+                                create table if not exists logs
                                 (
                                 (
                                     logid         Integer
                                     logid         Integer
                                         primary key autoincrement,
                                         primary key autoincrement,
@@ -60,25 +60,26 @@ public class LoggerService {
                 fileNames.add(filename);
                 fileNames.add(filename);
                 fileNames.removeIf(it -> it + 1000 < filename);
                 fileNames.removeIf(it -> it + 1000 < filename);
             }
             }
-        }
-        try {
-            List<Object[]> datas = new ArrayList<>();
-            List<Map<String, Object>> targets = DATA_BASE.query(Config.getCenterConnectionStr(), "select * from systeminfo where keyname=?", type.getName());
-            for (Map<String, Object> targetconnection : targets) {
-                datas.add(new Object[]{type.getName(), filePath, targetconnection.get("datasourceid"), targetconnection.get("expression"), DataFormatUtil.toString(data)});
-            }
-            DATA_BASE.updateBatch(connectionStr, "insert into logs (target,currentfile,datasourceid,expression,datacontent) values(?,?,?,?,?)", datas);
-        } catch (Exception e) {
-            if (Config.isDebug()) {
-                e.printStackTrace();
+            if (data != null && !data.isEmpty()) {
+                try {
+                    List<Object[]> datas = new ArrayList<>();
+                    List<Map<String, Object>> targets = DATA_BASE.query(Config.getCenterConnectionStr(), "select * from systeminfo where keyname=?", type.getName());
+                    for (Map<String, Object> targetconnection : targets) {
+                        datas.add(new Object[]{type.getName(), filePath, targetconnection.get("datasourceid"), targetconnection.get("expression"), DataFormatUtil.toString(data)});
+                    }
+                    DATA_BASE.updateBatch(connectionStr, "insert into logs (target,currentfile,datasourceid,expression,datacontent) values(?,?,?,?,?)", datas);
+                } catch (Exception e) {
+                    if (Config.isDebug()) {
+                        e.printStackTrace();
+                    }
+                }
             }
             }
         }
         }
     }
     }
 
 
     public static void sendMessage() {
     public static void sendMessage() {
+        log(LogType.SYSTEM, null);
 
 
-        long filename = System.currentTimeMillis() / Config.getSplitCount();
-        currentFileName = filename + ".sqlite";
 //        判断目录
 //        判断目录
 
 
         File file = new File(DIR);
         File file = new File(DIR);
@@ -169,7 +170,7 @@ public class LoggerService {
                                         put("datacontent", datacontentStream.map(DataFormatUtil::toMap).map(dataContent -> ((Map<String, Object>) dataContent)).toList());
                                         put("datacontent", datacontentStream.map(DataFormatUtil::toMap).map(dataContent -> ((Map<String, Object>) dataContent)).toList());
                                         put("event", "1");
                                         put("event", "1");
                                     }});
                                     }});
-                                    new DataProcessService().processByAlgorithm("3", parameters);
+                                    DataProcessService.processByAlgorithm("3", parameters);
                                 }
                                 }
                             }
                             }
 
 

+ 78 - 5
src/main/java/com/scbfkj/uni/service/SecurityService.java

@@ -173,10 +173,6 @@ public class SecurityService {
             } else if (codeRule.contains("L")) {
             } else if (codeRule.contains("L")) {
                 rule += "abcdefghgkmnpqrstuvwxyz";
                 rule += "abcdefghgkmnpqrstuvwxyz";
             }
             }
-//            字符 c
-            if (codeRule.contains("C")) {
-                rule += "~!@#%&-_;:";
-            }
 //            最后四位长度为最小长度和最大长度
 //            最后四位长度为最小长度和最大长度
             String minMax = codeRule.substring(codeRule.length() - 4);
             String minMax = codeRule.substring(codeRule.length() - 4);
 
 
@@ -579,9 +575,19 @@ public class SecurityService {
         if (!userpassword.equals(oldPassword)) {
         if (!userpassword.equals(oldPassword)) {
             return UniReturnUtil.fail("密码错误");
             return UniReturnUtil.fail("密码错误");
         } else {
         } else {
+            String newPassword = DataEncryptionUtil.decryptRSAByPrivateKey(passwordOpt.get());
+            Map<String, Object> application = RequestUtil.getApplication();
+            Object passwordrule = application.get("passwordrule");
+            if (passwordrule != null) {
+                try {
+                    checkPasswordRule(newPassword, passwordrule.toString());
+                } catch (Exception e) {
+                    return UniReturnUtil.fail(e.getMessage());
+                }
+            }
             String userId = RequestUtil.getUserId();
             String userId = RequestUtil.getUserId();
             String update = "update userinfo set userpassword=? where userid=?";
             String update = "update userinfo set userpassword=? where userid=?";
-            DATABASE.update(Config.getSecurityConnectionStr(), update, passwordOpt.get(), userId);
+            DATABASE.update(Config.getSecurityConnectionStr(), update, newPassword, userId);
             return UniReturnUtil.success("成功");
             return UniReturnUtil.success("成功");
         }
         }
     }
     }
@@ -626,4 +632,71 @@ public class SecurityService {
         return DATABASE.update(Config.getSecurityConnectionStr(), deleteSql, code, sessionId, appid, requestIp) > 0;
         return DATABASE.update(Config.getSecurityConnectionStr(), deleteSql, code, sessionId, appid, requestIp) > 0;
     }
     }
 
 
+
+/**
+ * 检查密码是否符合指定的规则。
+ *
+ * @param password 待检查的密码字符串。
+ * @param codeRule 规则代码,由不同的字母组成,每个字母代表一种规则:
+ *                 N - 密码必须包含数字
+ *                 W - 密码必须包含大写字母和小写字母
+ *                 U - 密码必须包含大写字母
+ *                 L - 密码必须包含小写字母
+ *                 C - 密码必须包含特殊字符
+ * @return 布尔值,如果密码符合所有指定的规则,则返回true;否则,方法可能抛出异常而不会返回。
+ * @throws RuntimeException 如果密码不满足某些特定规则或长度要求,则抛出此异常。
+ */
+public boolean checkPasswordRule(String password, String codeRule) {
+    // 检查密码是否包含指定的字符类型,以及密码长度是否符合规定
+    if (codeRule.contains("N")) {
+        checkRule("0123456789", password, "密码必须包含数字");
+    }
+    // 同时检查大写字母和小写字母
+    if (codeRule.contains("W")) {
+        checkRule("ABCDEFGHGKMNPQRSTUVWXYZ", password, "密码必须包含大写字母");
+        checkRule("abcdefghgkmnpqrstuvwxyz", password, "密码必须包含小写字母");
+    // 单独检查大写字母
+    } else if (codeRule.contains("U")) {
+        checkRule("ABCDEFGHGKMNPQRSTUVWXYZ", password, "密码必须包含大写字母");
+    // 单独检查小写字母
+    } else if (codeRule.contains("L")) {
+        checkRule("abcdefghgkmnpqrstuvwxyz", password, "密码必须包含小写字母");
+    }
+    // 检查密码是否包含特殊字符
+    if (codeRule.contains("C")) {
+        checkRule("~!@#%&-_;:", password, "密码必须包含特殊字符");
+    }
+    // 检查密码长度是否符合规则代码指定的最小长度和最大长度
+    int minLength = Integer.parseInt(codeRule.substring(codeRule.length() - 4, codeRule.length() - 2));
+    int maxLength = Integer.parseInt(codeRule.substring(codeRule.length() - 2));
+    if (password.length() < minLength || password.length() > maxLength) {
+        throw new RuntimeException("密码长度不符合要求");
+    }
+    return true;
+}
+
+
+    /**
+     * 检查密码是否符合指定规则。
+     *
+     * @param ruleStr 规则字符串,包含需要在密码中出现的字符。
+     * @param password 待检查的密码。
+     * @param message 如果密码不符合规则时抛出异常所携带的信息。
+     * @throws RuntimeException 如果密码不包含规则字符串中的任何字符。
+     */
+    private static void checkRule(String ruleStr, String password, String message) {
+        boolean rule = false; // 默认规则不满足
+        for (char c : ruleStr.toCharArray()) {
+            // 检查密码是否包含规则字符串中的字符
+            if (password.contains(c + "")) {
+                rule = true; // 密码中包含规则字符,设置规则满足
+                break;
+            }
+        }
+        // 如果密码不包含规则字符串中的任何字符,则抛出异常
+        if (!rule) {
+            throw new RuntimeException(message);
+        }
+    }
+
 }
 }

+ 0 - 1
src/main/java/com/scbfkj/uni/system/Config.java

@@ -7,7 +7,6 @@ import java.util.Map;
 
 
 
 
 public class Config {
 public class Config {
-    public static final List<String> sessions = new ArrayList<>();
     public static final Map<String, Map<String, Object>> cache = new Hashtable<>();
     public static final Map<String, Map<String, Object>> cache = new Hashtable<>();
     public static List<Map<String, Object>> targets = new ArrayList<>();
     public static List<Map<String, Object>> targets = new ArrayList<>();
     private static String centerConnectionStr;
     private static String centerConnectionStr;

+ 444 - 0
src/main/java/com/scbfkj/uni/system/ProcessUtil.java

@@ -0,0 +1,444 @@
+package com.scbfkj.uni.system;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.NullNode;
+import com.scbfkj.uni.library.DataAliasGetUtil;
+import com.scbfkj.uni.library.DataFormatUtil;
+import com.scbfkj.uni.library.UniReturnUtil;
+import com.scbfkj.uni.library.script.JavaScriptEngineUtil;
+import com.scbfkj.uni.library.script.JsScriptEngineUtil;
+import com.scbfkj.uni.process.DataBase;
+import com.scbfkj.uni.service.LoggerService;
+
+import java.io.File;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+public class ProcessUtil {
+
+    //    添加一个线程池
+// 创建一个固定大小的线程池,包含2个线程
+    private static final ExecutorService executor = Executors.newWorkStealingPool();
+    private final DataBase DATA_BASE = new DataBase();
+
+
+    public Map<String, Object> process(Map<String, Object> inData) {
+        String lifecycleid = null;
+        List<Map<String, Object>> resource = new ArrayList<>();
+//        List<Map<String, Object>> tempResult = new ArrayList<>();
+        List<Map<String, Object>> preResource = new ArrayList<>();
+//        tempResult.add(inData);
+        inData.put("index", 0);
+        resource.add(inData);
+        String serviceId = null;
+        LocalDateTime startDateTime = LocalDateTime.now();
+        Optional<String> serviceIdOpt;
+        String message = null;
+        Object algorithmlibraryid;
+
+        Map<String, Object> serviceInfo = null;
+
+        try {
+            serviceIdOpt = DataAliasGetUtil.getValue("serviceid", inData);
+            if (serviceIdOpt.isEmpty()) {
+                throw new RuntimeException("服务编号不能为空");
+            }
+            serviceId = serviceIdOpt.get();
+
+//        熔断
+//            查询服务运行状态
+            List<Map<String, Object>> serviceState = DATA_BASE.query(Config.getCenterConnectionStr(), """
+                    select  runstate
+                    from servicestate
+                    where serviceid =? and runstate = '1' and containercode=? order by servicestateid desc""", serviceId, Config.getContainerCode());
+            if (serviceState.isEmpty() || serviceState.get(0).get("runstate").equals("0")) {
+                throw new RuntimeException("服务没有运行");
+            }
+            List<Map<String, Object>> serviceInfoList = DATA_BASE.query(Config.getCenterConnectionStr(), """
+                    select * from serviceinfo where serviceid = ?""", serviceId);
+            if (!serviceInfoList.isEmpty()) {
+                serviceInfo = serviceInfoList.get(0);
+            }
+            Optional<String> lifecycleidOpt = DataAliasGetUtil.getValue("lifecycleid", inData);
+
+            if (lifecycleidOpt.isEmpty()) {
+                lifecycleid = DataAliasGetUtil.createLifeCycleCol(Config.getContainerCode(), serviceId);
+                inData.put("lifecycleid", lifecycleid);
+            } else {
+                lifecycleid = lifecycleidOpt.get();
+            }
+//            HashMap<String, Object> source = new HashMap<>();
+
+            Map<String, Integer> algorithmLibrariesOrders = new HashMap<>();
+
+            List<Map<String, Object>> algorithmLibraries = DATA_BASE.query(Config.getCenterConnectionStr(), """
+                    select *
+                    from algorithmlibrary
+                    where serviceid = ? order by executionorder""", serviceId);
+            for (int i = 0; i < algorithmLibraries.size(); i++) {
+                Map<String, Object> algorithmLibrary = algorithmLibraries.get(i);
+                String id = algorithmLibrary.get("algorithmlibraryid").toString();
+                algorithmLibrariesOrders.put(id, i + 1);
+            }
+
+            List<AlgorithmLibraryGroup> groups = algorithmLibraries.stream().map(it -> {
+                Object groupNameObj = it.get("groupname");
+                if (Objects.isNull(groupNameObj)) {
+                    groupNameObj = "N" + it.get("algorithmlibraryid");
+                }
+                Object loopcountObj = it.get("loopcount");
+                if (Objects.isNull(loopcountObj)) {
+                    loopcountObj = 1;
+                }
+                int count = Integer.parseInt(loopcountObj.toString());
+                return new AlgorithmLibraryGroup(groupNameObj.toString(), count);
+            }).distinct().toList();
+
+
+            String preCode = "0";
+            for (AlgorithmLibraryGroup group : groups) {
+                List<Map<String, Object>> list = algorithmLibraries.stream().filter(it -> {
+                    Object groupNameObj = it.get("groupname");
+                    if (Objects.isNull(groupNameObj)) {
+                        groupNameObj = "N" + it.get("algorithmlibraryid");
+                    }
+                    return groupNameObj.toString().equalsIgnoreCase(group.groupName);
+                }).toList();
+
+                for (int g = 0; g < group.count; g++) {
+                    for (Map<String, Object> algorithmLibrary : list) {
+                        preCode = "0";
+                        startDateTime = LocalDateTime.now();
+                        long startTime = System.currentTimeMillis();
+                        algorithmlibraryid = algorithmLibrary.get("algorithmlibraryid");
+                        HashMap<String, Object> data = new HashMap<>();
+                        data.put("count", g);
+                        Object preConditions = algorithmLibrary.get("preconditions");
+
+//                        source.put("args", resource);
+//                        source.put("algorithm", algorithmLibrary);
+                        HashMap<String, Object> preData = new HashMap<>();
+                        preData.put("preConditions", preConditions);
+                        preData.put("algorithmlibraryid", algorithmlibraryid);
+                        preData.put("count", g);
+                        preResource.add(preData);
+                        if (Objects.nonNull(preConditions)) {
+                            Map<String, Object> eval = JsScriptEngineUtil.eval(preConditions.toString(), resource);
+                            preData.put("preResult", eval);
+                            preCode = eval.get("returnData").toString();
+                        }
+
+//                        if ("1".equalsIgnoreCase(preCode)) {
+//                            continue;
+//                        }
+                        if ("1".equalsIgnoreCase(preCode) || "2".equalsIgnoreCase(preCode) || "3".equalsIgnoreCase(preCode)) {
+                            break;
+                        }
+
+                        Object algorithmsourcelibraryid = algorithmLibrary.get("algorithmsourcelibraryid");
+
+                        List<Map<String, Object>> algorithmsourcelibraryList = DATA_BASE.query(Config.getCenterConnectionStr(), "select * from algorithmsourcelibrary where id=? ", algorithmsourcelibraryid);
+                        Map<String, Object> algorithmsourcelibrary = algorithmsourcelibraryList.get(0);
+
+                        HashMap<String, Object> configMap = new HashMap<>();
+                        Object methodName = algorithmsourcelibrary.get("code");
+                        configMap.put("methodName", methodName);
+                        configMap.put("path", algorithmsourcelibrary.get("filepath"));
+                        Object className = algorithmsourcelibrary.get("library");
+                        configMap.put("className", className);
+                        Map<String, Object> result = null;
+//        获取入参列表
+                        List<Object> parameters = new ArrayList<>();
+                        if ("com.scbfkj.uni.library.script.JsScriptEngineUtil".equals(className) && "eval".equals(methodName)) {
+                            String expressionStr = algorithmLibrary.get("computingexpression").toString();
+                            data.put("expression", expressionStr);
+                            result = JsScriptEngineUtil.eval(expressionStr, resource);
+                        } else {
+                            List<Map<String, Object>> params = DATA_BASE.query(Config.getCenterConnectionStr(), """
+                                    select
+                                    algorithmparametersid, algorithmlibraryid, parametername, subscriptionexpressions, parametertype, datasource
+                                    from algorithmparameters where algorithmlibraryid =?""", algorithmlibraryid.toString());
+
+                            for (Map<String, Object> param : params) {
+                                Object o = param.get("datasource");
+                                Object subscriptionExpressions = param.get("subscriptionexpressions");
+                                Object parameterType = param.get("parametertype");
+                                if ("0".equals(o)) {
+
+
+                                } else if ("1".equals(o)) {
+                                    Object o1 = algorithmLibrary.get(subscriptionExpressions);
+                                    parseData(parameterType, parameters, o1);
+                                } else if ("2".equals(o)) {
+                                    parseData(parameterType, parameters, subscriptionExpressions);
+                                } else if ("3".equals(o)) {
+                                    parameters.add(getParamsByIndex(subscriptionExpressions.toString(), resource, false));
+                                }
+                            }
+                            result = JavaScriptEngineUtil.invoke(configMap, methodName.toString(), parameters.toArray());
+                            if (!result.isEmpty() && result.containsKey("code") && result.containsKey("returnData") && "0".equalsIgnoreCase(result.get("code").toString())) {
+                                Object returnData = result.get("returnData");
+                                if (returnData instanceof Map<?, ?> map) {
+                                    if (!map.isEmpty() && map.containsKey("code") && map.containsKey("returnData") && "0".equalsIgnoreCase(map.get("code").toString())) {
+                                        result = (Map<String, Object>) map;
+                                    }
+                                }
+                            }
+                        }
+
+                        data.put("lifecycleid", lifecycleid);
+                        data.put("algorithmlibraryid", algorithmlibraryid);
+                        data.put("result", result);
+                        data.put("index", algorithmLibrariesOrders.get(algorithmlibraryid.toString()));
+                        data.put("parameters", parameters);
+//                    执行时长
+                        data.put("execTime", System.currentTimeMillis() - startTime);
+
+//                    执行成功与否
+                        Object code = Optional.ofNullable(result.get("code")).map(DataFormatUtil::toString).orElse(null);
+                        message = Optional.ofNullable(result.get("message")).map(DataFormatUtil::toString).orElse(null);
+                        data.put("resultCode", code);
+
+                        resource.add(data);
+                    }
+                    if ("2".equalsIgnoreCase(preCode) || "3".equalsIgnoreCase(preCode)) {
+                        break;
+                    }
+                }
+                if ("3".equalsIgnoreCase(preCode)) {
+                    break;
+                }
+            }
+
+            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();
+            if (Config.isDebug()) {
+                e.printStackTrace();
+            }
+            return UniReturnUtil.fail(e);
+        } finally {
+
+//                    不管成功还是失败都记录日志
+            if (serviceInfo != null) {
+                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;
+                    String finalLifecycleid = lifecycleid;
+//                使用线程不阻塞
+                    executor.execute(() -> {
+                        LoggerService.LogType target = LoggerService.LogType.SERVICE;
+                        if (Objects.nonNull(finalMessage)) {
+                            target = LoggerService.LogType.SERVICE_ERR;
+                        }
+                        HashMap<String, Object> logData = new HashMap<>();
+                        logData.put("begintime", finalStartDateTime);
+                        LocalDateTime dateTime = LocalDateTime.now();
+                        logData.put("endtime", dateTime);
+                        logData.put("serviceid", finalServiceId);
+                        String string = DataFormatUtil.toString(resource);
+                        if (Config.isDebug()) {
+                            System.out.println("resources:" + string);
+                        }
+                        logData.put("inputdata", string);
+                        logData.put("prepesource", DataFormatUtil.toString(preResource));
+                        logData.put("returnmessage", finalMessage);
+                        logData.put("lifecycleid", finalLifecycleid);
+                        try {
+                            LoggerService.log(target, logData);
+                        } catch (Exception exception) {
+                            if (Config.isDebug()) {
+                                exception.printStackTrace();
+                            }
+                        }
+                    });
+
+                }
+//                使用线程不阻塞
+            }
+            String finalServiceId1 = serviceId;
+            executor.execute(() -> {
+                try {
+                    DATA_BASE.update(Config.getCenterConnectionStr(), """
+                            update servicestate
+                            set lasttime = ?,workpath = ?
+                            where serviceid=? and containercode=?""", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyy-MM-dd HH:mm:ss")), new File(".").getAbsolutePath(), finalServiceId1, Config.getContainerCode());
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            });
+        }
+
+    }
+
+    private static void parseData(Object parameterType, List<Object> parameters, Object subscriptionExpressions) throws ParseException {
+        switch (parameterType.toString()) {
+            case "String" -> {
+                parameters.add(DataFormatUtil.toString(subscriptionExpressions));
+            }
+            case "Array" -> {
+                parameters.add(DataFormatUtil.toList(subscriptionExpressions));
+            }
+            case "Map" -> {
+                parameters.add(DataFormatUtil.toMap(subscriptionExpressions));
+            }
+            case "Number" -> {
+                parameters.add(NumberFormat.getInstance().parse(subscriptionExpressions.toString()));
+            }
+            case "Boolean" -> {
+                parameters.add(Boolean.parseBoolean(subscriptionExpressions.toString()));
+            }
+            default -> {
+                throw new RuntimeException("参数数据类型错误");
+            }
+        }
+    }
+
+
+    public Object getParamsByIndex(String parameterSet, Object source, boolean all) throws JsonProcessingException {
+        if (Objects.isNull(source)) {
+            return null;
+        }
+        if (parameterSet == null) return NullNode.instance;
+        ArrayNode jsonNode = DataFormatUtil.toJsonNode(source).withArray("");
+        if (parameterSet.trim().isEmpty()) return jsonNode;
+        String jsonPtrExpr = parameterSet.replaceAll("[\\[\\]$.]", "/").replaceAll("/+", "/");
+
+        String[] split = jsonPtrExpr.split("/", 2);
+
+        if (split.length > 1 && (split[0].isEmpty()) && (split.length == 2)) {
+            jsonPtrExpr = split[1];
+        }
+        if (!jsonPtrExpr.equalsIgnoreCase("/") && jsonPtrExpr.endsWith("/")) {
+            jsonPtrExpr = jsonPtrExpr.substring(0, jsonPtrExpr.length() - 1);
+        }
+        String[] split1 = jsonPtrExpr.split("/", 2);
+        JsonNode result = NullNode.getInstance();
+
+        for (int i = 0; i < split1.length; i++) {
+            String key = split1[i];
+            if (i == 0) {
+                ArrayNode arrayNode = new ArrayNode(JsonNodeFactory.instance);
+                var index = 0;
+                for (JsonNode node : jsonNode) {
+
+                    if (node.get("index").asText().equals(key)) {
+                        if (!all) {
+                            if (index == jsonNode.size() - 1) {
+                                arrayNode.add(node);
+                                result = node;
+                            }
+                        } else {
+                            arrayNode.add(node);
+                            result = node;
+                        }
+                    }
+                    index++;
+                }
+                jsonNode = arrayNode;
+            } else {
+                ArrayNode arrayNode = new ArrayNode(JsonNodeFactory.instance);
+                for (JsonNode node : jsonNode) {
+                    JsonNode node1 = node.at("/" + key);
+                    arrayNode.add(node1);
+                    result = node1;
+                }
+                jsonNode = arrayNode;
+            }
+        }
+        return all ? jsonNode : result;
+    }
+
+
+    public Object getParams(String root, String parameterSet, Object source) throws JsonProcessingException {
+
+
+        if (Objects.isNull(source)) {
+            return null;
+        }
+
+        JsonNode jsonNode = DataFormatUtil.toJsonNode(source);
+        if (root == null) {
+            root = "";
+        }
+        if (parameterSet == null) parameterSet = "";
+        String jsonPtrExpr = (root + parameterSet.replaceAll("[\\[\\]$.]", "/")).replaceAll("/+", "/");
+        if (!jsonPtrExpr.startsWith("/")) {
+            jsonPtrExpr = "/" + jsonPtrExpr;
+        }
+        if (jsonPtrExpr.endsWith("/") && jsonPtrExpr.length() > 1) {
+            jsonPtrExpr = jsonPtrExpr.substring(0, jsonPtrExpr.length() - 1);
+        }
+        return "/".equalsIgnoreCase(jsonPtrExpr) ? jsonNode : jsonNode.at(jsonPtrExpr);
+    }
+
+
+    public static class AlgorithmLibraryGroup {
+        private String groupName;
+        private int count;
+
+        public String getGroupName() {
+            return groupName;
+        }
+
+        public void setGroupName(String groupName) {
+            this.groupName = groupName;
+        }
+
+        public int getCount() {
+            return count;
+        }
+
+        public void setCount(int count) {
+            this.count = count;
+        }
+
+        public AlgorithmLibraryGroup(String groupName, int count) {
+            this.groupName = groupName;
+            this.count = count;
+        }
+
+        @Override
+        public String toString() {
+            return "AlgorithmLibraryGroup{" +
+                   "groupName='" + groupName + '\'' +
+                   ", count=" + count +
+                   '}';
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+            AlgorithmLibraryGroup that = (AlgorithmLibraryGroup) o;
+            return count == that.count && Objects.equals(groupName, that.groupName);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(groupName, count);
+        }
+    }
+
+}

+ 1 - 2
src/main/java/com/scbfkj/uni/system/ScheduleTask.java

@@ -1,7 +1,6 @@
 package com.scbfkj.uni.system;
 package com.scbfkj.uni.system;
 
 
 import com.scbfkj.uni.library.UniReturnUtil;
 import com.scbfkj.uni.library.UniReturnUtil;
-import com.scbfkj.uni.service.DataProcessService;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Objects;
 import java.util.Objects;
@@ -29,7 +28,7 @@ public class ScheduleTask implements Runnable {
             count++;
             count++;
         }
         }
         try {
         try {
-            new DataProcessService().process(new HashMap<>() {{
+            new ProcessUtil().process(new HashMap<>() {{
                 put("serviceid", id);
                 put("serviceid", id);
             }});
             }});
         } catch (Exception e) {
         } catch (Exception e) {

+ 11 - 0
src/main/java/com/scbfkj/uni/system/ScheduleUtil.java

@@ -79,6 +79,17 @@ public class ScheduleUtil {
         return true;
         return true;
     }
     }
 
 
+    /**
+     * 间隔执行 毫秒级 执行结束到下次开始执行时间
+     *
+     * @param runnable
+     * @param frequency
+     * @return
+     */
+    public static void startCronTask(Runnable runnable, String cronExpress) {
+        threadPoolTaskScheduler.schedule(runnable, new CronTrigger(cronExpress));
+    }
+
     /**
     /**
      * 间隔执行 毫秒级 执行结束到下次开始执行时间
      * 间隔执行 毫秒级 执行结束到下次开始执行时间
      *
      *

+ 155 - 56
src/main/java/com/scbfkj/uni/system/SystemInit.java

@@ -1,19 +1,23 @@
 package com.scbfkj.uni.system;
 package com.scbfkj.uni.system;
 
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.scbfkj.uni.library.DataEncryptionUtil;
 import com.scbfkj.uni.library.DataEncryptionUtil;
 import com.scbfkj.uni.library.DataFormatUtil;
 import com.scbfkj.uni.library.DataFormatUtil;
-import com.scbfkj.uni.library.EmailUtil;
 import com.scbfkj.uni.library.UniReturnUtil;
 import com.scbfkj.uni.library.UniReturnUtil;
 import com.scbfkj.uni.library.script.DatabaseScriptUtil;
 import com.scbfkj.uni.library.script.DatabaseScriptUtil;
 import com.scbfkj.uni.library.script.JsScriptEngineUtil;
 import com.scbfkj.uni.library.script.JsScriptEngineUtil;
 import com.scbfkj.uni.library.script.KafkaScriptUtil;
 import com.scbfkj.uni.library.script.KafkaScriptUtil;
 import com.scbfkj.uni.process.DataBase;
 import com.scbfkj.uni.process.DataBase;
 import com.scbfkj.uni.process.Elasticsearch;
 import com.scbfkj.uni.process.Elasticsearch;
-import com.scbfkj.uni.process.Kafka;
+import com.scbfkj.uni.process.Http;
 import com.scbfkj.uni.service.ControlService;
 import com.scbfkj.uni.service.ControlService;
 import com.scbfkj.uni.service.LoggerService;
 import com.scbfkj.uni.service.LoggerService;
+import com.scbfkj.uni.utils.Util;
 import jakarta.annotation.PostConstruct;
 import jakarta.annotation.PostConstruct;
+import org.apache.commons.io.FileUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.FileSystemResource;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.support.ResourcePatternResolver;
 import org.springframework.core.io.support.ResourcePatternResolver;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
@@ -23,7 +27,12 @@ import java.io.*;
 import java.nio.charset.StandardCharsets;
 import java.nio.charset.StandardCharsets;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.*;
-import java.util.concurrent.*;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 
 
@@ -41,6 +50,10 @@ public class SystemInit {
     @Value("${db.security.config}")
     @Value("${db.security.config}")
     private String securityConfig;
     private String securityConfig;
 
 
+    @Value("${app.singleton.enable:false}")
+    private boolean singletonEnable = false;
+    @Value("${app.singleton.file:./config/config.sqlite}")
+    private String singletonFile;
     @Value("${app.security.enable:true}")
     @Value("${app.security.enable:true}")
     private boolean securityEnable = false;
     private boolean securityEnable = false;
     @Value("${app.security.encrypt:true}")
     @Value("${app.security.encrypt:true}")
@@ -53,26 +66,20 @@ public class SystemInit {
 
 
     @Value("${app.enable-reset-config:false}")
     @Value("${app.enable-reset-config:false}")
     private boolean enableResetConfig = false;
     private boolean enableResetConfig = false;
-    List<String> qualityControlIds = new ArrayList<>();
+    Set<String> qualityControlIds = new HashSet<>();
     Set<String> qualityControlIds2 = new HashSet<>();
     Set<String> qualityControlIds2 = new HashSet<>();
 
 
+
+//    @Value("${APPKEY}")
+//    private String appkey;
+//
+//    @Value("${DEFAULT_SERVICE_URL}")
+//    private String serviceUrl;
+
     public SystemInit(ResourcePatternResolver resourcePatternResolver) {
     public SystemInit(ResourcePatternResolver resourcePatternResolver) {
         this.resourcePatternResolver = resourcePatternResolver;
         this.resourcePatternResolver = resourcePatternResolver;
     }
     }
 
 
-    public static String readFileToString(File file) {
-        StringBuilder content = new StringBuilder();
-        try (Scanner scanner = new Scanner(file)) {
-            while (scanner.hasNextLine()) {
-                content.append(scanner.nextLine());
-            }
-        } catch (FileNotFoundException e) {
-            if (Config.isDebug()) {
-                e.printStackTrace();
-            }
-        }
-        return content.toString();
-    }
 
 
     private static void containerHeartbeat() {
     private static void containerHeartbeat() {
         try {
         try {
@@ -87,20 +94,67 @@ public class SystemInit {
 
 
     @PostConstruct
     @PostConstruct
     public void init() throws Exception {
     public void init() throws Exception {
+
+        String serviceUrl = SpringContextApplication.getString("DEFAULT_SERVICE_URL");
+        String appkey = SpringContextApplication.getString("APPKEY");
+        try {
+            checkAppKey(serviceUrl, appkey);
+            ScheduleUtil.startCronTask(() -> {
+                try {
+                    checkAppKey(serviceUrl, appkey);
+                } catch (Exception e) {
+                    System.out.println(e.getMessage());
+                    System.exit(-1);
+                }
+            }, "0 0 0 * * *");
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+            System.exit(-1);
+        }
         Config.setContainerCode(containerCode);
         Config.setContainerCode(containerCode);
         Config.setSecurityEnable(securityEnable);
         Config.setSecurityEnable(securityEnable);
         Config.setDebug(debug);
         Config.setDebug(debug);
-        if (encryptEnable) {
-            Config.setCenterConnectionStr(DataEncryptionUtil.decryptRSAByPrivateKey(centerConfig));
-            Config.setSecurityConnectionStr(DataEncryptionUtil.decryptRSAByPrivateKey(securityConfig));
+        if (singletonEnable) {
+            String config = """
+                    {
+                      "jdbcUrl": "jdbc:sqlite:%s",
+                      "driverClassName": "org.sqlite.JDBC"
+                    }""".formatted(singletonFile);
+            Config.setCenterConnectionStr(config);
+            Config.setSecurityConnectionStr(config);
+            if (enableResetConfig) {
+                resetRemoteConfig(Config.getCenterConnectionStr(), "classpath:sql/sqlite/*");
+            }
         } else {
         } else {
-            Config.setCenterConnectionStr(centerConfig);
-            Config.setSecurityConnectionStr(securityConfig);
-        }
-        if (enableResetConfig) {
-            cleanRemoteConfig(Config.getCenterConnectionStr(), "classpath:sql/systemset/*");
-            cleanRemoteConfig(Config.getSecurityConnectionStr(), "classpath:sql/uniauth/*");
-
+            if (encryptEnable) {
+                Config.setCenterConnectionStr(DataEncryptionUtil.decryptRSAByPrivateKey(centerConfig));
+                Config.setSecurityConnectionStr(DataEncryptionUtil.decryptRSAByPrivateKey(securityConfig));
+            } else {
+                Config.setCenterConnectionStr(centerConfig);
+                Config.setSecurityConnectionStr(securityConfig);
+            }
+            if (enableResetConfig) {
+//                使用正则判断 Config.getCenterConnectionStr()链接字符串配置中的jdbc数据库类型
+//                声明一个正则表达式
+                String regex = "jdbc:([a-zA-Z]+)";
+
+                // 创建 Pattern 对象
+                Pattern pattern = Pattern.compile(regex);
+
+                // 创建 Matcher 对象
+                Matcher matcher = pattern.matcher(Config.getCenterConnectionStr());
+
+                // 查找匹配的子串
+                if (matcher.find()) {
+                    String dbType = matcher.group(1);
+                    resetRemoteConfig(Config.getCenterConnectionStr(), "classpath:sql/%s/systemset/*".formatted(dbType));
+                    resetRemoteConfig(Config.getSecurityConnectionStr(), "classpath:sql/%s/uniauth/*".formatted(dbType));
+
+                } else {
+                    resetRemoteConfig(Config.getCenterConnectionStr(), "classpath:sql/mysql/systemset/*");
+                    resetRemoteConfig(Config.getSecurityConnectionStr(), "classpath:sql/mysql/uniauth/*");
+                }
+            }
         }
         }
 
 
 //        日志配置初始化
 //        日志配置初始化
@@ -152,38 +206,14 @@ public class SystemInit {
                 System.out.println("创建目录成功:" + resource.getAbsolutePath());
                 System.out.println("创建目录成功:" + resource.getAbsolutePath());
             }
             }
         }
         }
-        readConfigFile();
         ControlService.startServiceByContainerCode(Config.getContainerCode());
         ControlService.startServiceByContainerCode(Config.getContainerCode());
     }
     }
-
-    private String readConfigFile() throws Exception {
-        File resource = new File("config");
-        if (resource.exists()) {
-            StringBuilder builder;
-            try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(resource))) {
-                byte[] bytes = new byte[1024];
-                builder = new StringBuilder();
-                while (inputStream.read(bytes) > 0) {
-                    builder.append(new String(bytes));
-                }
-            }
-            String string = builder.toString();
-            return DataEncryptionUtil.decryptRSAByPrivateKey(string);
-        } else {
-            return "{}";
-        }
-    }
-
     /**
     /**
-     * 清理远程数据配置
+     * 重置远程数据配置
      */
      */
-    private void cleanRemoteConfig(String connection, String path) throws Exception {
-
-
+    private void resetRemoteConfig(String connection, String path) throws Exception {
         Resource[] resources = resourcePatternResolver.getResources(path);
         Resource[] resources = resourcePatternResolver.getResources(path);
-
         for (Resource resource : resources) {
         for (Resource resource : resources) {
-
             StringBuilder stringBuilder = new StringBuilder();
             StringBuilder stringBuilder = new StringBuilder();
             try (InputStream inputStream = resource.getInputStream();
             try (InputStream inputStream = resource.getInputStream();
                  BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
                  BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
@@ -201,7 +231,6 @@ public class SystemInit {
                 }
                 }
             }
             }
         }
         }
-
     }
     }
 
 
     /**
     /**
@@ -353,7 +382,7 @@ public class SystemInit {
 
 
                                     if (send) {
                                     if (send) {
                                         // 发送消息
                                         // 发送消息
-                                        sendMessage(target == null ? null : target.toString(),targetName == null ? null : targetName.toString(), messageTemplate == null ? null : messageTemplate.toString(), result);
+                                        sendMessage(target == null ? null : target.toString(), targetName == null ? null : targetName.toString(), messageTemplate == null ? null : messageTemplate.toString(), result);
                                         DATA_BASE.update(Config.getCenterConnectionStr(), "update qualitycontrol set lastruntime = ? , lastruncontainercode= ? where id =?", LocalDateTime.now(), Config.getContainerCode(), id);
                                         DATA_BASE.update(Config.getCenterConnectionStr(), "update qualitycontrol set lastruntime = ? , lastruncontainercode= ? where id =?", LocalDateTime.now(), Config.getContainerCode(), id);
                                     }
                                     }
 //                                    判断日志记录
 //                                    判断日志记录
@@ -427,7 +456,7 @@ public class SystemInit {
         }
         }
     }
     }
 
 
-    private  void sendData(String message, List<Object> data, String datasourceId, String targetTopic) throws Exception {
+    private void sendData(String message, List<Object> data, String datasourceId, String targetTopic) throws Exception {
         List<Map<String, Object>> dataSources = DATA_BASE.query(Config.getCenterConnectionStr(), "select * from datasource where datasourceid = ?", datasourceId);
         List<Map<String, Object>> dataSources = DATA_BASE.query(Config.getCenterConnectionStr(), "select * from datasource where datasourceid = ?", datasourceId);
         if (!dataSources.isEmpty()) {
         if (!dataSources.isEmpty()) {
             Map<String, Object> dataSourceMap = dataSources.get(0);
             Map<String, Object> dataSourceMap = dataSources.get(0);
@@ -450,4 +479,74 @@ public class SystemInit {
             }
             }
         }
         }
     }
     }
+
+    private void checkAppKey(String url, String key) throws IOException {
+        // 获取本地机器的MAC地址
+        String mac = Util.mac();
+        System.out.println(mac);
+
+        // 尝试从本地许可证文件进行验证
+        String licensePath = SpringContextApplication.getString("app.license.file");
+        Resource resource = new FileSystemResource(licensePath);
+        if (resource.exists()) {
+            // 读取并解密许可证文件
+            String license = FileUtils.readFileToString(resource.getFile(), StandardCharsets.UTF_8);
+            try {
+                JsonNode jsonNode = DataFormatUtil.toJsonNode(DataEncryptionUtil.decryptRSAByPrivateKey(license));
+                // 验证许可证中的MAC地址是否与本地机器的MAC地址匹配
+                if (jsonNode.has("mac")) {
+                    String localMac = jsonNode.get("mac").asText();
+                    if (!localMac.equalsIgnoreCase(mac)) {
+                        throw new RuntimeException("密钥无效");
+                    }
+                    // 检查许可证是否已过期
+                    String exp = jsonNode.get("exp").asText();
+                    LocalDateTime expLocalDateTime = LocalDateTime.parse(exp);
+                    if (expLocalDateTime.isBefore(LocalDateTime.now())) {
+                        throw new RuntimeException("密钥已过期");
+                    }
+                } else
+                    throw new RuntimeException("密钥无效");
+            } catch (Exception e) {
+                throw new RuntimeException(e.getMessage());
+            }
+        } else {
+            // 通过Web API进行密钥验证
+            Map<String, Object> result = new Http().execWebApi(
+                    new HashMap<>() {{
+                        put("Content-Type", "application/json");
+                    }},
+                    "POST",
+                    new HashMap<>() {{
+                        put("event", "0");
+                        put("datacontent", new HashMap<String, Object>() {{
+                            put("appkey", key);
+                            put("mac", mac);
+                        }});
+                    }}, url + "/openApi/checkappkey");
+
+            // 处理Web API验证响应
+            if (result.isEmpty()) {
+                throw new RuntimeException("密钥无效");
+            }
+            Object code = result.get("code");
+            if (!Objects.equals("0", code)) {
+                throw new RuntimeException(result.getOrDefault("message", "验证失败").toString());
+            }
+
+            // 解析并检查通过Web API返回的密钥过期时间
+            Object data = result.get("returnData");
+            JsonNode json = DataFormatUtil.toJsonNode(data.toString());
+
+            ArrayNode jsonNode = json.withArray("returnData");
+            if (jsonNode.isEmpty()){
+                throw new RuntimeException("无效的密钥");
+            }
+            String exp = jsonNode.get(0).get("exptime").asText();
+            LocalDateTime expLocalDateTime = LocalDateTime.parse(exp);
+            if (expLocalDateTime.isBefore(LocalDateTime.now())) {
+                throw new RuntimeException("密钥已过期");
+            }
+        }
+    }
 }
 }

+ 43 - 6
src/main/java/com/scbfkj/uni/utils/Util.java

@@ -10,26 +10,39 @@ import com.scbfkj.uni.system.Config;
 import jakarta.annotation.Resource;
 import jakarta.annotation.Resource;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
 import java.util.*;
 import java.util.*;
 
 
 @Component
 @Component
 public class Util {
 public class Util {
-    @Resource
-    private SecurityService securityService;
+
+    public Util(SecurityService securityService) {
+        Util.securityService = securityService;
+    }
+
+    private static SecurityService securityService = null;
+
 
 
     private static final DataBase DATA_BASE = new DataBase();
     private static final DataBase DATA_BASE = new DataBase();
 
 
 
 
-    public  void addFilter(Map<String, Object> body, Optional<String> serviceid,String uri,boolean checkToken) throws Exception {
+    public static void addFilter(Map<String, Object> body, Optional<String> serviceid, String uri, boolean check) throws Exception {
 
 
 
 
         List<Map<String, Object>> permission = (List<Map<String, Object>>) securityService.permission().get("returnData");
         List<Map<String, Object>> permission = (List<Map<String, Object>>) securityService.permission().get("returnData");
 
 
 
 
-        if(checkToken) {
+        if (check) {
             checkToken(uri);
             checkToken(uri);
         }
         }
-        if (Objects.nonNull(body) && uri.startsWith("/openApi")) {
+        if(!Config.isSecurityEnable()){
+            body.put("filterColumns", Collections.singletonList("*"));
+            return;
+        }
+        if (Objects.nonNull(body) && (!uri.startsWith("/controlApi") && !uri.startsWith("/user") && !uri.startsWith("/foxlibc"))) {
 
 
             Map<String, Object> userInfo = RequestUtil.getUserInfo();
             Map<String, Object> userInfo = RequestUtil.getUserInfo();
 
 
@@ -76,7 +89,7 @@ public class Util {
         }
         }
     }
     }
 
 
-    public  void checkToken(String uri) throws Exception {
+    public static void checkToken(String uri) throws Exception {
         if (Config.isSecurityEnable()) {
         if (Config.isSecurityEnable()) {
             List<Map<String, Object>> apiInfos = DATA_BASE.query(Config.getSecurityConnectionStr(), "select * from apiinfo");
             List<Map<String, Object>> apiInfos = DATA_BASE.query(Config.getSecurityConnectionStr(), "select * from apiinfo");
 
 
@@ -118,4 +131,28 @@ public class Util {
             }
             }
         }
         }
     }
     }
+
+    /**
+     * 获取当前机器的MAC地址
+     */
+    public static String mac() throws UnknownHostException, SocketException {
+        InetAddress localHost = InetAddress.getLocalHost();
+        NetworkInterface networkInterface = NetworkInterface.getByInetAddress(localHost);
+        byte[] macAddressBytes = networkInterface.getHardwareAddress();
+
+        StringBuilder macAddressBuilder = new StringBuilder();
+        for (byte b : macAddressBytes) {
+            macAddressBuilder.append(String.format("%02X:", b));
+        }
+
+        String macAddress = macAddressBuilder.toString();
+        if (!macAddress.isEmpty()) {
+            macAddress = macAddress.substring(0, macAddress.length() - 1);
+        }
+
+        return macAddress;
+
+    }
+
+
 }
 }

+ 1 - 1
src/main/resources/application-dev.yml

@@ -4,7 +4,7 @@ app:
   debug: false
   debug: false
   security:
   security:
     encrypt: false
     encrypt: false
-    enable: true
+    enable: false
   inner:
   inner:
     ssl:
     ssl:
       enable: false
       enable: false

+ 7 - 1
src/main/resources/application.yml

@@ -1,10 +1,16 @@
 app:
 app:
   enable-reset-config: false
   enable-reset-config: false
+  license:
+    file: ./license
   security:
   security:
     enable: true
     enable: true
     encrypt: true
     encrypt: true
+  singleton:
+    enable: false
+    file: ./config/config.sqlite
+
 server:
 server:
   port: 9500
   port: 9500
 spring:
 spring:
   profiles:
   profiles:
-    default: test
+    default: test

+ 28 - 0
src/main/resources/sql/mysql/systemset/V0.0__drop_table.sql

@@ -0,0 +1,28 @@
+drop table if exists algorithmlibrary;
+
+drop table if exists algorithmparameters;
+
+drop table if exists algorithmsourcelibrary;
+
+drop table if exists container;
+
+drop table if exists containerdeploy;
+
+drop table if exists datacache;
+
+drop table if exists datasource;
+
+drop table if exists keyalias;
+
+drop table if exists qualitycontrol;
+
+drop table if exists serviceinfo;
+
+drop table if exists servicestate;
+
+drop table if exists servicetype;
+
+drop table if exists systeminfo;
+
+drop table if exists tablejoin;
+

+ 195 - 0
src/main/resources/sql/mysql/systemset/V1.0__create_table.sql

@@ -0,0 +1,195 @@
+create table algorithmlibrary
+(
+    algorithmlibraryid       int auto_increment comment '算法编号'
+        primary key,
+    serviceid                int         null comment '服务编号',
+    computingexpression      text        null comment '计算表达式',
+    preconditions            text        null comment '前置计算条件',
+    executionorder           varchar(8)  null comment '执行顺序',
+    algorithmdescription     text        null comment '描述',
+    algorithmsourcelibraryid int         null comment '算法库算法id',
+    groupname                varchar(64) null,
+    loopcount                int         null
+)
+    row_format = DYNAMIC;
+
+create table algorithmparameters
+(
+    algorithmparametersid   int auto_increment
+        primary key,
+    algorithmlibraryid      int         null comment '所属算法编号',
+    parametername           tinytext    null comment '参数名',
+    subscriptionexpressions tinytext    null comment '参数订阅规则',
+    parametertype           tinytext    not null comment '参数类型',
+    datasource              tinytext    null,
+    algorithmname           tinytext    null comment '算法名称',
+    datasourcekey           varchar(12) null comment '是否是数据源字段'
+)
+    comment '算法参数' row_format = DYNAMIC;
+
+create table algorithmsourcelibrary
+(
+    id            int auto_increment
+        primary key,
+    superiorid    int unsigned null comment '上级编号',
+    type          tinytext     not null comment '类型',
+    name          tinytext     not null comment '名称',
+    code          tinytext     not null comment '编码',
+    datatype      tinytext     null comment '数据类型',
+    datasource    tinytext     null comment '数据来源',
+    defaultvalue  tinytext     null comment '默认值',
+    description   tinytext     null comment '描述',
+    templatejson  text         null comment '模板JSON',
+    library       tinytext     null comment '类库',
+    filepath      tinytext     null comment '文件路径',
+    datasourcekey int          null comment '是否是数据源'
+)
+    row_format = DYNAMIC;
+
+create table container
+(
+    containerid       int auto_increment
+        primary key,
+    containercode     tinytext null comment '容器编号',
+    containername     tinytext null comment '名称',
+    containerdescribe tinytext null comment '用途说明',
+    requesturi        tinytext null comment '访问路径',
+    containervesion   tinytext null comment '版本号',
+    runstate          tinytext null comment '当前状态',
+    lasttime          datetime null comment '最后活跃时间',
+    workpath          tinytext null
+)
+    row_format = DYNAMIC;
+
+create table containerdeploy
+(
+    containerdeployid int auto_increment
+        primary key,
+    serviceid         int      null comment '服务id',
+    servicename       tinytext null comment '服务名称',
+    containerid       int      null comment '容器id',
+    containercode     tinytext null comment '容器编号',
+    containername     tinytext null comment '容器名称',
+    workpath          tinytext null comment '服务运行路径'
+)
+    comment '容器服务部署' row_format = DYNAMIC;
+
+create table datacache
+(
+    datacacheid       int auto_increment
+        primary key,
+    connectset        text null comment '连接字符串',
+    querysql          text null comment '查询语句',
+    querytable        text null comment '查询表名',
+    effectiveduration int  null comment '缓存时长(秒)',
+    datacachedescribe text null comment '描述'
+)
+    comment '二级缓存配置' row_format = DYNAMIC;
+
+create table datasource
+(
+    datasourceid       int auto_increment
+        primary key,
+    datasourcedescribe tinytext null comment '数据源说明',
+    datasourcetype     tinytext null comment '数据源类型',
+    host               tinytext null comment 'ip',
+    username           tinytext null comment '用户名',
+    password           tinytext null comment '密码',
+    httpheaders        text     null comment 'http请求头',
+    httpbody           text     null comment 'http请求体',
+    driverclassname    tinytext null comment '类名(驱动)'
+)
+    row_format = DYNAMIC;
+
+create table keyalias
+(
+    aliasid       int auto_increment
+        primary key,
+    keyname       tinytext null comment '键名',
+    aliasname     tinytext null comment '别名',
+    aliasdescribe tinytext null comment '备注'
+)
+    row_format = DYNAMIC;
+
+create table qualitycontrol
+(
+    id                   int auto_increment
+        primary key,
+    sourceid             int          not null comment '数据源',
+    sourcename           varchar(64)  null,
+    target               varchar(128) not null,
+    targetname           varchar(128) null,
+    rules                text         not null,
+    frequency            int          null,
+    single               int          null,
+    enablelog            int          null,
+    messagetemplate      int          null,
+    lastruncontainercode varchar(16)  null comment '最后运行容器',
+    lastruntime          timestamp    null comment '最后运行时间',
+    resultfilter         text         null
+);
+
+create table serviceinfo
+(
+    serviceid   int auto_increment comment '主键'
+        primary key,
+    servicename tinytext null comment '名称',
+    tasktype    int      null comment '定时类型',
+    cronexpress tinytext null comment '定时器表达式',
+    urilist     tinytext null comment '对外暴露URI列表',
+    loopcount   int      null comment '循环次数',
+    frequency   int      null comment '频率',
+    enablelog   int      null comment '运行日志',
+    raw         int      null comment '是否返回原始数据 1返回原始数据 否则返回包装数据'
+)
+    row_format = DYNAMIC;
+
+create table servicestate
+(
+    servicestateid int auto_increment
+        primary key,
+    serviceid      int      null comment '服务编号',
+    servicename    tinytext null,
+    containerid    int      null comment '容器编号',
+    containercode  tinytext null comment '运行实例编号',
+    starttime      datetime null comment '启动时间',
+    stoptime       datetime null comment '停止时间',
+    runstate       tinytext null comment '当前状态',
+    lasttime       datetime null comment '最后活跃时间',
+    workpath       tinytext null
+)
+    row_format = DYNAMIC;
+
+create table servicetype
+(
+    servicetypeid       int auto_increment
+        primary key,
+    servicetypename     tinytext null comment '服务类型名称',
+    servicetypedescribe text     null comment '描述'
+)
+    row_format = DYNAMIC;
+
+create table systeminfo
+(
+    systemid       int auto_increment
+        primary key,
+    keyname        tinytext null comment '键名',
+    datasourceid   int      null comment '数据源id',
+    expression     tinytext null comment '表达式',
+    systemdescribe tinytext null comment '系统描述'
+)
+    row_format = DYNAMIC;
+
+create table tablejoin
+(
+    id                int auto_increment
+        primary key,
+    sourcetable       tinytext null comment '源表',
+    targettable       tinytext null comment '目标表',
+    sourcejoincolumn  tinytext null comment '源关联列名',
+    targetjoincolumn  tinytext null comment '目标关联列名',
+    targetshowcolumns tinytext null comment '目标显示列名列表',
+    datasourceid      int      null comment '数据源'
+)
+    comment '外键关联' row_format = DYNAMIC;
+

+ 28 - 0
src/main/resources/sql/mysql/uniauth/V0.0__drop_table.sql

@@ -0,0 +1,28 @@
+drop table apiinfo;
+
+drop table appconnectlog;
+
+drop table application;
+
+drop table applicationpermissions;
+
+drop table breakerrule;
+
+drop table pageconfiguration;
+
+drop table ratelimitrule;
+
+drop table tempsecuritycode;
+
+drop table tenantManage;
+
+drop table usergroup;
+
+drop table usergrouppermissions;
+
+drop table userinfo;
+
+drop table userloginlog;
+
+drop table userpermissions;
+

+ 236 - 0
src/main/resources/sql/mysql/uniauth/V1.0__create_table.sql

@@ -0,0 +1,236 @@
+create table apiinfo
+(
+    apiid            int auto_increment
+        primary key,
+    apiname          tinytext null comment 'api名称',
+    apitype          tinytext null comment 'api类型',
+    requestpath      tinytext null comment '请求地址',
+    routepath        tinytext null comment '响应地址',
+    securitykey      tinytext null comment '安全认证类型',
+    superiorid       int null comment '所属api编号',
+    apicode          tinytext null comment '参数编码',
+    datatype         tinytext null comment '参数数据类型',
+    datadefaultvalue tinytext null comment '默认参数值',
+    constraint apiinfo_pk
+        unique (apiid)
+);
+
+create table appconnectlog
+(
+    connid      int auto_increment
+        primary key,
+    appid       tinytext null comment '应用编号',
+    requesttime datetime null comment '请求时间',
+    requestip   tinytext null comment '请求地址',
+    apptoken    tinytext null comment '连接令牌',
+    expiretime  datetime null comment '令牌过期时间',
+    lasttime    datetime null comment '最后活跃时间'
+);
+
+create table application
+(
+    applicationid         int auto_increment
+        primary key,
+    appid                 tinytext null comment '编号',
+    appsecret             tinytext null comment '连接密钥',
+    appname               tinytext null comment '名称',
+    appengname            tinytext null comment '英文名称',
+    appdescribe           tinytext null comment '描述',
+    applogo               longtext null comment '图标',
+    smalllogo             longtext null comment '小图标',
+    backgroundimage       longtext null comment '背景图',
+    apptokeneffective     int null comment '令牌有效时长',
+    securitycoderule      tinytext null comment '验证码规则',
+    securitycodeeffective int null comment '验证码有效时长',
+    multilogin            int null comment '多机登陆',
+    passwordrule          tinytext null comment '密码规则',
+    passwordeffective     int null comment '密码有效时长'
+);
+
+create table applicationpermissions
+(
+    applicationpermissionsid int auto_increment
+        primary key,
+    appid                    tinytext null comment '应用编号',
+    apiid                    int null comment 'API编号',
+    columnlist               tinytext null comment '列权限',
+    filterset                tinytext null comment '行权限'
+);
+
+create table breakerrule
+(
+    breakerruleid        int auto_increment comment '熔断规则自增id'
+        primary key,
+    breakerrulename      tinytext null comment '熔断规则名称',
+    duration             int null comment '熔断时间',
+    limitvalue           int null comment '熔断范围值',
+    averageerrorrate     decimal(5, 2) null comment '平均错误率',
+    errorcount           int null comment '错误次数',
+    averageexecutiontime int null comment '平均执行时间',
+    returnmessage        tinytext null comment '返回消息'
+);
+
+create table pageconfiguration
+(
+    pageconfigurationid          int auto_increment
+        primary key,
+    pagetype                     tinytext not null comment '类型(模块、页面、按钮、Table表格、树、数据项、From表单)',
+    superiorid                   int null comment '上级编号',
+    pagename                     tinytext not null comment '名称',
+    pagecode                     tinytext not null comment '编码',
+    pagedescribe                 tinytext null comment '描述',
+    serviceid                    int null comment '绑定服务编号',
+    shortcutkeys                 tinytext null comment '快捷键(核心用于按钮)',
+    openmode                     tinytext null comment '打开方式(新页、弹出或抽屉、同页关联查询)',
+    pageroute                    tinytext null comment '路由',
+    pageaddress                  tinytext null comment '地址',
+    passparameters               longtext null comment '传递参数',
+    defaultfilter                tinytext null comment '页面打开时的默认查询条件',
+    pageicon                     tinytext null comment '图标',
+    rowbackgroundcolorexpression tinytext null comment '行背景色表达式',
+    rowfontcolorexpression       tinytext null comment '行字体色表达式',
+    datatype                     tinytext null comment '渲染类型',
+    datalength                   int null comment '数据长度',
+    isdisplay                    tinytext null comment '是否显示',
+    displaynumber                int null comment '显示顺序',
+    displaywidth                 int null comment '显示宽度',
+    backgroundcolorexpression    tinytext null comment '背景色表达式',
+    fontcolorexpression          tinytext null comment '字体色表达式',
+    enablesort                   int null comment '启用排序功能',
+    enablefilter                 int null comment '启用过滤功能',
+    enablegroup                  int null comment '是否分组',
+    enablecount                  int null comment '启用合计',
+    counttopmost                 int null comment '合计置顶',
+    isfiltercolumn               int null comment '是否为查询条件',
+    isprimarykey                 int null comment '是否主键',
+    defaultparameters            tinytext null comment '默认查询参数',
+    dropdownlist                 tinytext null comment '下来列表(服务编号)',
+    dropdownlistid               tinytext null comment '下来列表键值',
+    dropdownlistlabel            tinytext null comment '下来列表显示名称',
+    isrequired                   int null comment '是否必填',
+    uniquitytype                 tinytext null comment '唯一性',
+    formatrule                   tinytext null comment '格式校验规则',
+    defaultvalue                 tinytext null comment '默认值',
+    calculationformula           tinytext null comment '计算公式',
+    servicetype                  int null,
+    groupid                      tinytext null comment '所属分组',
+    alias                        tinytext null comment '别名',
+    labelcode                    tinytext null comment '下拉数据关联项编码',
+    selected                     int null comment '是否勾选',
+    triggerserviceid             int null comment '勾选触发的服务id',
+    charttype                    tinytext null comment '图表类型',
+    easysearch                   int default 0 null
+);
+
+create table ratelimitrule
+(
+    ratelimitingid   int auto_increment
+        primary key,
+    ratelimitingname tinytext null comment '策略名',
+    duration         int null comment '单位时间频率(秒)',
+    timeout          int null comment '超时shi''c',
+    limitvalue       int null comment '数量上限',
+    returnmessage    tinytext null comment '超限返回提示',
+    serviceid        tinytext null comment '适用服务编号列表',
+    pathmatch        tinytext null comment '路径匹配'
+);
+
+create table tempsecuritycode
+(
+    codeid       int auto_increment
+        primary key,
+    appid        tinytext null comment '应用编号',
+    requestip    tinytext null comment '请求地址',
+    sessionid    tinytext null comment '请求编号',
+    securitycode tinytext null comment '验证码',
+    expiretime   datetime null comment '验证码过期时间'
+);
+
+create table tenantManage
+(
+    tenantId       int not null comment '租户ID'
+        primary key,
+    tenantName     varchar(24) null comment '租户名称',
+    tenantEngName  varchar(32) null comment '英文名称',
+    tenantDescribe text null comment '描述',
+    validStartTime datetime null comment '有效开始时间',
+    validEndTime   datetime null comment '有效结束时间',
+    contact        varchar(12) null comment '联系人',
+    phone          varchar(16) null comment '联系电话'
+);
+
+create table usergroup
+(
+    usergroupid       int auto_increment
+        primary key,
+    superiorid        int null comment '上级编号',
+    usergroupname     tinytext null comment '名称',
+    usergroupdescribe text null comment '描述',
+    isenable          int null comment '是否启用',
+    isdelete          int null comment '删除状态',
+    grouptype         tinytext null comment '组织类型'
+);
+
+create table usergrouppermissions
+(
+    userpermissionsid   int auto_increment
+        primary key,
+    usergroupid         int null comment '用户组编号',
+    pageconfigurationid int null comment '权限项编号',
+    serviceid           int null comment '服务编号',
+    insetcolumnlist     text null comment '新增权限',
+    updatecolumnlist    text null comment '更新权限',
+    selectcolumnlist    text null comment '查询权限',
+    filterset           text null comment '过滤权限'
+);
+
+create table userinfo
+(
+    userid               int auto_increment
+        primary key,
+    usergroupid          int null comment '所属用户组编号',
+    username             varchar(255) null comment '用户名',
+    account              varchar(255) not null comment '账号',
+    userpassword         varchar(255) null comment '密码',
+    userdescribe         text null comment '描述',
+    isenable             int null comment '是否启用',
+    secondarypassword    varchar(255) null comment '二次密码',
+    multilogin           int null comment '多机登录',
+    passwordlastmodified datetime null comment '密码最后修改时间',
+    isdelete             int null comment '删除状态',
+    email                varchar(64) null comment '右键',
+    constraint account
+        unique (account)
+);
+
+create table userloginlog
+(
+    loginid       int auto_increment
+        primary key,
+    userid        int null comment '用户编号',
+    requestip     tinytext null comment '请求地址',
+    sessionid     tinytext null comment '请求编号',
+    logintime     datetime null comment '登录时间',
+    usertoken     tinytext null comment '用户令牌',
+    lasttime      datetime null comment '最后活跃时间',
+    lastheartbeat datetime null comment '最后心跳时间',
+    logouttime    datetime null comment '登出时间',
+    apptoken      tinytext null comment '连接令牌',
+    isexpires     tinyint null comment '是否过期',
+    appid         tinytext null comment '应用编号',
+    expirestime   datetime null comment '过期时间'
+);
+
+create table userpermissions
+(
+    userpermissionsid   int auto_increment
+        primary key,
+    userid              int null comment '用户变化',
+    pageconfigurationid int null comment '权限项编号',
+    serviceid           int null comment '服务编号',
+    insetcolumnlist     text null comment '新增',
+    updatecolumnlist    text null comment '更新',
+    selectcolumnlist    text null comment '查询',
+    filterset           text null comment '过滤',
+    parentserviceid     int null
+);

+ 6 - 0
src/main/resources/sql/mysql/uniauth/v1.1__init_data.sql

@@ -0,0 +1,6 @@
+INSERT INTO uniauth.apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (1, '获取token', '外部API', '/user/getToken', null, null, null, null, null, null);
+INSERT INTO uniauth.apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (2, '刷新token', '外部API', '/user/refreshToken', null, 'token', null, null, null, null);
+INSERT INTO uniauth.apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (3, '新增', '外部API', '/openApi/newdata', null, 'usertoken', null, null, null, null);
+INSERT INTO uniauth.apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (4, '修改', '外部API', '/openApi/modifydata', null, 'usertoken', null, null, null, null);
+INSERT INTO uniauth.apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (5, '删除', '外部API', '/openApi/movedata', null, 'usertoken', null, null, null, null);
+INSERT INTO uniauth.apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (6, '查询', '外部API', '/openApi/query', null, 'usertoken', null, null, null, null);

+ 57 - 0
src/main/resources/sql/sqlite/V0.0__drop_table.sql

@@ -0,0 +1,57 @@
+drop table if exists algorithmlibrary;
+
+drop table if exists algorithmparameters;
+
+drop table if exists algorithmsourcelibrary;
+
+drop table if exists apiinfo;
+
+drop table if exists appconnectlog;
+
+drop table if exists application;
+
+drop table if exists applicationpermissions;
+
+drop table if exists breakerrule;
+
+drop table if exists container;
+
+drop table if exists containerdeploy;
+
+drop table if exists datacache;
+
+drop table if exists datasource;
+
+drop table if exists keyalias;
+
+drop table if exists pageconfiguration;
+
+drop table if exists qualitycontrol;
+
+drop table if exists ratelimitrule;
+
+drop table if exists serviceinfo;
+
+drop table if exists servicestate;
+
+drop table if exists servicetype;
+
+
+drop table if exists systeminfo;
+
+drop table if exists tablejoin;
+
+drop table if exists tempsecuritycode;
+
+drop table if exists tenantManage;
+
+drop table if exists usergroup;
+
+drop table if exists usergrouppermissions;
+
+drop table if exists userinfo;
+
+drop table if exists userloginlog;
+
+drop table if exists userpermissions;
+

+ 388 - 0
src/main/resources/sql/sqlite/V1.0__create_table.sql

@@ -0,0 +1,388 @@
+create table algorithmlibrary
+(
+    algorithmlibraryid       integer,
+    serviceid                integer,
+    computingexpression      text,
+    preconditions            text,
+    executionorder           varchar(8),
+    algorithmdescription     text,
+    algorithmsourcelibraryid integer,
+    groupname                varchar(64),
+    loopcount                integer
+);
+
+create table algorithmparameters
+(
+    algorithmparametersid   integer,
+    algorithmlibraryid      integer,
+    parametername           varchar,
+    subscriptionexpressions varchar,
+    parametertype           varchar,
+    datasource              varchar,
+    algorithmname           varchar,
+    datasourcekey           varchar(12)
+);
+
+create table algorithmsourcelibrary
+(
+    id            integer,
+    superiorid    unsigned bigint,
+    type          varchar,
+    name          varchar,
+    code          varchar,
+    datatype      varchar,
+    datasource    varchar,
+    defaultvalue  varchar,
+    description   varchar,
+    templatejson  text,
+    library       varchar,
+    filepath      varchar,
+    datasourcekey integer
+);
+
+create table apiinfo
+(
+    apiid            integer,
+    apiname          varchar,
+    apitype          varchar,
+    requestpath      varchar,
+    routepath        varchar,
+    securitykey      varchar,
+    superiorid       integer,
+    apicode          varchar,
+    datatype         varchar,
+    datadefaultvalue varchar
+);
+
+create table appconnectlog
+(
+    connid      integer,
+    appid       varchar,
+    requesttime datetime,
+    requestip   varchar,
+    apptoken    varchar,
+    expiretime  datetime,
+    lasttime    datetime
+);
+
+create table application
+(
+    applicationid         integer,
+    appid                 varchar,
+    appsecret             varchar,
+    appname               varchar,
+    appengname            varchar,
+    appdescribe           varchar,
+    applogo               longvarchar,
+    smalllogo             longvarchar,
+    backgroundimage       longvarchar,
+    apptokeneffective     integer,
+    securitycoderule      varchar,
+    securitycodeeffective integer,
+    multilogin            integer,
+    passwordrule          varchar,
+    passwordeffective     integer
+);
+
+create table applicationpermissions
+(
+    applicationpermissionsid integer,
+    appid                    varchar,
+    apiid                    integer,
+    columnlist               varchar,
+    filterset                varchar
+);
+
+create table breakerrule
+(
+    breakerruleid        integer,
+    breakerrulename      varchar,
+    duration             integer,
+    limitvalue           integer,
+    averageerrorrate     decimal(5, 2),
+    errorcount           integer,
+    averageexecutiontime integer,
+    returnmessage        varchar
+);
+
+create table container
+(
+    containerid       integer,
+    containercode     varchar,
+    containername     varchar,
+    containerdescribe varchar,
+    requesturi        varchar,
+    containervesion   varchar,
+    runstate          varchar,
+    lasttime          datetime,
+    workpath          varchar
+);
+
+create table containerdeploy
+(
+    containerdeployid integer,
+    serviceid         integer,
+    servicename       varchar,
+    containerid       integer,
+    containercode     varchar,
+    containername     varchar,
+    workpath          varchar
+);
+
+create table datacache
+(
+    datacacheid       integer,
+    connectset        text,
+    querysql          text,
+    querytable        text,
+    effectiveduration integer,
+    datacachedescribe text
+);
+
+create table datasource
+(
+    datasourceid       integer,
+    datasourcedescribe varchar,
+    datasourcetype     varchar,
+    host               varchar,
+    username           varchar,
+    password           varchar,
+    httpheaders        text,
+    httpbody           text,
+    driverclassname    varchar
+);
+
+create table keyalias
+(
+    aliasid       integer,
+    keyname       varchar,
+    aliasname     varchar,
+    aliasdescribe varchar
+);
+
+create table pageconfiguration
+(
+    pageconfigurationid          integer,
+    pagetype                     varchar,
+    superiorid                   integer,
+    pagename                     varchar,
+    pagecode                     varchar,
+    pagedescribe                 varchar,
+    serviceid                    integer,
+    shortcutkeys                 varchar,
+    openmode                     varchar,
+    pageroute                    varchar,
+    pageaddress                  varchar,
+    passparameters               longvarchar,
+    defaultfilter                varchar,
+    pageicon                     varchar,
+    rowbackgroundcolorexpression varchar,
+    rowfontcolorexpression       varchar,
+    datatype                     varchar,
+    datalength                   integer,
+    isdisplay                    varchar,
+    displaynumber                integer,
+    displaywidth                 integer,
+    backgroundcolorexpression    varchar,
+    fontcolorexpression          varchar,
+    enablesort                   integer,
+    enablefilter                 integer,
+    enablegroup                  integer,
+    enablecount                  integer,
+    counttopmost                 integer,
+    isfiltercolumn               integer,
+    isprimarykey                 integer,
+    defaultparameters            varchar,
+    dropdownlist                 varchar,
+    dropdownlistid               varchar,
+    dropdownlistlabel            varchar,
+    isrequired                   integer,
+    uniquitytype                 varchar,
+    formatrule                   varchar,
+    defaultvalue                 varchar,
+    calculationformula           varchar,
+    servicetype                  integer,
+    groupid                      varchar,
+    alias                        varchar,
+    labelcode                    varchar,
+    selected                     integer,
+    triggerserviceid             integer,
+    charttype                    varchar,
+    easysearch                   integer
+);
+
+create table qualitycontrol
+(
+    id                   integer,
+    sourceid             integer,
+    sourcename           varchar(64),
+    target               varchar(128),
+    targetname           varchar(128),
+    rules                text,
+    frequency            integer,
+    single               integer,
+    enablelog            integer,
+    messagetemplate      integer,
+    lastruncontainercode varchar(16),
+    lastruntime          datetime,
+    resultfilter         text
+);
+
+create table ratelimitrule
+(
+    ratelimitingid   integer,
+    ratelimitingname varchar,
+    duration         integer,
+    timeout          integer,
+    limitvalue       integer,
+    returnmessage    varchar,
+    serviceid        varchar,
+    pathmatch        varchar
+);
+
+create table serviceinfo
+(
+    serviceid   integer,
+    servicename varchar,
+    tasktype    integer,
+    cronexpress varchar,
+    urilist     varchar,
+    loopcount   integer,
+    frequency   integer,
+    enablelog   integer,
+    raw         integer
+);
+
+create table servicestate
+(
+    servicestateid integer,
+    serviceid      integer,
+    servicename    varchar,
+    containerid    integer,
+    containercode  varchar,
+    starttime      datetime,
+    stoptime       datetime,
+    runstate       varchar,
+    lasttime       datetime,
+    workpath       varchar
+);
+
+create table servicetype
+(
+    servicetypeid       integer,
+    servicetypename     varchar,
+    servicetypedescribe text
+);
+
+
+create table systeminfo
+(
+    systemid       integer,
+    keyname        varchar,
+    datasourceid   integer,
+    expression     varchar,
+    systemdescribe varchar
+);
+
+create table tablejoin
+(
+    id                integer,
+    sourcetable       varchar,
+    targettable       varchar,
+    sourcejoincolumn  varchar,
+    targetjoincolumn  varchar,
+    targetshowcolumns varchar,
+    datasourceid      integer
+);
+
+create table tempsecuritycode
+(
+    codeid       integer,
+    appid        varchar,
+    requestip    varchar,
+    sessionid    varchar,
+    securitycode varchar,
+    expiretime   datetime
+);
+
+create table tenantManage
+(
+    tenantId       integer,
+    tenantName     varchar(24),
+    tenantEngName  varchar(32),
+    tenantDescribe text,
+    validStartTime datetime,
+    validEndTime   datetime,
+    contact        varchar(12),
+    phone          varchar(16)
+);
+
+create table usergroup
+(
+    usergroupid       integer,
+    superiorid        integer,
+    usergroupname     varchar,
+    usergroupdescribe text,
+    isenable          integer,
+    isdelete          integer,
+    grouptype         varchar
+);
+
+create table usergrouppermissions
+(
+    userpermissionsid   integer,
+    usergroupid         integer,
+    pageconfigurationid integer,
+    serviceid           integer,
+    insetcolumnlist     text,
+    updatecolumnlist    text,
+    selectcolumnlist    text,
+    filterset           text
+);
+
+create table userinfo
+(
+    userid               integer,
+    usergroupid          integer,
+    username             varchar(255),
+    account              varchar(255),
+    userpassword         varchar(255),
+    userdescribe         text,
+    isenable             integer,
+    secondarypassword    varchar(255),
+    multilogin           integer,
+    passwordlastmodified datetime,
+    isdelete             integer,
+    email                varchar(64)
+);
+
+create table userloginlog
+(
+    loginid       integer,
+    userid        integer,
+    requestip     varchar,
+    sessionid     varchar,
+    logintime     datetime,
+    usertoken     varchar,
+    lasttime      datetime,
+    lastheartbeat datetime,
+    logouttime    datetime,
+    apptoken      varchar,
+    isexpires     tinyint,
+    appid         varchar,
+    expirestime   datetime
+);
+
+create table userpermissions
+(
+    userpermissionsid   integer,
+    userid              integer,
+    pageconfigurationid integer,
+    serviceid           integer,
+    insetcolumnlist     text,
+    updatecolumnlist    text,
+    selectcolumnlist    text,
+    filterset           text,
+    parentserviceid     integer
+);
+

+ 6 - 0
src/main/resources/sql/sqlite/v1.1__init_data.sql

@@ -0,0 +1,6 @@
+INSERT INTO apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (1, '获取token', '外部API', '/user/getToken', null, null, null, null, null, null);
+INSERT INTO apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (2, '刷新token', '外部API', '/user/refreshToken', null, 'token', null, null, null, null);
+INSERT INTO apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (3, '新增', '外部API', '/openApi/newdata', null, 'usertoken', null, null, null, null);
+INSERT INTO apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (4, '修改', '外部API', '/openApi/modifydata', null, 'usertoken', null, null, null, null);
+INSERT INTO apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (5, '删除', '外部API', '/openApi/movedata', null, 'usertoken', null, null, null, null);
+INSERT INTO apiinfo (apiid, apiname, apitype, requestpath, routepath, securitykey, superiorid, apicode, datatype, datadefaultvalue) VALUES (6, '查询', '外部API', '/openApi/query', null, 'usertoken', null, null, null, null);

+ 18 - 15
src/test/java/com/scbfkj/uni/library/JsonPathTest.java

@@ -1,25 +1,28 @@
 package com.scbfkj.uni.library;
 package com.scbfkj.uni.library;
 
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.scbfkj.uni.system.ProcessUtil;
+import com.scbfkj.uni.utils.Util;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Test;
 
 
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
 public class JsonPathTest {
 public class JsonPathTest {
     @Test
     @Test
-    void test1() throws JsonProcessingException {
-        ObjectMapper objectMapper = new ObjectMapper();
-        JsonNode jsonNode = objectMapper.readTree("""
-                                [{
-                  "serviceid": "133",
-                  "datacontent": [{
-                    "datasourceid": "13",
-                    "tableName": "datasource"
-                  }],
-                  "event": "0",
-                  "page": 1,
-                  "size": 9999
-                }]""");
-        System.out.println(jsonNode.at("/0/datacontent/0/datasourceid"));
+    void test1() throws SocketException, UnknownHostException {
+        String mac = Util.mac();
+        System.out.println(mac);
+        List<ProcessUtil.AgorithmLibraryGroup> list = new ArrayList<>();
+        list.add(new ProcessUtil.AgorithmLibraryGroup("a",10));
+        list.add(new ProcessUtil.AgorithmLibraryGroup("a",10));
+        list.add(new ProcessUtil.AgorithmLibraryGroup("a",10));
+        list.add(new ProcessUtil.AgorithmLibraryGroup("a",10));
+        for (ProcessUtil.AgorithmLibraryGroup agorithmLibraryGroup : list.stream().distinct().toList()) {
+            System.out.println(agorithmLibraryGroup);
+        }
     }
     }
 }
 }