|
@@ -1,13 +1,16 @@
|
|
|
package com.fs.company.service.impl.call.node;
|
|
package com.fs.company.service.impl.call.node;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fs.aicall.domain.result.CalltaskcreateaiCustomizeResult;
|
|
import com.fs.aicall.domain.result.CalltaskcreateaiCustomizeResult;
|
|
|
import com.fs.common.utils.spring.SpringUtils;
|
|
import com.fs.common.utils.spring.SpringUtils;
|
|
|
import com.fs.company.domain.CompanyAiWorkflowExec;
|
|
import com.fs.company.domain.CompanyAiWorkflowExec;
|
|
|
import com.fs.company.domain.CompanyVoiceRoboticBusiness;
|
|
import com.fs.company.domain.CompanyVoiceRoboticBusiness;
|
|
|
|
|
+import com.fs.company.domain.CompanyVoiceRoboticCallees;
|
|
|
import com.fs.company.domain.CompanyWorkflowEdge;
|
|
import com.fs.company.domain.CompanyWorkflowEdge;
|
|
|
import com.fs.company.mapper.CompanyWorkflowNodeMapper;
|
|
import com.fs.company.mapper.CompanyWorkflowNodeMapper;
|
|
|
import com.fs.company.param.ExecutionContext;
|
|
import com.fs.company.param.ExecutionContext;
|
|
|
|
|
+import com.fs.company.service.ICompanyVoiceRoboticService;
|
|
|
import com.fs.company.service.impl.CompanyVoiceRoboticServiceImpl;
|
|
import com.fs.company.service.impl.CompanyVoiceRoboticServiceImpl;
|
|
|
import com.fs.company.vo.AiCallWorkflowConditionVo;
|
|
import com.fs.company.vo.AiCallWorkflowConditionVo;
|
|
|
import com.fs.company.vo.ExecutionResult;
|
|
import com.fs.company.vo.ExecutionResult;
|
|
@@ -23,31 +26,57 @@ import java.util.Map;
|
|
|
*/
|
|
*/
|
|
|
public class AiCallTaskNode extends AbstractWorkflowNode {
|
|
public class AiCallTaskNode extends AbstractWorkflowNode {
|
|
|
private static final CompanyWorkflowNodeMapper companyWorkflowNodeMapper = SpringUtils.getBean(CompanyWorkflowNodeMapper.class);
|
|
private static final CompanyWorkflowNodeMapper companyWorkflowNodeMapper = SpringUtils.getBean(CompanyWorkflowNodeMapper.class);
|
|
|
- private static final CompanyVoiceRoboticServiceImpl companyVoiceRoboticService = SpringUtils.getBean(CompanyVoiceRoboticServiceImpl.class);
|
|
|
|
|
|
|
+ private static final ICompanyVoiceRoboticService companyVoiceRoboticService = SpringUtils.getBean(ICompanyVoiceRoboticService.class);
|
|
|
|
|
|
|
|
public AiCallTaskNode(String nodeKey, String nodeName, Map<String, Object> properties) {
|
|
public AiCallTaskNode(String nodeKey, String nodeName, Map<String, Object> properties) {
|
|
|
super(nodeKey, nodeName, properties);
|
|
super(nodeKey, nodeName, properties);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 收到回调以后,继续判定和执行下一步动作
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param context
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
@Override
|
|
@Override
|
|
|
protected ExecutionResult doContinue(ExecutionContext context) {
|
|
protected ExecutionResult doContinue(ExecutionContext context) {
|
|
|
|
|
+
|
|
|
|
|
+ CompanyAiWorkflowExec exec = companyAiWorkflowExecMapper.selectByWorkflowInstanceId(context.getWorkflowInstanceId());
|
|
|
|
|
+
|
|
|
|
|
+ List<CompanyWorkflowEdge> edges = companyWorkflowEdgeMapper.selectListByWorkflowIdAndNodeKey(exec.getWorkflowId(), nodeKey);
|
|
|
|
|
+ //获取外呼回调结果
|
|
|
|
|
+ CompanyVoiceRoboticCallees callees = super.companyVoiceRoboticBusinessMapper.selectCalleesByBusinessId(Long.valueOf(exec.getBusinessKey()));
|
|
|
|
|
+ edges.forEach(edge -> {
|
|
|
|
|
+ AiCallWorkflowConditionVo condition = JSONObject.parseObject(edge.getConditionExpr(), AiCallWorkflowConditionVo.class);
|
|
|
|
|
+ //未拨通
|
|
|
|
|
+ if (!condition.isCallConnected()) {
|
|
|
|
|
+ if (null != condition.getCallTime()) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //拨通
|
|
|
|
|
+ else {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ //加入到计时组
|
|
|
|
|
+
|
|
|
|
|
+ //同步监听回调回调
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected ExecutionResult doExecute(ExecutionContext context) {
|
|
protected ExecutionResult doExecute(ExecutionContext context) {
|
|
|
- if(isAsync()){
|
|
|
|
|
|
|
+ if (isAsync()) {
|
|
|
|
|
+
|
|
|
//执行外呼逻辑 需要传入节点信息
|
|
//执行外呼逻辑 需要传入节点信息
|
|
|
CompanyVoiceRoboticBusiness bus = super.getRoboticBusiness(context.getWorkflowInstanceId());
|
|
CompanyVoiceRoboticBusiness bus = super.getRoboticBusiness(context.getWorkflowInstanceId());
|
|
|
- CalltaskcreateaiCustomizeResult result = companyVoiceRoboticService.callPhoneOne(bus.getRoboticId(), bus.getCalleeId());
|
|
|
|
|
-
|
|
|
|
|
- //加入到计时组
|
|
|
|
|
|
|
+ CalltaskcreateaiCustomizeResult result = companyVoiceRoboticService.workflowCallPhoneOne(bus.getRoboticId(), bus.getCalleeId(), context.getWorkflowInstanceId());
|
|
|
|
|
|
|
|
- //同步监听回调回调
|
|
|
|
|
|
|
|
|
|
return ExecutionResult.paused()
|
|
return ExecutionResult.paused()
|
|
|
.nextNodeKey(getNextNodeKey(context.getWorkflowInstanceId(), nodeKey)).build();
|
|
.nextNodeKey(getNextNodeKey(context.getWorkflowInstanceId(), nodeKey)).build();
|
|
|
- } else{
|
|
|
|
|
|
|
+ } else {
|
|
|
return ExecutionResult.success()
|
|
return ExecutionResult.success()
|
|
|
.nextNodeKey(getNextNodeKey(context.getWorkflowInstanceId(), nodeKey)).build();
|
|
.nextNodeKey(getNextNodeKey(context.getWorkflowInstanceId(), nodeKey)).build();
|
|
|
}
|
|
}
|