From 01a79d5b431b71cc79cf5f6cc92cd4f3432781dd Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 30 四月 2024 12:39:54 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java |  586 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 387 insertions(+), 199 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 fff13e3..9ab3ad8 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java
@@ -326,30 +326,24 @@
     }
 
     @Override
-    public PhoneCallBackVO phoneCallBack(PhoneCallBackVO phoneCallBackVO) {
-        log.info("phoneCallBackVO鐨勫叆鍙傦細{},{},{},{},{},{},{}", phoneCallBackVO.getResultType(), phoneCallBackVO.getUuid(), phoneCallBackVO.getErrResult(), phoneCallBackVO.getTextResult(), phoneCallBackVO.getHangUpResult(), phoneCallBackVO.getEnumState(), phoneCallBackVO.getUint8());
+    public void phoneCallBack(PhoneCallBackVO phoneCallBackVO) {phoneCallBackVO.setTextResult(phoneCallBackVO.getTextResult().substring(0, phoneCallBackVO.getTextResult().length() - 1));
+
         //鑾峰彇鏁版嵁
         Boolean aBoolean = redisCache.hasKey(phoneCallBackVO.getUuid());
         if (!aBoolean) {
-            new BaseException("璇uid涓嶅瓨鍦�");
+            throw new BaseException("璇uid涓嶅瓨鍦�");
         }
         Integer hangupValue = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "hangup");
+        PhoneUtils phoneUtils = new PhoneUtils();
         if (hangupValue != null && hangupValue == 1) {
+            log.info("鐢佃瘽瑕佹寕鏂簡");
             //hangupValue == 1  闅忚缁撴潫锛岀洿鎺ュ彲浠ユ寕鐢佃瘽
-            PhoneUtils phoneUtils = new PhoneUtils();
-            phoneUtils.hangup(phoneCallBackVO.getUuid(), null, null, null, null, null, null, null);
-
+            phoneUtils.hangup(null, null, null, null, null, null, null, phoneCallBackVO.getUuid());
+            log.info("鐢佃瘽鎸傛柇----------------------------");
+            return;
         }
 
-        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();
-        }
-
+        Map<String, Object> map = redisCache.getCacheObject(phoneCallBackVO.getUuid());
         IvrTaskSingle ivrTaskcall = (IvrTaskSingle) map.get("ivrTaskcall");
         List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOs = (List<IvrLibaTemplateScriptVO>) map.get("ivrLibaTemplateScriptVO");
         //灏唘uid鏇存柊鍒版暟鎹簱涓�
@@ -359,206 +353,400 @@
         //鑾峰彇妯℃澘淇℃伅
         IvrLibaTemplateVO ivrLibaTemplateVO = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "ivrLibaTemplateVO");
 
+        //璇煶璇嗗埆缁撴灉涓婃姤鎺ュ彛: 3
+        Integer noVoice = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "noVoice");
+        QuestionMessage returnQues = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "returnQues");
+        //灏嗕紶鍥炵殑缁撴灉鏀惧埌鍥炲瀵硅薄涓�
+        returnQues.setContent(phoneCallBackVO.getTextResult());
 
-        //棣栧厛鍒ゆ柇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);
+        IvrLibaTemplateScriptVO nowQuestion = returnQues.getNowQuestion();
+
+        if (StringUtils.isEmpty(returnQues.getContent())) {
+            //鏃犲洖璇�
+            //鍒ゆ柇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());
+                    return;
                 } else {
-                    redisCache.setCacheObject(phoneCallBackVO.getUuid() + "uint8", 1, 120, TimeUnit.MINUTES);
+                    //鏈変笅涓�棰�
+                    redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES);
+                    IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion);
+                    // 闂锛�  鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙�
+                    phoneUtils.ttsPlayback(nowQuestion.getQuestionText(), phoneCallBackVO.getUuid());
                 }
-
-                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));
+                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;
+            }
 
-
-                        //灏嗛潤榛樼疆涓�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);
-                        }
-                    }
-
+        } 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());
                 }
-                //閫夐」鍖归厤瀹屾垚鍚庯紝闇�瑕佸啀鍘婚�氳繃搴撳啀杩涜鍖归厤涓�娆�
-                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(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));
 
-                        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());
+                    //灏嗛潤榛樼疆涓�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);
-                            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鈥濆皢缁撴灉浼犲洖
-
-
+                            phoneUtils.ttsPlayback(script.getQuestionText(), phoneCallBackVO.getUuid());
+                            return;
+                        } else if (nextQuestion > ivrLibaTemplateScriptVOs.size()) {
+                            //娌℃湁涓嬩竴棰樹簡锛屽氨缁撴潫浜�
+                            redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES);
+                            phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid());
+                            phoneUtils.hangup(null, null, null, null, null, null, null, phoneCallBackVO.getUuid());
+                            return;
                         }
-                        break;
+                    }
+                    return;
+                } else {
+                    //娌℃湁鍖归厤鍒�
+                    Integer mateNum = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "mateNum");
+                    if (mateNum == null) mateNum = 0;
+                    //鏃犲尮閰嶆鏁板幓鍒ゆ柇鏄惁鍒版渶澶ц闂鏁帮紝骞朵笖鎵�鏈夌殑閫夐」閮藉尮閰嶅畬浜�
+                    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);
+                            phoneUtils.ttsPlayback(nextQuestion.getQuestionText(), phoneCallBackVO.getUuid());
+                            return;
+                        } else {
+                            //灏卞彲浠ユ寕鏂數璇濅簡
+                            redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES);
+                            phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid());
+                            phoneUtils.hangup(null, null, null, null, null, null, null, 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);
+
                     }
                 }
+            }
+            //閫夐」鍖归厤瀹屾垚鍚庯紝闇�瑕佸啀鍘婚�氳繃搴撳啀杩涜鍖归厤涓�娆�
+            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鈥濆皢缁撴灉浼犲洖
+                        phoneUtils.ttsPlayback(nowQuestion.getQuestionText() + ivrLibaTemplateScriptVO.getSubmoduleText(), phoneCallBackVO.getUuid());
+                    }
+                    break;
+                }
+                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