From e44f3f7b666394907a016488e79f788e7ed97a70 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 27 十一月 2024 19:23:37 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index 9294e4f..2b81cc2 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -749,6 +749,9 @@
                 req.put("caller", phoneCallReqYQVO.getPhone());
                 HttpUtil.postJsonRequest(hangup, new Gson().toJson(req));
                 redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- hangup", "1", 2, TimeUnit.MINUTES);
+                //鍏堟妸榛樿鐨剅ecordAccept-hungup鍒犻櫎锛屽啀鏇存柊
+                redisCache.deleteObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup");
+                redisCache.setCacheObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup", "1", 10, TimeUnit.MINUTES);
                 //杩欎釜鏃跺�欏氨闇�瑕佽蛋琛ュ伩鏈哄埗浜嗭紝鍏堟殏瀹氳蛋鐭俊
                 getSmsCompensate(Long.valueOf(phoneCallReqYQVO.getTaskid()));
                 return new PhoneCallBackYQVO();
@@ -781,7 +784,6 @@
                     HttpUtil.postJsonRequest(hangup, new Gson().toJson(req));
                     //鍒犻櫎缁撴潫璇殑鎮e瓨
                     redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "- jsy");
-                    redisCache.setCacheObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup", "2", 10, TimeUnit.MINUTES);
                 } else {
                     redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop", true, 120, TimeUnit.MINUTES);
                     log.error("-------PlayEventCallbackPlaystop鐨勫�间负锛歿}", true);
@@ -870,7 +872,9 @@
             }
             return phoneCallBackYQVO;
         } else if ("AsrCallback".equals(phoneCallReqYQVO.getOperate()) && phoneCallReqYQVO.getEnd_time() != null && phoneCallReqYQVO.getEnd_time() != -1) {
-
+            //鍋氫竴涓爣璇嗭紝鐢ㄦ潵鍦ㄩ�氳瘽璇︽儏鎺ュ彛閲岋紝鍒ゆ柇鏄惁鏈変汉鎺ョ數璇濓紙value=2,琛ㄧず鏈変汉鎺ワ級
+            redisCache.deleteObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup");
+            redisCache.setCacheObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup", "2", 10, TimeUnit.MINUTES);
             // 鍏堝閫氳瘽杩涜閫氱敤搴撳尮閰嶄竴娆�
             String extemplateID = ivrTaskTemplate.getSubmoduleID();
             if (StringUtils.isNotEmpty(extemplateID)) {
@@ -1700,8 +1704,12 @@
 
     @Override
     public Integer recordAccept(PhoneCallRecordVO phoneCallRecordVO) {
-        Object cacheObject = redisCache.getCacheObject("recordAccept-hungup");
-        if (ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("2")) {
+        Object cacheObject = redisCache.getCacheObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup");
+        if (phoneCallRecordVO.getHangup_cause().equals("NO_USER_RESPONSE") || ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("1")) {
+            //鏃犱汉鎺ュ惉
+            getSmsCompensate(Long.valueOf(phoneCallRecordVO.getTaskid()));
+            redisCache.deleteObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup");
+        } else if (ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("2")) {
 //        if (phoneCallRecordVO.getAnswered() != null && phoneCallRecordVO.getAnswered() == true) {
             log.error("鏈変汉鎺ョ數璇濅簡锛屽苟涓斿畬浜�");
             //璇存槑鏈変汉鎺ヤ簡
@@ -1710,11 +1718,21 @@
             String result = phoneCallRecordVO.getRecord_path().substring(startIndex, endIndex);
             //涓嬭浇鏂囦欢
             ftpService.downloadFolder("/" + LocalDate.now().toString(), profile + "/upload/vadio/voice/" + LocalDate.now().toString());
-        } else if (phoneCallRecordVO.getHangup_cause().equals("NO_USER_RESPONSE") || ObjectUtils.isNotEmpty(cacheObject) && !String.valueOf(cacheObject).equals("2")) {
-            //鏃犱汉鎺ュ惉
-            getSmsCompensate(Long.valueOf(phoneCallRecordVO.getTaskid()));
+            redisCache.deleteObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup");
+        } else {
+            //鎮h�呮嫆缁濋殢璁�
+            ServiceSubtask serviceSubtask = new ServiceSubtask();
+            serviceSubtask.setRemark("鐢佃瘽鎺ラ�氭垚鍔燂紝鎮h�呮嫆缁濋殢璁�");
+            serviceSubtask.setId(Long.valueOf(phoneCallRecordVO.getTaskid()));
+            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+            int startIndex = phoneCallRecordVO.getRecord_path().indexOf("voice") + "voice".length() + 1;  // 鍔�1鏄烦杩�/绗﹀彿
+            int endIndex = phoneCallRecordVO.getRecord_path().lastIndexOf("/");
+            String result = phoneCallRecordVO.getRecord_path().substring(startIndex, endIndex);
+            //涓嬭浇鏂囦欢
+            ftpService.downloadFolder("/" + LocalDate.now().toString(), profile + "/upload/vadio/voice/" + LocalDate.now().toString());
+            redisCache.deleteObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup");
         }
-        redisCache.deleteObject("recordAccept-hungup");
+
         return 1;
     }
 
@@ -1829,8 +1847,7 @@
         map.put("content", sendMagParam.getContent());
         String result = HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(map));
         redisCache.setCacheObject(subTaskId + "recordAccept-hungup", "1", 10, TimeUnit.MINUTES);
-        if (StringUtils.isNotEmpty(serviceSubtask.getRemark()))
-            serviceSubtask.setRemark("鐢佃瘽鍙戦�佹嫆鎺�,鐭俊琛ュ伩鍙戦�佹垚鍔�");
+        if (StringUtils.isNotEmpty(serviceSubtask.getRemark())) serviceSubtask.setRemark("鐢佃瘽鍙戦�佹嫆鎺�,鐭俊琛ュ伩鍙戦�佹垚鍔�");
         else serviceSubtask.setRemark("鐭俊琛ュ伩鍙戦�佹垚鍔�");
         serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
     }

--
Gitblit v1.9.3