Browse Source

2.0 异常修改

pms 1 year ago
parent
commit
5a1e9cd8ae

+ 43 - 91
mainFactory/src/main/java/org/bfkj/MainFactoryApplication.java

@@ -4,10 +4,14 @@ import org.bfkj.application.DataProcess;
 import org.bfkj.application.ServiceInputControl;
 import org.bfkj.config.AppConfig;
 import org.bfkj.config.ObjectMap;
+import org.bfkj.config.RemoteDB;
+import org.bfkj.config.RemoteLogDB;
 import org.bfkj.utils.LogUtils;
 import org.bfkj.utils.MapTools;
 import org.bfkj.utils.MyDbHelper;
 import org.bfkj.utils.ScheduleUtil;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -25,11 +29,15 @@ import java.util.*;
 
 @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
 @EnableScheduling
-public class MainFactoryApplication {
+public class MainFactoryApplication implements InitializingBean {
 
-    private final String INSERT_SQL = "INSERT INTO log_success_a ( success, location, logContent, createtime, serviceId, workId, event, iNDataContent, outDataContent, calculationLocation, dataObjectId) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
-    private final String ERROR_SQL = "INSERT INTO log_error_a ( success, location, logContent, createtime, serviceId, workId, event, iNDataContent, outDataContent, calculationLocation, dataObjectId) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
-    private final String FULL_DATA_SQL = "INSERT INTO log_fulldata_a ( dataObjectId, FULL_DATA_SQL) VALUES (?,?)";
+    private final String INSERT_SQL = "INSERT INTO log_success ( success, location, logContent, createtime, serviceId, workId, event, iNDataContent, outDataContent, calculationLocation, dataObjectId) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+    private final String ERROR_SQL = "INSERT INTO log_error ( success, location, logContent, createtime, serviceId, workId, event, iNDataContent, outDataContent, calculationLocation, dataObjectId) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+
+    @Autowired
+    private RemoteDB remoteDB;
+    @Autowired
+    private RemoteLogDB remoteLogDB;
 
     /*服务初始化: 启动服务*/
     public static void main(String[] args) {
@@ -38,14 +46,10 @@ public class MainFactoryApplication {
             System.out.println("配置文件夹检测失败");
             return;
         }
+        /*获取初始地址*/
         Map<String, String> systemDefaultParams = getSystemDefaultParams(path);
         ConfigurableApplicationContext context = SpringApplication.run(MainFactoryApplication.class, args);
         Environment env = context.getBean(Environment.class);
-
-        Map<String, String> configByEnvironment = getConfigByEnvironment(env);
-        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);
@@ -57,15 +61,11 @@ public class MainFactoryApplication {
                     systemDefaultParams.put(key, keyValue);
                 }
             }
+            /*设置远程连接、服务地址*/
+            AppConfig.serviceURL = systemDefaultParams.get("serviceURL");
+            AppConfig.REMOTE_DB_CONNECT = systemDefaultParams.get("remote_db_connect");
         }
-        //调用接口,更新系统参数(AppConfig类中的方法)
-        AppConfig.setSystemParameters(systemDefaultParams);
-        //初始化本地日志数据库
-        if (!LocalInitDB()) {
-            System.out.println("初始化本地日志数据库失败");
-            return;
-        }
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             System.out.println("初始化获取MyDbHelper对象异常");
             return;
@@ -75,9 +75,8 @@ public class MainFactoryApplication {
             return;
         }
         Runtime.getRuntime().addShutdownHook(new Thread(MainFactoryApplication::currentWorkExit));
-        String serviceURL = AppConfig.getSystemParams("serviceURL");
         try {
-            Map<String, String> hasDeployNodeIDMap = myDbHelper.queryForObject("select Max(deployNodeID) from deploynode where serviceURL = ? ", serviceURL);
+            Map<String, String> hasDeployNodeIDMap = myDbHelper.queryForObject("select Max(deployNodeID) from deploynode where serviceURL = ? ", AppConfig.serviceURL);
             if (hasDeployNodeIDMap.get("code").equals("-1")) {
                 System.out.println("初始化获取机器表信息: 执行SQL失败 " + hasDeployNodeIDMap.get("message"));
                 return;
@@ -86,9 +85,9 @@ public class MainFactoryApplication {
             if (!"".equals(workID) && !"0".equals(workID)) {
                 AppConfig.WORK_ID = workID;
             } else {
-                Map<String, String> returnKeyValues = myDbHelper.insertReturnKeyValues("insert into deploynode(serviceURL)  values(?)", serviceURL);
+                Map<String, String> returnKeyValues = myDbHelper.insertReturnKeyValues("insert into deploynode(serviceURL)  values(?)", AppConfig.serviceURL);
                 if (returnKeyValues.get("code").equals("-1")) {
-                    System.out.println("根据serviceURL新增入库失败: " + ("insert into deploynode(serviceURL)  values(?)") + " 参数: " + serviceURL);
+                    System.out.println("根据serviceURL新增入库失败: " + ("insert into deploynode(serviceURL)  values(?)") + " 参数: " + AppConfig.serviceURL);
                     return;
                 }
                 AppConfig.WORK_ID = returnKeyValues.get("returnData");
@@ -121,37 +120,6 @@ public class MainFactoryApplication {
         }
         System.out.println("本机共部署服务个数:" + serviceList.size() + ",启动主动采集个数:" + autoCount);
     }
-
-    private static Map<String, String> getConfigByEnvironment(Environment env) {
-        String url = env.getProperty("mydb.url");
-        String uname = env.getProperty("mydb.title");
-        String cipher = env.getProperty("mydb.cipher");
-        String type = env.getProperty("mydb.type");
-        String serviceURL = env.getProperty("mydb.serviceURL");
-        Map<Object, Object> remoteDBConnect = new HashMap<>();
-        if (null != url) {
-            remoteDBConnect.put("url", url);
-        }
-        if (null != uname) {
-            remoteDBConnect.put("username", uname);
-        }
-        if (null != cipher) {
-            remoteDBConnect.put("password", cipher);
-        }
-        if (null != type) {
-            remoteDBConnect.put("driver-class-name", type);
-        }
-        Map<String, String> returnMap = new HashMap<>();
-        if (null != serviceURL) {
-            returnMap.put("serviceURL", serviceURL);
-        }
-        if (null != url && null != uname && null != type && null != cipher) {
-            returnMap.put("remote_db_connect", MapTools.objToJSONStr(remoteDBConnect));
-        }
-        return returnMap;
-    }
-
-
     /**
      * 获取系统默认参数
      *
@@ -172,7 +140,7 @@ public class MainFactoryApplication {
     private static void currentWorkExit() {
         ServiceInputControl.ScheduleTaskMaps.values().forEach(ScheduleUtil::cancel);
         //关闭数据库连接
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         myDbHelper.close();
         System.out.println("系统正常退出");
     }
@@ -197,23 +165,6 @@ public class MainFactoryApplication {
         }
         return true;
     }
-
-    public static boolean LocalInitDB() {
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.LOCAL_LOG_CONNECT));
-        if (Objects.nonNull(myDbHelper.getErrorMessage())) {
-            System.out.println("初始化获取MyDbHelper对象异常");
-            return false;
-        }
-        try {
-            myDbHelper.execute("CREATE TABLE if not EXISTS `log_success_a` (  `id` int PRIMARY KEY  NOT NULL  ,  `success` TEXT  DEFAULT NULL,  `location` TEXT DEFAULT NULL,  `logContent` TEXT,  `serviceId`INT  DEFAULT NULL,  `workId` INT  DEFAULT NULL,  `iNDataContent` TEXT DEFAULT NULL, `outDataContent` TEXT DEFAULT NULL,`calculationLocation` TEXT DEFAULT NULL, `dataObjectId` TEXT DEFAULT NULL,`event` TEXT DEFAULT NULL,`createtime` timestamp not null default current_timestamp)");
-            myDbHelper.execute("CREATE TABLE if not EXISTS `log_error_a` (  `id` int  PRIMARY KEY  NOT NULL   ,  `success` TEXT  DEFAULT NULL,  `location` TEXT DEFAULT NULL,  `logContent` TEXT,  `serviceId` INT  DEFAULT NULL,  `workId` INT  DEFAULT NULL,  `iNDataContent` TEXT DEFAULT NULL, `outDataContent` TEXT DEFAULT NULL,`calculationLocation` TEXT DEFAULT NULL,  `dataObjectId` TEXT DEFAULT NULL,`event` TEXT DEFAULT NULL,`createtime` timestamp not null default current_timestamp)");
-            myDbHelper.execute("CREATE TABLE if not EXISTS `log_fulldata_a` (  `id` int(11)  NOT NULL auto_increment  PRIMARY KEY,  `dataObjectId `TEXT  DEFAULT NULL,`FULL_DATA_SQL` TEXT DEFAULT NULL)");
-        } catch (Exception e) {
-            return false;
-        }
-        return true;
-    }
-
     public static boolean initDB(MyDbHelper myDbHelper) {
 
         Map<String, String> hasAppMap = myDbHelper.queryForObject("select count(1) hasCount  from t_application where app_id =?", "1");
@@ -263,9 +214,8 @@ public class MainFactoryApplication {
         }
         try {
             //远程表日志表结构结构
-            myDbHelper.execute("CREATE TABLE if not EXISTS `log_success_a` (  `id` int(11)  NOT NULL auto_increment  PRIMARY KEY,  `success` varchar(8)  DEFAULT NULL,  `location` varchar(255) DEFAULT NULL,  `logContent` varchar(1024)  DEFAULT NULL,  `serviceId` int(11) DEFAULT NULL,  `workId` int(11) DEFAULT NULL,`event` varchar(2) DEFAULT NULL, `iNDataContent` varchar(2048) DEFAULT NULL, `outDataContent` varchar(2048) DEFAULT NULL,`calculationLocation` varchar(8)  DEFAULT NULL,   `dataObjectId` varchar(32) DEFAULT NULL,`createtime` datetime )");
-            myDbHelper.execute("CREATE TABLE if not EXISTS `log_error_a` (  `id` int(11)  NOT NULL auto_increment  PRIMARY KEY,  `success` varchar(8)  DEFAULT NULL,  `location` varchar(255) DEFAULT NULL, `logContent` varchar(1024)  DEFAULT NULL,  `serviceId` int(11) DEFAULT NULL,  `workId` int(11) DEFAULT NULL,  `event` varchar(2) DEFAULT NULL,`iNDataContent` varchar(2048) DEFAULT NULL, `outDataContent` varchar(2048) DEFAULT NULL,`calculationLocation` varchar(8)  DEFAULT NULL,  `dataObjectId` varchar(32) DEFAULT NULL,`createtime`datetime)");
-            myDbHelper.execute("CREATE TABLE if not EXISTS `log_fulldata_a` (  `id` int(11)  NOT NULL auto_increment  PRIMARY KEY,  `dataObjectId` varchar(32) DEFAULT NULL,`FULL_DATA_SQL` longtext DEFAULT NULL)");
+            myDbHelper.execute("CREATE TABLE log_error (id int NOT NULL auto_increment  PRIMARY KEY, success varchar(8) DEFAULT NULL, location varchar(256) DEFAULT NULL,  logContent text,  serviceId int DEFAULT NULL,  workId int DEFAULT NULL,  event varchar(2) DEFAULT NULL,  iNDataContent longtext,  outDataContent text,  calculationLocation varchar(256) DEFAULT NULL,  dataObjectId varchar(32) DEFAULT NULL,  createtime datetime DEFAULT NULL");
+            myDbHelper.execute("CREATE TABLE log_success (id int NOT NULL auto_increment  PRIMARY KEY, success varchar(8) DEFAULT NULL, location varchar(256) DEFAULT NULL,  logContent text,  serviceId int DEFAULT NULL,  workId int DEFAULT NULL,  event varchar(2) DEFAULT NULL,  iNDataContent longtext,  outDataContent text,  calculationLocation varchar(256) DEFAULT NULL,  dataObjectId varchar(32) DEFAULT NULL,  createtime datetime DEFAULT NULL");
             return true;
         } catch (Exception e) {
             return false;
@@ -290,16 +240,15 @@ public class MainFactoryApplication {
         Runtime.getRuntime().gc();
     }
 
-    private MyDbHelper baseDbHelper;
+    private MyDbHelper logDbHelper;
 
     /*1每2秒执行一次 日志的批量插入*/
     @Scheduled(cron = "*/2 * * * * *")
     public void batchLog() {
         Map<String, List<Object>> logSuccessMap = LogUtils.logSuccessMapList;
         Map<String, List<Object>> logErrorMap = LogUtils.logErrorMapList;
-        Map<String, List<Object>> logSourceMap = LogUtils.sourceMapList;
         /*批量写日志*/
-        if (logSuccessMap.size() == 0 && logErrorMap.size() == 0 && logSourceMap.size() == 0) return;
+        if (logSuccessMap.size() == 0 && logErrorMap.size() == 0) return;
         long current = System.currentTimeMillis();
         List<String> successList = logSuccessMap.keySet().stream().filter(key -> Long.parseLong(key) < current).toList();
         List<Object> logSuccessList = new ArrayList<>();
@@ -313,30 +262,33 @@ public class MainFactoryApplication {
             logErrorList.addAll(logErrorMap.get(currentTime));
             logErrorMap.remove(currentTime);
         }
-        List<String> sourceList = logSourceMap.keySet().stream().filter(key -> Long.parseLong(key) < current).toList();
-        List<Object> logSourceList = new ArrayList<>();
-        for (String currentTime : sourceList) {
-            logSourceList.addAll(logSourceMap.get(currentTime));
-            logSourceMap.remove(currentTime);
-        }
-        if (Objects.isNull(baseDbHelper)) {
-            baseDbHelper = new MyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));//获取底座数据库对象
-            if (Objects.nonNull(baseDbHelper.getErrorMessage())) {
+        if (Objects.isNull(logDbHelper)) {
+            logDbHelper = new MyDbHelper(AppConfig.REMOTE_DB_LOG_CONNECT);//获取底座数据库对象
+            if (Objects.nonNull(logDbHelper.getErrorMessage())) {
                 return;
             }
         }
-        if (Objects.isNull(baseDbHelper)) {
+        if (Objects.isNull(logDbHelper)) {
             System.out.println("获取远程数据库失败:写入日志失败");
             return;
         }
         try {
-            if (logSuccessList.size() > 0) baseDbHelper.JDBCBatch(INSERT_SQL, logSuccessList, null);
-            if (logErrorList.size() > 0) baseDbHelper.JDBCBatch(ERROR_SQL, logErrorList, null);
-            if (logSourceList.size() > 0) {
-                baseDbHelper.JDBCBatch(FULL_DATA_SQL, logSourceList, null);
-            }
+            if (logSuccessList.size() > 0) logDbHelper.JDBCBatch(INSERT_SQL, logSuccessList, null);
+            if (logErrorList.size() > 0) logDbHelper.JDBCBatch(ERROR_SQL, logErrorList, null);
         } catch (Exception e) {
             System.out.println("日志记录异常" + LogUtils.getException(e));
         }
     }
+
+    @Override
+    public void afterPropertiesSet() {
+        Map<String,Object> mapDB = (Map<String, Object>) MapTools.strToObj( MapTools.objToJSONStr(remoteDB));
+        mapDB.put("driver-class-name",mapDB.get("driverClassName"));
+        AppConfig.REMOTE_DB_CONNECT = MapTools.objToJSONStr(mapDB);
+
+        Map<String,Object> maplogDB = (Map<String, Object>) MapTools.strToObj(MapTools.objToJSONStr(remoteLogDB));
+        maplogDB.put("driver-class-name",maplogDB.get("driverClassName"));
+        AppConfig.REMOTE_DB_LOG_CONNECT = MapTools.objToJSONStr(maplogDB);
+        AppConfig.serviceURL =remoteDB.getServiceURL();
+    }
 }

+ 8 - 1
mainFactory/src/main/java/org/bfkj/api/CommonApi.java

@@ -85,6 +85,13 @@ public class CommonApi {
         return commonInterface(token, params, "3");
     }
 
+
+
+
+
+
+
+
     /**
      * 统一接收处理
      */
@@ -127,7 +134,7 @@ public class CommonApi {
             return errMap;
         }
         //通过服务ID 查询对应服务的服务类型是否为1,如果时则继续,否则返回
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             HashMap<String, Object> errMap = new HashMap<>();
             errMap.put("code", "-1");

+ 42 - 0
mainFactory/src/main/java/org/bfkj/api/TransferData.java

@@ -0,0 +1,42 @@
+package org.bfkj.api;
+
+import org.bfkj.application.DataProcess;
+import org.bfkj.config.ObjectMap;
+import org.bfkj.utils.MapTools;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+
+@RestController
+@RequestMapping("externalApi/openApi")
+public class TransferData {
+    /**
+     * /**
+     * /**
+     * 删除入口CRUD
+     */
+    @PostMapping("sendData")
+    @ResponseBody
+    public Object sendData(@RequestHeader Map<String, String> token, @RequestBody Map<String, Object> params) {
+        System.out.println("params"+params);
+        Object serviceId = params.get("serviceId");
+        if (Objects.isNull(serviceId)) {
+            HashMap<String, Object> errMap = new HashMap<>();
+            errMap.put("code", "-1");
+            errMap.put("message", "缺失必要的参数:serviceId" + params);
+            return errMap;
+        }
+        //通过服务ID 查询对应服务的服务类型是否为1,如果时则继续,否则返回
+        DataProcess dataProcessObj = ObjectMap.getordropInput(serviceId.toString(), true);//获取数据输出处理对象
+        if (null == dataProcessObj || !MapTools.isBlank(dataProcessObj.getErrorMessage())) {
+            HashMap<String, Object> errMap = new HashMap<>();
+            errMap.put("code", "-1");
+            errMap.put("message", "服务不可用:" + (null == dataProcessObj ? "" : dataProcessObj.getErrorMessage()));
+            return errMap;
+        }
+        return dataProcessObj.processData(params, token.get("user_id"));
+    }
+}

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

@@ -44,7 +44,7 @@ public class AuthApplicationImpl {
     public Object getToken(Map<String, String> params, String sessionID) {
         String appid = params.get("appid");
         String appSecret = params.get("appSecret");
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("获取数据库连接失败");
         }
@@ -87,7 +87,7 @@ public class AuthApplicationImpl {
      * @return
      */
     public String verificationToken(String appToken) {
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return "验证令牌获取远程数据库连接失败" + myDbHelper.getErrorMessage();
         }
@@ -108,7 +108,7 @@ public class AuthApplicationImpl {
             return processFail("app_token为空,刷新失败");
 
         }
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("刷新应用app_token获取远程数据库连接失败" + myDbHelper.getErrorMessage());
         }
@@ -157,7 +157,7 @@ public class AuthApplicationImpl {
         if (!MapTools.isNumber(appid)) {
             return processFail("tokan校验失败:" + appid);
         }
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("获取验证码,获取数据库连接失败");
         }
@@ -227,7 +227,7 @@ public class AuthApplicationImpl {
             return processFail("登陆token校验失败:" + app_id);
         }
         //校验验证码
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("用户登陆,获取数据库连接失败");
         }
@@ -267,7 +267,7 @@ public class AuthApplicationImpl {
         String user_token = params.get("user_token");
         String user_id = params.get("user_id");
         if (Objects.isNull(user_token) || Objects.isNull(user_id)) return "user_token 或则 user_id为空";
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return "验证user_token获取远程数据库连接失败" + myDbHelper.getErrorMessage();
         }
@@ -289,7 +289,7 @@ public class AuthApplicationImpl {
         if (Objects.nonNull(errorInfo)) {
             return processFail("用户登出失败: " + errorInfo);
         }
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("用户登出,获取远程数据库连接失败" + myDbHelper.getErrorMessage());
         }
@@ -307,7 +307,7 @@ public class AuthApplicationImpl {
         if (Objects.nonNull(errorInfo)) {
             return processFail("获取权限: " + errorInfo);
         }
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("获取用户权限,获取远程数据库连接失败" + myDbHelper.getErrorMessage());
         }
@@ -325,7 +325,7 @@ public class AuthApplicationImpl {
             return processFail("权限编号为空");
         }
         String auth_id = data.get("auth_id").toString();
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("初始化列设置:权限编号:" + auth_id + " 获取数据库对象异常");
         }
@@ -472,7 +472,7 @@ public class AuthApplicationImpl {
             sql = sql + " and dataObjectId = ?";
             pmList.add(dataObjectId);
         }
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("异常数据恢复:获取远程数据库连接失败" + myDbHelper.getErrorMessage());
         }

+ 1 - 6
mainFactory/src/main/java/org/bfkj/application/DataProcess.java

@@ -28,7 +28,7 @@ public class DataProcess {//数据处理对象
         lastActive = System.currentTimeMillis();//默认最后活跃时间
         serviceId = service_Id;
         try {
-            baseDbHelper = new MyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));//获取底座数据库对象
+            baseDbHelper = new MyDbHelper(AppConfig.REMOTE_DB_CONNECT);//获取底座数据库对象
             if (Objects.nonNull(baseDbHelper.getErrorMessage())) {
                 errorMessage = "获取底座myDbHelper对象异常: ".concat(baseDbHelper.getErrorMessage());
                 return;
@@ -186,11 +186,6 @@ public class DataProcess {//数据处理对象
                             signRowAuth.put(columnName, row_auth);
                             rowAuth.addAll(baseDbHelper.changeSignFilter(signRowAuth, connect, connect.equals("!=") ? "and" : "or"));
                         }
-//                        if (rowAuth.size() > 0) {//存在行权限则进行括号包裹
-//                            rowAuth.get(0).put("left", "(");
-//                            rowAuth.get(rowAuth.size() - 1).put("connector", "  and ");
-//                            rowAuth.get(rowAuth.size() - 1).put("right", " ) ");
-//                        }   //(c1 = pek )
                     }
                 });
                 if (rowAuth.size() > 0) {//存在行权限则进行括号包裹

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

@@ -35,7 +35,7 @@ public class ServiceInputControl {
      * @return
      */
     public static Map<String,Object> start(String service_id) {
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("获取采集服务执行SQL异常");
         }
@@ -87,7 +87,7 @@ public class ServiceInputControl {
         boolean reset = ScheduleUtil.cancel(scheduleTask);
         ScheduleTaskMaps.remove(service_id);
         // 修改服务的状态
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("服务:" + service_id +" 停止 获取数据库对象失败,异常信息 " + myDbHelper.getErrorMessage());
         }
@@ -102,7 +102,7 @@ public class ServiceInputControl {
             return processFail("服务" + (statue.equals("1") ? "启动" : "停止") + (MapTools.isBlank(serviceId) ? "失败:serviceId为空" : "成功"));
         }
 
-        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));
+        MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return processFail("startOrStop 获取数据库连接对象失败");
 

+ 4 - 26
mainFactory/src/main/java/org/bfkj/config/AppConfig.java

@@ -1,41 +1,19 @@
 package org.bfkj.config;
 
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 public class AppConfig {
-    private final static Map<String, String> system_parameter = new HashMap<>(); // 全局公共变量
-    public static final String REMOTE_DB_CONNECT = "remote_db_connect";
-    public static final String LOCAL_DB_CONNECT = "local_db_connect";
-    public static final String LOCAL_LOG_CONNECT = "local_log_connect";
+    public static String REMOTE_DB_CONNECT = "";
+    public static String REMOTE_DB_LOG_CONNECT = "";
+    public static String serviceURL = "";
     public static String WORK_ID;
     public static Integer SERVICE_ERR_MAX = 3; //服务最大连续异常次数
 
-    public static  Integer  count = 0;
-
-
-    public static HashMap<String, String> staticEvent = new HashMap<String, String>() {{
+    public static HashMap<String, String> staticEvent = new HashMap<>() {{
         put("select", "0");
         put("update", "2");
         put("insert", "1");
         put("delete", "3");
     }};
-    /***
-     * 设置系统参数
-     * @param maps 本机workId
-     */
-    public static void setSystemParameters(Map<String, String> maps) {
-        WORK_ID = maps.get("work_id");
-        system_parameter.putAll(maps);
-    }
-    /**
-     * 获取系统参数
-     *
-     * @param key
-     */
-    public static String getSystemParams(String key) {
-        return system_parameter.get(key);
-    }
 }

+ 14 - 14
mainFactory/src/main/java/org/bfkj/config/EsConfig.java → mainFactory/src/main/java/org/bfkj/config/ElasticsearchConfig.java

@@ -5,7 +5,7 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
 @Configuration
-public class EsConfig {
+public class ElasticsearchConfig {
     @Value("${isEs.open}")
     private boolean open;
     @Value("${isEs.scheme}")
@@ -26,19 +26,19 @@ public class EsConfig {
     @Value("${isEs.errorIndexName}")
     private String errorIndexName;
 
-    @Bean("EsConfig")
-    public EsConfig EsConfig() {
-        EsConfig esConfig = new EsConfig();
-        esConfig.open = open;
-        esConfig.scheme = scheme;
-        esConfig.hostname = hostname;
-        esConfig.port = port;
-        esConfig.auth = auth;
-        esConfig.username = username;
-        esConfig.password = password;
-        esConfig.errorIndexName = errorIndexName;
-        esConfig.successIndexName = successIndexName;
-        return esConfig;
+    @Bean("ElasticBean")
+    public ElasticsearchConfig EsConfig() {
+        ElasticsearchConfig elasticsearchConfig = new ElasticsearchConfig();
+        elasticsearchConfig.open = open;
+        elasticsearchConfig.scheme = scheme;
+        elasticsearchConfig.hostname = hostname;
+        elasticsearchConfig.port = port;
+        elasticsearchConfig.auth = auth;
+        elasticsearchConfig.username = username;
+        elasticsearchConfig.password = password;
+        elasticsearchConfig.errorIndexName = errorIndexName;
+        elasticsearchConfig.successIndexName = successIndexName;
+        return elasticsearchConfig;
 
     }
 

+ 61 - 0
mainFactory/src/main/java/org/bfkj/config/RemoteDB.java

@@ -0,0 +1,61 @@
+package org.bfkj.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@ConfigurationProperties(prefix = "mydb")
+public class RemoteDB {
+    @Value("${mydb.url}")
+    private String url;
+    @Value("${mydb.title}")
+    private String username;
+    @Value("${mydb.cipher}")
+    private String password;
+    @Value("${mydb.type}")
+    private String driverClassName;
+    @Value("${mydb.serviceURL}")
+    private String serviceURL;
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getDriverClassName() {
+        return driverClassName;
+    }
+
+    public void setDriverClassName(String driverClassName) {
+        this.driverClassName = driverClassName;
+    }
+
+    public String getServiceURL() {
+        return serviceURL;
+    }
+
+    public void setServiceURL(String serviceURL) {
+        this.serviceURL = serviceURL;
+    }
+}

+ 51 - 0
mainFactory/src/main/java/org/bfkj/config/RemoteLogDB.java

@@ -0,0 +1,51 @@
+package org.bfkj.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@ConfigurationProperties(prefix = "log" )
+public class RemoteLogDB {
+    @Value("${log.url}")
+    private String url;
+    @Value("${log.title}")
+    private String username;
+    @Value("${log.cipher}")
+    private String password;
+    @Value("${log.type}")
+    private String driverClassName;
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getDriverClassName() {
+        return driverClassName;
+    }
+
+    public void setDriverClassName(String driverClassName) {
+        this.driverClassName = driverClassName;
+    }
+}

+ 5 - 3
mainFactory/src/main/java/org/bfkj/config/SpringContextBeans.java → mainFactory/src/main/java/org/bfkj/config/SpringContextApplication.java

@@ -5,14 +5,16 @@ import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.stereotype.Component;
 
+/**
+ * 用于获取Bean对象
+ */
 @Component
-public class SpringContextBeans implements ApplicationContextAware {
-
+public class SpringContextApplication implements ApplicationContextAware {
     private static ApplicationContext applicationContext;
 
     @Override
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-        SpringContextBeans.applicationContext = applicationContext;
+        SpringContextApplication.applicationContext = applicationContext;
     }
 
     @SuppressWarnings("unchecked")

+ 7 - 3
mainFactory/src/main/java/org/bfkj/protocol/WebAPI.java

@@ -1,5 +1,6 @@
 package org.bfkj.protocol;
 
+import jdk.jfr.ContentType;
 import org.bfkj.utils.LogUtils;
 import org.bfkj.utils.MapTools;
 import org.springframework.http.HttpEntity;
@@ -31,10 +32,13 @@ public class WebAPI {
         if (!restTemplateResult.get("code").equals("0")) {
             return MapTools.processFail(restTemplateResult.get("message").toString());
         }
-        if (header instanceof Map) {
+        if (header instanceof Map ) {
             Map<String, Object>  temeMap=  (Map) header;
-            for (String key : temeMap.keySet()) {
-                webApiHeader.add(key, temeMap.get(key).toString());
+            if (!temeMap.isEmpty()){
+                webApiHeader.clear();
+                for (String key : temeMap.keySet()) {
+                    webApiHeader.add(key, temeMap.get(key).toString());
+                }
             }
         }
         if (MapTools.isNotBlank(method)) {

+ 17 - 39
mainFactory/src/main/java/org/bfkj/utils/LogUtils.java

@@ -2,9 +2,10 @@ package org.bfkj.utils;
 
 
 import org.bfkj.config.AppConfig;
-import org.bfkj.config.EsConfig;
-import org.bfkj.config.SpringContextBeans;
+import org.bfkj.config.ElasticsearchConfig;
+import org.bfkj.config.SpringContextApplication;
 import org.bfkj.protocol.ElasticHandler;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -13,14 +14,15 @@ import java.util.stream.Collectors;
 public class LogUtils { // 依据服务编号ID获取服务类型,如果是异步 异常日志无条件写入到本地数据库(每个服务都有这样的一个数据库) ,在程序启动时会扫描此表,重新进行,如果成功则从此表中移除
     public static Map<String, List<Object>> logErrorMapList = new HashMap<>();
     public static Map<String, List<Object>> logSuccessMapList = new HashMap<>();
-    public static Map<String, List<Object>> sourceMapList = new HashMap<>();
-
     public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-    private static Long deleteTime = 0L;
-
-    private static MyDbHelper myDbHelper;
+    public static  void log(String location, String success, Object calculationLocation, String logContent, String serviceId,  Object iNDataContent, String dataObjectId, Object OutDataContent, Object event) {
+//        ThreadPoolTaskExecutor threadPoolTaskExecutor = SpringContextApplication.getBean("ThreadPoolTaskExecutor");
+//        threadPoolTaskExecutor.submit(() ->
+                logWrite(location, success, calculationLocation, logContent, serviceId, iNDataContent, dataObjectId, OutDataContent, event);
+//        );
+    }
 
-    public static void log(String location, String success, Object calculationLocation, String logContent, String serviceId, Object iNDataContent, String dataObjectId, Object OutDataContent, Object event) {
+    public static void logWrite(String location, String success, Object calculationLocation, String logContent, String serviceId, Object iNDataContent, String dataObjectId, Object OutDataContent, Object event) {
         String inData = MapTools.objToJSONStr(iNDataContent);
         try {
             Map<Object, Object> filterMap = Objects.nonNull(iNDataContent) && ((List) iNDataContent).size() == 2 ? (Map) (((List) iNDataContent).get(1)) : null;
@@ -31,8 +33,8 @@ public class LogUtils { // 依据服务编号ID获取服务类型,如果是异
             System.out.println("过滤:读取空消息: 出现错误".concat(LogUtils.getException(e)).concat(" iNDataContent: ").concat(inData == null ? "" : inData));
             return;
         }
-        EsConfig esConfig = SpringContextBeans.getBean("EsConfig");
-        if (esConfig.isOpen()) {
+        ElasticsearchConfig elasticsearchConfig = SpringContextApplication.getBean("ElasticBean");
+        if (elasticsearchConfig.isOpen()) {
             HashMap<Object, Object> esSendData = new HashMap<>();
             esSendData.put("success", success);
             esSendData.put("location", location);
@@ -46,14 +48,14 @@ public class LogUtils { // 依据服务编号ID获取服务类型,如果是异
             esSendData.put("calculationLocation", Objects.isNull(calculationLocation) ? null : calculationLocation.toString());
             esSendData.put("dataObjectId", dataObjectId);
             ElasticHandler elasticHandler = new ElasticHandler();
-            String connectConfig = MapTools.objToJSONStr(esConfig);
+            String connectConfig = MapTools.objToJSONStr(elasticsearchConfig);
             boolean b;
             if (success.equals("0")) {
-                b = elasticHandler.sendData(esConfig.getSuccessIndexName(), new ArrayList<>() {{
+                b = elasticHandler.sendData(elasticsearchConfig.getSuccessIndexName(), new ArrayList<>() {{
                     add(esSendData);
                 }}, connectConfig, serviceId);
             } else {
-                b = elasticHandler.sendData(esConfig.getErrorIndexName(), new ArrayList<>() {{
+                b = elasticHandler.sendData(elasticsearchConfig.getErrorIndexName(), new ArrayList<>() {{
                     add(esSendData);
                 }}, connectConfig, serviceId);
             }
@@ -61,7 +63,6 @@ public class LogUtils { // 依据服务编号ID获取服务类型,如果是异
                 return;
             }
         }
-        String shortData = MapTools.isNotBlank(inData) ? (inData.length() > 20480 ? inData.substring(0, 20480) : inData) : null;
         List<Object> logParam = new ArrayList<>() {{
             add(success);
             add(location);
@@ -70,14 +71,12 @@ public class LogUtils { // 依据服务编号ID获取服务类型,如果是异
             add(serviceId);
             add(AppConfig.WORK_ID);
             add(Objects.isNull(event) ? null : event.toString());
-            add(shortData);
+            add(inData);
             add(MapTools.objToJSONStr(OutDataContent));
             add(Objects.isNull(calculationLocation) ? null : calculationLocation.toString());
             add(dataObjectId);
         }};
-        // [{"dataContent":"1","dataObjectId":"168130842269100010042250","event":"1"},{"code":"0","returnData":[]}]
-        long l = System.currentTimeMillis() / 1000;
-        String key = l + "";
+        String key = (System.currentTimeMillis() / 1000) + "";
         if (!"0".equals(success)) {
             List<Object> tempLogList = logErrorMapList.containsKey(key) ? logErrorMapList.get(key) : new ArrayList<>();
             tempLogList.add(logParam);
@@ -87,26 +86,6 @@ public class LogUtils { // 依据服务编号ID获取服务类型,如果是异
             tempLogList.add(logParam);
             logSuccessMapList.put(key, tempLogList);
         }
-        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) {
-            if (null == myDbHelper) {
-                myDbHelper = new MyDbHelper(AppConfig.getSystemParams(AppConfig.REMOTE_DB_CONNECT));//获取底座数据库对象;
-            }
-            if (Objects.nonNull(myDbHelper.getErrorMessage())) {
-                System.out.println("记录日志: 获取 MyDbHelper对象失败,日志信息 :" + myDbHelper.getErrorMessage());
-                return;
-            }
-            myDbHelper.updateByCondition("delete log_success_a where serviceId =? and id not in (select id  from log_success_a  where serviceId = ? order by id desc limit 100 ) ", null, serviceId, serviceId);
-            deleteTime = System.currentTimeMillis();
-        }
     }
 
     /**
@@ -118,7 +97,6 @@ public class LogUtils { // 依据服务编号ID获取服务类型,如果是异
         StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
         return stackTrace[2].getClassName() + ":" + stackTrace[2].getLineNumber();
     }
-
     /**
      * 异常位置
      *

+ 44 - 33
mainFactory/src/main/java/org/bfkj/utils/MyDbHelper.java

@@ -77,6 +77,7 @@ public class MyDbHelper {//目前只差主键的条件优化
         }
         config.setJdbcUrl(connectMaps.get("url").toString());
         config.setDriverClassName(connectMaps.get("driver-class-name").toString());
+
         theDataSource = new HikariDataSource(config);
         theJdbcTemplate = new JdbcTemplate(theDataSource);
         try (Connection theConnect = theDataSource.getConnection();//用于批量新增以及获取当前数据库的相关信息
@@ -200,46 +201,56 @@ public class MyDbHelper {//目前只差主键的条件优化
 
 
             //循环执行execSQLMap
-            inertSQLMap.putAll(execSQLMap);
-            for (String signSql : inertSQLMap.keySet()) {//循环当前MAP,查询必定是单条SQL,SQL语句方式:都是单条,表名方式:查询、新增是单条,更新、删除可能多条,事件6可能多条
-                Map<String, Object> signParamMap = inertSQLMap.get(signSql);
-                String newSignSQL = signSql;
-                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++) {
-                        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("}","");
+            Map<String, Map<String, Object>> tmpExec = new HashMap<>();
+            tmpExec.putAll(inertSQLMap);
+            tmpExec.putAll(execSQLMap);
+            for(int loop =0; loop <2 ;loop ++){
+                Map<String, Map<String, Object>> exeMap = new HashMap<>();
+                if (loop ==0){
+                    exeMap = inertSQLMap;
+                }else {
+                    exeMap = execSQLMap;
                 }
 
-                Map<String, Object> execSignResult = new HashMap<>();
-                if (signParamMap.containsKey("noExec")) {
-                    execSignResult.put("code", "0");
-                    execSignResult.put("message", " 禁止全表更新、删除");
-                } else {
-                    execSignResult = execSign(sqlStr, signSql, signParamMap, inputData);
-                }
-                if ("-1".equals(execSignResult.get("code"))) {
-                    return execSignResult;
+                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("}"));
+                        String newWhere = tempWhere;
+                        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("}","");
+                    }
+
+                    Map<String, Object> execSignResult = new HashMap<>();
+                    if (signParamMap.containsKey("noExec")) {
+                        execSignResult.put("code", "0");
+                        execSignResult.put("message", " 禁止全表更新、删除");
+                    } else {
+                        execSignResult = execSign(sqlStr, signSql, signParamMap, inputData);
+                    }
+                    if ("-1".equals(execSignResult.get("code"))) {
+                        return execSignResult;
+                    }
+                    signParamMap.put("returnData", execSignResult.get("returnData"));
+                    signParamMap.put("rowcount", execSignResult.get("rowcount"));
+                    signParamMap.put("sql", signSql);
+                    tmpExec.put(newSignSQL, signParamMap);
                 }
-                signParamMap.put("returnData", execSignResult.get("returnData"));
-                signParamMap.put("rowcount", execSignResult.get("rowcount"));
-                signParamMap.put("sql", signSql);
-//                returnList.add(execSignResult.get("returnData"));
-                inertSQLMap.put(newSignSQL, signParamMap);
             }
             Object obj = new Object();
-            if (inertSQLMap.keySet().size() == 1) {
-                for (String exc : inertSQLMap.keySet()) {
-                    obj = inertSQLMap.get(exc);
+            if (tmpExec.keySet().size() == 1) {
+                for (String exc : tmpExec.keySet()) {
+                    obj = tmpExec.get(exc);
                     break;
                 }
             } else {
-                obj = inertSQLMap;
+                obj = tmpExec;
             }
             return processSuccess(obj);
         } catch (Exception e) {
@@ -690,7 +701,7 @@ public class MyDbHelper {//目前只差主键的条件优化
                     sqlPS.setObject(index + 1, signdbValue[index]);
                 }
                 sqlPS.addBatch();
-                if ((i+1) % 500 == 0){
+                if ((i+1) % 100 == 0){
                     sqlPS.executeBatch();
                     connection.commit(); // 统一提交
                     sqlPS.clearBatch();

+ 69 - 0
mainFactory/src/main/resources/application-prod.yml

@@ -0,0 +1,69 @@
+server:
+  port: ${PORT:18400}
+  servlet:
+    encoding:
+      charset: UTF-8
+      force: true
+      enabled: true
+  codec:
+    max-in-memory-size: -1
+  application:
+    name: mainFactory
+spring:
+  mvc:
+    view:
+      prefix: /
+      suffix: .html
+
+log:
+  url: jdbc:mysql://10.211.66.16:3163/DPFBLOG
+  title: root
+  cipher: QtrmuqDw^bJu$
+  type: com.mysql.cj.jdbc.Driver
+
+#mydb:
+#  url: ${MYDB_URL:jdbc:mysql://rm-bp12c6mmk845m73p48o.mysql.rds.aliyuncs.com:3306/test_cen}
+#  title: ${MYDB_USER:bf_dev_epi}
+#  cipher: ${MYDB_PASSWD:Bfepi2021(}
+#  type: ${MYDB_DRIVER:com.mysql.cj.jdbc.Driver}
+#  serviceURL: ${MY_SERVICE_URL:172.23.61.8:8089}
+
+
+mydb:
+  url: ${MYDB_URL:jdbc:mysql://10.211.66.16:3163/DISACenter_2}
+  title: ${MYDB_USER:root}
+  cipher: ${MYDB_PASSWD:QtrmuqDw^bJu$}
+  type: ${MYDB_DRIVER:com.mysql.cj.jdbc.Driver}
+  serviceURL: ${MY_SERVICE_URL:127.99.99:00}
+
+#isEs:
+#  open: true
+#  scheme: http
+#  hostname: 120.26.64.82
+#  port: 9200
+#  auth: false
+#  username: ""
+#  password: ""
+#  successIndexName: "success_log_center2"
+#  errorIndexName: "error_log_center2"
+
+isEs:
+  open: false
+  scheme: http
+  hostname: 10.211.67.175
+  port: 9201
+  auth: true
+  username: "elastic"
+  password: "TUihk5^a0J+GkI4!4"
+  successIndexName: "success_log_center"
+  errorIndexName: "error_log_center"
+
+
+service:
+  pool:
+    maxPoolSize: 512
+    corePoolSize: 6
+    queueCapacity: 1024
+    keepAliveSeconds: 60
+    threadNamePrefix: logthreadpool
+    waitForTasksToCompleteOnShutdown: true

+ 2 - 61
mainFactory/src/main/resources/application.yml

@@ -1,62 +1,3 @@
-server:
-  port: ${PORT:8082}
-  servlet:
-    encoding:
-      charset: UTF-8
-      force: true
-      enabled: true
-  codec:
-    max-in-memory-size: -1
-  application:
-    name: mainFactory
 spring:
-  mvc:
-    view:
-      prefix: /
-      suffix: .html
-
-mydb:
-  url: ${MYDB_URL:jdbc:mysql://10.211.66.16:3163/DISACenter_2}
-  title: ${MYDB_USER:root}
-  cipher: ${MYDB_PASSWD:QtrmuqDw^bJu$}
-  type: ${MYDB_DRIVER:com.mysql.cj.jdbc.Driver}
-  serviceURL: ${MY_SERVICE_URL:127.0.0.1:8080}
-
-#mydb:
-#  url: ${MYDB_URL:jdbc:mysql://rm-bp12c6mmk845m73p48o.mysql.rds.aliyuncs.com:3306/test_cen}
-#  title: ${MYDB_USER:bf_dev_epi}
-#  cipher: ${MYDB_PASSWD:Bfepi2021(}
-#  type: ${MYDB_DRIVER:com.mysql.cj.jdbc.Driver}
-#  serviceURL: ${MY_SERVICE_URL:172.23.61.4:9999}
-
-#isEs:
-#  open: true
-#  scheme: http
-#  hostname: 120.26.64.82
-#  port: 9200
-#  auth: false
-#  username: ""
-#  password: ""
-#  successIndexName: "success_log_center2"
-#  errorIndexName: "error_log_center2"
-
-isEs:
-  open: false
-  scheme: http
-  hostname: 10.211.67.175
-  port: 9201
-  auth: true
-  username: "elastic"
-  password: "TUihk5^a0J+GkI4!4"
-  successIndexName: "success_log_center"
-  errorIndexName: "error_log_center"
-
-
-service:
-  pool:
-    maxPoolSize: 512
-    corePoolSize: 6
-    queueCapacity: 1024
-    keepAliveSeconds: 60
-    threadNamePrefix: logthreadpool
-    waitForTasksToCompleteOnShutdown: true
+  profiles:
+    active: prod