| | |
| | | */ |
| | | @Override |
| | | public PhoneCallBackYQVO phoneCallBackYQ(PhoneCallReqYQVO phoneCallReqYQVO) { |
| | | //先把该subId从cache_exist中剔除,只要有回调就剔除(目的是,尽快让cache-exist为空,去缓存下一批要打的电话;这里剔除不影响电话的正常业务) |
| | | redisCache.removeElementFromList("cache-exist", phoneCallReqYQVO.getTaskid()); |
| | | |
| | | //判断是否挂机 |
| | | String hangupState = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "- hangup"); |
| | | Object cacheObject1 = redisCache.getCacheObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup"); |
| | |
| | | if (ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("1")) { |
| | | return new PhoneCallBackYQVO(); |
| | | } |
| | | //如果发送状态为6,就说明已经打完了,也没有必要继续往下走了 |
| | | if (StringUtils.isNotEmpty(phoneCallReqYQVO.getTaskid())) { |
| | | ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(Long.valueOf(phoneCallReqYQVO.getTaskid())); |
| | | if (serviceSubtask.getSendstate() == 6L) return new PhoneCallBackYQVO(); |
| | | } |
| | | |
| | | ServiceSubtask serviceSubtask2 = new ServiceSubtask(); |
| | | serviceSubtask2.setRemark("电话发送成功(患者挂断)"); |
| | | serviceSubtask2.setSenduuid(phoneCallReqYQVO.getUuid()); |
| | |
| | | @Override |
| | | public List<PullTaskVO> taskPull() { |
| | | //pullTaskVOList用于数据返回 |
| | | List<PullTaskVO> pullTaskVOList = null; |
| | | List<PullTaskVO> pullTaskVOList = new ArrayList<>(); |
| | | List<String> cacheList = new ArrayList<>(); |
| | | ListOperations<String, String> listOps = redisTemplate.opsForList(); |
| | | //必须等ache-exist全部打完才能拉取下一批(主要是怕所有的数据都堆在电话的缓存里,在规定的时间打不完) |
| | | long existSize = listOps.size("cache-exist"); |
| | | if (existSize > 0) return pullTaskVOList; |
| | | |
| | | long size = listOps.size("cache-0"); |
| | | log.error("---------打电话之前缓存中的数据量:{}", size); |
| | | int count = 0; |
| | |
| | | listOps.trim("cache-0" + i, count1, -1); |
| | | } |
| | | } |
| | | //existList用来记录接下来需要执行的子任务ID |
| | | List<String> existList = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(pullTaskVOList)) { |
| | | //给回调参数赋值 |
| | | for (PullTaskVO pullTaskVO : pullTaskVOList) { |
| | | existList.add(pullTaskVO.getTaskid()); |
| | | pullTaskVO.setAsrcallback(ASRCallBackPath); |
| | | } |
| | | } |
| | | if (existList.size() != 0) redisCache.setCacheListRight("cache-exist", existList); |
| | | log.error("-----------实际拉取的电话数据量:{}", pullTaskVOList.size()); |
| | | return pullTaskVOList; |
| | | } |
| | |
| | | redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim(), ivrTaskTemplateScript.getId().toString(), 120, TimeUnit.MINUTES); |
| | | } else { |
| | | newValue0.add(subIds.get(i)); |
| | | redisCache.setCacheList(cacheName, newValue0); |
| | | redisCache.setCacheListRight(cacheName, newValue0); |
| | | } |
| | | } |
| | | |
| | |
| | | ServiceSubtask serviceSubtask = new ServiceSubtask(); |
| | | serviceSubtask.setRemark("电话接通成功,患者拒绝随访"); |
| | | serviceSubtask.setId(Long.valueOf(phoneCallRecordVO.getTaskid())); |
| | | serviceSubtask.setSendstate(6L); |
| | | serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); |
| | | int startIndex = phoneCallRecordVO.getRecord_path().indexOf("voice") + "voice".length() + 1; // 加1是跳过/符号 |
| | | int endIndex = phoneCallRecordVO.getRecord_path().lastIndexOf("/"); |
| | |
| | | redisCache.setCacheObject(subTaskId + "recordAccept-hungup", "1", 10, TimeUnit.MINUTES); |
| | | if (StringUtils.isNotEmpty(serviceSubtask.getRemark())) serviceSubtask.setRemark("电话发送拒接,短信补偿发送成功"); |
| | | else serviceSubtask.setRemark("短信补偿发送成功"); |
| | | serviceSubtask.setSendstate(3L); |
| | | serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); |
| | | |
| | | } |
| | | |
| | | //通过当前时间,拉取电话总数 |