lmx 2 settimane fa
parent
commit
a8b80e92fb

+ 3 - 1
fs-ai-call-task/src/main/java/com/fs/app/service/CallTaskService.java

@@ -55,7 +55,9 @@ public class CallTaskService {
                     } catch (Exception e) {
                         log.error("处理工作流延时任务异常 - key: {}", key, e);
                     }
-                }, cidExcutor);
+                }, cidExcutor).thenRun(()->{
+                    redisCache2.deleteObject(key);
+                });
             } catch (Exception ex) {
                 log.error("处理工作流延时任务异常 - key: {}", key, ex);
             }

+ 2 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyVoiceRoboticBusinessMapper.java

@@ -85,5 +85,7 @@ public interface CompanyVoiceRoboticBusinessMapper extends BaseMapper<CompanyVoi
 
     CompanyVoiceRoboticCallees selectCalleesByBusinessId(@Param("businessId") Long businessId);
 
+    Integer selectUnfinishedTaskCountByRoboticId(@Param("roboticId") Long roboticId, @Param("endNodeKey") String endNodeKey);
+
 
 }

+ 1 - 2
fs-service/src/main/java/com/fs/company/service/impl/CompanyVoiceRoboticServiceImpl.java

@@ -343,6 +343,7 @@ public class CompanyVoiceRoboticServiceImpl extends ServiceImpl<CompanyVoiceRobo
             param.setMultiplier(callConfigVo.getMultiplier());
             param.setAutoRecall(callConfigVo.getAutoRecall());
             param.setRecallTimes(callConfigVo.getRecallTimes());
+            param.setAutoStart("1");
             param.setCIDGroupID(callConfigVo.getCidGroupId());
             if (StringUtils.isNotEmpty(robotic.getWeekDay1())) {
                 param.setWeekday1(Arrays.asList(robotic.getWeekDay1().split(",")));
@@ -627,9 +628,7 @@ public class CompanyVoiceRoboticServiceImpl extends ServiceImpl<CompanyVoiceRobo
         return companyVoiceRoboticMapper.qwUserListCompany(companyVoiceRobotic);
     }
 
-    //todo 这个回调方法可优化成异步返回 防止同步阻塞造成多次回调
     @Override
-    @Async
     public void callerResult(PushIIntentionResult result) {
         log.info("进入外呼回调:{}", JSON.toJSONString(result));
         Notify notify = result.getNotify();

+ 2 - 4
fs-service/src/main/java/com/fs/company/service/impl/CompanyWorkflowEngineImpl.java

@@ -22,6 +22,7 @@ import com.fs.enums.ExecutionStatusEnum;
 import com.fs.enums.NodeTypeEnum;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -60,7 +61,6 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
      * 创建工作流实例并保存初始状态
      */
     @Override
-    @Transactional
     public ExecutionResult initialize(Long workflowDefinitionId, Map<String, Object> inputVariables) {
         try {
             // 生成工作流实例ID
@@ -94,7 +94,7 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
      * 根据节点ID执行对应的节点逻辑
      */
     @Override
-    @Transactional
+    @Async("cidWorkFlowExecutor")
     public void executeNode(String workflowInstanceId, String nodeKey) {
         try {
             // 加载当前执行记录
@@ -151,7 +151,6 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
      * 将工作流状态设置为暂停
      */
     @Override
-    @Transactional
     public ExecutionResult pauseWorkflow(String workflowInstanceId) {
         try {
             CompanyAiWorkflowExec update = new CompanyAiWorkflowExec();
@@ -181,7 +180,6 @@ public class CompanyWorkflowEngineImpl implements CompanyWorkflowEngine {
      * 将工作流状态设置为完成
      */
     @Override
-    @Transactional
     public ExecutionResult completeWorkflow(String workflowInstanceId) {
         try {
             CompanyAiWorkflowExec update = new CompanyAiWorkflowExec();

+ 29 - 17
fs-service/src/main/java/com/fs/company/service/impl/call/node/AbstractWorkflowNode.java

@@ -17,6 +17,7 @@ import com.fs.enums.NodeTypeEnum;
 import lombok.extern.slf4j.Slf4j;
 import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
+import org.springframework.scheduling.annotation.Async;
 
 import java.time.LocalDateTime;
 import java.util.*;
@@ -37,6 +38,7 @@ public abstract class AbstractWorkflowNode implements IWorkflowNode {
     public static final CompanyWorkflowEdgeMapper companyWorkflowEdgeMapper = SpringUtils.getBean(CompanyWorkflowEdgeMapper.class);
     public static final CompanyVoiceRoboticBusinessMapper companyVoiceRoboticBusinessMapper = SpringUtils.getBean(CompanyVoiceRoboticBusinessMapper.class);
     public static final CompanyVoiceRoboticCallLogCallphoneMapper companyVoiceRoboticCallLogCallphoneMapper = SpringUtils.getBean(CompanyVoiceRoboticCallLogCallphoneMapper.class);
+    public static final CompanyVoiceRoboticMapper companyVoiceRoboticMapper = SpringUtils.getBean(CompanyVoiceRoboticMapper.class);
     public static final RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
     public static final WorkflowNodeFactory workflowNodeFactory = SpringUtils.getBean(WorkflowNodeFactory.class);
     public static final ObjectMapper objectMapper = new ObjectMapper();
@@ -105,7 +107,7 @@ public abstract class AbstractWorkflowNode implements IWorkflowNode {
             }
             log.info("收到继续执行请求 - workflowInstanceId: {}, nodeKey: {}, 当前状态: {}",
                     context.getWorkflowInstanceId(), nodeKey, companyAiWorkflowExec.getStatus());
-            CompanyWorkflowNode node = companyWorkflowNodeMapper.selectNodeByNodeKey(nodeKey);
+            CompanyWorkflowNode node = getNodeByKey(nodeKey);
             context.setVariable("currentNode", node);
             // 允许 PAUSED 或 WAITING 状态继续执行
             if (!Integer.valueOf(ExecutionStatusEnum.PAUSED.getValue()).equals(companyAiWorkflowExec.getStatus())
@@ -151,15 +153,15 @@ public abstract class AbstractWorkflowNode implements IWorkflowNode {
         context.setVariable("lastNodeKey", nodeKey);
         log.info("Starting execution of node: {} ({})", nodeKey, nodeName);
         context.setCurrentNodeKey(nodeKey);
-        CompanyWorkflowNode node = companyWorkflowNodeMapper.selectNodeByNodeKey(nodeKey);
+        CompanyWorkflowNode node = getNodeByKey(nodeKey);
         context.setVariable("currentNode", node);
         CompanyAiWorkflowExec companyAiWorkflowExec = companyAiWorkflowExecMapper.selectByWorkflowInstanceId(context.getWorkflowInstanceId());
         if (!companyAiWorkflowExec.getCurrentNodeKey().equals(nodeKey)) {
-            CompanyWorkflowNode cNode = companyWorkflowNodeMapper.selectNodeByNodeKey(nodeKey);
             CompanyAiWorkflowExec update = new CompanyAiWorkflowExec();
+            update.setId(companyAiWorkflowExec.getId());
             update.setCurrentNodeKey(nodeKey);
             update.setCurrentNodeName(nodeName);
-            update.setCurrentNodeType(NodeTypeEnum.fromCode(cNode.getNodeType()).getValue());
+            update.setCurrentNodeType(NodeTypeEnum.fromCode(node.getNodeType()).getValue());
             update.setLastUpdateTime(LocalDateTime.now());
             companyAiWorkflowExecMapper.updateCompanyAiWorkflowExec(update);
         }
@@ -173,17 +175,18 @@ public abstract class AbstractWorkflowNode implements IWorkflowNode {
         long endTime = System.currentTimeMillis();
         context.setVariable("node_end_time_" + nodeKey, endTime);
         log.info("Completed execution of node: {} ({})", nodeKey, nodeName);
-        //todo 写入执行日志等后置操作
-        int logStatus;
-        if (ExecutionStatusEnum.SUCCESS.equals(result.getStatus())) {
-            logStatus = ExecutionStatusEnum.SUCCESS.getValue();
-            updateWorkflowStatus(context.getWorkflowInstanceId(), ExecutionStatusEnum.SUCCESS);
-        } else if (ExecutionStatusEnum.FAILURE.equals(result.getStatus())) {
-            logStatus = ExecutionStatusEnum.FAILURE.getValue();
-            updateWorkflowStatus(context.getWorkflowInstanceId(), ExecutionStatusEnum.FAILURE);
-        } else {
-            logStatus = result.getStatus().getValue();
-        }
+        //不在这里控制流程状态容易出问题bug,各节点自行管理状态
+//        int logStatus;
+//        if (ExecutionStatusEnum.SUCCESS.equals(result.getStatus())) {
+//            logStatus = ExecutionStatusEnum.SUCCESS.getValue();
+//            updateWorkflowStatus(context.getWorkflowInstanceId(), ExecutionStatusEnum.SUCCESS);
+//        } else if (ExecutionStatusEnum.FAILURE.equals(result.getStatus())) {
+//            logStatus = ExecutionStatusEnum.FAILURE.getValue();
+//            updateWorkflowStatus(context.getWorkflowInstanceId(), ExecutionStatusEnum.FAILURE);
+//        } else {
+//
+//        }
+        int logStatus = result.getStatus().getValue();
         CompanyAiWorkflowExecLog logEntry = createLogEntry(context.getWorkflowInstanceId(), nodeKey, getType(), result, context);
         logEntry.setStatus(logStatus);
         logExecution(logEntry);
@@ -347,6 +350,9 @@ public abstract class AbstractWorkflowNode implements IWorkflowNode {
     public void updateWorkflowStatus(String workflowInstanceId, ExecutionStatusEnum status) {
         CompanyAiWorkflowExec update = new CompanyAiWorkflowExec();
         update.setWorkflowInstanceId(workflowInstanceId);
+        update.setCurrentNodeName(nodeName);
+        update.setCurrentNodeType(getType().getValue());
+        update.setCurrentNodeKey(nodeKey);
         update.setStatus(status.getValue());
         update.setLastUpdateTime(LocalDateTime.now());
         companyAiWorkflowExecMapper.updateByWorkflowInstanceId(update);
@@ -373,7 +379,7 @@ public abstract class AbstractWorkflowNode implements IWorkflowNode {
             update.setWorkflowInstanceId(context.getWorkflowInstanceId());
             update.setCurrentNodeKey(context.getCurrentNodeKey());
             if (null != context.getVariables() && null != context.getVariable("nodeName", String.class)) {
-                update.setCurrentNodeName(context.getVariable("nodeName", String.class));
+                update.setCurrentNodeName(context.getVariable("nodeName0", String.class));
             }
             update.setStatus(ExecutionStatusEnum.RUNNING.getValue());
             update.setLastUpdateTime(LocalDateTime.now());
@@ -386,13 +392,19 @@ public abstract class AbstractWorkflowNode implements IWorkflowNode {
     }
 
     protected void runNextNode(ExecutionContext context, CompanyWorkflowEdge edge) {
+        try {
+            Thread.sleep(2000L);
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        }
         if (StringUtils.isBlank(edge.getTargetNodeKey())) {
             return;
         }
         ExecutionContext nextContext = context.clone();
-        CompanyWorkflowNode nextNode = companyWorkflowNodeMapper.selectNodeByNodeKey(edge.getTargetNodeKey());
+        CompanyWorkflowNode nextNode = getNodeByKey(edge.getTargetNodeKey());
         nextContext.setCurrentNodeKey(nextNode.getNodeKey());
         nextContext.setVariable("nodeName", nextNode.getNodeName());
+        log.info("开始执行下一个节点:{}", nextNode.getNodeName());
         execPointNextNode(nextContext);
         IWorkflowNode node = workflowNodeFactory.createNode(nextNode.getNodeKey(), NodeTypeEnum.fromCode(nextNode.getNodeType()), nextNode.getNodeName(), null);
         node.execute(nextContext);

+ 31 - 24
fs-service/src/main/java/com/fs/company/service/impl/call/node/AiAddWxTaskNode.java

@@ -11,9 +11,7 @@ import com.fs.company.mapper.CompanyWxClientMapper;
 import com.fs.company.mapper.CompanyWorkflowNodeMapper;
 import com.fs.company.param.ExecutionContext;
 import com.fs.company.service.IWorkflowNode;
-import com.fs.company.vo.AiAddWxWorkflowConditionVo;
-import com.fs.company.vo.AiCallWorkflowConditionVo;
-import com.fs.company.vo.ExecutionResult;
+import com.fs.company.vo.*;
 import com.fs.enums.ExecutionStatusEnum;
 import com.fs.enums.NodeTypeEnum;
 import lombok.extern.slf4j.Slf4j;
@@ -91,7 +89,7 @@ public class AiAddWxTaskNode extends AbstractWorkflowNode {
                 // 匹配失败条件
                 if (!condition.isAdd()) {
                     log.info("加微失败,执行失败分支 - workflowInstanceId: {}", context.getWorkflowInstanceId());
-                    this.runNextNode(context, edge);
+                    super.runNextNode(context, edge);
                     return null;
                 }
 
@@ -113,6 +111,15 @@ public class AiAddWxTaskNode extends AbstractWorkflowNode {
             return ExecutionResult.failure().nextNodeKey(null).build();
         }
         try {
+            //设置加微话术
+            CompanyWorkflowNode node = context.getVariable("currentNode", CompanyWorkflowNode.class)==null? getNodeByKey(nodeKey):context.getVariable("currentNode", CompanyWorkflowNode.class);
+            String nodeConfig = node.getNodeConfig();
+            AiAddWxConfigVO addWxConfig = JSONObject.parseObject(nodeConfig, AiAddWxConfigVO.class);
+            CompanyVoiceRoboticBusiness roboticBusiness = getRoboticBusiness(context.getWorkflowInstanceId());
+            CompanyWxClient update = new CompanyWxClient();
+            update.setDialogId(addWxConfig.getDialogId());
+            update.setId(roboticBusiness.getWxClientId());
+            companyWxClientMapper.updateCompanyWxClient(update);
             super.asyncWorkflowForBlockingNode(context.getWorkflowInstanceId(), context.getCurrentNodeKey(), context, ExecutionStatusEnum.PAUSED);
             return ExecutionResult.paused()
                     .outputData(context.getVariables())
@@ -191,26 +198,26 @@ public class AiAddWxTaskNode extends AbstractWorkflowNode {
         return true;
     }
 
-    /**
-     * 运行下一个节点
-     *
-     * @param context 执行上下文
-     * @param edge    边
-     */
-    @Override
-    protected void runNextNode(ExecutionContext context, CompanyWorkflowEdge edge) {
-        ExecutionContext nextContext = context.clone();
-        nextContext.setCurrentNodeKey(edge.getTargetNodeKey());
-        super.execPointNextNode(nextContext);
-        CompanyWorkflowNode nextNode = companyWorkflowNodeMapper.selectNodeByNodeKey(edge.getTargetNodeKey());
-        IWorkflowNode node = super.workflowNodeFactory.createNode(
-                nextNode.getNodeKey(),
-                NodeTypeEnum.fromCode(nextNode.getNodeType()),
-                nextNode.getNodeName(),
-                null
-        );
-        node.execute(nextContext);
-    }
+//    /**
+//     * 运行下一个节点
+//     *
+//     * @param context 执行上下文
+//     * @param edge    边
+//     */
+//    @Override
+//    protected void runNextNode(ExecutionContext context, CompanyWorkflowEdge edge) {
+//        ExecutionContext nextContext = context.clone();
+//        nextContext.setCurrentNodeKey(edge.getTargetNodeKey());
+//        super.execPointNextNode(nextContext);
+//        CompanyWorkflowNode nextNode = companyWorkflowNodeMapper.selectNodeByNodeKey(edge.getTargetNodeKey());
+//        IWorkflowNode node = super.workflowNodeFactory.createNode(
+//                nextNode.getNodeKey(),
+//                NodeTypeEnum.fromCode(nextNode.getNodeType()),
+//                nextNode.getNodeName(),
+//                null
+//        );
+//        node.execute(nextContext);
+//    }
 
     /**
      * 从节点配置获取超时时间(分钟)

+ 10 - 10
fs-service/src/main/java/com/fs/company/service/impl/call/node/AiCallTaskNode.java

@@ -142,16 +142,16 @@ public class AiCallTaskNode extends AbstractWorkflowNode {
         return String.format(DELAY_CALL_KEY, nowDay.getHours(), nowDay.getMinutes());
     }
 
-    @Override
-    protected void postExecute(ExecutionContext context, ExecutionResult result) {
-        super.postExecute(context, result);
-        String callRedisKey = context.getVariable("callRedisKey", String.class);
-        //来源于定时调用doexec,调用后移除key
-        if (StringUtils.isNotBlank(callRedisKey)) {
-            super.redisCache.deleteObject(callRedisKey);
-        }
-
-    }
+//    @Override
+//    protected void postExecute(ExecutionContext context, ExecutionResult result) {
+//        super.postExecute(context, result);
+//        String callRedisKey = context.getVariable("callRedisKey", String.class);
+//        //来源于定时调用doexec,调用后移除key
+//        if (StringUtils.isNotBlank(callRedisKey)) {
+//            super.redisCache.deleteObject(callRedisKey);
+//        }
+//
+//    }
 
 
 //    @Override

+ 24 - 15
fs-service/src/main/java/com/fs/company/service/impl/call/node/AiSendMsgTaskNode.java

@@ -9,9 +9,12 @@ import com.fs.company.mapper.CompanyWorkflowNodeMapper;
 import com.fs.company.param.ExecutionContext;
 import com.fs.company.service.IWorkflowNode;
 import com.fs.company.vo.ExecutionResult;
+import com.fs.enums.ExecutionStatusEnum;
 import com.fs.enums.NodeTypeEnum;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Async;
 
+import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Map;
 
@@ -41,7 +44,7 @@ public class AiSendMsgTaskNode extends AbstractWorkflowNode {
                 context.getVariable("workflowId", Long.class), nodeKey);
         
         if (edges != null && !edges.isEmpty()) {
-            this.runNextNode(context, edges.get(0));
+            super.runNextNode(context, edges.get(0));
         }
         return null;
     }
@@ -73,6 +76,7 @@ public class AiSendMsgTaskNode extends AbstractWorkflowNode {
                     business.getCalleeId(), null);
             
             log.info("短信发送成功 - workflowInstanceId: {}", context.getWorkflowInstanceId());
+            super.updateWorkflowStatus(context.getWorkflowInstanceId(), ExecutionStatusEnum.SUCCESS);
             //CompanyVoiceRoboticServiceImpl.sendMsgOne()
             // 获取下一个节点并执行
             CompanyAiWorkflowExec exec = companyAiWorkflowExecMapper.selectByWorkflowInstanceId(context.getWorkflowInstanceId());
@@ -112,18 +116,23 @@ public class AiSendMsgTaskNode extends AbstractWorkflowNode {
      * @param context 执行上下文
      * @param edge    边
      */
-    public void runNextNode(ExecutionContext context, CompanyWorkflowEdge edge) {
-        ExecutionContext nextContext = context.clone();
-        nextContext.setCurrentNodeKey(edge.getTargetNodeKey());
-        super.execPointNextNode(nextContext);
-        
-        CompanyWorkflowNode nextNode = companyWorkflowNodeMapper.selectNodeByNodeKey(edge.getTargetNodeKey());
-        IWorkflowNode node = super.workflowNodeFactory.createNode(
-                nextNode.getNodeKey(),
-                NodeTypeEnum.fromCode(nextNode.getNodeType()),
-                nextNode.getNodeName(),
-                null
-        );
-        node.execute(nextContext);
-    }
+//    public void runNextNode(ExecutionContext context, CompanyWorkflowEdge edge) {
+//        try {
+//            Thread.sleep(5000L);
+//        } catch (InterruptedException e) {
+//            throw new RuntimeException(e);
+//        }
+//        ExecutionContext nextContext = context.clone();
+//        nextContext.setCurrentNodeKey(edge.getTargetNodeKey());
+//        super.execPointNextNode(nextContext);
+//
+//        CompanyWorkflowNode nextNode = companyWorkflowNodeMapper.selectNodeByNodeKey(edge.getTargetNodeKey());
+//        IWorkflowNode node = super.workflowNodeFactory.createNode(
+//                nextNode.getNodeKey(),
+//                NodeTypeEnum.fromCode(nextNode.getNodeType()),
+//                nextNode.getNodeName(),
+//                null
+//        );
+//        node.execute(nextContext);
+//    }
 }

+ 14 - 0
fs-service/src/main/java/com/fs/company/service/impl/call/node/EndNode.java

@@ -2,6 +2,8 @@ package com.fs.company.service.impl.call.node;
 
 import com.fs.common.utils.spring.SpringUtils;
 import com.fs.company.domain.CompanyAiWorkflowExecLog;
+import com.fs.company.domain.CompanyVoiceRobotic;
+import com.fs.company.domain.CompanyVoiceRoboticBusiness;
 import com.fs.company.mapper.CompanyWorkflowNodeMapper;
 import com.fs.company.param.ExecutionContext;
 import com.fs.company.vo.ExecutionResult;
@@ -42,5 +44,17 @@ public class EndNode extends AbstractWorkflowNode {
     @Override
     protected void postExecute(ExecutionContext context, ExecutionResult result) {
       super.postExecute(context, result);
+      super.updateWorkflowStatus(context.getWorkflowInstanceId(), ExecutionStatusEnum.SUCCESS);
+      //判定是否任务完成了更新任务的状态为执行完成
+        CompanyVoiceRoboticBusiness roboticBusiness = getRoboticBusiness(context.getWorkflowInstanceId());
+        if(null != roboticBusiness){
+            Integer i = companyVoiceRoboticBusinessMapper.selectUnfinishedTaskCountByRoboticId(roboticBusiness.getRoboticId(), nodeKey);
+            if(Integer.valueOf(0).equals(i)){
+                CompanyVoiceRobotic robotic = new CompanyVoiceRobotic();
+                robotic.setId(roboticBusiness.getRoboticId());
+                robotic.setTaskStatus(3);
+                companyVoiceRoboticMapper.updateById(robotic);
+            }
+        }
     }
 }

+ 16 - 13
fs-service/src/main/java/com/fs/company/service/impl/call/node/StartNode.java

@@ -58,7 +58,10 @@ public class StartNode extends AbstractWorkflowNode {
     @Override
     protected void postExecute(ExecutionContext context, ExecutionResult result) {
         super.postExecute(context, result);
-        runNextNode(context,result);
+        super.updateWorkflowStatus(context.getWorkflowInstanceId(), ExecutionStatusEnum.SUCCESS);
+        CompanyAiWorkflowExec exec = companyAiWorkflowExecMapper.selectByWorkflowInstanceId(context.getWorkflowInstanceId());
+        List<CompanyWorkflowEdge> edges = companyWorkflowEdgeMapper.selectListByWorkflowIdAndNodeKey(exec.getWorkflowId(), nodeKey);
+        super.runNextNode(context,edges.get(0));
     }
 
     /**
@@ -66,16 +69,16 @@ public class StartNode extends AbstractWorkflowNode {
      * @param context
      * @param res
      */
-    private void runNextNode(ExecutionContext context, ExecutionResult res){
-        if(StringUtils.isBlank(res.getNextNodeKey())){
-            return;
-        }
-        ExecutionContext nextContext = context.clone();
-        nextContext.setCurrentNodeKey(res.getNextNodeKey());
-        CompanyWorkflowNode nextNode = companyWorkflowNodeMapper.selectNodeByNodeKey(res.getNextNodeKey());
-        IWorkflowNode node = super.workflowNodeFactory.createNode(nextNode.getNodeKey(), NodeTypeEnum.fromCode(nextNode.getNodeType()), nextNode.getNodeName(), null);
-        nextContext.setVariable("nodeName",nextNode.getNodeName());
-        super.execPointNextNode(nextContext);
-        node.execute(nextContext);
-    }
+//    private void runNextNode(ExecutionContext context, ExecutionResult res){
+//        if(StringUtils.isBlank(res.getNextNodeKey())){
+//            return;
+//        }
+//        ExecutionContext nextContext = context.clone();
+//        nextContext.setCurrentNodeKey(res.getNextNodeKey());
+//        CompanyWorkflowNode nextNode = companyWorkflowNodeMapper.selectNodeByNodeKey(res.getNextNodeKey());
+//        IWorkflowNode node = super.workflowNodeFactory.createNode(nextNode.getNodeKey(), NodeTypeEnum.fromCode(nextNode.getNodeType()), nextNode.getNodeName(), null);
+//        nextContext.setVariable("nodeName",nextNode.getNodeName());
+////        super.execPointNextNode(nextContext);
+//        node.execute(nextContext);
+//    }
 }

+ 18 - 0
fs-service/src/main/java/com/fs/company/vo/AiAddWxConfigVO.java

@@ -0,0 +1,18 @@
+package com.fs.company.vo;
+
+import lombok.Data;
+
+/**
+ * @author MixLiu
+ * @date 2026/2/10 09:20
+ * @description
+ */
+@Data
+public class AiAddWxConfigVO {
+
+    /**
+     * 使用话术
+     */
+    private Long dialogId;
+
+}

+ 1 - 1
fs-service/src/main/java/com/fs/wxcid/threadExecutor/cidCompanyWorkFlowExecutor.java

@@ -17,7 +17,7 @@ public class cidCompanyWorkFlowExecutor {
         ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
         executor.setCorePoolSize(8);
         executor.setMaxPoolSize(16);
-        executor.setQueueCapacity(2000);
+        executor.setQueueCapacity(20000);
         executor.setThreadNamePrefix("WorkfLow-");
         executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
         executor.setKeepAliveSeconds(60);

+ 9 - 0
fs-service/src/main/resources/mapper/company/CompanyVoiceRoboticBusinessMapper.xml

@@ -140,4 +140,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         inner join company_voice_robotic_callees t2 on t1.callee_id = t2.id
         where t1.id = #{businessId}
     </select>
+
+    <select id="selectUnfinishedTaskCountByRoboticId" resultType="Integer">
+        SELECT
+            count(*)
+        FROM
+            company_voice_robotic_business t1
+                inner join company_ai_workflow_exec t2 on t1.id = t2.business_key
+        where t1.robotic_id = #{roboticId} and t2.current_node_key != #{endNodeKey};
+    </select>
 </mapper>

+ 3 - 1
fs-wx-task/src/main/java/com/fs/app/service/WxTaskService.java

@@ -815,7 +815,9 @@ public class WxTaskService {
                     } catch (Exception e) {
                         log.error("处理工作流延时任务异常 - key: {}", key, e);
                     }
-                }, cidExcutor);
+                }, cidExcutor).thenRun(()->{
+                    redisCache2.deleteObject(key);
+                });
 
             } catch (Exception ex) {
                 log.error("处理工作流延时任务异常 - key: {}", key, ex);