|
|
@@ -11,9 +11,11 @@ import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.domain.entity.SysDictData;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.common.utils.spring.SpringUtils;
|
|
|
+import com.fs.company.domain.CompanyConfig;
|
|
|
import com.fs.company.domain.CompanyVoiceRobotic;
|
|
|
import com.fs.company.mapper.CompanyVoiceRoboticMapper;
|
|
|
import com.fs.company.param.EntryCustomerParam;
|
|
|
+import com.fs.company.service.ICompanyConfigService;
|
|
|
import com.fs.company.service.ICompanyVoiceRoboticService;
|
|
|
import com.fs.company.service.IGeneralCustomerEntryService;
|
|
|
import com.fs.company.util.CryptoUtil;
|
|
|
@@ -39,6 +41,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.time.LocalTime;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
@@ -67,6 +70,8 @@ public class GeneralCustomerEntryServiceImpl implements IGeneralCustomerEntrySer
|
|
|
@Autowired
|
|
|
private SysDictDataMapper sysDictDataMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ICompanyConfigService companyConfigService;
|
|
|
/**
|
|
|
* 录入客户
|
|
|
*
|
|
|
@@ -210,11 +215,28 @@ public class GeneralCustomerEntryServiceImpl implements IGeneralCustomerEntrySer
|
|
|
}
|
|
|
//客户数据解析,是否包含对话图 对话图解析标签&意向度标识 todo 庄旭组在研发此功能
|
|
|
if (StringUtils.isNotBlank(data.getDialogue())) {
|
|
|
- JSONObject jsonObject = analysisDialogue(data.getDialogue());
|
|
|
- if (jsonObject != null) {
|
|
|
- data.setIntention(jsonObject.getString("intention"));
|
|
|
- data.setTags(jsonObject.getString("tags"));
|
|
|
+ try {
|
|
|
+ List<CrmCustomerAiTagVo> aiTags = getAiTags(data.getDialogue());
|
|
|
+ if(null != aiTags && !aiTags.isEmpty()){
|
|
|
+ String tags = data.getTags()==null?"":data.getTags();
|
|
|
+ StringBuilder sb = new StringBuilder(tags);
|
|
|
+ aiTags.forEach(a->{
|
|
|
+ sb.append(a.getName()).append(",");
|
|
|
+ });
|
|
|
+ if(sb.length() >0 && ',' == sb.charAt(sb.length()-1)){
|
|
|
+ data.setTags(sb.substring(0,sb.length()-1));
|
|
|
+ }
|
|
|
+ data.setTags(sb.toString());
|
|
|
+ }
|
|
|
+ //todo 意向度分析
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ log.error("导入用户标签数据解析异常", e);
|
|
|
}
|
|
|
+// JSONObject jsonObject = analysisDialogue(data.getDialogue());
|
|
|
+// if (jsonObject != null) {
|
|
|
+// data.setIntention(jsonObject.getString("intention"));
|
|
|
+// data.setTags(jsonObject.getString("tags"));
|
|
|
+// }
|
|
|
}
|
|
|
//客户数据插入
|
|
|
insertCrmCustomer(data);
|
|
|
@@ -239,10 +261,18 @@ public class GeneralCustomerEntryServiceImpl implements IGeneralCustomerEntrySer
|
|
|
log.error("手机号格式错误,{}", param.getMobile());
|
|
|
return false;
|
|
|
}
|
|
|
- Long customerId = crmCustomerMapper.selectCrmCustomerByCrmMobile(param.getMobile());
|
|
|
- // todo 添加配置是否允许重复客户导入
|
|
|
- if( null != customerId && true){
|
|
|
- return false;
|
|
|
+ //根据配置项是否允许重复手机号客户录入
|
|
|
+ CompanyConfig config=companyConfigService.selectCompanyConfigByKey(param.getCompanyId(),"cId.config");
|
|
|
+ if (null != config) {
|
|
|
+ String configValue = config.getConfigValue();
|
|
|
+ JSONObject configObj = JSONObject.parseObject(configValue);
|
|
|
+ if(configObj.containsKey("allowRepeatCustomer") && null != configObj.getBoolean("allowRepeatCustomer") && !configObj.getBoolean("allowRepeatCustomer")){
|
|
|
+ Long customerId = crmCustomerMapper.selectCrmCustomerByCrmMobileAndCompanyId(param.getCompanyId(),param.getMobile());
|
|
|
+ if( null != customerId && true){
|
|
|
+ log.error("手机号重复数据,{}", param.getMobile());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
@@ -265,6 +295,13 @@ public class GeneralCustomerEntryServiceImpl implements IGeneralCustomerEntrySer
|
|
|
public void insertCrmCustomer(EntryCustomerParam data){
|
|
|
CrmCustomer insertObj = new CrmCustomer();
|
|
|
BeanUtils.copyProperties(data,insertObj);
|
|
|
+ if(StringUtils.isBlank(insertObj.getCustomerName())){
|
|
|
+ insertObj.setCustomerName("客户"+insertObj.getMobile().substring(7,11));
|
|
|
+ }
|
|
|
+ insertObj.setIsLine(1);
|
|
|
+ if(null == insertObj.getCreateTime()){
|
|
|
+ insertObj.setCreateTime(new Date());
|
|
|
+ }
|
|
|
crmCustomerMapper.insertCrmCustomer(insertObj);
|
|
|
data.setCustomerId(insertObj.getCustomerId());
|
|
|
}
|