|
|
@@ -214,6 +214,7 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
// 1、 调用第三方接口 获取数据
|
|
|
String reportMap = "";
|
|
|
String interactionListStr = "";
|
|
|
+ String caseListStr = "";
|
|
|
try {
|
|
|
String data = requestApiGetReportMap(add);
|
|
|
reportMap = JSONUtil.parseObj(data).getStr("reportMap");
|
|
|
@@ -223,6 +224,7 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
return null;
|
|
|
}
|
|
|
interactionListStr = JSONUtil.parseObj(data).getStr("interactionList");
|
|
|
+ caseListStr = JSONUtil.parseObj(data).getStr("caseList");
|
|
|
} catch (Exception e) {
|
|
|
log.error("请求第三方接口失败", e);
|
|
|
return null;
|
|
|
@@ -251,7 +253,7 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
futures.add(CompletableFuture.runAsync(() -> createProduct(productList, add, smsbDeviceChatScProductMapper), threadPoolTaskExecutor));
|
|
|
}
|
|
|
// 5、看样学样:应用案例列表
|
|
|
- List<SmsbDeviceChatScCase> caseList = getCaseList(reportMap, add);
|
|
|
+ List<SmsbDeviceChatScCase> caseList = getCaseList(caseListStr, add);
|
|
|
if (!CollectionUtils.isEmpty(reportList)) {
|
|
|
futures.add(CompletableFuture.runAsync(() -> createCaseList(caseList, add, smsbDeviceChatScCaseMapper), threadPoolTaskExecutor));
|
|
|
}
|
|
|
@@ -314,7 +316,7 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
String reportSummary = DifyStreamUtil.callDifyStreamApi(difyBaseUrl + "/v1/chat-messages", difyScAgentApiKey, InteractionContentStr.toString());
|
|
|
SmsbDeviceChatScScene scInteraction = new SmsbDeviceChatScScene();
|
|
|
scInteraction.setType(1L);
|
|
|
- String content = "你好," + add.getEnterprise() + "企业,我是小数智能分析助手。您企业诊断痛点问题为:" + reportSummary + "您可以继续向我提问。";
|
|
|
+ String content = "你好," + add.getEnterprise() + "企业,我是小数智能分析助手。您企业诊断痛点问题为:" + reportSummary.replaceAll("\\*","") + "您可以继续向我提问。";
|
|
|
scInteraction.setDescription(content);
|
|
|
scInteraction.setInteractionName("欢迎词");
|
|
|
scInteraction.setAppointmentId(add.getId());
|
|
|
@@ -340,7 +342,7 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
String reportSummary = DifyStreamUtil.callDifyStreamApi(difyBaseUrl + "/v1/chat-messages", difyScAgentApiKey, caseContentStr.toString());
|
|
|
SmsbDeviceChatScCase scCase = new SmsbDeviceChatScCase();
|
|
|
scCase.setType(1);
|
|
|
- String content = "你好," + add.getEnterprise() + "企业,我是小数智能分析助手。推荐您学习的企业案例为:" + reportSummary + "您可以继续向我提问。";
|
|
|
+ String content = "你好," + add.getEnterprise() + "企业,我是小数智能分析助手。为您企业推荐的看样学样案例介绍为:" + reportSummary + "您可以继续向我提问。";
|
|
|
scCase.setIntroduction(content);
|
|
|
scCase.setName("欢迎词");
|
|
|
scCase.setAppointmentId(add.getId());
|
|
|
@@ -353,24 +355,25 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
// threadPoolTaskExecutor.submit(transTask);
|
|
|
}
|
|
|
|
|
|
- private List<SmsbDeviceChatScCase> getCaseList(String reportMap,SmsbAppointmentInfo add) {
|
|
|
+ private List<SmsbDeviceChatScCase> getCaseList(String caseListStr,SmsbAppointmentInfo add) {
|
|
|
try {
|
|
|
- JSONObject reportMapJson = JSONUtil.parseObj(reportMap);
|
|
|
- if (!"true".equalsIgnoreCase(reportMapJson.getStr("result"))) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- // 读取报告具体内容
|
|
|
- JSONObject reportContent = reportMapJson.getJSONObject("reportContent");
|
|
|
- JSONObject recommend = reportContent.getJSONObject("recommend");
|
|
|
// 应用案例列表:
|
|
|
- JSONArray caseList = recommend.getJSONArray("caseList");
|
|
|
+ JSONArray caseList = JSONUtil.parseArray(caseListStr);
|
|
|
List<SmsbDeviceChatScCase> addCaseList = new ArrayList<>();
|
|
|
for (int i = 0; i < caseList.size(); i++) {
|
|
|
JSONObject caseItem = caseList.getJSONObject(i);
|
|
|
SmsbDeviceChatScCase addCase = new SmsbDeviceChatScCase();
|
|
|
- addCase.setName(caseItem.getStr("name"));
|
|
|
+ addCase.setName(caseItem.getStr("caseName"));
|
|
|
addCase.setPhoto(caseItem.getStr("photo"));
|
|
|
addCase.setIntroduction(caseItem.getStr("introduction"));
|
|
|
+ JSONArray painPointList = caseItem.getJSONArray("painPointList");
|
|
|
+ if (painPointList != null && painPointList.size() > 1) {
|
|
|
+ StringBuilder painPointStr = new StringBuilder();
|
|
|
+ for (int j = 0; j < painPointList.size(); j++) {
|
|
|
+ painPointStr.append(painPointList.get(j)).append(";");
|
|
|
+ }
|
|
|
+ addCase.setPainPoint(painPointStr.toString());
|
|
|
+ }
|
|
|
addCase.setAppointmentId(add.getId());
|
|
|
addCase.setEnterprise(add.getEnterprise());
|
|
|
addCase.setTenantId(add.getTenantId());
|
|
|
@@ -825,7 +828,8 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
for (SmsbDeviceChatScCaseVo caseVo : caseVoList) {
|
|
|
StringBuilder allContentStr = new StringBuilder();
|
|
|
allContentStr.append("案例名称:").append(caseVo.getName()).append("\n");
|
|
|
- allContentStr.append("案例简介:").append(caseVo.getIntroduction()).append("\n");
|
|
|
+ allContentStr.append("案例介绍:").append(caseVo.getIntroduction()).append("\n");
|
|
|
+ allContentStr.append("企业痛点:").append(caseVo.getPainPoint()).append("\n");
|
|
|
contentList.add(allContentStr.toString());
|
|
|
}
|
|
|
return contentList;
|