Explorar o código

添加日志方便线上调试线程走到一半没有日志的情况

yejian %!s(int64=2) %!d(string=hai) anos
pai
achega
a6c466264d

+ 30 - 27
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java

@@ -168,8 +168,8 @@ public class TaskWorkNode {
 
         BaseContextHandler.setTenant("0000");
         JSONObject jsonObject = JSONObject.parseObject(data);
-        System.out.println("返回请求数据: " + data);
         String taskNodeId = jsonObject.getString("taskNodeId");
+        logger.info("节点{}准备开始执行任务",taskNodeId);
         taskNode = taskNodeService.getById(taskNodeId);
         tTask = taskMapper.selectById(taskNode.getTaskId());
         //初始化业务日志
@@ -292,7 +292,9 @@ public class TaskWorkNode {
 
                     //运行条件验证
                     conMap = checkCon(taskNode, tTask, queryMap);
+                    logger.info("节点{}资源检查返回{}",taskNode.getId(),conMap);
                     msgUtil.redis_set_map(CacheKey.TASK_CURRENT_NODE_CONDITION + "_" + taskNode.getId(), conMap);
+
                     if((boolean)conMap.get("result")){
                         if ("03".equals(taskNode.getInterfaceType())) {
                             // 执行线边库操作
@@ -593,33 +595,34 @@ public class TaskWorkNode {
      * @throws Exception
      */
     public Map checkCon(TaskNode taskNode, TTask task, Map<String, Object> dataMap) {
-        Object repeatCount = msgUtil.redis_get("repeatCheckOnCount"+taskNode.getId());
-        int repeatCheckOnCount;
-        if(null == repeatCount){
-            repeatCheckOnCount = 1;
-        }else{
-            repeatCheckOnCount = Integer.valueOf(repeatCount.toString()) + 1;
-        }
-        if(repeatCheckOnCount > 1){
-            Map conMap = new HashMap();
-            conMap.put("result",false);
-            msgUtil.redis_del("repeatCheckOnCount"+taskNode.getId());
-            return conMap;
-        }else{
-            msgUtil.redis_set("repeatCheckOnCount"+taskNode.getId(),repeatCheckOnCount,10, TimeUnit.MINUTES);
+//        Object repeatCount = msgUtil.redis_get("repeatCheckOnCount"+taskNode.getId());
+//        int repeatCheckOnCount;
+//        if(null == repeatCount){
+//            repeatCheckOnCount = 1;
+//        }else{
+//            repeatCheckOnCount = Integer.valueOf(repeatCount.toString()) + 1;
+//        }
+//        if(repeatCheckOnCount > 1){
+//            Map conMap = new HashMap();
+//            conMap.put("result",false);
+//            msgUtil.redis_del("repeatCheckOnCount"+taskNode.getId());
+//            return conMap;
+//        }else{
+//            msgUtil.redis_set("repeatCheckOnCount"+taskNode.getId(),repeatCheckOnCount,10, TimeUnit.MINUTES);
             Map map = getCheckCon(taskNode, task, dataMap);
-            boolean b = (boolean) map.get("result");
-            if (!b) {
-                try {
-                    Thread.sleep(10000);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-                return checkCon(taskNode, task, dataMap);
-            } else {
-                return map;
-            }
-        }
+            return map;
+//            boolean b = (boolean) map.get("result");
+//            if (!b) {
+//                try {
+//                    Thread.sleep(10000);
+//                } catch (InterruptedException e) {
+//                    e.printStackTrace();
+//                }
+//                return checkCon(taskNode, task, dataMap);
+//            } else {
+//                return map;
+//            }
+//        }
 //        logger.info("异步消息获取执行状态:");
 //        //单线程化线程池
 //        //初始化执行次数(默认10次) 10次后按超时处理