Pārlūkot izejas kodu

话术润色功能完善

peicj 2 nedēļas atpakaļ
vecāks
revīzija
6ec3e6c501

+ 2 - 16
fs-company/src/main/java/com/fs/company/controller/crm/CrmCustomerAnalyzeController.java

@@ -1,9 +1,6 @@
 package com.fs.company.controller.crm;
 
 import java.util.List;
-
-import com.fs.common.core.domain.R;
-import com.fs.crm.param.PolishingScriptParam;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -51,8 +48,8 @@ public class CrmCustomerAnalyzeController extends BaseController
     /**
      * 查询所有客户(根据客户分组取客户最新一条数据)
      */
-    @GetMapping("/listAll")
-    public TableDataInfo listAll(CrmCustomerAnalyze crmCustomerAnalyze)
+    @PostMapping("/listAll")
+    public TableDataInfo listAll(@RequestBody CrmCustomerAnalyze crmCustomerAnalyze)
     {
         startPage();
         List<CrmCustomerAnalyze> list = crmCustomerAnalyzeService.selectCrmCustomerAnalyzeListAll(crmCustomerAnalyze);
@@ -115,15 +112,4 @@ public class CrmCustomerAnalyzeController extends BaseController
     {
         return toAjax(crmCustomerAnalyzeService.deleteCrmCustomerAnalyzeByIds(ids));
     }
-
-    /**
-     * 话术润色
-     */
-    @PreAuthorize("@ss.hasPermi('crm:analyze:polishingScript')")
-    @PostMapping("/polishingScript")
-    public R polishingScript(@RequestBody PolishingScriptParam param)
-    {
-        return R.ok().put("data",crmCustomerAnalyzeService.polishingScript(param));
-    }
-
 }

+ 16 - 2
fs-company/src/main/java/com/fs/company/controller/crm/chat/CrmCustomerChatSessionController.java

@@ -2,10 +2,13 @@ package com.fs.company.controller.crm.chat;
 
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.utils.ServletUtils;
 import com.fs.crm.domain.CrmCustomerChatMessage;
 import com.fs.crm.domain.CrmCustomerChatSession;
+import com.fs.crm.param.PolishingScriptParam;
+import com.fs.crm.service.ICrmCustomerAnalyzeService;
 import com.fs.crm.service.ICrmCustomerChatMessageService;
 import com.fs.crm.service.ICrmCustomerChatSessionService;
 import com.fs.framework.security.LoginUser;
@@ -32,6 +35,8 @@ public class CrmCustomerChatSessionController extends BaseController {
     private TokenService tokenService;
     @Autowired
     private ICrmCustomerChatMessageService chatMessageService;
+    @Autowired
+    private ICrmCustomerAnalyzeService crmCustomerAnalyzeService;
 
     /**
      * 查询聊天会话列表
@@ -40,8 +45,9 @@ public class CrmCustomerChatSessionController extends BaseController {
     public TableDataInfo list(CrmCustomerChatSession chatSession) {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         chatSession.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<CrmCustomerChatSession> list = chatSessionService.selectChatSessionList(chatSession);
-        //根据会话查询对应的消息数据
+        //根据会话查询对应的消息数据,返回一个sessionId对应200条数据显示
         list.forEach(session -> {
             List<CrmCustomerChatMessage> messageList =chatMessageService.selectChatMessageBySessionIdLimit(session.getSessionId());
             session.setMessageList(messageList);
@@ -93,7 +99,6 @@ public class CrmCustomerChatSessionController extends BaseController {
             int result = chatSessionService.updateChatSessionTitle(sessionId, title);
             return result > 0 ? success("更新成功") : error("更新失败");
         } catch (Exception e) {
-            logger.error("更新会话标题失败", e);
             return error("更新失败:" + e.getMessage());
         }
     }
@@ -153,4 +158,13 @@ public class CrmCustomerChatSessionController extends BaseController {
     public AjaxResult removeBatch(@RequestBody Long[] sessionIds) {
         return toAjax(chatSessionService.deleteChatSessionByIds(sessionIds));
     }
+
+    /**
+     * 话术润色
+     */
+    @PostMapping("/polishingScript")
+    public R polishingScript(@RequestBody PolishingScriptParam param)
+    {
+        return R.ok().put("data",crmCustomerAnalyzeService.polishingScript(param));
+    }
 }

+ 1 - 1
fs-service/src/main/java/com/fs/crm/mapper/CrmCustomerChatMessageMapper.java

@@ -81,6 +81,6 @@ public interface CrmCustomerChatMessageMapper {
      * 根据会话 ID 查询消息分页列表
      * @param sessionId sessionId
      */
-    @Select("SELECT * FROM crm_customer_chat_message WHERE session_id = #{sessionId} ORDER BY create_time DESC LIMIT 50")
+    @Select("SELECT * FROM crm_customer_chat_message WHERE session_id = #{sessionId} ORDER BY create_time DESC LIMIT 200")
     List<CrmCustomerChatMessage> selectChatMessageBySessionIdLimit(@Param("sessionId") Long sessionId);
 }

+ 5 - 18
fs-service/src/main/java/com/fs/crm/service/impl/CrmCustomerChatSessionServiceImpl.java

@@ -4,7 +4,6 @@ import com.fs.common.utils.DateUtils;
 import com.fs.crm.domain.CrmCustomerChatSession;
 import com.fs.crm.mapper.CrmCustomerChatSessionMapper;
 import com.fs.crm.service.ICrmCustomerChatSessionService;
-import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -17,7 +16,6 @@ import java.util.List;
  * @author ylrz
  * @date 2026-03-30
  */
-@Slf4j
 @Service
 public class CrmCustomerChatSessionServiceImpl implements ICrmCustomerChatSessionService {
 
@@ -64,9 +62,7 @@ public class CrmCustomerChatSessionServiceImpl implements ICrmCustomerChatSessio
         if (chatSession.getIsPinned() == null) {
             chatSession.setIsPinned(0);
         }
-        int result = chatSessionMapper.insertChatSession(chatSession);
-        log.info("新增会话成功,sessionId: {}", chatSession.getSessionId());
-        return result;
+        return chatSessionMapper.insertChatSession(chatSession);
     }
 
     /**
@@ -78,9 +74,7 @@ public class CrmCustomerChatSessionServiceImpl implements ICrmCustomerChatSessio
     @Override
     public int updateChatSession(CrmCustomerChatSession chatSession) {
         chatSession.setUpdateTime(DateUtils.getNowDate());
-        int result = chatSessionMapper.updateChatSession(chatSession);
-        log.info("更新会话成功,sessionId: {}", chatSession.getSessionId());
-        return result;
+        return chatSessionMapper.updateChatSession(chatSession);
     }
 
     /**
@@ -94,11 +88,8 @@ public class CrmCustomerChatSessionServiceImpl implements ICrmCustomerChatSessio
     @Transactional(rollbackFor = Exception.class)
     public int updateChatSessionTitle(Long sessionId, String title) {
         try {
-            int result = chatSessionMapper.updateChatSessionTitle(sessionId, title);
-            log.info("更新会话标题成功,sessionId: {}, title: {}", sessionId, title);
-            return result;
+            return chatSessionMapper.updateChatSessionTitle(sessionId, title);
         } catch (Exception e) {
-            log.error("更新会话标题失败", e);
             throw new RuntimeException("更新会话标题失败:" + e.getMessage());
         }
     }
@@ -138,9 +129,7 @@ public class CrmCustomerChatSessionServiceImpl implements ICrmCustomerChatSessio
         if (sessionIds == null || sessionIds.length == 0) {
             return 0;
         }
-        int result = chatSessionMapper.deleteChatSessionByIds(sessionIds);
-        log.info("批量删除会话成功,删除数量:{}", sessionIds.length);
-        return result;
+        return chatSessionMapper.deleteChatSessionByIds(sessionIds);
     }
 
     /**
@@ -151,9 +140,7 @@ public class CrmCustomerChatSessionServiceImpl implements ICrmCustomerChatSessio
      */
     @Override
     public int deleteChatSessionById(Long sessionId) {
-        int result = chatSessionMapper.deleteChatSessionById(sessionId);
-        log.info("删除会话成功,sessionId: {}", sessionId);
-        return result;
+        return chatSessionMapper.deleteChatSessionById(sessionId);
     }
 
     @Override