Class WorkgroupRoutingService

java.lang.Object
com.bytedesk.service.workgroup.WorkgroupRoutingService

@Component public class WorkgroupRoutingService extends Object
工作组路由服务 根据工作组路由模式选择客服
  • Field Details

    • redisTemplate

      private final org.springframework.data.redis.core.StringRedisTemplate redisTemplate
    • COUNTER_KEY_PREFIX

      private static final String COUNTER_KEY_PREFIX
      See Also:
  • Constructor Details

    • WorkgroupRoutingService

      public WorkgroupRoutingService()
  • Method Details

    • selectAgent

      public AgentEntity selectAgent(WorkgroupEntity workgroup, ThreadEntity thread, List<AgentEntity> availableAgents)
      根据工作组路由模式选择客服
    • selectByRoundRobin

      private AgentEntity selectByRoundRobin(String workgroupUid, List<AgentEntity> agents)
      轮询算法 按顺序将请求分配给每个客服
    • selectByLeastActive

      private AgentEntity selectByLeastActive(List<AgentEntity> agents)
      最小活动数算法 选择当前会话数最少的客服
    • selectByRandom

      private AgentEntity selectByRandom(List<AgentEntity> agents)
      随机算法 随机选择一个可用客服
    • selectByWeightedRandom

      private AgentEntity selectByWeightedRandom(List<AgentEntity> agents)
      加权随机算法 根据客服评分和性能给予不同权重
    • selectByConsistentHash

      private AgentEntity selectByConsistentHash(String visitorUid, List<AgentEntity> agents)
      一致性哈希算法 相同访客尽量分配给同一个客服
    • selectByFastestResponse

      private AgentEntity selectByFastestResponse(List<AgentEntity> agents)
      最快响应算法 选择平均响应时间最短的客服
    • calculateWeight

      private double calculateWeight(AgentEntity agent)
      计算客服权重
    • getAverageResponseTime

      private double getAverageResponseTime(AgentEntity agent)
      获取平均响应时间(秒)
    • calculatePriority

      public int calculatePriority(ThreadEntity thread)
      计算会话优先级