浏览代码

2.0 修改版本-日志变更

pms 2 年之前
父节点
当前提交
a49bd0efe7

+ 48 - 6
mainFactory/src/main/java/org/bfkj/MainFactoryApplication.java

@@ -1,8 +1,5 @@
 package org.bfkj;
 
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import org.bfkj.application.DataProcess;
 import org.bfkj.application.ServiceInputControl;
 import org.bfkj.config.AppConfig;
@@ -39,18 +36,18 @@ public class MainFactoryApplication {
         Environment env = context.getBean(Environment.class);
 
         Map<String, String> configByEnvironment = getConfigByEnvironment(env);
-        if (!configByEnvironment.isEmpty()){
+        if (!configByEnvironment.isEmpty()) {
             systemDefaultParams.putAll(configByEnvironment);
         }
         String systemParams = env.getProperty("systemParams");
         if (Objects.nonNull(systemParams) && !"".equals(systemParams)) {
-            Map<String, Object> inSystemParams =(Map<String, Object>) MapTools.strToObj(systemParams);
+            Map<String, Object> inSystemParams = (Map<String, Object>) MapTools.strToObj(systemParams);
             for (String key : inSystemParams.keySet()) {
                 String keyValue = inSystemParams.get(key).toString().replace("path", path);
                 if (Objects.isNull(MapTools.strToObj(keyValue))) {
                     systemDefaultParams.put(key, keyValue);
                 } else {
-                    systemDefaultParams.put(key,keyValue);
+                    systemDefaultParams.put(key, keyValue);
                 }
             }
         }
@@ -285,4 +282,49 @@ public class MainFactoryApplication {
     public void clearGc() {
         Runtime.getRuntime().gc();
     }
+
+
+    /*1每2秒执行一次 日志的批量插入*/
+    @Scheduled(cron = "2 * * * * ?")
+    public void batchLog() {
+        Map<String, List<Object>> logSuccessMap = LogUtils.logSuccessMapList;
+        long current = System.currentTimeMillis();
+        List<String> successList = logSuccessMap.keySet().stream().filter(key -> Long.getLong(key) > (current - 2)).toList();
+        List<Object[]> logSuccessList = new ArrayList<>();
+        for (String currentTime : successList) {
+            logSuccessList.add(logSuccessMap.get(currentTime).toArray());
+            logSuccessMap.remove(currentTime);
+        }
+        Map<String, List<Object>> logErrorMap = LogUtils.logErrorMapList;
+        List<String> errorList = logErrorMap.keySet().stream().filter(key -> Long.getLong(key) > (current - 2)).toList();
+        List<Object[]> logErrorList = new ArrayList<>();
+        for (String currentTime : errorList) {
+            logErrorList.add(logErrorMap.get(currentTime).toArray());
+            logErrorMap.remove(currentTime);
+        }
+        Map<String, List<Object>> logSourceMap = LogUtils.sourceMapList;
+        List<String> sourceList = logSourceMap.keySet().stream().filter(key -> Long.getLong(key) > (current - 2)).toList();
+        List<Object[]> logSourceList = new ArrayList<>();
+        for (String currentTime : sourceList) {
+            logSourceList.add(logSourceMap.get(currentTime).toArray());
+            logSourceMap.remove(currentTime);
+        }
+
+        /*批量写日志*/
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        if (Objects.nonNull(myDbHelper.getErrorMessage())) {
+            System.out.println("获取远程数据库失败:写入日志失败");
+        }
+
+
+        String insertSQL = "INSERT INTO log_success ( success, location, logContent, createtime, serviceId, workId, event, iNDataContent, outDataContent, calculationLocation, dataObjectId) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+        String errorSQL = "INSERT INTO log_error ( success, location, logContent, createtime, serviceId, workId, event, iNDataContent, outDataContent, calculationLocation, dataObjectId) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+        try {
+            if (logSuccessList.size() > 0) myDbHelper.updateByCondition(insertSQL, logSuccessList);
+            if (logErrorList.size() > 0) myDbHelper.updateByCondition(errorSQL, logErrorList);
+            if (logSourceList.size() > 0) myDbHelper.updateByCondition("INSERT INTO log_fulldata ( dataObjectId, fullData) VALUES (?,?)", logSourceList);
+        } catch (Exception e) {
+            System.out.println("日志记录异常" + LogUtils.getException(e));
+        }
+    }
 }

+ 3 - 2
mainFactory/src/main/java/org/bfkj/api/CommonApi.java

@@ -51,7 +51,8 @@ public class CommonApi {
     @PostMapping("query")
     @ResponseBody
     public Object queryApi(@RequestHeader Map<String, String> token, @RequestBody Map<String, Object> params) {
-        return commonInterface(token, params, "0");
+        Map<String, Object> stringObjectMap = commonInterface(token, params, "0");
+        return stringObjectMap;
     }
 
     /**
@@ -160,7 +161,7 @@ public class CommonApi {
 
 
     @PostMapping("/upload")
-    public Object upload(@RequestParam(value = "file") MultipartFile excelFile,@RequestParam(value = "serviceId") String serviceID, @RequestParam(value = "token") String token ) throws Exception {
+    public Object upload(@RequestParam(value = "file") MultipartFile excelFile, @RequestParam(value = "serviceId") String serviceID, @RequestParam(value = "token") String token) throws Exception {
         if (excelFile.isEmpty()) {
             return MapTools.processFail("文件夹为空,重新上传");
         } else {

+ 31 - 43
mainFactory/src/main/java/org/bfkj/utils/LogUtils.java

@@ -1,30 +1,22 @@
 package org.bfkj.utils;
 
 
-import com.mysql.cj.log.Log;
 import org.bfkj.config.AppConfig;
 import org.bfkj.config.ObjectMap;
-import org.bfkj.config.SpringContextBeans;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
 public class LogUtils { // 依据服务编号ID获取服务类型,如果是异步 异常日志无条件写入到本地数据库(每个服务都有这样的一个数据库) ,在程序启动时会扫描此表,重新进行,如果成功则从此表中移除
-    public static void log(String location, String success, Object calculationLocation, String logContent, String serviceId, Object iNDataContent, String dataObjectId, Object OutDataContent, Object event) {
-        ThreadPoolTaskExecutor threadPoolTaskExecutor = SpringContextBeans.getBean("ThreadPoolTaskExecutor");
-        threadPoolTaskExecutor.submit(() -> logWrite(location, success, calculationLocation, logContent, serviceId, iNDataContent, dataObjectId, OutDataContent, event));
-    }
+    public static Map<String, List<Object>> logErrorMapList = new ConcurrentHashMap<>();
+    public static Map<String, List<Object>> logSuccessMapList = new ConcurrentHashMap<>();
+    public static Map<String, List<Object>> sourceMapList = new ConcurrentHashMap<>();
 
     private static Long deleteTime = 0L;
 
-    /*
-    算法输入数据
-    算法返回结果
-    前置执行条件输出数据
-    前置执行条件返回结果
-    * */
-    public static void logWrite(String location, String success, Object calculationLocation, String logContent, String serviceId, Object iNDataContent, String dataObjectId, Object OutDataContent, Object event) {
+
+    public static void log(String location, String success, Object calculationLocation, String logContent, String serviceId, Object iNDataContent, String dataObjectId, Object OutDataContent, Object event) {
         String inData = MapTools.objToJSONStr(iNDataContent);
         String shortData = MapTools.isNotBlank(inData) ? (inData.length() > 20480 ? inData.substring(0, 20480) : inData) : null;
         List<Object> logParam = new ArrayList<>() {{
@@ -39,43 +31,39 @@ public class LogUtils { // 依据服务编号ID获取服务类型,如果是异
             add(MapTools.objToJSONStr(OutDataContent));
             add(Objects.isNull(calculationLocation) ? null : calculationLocation.toString());
             add(dataObjectId);
-//            add(inData);
         }};
-        if (MapTools.isBlank(dataObjectId) && (!success.equals("0") || location.equals("start: 1"))) {
-            System.out.println("系统错误日志" + logParam); //系统错误日志
-            return;
-        }
-        String tableName = success.equals("0") ? "log_success" : "log_error";
-        String dbText = "远程数据库";
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
-        if (Objects.nonNull(myDbHelper.getErrorMessage())) {
-            dbText = "本地数据库";
-            myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.LOCAL_DB_CONNECT));
+        long l = System.currentTimeMillis() / 1000;
+        String key = l + "";
+        if ("0".equals(success)){
+            List<Object> tempLogList = logErrorMapList.containsKey(key) ? logErrorMapList.get(key) : new ArrayList<>();
+            tempLogList.add(logParam);
+            logErrorMapList.put(key, tempLogList);
+        }else {
+            List<Object> tempLogList = logSuccessMapList.containsKey(key) ? logSuccessMapList.get(key) : new ArrayList<>();
+            tempLogList.add(logParam);
+            logSuccessMapList.put(key, tempLogList);
         }
-        if (Objects.nonNull(myDbHelper.getErrorMessage())) {
-            System.out.println("记录日志: 获取" + dbText + "MyDbHelper对象失败,日志信息 :" + myDbHelper.getErrorMessage());
+        if (MapTools.isNotBlank(inData) && inData.length() > 20480) {
+            List<Object> sourceList = new ArrayList<>() {{
+                add(dataObjectId);
+                add(inData);
+            }};
+            List<Object> sourceLogList = sourceMapList.containsKey(key) ? sourceMapList.get(key) : new ArrayList<>();
+            sourceLogList.add(sourceList);
+            sourceMapList.put(key, sourceLogList);
         }
         if (MapTools.isNotBlank(serviceId) && (System.currentTimeMillis() - deleteTime) > 10000) {
-            myDbHelper.updateByCondition("delete log_success where serviceId =? and id not in (select id  from log_success  where serviceId = ? order by id desc limit 100 ) ", null, serviceId,serviceId);
+            MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+            if (Objects.nonNull(myDbHelper.getErrorMessage())) {
+                System.out.println("记录日志: 获取 MyDbHelper对象失败,日志信息 :" + myDbHelper.getErrorMessage());
+            }
+            myDbHelper.updateByCondition("delete log_success where serviceId =? and id not in (select id  from log_success  where serviceId = ? order by id desc limit 100 ) ", null, serviceId, serviceId);
             deleteTime = System.currentTimeMillis();
         }
-        String insertSQL = "INSERT INTO log_success ( success, location, logContent, createtime, serviceId, workId, event, iNDataContent, outDataContent, calculationLocation, dataObjectId) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+    }
+
 
-        try {
-            myDbHelper.updateByCondition(insertSQL,null,logParam.toArray() );
-            if (MapTools.isNotBlank(inData) && inData.length() > 20480) {
-                myDbHelper.updateByCondition("INSERT INTO log_fulldata ( dataObjectId, fullData) VALUES (?,?)",null,dataObjectId,inData);
-            }
-        }catch (Exception e){
-            System.out.println("日志记录异常"+LogUtils.getException(e));
-        }
-//
-//        Map<String, Object> shortMap = myDbHelper.generalProcess("1", tableName, null, null, logParam, false, null, null);
-//        if (!shortMap.get("code").equals("0")) {
-//            System.out.println("记录日志: 写入" + dbText + "日志失败 :" + shortMap.get("message") + "\n数据:" + MapTools.objectToString(logParam));
-//        }
 
-    }
 
     /**
      * 获取当前行

+ 84 - 145
mainFactory/src/main/java/org/bfkj/utils/MyDbHelper.java

@@ -122,8 +122,6 @@ public class MyDbHelper {//目前只差主键的条件优化
                 }
                 allSQLColumn = String.join(",", tableColumn.get(tableName));//依据表名获取所有列
             }
-            //isSQLBatch应该从算法上进行分离,否则性能存在极大影响:先select然后insert或者update;MyDbHelper理论上也可以进行自动分离,Statement性能太低,在DataProcess进行处理
-            boolean isSQLBatch = "7".equals(event);//SQL语句的执行类型,预编译参数化执行false;整句SQL非预编译参数化执行true
             List<Map<String, Object>> initParam = new ArrayList<>();
             if (Objects.nonNull(inParams)) {
                 if (inParams instanceof List) {
@@ -136,99 +134,86 @@ public class MyDbHelper {//目前只差主键的条件优化
                 initParam.add(new HashMap<>());
             }
 
-
             for (Map<String, Object> signParam : initParam) {//循环入口参数,可以开启多线程执行
                 String execSQLStr = newSqlStr;
-                Map<String, Object> dbFilter = getdbFilter(varList, event, isSQLBatch, signParam, rowAuth, allSQLColumn);//获取条件,1、返回where字符串;2、返回执行参数 where  值
+                Map<String, Object> dbFilter = getdbFilter(varList, event, signParam, rowAuth, allSQLColumn);//获取条件,1、返回where字符串;2、返回执行参数 where  值
                 List<Object> filterList = (List<Object>) dbFilter.get("dbFilter");//执行参数---
                 String whereStr = (String) dbFilter.get("whereStr");//where字符串--依据参数变化不可缓存
                 List<Object> dbValueList = new ArrayList<>();
-                if (MapTools.isNotBlank(sqlStr)) {//编写SQL语句方式
-                    Map<String, Object> dbValueForSql = getdbValueForSql(execSQLStr, varList, isSQLBatch, signParam);//获取执行的参数值集合,SQL语句方式针对的是书名号变量,注意使用未替换书名号的SQL语句
-                    dbValueList = (List<Object>) dbValueForSql.get("dbValue");//执行参数
-                    execSQLStr = (String) dbValueForSql.get("newSqlStr");//修订后的SQL语句,针对in方式进行修订
-                    rowCountSql = "0".equals(event) && MapTools.isNotBlank(allSQLColumn) ? execSQLStr.replace(String.join(",", allSQLColumn), " count(1) ") : "";//查询则创建rowCountSql
-                } else {
-                    event = "6".equals(event) ? isExist(tableName, whereStr, filterList) : event;//如果是事件6则需要先进行判断后再决定事件
-                    Map<String, Object> dbValueInfo = getdbValueForTable(tableName, event, authColumn, signParam, Objects.equals("true", calcInfo.get("isActive")));//获取执行的参数值集合,SQL语句方式针对的是书名号变量
-                    execSQLStr = (String) dbValueInfo.get("sqlStr");//创建的SQL语句
-                    rowCountSql = (String) dbValueInfo.get("rowCountSql");//查询时创建的行总数查询
-                    dbValueList = (List<Object>) dbValueInfo.get("dbValue");//执行参数
-                }
+                event = "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, event, authColumn, signParam, Objects.equals("true", calcInfo.get("isActive")));//获取执行的参数值集合,SQL语句方式针对的是书名号变量,注意使用未替换书名号的SQL语句
+                dbValueList = (List<Object>) dbValueInfo.get("dbValue");//执行参数
+                execSQLStr = dbValueInfo.get("newSqlStr").toString();//修订后的SQL语句,针对in方式进行修订
+                rowCountSql = "0".equals(event) && MapTools.isNotBlank(allSQLColumn) ? execSQLStr.replace(allSQLColumn, " count(1) ") : "";//查询则创建rowCountSql
                 if (MapTools.isNotBlank(whereStr) && !"1".equals(event)) {//如果where字符串不为空
-                    if (isSQLBatch) {//如果是SQL语句执行方式
-                        String sqlVar = dbValueList.size() == 0 ? execSQLStr : dbValueList.get(0).toString();//dbValueList只有一条SQL语句字符串,没有书名号时dbValueList为空
-                        dbValueList = new ArrayList<>();//清空
-                        sqlVar = sqlVar.concat(sqlVar.lastIndexOf(")") >= sqlVar.lastIndexOf(" where ") ? " where " : " and ")
-                                .concat("(")
-                                .concat(whereStr)
-                                .concat(")");
-                        dbValueList.add(sqlVar);//添加参数
-                    } else {
-                        execSQLStr = execSQLStr.concat(execSQLStr.lastIndexOf(")") >= execSQLStr.toLowerCase().lastIndexOf(" where ") ? " where " : " and ")
-                                .concat("(")
-                                .concat(whereStr)
-                                .concat(")");
-                        rowCountSql = MapTools.isBlank(rowCountSql) ? "" : rowCountSql.concat(rowCountSql.lastIndexOf(")") >= rowCountSql.lastIndexOf(" where ") ? " where " : " and ")
-                                .concat("(")
-                                .concat(whereStr)
-                                .concat(")");
-                        dbValueList.addAll(filterList);//组合执行参数
-                    }
+                    execSQLStr = execSQLStr.concat(execSQLStr.lastIndexOf(")") >= execSQLStr.toLowerCase().lastIndexOf(" where ") ? " where " : " and ")
+                            .concat("(")
+                            .concat(whereStr)
+                            .concat(")");
+                    rowCountSql = MapTools.isBlank(rowCountSql) ? "" : rowCountSql.concat(rowCountSql.lastIndexOf(")") >= rowCountSql.lastIndexOf(" where ") ? " where " : " and ")
+                            .concat("(")
+                            .concat(whereStr)
+                            .concat(")");
+                    dbValueList.addAll(filterList);//组合执行参数
                 }
 
                 Map<String, Object> sqlParmMap = new HashMap<>();
                 sqlParmMap.put("rowCountSql", rowCountSql);//行总数查询
                 sqlParmMap.put("event", event);//事件
-                sqlParmMap.put("isSQLBatch", isSQLBatch);//执行方式,是否使用预编译
+                Map<String, Map<String, Object>> tempSQLMap = "1".equals(event) ? inertSQLMap : execSQLMap;
+
+                List signParamList = Objects.nonNull(tempSQLMap.get(execSQLStr)) && Objects.nonNull(tempSQLMap.get(execSQLStr).get("signParam")) ? (List) tempSQLMap.get(execSQLStr).get("signParam") : new ArrayList<>();//获取对应SQL语句的执行参数,没有则默认为空数组
+                List dbParam = Objects.nonNull(tempSQLMap.get(execSQLStr)) && Objects.nonNull(tempSQLMap.get(execSQLStr).get("dbParam")) ? (List) tempSQLMap.get(execSQLStr).get("dbParam") : new ArrayList<>();//获取对应SQL语句的执行参数,没有则默认为空数组
+                signParamList.add(signParam);
+                sqlParmMap.put("signParam", signParamList);//上传的参数
                 if ("1".equals(event)) {
-                    List signParamList = Objects.nonNull(inertSQLMap.get(execSQLStr)) && Objects.nonNull(inertSQLMap.get(execSQLStr).get("signParam")) ? (List) inertSQLMap.get(execSQLStr).get("signParam") : new ArrayList<>();//获取对应SQL语句的执行参数,没有则默认为空数组
-                    List dbParam = Objects.nonNull(inertSQLMap.get(execSQLStr)) && Objects.nonNull(inertSQLMap.get(execSQLStr).get("dbParam")) ? (List) inertSQLMap.get(execSQLStr).get("dbParam") : new ArrayList<>();//获取对应SQL语句的执行参数,没有则默认为空数组
-                    signParamList.add(signParam);
                     //参数一致时,去重执行
                     dbParam.add(dbValueList);//添加当前行的执行参数
                     sqlParmMap.put("dbParam", dbParam);//执行参数
-                    sqlParmMap.put("signParam", signParamList);//上传的参数
                     inertSQLMap.put(execSQLStr, sqlParmMap);//添加到最终执行列表中
                 } else {
-                    List signParamList = Objects.nonNull(execSQLMap.get(execSQLStr)) && Objects.nonNull(execSQLMap.get(execSQLStr).get("signParam")) ? (List) execSQLMap.get(execSQLStr).get("signParam") : new ArrayList<>();//获取对应SQL语句的执行参数,没有则默认为空数组
-                    List dbParam = Objects.nonNull(execSQLMap.get(execSQLStr)) && Objects.nonNull(execSQLMap.get(execSQLStr).get("dbParam")) ? (List) execSQLMap.get(execSQLStr).get("dbParam") : new ArrayList<>();//获取对应SQL语句的执行参数,没有则默认为空数组
-                    signParamList.add(signParam);
-                    sqlParmMap.put("signParam", signParamList);//上传的参数
                     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(event) && batchSQL.contains(whereStr) && dbParam.size() > 0) {
-                            batchSQL = batchSQL.concat(" or (").concat(whereStr).concat(")");
+                            batchSQL = (MapTools.isBlank(batchSQL) ? execSQLStr : batchSQL).concat(" or (").concat(whereStr).concat(")");
                             List tempList = dbParam.isEmpty() ? new ArrayList() : (List) dbParam.get(0);
                             tempList.addAll(dbValueList);
                             dbParam.clear();
                             dbParam.add(tempList);
+                            sqlParmMap.put("batchSQL", batchSQL);
                         } else {
-                            if (batchSQL.equals("")) {
-                                batchSQL = execSQLStr;
-                            }
                             dbParam.add(dbValueList);//添加当前行的执行参数
                         }
-                        sqlParmMap.put("batchSQL", batchSQL);
                     }
                     sqlParmMap.put("dbParam", dbParam);//执行参数
                     execSQLMap.put(execSQLStr, sqlParmMap);//添加到最终执行列表中
                 }
             }
-
             //循环执行execSQLMap
+            inertSQLMap.putAll(execSQLMap);
             List<Object> returnList = new ArrayList<>();
+
             for (String signSql : inertSQLMap.keySet()) {//循环当前MAP,查询必定是单条SQL,SQL语句方式:都是单条,表名方式:查询、新增是单条,更新、删除可能多条,事件6可能多条
-                Map<String, Object> stringObjectMap = execSign(sqlStr, signSql, inertSQLMap.get(signSql), inputData);
-                stringObjectMap.put("fullData", inertSQLMap.get(signSql));
-                returnList.add(stringObjectMap);//开启多线程执行,合并返回值
-            }
-            for (String signSql : execSQLMap.keySet()) {//循环当前MAP,查询必定是单条SQL,SQL语句方式:都是单条,表名方式:查询、新增是单条,更新、删除可能多条,事件6可能多条
-                Map<String, Object> stringObjectMap = execSign(sqlStr, signSql, execSQLMap.get(signSql), inputData);
-                stringObjectMap.put("fullData", execSQLMap.get(signSql));
-                returnList.add(stringObjectMap);//开启多线程执行,合并返回值
+                Map<String, Object> execSignResult = execSign(sqlStr, signSql, inertSQLMap.get(signSql), inputData);
+                if ("-1".equals(execSignResult.get("code"))) {
+                    return execSignResult;
+                }
+                Map<String, Object> signParamMap = inertSQLMap.get(signSql);
+                signParamMap.put("returnData", execSignResult.get("returnData"));
+                signParamMap.put("sql", signSql);
+//                returnList.add(execSignResult.get("returnData"));
+                inertSQLMap.put(signSql, signParamMap);
+            }
+            Object obj = new Object();
+            if (inertSQLMap.keySet().size() == 1) {
+                for (String exc : inertSQLMap.keySet()) {
+                    obj = inertSQLMap.get(exc);
+                    break;
+                }
+            } else {
+                obj = inertSQLMap;
             }
-            return returnList.size() == 1 ? (Map<String, Object>) returnList.get(0) : processSuccess(returnList, sqlStr, inParams);
+            return processSuccess(obj);
         } catch (Exception e) {
             return processFail("generalProcess函数:执行出错", LogUtils.getException(e), inParams);
         }
@@ -279,7 +264,7 @@ public class MyDbHelper {//目前只差主键的条件优化
                 tempMap.put("columnLable", rsd.getColumnLabel(i + 1));
                 allColumnList.add(tempMap);
             }
-            return processSuccess(allColumnList, sql, null);
+            return processSuccess(allColumnList);
         } catch (SQLException e) {
             return processFail("getAllColumnForSet 异常: " + LogUtils.getException(e), sql, null);
         } finally {
@@ -346,7 +331,7 @@ public class MyDbHelper {//目前只差主键的条件优化
                 tempSQLStr = tempSQLStr.replace(findOne > -1 ? " select " : "(select ", "88888888");//替换掉子查询的select,避免下一次又找到,同时注意替换长度要保持一致,否则影响后面的取值
                 beginIndex = beginIndex + 6;//在当前找到的from位置上加6,下一次查找就不会再找当前的from
             }
-            allColumnStr = beginIndex>6? sqlStr.substring(6, beginIndex):""; //从原SQL中提取完整的字段,tempSQLStr中子查询select被替换掉了
+            allColumnStr = beginIndex > 6 ? sqlStr.substring(6, beginIndex) : ""; //从原SQL中提取完整的字段,tempSQLStr中子查询select被替换掉了
             return allColumnStr; //使用逗号分割为字段列表
         } else {//增删改只涉及单表,不存在伪列的情况
             String tableName = getTableBySql(sqlStr);//获取表名
@@ -399,7 +384,7 @@ public class MyDbHelper {//目前只差主键的条件优化
                 return processFail("依据表名获取字段信息出错:".concat(LogUtils.getException(e)), tableName, null);
             }
         }
-        return processSuccess(null, tableName, null);
+        return processSuccess(null);
     }
 
     //获取SQL语句中的所有书名号变量
@@ -420,7 +405,7 @@ public class MyDbHelper {//目前只差主键的条件优化
     }
 
     //获取SQL执行的参数集:针对书名号变量
-    private Map<String, Object> getdbValueForSql(String sqlStr, List<String> varList, boolean isSQLBatch, Map<String, Object> signParam) {
+    private Map<String, Object> getdbValueForSql(String sqlStr, List<String> varList, Map<String, Object> signParam) {
         String newSqlStr = sqlStr;
         List<Object> dbValue = new ArrayList<>();//执行参数
         String sqlVar = sqlStr;//针对非参数化执行的SQL语句执行
@@ -431,40 +416,35 @@ public class MyDbHelper {//目前只差主键的条件优化
                 newColumnName = newColumnName.substring(1);//去掉:才可以取值
             }
             Object currentVar = valueObj.get(newColumnName);//优先从当前MAP中直接获取
-            if (isSQLBatch) {//如果是语句方式执行则修改语句
-                sqlVar = sqlVar.replace("《".concat(newColumnName).concat("》"), "\"".concat(Objects.nonNull(currentVar) ? currentVar.toString() : "").concat("\""));
-            } else {
-                if (columnName.startsWith(":")) {//处理in,只是书名号方式存在
-                    String[] varSplit = Objects.isNull(currentVar) ? null : currentVar.toString().split(",");//使用逗号进行分组
-                    if (Objects.isNull(varSplit)) {//
-                        newSqlStr = newSqlStr.replaceFirst(columnName.concat("?"), "?"); //修订SQL
-                    } else {
-                        List<String> tempVarList = new ArrayList<>();//准备对应的?
-                        for (String signVar : varSplit) {//循环进行替换
-                            dbValue.add(signVar);//添加变量
-                            tempVarList.add("?");
-                        }
-                        newSqlStr = newSqlStr.replaceFirst(columnName.concat("?"), String.join(",", tempVarList)); //修订SQL
-                    }
+
+            if (columnName.startsWith(":")) {//处理in,只是书名号方式存在
+                String[] varSplit = Objects.isNull(currentVar) ? null : currentVar.toString().split(",");//使用逗号进行分组
+                if (Objects.isNull(varSplit)) {//
+                    newSqlStr = newSqlStr.replaceFirst(columnName.concat("?"), "?"); //修订SQL
                 } else {
-                    dbValue.add(currentVar);//添加变量
+                    List<String> tempVarList = new ArrayList<>();//准备对应的?
+                    for (String signVar : varSplit) {//循环进行替换
+                        dbValue.add(signVar);//添加变量
+                        tempVarList.add("?");
+                    }
+                    newSqlStr = newSqlStr.replaceFirst(columnName.concat("?"), String.join(",", tempVarList)); //修订SQL
                 }
+            } else {
+                dbValue.add(currentVar);//添加变量
             }
         }
-        if (isSQLBatch) {//如果是语句方式执行则修改语句
-            dbValue.add(sqlVar);//添加变量
-        }
+
         Map<String, Object> returnData = new HashMap<>();
         returnData.put("dbValue", dbValue);//执行参数
         returnData.put("newSqlStr", newSqlStr);//修订后的SQL语句,针对in方式进行修订
         return returnData;
     }
 
-    //组建SQL的where以及对应的执行参数,与SQL语句无关,所以兼容SQL语句方式和表名方式(event, isSQLBatch, signParam, rowAuth,allSQLColumn)
-    private Map<String, Object> getdbFilter(List<String> varList, String event, boolean isSQLBatch, Map<String, Object> signParam, List<Map<String, Object>> rowAuth, String allSQLColumn) {
+    //组建SQL的where以及对应的执行参数,与SQL语句无关,所以兼容SQL语句方式和表名方式(event,  signParam, rowAuth,allSQLColumn)
+    private Map<String, Object> getdbFilter(List<String> varList, String event, Map<String, Object> signParam, List<Map<String, Object>> rowAuth, String allSQLColumn) {
         List<Object> dbFilter = new ArrayList<>();//初始化条件执行参数
         String whereStr = "";//初始化条件字符串
-        if (!"1".equals(event) || !isSQLBatch) {//新增不存在条件,除非insert select才存在
+        if (!"1".equals(event)) {//新增不存在条件,除非insert select才存在
 
             List<Map<String, Object>> filterList = standarInFilter(signParam, event, rowAuth);//先进行上传条件参数的标准化,同时把行权限进行合并
             if (filterList.size() > 0) {//如果存在上传的条件参数或者存在行权限
@@ -477,10 +457,10 @@ public class MyDbHelper {//目前只差主键的条件优化
                         whereStr = whereStr.concat(filterMap.get("left").toString())
                                 .concat(column.toString())
                                 .concat(comparator.toString())
-                                .concat(" is null ".equals(comparator) ? "" : (isSQLBatch ? "\"".concat(filterMap.get("value").toString()).concat("\"") : "?"))
+                                .concat(" is null ".equals(comparator) ? "" : "?")
                                 .concat(filterMap.get("right").toString())
                                 .concat((MapTools.isBlank(connector)) ? " and " : ("lastConnector".equals(connector) ? "" : " ".concat(connector).concat(" ")));
-                        if (!" is null ".equals(comparator) && !isSQLBatch) {//不是is null,且不是SQL语句执行方式
+                        if (!" is null ".equals(comparator)) {//不是is null,且不是SQL语句执行方式
                             dbFilter.add(filterMap.get("value"));//添加执行参数
                         }
                     }
@@ -620,7 +600,7 @@ public class MyDbHelper {//目前只差主键的条件优化
             List<Map<String, Object>> fullSelect = new ArrayList<>();
             for (Object signValue : dbValue) {
                 try {//执行查询
-                    Map<String, Object> returnData = processSuccess(theJdbcTemplate.queryForList(signSql, ((List) signValue).toArray()), signSql, sqlParmMap.get("signParam"));
+                    Map<String, Object> returnData = processSuccess(theJdbcTemplate.queryForList(signSql, ((List) signValue).toArray()));
 //                    String rowCountSQL = sqlParmMap.get("rowCountSql").toString();//提取行总数查询语句
 //                    if (!MapTools.isBlank(rowCountSQL)) {
 //                        returnData.put("rowcount", theJdbcTemplate.queryForObject(rowCountSQL, Integer.class, ((List)signValue).toArray()));
@@ -638,62 +618,17 @@ public class MyDbHelper {//目前只差主键的条件优化
                     System.out.println("批量查询异常,异常信息: " + LogUtils.getException(e));
                 }
             }
-            return processSuccess(fullSelect, signSql, sqlParmMap);
-        }
-        if ((Boolean) sqlParmMap.get("isSQLBatch")) {
-            return JDBCSQLBatch(signSql, dbValue, sqlParmMap.get("signParam"));
+            return processSuccess(fullSelect);
         }
+
         return JDBCBatch(signSql, dbValue, sqlParmMap.get("signParam"));
     }
 
-    public Map<String, Object> JDBCSQLBatch(String sqlStr, List<Object> dbValue, Object signParam) {
-        if (sqlStr.contains("?") && dbValue.size() == 0) {  //要求参数但是参数为空则返回
-            return processSuccess(null, sqlStr, dbValue);
-        }
-        Connection connection = null;
-        Statement stmd = null;
-        try {
-            connection = theDataSource.getConnection();//获取连接
-            stmd = connection.createStatement();//非预编译方式
-            connection.setAutoCommit(false);    //手动事务
-            for (Object signdbValue : dbValue) {//循环添加参数
-                stmd.addBatch(signdbValue.toString());
-            }
-            int[] ints = stmd.executeBatch();
-            connection.commit(); // 统一提交
-            stmd.clearBatch();
-            return processSuccess(dbValue, sqlStr, signParam);
-        } catch (Exception e) {
-            try {
-                if (connection != null) {
-                    connection.rollback();
-                }
-            } catch (SQLException ex) {
-                System.out.println("jdbc 批量新增 : 事务回滚异常信息:".concat(LogUtils.getException(e)));
-            }
-            return processFail("执行批量更新SQL异常 ".concat(LogUtils.getException(e)).concat("事务回滚"), sqlStr, signParam);
-        } finally {
-            if (stmd != null) {
-                try {
-                    stmd.close();
-                } catch (SQLException e) {
-                    System.out.println("Statement 关闭连接失败");
-                }
-            }
-            if (connection != null) {
-                try {
-                    connection.close();
-                } catch (SQLException e) {
-                    System.out.println("Statement 关闭连接失败");
-                }
-            }
-        }
-    }
 
     //JDBC更新
     public Map<String, Object> JDBCBatch(String sqlStr, List<Object> dbValue, Object signParam) {
         if (sqlStr.contains("?") && dbValue.size() == 0) {  //要求参数但是参数为空则返回
-            return processSuccess(null, sqlStr, dbValue);
+            return processSuccess(null);
         }
         Connection connection = null;
         PreparedStatement sqlPS = null;
@@ -711,7 +646,7 @@ public class MyDbHelper {//目前只差主键的条件优化
             sqlPS.executeBatch();
             connection.commit(); // 统一提交
             sqlPS.clearBatch();
-            return processSuccess(dbValue, sqlStr, signParam);
+            return processSuccess(dbValue);
         } catch (Exception e) {
             try {
                 if (connection != null) {
@@ -749,17 +684,21 @@ public class MyDbHelper {//目前只差主键的条件优化
         theJdbcTemplate = null;//无条件情况即可
     }
 
+
     //统一成功信息处理
-    public Map<String, Object> processSuccess(Object returnData, String sql, Object params) {
-        // todo 应该分析returnData是否包含code,如果包含应该合并分解--- 批量时的问题
+    public Map<String, Object> processSuccess(Object returnData) {
+        if (returnData instanceof Map) {
+            Map<String, Object> resultData1 = (Map<String, Object>) returnData;
+            resultData1.put("code", "0");
+            return resultData1;
+        }
         Map<String, Object> returnMap = new HashMap<>();//用于当前方法统一返回参数,不存在深拷贝问题
         returnMap.put("code", "0");
         returnMap.put("returnData", returnData);
-        returnMap.put("sql", sql); //记录日志时 需要返回时去掉 dataProcess中处理
-        returnMap.put("params", params);
         return returnMap;
     }
 
+
     //统一错误信息处理
     public Map<String, Object> processFail(String errorMessage, String sql, Object params) {
         Map<String, Object> returnMap = new HashMap<>();//用于当前方法统一返回参数,不存在深拷贝问题
@@ -774,7 +713,7 @@ public class MyDbHelper {//目前只差主键的条件优化
     public Map<String, Object> execute(String sql) {
         try {
             theJdbcTemplate.execute(sql);
-            return processSuccess(null, sql, null);
+            return processSuccess(null);
         } catch (Exception e) {
             return processFail("执行创建表错误: ".concat(LogUtils.getException(e)), sql, null);
         }
@@ -783,7 +722,7 @@ public class MyDbHelper {//目前只差主键的条件优化
     //查询
     public Map<String, Object> queryByParamsReturnList(String sql, Object... params) {
         try {
-            return processSuccess(theJdbcTemplate.queryForList(sql, params), sql, params);
+            return processSuccess(theJdbcTemplate.queryForList(sql, params));
         } catch (Exception e) {
             return processFail("根据条件查询异常".concat(LogUtils.getException(e)), sql, params);
         }
@@ -794,10 +733,10 @@ public class MyDbHelper {//目前只差主键的条件优化
         boolean bathpmNull = Objects.isNull(batchPm) || batchPm.size() == 0 || Objects.isNull(batchPm.get(0));
         try {
             if (sql.contains("?") && (bathpmNull && params.length != StringUtils.countOccurrencesOf(sql, "?"))) {
-                return processSuccess(null, sql, null);
+                return processSuccess(null);
             }
             Object tempObject = bathpmNull ? theJdbcTemplate.update(sql, params) : theJdbcTemplate.batchUpdate(sql, batchPm);
-            return processSuccess(tempObject, sql, bathpmNull ? batchPm : params);
+            return processSuccess(tempObject);
         } catch (Exception e) {
             return processFail("根据条件更新异常,SQL: ".concat(LogUtils.getException(e)), sql, bathpmNull ? batchPm : params);
         }