|  |  | 
 |  |  |                                     list.add(serviceSubtask2.getId().toString()); | 
 |  |  |                                 } | 
 |  |  |                                 log.error("缓存中cache-0的值为:{}", list); | 
 |  |  |                                 redisCache.setCacheListLeft("cache-0", list); | 
 |  |  | //                                redisCache.setCacheListLeft("cache-0", list); | 
 |  |  |                                 redisCache.setCacheListLeftAndDistinct("cache-0", list); | 
 |  |  |                             } else { | 
 |  |  |                                 //非立即发送 | 
 |  |  |                                 ServiceSubtaskVO serviceSubtask1 = new ServiceSubtaskVO(); | 
 |  |  | 
 |  |  |                                 for (ServiceSubtask serviceSubtask2 : selectServiceSubtaskList1) { | 
 |  |  |                                     list.add(serviceSubtask2.getId().toString()); | 
 |  |  |                                 } | 
 |  |  |                                 redisCache.setCacheListLeft(key, list); | 
 |  |  | //                                redisCache.setCacheListLeft(key, list); | 
 |  |  |                                 redisCache.setCacheListLeftAndDistinct(key, list); | 
 |  |  |                             } | 
 |  |  |                         } catch (Exception exception) { | 
 |  |  |                             ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); | 
 
 |  |  | 
 |  |  | import com.ruoyi.common.core.domain.entity.SysUser; | 
 |  |  | import com.ruoyi.common.core.domain.model.LoginUser; | 
 |  |  | import com.ruoyi.common.core.page.TableDataInfo; | 
 |  |  | import com.ruoyi.common.core.redis.RedisCache; | 
 |  |  | import com.ruoyi.common.enums.BusinessType; | 
 |  |  | import com.ruoyi.common.utils.DtoConversionUtils; | 
 |  |  | import com.ruoyi.common.utils.PageUtils; | 
 
 |  |  | 
 |  |  | package com.ruoyi.common.core.redis; | 
 |  |  |  | 
 |  |  | import java.util.Collection; | 
 |  |  | import java.util.Iterator; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.Set; | 
 |  |  | import java.util.*; | 
 |  |  | import java.util.concurrent.TimeUnit; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.data.redis.core.*; | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 缓存List数据 | 
 |  |  |      * | 
 |  |  |      * @param cacheKey      缓存的键值 | 
 |  |  |      * @param list 待缓存的List数据(这里如果新增的话,是往头部新增)并去重 | 
 |  |  |      * @return 缓存的对象 | 
 |  |  |      */ | 
 |  |  |     public void setCacheListLeftAndDistinct(String cacheKey, List<String> list) { | 
 |  |  |         // 获取 ListOperations 对象,用于操作 Redis List | 
 |  |  |         ListOperations<String, String> listOps = redisTemplate.opsForList(); | 
 |  |  |  | 
 |  |  |         // 获取现有的 cache-0 列表中的所有值 | 
 |  |  |         List<String> existingValues = listOps.range(cacheKey, 0, -1); | 
 |  |  |  | 
 |  |  |         // 过滤出不在 Redis 列表中的值 | 
 |  |  |         List<String> newValues = list.stream().filter(value -> !existingValues.contains(value)).collect(Collectors.toList()); | 
 |  |  |  | 
 |  |  |         // 将新的值添加到 Redis 列表的左侧 | 
 |  |  |         if (!newValues.isEmpty()) { | 
 |  |  |             listOps.leftPushAll(cacheKey, newValues); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获得缓存的list对象 | 
 |  |  |      * | 
 |  |  |      * @param key 缓存的键值 | 
 
 |  |  | 
 |  |  |                 List<ServiceSubtask> subtaskList = iServiceSubtaskService.selectServiceSubtaskList(ivrTaskcall); | 
 |  |  |  | 
 |  |  |                 // 按照 endtime 离当前时间最近的排序 | 
 |  |  |                 List<ServiceSubtask> selectServiceSubtaskList = subtaskList.stream() | 
 |  |  |                         .sorted(Comparator.comparing(subtask -> Math.abs(subtask.getEndtime().getTime() - new Date().getTime()))) | 
 |  |  |                         .collect(Collectors.toList()); | 
 |  |  |                 List<ServiceSubtask> selectServiceSubtaskList = subtaskList.stream().sorted(Comparator.comparing(subtask -> Math.abs(subtask.getEndtime().getTime() - new Date().getTime()))).collect(Collectors.toList()); | 
 |  |  |  | 
 |  |  |                 if (descByCode.equals("电话")) { | 
 |  |  |                     String value = ""; | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //将要执行的放到缓存中 | 
 |  |  |                     if (list.size() > 0) { | 
 |  |  |                         redisCache.setCacheListLeft("cache-0", list); | 
 |  |  | //                        redisCache.setCacheListLeft("cache-0", list); | 
 |  |  |                         redisCache.setCacheListLeftAndDistinct("cache-0", list); | 
 |  |  |                     } | 
 |  |  |                 } else if (descByCode.equals("多媒体")) { | 
 |  |  |                     //多媒体 | 
 
 |  |  | 
 |  |  |             //无人接听 | 
 |  |  |             getSmsCompensate(Long.valueOf(phoneCallRecordVO.getTaskid())); | 
 |  |  |             redisCache.deleteObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup"); | 
 |  |  |             redisCache.removeElementFromList("cache-exist", phoneCallRecordVO.getTaskid()); | 
 |  |  |         } else if (ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("2")) { | 
 |  |  | //        if (phoneCallRecordVO.getAnswered() != null && phoneCallRecordVO.getAnswered() == true) { | 
 |  |  |             log.error("有人接电话了,并且完了"); |