From bb60b5747d5f4b85655a541d4990ec7464497b1b Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期五, 10 五月 2024 18:18:02 +0800 Subject: [PATCH] 代码提交 --- smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java | 587 ++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 427 insertions(+), 160 deletions(-) diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java index 8fc80bd..5a9142d 100644 --- a/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java @@ -4,6 +4,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.utils.DateUtils; @@ -49,6 +51,12 @@ private IvrLibaTemplateTargetoptionMapper ivrLibaScriptTargetoptionMapper; @Autowired + private IvrLibaTemplateScriptMapper ivrLibaTemplateScriptMapper; + + @Autowired + private IvrTaskVisitResultMapper ivrTaskVisitResultMapper; + + @Autowired private RedisCache redisCache; @Autowired @@ -56,13 +64,6 @@ @Autowired private RabbitTemplate rabbitTemplate; - - - @Autowired - private PatMedOuthospMapper patMedOuthospMapper; - - @Autowired - private PatMedInhospMapper patMedInhospMapper; /** @@ -88,41 +89,68 @@ } @Override - public List<IvrVisitInfoVo> patItem(IvrTaskSingle ivrTaskcall) { - List<IvrTaskSingle> list = this.selectIvrTaskcallList(ivrTaskcall); + public IvrTaskSingleVO queryTaskByCondition(IvrTaskSingle ivrTaskcall) { + //瀹氫箟鎮h�呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚� + List<PatTaskRelevance> patTaskRelevances = new ArrayList<>(); + List<IvrTaskSingle> list = selectIvrTaskcallList(ivrTaskcall); + if (CollectionUtils.isEmpty(list)) { + new BaseException("璇ヤ换鍔′笉瀛樺湪"); + } + //灏嗘煡鍑烘潵鐨勬暟鎹�掑叆IvrTaskcallVO涓� + IvrTaskSingleVO ivrTaskcallVO2 = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskSingleVO.class); + String sendTimeSlot = list.get(0).getSendTimeSlot(); + ObjectMapper objectMapper = new ObjectMapper(); + try { + //鑾峰彇鍒板彂閫佹椂闂寸殑闆嗗悎 + if (com.ruoyi.common.utils.StringUtils.isNotEmpty(sendTimeSlot)) { + List<TaskSendTimeVO> taskSendTimeVOList = objectMapper.readValue(sendTimeSlot, List.class); + ivrTaskcallVO2.setSendTimeslot(taskSendTimeVOList); + } + //鏂囨湰鍙橀噺鍙傛暟 + if (com.ruoyi.common.utils.StringUtils.isNotEmpty(list.get(0).getTextParam())) { + Map<String, Map<String, String>> textParam = objectMapper.readValue(list.get(0).getTextParam(), Map.class); + ivrTaskcallVO2.setTextParam(textParam); + } + } catch (JsonProcessingException e) { + e.printStackTrace(); + } - //瀹氫箟杩斿弬鏁版嵁 - List<IvrVisitInfoVo> visitInfoVos = new ArrayList<>(); for (IvrTaskSingle ivrTaskcall1 : list) { - IvrVisitInfoVo ivrVisitInfoVo = DtoConversionUtils.sourceToTarget(ivrTaskcall1, IvrVisitInfoVo.class); - ivrVisitInfoVo.setPatientName(ivrTaskcall1.getSendname()); - if (ivrTaskcall.getRecordid() != null) { - if (ivrTaskcall1.getHospType().equals("1")) { - //闂ㄨ瘖闅忚 - PatMedOuthosp patMedOuthosp = patMedOuthospMapper.selectPatMedOuthospById(ivrTaskcall.getRecordid()); - ivrVisitInfoVo.setDiagname(patMedOuthosp.getDiagname()); - ivrVisitInfoVo.setDeptname(patMedOuthosp.getDeptname()); - ivrVisitInfoVo.setAdmitdate(patMedOuthosp.getAdmitdate()); - ivrVisitInfoVo.setVisitTime(ivrTaskcall1.getSendTimeSlot()); - ivrVisitInfoVo.setState(ivrTaskcall1.getSendstate()); - ivrVisitInfoVo.setHospno(patMedOuthosp.getOuthospno()); - visitInfoVos.add(ivrVisitInfoVo); - } else if (ivrTaskcall1.getHospType().equals("2")) { - //鍑洪櫌 - PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(ivrTaskcall.getRecordid()); - ivrVisitInfoVo.setDiagname(patMedInhosp.getDiagname()); - ivrVisitInfoVo.setDeptname(patMedInhosp.getDeptname()); - ivrVisitInfoVo.setAdmitdate(patMedInhosp.getStarttime()); - ivrVisitInfoVo.setVisitTime(ivrTaskcall1.getSendTimeSlot()); - ivrVisitInfoVo.setState(ivrTaskcall1.getSendstate()); - ivrVisitInfoVo.setHospno(patMedInhosp.getInhospno()); - ivrVisitInfoVo.setRoomno(patMedInhosp.getRoomno()); - ivrVisitInfoVo.setBedno(patMedInhosp.getBedno()); - visitInfoVos.add(ivrVisitInfoVo); - } + PatTaskRelevance patTaskRelevance = new PatTaskRelevance(); + if (!ivrTaskcall1.getHospType().equals("2")) { + log.info("闅忚鏌ヨ涓嶄负鍑洪櫌锛寋}", ivrTaskcall1.getHospType()); + //鑾峰彇鍒版偅鑰呬俊鎭紝骞舵斁鍏ュ埌闆嗗悎涓� + patTaskRelevance.setName(ivrTaskcall1.getSendname()); + patTaskRelevance.setAge(ivrTaskcall1.getAge()); + patTaskRelevance.setSfzh(ivrTaskcall1.getSfzh()); + patTaskRelevance.setPhone(ivrTaskcall1.getPhone()); + patTaskRelevance.setAddr(ivrTaskcall1.getAddr()); + patTaskRelevance.setDiagname(ivrTaskcall1.getDiagname()); + patTaskRelevances.add(patTaskRelevance); + } + if (ivrTaskcall1.getHospType().equals("2")) { + log.info("闅忚鏌ヨ涓哄嚭闄紝{}", ivrTaskcall1.getHospType()); + patTaskRelevance.setName(ivrTaskcall1.getSendname()); + patTaskRelevance.setAge(ivrTaskcall1.getAge()); + patTaskRelevance.setSfzh(ivrTaskcall1.getSfzh()); + patTaskRelevance.setPhone(ivrTaskcall1.getPhone()); + patTaskRelevance.setAddr(ivrTaskcall1.getAddr()); + patTaskRelevance.setDeptName(ivrTaskcall1.getDeptname()); + patTaskRelevance.setBedNo(ivrTaskcall1.getBedNo()); + patTaskRelevance.setDiagname(ivrTaskcall1.getDiagname()); + patTaskRelevances.add(patTaskRelevance); } } - return visitInfoVos; + + ivrTaskcallVO2.setPatTaskRelevances(patTaskRelevances); + return ivrTaskcallVO2; + } + + @Override + public List<IvrTaskSingle> patItem(IvrTaskSingle ivrTaskSingle) { + + + return this.selectIvrTaskcallList(ivrTaskSingle); } /** @@ -152,7 +180,6 @@ /** * 鎵归噺鍒犻櫎鍗曚竴浠诲姟锛堥殢璁匡級 * - * @param ids 闇�瑕佸垹闄ょ殑鍗曚竴浠诲姟锛堥殢璁匡級涓婚敭 * @return 缁撴灉 */ @Override @@ -167,7 +194,6 @@ /** * 鍗曚竴浠诲姟 * - * @param ivrTaskcallVO 鍗曚竴浠诲姟 * @return 缁撴灉 */ @Transactional(rollbackFor = Exception.class) @@ -181,9 +207,9 @@ if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 1) { //寰�浠诲姟琛ㄤ腑锛屾柊澧炰换鍔� IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTask.class); - Integer taskId = ivrTaskService.insertIvrTask(ivrTask); + ivrTaskService.insertIvrTask(ivrTask); - ivrTaskcallVO.setTaskid(taskId.longValue()); + ivrTaskcallVO.setTaskid(ivrTask.getTaskid().longValue()); //鏂板 if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getPatTaskRelevances())) { for (PatTaskRelevance patTaskRelevance : ivrTaskcallVO.getPatTaskRelevances()) { @@ -195,7 +221,7 @@ ivrTaskcall.setPhone(patTaskRelevance.getPhone()); ivrTaskcall.setAddr(patTaskRelevance.getAddr()); ivrTaskcall.setCreateTime(DateUtils.getNowDate()); - ivrTaskcall.setTextParam(new Gson().toJson(ivrTaskcallVO.getTextParam())); + ivrTaskcall.setTextParam(new Gson().toJson(patTaskRelevance.getTextParam())); if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getSendTimeslot())) { ivrTaskcall.setSendTimeSlot(ivrTaskcallVO.getSendTimeslot().toString()); } @@ -245,7 +271,7 @@ @Override public int heTaskSend(IvrTaskSingleVO ivrTaskcallVO) { //鍒ゆ柇浠诲姟鏄惁鏄珛鍗冲彂閫� - if (ivrTaskcallVO.getSendType().equals("2") && ivrTaskcallVO.getSendstate() == 1) { + if (ivrTaskcallVO.getSendType().equals("2")) { IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ(); ivrTaskcallMQ.setTaskid(ivrTaskcallVO.getTaskid()); ivrTaskcallMQ.setSendType("1"); @@ -259,7 +285,7 @@ message.getMessageProperties().setHeader("x-delay", 0); return message; }); - } else if (ivrTaskcallVO.getSendType().equals("1") && ivrTaskcallVO.getSendstate() == 1) { + } else if (ivrTaskcallVO.getSendType().equals("1")) { //鏃堕棿娈靛彂閫� if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getSendTimeslot())) { for (TaskSendTimeVO taskSendTimeVO : ivrTaskcallVO.getSendTimeslot()) { @@ -294,6 +320,11 @@ return message; }); } + //灏嗕换鍔$姸鎬佷慨鏀规垚鎵ц涓� + IvrTask ivrTask = new IvrTask(); + ivrTask.setTaskid(ivrTaskcallVO.getTaskid()); + ivrTask.setSendState("2"); + ivrTaskService.updateIvrTask(ivrTask); } } @@ -301,97 +332,45 @@ } @Override - public PhoneCallBackVO phoneCallBack(PhoneCallBackVO phoneCallBackVO) { - log.info("phoneCallBackVO鐨勫叆鍙傦細{},{},{},{},{},{},{}", phoneCallBackVO.getResultType(), phoneCallBackVO.getUuid(), phoneCallBackVO.getErrResult(), phoneCallBackVO.getTextResult(), phoneCallBackVO.getHangUpResult(), phoneCallBackVO.getEnumState(), phoneCallBackVO.getUint8()); - //鑾峰彇鏁版嵁 - Boolean aBoolean = redisCache.hasKey(phoneCallBackVO.getUuid()); - if (!aBoolean) { - new BaseException("璇uid涓嶅瓨鍦�"); - } - Integer hangupValue = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "hangup"); - if (hangupValue != null && hangupValue == 1) { - //hangupValue == 1 闅忚缁撴潫锛岀洿鎺ュ彲浠ユ寕鐢佃瘽 + public void phoneCallBack(PhoneCallBackVO phoneCallBackVO) { + synchronized (new IvrTaskSingleServiceImpl()) { + phoneCallBackVO.setTextResult(phoneCallBackVO.getTextResult().substring(0, phoneCallBackVO.getTextResult().length() - 1)); + SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); + + //鑾峰彇鏁版嵁 + Boolean aBoolean = redisCache.hasKey(phoneCallBackVO.getUuid()); + if (!aBoolean) { + throw new BaseException("璇uid涓嶅瓨鍦�"); + } + Integer hangupValue = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "hangup"); PhoneUtils phoneUtils = new PhoneUtils(); - phoneUtils.hangup(phoneCallBackVO.getUuid(), null, null, null, null, null, null, null); - - } - - String cacheObject = redisCache.getCacheObject(phoneCallBackVO.getUuid()); - ObjectMapper objectMapper = new ObjectMapper(); - Map<String, Object> map = null; - try { - map = objectMapper.readValue(cacheObject, Map.class); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - - IvrTaskSingle ivrTaskcall = (IvrTaskSingle) map.get("ivrTaskcall"); - List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOs = (List<IvrLibaTemplateScriptVO>) map.get("ivrLibaTemplateScriptVO"); - //灏唘uid鏇存柊鍒版暟鎹簱涓� - ivrTaskcall.setSenduuid(phoneCallBackVO.getUuid()); - ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall); - - //鑾峰彇妯℃澘淇℃伅 - IvrLibaTemplateVO ivrLibaTemplateVO = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "ivrLibaTemplateVO"); - - - //棣栧厛鍒ゆ柇resultType - if (phoneCallBackVO.getResultType() == 1) { - //鍛煎彨缁撴灉鎺ュ彛: 1 - if (phoneCallBackVO.getUint8() == 1) { - //鍛煎彨澶辫触锛屽幓redis涓褰曚竴涓嬪け璐ユ鏁帮紝杩涜鍐嶆鍛煎彨 - Integer integer = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "uint8"); - if (integer != null) { - redisCache.setCacheObject(phoneCallBackVO.getUuid() + "uint8", integer + 1, 120, TimeUnit.MINUTES); - } else { - redisCache.setCacheObject(phoneCallBackVO.getUuid() + "uint8", 1, 120, TimeUnit.MINUTES); - } - - if (integer != null && integer == ivrTaskcall.getRecallcount().intValue()) { - log.info("鏃犱汉鎺ュ惉锛歿}, {}", phoneCallBackVO.getErrResult(), phoneCallBackVO.getUuid()); - //杩炵画鎵撹瀹氭锛屽鏋滆娌′汉鎺ワ紝閭e氨缁撴潫 - ivrTaskcall.setResult(phoneCallBackVO.getErrResult()); - ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall); - redisCache.deleteObject(phoneCallBackVO.getUuid() + "uint8"); - } else if (integer != null && integer < ivrTaskcall.getRecallcount().intValue()) { - //杩涜閲嶆嫧 - PhoneUtils phoneUtils = new PhoneUtils(); - phoneUtils.ob(phoneCallBackVO.getUuid(), null, ivrTaskcall.getPhone(), null, null, null, null, null, null, null, null); - } + if (hangupValue != null && hangupValue == 1) { + String date = simpleDateFormat1.format(new Date()); + log.info("鐢佃瘽瑕佹寕鏂簡: {}", date); + //hangupValue == 1 闅忚缁撴潫锛岀洿鎺ュ彲浠ユ寕鐢佃瘽 + phoneUtils.hangup("", "", "", "", "", "", "", phoneCallBackVO.getUuid()); + return; } - } else if (phoneCallBackVO.getResultType() == 2) { - //閫氳瘽鐘舵�佹洿鏂版帴鍙�: 2 - if (phoneCallBackVO.getEnumState() == 0) { - // 0-鎸搩 - Integer integer = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "enumState"); + Map<String, Object> map = redisCache.getCacheObject(phoneCallBackVO.getUuid()); + IvrTaskSingle ivrTaskcall = (IvrTaskSingle) map.get("ivrTaskSingle"); + List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOs = (List<IvrLibaTemplateScriptVO>) map.get("ivrLibaTemplateScriptVO"); + //灏唘uid鏇存柊鍒版暟鎹簱涓� + ivrTaskcall.setSenduuid(phoneCallBackVO.getUuid()); + ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall); - if (integer != null && integer < ivrTaskcall.getRecallcount().intValue()) { - redisCache.setCacheObject(phoneCallBackVO.getUuid() + "enumState", integer + 1, 120, TimeUnit.MINUTES); - } else if (integer == null) { - redisCache.setCacheObject(phoneCallBackVO.getUuid() + "enumState", 1, 120, TimeUnit.MINUTES); - } else if (integer != null && integer == ivrTaskcall.getRecallcount().intValue()) { - ivrTaskcall.setResult("鏃犱汉鎺ュ惉"); - ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall); - redisCache.deleteObject(phoneCallBackVO.getUuid() + "enumState"); - } - } else if (phoneCallBackVO.getEnumState() == 2) { - //鎮h�呮寕鏂數璇� - log.info("鎮h�呮寕鏂數璇濓細{}", phoneCallBackVO.getUuid()); - ivrTaskcall.setResult(phoneCallBackVO.getHangUpResult()); - ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall); - redisCache.deleteObject(phoneCallBackVO.getUuid() + "enumState"); - } + //鑾峰彇妯℃澘淇℃伅 + IvrLibaTemplateVO ivrLibaTemplateVO = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "ivrLibaTemplateVO"); - - } else if (phoneCallBackVO.getResultType() == 3) { //璇煶璇嗗埆缁撴灉涓婃姤鎺ュ彛: 3 Integer noVoice = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "noVoice"); QuestionMessage returnQues = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "returnQues"); - IvrLibaTemplateScriptVO nowQuestion = returnQues.getNowQuestion(); - PhoneUtils phoneUtils = new PhoneUtils(); + //灏嗕紶鍥炵殑缁撴灉鏀惧埌鍥炲瀵硅薄涓� + returnQues.setContent(phoneCallBackVO.getTextResult()); - if (StringUtils.isEmpty(phoneCallBackVO.getTextResult())) { + IvrLibaTemplateScriptVO nowQuestion = returnQues.getNowQuestion(); + + if (StringUtils.isEmpty(returnQues.getContent())) { //鏃犲洖璇� //鍒ゆ柇noVoice鏄惁宸茬粡鍒颁簡鏈�澶у�� if (noVoice == ivrLibaTemplateVO.getNoVoiceNum().intValue()) { @@ -400,11 +379,14 @@ //娌℃湁涓嬩竴棰樹簡锛屽氨鎸傛柇鐢佃瘽锛屾挱鏀剧粨鏉熻 redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES); phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid()); + return; } else { //鏈変笅涓�棰� redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES); IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion); // 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙� + String date = simpleDateFormat1.format(new Date()); + log.info("鍘昏皟鐢╰ts鍚堟垚鍜屾挱鏀炬帴鍙�: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid()); phoneUtils.ttsPlayback(nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); } } else { @@ -412,11 +394,15 @@ //璋冪敤ivrLibaTemplateScriptVO涓殑slienceText(闈欓粯璇濇湳) String slienceText = nowQuestion.getSlienceText(); //闈欓粯璇濇湳 + 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙� + String date = simpleDateFormat1.format(new Date()); + log.info("闈欓粯璇濇湳 + 闂,鍘昏皟鐢╰ts鍚堟垚鍜屾挱鏀炬帴鍙�: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid()); phoneUtils.ttsPlayback(slienceText + nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); - return new PhoneCallBackVO(); + return; } } else { + //isppd鐢ㄦ潵璁板綍鏄惁鍖归厤鍒� + Boolean isppd = false; //鏈夊洖璇濓紝瀵瑰洖绛旂殑闂,杩涜姝e垯鍖归厤锛堣繖閲屽彧閽堝閫夋嫨棰橈紝鍏跺畠棰樺瀷涓嶈锛� for (int j = 0; j < nowQuestion.getIvrLibaScriptTargetoptionList().size(); j++) { //鍖呭惈 @@ -431,17 +417,29 @@ Pattern pattern2 = Pattern.compile(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()); matcher2 = pattern2.matcher(phoneCallBackVO.getTextResult()); } - log.info("phoneCallBack--Targetregex鐨勫�间负锛歿}, phoneCallBack--Targetregex2鐨勫�间负锛歿}", nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex(), nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()); - if (StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) { + log.error("PCB--getQuestionText闂涓猴細{},UUID锛歿}", nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); + if (StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() || StringUtils.isEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) { //璇存槑鍖归厤姝g‘浜� //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉� nowQuestion.getIvrLibaScriptTargetoptionList().get(j).setIsUserOperation(true); ivrLibaScriptTargetoptionMapper.updateIvrLibaTemplateTargetoption(nowQuestion.getIvrLibaScriptTargetoptionList().get(j)); - //灏嗛潤榛樼疆涓�0 redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES); redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", 0, 120, TimeUnit.MINUTES); + + //灏嗘偅鑰呯殑鍥炵鍐欒繘琛ㄩ噷 + IvrTaskVisitResult ivrTaskVisitResult = DtoConversionUtils.sourceToTarget(ivrTaskcall, IvrTaskVisitResult.class); + ivrTaskVisitResult.setId(null); + ivrTaskVisitResult.setQuestion(nowQuestion.getQuestionText()); + ivrTaskVisitResult.setPatientAnswer(phoneCallBackVO.getTextResult()); + ivrTaskVisitResult.setCreateTime(new Date()); + ivrTaskVisitResult.setOptionResult(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetvalue()); + ivrTaskVisitResultMapper.insertIvrTaskVisitResult(ivrTaskVisitResult); + + //灏嗗尮閰嶅埌鐨勬爣璇嗘敼鎴恡rue + isppd = true; + //鑾峰彇涓嬩竴棰� Integer nextQuestion = nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getNextQuestion(); for (IvrLibaTemplateScriptVO script : ivrLibaTemplateScriptVOs) { @@ -450,36 +448,68 @@ questionMessage.setNowQuestion(script); questionMessage.setQuestionList(ivrLibaTemplateScriptVOs); redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); - break; - } - } - break; - } else { - //娌℃湁鍖归厤鍒� - Integer mateNum = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "mateNum"); - //鏃犲尮閰嶆鏁板幓鍒ゆ柇鏄惁鍒版渶澶ц闂鏁帮紝骞朵笖鎵�鏈夌殑閫夐」閮藉尮閰嶅畬浜� - if (mateNum == ivrLibaTemplateVO.getMateNum().intValue() && j == nowQuestion.getIvrLibaScriptTargetoptionList().size() - 1) { - //濡傛灉涓嬩竴棰樹负绌�.鍒欐柊鐨勬暟鎹繑鍥�,骞跺姞涓婃劅璋㈣ - if (nowQuestion.getTargetid() < ivrLibaTemplateScriptVOs.size()) { - QuestionMessage questionMessage = new QuestionMessage(); - IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion); - questionMessage.setQuestionList(ivrLibaTemplateScriptVOs); - questionMessage.setNowQuestion(nextQuestion); - redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); - redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", 0, 120, TimeUnit.MINUTES); - } else { - //灏卞彲浠ユ寕鏂數璇濅簡 + phoneUtils.ttsPlayback(script.getQuestionText(), phoneCallBackVO.getUuid()); + return; + } else if (nextQuestion > ivrLibaTemplateScriptVOs.size()) { + //娌℃湁涓嬩竴棰樹簡锛屽氨缁撴潫浜� + String date = simpleDateFormat1.format(new Date()); + log.error("娌℃湁涓嬩竴棰樹簡锛屽氨缁撴潫浜�: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid()); redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES); phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid()); - break; + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + phoneUtils.hangup("", "", ivrLibaTemplateVO.getRevisitAfter(), "", "", "", "", phoneCallBackVO.getUuid()); + return; } - } else if (mateNum < ivrLibaTemplateVO.getMateNum().intValue() && j == nowQuestion.getIvrLibaScriptTargetoptionList().size() - 1) { - //娌℃湁闂埌瑙勫畾娆℃暟 - mateNum = mateNum + 1; - redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", mateNum, 120, TimeUnit.MINUTES); } + return; + } else { + //娌℃湁鍖归厤涓婂綋鍓峯ption + //Targetregex2 涓篺alse锛岃〃绀哄湪Targetregex2涓瓨鍦� 璇彞涓殑鍏抽敭瀛楋紝杩欎釜option灏变笉鐢ㄥ啀缁х画鍖归厤浜嗭紝鐩存帴鍖归厤涓嬩竴涓猳ption + continue; } + } + if (isppd != true) { + //娌℃湁鍖归厤鍒� + Integer mateNum = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "mateNum"); + if (mateNum == null) mateNum = 0; + //鏃犲尮閰嶆鏁板幓鍒ゆ柇鏄惁鍒版渶澶ц闂鏁帮紝骞朵笖鎵�鏈夌殑閫夐」閮藉尮閰嶅畬浜� + if (mateNum == ivrLibaTemplateVO.getMateNum().intValue()) { + //濡傛灉涓嬩竴棰樹负绌�.鍒欐柊鐨勬暟鎹繑鍥�,骞跺姞涓婃劅璋㈣ + if (nowQuestion.getTargetid() < ivrLibaTemplateScriptVOs.size()) { + QuestionMessage questionMessage = new QuestionMessage(); + IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion); + questionMessage.setQuestionList(ivrLibaTemplateScriptVOs); + questionMessage.setNowQuestion(nextQuestion); + redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); + redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", 0, 120, TimeUnit.MINUTES); + String date = simpleDateFormat1.format(new Date()); + log.info("濡傛灉涓嬩竴棰樹负绌�.鍒欐柊鐨勬暟鎹繑鍥�,骞跺姞涓婃劅璋㈣: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid()); + phoneUtils.ttsPlayback(nextQuestion.getQuestionText(), phoneCallBackVO.getUuid()); + return; + } else { + //灏卞彲浠ユ寕鏂數璇濅簡 + String date = simpleDateFormat1.format(new Date()); + log.info("灏卞彲浠ユ寕鏂數璇濅簡------: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid()); + redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES); + phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid()); + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + phoneUtils.hangup("", "", ivrLibaTemplateVO.getRevisitAfter(), "", "", "", "", phoneCallBackVO.getUuid()); + return; + } + } else if (mateNum < ivrLibaTemplateVO.getMateNum().intValue()) { + //娌℃湁闂埌瑙勫畾娆℃暟 + mateNum = mateNum + 1; + redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", mateNum, 120, TimeUnit.MINUTES); + } } //閫夐」鍖归厤瀹屾垚鍚庯紝闇�瑕佸啀鍘婚�氳繃搴撳啀杩涜鍖归厤涓�娆� String extemplateID = ivrLibaTemplateVO.getSubmoduleID(); @@ -520,20 +550,257 @@ redisCache.setCacheObject(phoneCallBackVO.getUuid() + "isOver", 1, 120, TimeUnit.MINUTES); } - //璋冪敤鈥�15銆乼ts鍚堟垚鍜屾挱鏀撅紝 tts_playback鈥濆皢缁撴灉浼犲洖 - - + String date = simpleDateFormat1.format(new Date()); + log.info("璋冪敤鈥�15銆乼ts鍚堟垚鍜屾挱鏀�------: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid()); + phoneUtils.ttsPlayback(nowQuestion.getQuestionText() + ivrLibaTemplateScriptVO.getSubmoduleText(), phoneCallBackVO.getUuid()); } break; } + String date = simpleDateFormat1.format(new Date()); + log.info("鏈�鍚庣殑淇℃伅鍥炲-: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid()); + phoneUtils.ttsPlayback(nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); } - } } - return phoneCallBackVO; } + + //涓嬮潰鐨勪唬鐮佷笉鑳藉垹闄わ紝涓婇潰鐨勬柟娉曞彧鏄厤鍚堢數璇濈鑱旇皟鐢ㄧ殑锛� +// @Override +// public PhoneCallBackVO phoneCallBack(PhoneCallBackVO phoneCallBackVO) { +// log.error("phoneCallBackVO鐨勫叆鍙傦細{},{},{},{},{},{},{}", phoneCallBackVO.getResultType(), phoneCallBackVO.getUuid(), phoneCallBackVO.getErrResult(), phoneCallBackVO.getTextResult(), phoneCallBackVO.getHangUpResult(), phoneCallBackVO.getEnumState(), phoneCallBackVO.getUint8()); +// //鑾峰彇鏁版嵁 +// Boolean aBoolean = redisCache.hasKey(phoneCallBackVO.getUuid()); +// if (!aBoolean) { +// throw new BaseException("璇uid涓嶅瓨鍦�"); +// } +// Integer hangupValue = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "hangup"); +// if (hangupValue != null && hangupValue == 1) { +// //hangupValue == 1 闅忚缁撴潫锛岀洿鎺ュ彲浠ユ寕鐢佃瘽 +// PhoneUtils phoneUtils = new PhoneUtils(); +// phoneUtils.hangup(phoneCallBackVO.getUuid(), null, null, null, null, null, null, null); +// +// } +// +// Map<String, Object> map = redisCache.getCacheObject(phoneCallBackVO.getUuid()); +//// ObjectMapper objectMapper = new ObjectMapper(); +//// Map<String, Object> map = null; +//// try { +//// map = objectMapper.readValue(cacheObject, Map.class); +//// } catch (JsonProcessingException e) { +//// e.printStackTrace(); +//// } +// +// IvrTaskSingle ivrTaskcall = (IvrTaskSingle) map.get("ivrTaskcall"); +// List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOs = (List<IvrLibaTemplateScriptVO>) map.get("ivrLibaTemplateScriptVO"); +// //灏唘uid鏇存柊鍒版暟鎹簱涓� +// ivrTaskcall.setSenduuid(phoneCallBackVO.getUuid()); +// ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall); +// +// //鑾峰彇妯℃澘淇℃伅 +// IvrLibaTemplateVO ivrLibaTemplateVO = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "ivrLibaTemplateVO"); +// +// +// //棣栧厛鍒ゆ柇resultType +// if (phoneCallBackVO.getResultType() == 1) { +// //鍛煎彨缁撴灉鎺ュ彛: 1 +// if (phoneCallBackVO.getUint8() == 1) { +// //鍛煎彨澶辫触锛屽幓redis涓褰曚竴涓嬪け璐ユ鏁帮紝杩涜鍐嶆鍛煎彨 +// Integer integer = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "uint8"); +// if (integer != null) { +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "uint8", integer + 1, 120, TimeUnit.MINUTES); +// } else { +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "uint8", 1, 120, TimeUnit.MINUTES); +// } +// +// if (integer != null && integer == ivrTaskcall.getRecallcount().intValue()) { +// log.info("鏃犱汉鎺ュ惉锛歿}, {}", phoneCallBackVO.getErrResult(), phoneCallBackVO.getUuid()); +// //杩炵画鎵撹瀹氭锛屽鏋滆娌′汉鎺ワ紝閭e氨缁撴潫 +// ivrTaskcall.setResult(phoneCallBackVO.getErrResult()); +// ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall); +// redisCache.deleteObject(phoneCallBackVO.getUuid() + "uint8"); +// } else if (integer != null && integer < ivrTaskcall.getRecallcount().intValue()) { +// //杩涜閲嶆嫧 +// PhoneUtils phoneUtils = new PhoneUtils(); +// phoneUtils.ob(null, null, null, null, null, null, null, ivrTaskcall.getPhone(), phoneCallBackVO.getUuid(), true); +// } +// } +// +// } else if (phoneCallBackVO.getResultType() == 2) { +// //閫氳瘽鐘舵�佹洿鏂版帴鍙�: 2 +// if (phoneCallBackVO.getEnumState() == 0) { +// // 0-鎸搩 +// Integer integer = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "enumState"); +// +// if (integer != null && integer < ivrTaskcall.getRecallcount().intValue()) { +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "enumState", integer + 1, 120, TimeUnit.MINUTES); +// } else if (integer == null) { +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "enumState", 1, 120, TimeUnit.MINUTES); +// } else if (integer != null && integer == ivrTaskcall.getRecallcount().intValue()) { +// ivrTaskcall.setResult("鏃犱汉鎺ュ惉"); +// ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall); +// redisCache.deleteObject(phoneCallBackVO.getUuid() + "enumState"); +// } +// } else if (phoneCallBackVO.getEnumState() == 2) { +// //鎮h�呮寕鏂數璇� +// log.info("鎮h�呮寕鏂數璇濓細{}", phoneCallBackVO.getUuid()); +// ivrTaskcall.setResult(phoneCallBackVO.getHangUpResult()); +// ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall); +// redisCache.deleteObject(phoneCallBackVO.getUuid() + "enumState"); +// } +// +// +// } else if (phoneCallBackVO.getResultType() == 3) { +// //璇煶璇嗗埆缁撴灉涓婃姤鎺ュ彛: 3 +// Integer noVoice = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "noVoice"); +// QuestionMessage returnQues = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "returnQues"); +// IvrLibaTemplateScriptVO nowQuestion = returnQues.getNowQuestion(); +// PhoneUtils phoneUtils = new PhoneUtils(); +// +// if (StringUtils.isEmpty(phoneCallBackVO.getTextResult())) { +// //鏃犲洖璇� +// //鍒ゆ柇noVoice鏄惁宸茬粡鍒颁簡鏈�澶у�� +// if (noVoice == ivrLibaTemplateVO.getNoVoiceNum().intValue()) { +// //宸茬粡闂簡瀵瑰簲鐨勯亶鏁帮紝灏卞垽鏂槸鍚﹁繕鏈変笅涓�棰� +// if (nowQuestion.getTargetid() == ivrLibaTemplateScriptVOs.size()) { +// //娌℃湁涓嬩竴棰樹簡锛屽氨鎸傛柇鐢佃瘽锛屾挱鏀剧粨鏉熻 +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES); +// phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid()); +// } else { +// //鏈変笅涓�棰� +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES); +// IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion); +// // 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙� +// phoneUtils.ttsPlayback(nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); +// } +// } else { +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", noVoice + 1, 120, TimeUnit.MINUTES); +// //璋冪敤ivrLibaTemplateScriptVO涓殑slienceText(闈欓粯璇濇湳) +// String slienceText = nowQuestion.getSlienceText(); +// //闈欓粯璇濇湳 + 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙� +// phoneUtils.ttsPlayback(slienceText + nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); +// return new PhoneCallBackVO(); +// } +// +// } else { +// //鏈夊洖璇濓紝瀵瑰洖绛旂殑闂,杩涜姝e垯鍖归厤锛堣繖閲屽彧閽堝閫夋嫨棰橈紝鍏跺畠棰樺瀷涓嶈锛� +// for (int j = 0; j < nowQuestion.getIvrLibaScriptTargetoptionList().size(); j++) { +// //鍖呭惈 +// Matcher matcher = null; +// if (StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex())) { +// Pattern pattern = Pattern.compile(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()); +// matcher = pattern.matcher(phoneCallBackVO.getTextResult()); +// } +// //涓嶅寘鍚� +// Matcher matcher2 = null; +// if (StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2())) { +// Pattern pattern2 = Pattern.compile(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()); +// matcher2 = pattern2.matcher(phoneCallBackVO.getTextResult()); +// } +// log.info("phoneCallBack--Targetregex鐨勫�间负锛歿}, phoneCallBack--Targetregex2鐨勫�间负锛歿}", nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex(), nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()); +// if (StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) { +// //璇存槑鍖归厤姝g‘浜� +// //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉� +// nowQuestion.getIvrLibaScriptTargetoptionList().get(j).setIsUserOperation(true); +// ivrLibaScriptTargetoptionMapper.updateIvrLibaTemplateTargetoption(nowQuestion.getIvrLibaScriptTargetoptionList().get(j)); +// +// +// //灏嗛潤榛樼疆涓�0 +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES); +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", 0, 120, TimeUnit.MINUTES); +// //鑾峰彇涓嬩竴棰� +// Integer nextQuestion = nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getNextQuestion(); +// for (IvrLibaTemplateScriptVO script : ivrLibaTemplateScriptVOs) { +// if (script.getTargetid() == nextQuestion) { +// QuestionMessage questionMessage = new QuestionMessage(); +// questionMessage.setNowQuestion(script); +// questionMessage.setQuestionList(ivrLibaTemplateScriptVOs); +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); +// break; +// } +// } +// break; +// } else { +// //娌℃湁鍖归厤鍒� +// Integer mateNum = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "mateNum"); +// //鏃犲尮閰嶆鏁板幓鍒ゆ柇鏄惁鍒版渶澶ц闂鏁帮紝骞朵笖鎵�鏈夌殑閫夐」閮藉尮閰嶅畬浜� +// if (mateNum == ivrLibaTemplateVO.getMateNum().intValue() && j == nowQuestion.getIvrLibaScriptTargetoptionList().size() - 1) { +// //濡傛灉涓嬩竴棰樹负绌�.鍒欐柊鐨勬暟鎹繑鍥�,骞跺姞涓婃劅璋㈣ +// if (nowQuestion.getTargetid() < ivrLibaTemplateScriptVOs.size()) { +// QuestionMessage questionMessage = new QuestionMessage(); +// IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion); +// questionMessage.setQuestionList(ivrLibaTemplateScriptVOs); +// questionMessage.setNowQuestion(nextQuestion); +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", 0, 120, TimeUnit.MINUTES); +// } else { +// //灏卞彲浠ユ寕鏂數璇濅簡 +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES); +// phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid()); +// break; +// } +// } else if (mateNum < ivrLibaTemplateVO.getMateNum().intValue() && j == nowQuestion.getIvrLibaScriptTargetoptionList().size() - 1) { +// //娌℃湁闂埌瑙勫畾娆℃暟 +// mateNum = mateNum + 1; +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", mateNum, 120, TimeUnit.MINUTES); +// } +// } +// +// } +// //閫夐」鍖归厤瀹屾垚鍚庯紝闇�瑕佸啀鍘婚�氳繃搴撳啀杩涜鍖归厤涓�娆� +// String extemplateID = ivrLibaTemplateVO.getSubmoduleID(); +// String[] split = extemplateID.split(","); +// List<String> list = Arrays.asList(split); +// List<Long> list1 = new ArrayList<>(); +// if (StringUtils.isNotEmpty(extemplateID)) { +// for (String str : list) { +// list1.add(Long.valueOf(str)); +// } +// List<IvrLibaExtemplatescript> ivrLibaExtemplatescripts = ivrLibaExtemplatescriptMapper.queryIvrLibaExtemplatescriptList(list1); +// for (IvrLibaExtemplatescript ivrLibaExtemplatescript : ivrLibaExtemplatescripts) { +// Matcher matcher = null; +// if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex())) { +// Pattern pattern = Pattern.compile(ivrLibaExtemplatescript.getSelfRegex()); +// matcher = pattern.matcher(returnQues.getContent()); +// } +// +// Matcher matcher2 = null; +// if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2())) { +// Pattern pattern2 = Pattern.compile(ivrLibaExtemplatescript.getSelfRegex2()); +// matcher2 = pattern2.matcher(returnQues.getContent()); +// } +// log.info("++++++++++++++++++++++++++閫氱敤搴撴槸鍚︿负绌猴細selfRegex : {} , selfRegex2 : {}", ivrLibaExtemplatescript.getSelfRegex(), ivrLibaExtemplatescript.getSelfRegex2()); +// if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex()) && matcher.matches() && StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2()) && matcher2.matches() || StringUtils.isEmpty(ivrLibaExtemplatescript.getSelfRegex()) && StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2()) && matcher2.matches() || StringUtils.isEmpty(ivrLibaExtemplatescript.getSelfRegex2()) && StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex()) && matcher.matches()) { +// QuestionMessage questionMessage = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "returnQues"); +// IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO = returnQues.getNowQuestion(); +// ivrLibaTemplateScriptVO.setSubmoduleText(ivrLibaExtemplatescript.getSwitchText()); +// ivrLibaTemplateScriptVO.setSubmoduleVoice(ivrLibaExtemplatescript.getSwitchWav()); +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); +// if (ivrLibaExtemplatescript.getIsEnd() == 1) { +// //灏嗛棶棰樼疆绌� +// IvrLibaTemplateScriptVO nowQuestion1 = questionMessage.getNowQuestion(); +// nowQuestion1.setQuestionText(null); +// nowQuestion1.setQuestionVoice(null); +// questionMessage.setNowQuestion(nowQuestion1); +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); +// +// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "isOver", 1, 120, TimeUnit.MINUTES); +// } +// +// //璋冪敤鈥�15銆乼ts鍚堟垚鍜屾挱鏀撅紝 tts_playback鈥濆皢缁撴灉浼犲洖 +// +// +// } +// break; +// } +// } +// +// } +// } +// return phoneCallBackVO; +// } + private IvrLibaTemplateScriptVO getNextQuestion(List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList, IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO) { for (int j = 0; j < ivrLibaTemplateScriptVOList.size(); j++) { -- Gitblit v1.9.3