Explorar o código

通话记录筛选用户列表接口调整: 按用户ID去重,人工再去查询最新的名字

王苗苗 hai 2 meses
pai
achega
c4ad8a14a3

+ 3 - 1
slibra-admin/src/main/java/com/slibra/web/controller/business/TCallRecordController.java

@@ -3,6 +3,7 @@ package com.slibra.web.controller.business;
 import java.util.*;
 import javax.servlet.http.HttpServletResponse;
 
+import com.slibra.business.res.UserTypeResp;
 import com.slibra.common.core.domain.R;
 import com.slibra.common.exception.ServiceException;
 import com.slibra.common.utils.StringUtils;
@@ -144,10 +145,11 @@ public class TCallRecordController extends BaseController
 
     /**
      * 获取客服列表接口【只返回用户的ID和姓名】
+     * 2025年01月07日16:59:46 逻辑调整:因为可能用户会改名字,所以如果用户ID一样,但是姓名不一样的,就返回一条数据,名称是查询最新的用户  【机器人不用处理,因为机器人都是大模型那边固定死的】
      * @return
      */
     @GetMapping(value = "/getAgentList")
-    public R<List<HashMap<String, Object>>> getAgentList()
+    public R<List<UserTypeResp>> getAgentList()
     {
         return R.ok(tCallRecordService.getAgentList());
     }

+ 2 - 1
slibra-system/src/main/java/com/slibra/business/mapper/TCallRecordMapper.java

@@ -5,6 +5,7 @@ import java.util.List;
 
 import com.slibra.business.domain.TCallRecord;
 import com.slibra.business.res.CallUserCountInfo;
+import com.slibra.business.res.UserTypeResp;
 import org.apache.ibatis.annotations.Param;
 
 /**
@@ -67,7 +68,7 @@ public interface TCallRecordMapper
 
     String getContentsBySessionId(String sessionId);
 
-    List<HashMap<String, Object>> getAgentList();
+    List<UserTypeResp> getAgentList();
 
     int getCallCountsByPhone(String phone);
 

+ 34 - 0
slibra-system/src/main/java/com/slibra/business/res/UserTypeResp.java

@@ -0,0 +1,34 @@
+package com.slibra.business.res;
+
+import com.slibra.common.annotation.Excel;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * 用户信息对象 t_user_info
+ * 
+ * @author slibra
+ * @date 2024-11-06
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class UserTypeResp implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    //用户ID
+    private Long id;
+
+    //用户名称
+    private String name;
+
+    //通话记录的分类 服务类型(0人工坐席 1机器人坐席 2机器人转人工)
+    private Long serviceCategory;
+
+
+}

+ 2 - 1
slibra-system/src/main/java/com/slibra/business/service/ITCallRecordService.java

@@ -6,6 +6,7 @@ import java.util.List;
 import com.slibra.business.domain.TCallRecord;
 import com.slibra.business.res.CallRecordCount;
 import com.slibra.business.res.CallUserCountInfo;
+import com.slibra.business.res.UserTypeResp;
 
 /**
  * 通话记录Service接口
@@ -65,7 +66,7 @@ public interface ITCallRecordService
 
     TCallRecord getCallBySessionId(String sessionId);
 
-    List<HashMap<String, Object>> getAgentList();
+    List<UserTypeResp> getAgentList();
 
     String updateFile2TextById(Long id);
 

+ 17 - 2
slibra-system/src/main/java/com/slibra/business/service/impl/TCallRecordServiceImpl.java

@@ -11,6 +11,7 @@ import com.slibra.business.mapper.TCutOffWaterMapper;
 import com.slibra.business.mapper.TUserInfoMapper;
 import com.slibra.business.res.CallRecordCount;
 import com.slibra.business.res.CallUserCountInfo;
+import com.slibra.business.res.UserTypeResp;
 import com.slibra.common.DecimalUtils;
 import com.slibra.common.core.domain.entity.SysUser;
 import com.slibra.common.exception.ServiceException;
@@ -217,8 +218,22 @@ public class TCallRecordServiceImpl implements ITCallRecordService
     }
 
     @Override
-    public List<HashMap<String, Object>> getAgentList() {
-        return this.tCallRecordMapper.getAgentList();
+    public List<UserTypeResp> getAgentList() {
+        List<UserTypeResp> agentList = this.tCallRecordMapper.getAgentList();
+        if(!CollectionUtils.isEmpty(agentList)){
+            for (UserTypeResp userTypeResp : agentList) {
+                Long serviceCategory = userTypeResp.getServiceCategory();
+                if(!Objects.isNull(serviceCategory) && 0L == serviceCategory){//人工 需要特殊处理
+                    Long id = userTypeResp.getId();
+                    if(!Objects.isNull(id)){
+                        SysUser sysUser = this.sysUserMapper.selectUserById(id);
+                        if(!Objects.isNull(sysUser))
+                            userTypeResp.setName(sysUser.getNickName());
+                    }
+                }
+            }
+        }
+        return agentList;
     }
 
     /**

+ 15 - 3
slibra-system/src/main/resources/mapper/business/TCallRecordMapper.xml

@@ -184,13 +184,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LIMIT 1
     </select>
 
-    <select id="getAgentList" resultType="java.util.HashMap">
-        SELECT DISTINCT
+    <select id="getAgentList" resultType="com.slibra.business.res.UserTypeResp">
+        <!-- SELECT DISTINCT
             user_id id,
             user_name `name`
         FROM
             t_call_record
-        WHERE user_id is not null
+        WHERE user_id is not null -->
+        SELECT DISTINCT
+        user_id id,
+        user_name `name`,
+        CASE
+        service_category
+        WHEN 0 THEN
+        0 ELSE 1
+        END serviceCategory
+        FROM
+        t_call_record
+        WHERE
+        user_id IS NOT NULL
     </select>
 
     <select id="getCallCountsByPhone" resultType="int">