瀏覽代碼

修改语音通知bug

suntianwu 3 年之前
父節點
當前提交
078088a1d4

+ 28 - 21
src/main/java/com/care/bms/controller/VoiceCallbackController.java

@@ -5,6 +5,7 @@ import com.care.bms.service.BmsEventOrderService;
 import com.care.common.cache.RedisKeyConstant;
 import com.care.common.cache.RedisUtil;
 import com.care.common.enums.ContactorStatusEnum;
+import com.care.common.util.JsonUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -33,28 +34,34 @@ public class VoiceCallbackController {
     @PostMapping("/voice/callback")
     @ApiOperation(tags = {"语音通知回调接口"},value = "语音通知回调接口")
     public Map<String,Object> callback(@RequestBody Map<String,Object> voicepromptCallback) {
-        VoiceCallbackParams voiceCallbackParams = (VoiceCallbackParams)voicepromptCallback.get("voiceprompt_callback");
-        String callId = voiceCallbackParams.getCallid();
-        System.out.println("callback:callId==" + callId);
-        String orderId = (String) redisUtil.hget(RedisKeyConstant.VOICE_CALLBACK_INFO, callId);
-        System.out.println("callback:orderId==" + orderId);
-        String mobile = voiceCallbackParams.getMobile();
-        System.out.println("callback:mobile==" + mobile);
-        Integer status = null;
-        String result = voiceCallbackParams.getResult();
-        if("0".equals(result)) { //用户正常接听
-            status = ContactorStatusEnum.YI_LIAN_XI.getValue();
-        } else if("1".equals(result)){ //用户未接听
-            status = ContactorStatusEnum.WEI_JIE_TONG.getValue();
-        } else { //呼叫异常
-            status = ContactorStatusEnum.WEI_JIE_TONG.getValue();
-        }
-        bmsEventOrderService.updateOrderContactStatus4Callback(Long.parseLong(orderId),mobile,status);
+        try {
+            System.out.println("callback json == " + JsonUtil.toJson(voicepromptCallback));
+            Map voiceCallbackParams = (Map) voicepromptCallback.get("voiceprompt_callback");
+            String callId = (String) voiceCallbackParams.get("callid");
+            System.out.println("callback:callId==" + callId);
+            String orderId = (String) redisUtil.hget(RedisKeyConstant.VOICE_CALLBACK_INFO, callId);
+            System.out.println("callback:orderId==" + orderId);
+            String mobile = (String) voiceCallbackParams.get("mobile");
+            System.out.println("callback:mobile==" + mobile);
+            Integer status = null;
+            String result = (String) voiceCallbackParams.get("result");
+            if ("0".equals(result)) { //用户正常接听
+                status = ContactorStatusEnum.YI_LIAN_XI.getValue();
+            } else if ("1".equals(result)) { //用户未接听
+                status = ContactorStatusEnum.WEI_JIE_TONG.getValue();
+            } else { //呼叫异常
+                status = ContactorStatusEnum.WEI_JIE_TONG.getValue();
+            }
+            bmsEventOrderService.updateOrderContactStatus4Callback(Long.parseLong(orderId), mobile, status);
 
-        Map<String,Object> rtn = new HashMap<>();
-        rtn.put("result",0);
-        rtn.put("errmsg","OK");
-        return rtn;
+            Map<String, Object> rtn = new HashMap<>();
+            rtn.put("result", 0);
+            rtn.put("errmsg", "OK");
+            return rtn;
+        } catch (Exception e){
+            e.printStackTrace();
+            return null;
+        }
     }
 
 

+ 1 - 1
src/main/java/com/care/bms/service/BmsEventOrderService.java

@@ -742,7 +742,7 @@ public class BmsEventOrderService {
                 .eq(CareEventOrderHandleHis::getLogType,LogTypeEnum.VOTICE.getValue())
                 .eq(CareEventOrderHandleHis::getLogObjectId,contact.getContactId())
                 .eq(CareEventOrderHandleHis::getLogResult,"语音通知")
-                .set(CareEventOrderHandleHis::getLogResult, String.valueOf(status));
+                .set(CareEventOrderHandleHis::getLogResult, ContactorStatusEnum.getCodeToName(status));
         this.careEventOrderHandleHisService.update(updateWrapper2);
 
         return this.careEventOrderContactStatusService.update(updateWrapper);