Pārlūkot izejas kodu

2.0 from 处理 不支持字段中包含from

pms 1 gadu atpakaļ
vecāks
revīzija
6e532b4a13

+ 2 - 0
.idea/encodings.xml

@@ -2,6 +2,8 @@
 <project version="4">
   <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
     <file url="file://$PROJECT_DIR$/mainFactory/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
     <file url="PROJECT" charset="UTF-8" />
   </component>
 </project>

+ 2 - 2
mainFactory/src/main/java/org/bfkj/MainFactoryApplication.java

@@ -140,8 +140,8 @@ public class MainFactoryApplication implements InitializingBean {
     private static void currentWorkExit() {
         ServiceInputControl.ScheduleTaskMaps.values().forEach(ScheduleUtil::cancel);
         //关闭数据库连接
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
-        myDbHelper.close();
+        ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT).close();
+        ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_LOG_CONNECT).close();
         System.out.println("系统正常退出");
     }
 

+ 10 - 9
mainFactory/src/main/java/org/bfkj/application/DataProcess.java

@@ -38,7 +38,7 @@ public class DataProcess {//数据处理对象
             Map<String, Object> calculationMap = baseDbHelper.queryByParamsReturnList("SELECT CL.*,DI.*  FROM calculation_library CL  left JOIN datasourceinfo DI ON DI.dataSourceID = CL.datasource_id WHERE CL.service_id  =? and  CL.library_type is not null order by library_sort,library_id", service_Id);//直接数据库查询
             calcList = Objects.isNull(calculationMap.get("returnData")) ? null : (List<Map<String, Object>>) calculationMap.get("returnData");
             if (!calculationMap.get("code").equals("0") || calcList == null || calcList.isEmpty()) {//查询数据库失败
-                errorMessage = "查询".concat(serviceId).concat("的算法失败:").concat(calculationMap.get("message").toString());
+                errorMessage = "查询".concat(serviceId).concat("的算法失败:").concat(calculationMap.containsKey("message")?calculationMap.get("message").toString():"对应算法不存在");
                 return;
             }
             //获取当前服务的安全等级
@@ -67,7 +67,7 @@ public class DataProcess {//数据处理对象
                 calcMyDbHelper.close();//关闭数据库连接池
             }
             calcDbHelperMaps.clear();//清除缓存
-            baseDbHelper.close();//底座数据库对象
+//            baseDbHelper.close();//底座数据库对象
         } catch (Exception e) {
             System.out.println("dataProcess 关闭异常: " + LogUtils.getException(e));
         }
@@ -184,11 +184,11 @@ public class DataProcess {//数据处理对象
                             System.out.println("权限集成执行异常".concat(authExtendMapList.get("message").toString()));
                             return;
                         }
-                        Object nextRule =authExtendMapList.get("returnData") instanceof List<?> tempList && tempList.get(0) instanceof Map tempMap ? tempMap.get("nextRule"):null;  // t_user_group.up_user_groupid
+                        Object nextRule =authExtendMapList.get("returnData") instanceof List<?> tempList && !tempList.isEmpty() && tempList.get(0) instanceof Map tempMap ? tempMap.get("nextRule"):null;  // t_user_group.up_user_groupid
                         String tempRowAuth = rowAuthObj.toString();
                         String connect = tempRowAuth.startsWith("!") ? "!=" : "=";//如果首位是!代表不等于,否则代表等于
                         tempRowAuth = tempRowAuth.startsWith("!") ? tempRowAuth.substring(1) : tempRowAuth;//修订行权限表达式
-                        String[] row_auths = tempRowAuth.split(","); //按,号进行分组!PEK,
+                        String[] row_auths = tempRowAuth.split(",",-1); //按,号进行分组!PEK,
                         for (String row_auth : row_auths) {//循环进行标准化
                             if (MapTools.isBlank(row_auth)) continue;//为空不设置--误操作填写了空格或者删除未设置为NULL
                             Map<String, Object> signRowAuth = new HashMap<>();
@@ -232,14 +232,14 @@ public class DataProcess {//数据处理对象
      */
     private List<Object> extendNextAuth(String columnName, String row_auth, Object nextRule) {
         List<Object> returnData = new ArrayList<>();
-        String[] rule = nextRule.toString().split("\\.");
+        String[] rule = nextRule.toString().split("\\.",-1);
         Map<String, Object> queryAuthReturnList = baseDbHelper.queryByParamsReturnList("select " + columnName + " from " + rule[0] + " where " + rule[1] + " = ?", row_auth);
         if ("-1".equals(queryAuthReturnList.get("code")) || ((List) queryAuthReturnList.get("returnData")).isEmpty()) {
             return returnData;
         }
         ((List<Map<String,Object>>) queryAuthReturnList.get("returnData")).stream().filter(Objects::nonNull).forEach(authvalue -> {
             returnData.add(authvalue.get(columnName)); // 5
-            returnData.addAll(extendNextAuth(columnName, authvalue.toString(), nextRule));
+            returnData.addAll(extendNextAuth(columnName,authvalue.get(columnName).toString(), nextRule));
         });
         return returnData;
     }
@@ -379,9 +379,9 @@ public class DataProcess {//数据处理对象
     }
 
     /*数据订阅:注意因前置导致算法未执行时,全量结果集的序号会存在问题*/
-    private Object dataSubscription(List<Map<String, Object>> calcAllData, String paramRule, Map<String, Object> calculationLibrary) { // List.1.returnData
+    private Object dataSubscription(List<Map<String, Object>> calcAllData, String paramRule, Map<String, Object> calculationLibrary) { // List.1.returnData.0
         try {
-            String[] itemRule = paramRule.split("\\.");//订阅规则按.进行分割
+            String[] itemRule = paramRule.split("\\.",-1);//订阅规则按.进行分割
             String dataType = itemRule.length > 0 ? itemRule[0] : "List"; //首位是最终返回的数据类型
             dataType = dataType.endsWith("]") ? dataType.substring(0, dataType.indexOf("[")) : dataType;//订阅时需要把[]去掉,在调用脚本引擎时进行分解
             String dataLocation = itemRule.length > 1 ? itemRule[1] : ""; //数据位置:代表从哪个算法结果中进行取值
@@ -402,7 +402,8 @@ public class DataProcess {//数据处理对象
                 }
                 if (MapTools.isNumber(itemRule[index])) {//数字代表从当前参数中取第N位,如果当前参数并不是List应该返回全部不应该返回空
                     //
-                    returnData = returnData instanceof List ? ((List<?>) returnData).get(Integer.parseInt(itemRule[index])) : returnData;
+                    int tempIndex = Integer.parseInt(itemRule[index]);
+                    returnData = returnData instanceof List<?> tempList && tempList.size() > tempIndex ? tempList.get(tempIndex) : returnData;
                 } else {//不是数字代表从当前参数中取对应的键,如果当前参数是List应该返回List中首个对应的键值
                     if (returnData instanceof Map) {//是MAP则直接获取对应Key的值
                         returnData = itemRule[index].equals("returnData") && Objects.isNull(((Map<?, ?>) returnData).get("returnData")) ? ((Map<?, ?>) returnData).get("dataContent") : ((Map<?, ?>) returnData).get(itemRule[index]);

+ 0 - 1
mainFactory/src/main/java/org/bfkj/application/ServiceInputControl.java

@@ -119,7 +119,6 @@ public class ServiceInputControl {
             }
             return ServiceInputControl.start(serviceId);
         }
-        ObjectMap.getordropMyDbHelper(serviceId, false);
         ObjectMap.getordropInput(serviceId,false);
         return processSuccess("重启成功");
     }

+ 11 - 0
mainFactory/src/main/java/org/bfkj/config/AppConfig.java

@@ -1,6 +1,7 @@
 package org.bfkj.config;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 
 public class AppConfig {
@@ -10,10 +11,20 @@ public class AppConfig {
     public static String WORK_ID;
     public static Integer SERVICE_ERR_MAX = 3; //服务最大连续异常次数
 
+    public static HashMap<String, HashSet<Object>> event6Map = new HashMap<>();//用于事件6是否存在的内存检测
+
     public static HashMap<String, String> staticEvent = new HashMap<>() {{
         put("select", "0");
         put("update", "2");
         put("insert", "1");
         put("delete", "3");
     }};
+
+
+    public static Map<String, String> eventSQL = new HashMap<>() {{//用于表名方式组建SQL的基本语句
+        put("0", "select 字段 from 表名");
+        put("1", "insert into 表名(字段) values(值) ");
+        put("2", "update 表名 set 值 ");
+        put("3", "delete from 表名 ");
+    }};
 }

+ 20 - 11
mainFactory/src/main/java/org/bfkj/protocol/FtpHandler.java

@@ -65,18 +65,23 @@ public class FtpHandler {
             String rootPath = ftp.printWorkingDirectory(); //ftp根目录
             FTPFile[] ftpFiles = ftp.listFiles(rootPath );
             if (ftpFiles.length == 0) {
+                System.out.println("没有找到文件");
                 ftp.logout();
                 return MapTools.processFail("没有找到文件");
             }
             List<File> files = new ArrayList<>();
             for (FTPFile ftpFile : ftpFiles) {
-                if (fileList.contains(ftpFile.getName())){
+                String tpFileName = ftpFile.getName();
+                System.out.println(tpFileName);
+                if (fileList.contains(tpFileName)){
                     String path = System.getProperty("user.dir") + File.separator + "ftp" + File.separator + ftpFile.getName();
                     File targetFile = new File(path);
                     files.add(targetFile);
-                    FileOutputStream fileOutputStream = new FileOutputStream(targetFile);
-                    ftp.retrieveFile(ftpFile.getName(), fileOutputStream);
-                    fileOutputStream.close();
+                    try ( FileOutputStream fileOutputStream = new FileOutputStream(targetFile);){
+                        ftp.retrieveFile(ftpFile.getName(), fileOutputStream);
+                    }catch (Exception e){
+                        System.out.println("数据下载异常".concat(LogUtils.getException(e)));
+                    }
                 }
             }
             ftp.logout();//退出ftp
@@ -85,14 +90,18 @@ public class FtpHandler {
                 String path = System.getProperty("user.dir") + File.separator + "ftp" + File.separator + ftpFile.getName();
                 File targetFile = new File(path);
                 if (targetFile.exists()) {
-                    GZIPInputStream gzipInputStream = new GZIPInputStream(Files.newInputStream(targetFile.toPath()));
-                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                    byte[] buf = new byte[BUFFER_SIZE];
-                    int len;
-                    while ((len = gzipInputStream.read(buf, 0, BUFFER_SIZE)) != -1) {
-                        baos.write(buf, 0, len);
+                    try(GZIPInputStream gzipInputStream = new GZIPInputStream(Files.newInputStream(targetFile.toPath()));
+                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                    ) {
+                        byte[] buf = new byte[BUFFER_SIZE];
+                        int len;
+                        while ((len = gzipInputStream.read(buf, 0, BUFFER_SIZE)) != -1) {
+                            baos.write(buf, 0, len);
+                        }
+                        fileContent.add(baos.toString(StandardCharsets.UTF_8));
+                    }catch (Exception e){
+                        System.out.println("数据解压异常".concat(LogUtils.getException(e)));
                     }
-                    fileContent.add(baos.toString(StandardCharsets.UTF_8));
                 }
             }
             return MapTools.processSuccess(fileContent);

+ 46 - 41
mainFactory/src/main/java/org/bfkj/protocol/WebAPI.java

@@ -1,6 +1,5 @@
 package org.bfkj.protocol;
 
-import jdk.jfr.ContentType;
 import org.bfkj.utils.LogUtils;
 import org.bfkj.utils.MapTools;
 import org.springframework.http.HttpEntity;
@@ -10,8 +9,7 @@ import org.springframework.http.converter.StringHttpMessageConverter;
 import org.springframework.web.client.RestTemplate;
 
 import java.nio.charset.StandardCharsets;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 
 public class WebAPI {
 
@@ -19,73 +17,78 @@ public class WebAPI {
     private String webapiURL;
 
     private HttpHeaders webApiHeader;
-    private Object defaultBody;
-
     private String webapiMethod;
 
+    private Map<String,Object> baseHeader = new HashMap<>();
+
     /**
      * webapi 执行入口函数
      */
-    public Map<String,Object> execWebApi(Object header, String method, Object body, String connectConfig) {
-        Map<String, Object>  connectConfigMaps = (Map<String, Object>) MapTools.strToObj(connectConfig);
-        Map<String,Object> restTemplateResult = initWebApiParams(connectConfigMaps); // 通过连接配置 获取restTemplate
+    public Map<String, Object> execWebApi(Object header, String method, Object defaultBody, String connectConfig) {
+        Map<String, Object> connectConfigMaps = (Map<String, Object>) MapTools.strToObj(connectConfig);
+        Map<String, Object> restTemplateResult = initWebApiParams(connectConfigMaps); // 通过连接配置 获取restTemplate
         if (!restTemplateResult.get("code").equals("0")) {
             return MapTools.processFail(restTemplateResult.get("message").toString());
         }
-        if (header instanceof Map ) {
-            Map<String, Object>  temeMap=  (Map) header;
-            if (!temeMap.isEmpty()){
+
+        if (header instanceof Map) {
+            Map<String, Object> temeMap = (Map) header;
+            if (!temeMap.isEmpty()) {
+                temeMap.putAll(baseHeader);
                 webApiHeader.clear();
                 for (String key : temeMap.keySet()) {
                     webApiHeader.add(key, temeMap.get(key).toString());
                 }
             }
         }
-        if (MapTools.isNotBlank(method)) {
-            webapiMethod = method.toLowerCase();
-        }
-        if (null !=body) {
-            defaultBody = body;
+        if (MapTools.isNotBlank(method)) webapiMethod = method.toLowerCase();
+        try {
+            List<Map<String, Object>> returnList = new ArrayList<>();
+            if (defaultBody instanceof List<?> tempList) {
+                for (Object o : tempList) {
+                    returnList.add(sendWebApiRequest(o));
+                }
+            } else {
+                returnList.add(sendWebApiRequest(defaultBody));
+            }
+            return (defaultBody instanceof List<?>) ? MapTools.processSuccess(returnList) : returnList.get(0);
+        } catch (Exception e) {
+            return MapTools.processFail("restTemplate执行异常" + LogUtils.getException(e));
         }
-        HttpEntity<Object> request = new HttpEntity<>(defaultBody, webApiHeader);
+    }
+
+    private Map<String, Object> sendWebApiRequest(Object defaultBody) {
         try {
+            HttpEntity<Object> request = new HttpEntity<>(defaultBody, webApiHeader);
             String responseEntity = null;
             switch (webapiMethod) {
-                case "get":
-                    responseEntity = restTemplate.getForObject(webapiURL, String.class, request);
-                    break;
-                case "put":
-                    restTemplate.put(webapiURL, request);
-                    break;
-                case "delete":
-                    restTemplate.delete(webapiURL, request);
-                    break;
-                default:
-                    responseEntity = restTemplate.postForObject(webapiURL, request, String.class);
-                    break;
+                case "get" -> responseEntity = restTemplate.getForObject(webapiURL, String.class, request);
+                case "put" -> restTemplate.put(webapiURL, request);
+                case "delete" -> restTemplate.delete(webapiURL, request);
+                default -> responseEntity = restTemplate.postForObject(webapiURL, request, String.class);
             }
             if (responseEntity == null && (webapiMethod.equals("put") || webapiMethod.equals("delete"))) {
                 return MapTools.processSuccess(null);
-
             }
             if (Objects.nonNull(responseEntity)) {
-                 return MapTools.processSuccess(responseEntity);
+                return MapTools.processSuccess(responseEntity);
             } else {
                 return MapTools.processFail("webapi发送请求失败 : " + responseEntity);
             }
-        } catch (Exception e) {
-            return MapTools.processFail("restTemplate执行异常" + LogUtils.getException(e));
+        }catch (Exception e){
+            return MapTools.processFail("发送请求失败 : ".concat(LogUtils.getException(e)));
         }
+
     }
 
-    public Map<String,Object> initWebApiParams(Map<String, Object> connectConfig) {
+    public Map<String, Object> initWebApiParams(Map<String, Object> connectConfig) {
         if (restTemplate == null) {
             if (Objects.isNull(connectConfig)) {
-                return MapTools.processFail("webapi请求配置参数为空" );
+                return MapTools.processFail("webapi请求配置参数为空");
             }
             webapiURL = Objects.nonNull(connectConfig.get("url")) ? connectConfig.get("url").toString() : null;
             if (Objects.isNull(webapiURL)) {
-                return MapTools.processFail("webapi请求地址为空" );
+                return MapTools.processFail("webapi请求地址为空");
             }
             Object tempHeaders = connectConfig.get("headers"); //需确定返回的是一个map对象还是字符串  headers: {ContentType:"JSON"}
             webApiHeader = new HttpHeaders();
@@ -93,20 +96,22 @@ public class WebAPI {
                 webApiHeader.setContentType(MediaType.APPLICATION_JSON);
             }
             if (tempHeaders instanceof Map) {
-                Map<String, Object> tempHeader = (Map) tempHeaders;
-                if (!tempHeader.isEmpty()) {
-                    for (String key : tempHeader.keySet()) {
-                        webApiHeader.add(key, tempHeader.get(key).toString());
+                baseHeader = (Map) tempHeaders;
+                if (!baseHeader.isEmpty()) {
+                    for (String key : baseHeader.keySet()) {
+                        webApiHeader.add(key, baseHeader.get(key).toString());
                     }
                 }
             }
-            defaultBody = connectConfig.get("body"); //需确定返回的是一个map对象还是字符串  headers: {ContentType:"JSON"}
             Object webMethod = connectConfig.get("method"); //需确定返回的是一个map对象还是字符串  headers: {ContentType:"JSON"}
             if (Objects.nonNull(webMethod)) {
                 webapiMethod = webMethod.toString().toLowerCase();
             } else {
                 webapiMethod = "post";
             }
+//            HttpComponentsClientHttpRequestFactory httpComponentsClientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory();
+//            httpComponentsClientHttpRequestFactory.setConnectTimeout(6000);
+//            httpComponentsClientHttpRequestFactory.setConnectionRequestTimeout(6000);
             restTemplate = new RestTemplate();
             restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
         }

+ 215 - 286
mainFactory/src/main/java/org/bfkj/utils/DataFormat.java

@@ -96,326 +96,256 @@ public class DataFormat {
         return tempIndex == str.length() ? str : str.substring(0, tempIndex);
     }
 
-    public static void main(String[] args) {
-//        String xx = "{BSM0G\\r\\n.R/+ACT/LD/B/S/1\\r\\nENDBPM\\r\\n\",\"dataObjectId\":\"167894111307300001000100\"}{\"dataContent\":\"QP CABDPCA\\r\\n.HKGBMCA 161231\\r\\nBPM\\r\\n.V/1LHKG\\r\\n.J/R/JAT/H92165/16MAR/123150L\\r\\n.F/CA0112/16MAR/PEK/Y\\r\\n.U/AKE29241CA//M/Y/PEK\\r\\n.N/3999456596001\\r\\n.Q/019\\r\\n.S/Y/55C/C/118//Y\\r\\n.P/1ZHONG/WEIGIANG\\r\\n.L/NBE0JY\\r\\nENDBPM\\r\\n\",\"dataObjectId\":\"167894111357600001000100\"}{\"dataContent\":\"CABDPCA\\r\\n.FRAHQ0A 160431\\r\\nBPM\\r\\n.V/1LPEK\\r\\n.J/R/13301/4693/16MAR/1231L/T2FJP43\\r\\n.F/CA1257/16MAR/KRL/Y\\r\\n.U/DOU41257CA//X/Y/KRL\\r\\n.N/3999431112001\\r\\n.Q/040\\r\\n.S/Y/12C/C/117//Y\\r\\n.P/RONGHONGQING\\r\\n.Y/CA006362841835\\r\\n.L/PFRGZG\\r\\n.R/+ACT/LD/B/S/1\\r\\nENDBPM\\r\\n\",\"dataObjectId\":\"167894111399100001000100\"}{\"dataContent\":\"QD CABDPCA\\r\\n.PEKBS1E 161231\\r\\nBSM\\r\\nCHG\\r\\n.V/1LPEK\\r\\n.F/CA1541/16MAR/NGB/Y\\r\\n.N/3999362826001\\r\\n.D/SELF//16MAR/1231L//BJS159627\\r\\n.S/Y/18L/C/046//Y//A\\r\\n.W/K/1/9\\r\\n.P/1ZHANGHONGHAI\\r\\n.Y/CA005317156803\\r\\n.L/PX201T\\r\\n.T/159627\\r\\nENDBSM}";
-
-//        HashMap<String, String> objectObjectHashMap = new HashMap<>();
-//        objectObjectHashMap.put("dataType", "dataType");
-//        objectObjectHashMap.put("dataState", "dataState");
-//        objectObjectHashMap.put(".B1", "abnormalState");
-//        objectObjectHashMap.put(".B2", "luggageNum");
-//        objectObjectHashMap.put(".N/1", "luggageNum");
-//        objectObjectHashMap.put(".C/", "groupName");
-//        objectObjectHashMap.put(".D/1", "checkInLocation");
-//        objectObjectHashMap.put(".D/2", "checkInLocationDescription");
-//        objectObjectHashMap.put(".D/3.D/4", "checkInDate");
-//        objectObjectHashMap.put(".D/5", "transportMedium");
-//        objectObjectHashMap.put(".D/6", "transportID");
-//        objectObjectHashMap.put(".E/", "specialType");
-//        objectObjectHashMap.put(".F/1", "flightNo");
-//        objectObjectHashMap.put(".F/2", "flightDate");
-//        objectObjectHashMap.put(".F/3", "target_airport");
-//        objectObjectHashMap.put(".F/4", "passenger_cabin");
-//        objectObjectHashMap.put(".G/1", "groundtransportationDateStar");
-//        objectObjectHashMap.put(".G/2", "groundtransportationDateEnd");
-//        objectObjectHashMap.put(".G/3", "groundtransportationAddress");
-//        objectObjectHashMap.put(".H/1", "doTerminal");
-//        objectObjectHashMap.put(".H/2", "operationArea");
-//        objectObjectHashMap.put(".H/3", "operatingPosition");
-//        objectObjectHashMap.put(".I/1", "inflightNo");
-//        objectObjectHashMap.put(".I/2", "inflightDate");
-//        objectObjectHashMap.put(".I/3", "inairport");
-//        objectObjectHashMap.put(".I/4", "inpassenger_cabin");
-//        objectObjectHashMap.put(".J/1", "secondary_code");
-//        objectObjectHashMap.put(".J/2", "agentNumber");
-//        objectObjectHashMap.put(".J/3", "device_ID");
-//        objectObjectHashMap.put(".J/4.J/5", "processing_time");
-//        objectObjectHashMap.put(".J/6", "location_code");
-//        objectObjectHashMap.put(".J/7", "to_location_code");
-//        objectObjectHashMap.put(".J/8", "location_describe");
-//        objectObjectHashMap.put(".J/9", "to_location_describe");
-//        objectObjectHashMap.put(".L/", "PNRNO");
-//        objectObjectHashMap.put(".O/1", "transferFlightNO");
-//        objectObjectHashMap.put(".O/2", "transferFlightDate");
-//        objectObjectHashMap.put(".O/3", "transferAirport");
-//        objectObjectHashMap.put(".P/", "passengerName");
-//        objectObjectHashMap.put(".Q/", "loadNumber");
-//        objectObjectHashMap.put(".R/", "luggage_describe");
-//        objectObjectHashMap.put(".S/4", "checkin_number");
-//        objectObjectHashMap.put(".S/5", "security_number");
-//        objectObjectHashMap.put(".S/6", "passengerinfoState");
-//        objectObjectHashMap.put(".S/7", "cantransportation");
-//        objectObjectHashMap.put(".S/8", "activeState");
-//        objectObjectHashMap.put(".S/1", "canLoad");
-//        objectObjectHashMap.put(".S/2", "seatNum");
-//        objectObjectHashMap.put(".S/3", "passengerState");
-//        objectObjectHashMap.put(".T/", "printerID");
-//        objectObjectHashMap.put(".U/1", "container_ID");
-//        objectObjectHashMap.put(".U/2", "loadAddress");
-//        objectObjectHashMap.put(".U/3", "luggageType");
-//        objectObjectHashMap.put(".V/2", "sourceAirport");
-//        objectObjectHashMap.put(".V/1", "sourceSign");
-//        objectObjectHashMap.put(".V/3", "sourceOther");
-//        objectObjectHashMap.put("creation_time", "creation_time");
-//        objectObjectHashMap.put("dataObjectId", "dataObjectId");
-//        objectObjectHashMap.put("sourceData", "sourceData");
-//        objectObjectHashMap.put(".W/2", "luggageCount");
-//        objectObjectHashMap.put(".W/3", "luggageWeight");
-//        objectObjectHashMap.put(".W/1", "weightUnit");
-//        objectObjectHashMap.put(".W/5", "luggageSize");
-//        objectObjectHashMap.put(".W/9", "externalFeatures");
-//        objectObjectHashMap.put(".X/1", "securityInspectionDescription");
-//        objectObjectHashMap.put(".X/2", "securityInspectionResults");
-//        objectObjectHashMap.put(".X/3", "reasonsForSecurity");
-//        objectObjectHashMap.put(".X/4", "securityInspectionMethod");
-//        objectObjectHashMap.put(".Y/1", "frequentflyerNO");
-//        objectObjectHashMap.put(".Y/2", "frequentflyerGrade");
-//        System.out.println(typeBToMap(xx,"11111111111111",objectObjectHashMap));
-//
-//        String typeStr = "{1}{2}";
-//
-//        System.out.println(typeStrList);
-    }
-
-
-    public static Map<String, Object> typeBToMap(String typeStr, String dataObjectId, Map<String, String> transMaps) {
+    public static Map<String, Object> typeBToMap(Object typeStr, String dataObjectId, Map<String, String> transMaps) {
         try {
-            if (MapTools.isBlank(typeStr)) {
-                return MapTools.processSuccess(null);
+            if (Objects.isNull(typeStr)) return MapTools.processSuccess(null);
+            if (Objects.isNull(transMaps)) transMaps = new HashMap<>();
+            List<Object> tempList = new ArrayList<>();
+            if (typeStr instanceof List<?> tempInList) {
+                tempList.addAll(tempInList);
+            } else {
+                tempList.add(typeStr);
             }
-            if (Objects.isNull(transMaps)) {
-                transMaps = new HashMap<>();
+            List<Map<String, Object>> rsList = new ArrayList<>();
+            for (Object o : tempList) {
+                String inData = Objects.toString(o);
+                if (MapTools.isBlank(inData)) continue;
+                int dataObjectIdIndex = inData.indexOf("dataObjectId");
+                String tpDataObjectId = inData.length() > 39 ? inData.substring(dataObjectIdIndex + 15, dataObjectIdIndex + 39) : null;
+                rsList.addAll(typebHandler(inData, transMaps, MapTools.isBlank(tpDataObjectId) ? dataObjectId : tpDataObjectId));
             }
-            List<String> typeStrList = MapTools.patternContent(typeStr, "\\{(.+?)\\}");
-            //设定报文提取规则MAP,此MAP应该放到类变量中,属于常量,没必要每次调用都去创建:未来从配置文件或者数据库读取TypeB的所有数据格式,只是目前只支持BSM和BPM,未来可以加
-            List<Map<String, Object>> returnDataList = new ArrayList<>();//初始化一个最终返回的数组
-            for (String dataType : messageRules.keySet()) {//循环报文提取规则MAP:为了兼容一条字符串中既有BSM又有BPM的情况
-                List<String> messagList = new ArrayList<>();
-                for (String tempTypeStr : typeStrList) {
-                    if (tempTypeStr.indexOf("dataObjectId") > 0) {
-                        String tempDataObjectId = tempTypeStr.substring(tempTypeStr.indexOf("dataObjectId"));
-                        dataObjectId = tempDataObjectId.replaceAll("[^0-9]+", "");
-                    }
-                    List<String> tempMessageList = MapTools.patternContent(tempTypeStr, messageRules.get(dataType)); //使用对应的提取正则表达式进行报文提取
-                    if (tempMessageList.size() > 0) {
-                        messagList.addAll(tempMessageList);
-                    } else {
-                        if (tempTypeStr.contains(dataType)) {
-                            HashMap<String, Object> errorMap = new HashMap<>();
-                            errorMap.put("dataObjectId", dataObjectId);
-                            errorMap.put("errMessage", "报文数据格式错误");
-                            errorMap.put("sourceData", tempTypeStr);
-                            if (!returnDataList.contains(errorMap)) {
-                                returnDataList.add(errorMap);
-                            }
+            return processSuccess(rsList);
+        } catch (Exception e) {
+            return processFail(LogUtils.getException(e));
+        }
+    }
+
+
+    public static List<Map<String, Object>> typebHandler(String typeStr, Map<String, String> transMaps, String dataObjectId) {
+        List<String> typeStrList = MapTools.patternContent(typeStr, "\\{(.+?)\\}");
+        //设定报文提取规则MAP,此MAP应该放到类变量中,属于常量,没必要每次调用都去创建:未来从配置文件或者数据库读取TypeB的所有数据格式,只是目前只支持BSM和BPM,未来可以加
+        List<Map<String, Object>> returnDataList = new ArrayList<>();//初始化一个最终返回的数组
+        for (String dataType : messageRules.keySet()) {//循环报文提取规则MAP:为了兼容一条字符串中既有BSM又有BPM的情况
+            List<String> messagList = new ArrayList<>();
+            for (String tempTypeStr : typeStrList) {
+                if (tempTypeStr.indexOf("dataObjectId") > 0) {
+                    String tempDataObjectId = tempTypeStr.substring(tempTypeStr.indexOf("dataObjectId"));
+                    dataObjectId = tempDataObjectId.replaceAll("[^0-9]+", "");
+                }
+                List<String> tempMessageList = MapTools.patternContent(tempTypeStr, messageRules.get(dataType)); //使用对应的提取正则表达式进行报文提取
+                if (tempMessageList.size() > 0) {
+                    messagList.addAll(tempMessageList);
+                } else {
+                    if (tempTypeStr.contains(dataType)) {
+                        HashMap<String, Object> errorMap = new HashMap<>();
+                        errorMap.put("dataObjectId", dataObjectId);
+                        errorMap.put("errMessage", "报文数据格式错误");
+                        errorMap.put("sourceData", tempTypeStr);
+                        if (!returnDataList.contains(errorMap)) {
+                            returnDataList.add(errorMap);
                         }
                     }
                 }
-                for (String signData : messagList) {//循环提取到的报文数组中每一条报文
-                    Map<String, Object> signDataMap = new HashMap<>();//创建一个当前报文的MAP
-                    signDataMap.put("dataType", dataType);//默认报文类型
-                    signDataMap.put("dataObjectId", dataObjectId); //默认生命周期ID
-                    signDataMap.put("sourceData", signData); //默认原始报文--因为要记录完整的原始报文,所以不去头不去尾
-                    String[] rowDataList = signData.split("(?=\\.[A-Z]{1}\\/)");//使用.字母/进行分组,获得行数据
-                    //获取第一行的数据:第一行,BPM为空,BSM直接使用indexOf判断即可
-                    signDataMap.put("dataState", dataType.equals("BSM") ? (rowDataList[0].contains("DEL") ? "DEL" : (rowDataList[0].contains("CHG") ? "CHG" : "ADD")) : null);
-                    List<Map<String, Object>> containerList = new ArrayList<>();//容器数组
-                    List<Map<String, Object>> luggageList = new ArrayList<>();//行李数组
-                    for (int rowNum = 1; rowNum < rowDataList.length; rowNum++) {  //循环行数据
-                        String rowDataStr = rowDataList[rowNum];//获取单行数据
-                        String rowType = rowDataStr.substring(0, 3);//头三位是行标识
-                        if (".B/.N/".contains(rowType)) {//如果是.B\.N开头则//luggageList = getluggageNumList(rowDataStr);//--单独一个方法处理
-                            List<String> luggageNumList = new ArrayList<>();//默认行李牌号数组为空数组
-                            String luggageState = null;//默认行李状态为NULL
-                            String[] colList = rowDataStr.split("\\/");//使用\进行分组,获得列数据
-                            for (int colNum = 1; colNum < colList.length; colNum++) {//循环
-                                String colValue = colList[colNum].trim();//去空格 OFF,3666149457002
-                                colValue = replaceWrap(colValue);
-                                if (MapTools.isNumber(colValue) && colValue.length() == 13) {//如果是13位数字则
-                                    String luggageNum = colValue.substring(0, 10);////获取前10位--开始行李牌号
-                                    for (int loopNum = 0; loopNum < Integer.parseInt(colValue.substring(10, 13)); loopNum++) {//循环连续行李数
-                                        luggageNum = String.format("%010d", (Long.parseLong(luggageNum) + loopNum)); //计算行李牌号,注意不足10位时前面补0:0999123456变数字后是9位
-                                        luggageNumList.add(luggageNum);//添加到行李牌号数组 3666149457,3666149458
-                                    }
-                                } else {//
-                                    luggageState = MapTools.isNotBlank(colValue) ? colValue.substring(0, 3) : null;//更新行李状态
+            }
+            for (String signData : messagList) {//循环提取到的报文数组中每一条报文
+                Map<String, Object> signDataMap = new HashMap<>();//创建一个当前报文的MAP
+                signDataMap.put("dataType", dataType);//默认报文类型
+                signDataMap.put("dataObjectId", dataObjectId); //默认生命周期ID
+                signDataMap.put("sourceData", signData); //默认原始报文--因为要记录完整的原始报文,所以不去头不去尾
+                String[] rowDataList = signData.split("(?=\\.[A-Z]{1}\\/)", -1);//使用.字母/进行分组,获得行数据
+                //获取第一行的数据:第一行,BPM为空,BSM直接使用indexOf判断即可
+                signDataMap.put("dataState", dataType.equals("BSM") ? (rowDataList[0].contains("DEL") ? "DEL" : (rowDataList[0].contains("CHG") ? "CHG" : "ADD")) : null);
+                List<Map<String, Object>> containerList = new ArrayList<>();//容器数组
+                List<Map<String, Object>> luggageList = new ArrayList<>();//行李数组
+                for (int rowNum = 1; rowNum < rowDataList.length; rowNum++) {  //循环行数据
+                    String rowDataStr = rowDataList[rowNum];//获取单行数据
+                    String rowType = rowDataStr.substring(0, 3);//头三位是行标识
+                    if (".B/.N/".contains(rowType)) {//如果是.B\.N开头则//luggageList = getluggageNumList(rowDataStr);//--单独一个方法处理
+                        List<String> luggageNumList = new ArrayList<>();//默认行李牌号数组为空数组
+                        String luggageState = null;//默认行李状态为NULL
+                        String[] colList = rowDataStr.split("\\/", -1);//使用\进行分组,获得列数据
+                        for (int colNum = 1; colNum < colList.length; colNum++) {//循环
+                            String colValue = colList[colNum].trim();//去空格 OFF,3666149457002
+                            colValue = replaceWrap(colValue);
+                            if (MapTools.isNumber(colValue) && colValue.length() == 13) {//如果是13位数字则
+                                String luggageNum = colValue.substring(0, 10);////获取前10位--开始行李牌号
+                                for (int loopNum = 0; loopNum < Integer.parseInt(colValue.substring(10, 13)); loopNum++) {//循环连续行李数
+                                    luggageNum = String.format("%010d", (Long.parseLong(luggageNum) + loopNum)); //计算行李牌号,注意不足10位时前面补0:0999123456变数字后是9位
+                                    luggageNumList.add(luggageNum);//添加到行李牌号数组 3666149457,3666149458
                                 }
-                            }
-                            for (String luggageNum : luggageNumList) {//循环行李牌号数组
-                                Map<String, Object> luggageMap = new HashMap<>();
-                                luggageMap.put("luggageNum", luggageNum);
-                                luggageMap.put("abnormalState", luggageState);
-                                luggageList.add(luggageMap);//追加到行李数组中{行李牌号,行李状态}
+                            } else {//
+                                luggageState = MapTools.isNotBlank(colValue) ? colValue.substring(0, 3) : null;//更新行李状态
                             }
                         }
-                        //如果是.C\.E\.L\.M\.P\.Q\.R\.Q\.T开头则//去头写入当前行MAP{"对应数据库字段名",值(,号分割的字符串)
-                        if (".C/.E/.L/.M/.P/.Q/.R/.T/".contains(rowType)) {
-                            rowDataStr = rowDataStr.replace(rowType, "").trim();//去头去空格
+                        for (String luggageNum : luggageNumList) {//循环行李牌号数组
+                            Map<String, Object> luggageMap = new HashMap<>();
+                            luggageMap.put("luggageNum", luggageNum);
+                            luggageMap.put("abnormalState", luggageState);
+                            luggageList.add(luggageMap);//追加到行李数组中{行李牌号,行李状态}
+                        }
+                    }
+                    //如果是.C\.E\.L\.M\.P\.Q\.R\.Q\.T开头则//去头写入当前行MAP{"对应数据库字段名",值(,号分割的字符串)
+                    if (".C/.E/.L/.M/.P/.Q/.R/.T/".contains(rowType)) {
+                        rowDataStr = rowDataStr.replace(rowType, "").trim();//去头去空格
 //                            rowDataStr = rowDataStr.indexOf("\\") > 0 ? rowDataStr.substring(0, rowDataStr.indexOf("\\") - 1) : rowDataStr;//去换行符
-                            rowDataStr = replaceWrap(rowDataStr);
-                            if (".P/".equals(rowType)) {//姓名需要去掉首位数字和分割符
-                                rowDataStr = rowDataStr.replaceAll("[(0-9)]", "").replaceAll("\\/", "");
-                            }
-                            if (Objects.nonNull(transMaps.get(rowType))) {
-                                signDataMap.put(transMaps.get(rowType), (signDataMap.containsKey(rowType) ? signDataMap.get(rowType) + "," : "") + rowDataStr);
-                            }
+                        rowDataStr = replaceWrap(rowDataStr);
+                        if (".P/".equals(rowType)) {//姓名需要去掉首位数字和分割符
+                            rowDataStr = rowDataStr.replaceAll("[(0-9)]", "").replaceAll("\\/", "");
                         }
-                        //如果是.D\.F\.G\.H\.I\.J\.O\.S\.W\.X\.Y开头则只记录第一个,存在则不覆盖
-                        if (".D/.F/.G/.H/.I/.J/.O/.S/.W/.X/.Y/".contains(rowType) && !signDataMap.containsKey(rowType + "1")) {
-                            String[] colList = rowDataStr.split("\\/");//使用\进行分组,获得列数据
-                            for (int colNum = 1; colNum < colList.length; colNum++) {//循环
-                                String colValue = colList[colNum].trim();//去空格
-                                colValue = replaceWrap(colValue);
-                                //如果是日期则使用日期转换方法进行转换(08APR)(注意跨年处理)".F/"".I/"".O/"有日期,".D/"".J/"有日期和时间
-                                if (".F/.I/.O/.D/.J/".contains(rowType)) {
-                                    String patternValue = MapTools.patternKey(colValue, "[0-3]{1}[0-9]{1}(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)");
-                                    if (!MapTools.isBlank(patternValue)) {
-                                        colValue = TypeBDateChange(patternValue, null);
-                                        signDataMap.put(rowType.equals(".D/") ? ".D/3" : (rowType.equals(".J/") ? ".J/4" : (rowType + "2")), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
-                                    }
-                                    if (".F/.I/.O/".contains(rowType) && MapTools.isNotBlank(colValue)) {
-                                        if (colValue.length() == 3 && !MapTools.isBlank(MapTools.patternKey(colValue, "[A-z]{3}"))) {
-                                            if (!signDataMap.containsKey(transMaps.get(rowType + "3"))) {
-                                                signDataMap.put(transMaps.get(rowType + "3"), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
-                                            }
-                                        }
-                                        if (colNum == 1) {
-                                            String temp = colValue.substring(2);
-                                            signDataMap.put(transMaps.get(rowType + "1"), colValue.substring(0, 2) + ((MapTools.isNumber(temp.substring(temp.length() - 1)) ? String.format("%4s", temp) : String.format("%5s", temp)).replace(" ", "0")));//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
+                        if (Objects.nonNull(transMaps.get(rowType))) {
+                            signDataMap.put(transMaps.get(rowType), (signDataMap.containsKey(rowType) ? signDataMap.get(rowType) + "," : "") + rowDataStr);
+                        }
+                    }
+                    //如果是.D\.F\.G\.H\.I\.J\.O\.S\.W\.X\.Y开头则只记录第一个,存在则不覆盖
+                    if (".D/.F/.G/.H/.I/.J/.O/.S/.W/.X/.Y/".contains(rowType) && !signDataMap.containsKey(rowType + "1")) {
+                        String[] colList = rowDataStr.split("\\/", -1);//使用\进行分组,获得列数据
+                        for (int colNum = 1; colNum < colList.length; colNum++) {//循环
+                            String colValue = colList[colNum].trim();//去空格
+                            colValue = replaceWrap(colValue);
+                            //如果是日期则使用日期转换方法进行转换(08APR)(注意跨年处理)".F/"".I/"".O/"有日期,".D/"".J/"有日期和时间
+                            if (".F/.I/.O/.D/.J/".contains(rowType)) {
+                                String patternValue = MapTools.patternKey(colValue, "[0-3]{1}[0-9]{1}(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)");
+                                if (!MapTools.isBlank(patternValue)) {
+                                    colValue = TypeBDateChange(patternValue, null);
+                                    signDataMap.put(rowType.equals(".D/") ? ".D/3" : (rowType.equals(".J/") ? ".J/4" : (rowType + "2")), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
+                                }
+                                if (".F/.I/.O/".contains(rowType) && MapTools.isNotBlank(colValue)) {
+                                    if (colValue.length() == 3 && !MapTools.isBlank(MapTools.patternKey(colValue, "[A-z]{3}"))) {
+                                        if (!signDataMap.containsKey(transMaps.get(rowType + "3"))) {
+                                            signDataMap.put(transMaps.get(rowType + "3"), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
                                         }
                                     }
-                                    if ((rowType + "" + colNum).equals(".J/5") || (rowType + "" + colNum).equals(".D/4")) {
-                                        colValue = TypeBDateChange(null, colValue);
+                                    if (colNum == 1) {
+                                        String temp = colValue.substring(2);
+                                        signDataMap.put(transMaps.get(rowType + "1"), colValue.substring(0, 2) + ((MapTools.isNumber(temp.substring(temp.length() - 1)) ? String.format("%4s", temp) : String.format("%5s", temp)).replace(" ", "0")));//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
                                     }
                                 }
-                                if (".S/".contains(rowType) && MapTools.isNotBlank(colValue)) {
-                                    if ("I,V,A".contains(colValue) && colValue.length() == 1 && !signDataMap.containsKey(transMaps.get(".S/8"))) {
-                                        signDataMap.put(transMaps.get(".S/8"), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
-                                    }
+                                if ((rowType + "" + colNum).equals(".J/5") || (rowType + "" + colNum).equals(".D/4")) {
+                                    colValue = TypeBDateChange(null, colValue);
                                 }
-                                if (".X/".contains(rowType) && MapTools.isNotBlank(colValue)) {
-                                    if (colValue.length() == 3) {
-                                        if ("CLR,RFJ,UCL".contains(colValue)) {
-                                            signDataMap.put(transMaps.get(".X/2"), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
-                                        } else {
-                                            signDataMap.put(transMaps.get(".X/1"), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
-                                        }
-                                    }
+                            }
+                            if (".S/".contains(rowType) && MapTools.isNotBlank(colValue)) {
+                                if ("I,V,A".contains(colValue) && colValue.length() == 1 && !signDataMap.containsKey(transMaps.get(".S/8"))) {
+                                    signDataMap.put(transMaps.get(".S/8"), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
                                 }
-                                //如果是时间则使用时间转换方法进行转换转换(082512;082512L;082512Z,0825;0825L;0825Z)(注意没有结尾字母则是)".D/"".J/"有日期和时间
-                                //如果是日期时间则使用日期时间转换方法进行转换转换".G/"有日期时间(25NOV1600)
-                                //如果同时存在日期和时间".D/"".J/"有日期和时间
-                                String key = rowType + "" + colNum;
-                                if (".D/3.D/4.J/4.J/5".contains(rowType + "" + colNum)) {
-                                    if (!signDataMap.containsKey(key)) {
-                                        signDataMap.put(rowType + "" + colNum, colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
+                            }
+                            if (".X/".contains(rowType) && MapTools.isNotBlank(colValue)) {
+                                if (colValue.length() == 3) {
+                                    if ("CLR,RFJ,UCL".contains(colValue)) {
+                                        signDataMap.put(transMaps.get(".X/2"), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
+                                    } else {
+                                        signDataMap.put(transMaps.get(".X/1"), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
                                     }
-                                } else {
-                                    if (Objects.nonNull(transMaps.get(rowType + "" + colNum))) {
-                                        if (!signDataMap.containsKey(transMaps.get(key))) {
-                                            signDataMap.put(transMaps.get(rowType + "" + colNum), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
-                                        }
+                                }
+                            }
+                            //如果是时间则使用时间转换方法进行转换转换(082512;082512L;082512Z,0825;0825L;0825Z)(注意没有结尾字母则是)".D/"".J/"有日期和时间
+                            //如果是日期时间则使用日期时间转换方法进行转换转换".G/"有日期时间(25NOV1600)
+                            //如果同时存在日期和时间".D/"".J/"有日期和时间
+                            String key = rowType + "" + colNum;
+                            if (".D/3.D/4.J/4.J/5".contains(rowType + "" + colNum)) {
+                                if (!signDataMap.containsKey(key)) {
+                                    signDataMap.put(rowType + "" + colNum, colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
+                                }
+                            } else {
+                                if (Objects.nonNull(transMaps.get(rowType + "" + colNum))) {
+                                    if (!signDataMap.containsKey(transMaps.get(key))) {
+                                        signDataMap.put(transMaps.get(rowType + "" + colNum), colValue);//写入当前行MAP{"对应数据库字段名",值(不覆盖)}
                                     }
                                 }
-
                             }
-                            // 处理D3D4 //J4J5
+
+                        }
+                        // 处理D3D4 //J4J5
 //                            "D3D4": "checkInDate",
-                            if (Objects.nonNull(signDataMap.get(".D/3")) && Objects.nonNull(signDataMap.get(".D/4"))) {
-                                String d4 = signDataMap.get(".D/4").toString();
-                                signDataMap.put("checkInTimeType", d4.substring(d4.length() - 1));
-                                signDataMap.put(transMaps.get(".D/3.D/4"), (signDataMap.get(".D/3") + " " + d4.substring(0, d4.length() - 1)).trim());
-                                signDataMap.remove(".D/3");
-                                signDataMap.remove(".D/4");
-                            }
-                            if (Objects.nonNull(signDataMap.get(".J/4")) && Objects.nonNull(signDataMap.get(".J/5"))) {
-                                String J5 = signDataMap.get(".J/5").toString();
-                                signDataMap.put("processTimeType", J5.substring(J5.length() - 1));
-                                signDataMap.put(transMaps.get(".J/4.J/5"), (signDataMap.get(".J/4") + " " + J5.substring(0, J5.length() - 1)).trim());
-                                signDataMap.remove(".J/4");
-                                signDataMap.remove(".J/5");
-                            }
+                        if (Objects.nonNull(signDataMap.get(".D/3")) && Objects.nonNull(signDataMap.get(".D/4"))) {
+                            String d4 = signDataMap.get(".D/4").toString();
+                            signDataMap.put("checkInTimeType", d4.substring(d4.length() - 1));
+                            signDataMap.put(transMaps.get(".D/3.D/4"), (signDataMap.get(".D/3") + " " + d4.substring(0, d4.length() - 1)).trim());
+                            signDataMap.remove(".D/3");
+                            signDataMap.remove(".D/4");
                         }
-                        if (".V/".equals(rowType) && !signDataMap.containsKey(rowType + "1")) {//存在则不覆盖
-                            signDataMap.put(transMaps.get(".V/1"), rowDataStr.substring(4, 5));//写入当前行MAP{"来源标识",值}
-                            signDataMap.put(transMaps.get(".V/2"), rowDataStr.substring(5, 8));//写入当前行MAP{"来源机场",值}
+                        if (Objects.nonNull(signDataMap.get(".J/4")) && Objects.nonNull(signDataMap.get(".J/5"))) {
+                            String J5 = signDataMap.get(".J/5").toString();
+                            signDataMap.put("processTimeType", J5.substring(J5.length() - 1));
+                            signDataMap.put(transMaps.get(".J/4.J/5"), (signDataMap.get(".J/4") + " " + J5.substring(0, J5.length() - 1)).trim());
+                            signDataMap.remove(".J/4");
+                            signDataMap.remove(".J/5");
                         }
-                        if (".U/".equals(rowType)) {//如果是.U开头则----出现两个.U的需要单独处理
-                            Map<String, Object> containerMap = new HashMap<>();//创建一个当前报文的MAP
-                            String[] colList = rowDataStr.split("\\/");//使用\进行分组,获得列数据
-                            for (int colNum = 1; colNum < colList.length; colNum++) {//循环
-                                String colValue = colList[colNum];//去空格
-//                                colValue = colValue.indexOf("\\r\\n") > 0 ? colValue.substring(0, colValue.indexOf("\\r\\n") - 1) : colValue;//去换行符
-                                colValue = replaceWrap(colValue);
-                                if (Objects.nonNull(transMaps.get(rowType + "" + colNum))) {
-                                    containerMap.put(transMaps.get(rowType + "" + colNum), colValue);//写入容器MAP
-                                }
-
+                    }
+                    if (".V/".equals(rowType) && !signDataMap.containsKey(rowType + "1")) {//存在则不覆盖
+                        signDataMap.put(transMaps.get(".V/1"), rowDataStr.substring(4, 5));//写入当前行MAP{"来源标识",值}
+                        signDataMap.put(transMaps.get(".V/2"), rowDataStr.substring(5, 8));//写入当前行MAP{"来源机场",值}
+                    }
+                    if (".U/".equals(rowType)) {//如果是.U开头则----出现两个.U的需要单独处理
+                        Map<String, Object> containerMap = new HashMap<>();//创建一个当前报文的MAP
+                        String[] colList = rowDataStr.split("\\/", -1);//使用\进行分组,获得列数据
+                        for (int colNum = 1; colNum < colList.length; colNum++) {//循环
+                            String colValue = colList[colNum];//去空格
+                            colValue = replaceWrap(colValue);
+                            if (Objects.nonNull(transMaps.get(rowType + "" + colNum))) {
+                                containerMap.put(transMaps.get(rowType + "" + colNum), colValue);//写入容器MAP
                             }
-                            containerList.add(containerMap);//添加到容器数组中
+
                         }
+                        containerList.add(containerMap);//添加到容器数组中
                     }
+                }
 
-                    //处理容器以及行李数组
-                    if (containerList.size() == 0) {//为0时添加空MAP,方便下面的循环
-                        containerList.add(new HashMap<>());
-                    }
-                    if (containerList.size() > 2) {//最多两个容器,否则是异常数据,整个报文都作废
-                        signDataMap.put("errMessage", "容器数量超规 " + containerList.size());//只需要标记错误,因为已经有原始报文存在
-                        Map<String, Object> containerMap = containerList.get(0);
-                        containerList = new ArrayList<>() {{
-                            add(containerMap);
-                        }};
+                //处理容器以及行李数组
+                if (containerList.size() == 0) {//为0时添加空MAP,方便下面的循环
+                    containerList.add(new HashMap<>());
+                }
+                if (containerList.size() > 2) {//最多两个容器,否则是异常数据,整个报文都作废
+                    signDataMap.put("errMessage", "容器数量超规 " + containerList.size());//只需要标记错误,因为已经有原始报文存在
+                    Map<String, Object> containerMap = containerList.get(0);
+                    containerList = new ArrayList<>() {{
+                        add(containerMap);
+                    }};
 //                        returnDataList.add(signDataMap);//添加到返回数组中
+                }
+                for (int containerNum = 0; containerNum < containerList.size(); containerNum++) {//循环容器数组
+                    HashMap<String, Object> tempDataMapClone = MapTools.clone(signDataMap);
+                    HashMap<String, Object> tempDataMap = Objects.isNull(tempDataMapClone) ? new HashMap<>() : tempDataMapClone;  //深拷贝添加到单条报文的MAP中
+                    Map<String, Object> containerMap = containerList.get(containerNum);//获取当前容器数据
+                    if (containerNum == 0 && containerList.size() > 1) {//如果当前是第一条且容器数组大于代表第一个容器是卸下,第二个容器是
+                        containerMap.put("containerState", "OFF");//添加容器状态为OFF,代表卸下
                     }
-                    for (int containerNum = 0; containerNum < containerList.size(); containerNum++) {//循环容器数组
-                        HashMap<String, Object> tempDataMapClone = MapTools.clone(signDataMap);
-                        HashMap<String, Object> tempDataMap = Objects.isNull(tempDataMapClone) ? new HashMap<>() : tempDataMapClone;  //深拷贝添加到单条报文的MAP中
-                        Map<String, Object> containerMap = containerList.get(containerNum);//获取当前容器数据
-                        if (containerNum == 0 && containerList.size() > 1) {//如果当前是第一条且容器数组大于代表第一个容器是卸下,第二个容器是
-                            containerMap.put("containerState", "OFF");//添加容器状态为OFF,代表卸下
-                        }
-                        if (!containerMap.isEmpty()) {//如果当前容器数据不是空
-                            tempDataMap.putAll(containerMap);//深拷贝添加到单条报文的MAP中
-                        }
-                        tempDataMap.values().removeAll(Collections.singleton(null));
-                        tempDataMap.values().removeAll(Collections.singleton(""));
-                        if (luggageList.size() == 0) {
-                            returnDataList.add(specialHandler(tempDataMap, dataObjectId)); //只有容器没有行李:整箱操作
-                        } else {
-                            for (Map<String, Object> tempLuggageMap : luggageList) {//循环行李数组
-                                if (containerNum == 0 && containerList.size() > 1 && tempLuggageMap.get("abnormalState") == null) {//只添加.B行李
-                                    continue;
-                                }
-                                if (containerNum != 0 && containerList.size() > 1 && tempLuggageMap.get("abnormalState") != null) {//只添加.N行李
-                                    continue;
-                                }
-                                HashMap<String, Object> objectObjectHashMap = new HashMap<>();
-                                objectObjectHashMap.putAll(tempDataMap);
-                                objectObjectHashMap.putAll(tempLuggageMap);
+                    if (!containerMap.isEmpty()) {//如果当前容器数据不是空
+                        tempDataMap.putAll(containerMap);//深拷贝添加到单条报文的MAP中
+                    }
+                    tempDataMap.values().removeAll(Collections.singleton(null));
+                    tempDataMap.values().removeAll(Collections.singleton(""));
+                    if (luggageList.size() == 0) {
+                        returnDataList.add(specialHandler(tempDataMap, dataObjectId)); //只有容器没有行李:整箱操作
+                    } else {
+                        for (Map<String, Object> tempLuggageMap : luggageList) {//循环行李数组
+                            if (containerNum == 0 && containerList.size() > 1 && tempLuggageMap.get("abnormalState") == null) {//只添加.B行李
+                                continue;
+                            }
+                            if (containerNum != 0 && containerList.size() > 1 && tempLuggageMap.get("abnormalState") != null) {//只添加.N行李
+                                continue;
+                            }
+                            HashMap<String, Object> objectObjectHashMap = new HashMap<>();
+                            objectObjectHashMap.putAll(tempDataMap);
+                            objectObjectHashMap.putAll(tempLuggageMap);
 
-                                if (Objects.isNull(objectObjectHashMap.get("abnormalState"))) {
-                                    objectObjectHashMap.remove("abnormalState");
-                                }
-//                                    tempDataMap.putAll(tempLuggageMap);//添加行李信息
-                                returnDataList.add(specialHandler(objectObjectHashMap, dataObjectId));//添加到返回数组中
+                            if (Objects.isNull(objectObjectHashMap.get("abnormalState"))) {
+                                objectObjectHashMap.remove("abnormalState");
                             }
+                            returnDataList.add(specialHandler(objectObjectHashMap, dataObjectId));//添加到返回数组中
                         }
                     }
                 }
             }
-
-            if (returnDataList.size() == 0) {
-                HashMap<String, Object> errorMap = new HashMap<>();
-                errorMap.put("dataObjectId", dataObjectId);
-                errorMap.put("errMessage", "报文数据格式错误");
-                errorMap.put("sourceData", typeStr);
-                returnDataList.add(errorMap);
-            }
-            return processSuccess(returnDataList);
-        } catch (Exception e) {
-            return processFail(LogUtils.getException(e));
         }
+        if (returnDataList.size() == 0) {
+            HashMap<String, Object> errorMap = new HashMap<>();
+            errorMap.put("dataObjectId", dataObjectId);
+            errorMap.put("errMessage", "报文数据格式错误");
+            errorMap.put("sourceData", typeStr);
+            returnDataList.add(errorMap);
+        }
+        return returnDataList;
     }
 
     /**
@@ -557,7 +487,6 @@ public class DataFormat {
     }
 
 
-
     /**
      * map key值转换
      *
@@ -596,11 +525,11 @@ public class DataFormat {
             Document doc = DocumentHelper.parseText(xmlStr);
             Element root = doc.getRootElement();
             Map<String, Object> returnMap = xmlToMap(root);
-            returnMap.put("souceData",xml);
+            returnMap.put("souceData", xml);
             return processSuccess(returnMap);
         } catch (Exception e) {
             Map<String, Object> errMap = processFail("入参不是规则的xml :" + xml);
-            errMap.put("souceData",xml);
+            errMap.put("souceData", xml);
             return errMap;
         }
     }

+ 16 - 18
mainFactory/src/main/java/org/bfkj/utils/MapTools.java

@@ -19,12 +19,13 @@ import java.util.regex.Pattern;
 public class MapTools implements Serializable {
     public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
-
-    /*对象转JSON字符串*/
-    public static String objToJSONStr(Object inObj) { //
-        ObjectMapper mapper = new ObjectMapper();
+    private static ObjectMapper mapper = new ObjectMapper();
+    static {
         mapper.registerModule(new JavaTimeModule());
         mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); //关闭
+    }
+    /*对象转JSON字符串*/
+    public static String objToJSONStr(Object inObj) { //
         try {
             if (Objects.isNull(inObj)) {
                 return null;
@@ -40,19 +41,17 @@ public class MapTools implements Serializable {
 
     /*字符串转对象*/
     public static Object strToObj(String inStr) {
-        ObjectMapper mapper = new ObjectMapper();
         try {
-            if (Pattern.compile("[0-9]{2}:[0-9]{2}:[0-9]{2}").matcher(inStr).find()){
-            return mapStrToObj(inStr, null);
+            if (Pattern.compile("[0-9]{2}:[0-9]{2}:[0-9]{2}").matcher(inStr).find()) {
+                return mapStrToObj(inStr, null);
             }
-            mapper.registerModule(new JavaTimeModule());
-            mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); //关闭
             return mapper.readValue(inStr, Map.class);
         } catch (JsonProcessingException e) {
             return mapStrToObj(inStr, null);
         }
     }
 
+
     private static Object mapStrToObj(String inMapStr, List<Object> itemMapList, String... strType) {//
         String beginChar = strType.length == 0 ? "{" : "[";//为了递归数组准备
         String endChar = strType.length == 0 ? "}" : "]"; //}
@@ -70,7 +69,7 @@ public class MapTools implements Serializable {
                 itemMapStr = tempObj.get("itemMapStr").toString();
                 itemMapList = (List<Object>) tempObj.get("itemMapList");
             }
-            String[] columnList = itemMapStr.replace(beginChar, "").replace(endChar, "").replaceAll("\"","").split(",");//使用逗号分割 //
+            String[] columnList = itemMapStr.replace(beginChar, "").replace(endChar, "").replaceAll("\"", "").split(",", -1);//使用逗号分割 //
             Map<String, Object> itemMap = new HashMap<>();
             List<Object> itemList = new ArrayList<>();
             for (String s : columnList) { //s= [1]
@@ -79,14 +78,14 @@ public class MapTools implements Serializable {
                 if (strType.length == 0) { //
                     //{A="12:00:00"}
                     midChar = !s.contains(":") ? "=" : !s.contains("=") ? ":" : s.indexOf("=") > s.indexOf(":") ? ":" : "=";
-                    String[] colValue = s.split(midChar); // [X1,1]
-                    if (s.contains(":") && s.lastIndexOf(":") > s.indexOf(":")){
+                    String[] colValue = s.split(midChar, -1); // [X1,1]
+                    if (s.contains(":") && s.lastIndexOf(":") > s.indexOf(":")) {
                         keyName = colValue[0].replace("'", "").replace("\"", "").trim(); //X1
-                        columnValue = s.substring(s.indexOf(":")+1);
-                    }else {
-                        if (colValue.length != 2 || Objects.equals(colValue[0], "")) continue;
+                        columnValue = s.substring(s.indexOf(":") + 1);
+                    } else {
+                        if (colValue.length != 2) continue; //  || Objects.equals(colValue[0], "")
                         keyName = colValue[0].replace("'", "").replace("\"", "").trim(); //X1
-                        columnValue = Objects.equals(colValue[1], "") ? null : (colValue[1].trim()); //1
+                        columnValue = Objects.equals(colValue[1], "null") ? null : (colValue[1].trim()); //1 Objects.equals(colValue[1], "") ||
                     }
 
                 } else {
@@ -113,7 +112,7 @@ public class MapTools implements Serializable {
         Map<Object, Object> temMap = new HashMap<>();
         temMap.put("itemMapStr", tempMapStr);
         temMap.put("itemMapList", itemMapList);
-        return strType.length == 0  ? (itemMapList.size() ==0 ?itemMapList :itemMapList.get(itemMapList.size() - 1))  : temMap;
+        return strType.length == 0 ? (itemMapList.size() == 0 ? itemMapList : itemMapList.get(itemMapList.size() - 1)) : temMap;
     }
 
     /**
@@ -161,7 +160,6 @@ public class MapTools implements Serializable {
     }
 
 
-
     public static String patternKey(String str, String pattern) {
         // 编写正则表达式
         // 匹配当前正则表达式

+ 38 - 48
mainFactory/src/main/java/org/bfkj/utils/MyDbHelper.java

@@ -29,18 +29,10 @@ public class MyDbHelper {//目前只差主键的条件优化
     Map<String, List<String>> sqlStrVarList = new HashMap<>();//SQL语句的书名号变量列表
     Map<String, String> sqlStrNewSQL = new HashMap<>();//SQL语句更换书名号变量后的可执行SQL
 
-    private HashMap<String, HashSet<Object>> event6Map = new HashMap<>();//用于事件6是否存在的内存检测
 
     private boolean isActive = false;
-
-    private Map<String, String> eventSQL = new HashMap<>() {{//用于表名方式组建SQL的基本语句
-        put("0", "select 字段 from 表名");
-        put("1", "insert into 表名(字段) values(值) ");
-        put("2", "update 表名 set 值 ");
-        put("3", "delete from 表名 ");
-    }};
     //还差一个基本字段列表,避免动态表自动生成(event,page,pagesize,serviceid)
-    private  String errorMessage = null; //当前数据输入处理对象不可用信息
+    private String errorMessage = null; //当前数据输入处理对象不可用信息
 
     public MyDbHelper(String connectStr) { // 需要json字符串
         Map<String, Object> connectMaps = null;
@@ -115,10 +107,10 @@ public class MyDbHelper {//目前只差主键的条件优化
             List<String> varList = new ArrayList<>();//
             String rowCountSql = "";
             if (MapTools.isNotBlank(sqlStr)) {//SQL语句方式:1、书名号;2、Where;3、SQL语句批量
-                sqlStr = standarSQLStr(sqlStr);
+                sqlStr = standarSQLStr(sqlStr); // todo sqlStr??  // select * from xx
                 newSqlStr = setAuthColumn(newSqlStr, authColumn, event);//列权限设置:1、获取所有列用于where的组建;2、返回修订后的SQL语句(去掉权限外的列)//sql ,allSQLCOlumn
                 allSQLColumn = sqlAllColumn.get(newSqlStr.concat(authColumn.toString()));//用于where组建的字段:1、Select优先依据伪列名;2、其它依据表列名
-                varList = getSQLVarList(newSqlStr);//获取SQL语句中的书名号变量列表,同时也将书名号进行了替换《中内容》
+                varList = getSQLVarList(newSqlStr);//获取SQL语句中的书名号变量列表,同时也将书名号进行了替换《中内容》 select * from xx
                 newSqlStr = sqlStrNewSQL.get(newSqlStr);//获取已经将书名号替换为?后的SQL语句
             } else {
                 Map<String, Object> metaDataMap = getMetaDataByTable(tableName, Objects.equals("true", calcInfo.get("isActive")));//获取表的所有字段列表
@@ -150,10 +142,10 @@ public class MyDbHelper {//目前只差主键的条件优化
                 String whereStr = (String) dbFilter.get("whereStr");//where字符串--依据参数变化不可缓存
 
                 List<Object> dbValueList = new ArrayList<>();
-                String  newEvent = "6".equals(event) && MapTools.isNotBlank(tableName) ? isExist(tableName, whereStr, filterList) : event;//如果是事件6则需要先进行判断后再决定事件
+                String newEvent = "6".equals(event) && MapTools.isNotBlank(tableName) ? isExist(tableName, whereStr, filterList) : event;//如果是事件6则需要先进行判断后再决定事件
                 Map<String, Object> dbValueInfo = MapTools.isNotBlank(sqlStr) ? getdbValueForSql(execSQLStr, varList, signParam) : getdbValueForTable(tableName, newEvent, authColumn, signParam, Objects.equals("true", calcInfo.get("isActive")));//获取执行的参数值集合,SQL语句方式针对的是书名号变量,注意使用未替换书名号的SQL语句
                 dbValueList = (List<Object>) dbValueInfo.get("dbValue");//执行参数
-                execSQLStr = dbValueInfo.get("newSqlStr").toString();//修订后的SQL语句,针对in方式进行修订
+                execSQLStr = dbValueInfo.get("newSqlStr").toString();//修订后的SQL语句,针对in方式进行修订 select * from xx
                 rowCountSql = "0".equals(newEvent) && MapTools.isNotBlank(allSQLColumn) ? execSQLStr.replace(allSQLColumn, " count(1) ") : "";//查询则创建rowCountSql
                 if (MapTools.isNotBlank(whereStr) && !"1".equals(newEvent)) {//如果where字符串不为空
                     execSQLStr = execSQLStr.concat(execSQLStr.lastIndexOf(")") >= execSQLStr.toLowerCase().lastIndexOf(" where ") ? " where " : " and ").concat("(").concat(whereStr).concat(")");
@@ -178,7 +170,7 @@ public class MyDbHelper {//目前只差主键的条件优化
                 } else {
                     if (!dbParam.contains(dbValueList)) {//参数一致时,去重执行
                         String batchSQL = Objects.nonNull(execSQLMap.get(execSQLStr)) && Objects.nonNull(execSQLMap.get(execSQLStr).get("batchSQL")) ? execSQLMap.get(execSQLStr).get("batchSQL").toString() : "";
-                        if ("0".equals(newEvent)  && dbParam.size() > 0) {
+                        if ("0".equals(newEvent) && dbParam.size() > 0) {
                             batchSQL = (MapTools.isBlank(batchSQL) ? execSQLStr : batchSQL).concat(" or (").concat(whereStr).concat(")");
                             List tempList = dbParam.isEmpty() ? new ArrayList() : (List) dbParam.get(0);
                             tempList.addAll(dbValueList);
@@ -188,46 +180,41 @@ public class MyDbHelper {//目前只差主键的条件优化
                         } else {
                             dbParam.add(dbValueList);//添加当前行的执行参数
                         }
-                        if (execSQLStr.indexOf("{")>0 && execSQLStr.indexOf("}")>0){
-                            whereIndex ++;
+                        if (execSQLStr.indexOf("{") > 0 && execSQLStr.indexOf("}") > 0) {
+                            whereIndex++;
                         }
                     }
                     sqlParmMap.put("dbParam", dbParam);//执行参数
-                    if (dbParam.size() ==0 &&MapTools.isBlank(whereStr) && "2,3".contains(newEvent)) {
+                    if (dbParam.size() == 0 && MapTools.isBlank(whereStr) && "2,3".contains(newEvent)) {
                         sqlParmMap.put("noExec", " 禁止全表更新、删除");//执行参数
                     }
                     execSQLMap.put(execSQLStr, sqlParmMap);//添加到最终执行列表中
                 }
             }
-
-
-
-
             //循环执行execSQLMap
             Map<String, Map<String, Object>> tmpExec = new HashMap<>();
             tmpExec.putAll(inertSQLMap);
             tmpExec.putAll(execSQLMap);
-            for(int loop =0; loop <2 ;loop ++){
+            for (int loop = 0; loop < 2; loop++) {
                 Map<String, Map<String, Object>> exeMap = new HashMap<>();
-                if (loop ==0){
+                if (loop == 0) {
                     exeMap = inertSQLMap;
-                }else {
+                } else {
                     exeMap = execSQLMap;
                 }
-
                 for (String signSql : exeMap.keySet()) {//循环当前MAP,查询必定是单条SQL,SQL语句方式:都是单条,表名方式:查询、新增是单条,更新、删除可能多条,事件6可能多条
                     Map<String, Object> signParamMap = exeMap.get(signSql);
                     String newSignSQL = signSql;
-                    if (signSql.indexOf("{")>0 && signSql.indexOf("}")>0){
-                        String tempWhere =  signSql.substring(signSql.indexOf("{")+1,signSql.indexOf("}"));
+                    if (signSql.indexOf("{") > 0 && signSql.indexOf("}") > 0) {
+                        String tempWhere = signSql.substring(signSql.indexOf("{") + 1, signSql.indexOf("}"));
                         String newWhere = tempWhere;
-                        for (int i = 0; i < whereIndex-1; i++) {
+                        for (int i = 0; i < whereIndex - 1; i++) {
                             newWhere = newWhere.concat(" or ").concat(tempWhere);
                         }
                         newWhere = "(".concat(newWhere).concat(")");
-                        signParamMap.put("batchSQL",null);
-                        signParamMap.put("rowCountSql",null);
-                        signSql = signSql.replace(tempWhere,newWhere).replace("{","").replace("}","");
+                        signParamMap.put("batchSQL", null);
+                        signParamMap.put("rowCountSql", null);
+                        signSql = signSql.replace(tempWhere, newWhere).replace("{", "").replace("}", "");
                     }
 
                     Map<String, Object> execSignResult = new HashMap<>();
@@ -266,7 +253,7 @@ public class MyDbHelper {//目前只差主键的条件优化
     /*标准化SQL*/
     private String standarSQLStr(String sqlStr) {
         String newSqlStr = sqlStr;
-        String[] sqlKeyWordList = "select,from,where,group by,limit,order by".split(",");
+        String[] sqlKeyWordList = "select,from,where,group by,limit,order by".split(",",-1);
 
 
         for (String sqlKeyWord : sqlKeyWordList) {//循环进行替换
@@ -346,7 +333,7 @@ public class MyDbHelper {//目前只差主键的条件优化
                         }
                     }
                     //todo 涉及到列的取值 存在问题
-                    newSqlStr = newSqlStr.replaceFirst(allSQLColumn," ".concat(String.join(",", tempColumn)));//直接进行清除
+                    newSqlStr = newSqlStr.replaceFirst(allSQLColumn, " ".concat(String.join(",", tempColumn)));//直接进行清除
                     newSqlStr = newSqlStr.replaceAll("[,]+", ",").replaceAll(", from ", " from ");//清除多余的逗号
                 }
                 sqlAllColumn.put(sqlAuthKey, allSQLColumn);//缓存当前SQL可用的字段
@@ -366,9 +353,9 @@ public class MyDbHelper {//目前只差主键的条件优化
                 int beginIndex = 6;//默认从第一个select后开始进行查找
                 String tempSQLStr = sqlStr.toLowerCase();//初始化一个中间变量,不影响原SQL语句,因为中间会把子查询的select替换掉
                 String allColumnStr = "";//初始化一个完整字段列表字符串
-                String fromStr =" from ";
+                String fromStr = " from ";
                 while (true) {//循环查找select后的from     //  select (select a as b from x) as t  from tx  id = select * from tx2
-                    if (!tempSQLStr.contains(fromStr)){
+                    if (!tempSQLStr.contains(fromStr)) {
                         fromStr = "from";
                     }
                     beginIndex = tempSQLStr.indexOf(fromStr, beginIndex); //从上一次找到的from后面开始查找下一个from,beginIndex的目的是为避免重复查找一个
@@ -400,7 +387,7 @@ public class MyDbHelper {//目前只差主键的条件优化
 
     //根据sql语句获取表名:查询存在多层多表联合等复杂情况,暂时不支持
     private String getTableBySql(String sqlStr) {
-        String[] sqlSplit = sqlStr.split("\\s+");//使用空格进行分组
+        String[] sqlSplit = sqlStr.split("\\s+",-1);//使用空格进行分组
         return sqlSplit.length < 3 ? null : sqlSplit[0].equals("insert") ? (sqlSplit[2].indexOf("(") > 0 ? sqlSplit[2].substring(0, sqlSplit[2].indexOf("(")) : sqlSplit[2])//insert into 表名(字段名)
                 : sqlSplit[0].equals("update") ? sqlSplit[1]//update 表名
                 : sqlSplit[0].equals("delete") ? sqlSplit[2] : null;//delete from 表名
@@ -473,7 +460,7 @@ public class MyDbHelper {//目前只差主键的条件优化
                 Object currentVar = valueObj.get(newColumnName);//优先从当前MAP中直接获取
 
                 if (columnName.startsWith(":")) {//处理in,只是书名号方式存在
-                    String[] varSplit = Objects.isNull(currentVar) ? null : currentVar.toString().split(",");//使用逗号进行分组
+                    String[] varSplit = Objects.isNull(currentVar) ? null : currentVar.toString().split(",",-1);//使用逗号进行分组
                     if (Objects.isNull(varSplit)) {//
                         newSqlStr = newSqlStr.replaceFirst(columnName.concat("?"), "?"); //修订SQL
                     } else {
@@ -561,20 +548,23 @@ public class MyDbHelper {//目前只差主键的条件优化
     //检测数据是否已经存在,使用同步锁(tableName,whereStr,filterList)
     private synchronized String isExist(String tableName, String whereStr, List<Object> dbFilter) {
         String event = "2";//默认为更新
-        if (!event6Map.containsKey(tableName)) {//如果对应表名未建立缓存则初始化一个
-            event6Map.put(tableName, new HashSet<>());
+        if (!AppConfig.event6Map.containsKey(tableName)) {//如果对应表名未建立缓存则初始化一个
+            AppConfig.event6Map.put(tableName, new HashSet<>());
         }
-        HashSet<Object> tableUniqe = event6Map.get(tableName);//获取已经缓存的数据
+        HashSet<Object> tableUniqe = AppConfig.event6Map.get(tableName);//获取已经缓存的数据
         String oldKey = whereStr.concat(MapTools.objToJSONStr(dbFilter));//条件字符串加条件执行参数
-        if (!tableUniqe.contains(oldKey)) {//如果不存在则查数据库 // 23298306
+        if (!tableUniqe.contains(oldKey)) {//如果不存在则查数据库 // HashSet的包含效率高于list的包含
             try {
                 List<Map<String, Object>> isExistResult = theJdbcTemplate.queryForList("select 1 from ".concat(tableName).concat(" where ").concat(whereStr).concat(" limit 1"), dbFilter.toArray());
                 event = (isExistResult.size() == 0) ? "1" : event;//数据库不存在则新增
                 //如果是新增则修订为新增SQL
+                if (tableUniqe.size() > 7000) {
+                    tableUniqe.remove(tableUniqe.iterator().next());
+                }
                 tableUniqe.add(oldKey);//无论是新增还是更新都添加到缓存
-//                event6Map.put(tableName,tableUniqe);
             } catch (Exception e) {//查询失败并不更新缓存
                 //打印错误即可
+                System.out.println(LogUtils.getException(e));
             }
         }
         return event;
@@ -618,7 +608,7 @@ public class MyDbHelper {//目前只差主键的条件优化
             }
             allColumn = modyColumn;
         }
-        String sqlStr = eventSQL.get(event).replace("表名", tableName).replace("字段", String.join(",", allColumn)).replace("值", String.join(",", modifyValue));
+        String sqlStr = AppConfig.eventSQL.get(event).replace("表名", tableName).replace("字段", String.join(",", allColumn)).replace("值", String.join(",", modifyValue));
         Map<String, Object> returnMap = new HashMap<>();
         returnMap.put("dbValue", dbValue);
         returnMap.put("sqlStr", sqlStr);
@@ -663,8 +653,8 @@ public class MyDbHelper {//目前只差主键的条件优化
                 try {//执行查询
                     Map<String, Object> returnData = processSuccess(theJdbcTemplate.queryForList(signSql, ((List) signValue).toArray()));
                     try {
-                        if (Objects.nonNull( sqlParmMap.get("rowCountSql"))) {
-                            returnData.put("rowcount", theJdbcTemplate.queryForObject( sqlParmMap.get("rowCountSql").toString(), Integer.class, ((List) signValue).toArray()));
+                        if (Objects.nonNull(sqlParmMap.get("rowCountSql"))) {
+                            returnData.put("rowcount", theJdbcTemplate.queryForObject(sqlParmMap.get("rowCountSql").toString(), Integer.class, ((List) signValue).toArray()));
                         }
                     } catch (Exception e) {
                         System.out.println("获取rowcount失败: ".concat(LogUtils.getException(e)));
@@ -704,12 +694,12 @@ public class MyDbHelper {//目前只差主键的条件优化
             connection.setAutoCommit(false);    //手动事务
             for (int i = 0; i < dbValue.size(); i++) {
 
-                Object[] signdbValue = ((List<Object>)dbValue.get(i)).toArray();
+                Object[] signdbValue = ((List<Object>) dbValue.get(i)).toArray();
                 for (int index = 0; index < signdbValue.length; index++) {
-                    sqlPS.setObject(index + 1, signdbValue[index]);
+                    sqlPS.setObject(index + 1,signdbValue[index]);
                 }
                 sqlPS.addBatch();
-                if ((i+1) % 100 == 0){
+                if ((i + 1) % 100 == 0) {
                     sqlPS.executeBatch();
                     connection.commit(); // 统一提交
                     sqlPS.clearBatch();