Browse Source

异常修复

pms 2 years ago
parent
commit
35c2dd15f1

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

@@ -58,7 +58,7 @@ public class DataProcess {
             errorMessage = "查询" + service_Id + "的算法失败:" + calculationResult.get("message");
         }
         if (calculationLibraryList == null || calculationLibraryList.isEmpty()) {//查询数据库失败
-            errorMessage = "服务ID " + service_Id +"没有找到对应的算法";
+            errorMessage = "服务ID " + service_Id + "没有找到对应的算法";
         }
     }
 
@@ -97,8 +97,11 @@ public class DataProcess {
     }
 
     //数据收集----目前应该是数据处理
+    int count = 0;
+    Long begin = 0L;
+
     public Map<String, Object> processData(Map<String, Object> inputData, String... user_id) { //{serviceid:1,datacontent:[{key:value},{key:value}],event:0,page:1,pagesize:10}
-        //事件判断由算法进行,不再作为入口必须条件  ?
+         //事件判断由算法进行,不再作为入口必须条件  ?
         if (!MapTools.isBlank(errorMessage)) {//如果当前服务存在问题,代表数据库对象不可用,此时应该重构当前对象,调用方控制
             LogUtils.log("processData:1", "-1", null, "服务不可用" + errorMessage, serviceId, AppConfig.WORK_ID, MapTools.jacksonObjToStr(inputData), null, null, null);
             return processFail("服务不可用" + errorMessage, null);
@@ -164,15 +167,15 @@ public class DataProcess {
         Map<String, List<Map<String, Object>>> execResult = execCalultion(calculationResult, null, event, dataObjectId, inputData.get("page"), inputData.get("pageSize"));
         calculationResult = execResult.get("calcData");//执行当前服务对应的算法库
         Map<String, Object> lastResult = calculationResult.get(calculationResult.size() - 1);//获取最后一个计算结果
+        String libraryId = lastResult.get("library_id").toString();
         if (Objects.equals(lastResult.get("code"), "-1")) {//最后一个计算结果为-1则记录异常,否则全部记录正常
-            String libraryId = lastResult.get("library_id").toString();
             Object message = lastResult.get("message");
             LogUtils.log("processData:3", "-1", libraryId, Objects.nonNull(message) ? message.toString() : null, serviceId, AppConfig.WORK_ID, MapTools.jacksonObjToStr(calculationResult), dataObjectId, MapTools.jacksonObjToStr(execResult.get("calcData")), event);
             setServiceErrorCount(libraryId, serviceId, "-1");//标记错误的算法:连续错误累加
             return processFail(libraryId + "数据计算错误:" + lastResult.get("message"), libraryId);
         }
         //写入 成功日志
-        LogUtils.log("DataProcess:9999", "0", null, "数据接收后处理成功", serviceId, AppConfig.WORK_ID, MapTools.jacksonObjToStr(calculationResult), dataObjectId, MapTools.jacksonObjToStr(execResult.get("calcData")), event);  //此处无法把所有的记过集返回过去
+        LogUtils.log("DataProcess:9999", "0", libraryId, "数据接收后处理成功", serviceId, AppConfig.WORK_ID, MapTools.jacksonObjToStr(calculationResult), dataObjectId, MapTools.jacksonObjToStr(execResult.get("calcData")), event);  //此处无法把所有的记过集返回过去
         // 如果列权限不为空
         // 循环lastResult
         // 遍历map
@@ -266,6 +269,7 @@ public class DataProcess {
         Map<String, List<Map<String, Object>>> returnData = new HashMap<>();
         List<Map<String, Object>> preData = new ArrayList<>();
         List<Map<String, Object>> calcData = Objects.isNull(inData) || inData.isEmpty() ? new ArrayList<>() : inData;
+//        long l2 = System.currentTimeMillis();
         for (Map<String, Object> calculationLibrary : calculationLibraryList) {//循环算法库
 //            long l = System.currentTimeMillis();
             String library_id = calculationLibrary.get("library_id").toString();//算法编号
@@ -310,7 +314,7 @@ public class DataProcess {
                 String tableName = Objects.isNull(calculationLibrary.get("sourceObjectName")) ? null : calculationLibrary.get("sourceObjectName").toString();
                 Object isActiveTable = calculationLibrary.get("isActiveTable");//是否动态表
                 //指定当前算法事件
-                String eventFlag = Objects.isNull(calculationLibrary.get("event")) ? (MapTools.isNotBlank(tableName)? event.toString() : AppConfig.staticEvent.get(Objects.requireNonNull(computing_expression).trim().toLowerCase().substring(0, 6))) : calculationLibrary.get("event").toString();
+                String eventFlag = Objects.isNull(calculationLibrary.get("event")) ? (MapTools.isNotBlank(tableName) ? event.toString() : AppConfig.staticEvent.get(Objects.requireNonNull(computing_expression).trim().toLowerCase().substring(0, 6))) : calculationLibrary.get("event").toString();
                 if (null == eventFlag) {
                     calcData.add(processFail("事件标志为空", library_id));
                     returnData.put("calcData", calcData);
@@ -359,9 +363,10 @@ public class DataProcess {
             }
             calcData.add(currentResult);
             returnData.put("calcData", calcData);
-//            System.out.println("算法ID : " + library_id +"  执行时间为:" +(System.currentTimeMillis()-l));
+//            System.out.println("算法ID : " + library_id + "  执行时间为:" + (System.currentTimeMillis() - l));
             setServiceErrorCount(library_id, serviceId, "0");    ///  错误次数恢复??
         }
+//        System.out.println("服务ID : " + serviceId + "  执行时间为:" + (System.currentTimeMillis() - l2));
         return returnData;
     }
 

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

@@ -12,6 +12,11 @@ public class AppConfig {
     public static final String LOCAL_LOG_CONNECT = "local_log_connect";
     public static String WORK_ID;
     public static Integer SERVICE_ERR_MAX = 3; //服务最大连续异常次数
+
+    public static  Integer  count = 0;
+    public static Long begin = 0L;
+
+
     public static HashMap<String, String> staticEvent = new HashMap<String, String>() {{
         put("select", "0");
         put("update", "2");

+ 2 - 0
mainFactory/src/main/java/org/bfkj/protocol/MyKafKa.java

@@ -6,6 +6,7 @@ import org.apache.kafka.clients.consumer.ConsumerRecords;
 import org.apache.kafka.clients.consumer.KafkaConsumer;
 import org.apache.kafka.clients.producer.KafkaProducer;
 import org.apache.kafka.clients.producer.ProducerRecord;
+import org.bfkj.config.AppConfig;
 import org.bfkj.utils.MapTools;
 
 import java.time.Duration;
@@ -38,6 +39,7 @@ public class MyKafKa {
             consumer = new KafkaConsumer<>(connectConfigMaps);
             consumer.subscribe(Collections.singleton(sourceObjectName));
         }
+//        System.out.println(consumer +"   library_id: " + library_id);
         //todo 1. 如果一次行读取多条 2.偏移修改  : // Duration.ofSeconds(1): 如果没有数据则此处会等待1秒
         ConsumerRecords<String, Object> records = consumer.poll(Duration.ofMillis(1));
         int count = records.count();

+ 58 - 46
mainFactory/src/main/java/org/bfkj/utils/DataFormat.java

@@ -57,7 +57,7 @@ public class DataFormat {
      * @param source 原已编码数据
      * @return 原始数据
      */
-    public static String base64DecoderToString(String source){
+    public static String base64DecoderToString(String source) {
         return new String(Base64.getDecoder().decode(source));
     }
 
@@ -67,7 +67,7 @@ public class DataFormat {
      * @param source 原数据
      * @return 编码后数据
      */
-    public static String base64EncoderToString(String source){
+    public static String base64EncoderToString(String source) {
         return Base64.getEncoder().encodeToString(source.getBytes());
     }
 
@@ -92,18 +92,6 @@ public class DataFormat {
         return tempIndex == str.length() ? str : str.substring(0, tempIndex);
     }
 
-//    public static List<Map<String, Object>> typeBToMapList(List<String> typeList, String dataObjectId, Map<String, String> transMaps) {
-//        if (Objects.isNull(typeList) || typeList.isEmpty()) return new ArrayList<>() {{
-//            add(processSuccess(null));
-//        }};
-//        List<Map<String, Object>> returnmap = new ArrayList<>();
-//        for (String typeStr : typeList) {
-//            returnmap.add(typeBToMap(typeStr, dataObjectId, transMaps));
-//        }
-//        return returnmap;
-//    }
-
-
     public static Map<String, Object> typeBToMap(String typeStr, String dataObjectId, Map<String, String> transMaps) {
         try {
             if (Objects.isNull(typeStr)) {
@@ -256,46 +244,59 @@ public class DataFormat {
                             containerList.add(containerMap);//添加到容器数组中
                         }
                     }
+
                     //处理容器以及行李数组
                     if (containerList.size() == 0) {//为0时添加空MAP,方便下面的循环
                         containerList.add(new HashMap<>());
                     }
                     if (containerList.size() > 2) {//最多两个容器,否则是异常数据,整个报文都作废
-                        signDataMap.put("errMessage", 1);//只需要标记错误,因为已经有原始报文存在
-                        returnDataList.add(signDataMap);//添加到返回数组中
-                    } else {
-                        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中
-                            }
-                            if (luggageList.size() == 0) {
-                                returnDataList.add(specialHandler(tempDataMap, dataObjectId)); //只有容器没有行李:整箱操作
-                            } else {
-                                for (Map<String, Object> tempLuggageMap : luggageList) {//循环行李数组
-                                    if (containerNum == 0 && containerList.size() > 1 && tempLuggageMap.get("luggageState") == null) {//只添加.B行李
-                                        continue;
-                                    }
-                                    if (containerNum != 0 && containerList.size() > 1 && tempLuggageMap.get("luggageState") != null) {//只添加.N行李
-                                        continue;
-                                    }
-                                    HashMap<String, Object> objectObjectHashMap = new HashMap<>();
-                                    objectObjectHashMap.putAll(tempDataMap);
-                                    objectObjectHashMap.putAll(tempLuggageMap);
-//                                    tempDataMap.putAll(tempLuggageMap);//添加行李信息
-                                    returnDataList.add(specialHandler(objectObjectHashMap, dataObjectId));//添加到返回数组中
+                        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,代表卸下
+                        }
+                        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("luggageState") == null) {//只添加.B行李
+                                    continue;
                                 }
+                                if (containerNum != 0 && containerList.size() > 1 && tempLuggageMap.get("luggageState") != null) {//只添加.N行李
+                                    continue;
+                                }
+                                HashMap<String, Object> objectObjectHashMap = new HashMap<>();
+                                objectObjectHashMap.putAll(tempDataMap);
+                                objectObjectHashMap.putAll(tempLuggageMap);
+//                                    tempDataMap.putAll(tempLuggageMap);//添加行李信息
+                                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));
@@ -326,14 +327,22 @@ public class DataFormat {
 
         String carrierFlights = inMap.containsKey("flightNo") ? "flightNo" : (inMap.containsKey("inflightNo") ? "inflightNo" : null);
         if (MapTools.isNotBlank(carrierFlights)) {
-            inMap.put("carrierFlights", inMap.get(carrierFlights));
+           Object  tempCarrierFlights= inMap.get(carrierFlights);
+            if (Objects.nonNull(tempCarrierFlights)){
+                 carrierFlights = tempCarrierFlights.toString();
+                if (carrierFlights.substring(2).replaceAll("\\D+","").length()<4){
+                    carrierFlights =  carrierFlights.substring(0,2) + "0"+ carrierFlights.substring(2);
+                }
+                inMap.put("carrierFlights", carrierFlights);
+            }
+//            inMap.put("carrierFlights", );
         }
         String carrierFlightsDate = inMap.containsKey("flightDate") ? "flightDate" : (inMap.containsKey("inflightDate") ? "inflightDate" : null);
         if (MapTools.isNotBlank(carrierFlightsDate)) {
             inMap.put("carrierFlightsDate", inMap.get(carrierFlightsDate));
         }
 
-        String readAddess = inMap.containsKey("location_code") ? "location_code" : (inMap.containsKey("checkInLocation") ? "checkInLocation" : inMap.containsKey("operationArea") ? "operationArea" : null);
+        String readAddess = inMap.containsKey("location_code") ? "location_code" : (inMap.containsKey("checkInLocation") ? "checkInLocation" : inMap.containsKey("operationArea") ? "operationArea" : (inMap.containsKey("location_describe")?"location_describe":null));
         if (MapTools.isNotBlank(readAddess)) {
             inMap.put("readAddess", inMap.get(readAddess));
         }
@@ -414,7 +423,10 @@ public class DataFormat {
             xml = (xml.contains("<?xml") ? "" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n").concat(xml);
             Document doc = DocumentHelper.parseText(xml);
             Element root = doc.getRootElement();
-            return processSuccess(xmlToMap(root));
+            Map<String, Object> returnMap = xmlToMap(root);
+            returnMap.values().removeAll(Collections.singleton(null));
+            returnMap.values().removeAll(Collections.singleton(""));
+            return processSuccess(returnMap);
         } catch (Exception e) {
             return processFail("入参不是规则的xml :" + xml);
         }

+ 2 - 0
mainFactory/src/main/java/org/bfkj/utils/MapTools.java

@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.util.JSONPObject;
 import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import org.dom4j.DocumentException;
 import org.dom4j.DocumentHelper;
+import org.json.JSONArray;
 
 import java.io.*;
 import java.math.BigInteger;
@@ -362,6 +363,7 @@ public class MapTools implements Serializable {
             return null;
         }
     }
+
     public static String mapToJSONString(Object mapStr) {
         ObjectMapper mapper = new ObjectMapper();
         try {

+ 41 - 18
mainFactory/src/main/java/org/bfkj/utils/MyDbHelper.java

@@ -10,7 +10,6 @@ import org.springframework.jdbc.support.KeyHolder;
 import java.sql.*;
 import java.util.Date;
 import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -26,7 +25,7 @@ public class MyDbHelper {
     private Map<String, List<String>> tableColumn = new HashMap<>();//缓存对象调用过的表的字段列表
     private Map<String, List<String>> tablePrimaryKey = new HashMap<>();//缓存对象调用过的表的主键列表
     private HashMap<String, Map<String, List<String>>> sqlColumn = new HashMap<>();//缓存对象调用过的表的主键列表
-    private ConcurrentHashMap<String, List<Object>> event6Map = new ConcurrentHashMap<>();
+    private HashMap<String, HashSet<Object>> event6Map = new HashMap<>();//
     private Map<String, String> eventSQL = new HashMap<>() {{
         put("0", "select * from 表名");
         put("1", "insert into 表名(字段) values(值) ");
@@ -180,10 +179,10 @@ public class MyDbHelper {
     public synchronized Boolean updateEvent6Map(String tableName, Object updateParam, boolean isAdd) {
         boolean isNew = false; //{tableName:[Map<String,Object>]}
         if (!event6Map.containsKey(tableName)) {
-            event6Map.put(tableName, new ArrayList<>());
+            event6Map.put(tableName, new HashSet<>());
         }
         String key = MapTools.jacksonObjToStr(updateParam);
-        List<Object> tableUniqe = event6Map.get(tableName);
+        HashSet<Object> tableUniqe = event6Map.get(tableName);
         if (isAdd) {
             if (!tableUniqe.contains(key)) {
                 isNew = true;
@@ -194,6 +193,7 @@ public class MyDbHelper {
             }
         } else {
             tableUniqe.remove(key);
+
         }
         return isNew;
     }
@@ -205,24 +205,48 @@ public class MyDbHelper {
         }
 
         List<Map<String, Object>> returnList = new ArrayList<>();
+//        long l2 = System.currentTimeMillis();
+//        System.out.println("event6: 操作开始 ");
+        int index = 0;
         for (Map<String, Object> signParam : paramsList) {
+            index++;
             String eventStr = "2";
-            if (updateEvent6Map(tableName, signParam.get("filter"), true)) { //不包含true
-                Map<String, Object> selectMap = generalProcess("0", null, "select 1 from " + tableName, null, new ArrayList<>() {{
-                    add(signParam);
-                }}, false, 1, 1);
-                if (selectMap.get("code").equals("-1")) {
+            Map<String, Object> tempFilterMap = (Map<String, Object>) signParam.get("filter");
+            if (updateEvent6Map(tableName, tempFilterMap, true)) { //不包含true
+//                long l = System.currentTimeMillis();
+                String whereStr = "";
+                List<Object> tempCheckValue = new ArrayList<>();
+                for (String key : tempFilterMap.keySet()) {
+                    whereStr = whereStr + " " + key + " = ? and ";
+                    tempCheckValue.add(tempFilterMap.get(key));
+                }
+                whereStr = whereStr.substring(0, whereStr.length() - 4);
+                String checkSQL = "select 1 from " + tableName + " where " + whereStr + " limit 1";
+                try {
+                    List<Map<String, Object>> queryForList = theJdbcTemplate.queryForList(checkSQL, tempCheckValue.toArray());
+//                    eventStr = (Objects.isNull(selectMap.get("returnData")) || ((List<?>) selectMap.get("returnData")).size() == 0) ? "1" : eventStr;
+                    eventStr = (queryForList.size() == 0) ? "1" : eventStr;
+                } catch (Exception e) {
+//                    if (selectMap.get("code").equals("-1")) {
                     updateEvent6Map(tableName, signParam.get("filter"), false);
-                    returnList.add(selectMap);
+//                    returnList.add(processFail());
                     continue;
+//                }
                 }
-                eventStr = (Objects.isNull(selectMap.get("returnData")) || ((List<?>) selectMap.get("returnData")).size() == 0) ? "1" : eventStr;
+//                Map<String, Object> selectMap = generalProcess("0", null, "select 1 from " + tableName, null, new ArrayList<>() {{
+//                    add(signParam);
+//                }}, false, 1, 1);
+//                System.out.println("event6: 查询时间为: " + (System.currentTimeMillis()-l));
             }
+//            System.out.println("event6: 单挑开始: " + index);
+//            long l3 = System.currentTimeMillis();
             // 包含:
             returnList.add(generalProcess(eventStr, tableName, null, null, new ArrayList<>() {{
                 add(signParam);
             }}, false, null, null));
+//            System.out.println("event6: 单挑ji结束: " + (System.currentTimeMillis() - l3));
         }
+//        System.out.println("event6: 操作结束: " + (System.currentTimeMillis() - l2));
         return returnList.size() == 1 ? returnList.get(0) : processSuccess(returnList, tableName, paramsList);
     }
 
@@ -264,7 +288,7 @@ public class MyDbHelper {
                     } else if (sql.startsWith("select count(") || sql.startsWith("select sum(")) { //??
                         for (int i = 0; i < sqlSplit.length; i++) {
                             if (sqlSplit[i].equals("from")) {
-                                tableName = sqlSplit[i+1];
+                                tableName = sqlSplit[i + 1];
                                 break;
                             }
                         }
@@ -430,7 +454,7 @@ public class MyDbHelper {
             tempList.add(paramsList.get(0));
             paramsList = tempList;
         }
-        if (paramsList.size() ==0){
+        if (paramsList.size() == 0) {
             paramsList.add(new HashMap<>());
         }
         for (Map<String, Object> itemMap : paramsList) {
@@ -439,10 +463,10 @@ public class MyDbHelper {
             List<String> modifyValue = new ArrayList<>();
             if ("1,2".contains(event)) {
                 Map<String, Object> valueMap = itemMap.containsKey("Value") ? (Map<String, Object>) itemMap.get("Value") : itemMap;
-                if (allColumn.contains("createtime") && "1".equals(event)) {
-                    valueMap.put("createtime", new Date());
-                }
                 if (event.equals("1")) {
+                    if (allColumn.contains("createtime") && "1".equals(event)) {
+                        valueMap.put("createtime", new Date());
+                    }
                     for (String column : allColumn) {
                         cuList.add(valueMap.get(column));
                         modifyValue.add("?");
@@ -513,7 +537,7 @@ public class MyDbHelper {
             if (event.equals("0") && !MapTools.isBlank(tableName)) { // 理论上sql 不为空 可以通过allColumn 替换为count 1 来组建rowCountSQL---> select * from biao left ……
                 rowCountSQL = "select count(1) from " + tableName;
             }
-            if (event.equals("0") && MapTools.isNotBlank(sql) && MapTools.isBlank(rowCountSQL) && allColumn.size() > 0) {
+            if ( !MapTools.isBlank(tableName) &&event.equals("0") && MapTools.isNotBlank(sql) && MapTools.isBlank(rowCountSQL) && allColumn.size() > 0) {
                 rowCountSQL = sql;
                 for (int index = 0; index < allColumn.size(); index++) {
                     rowCountSQL = rowCountSQL.replace(allColumn.get(index), index == 0 ? " count(1) " : "");
@@ -621,7 +645,6 @@ public class MyDbHelper {
                     }
                 }
             }
-
         }
         return processSuccess(null, tableName, null);
     }

+ 3 - 1
mainFactory/src/main/java/org/bfkj/utils/ScheduleUtil.java

@@ -20,6 +20,8 @@ public class ScheduleUtil {
     private static Map<String, ScheduledFuture<?>> scheduledFutureMap = new HashMap<>();
 
     static {
+
+        threadPoolTaskScheduler.setPoolSize(8);
         threadPoolTaskScheduler.initialize();
         System.out.println("定时任务线程池启动");
     }
@@ -31,7 +33,7 @@ public class ScheduleUtil {
      */
     public static boolean start(ScheduleTask scheduleTask, int cycleFrequency, Object cronExpress, int taskType) {
         System.out.println("启动定时任务线程 taskId " + scheduleTask.getId());// 设置时间比当前时间晚了
-        ScheduledFuture<?> scheduledFuture = null;
+        ScheduledFuture<?> scheduledFuture;
         if (taskType == 1) {
             scheduledFuture = threadPoolTaskScheduler.scheduleWithFixedDelay(scheduleTask, new Date(), cycleFrequency);
         } else {