Bläddra i källkod

Merge remote-tracking branch 'origin/master'

zyy 2 veckor sedan
förälder
incheckning
806fbc2cbd

+ 7 - 4
fs-company/src/main/java/com/fs/company/controller/crm/CrmCustomerAnalyzeController.java

@@ -1,6 +1,10 @@
 package com.fs.company.controller.crm;
 
 import java.util.List;
+
+import com.fs.common.core.domain.R;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -49,11 +53,10 @@ public class CrmCustomerAnalyzeController extends BaseController
      * 查询所有客户(根据客户分组取客户最新一条数据)
      */
     @PostMapping("/listAll")
-    public TableDataInfo listAll(@RequestBody CrmCustomerAnalyze crmCustomerAnalyze)
+    public R listAll(@RequestBody CrmCustomerAnalyze crmCustomerAnalyze)
     {
-        startPage();
-        List<CrmCustomerAnalyze> list = crmCustomerAnalyzeService.selectCrmCustomerAnalyzeListAll(crmCustomerAnalyze);
-        return getDataTable(list);
+        PageHelper.startPage(crmCustomerAnalyze.getPageNum(), crmCustomerAnalyze.getPageSize());
+        return R.ok().put("data",new PageInfo<>(crmCustomerAnalyzeService.selectCrmCustomerAnalyzeListAll(crmCustomerAnalyze)));
     }
 
 

+ 4 - 0
fs-service/src/main/java/com/fs/crm/domain/CrmCustomerAnalyze.java

@@ -67,4 +67,8 @@ public class CrmCustomerAnalyze extends BaseEntity{
     private String reserveStr;
     /** 客户集合 */
     private Long[] customerIds;
+
+    private Integer pageNum;
+
+    private Integer pageSize;
 }

+ 1 - 1
fs-service/src/main/java/com/fs/crm/domain/CrmCustomerChatMessage.java

@@ -39,7 +39,7 @@ public class CrmCustomerChatMessage extends BaseEntity {
     private String modelName;
 
     /** 耗时 (毫秒) */
-    private Integer costTime;
+    private Long costTime;
 
     /** 状态 (1-成功 0-失败) */
     private Integer status;

+ 8 - 4
fs-service/src/main/java/com/fs/crm/service/impl/CrmCustomerAnalyzeServiceImpl.java

@@ -379,10 +379,12 @@ public class CrmCustomerAnalyzeServiceImpl extends ServiceImpl<CrmCustomerAnalyz
         requestParam.put("history", "");
         requestParam.put("aiContent", "");
         requestParam.put("likeRatio", "");
+        long startTime = System.currentTimeMillis();
         R aiResponse = CrmCustomerAiTagUtil.callAiService(requestParam, Long.valueOf(param.getChatId()),OTHER_KEY);
         System.out.println(aiResponse);
         String result = "";
         CrmCustomerChatMessage crmCustomerChatMessage = new CrmCustomerChatMessage();
+        crmCustomerChatMessage.setContentType(1);
 //        Double runningTime;
 //        Long tokens;
         try {
@@ -421,18 +423,20 @@ public class CrmCustomerAnalyzeServiceImpl extends ServiceImpl<CrmCustomerAnalyz
                                 JsonNode innerJson = mapper.readTree(innerJsonStr);
                                 JsonNode userInfo1 = innerJson.path("aiContent");
                                 result = userInfo1.asText();
-                                crmCustomerChatMessage.setContentType(1);
                             }
                         }
                     }
                 }
             }
-
+            crmCustomerChatMessage.setContent(result);
+            crmCustomerChatMessage.setStatus(1);
         } catch (Exception e) {
             e.printStackTrace();
-            crmCustomerChatMessage.setContentType(0);
+            crmCustomerChatMessage.setContent("AI请求失败:" + e.getMessage());
+            crmCustomerChatMessage.setStatus(0);
         }
-        crmCustomerChatMessage.setContent(result);
+        //耗时时间为请求接口时间+解析数据时间
+        crmCustomerChatMessage.setCostTime(System.currentTimeMillis() - startTime);
         crmCustomerChatMessage.setModelName("话术润色");
         return crmCustomerChatMessage;
     }