Package com.bytedesk.service.workgroup
Class WorkgroupRoutingService
java.lang.Object
com.bytedesk.service.workgroup.WorkgroupRoutingService
工作组路由服务
根据工作组路由模式选择客服
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private final org.springframework.data.redis.core.StringRedisTemplate
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
calculatePriority
(ThreadEntity thread) 计算会话优先级private double
calculateWeight
(AgentEntity agent) 计算客服权重private double
获取平均响应时间(秒)selectAgent
(WorkgroupEntity workgroup, ThreadEntity thread, List<AgentEntity> availableAgents) 根据工作组路由模式选择客服private AgentEntity
selectByConsistentHash
(String visitorUid, List<AgentEntity> agents) 一致性哈希算法 相同访客尽量分配给同一个客服private AgentEntity
selectByFastestResponse
(List<AgentEntity> agents) 最快响应算法 选择平均响应时间最短的客服private AgentEntity
selectByLeastActive
(List<AgentEntity> agents) 最小活动数算法 选择当前会话数最少的客服private AgentEntity
selectByRandom
(List<AgentEntity> agents) 随机算法 随机选择一个可用客服private AgentEntity
selectByRoundRobin
(String workgroupUid, List<AgentEntity> agents) 轮询算法 按顺序将请求分配给每个客服private AgentEntity
selectByWeightedRandom
(List<AgentEntity> agents) 加权随机算法 根据客服评分和性能给予不同权重
-
Field Details
-
redisTemplate
private final org.springframework.data.redis.core.StringRedisTemplate redisTemplate -
COUNTER_KEY_PREFIX
- See Also:
-
-
Constructor Details
-
WorkgroupRoutingService
public WorkgroupRoutingService()
-
-
Method Details
-
selectAgent
public AgentEntity selectAgent(WorkgroupEntity workgroup, ThreadEntity thread, List<AgentEntity> availableAgents) 根据工作组路由模式选择客服 -
selectByRoundRobin
轮询算法 按顺序将请求分配给每个客服 -
selectByLeastActive
最小活动数算法 选择当前会话数最少的客服 -
selectByRandom
随机算法 随机选择一个可用客服 -
selectByWeightedRandom
加权随机算法 根据客服评分和性能给予不同权重 -
selectByConsistentHash
一致性哈希算法 相同访客尽量分配给同一个客服 -
selectByFastestResponse
最快响应算法 选择平均响应时间最短的客服 -
calculateWeight
计算客服权重 -
getAverageResponseTime
获取平均响应时间(秒) -
calculatePriority
计算会话优先级
-