|
|
@@ -1,11 +1,8 @@
|
|
|
package com.fs.company.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.util.IdUtil;
|
|
|
-import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.fs.aicall.domain.apiresult.Content;
|
|
|
import com.fs.aicall.domain.apiresult.Notify;
|
|
|
import com.fs.aicall.domain.apiresult.PushIIntentionResult;
|
|
|
import com.fs.aicall.domain.param.CalleeDomain;
|
|
|
@@ -14,8 +11,6 @@ import com.fs.aicall.domain.result.CalltaskcreateaiCustomizeResult;
|
|
|
import com.fs.aicall.service.AiCallService;
|
|
|
import com.fs.common.annotation.DataScope;
|
|
|
import com.fs.common.constant.Constants;
|
|
|
-import com.fs.common.core.domain.entity.SysDictData;
|
|
|
-import com.fs.common.core.domain.model.LoginUser;
|
|
|
import com.fs.common.core.redis.RedisCacheT;
|
|
|
import com.fs.common.exception.base.BaseException;
|
|
|
import com.fs.common.utils.*;
|
|
|
@@ -32,16 +27,13 @@ import com.fs.company.vo.RoboticWxVo;
|
|
|
import com.fs.crm.domain.CrmCustomer;
|
|
|
import com.fs.crm.mapper.CrmCustomerMapper;
|
|
|
import com.fs.crm.service.impl.CrmCustomerServiceImpl;
|
|
|
-import com.fs.his.config.AddWxConfig;
|
|
|
import com.fs.system.mapper.SysDictDataMapper;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
|
-import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@@ -242,19 +234,19 @@ public class CompanyVoiceRoboticServiceImpl extends ServiceImpl<CompanyVoiceRobo
|
|
|
if(notify == null) return;
|
|
|
if("pushDialogContent".equals(notify.getType())) pushDialogContent(result);
|
|
|
if("billing".equals(notify.getType())) pushBilling(result);
|
|
|
- // 是否全部回调完毕
|
|
|
- CompanyVoiceRoboticCallees callee = getResultCalleeInfo(notify);
|
|
|
- long count = companyVoiceRoboticCalleesMapper.countByRoboticIdNotUuid(callee.getRoboticId());
|
|
|
- if(count == 0){
|
|
|
- new Thread(() -> dispenseWx(callee.getRoboticId())).start();
|
|
|
- }
|
|
|
+// // 是否全部回调完毕
|
|
|
+// CompanyVoiceRoboticCallees callee = getResultCalleeInfo(notify);
|
|
|
+// long count = companyVoiceRoboticCalleesMapper.countByRoboticIdNotUuid(callee.getRoboticId());
|
|
|
+// if(count == 0){
|
|
|
+// new Thread(() -> dispenseWx(callee.getRoboticId())).start();
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
public void pushDialogContent(PushIIntentionResult result){
|
|
|
Notify notify = result.getNotify();
|
|
|
String intention = notify.getIntention();
|
|
|
if(StringUtils.isEmpty(intention)){
|
|
|
- intention = "无";
|
|
|
+ intention = "0";
|
|
|
}
|
|
|
CompanyVoiceRoboticCallees callee = getResultCalleeInfo(notify);
|
|
|
callee.setUuid(notify.getUuid());
|
|
|
@@ -267,6 +259,23 @@ public class CompanyVoiceRoboticServiceImpl extends ServiceImpl<CompanyVoiceRobo
|
|
|
CrmCustomer crmCustomer = crmCustomerMapper.selectCrmCustomerById(callee.getUserId());
|
|
|
crmCustomer.setIntention(intention);
|
|
|
crmCustomerMapper.updateById(crmCustomer);
|
|
|
+ List<CompanyVoiceRoboticWx> roboticWxList = companyVoiceRoboticWxMapper.selectByRoboticId(callee.getRoboticId(), intention);
|
|
|
+ CompanyWxClient companyWxClient = companyWxClientServiceImpl.getOne(new QueryWrapper<CompanyWxClient>().eq("robotic_id", callee.getRoboticId()).eq("customer_id", callee.getUserId()));
|
|
|
+ if(companyWxClient == null){
|
|
|
+ companyWxClient = new CompanyWxClient();
|
|
|
+ // 任务ID
|
|
|
+ companyWxClient.setRoboticId(callee.getRoboticId());
|
|
|
+ // 客户名称
|
|
|
+ companyWxClient.setNickName(callee.getUserName());
|
|
|
+ // 手机号
|
|
|
+ companyWxClient.setPhone(callee.getPhone());
|
|
|
+ // 微信号
|
|
|
+ companyWxClient.setCustomerId(callee.getUserId());
|
|
|
+ // 意向
|
|
|
+ companyWxClient.setIntention(intention);
|
|
|
+ }
|
|
|
+ bindCompany(companyWxClient, roboticWxList);
|
|
|
+ companyWxClientServiceImpl.saveOrUpdate(companyWxClient);
|
|
|
}
|
|
|
public void pushBilling(PushIIntentionResult result){
|
|
|
Notify notify = result.getNotify();
|
|
|
@@ -295,7 +304,7 @@ public class CompanyVoiceRoboticServiceImpl extends ServiceImpl<CompanyVoiceRobo
|
|
|
calleesList = calleesList.stream().filter(e -> StringUtils.isNotEmpty(e.getIntention())).collect(Collectors.toList());
|
|
|
if(calleesList.isEmpty()) return;
|
|
|
// 分配任务列表
|
|
|
- List<CompanyVoiceRoboticWx> roboticWxList = companyVoiceRoboticWxMapper.selectByRoboticId(roboticId);
|
|
|
+ List<CompanyVoiceRoboticWx> roboticWxList = companyVoiceRoboticWxMapper.selectByRoboticId(roboticId, null);
|
|
|
List<CompanyWxAccount> accountList = new ArrayList<>(companyWxAccountService.listByIds(PubFun.listToNewList(roboticWxList, CompanyVoiceRoboticWx::getAccountId)));
|
|
|
Map<Long, CompanyWxAccount> accountMap = PubFun.listToMapByGroupObject(accountList, CompanyWxAccount::getId);
|
|
|
roboticWxList.forEach(e -> e.setAccount(accountMap.get(e.getAccountId())));
|