|
@@ -2,12 +2,8 @@ package com.fs.crm.utils;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
-import cn.hutool.json.JSON;
|
|
|
|
|
-import cn.hutool.json.JSONArray;
|
|
|
|
|
-import cn.hutool.json.JSONObject;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.fasterxml.jackson.core.JsonParser;
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
@@ -23,19 +19,14 @@ import com.fs.crm.domain.CrmCustomerProperty;
|
|
|
import com.fs.crm.domain.CrmCustomerPropertyTemplate;
|
|
import com.fs.crm.domain.CrmCustomerPropertyTemplate;
|
|
|
import com.fs.crm.dto.CrmCustomerAiAutoTagVo;
|
|
import com.fs.crm.dto.CrmCustomerAiAutoTagVo;
|
|
|
import com.fs.crm.mapper.CrmCustomerMapper;
|
|
import com.fs.crm.mapper.CrmCustomerMapper;
|
|
|
|
|
+import com.fs.crm.param.CrmCustomerAiTagParam;
|
|
|
import com.fs.crm.service.ICrmCustomerPropertyTemplateService;
|
|
import com.fs.crm.service.ICrmCustomerPropertyTemplateService;
|
|
|
-import com.fs.erp.utils.WeizouApiClient;
|
|
|
|
|
|
|
+import com.fs.crm.vo.CrmCustomerAiTagVo;
|
|
|
import com.fs.fastgptApi.param.ChatParam;
|
|
import com.fs.fastgptApi.param.ChatParam;
|
|
|
import com.fs.fastgptApi.service.ChatService;
|
|
import com.fs.fastgptApi.service.ChatService;
|
|
|
import com.fs.hisapi.util.MapUtil;
|
|
import com.fs.hisapi.util.MapUtil;
|
|
|
-import com.fs.wx.utils.JsonUtils;
|
|
|
|
|
-import com.google.common.collect.ArrayListMultimap;
|
|
|
|
|
-import com.google.common.collect.LinkedListMultimap;
|
|
|
|
|
-import com.google.common.collect.Multimap;
|
|
|
|
|
-import org.checkerframework.checker.nullness.qual.Nullable;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.util.MultiValueMap;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -65,8 +56,8 @@ public class CrmCustomerAiTagUtil {
|
|
|
public void initStatic() {
|
|
public void initStatic() {
|
|
|
APP_KEY = this.appKey;
|
|
APP_KEY = this.appKey;
|
|
|
}
|
|
}
|
|
|
- public static List<CrmCustomerProperty> getTag(Map content) throws JsonProcessingException {
|
|
|
|
|
- String jsonStr = (String) content.get("json");
|
|
|
|
|
|
|
+ public static List<CrmCustomerAiTagVo> getTag(CrmCustomerAiTagParam content) throws JsonProcessingException {
|
|
|
|
|
+ String jsonStr = content.getJson();
|
|
|
List<Map<String, Object>> communication = new ArrayList<Map<String, Object>>();
|
|
List<Map<String, Object>> communication = new ArrayList<Map<String, Object>>();
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -80,9 +71,9 @@ public class CrmCustomerAiTagUtil {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
// List<Map<String,Object>> communication = (List<Map<String,Object>>) content.get("json");//对话图
|
|
// List<Map<String,Object>> communication = (List<Map<String,Object>>) content.get("json");//对话图
|
|
|
- String tradeType = (String) content.get("tradeType");//行业
|
|
|
|
|
- String customerId = (String) content.get("customerId");//客户id
|
|
|
|
|
- String logId = (String) content.get("logId");
|
|
|
|
|
|
|
+ String tradeType = content.getTradeType();//行业
|
|
|
|
|
+ String customerId = content.getCustomerId();//客户id
|
|
|
|
|
+ String logId = content.getLogId();
|
|
|
if (ObjectUtil.isEmpty(tradeType) || ObjectUtil.isEmpty(communication) || ObjectUtil.isEmpty(customerId) || ObjectUtil.isEmpty(logId)) {
|
|
if (ObjectUtil.isEmpty(tradeType) || ObjectUtil.isEmpty(communication) || ObjectUtil.isEmpty(customerId) || ObjectUtil.isEmpty(logId)) {
|
|
|
throw new RuntimeException("参数为空");
|
|
throw new RuntimeException("参数为空");
|
|
|
}
|
|
}
|
|
@@ -120,7 +111,7 @@ public class CrmCustomerAiTagUtil {
|
|
|
|
|
|
|
|
R r = SpringUtils.getBean(ChatService.class).initiatingTakeChat(param, SpringUtils.getBean(AiHostProper.class).getAiApi(), APP_KEY);
|
|
R r = SpringUtils.getBean(ChatService.class).initiatingTakeChat(param, SpringUtils.getBean(AiHostProper.class).getAiApi(), APP_KEY);
|
|
|
|
|
|
|
|
- ArrayList<CrmCustomerProperty> results = new ArrayList<>();
|
|
|
|
|
|
|
+ ArrayList<CrmCustomerAiTagVo> results = new ArrayList<>();
|
|
|
if (r.get("code").equals(200)) {
|
|
if (r.get("code").equals(200)) {
|
|
|
// 解析 tagInfos
|
|
// 解析 tagInfos
|
|
|
|
|
|
|
@@ -131,11 +122,11 @@ public class CrmCustomerAiTagUtil {
|
|
|
String id = tag.get("id");
|
|
String id = tag.get("id");
|
|
|
String name = tag.get("name");
|
|
String name = tag.get("name");
|
|
|
String value = tag.get("value");
|
|
String value = tag.get("value");
|
|
|
- CrmCustomerProperty p = new CrmCustomerProperty();
|
|
|
|
|
- p.setCustomerId(Long.parseLong(customerId));
|
|
|
|
|
- p.setPropertyId(Long.parseLong(id));
|
|
|
|
|
- p.setPropertyName(name);
|
|
|
|
|
- p.setPropertyValue(value);
|
|
|
|
|
|
|
+ CrmCustomerAiTagVo p = new CrmCustomerAiTagVo();
|
|
|
|
|
+ p.setCustomerId((customerId));
|
|
|
|
|
+ p.setId((id));
|
|
|
|
|
+ p.setName(name);
|
|
|
|
|
+ p.setValue(value);
|
|
|
results.add(p);
|
|
results.add(p);
|
|
|
}
|
|
}
|
|
|
|
|
|