Przeglądaj źródła

fix: 有样学样数据获取接口字段更换,增加企业痛点展示

lihao16 4 miesięcy temu
rodzic
commit
055043a483

+ 5 - 0
smsb-modules/smsb-digital-promotion/src/main/java/com/inspur/digital/domain/SmsbDeviceChatScCase.java

@@ -48,6 +48,11 @@ public class SmsbDeviceChatScCase {
      */
     private String introduction;
 
+    /**
+     * 企业痛点
+     */
+    private String painPoint;
+
     /**
      * 预约ID
      */

+ 4 - 1
smsb-modules/smsb-digital-promotion/src/main/java/com/inspur/digital/domain/bo/SmsbDeviceChatScCaseBo.java

@@ -52,5 +52,8 @@ public class SmsbDeviceChatScCaseBo extends BaseEntity {
      */
     private String enterprise;
 
-
+    /**
+     * 企业痛点
+     */
+    private String painPoint;
 }

+ 5 - 0
smsb-modules/smsb-digital-promotion/src/main/java/com/inspur/digital/domain/vo/SmsbDeviceChatScCaseVo.java

@@ -73,5 +73,10 @@ public class SmsbDeviceChatScCaseVo implements Serializable {
     @ExcelProperty(value = "创建时间")
     private Date createTime;
 
+    /**
+     * 企业痛点
+     */
+    private String painPoint;
+
 
 }

+ 18 - 14
smsb-modules/smsb-digital-promotion/src/main/java/com/inspur/digital/service/impl/SmsbAppointmentInfoServiceImpl.java

@@ -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;

+ 4 - 3
smsb-plus-ui/src/views/smsb/scCase/index.vue

@@ -51,10 +51,11 @@
 <!--
           <el-table-column label="预约ID" align="left" prop="appointmentId" width="175"/>
 -->
-          <el-table-column label="预约企业" align="left" prop="enterprise" width="250" :show-overflow-tooltip="true"/>
+          <el-table-column label="预约企业" align="left" prop="enterprise" width="220" :show-overflow-tooltip="true"/>
           <el-table-column label="简介" align="left" prop="introduction" :show-overflow-tooltip="true"/>
-          <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
-          <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
+          <el-table-column label="痛点" align="left" prop="painPoint" :show-overflow-tooltip="true"/>
+          <el-table-column label="创建时间" align="left" prop="createTime" width="160" />
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
             <template #default="scope">
               <el-tooltip content="修改" placement="top">
                 <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"