فهرست منبع

Merge branch 'master' of http://124.70.58.209:3000/care/care-server into master

orgycat 3 سال پیش
والد
کامیت
fd2ced74d9

+ 30 - 20
src/main/java/com/care/bms/controller/VoiceCallbackController.java

@@ -1,10 +1,11 @@
 package com.care.bms.controller;
 
-import com.care.bms.params.VoiceCallbackParams;
+
 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;
@@ -32,26 +33,35 @@ public class VoiceCallbackController {
 
     @PostMapping("/voice/callback")
     @ApiOperation(tags = {"语音通知回调接口"},value = "语音通知回调接口")
-    public Map<String,Object> callback(@RequestBody VoiceCallbackParams voiceCallbackParams) {
-        String callid = voiceCallbackParams.getCallid();
-        String orderId = (String) redisUtil.hget(RedisKeyConstant.VOICE_CALLBACK_INFO, callid);
-        String mobile = voiceCallbackParams.getMobile();
-
-        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);
+    public Map<String,Object> callback(@RequestBody Map<String,Object> voicepromptCallback) {
+        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;
+        }
     }
 
 

+ 0 - 38
src/main/java/com/care/bms/params/VoiceCallbackParams.java

@@ -1,38 +0,0 @@
-package com.care.bms.params;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class VoiceCallbackParams {
-
-    @ApiModelProperty("错误码,0表示用户正常接听,1表示用户未接听, 2表示呼叫异常")
-    private String result;
-
-    @ApiModelProperty("用户接听时间")
-    private String accept_time;
-
-    @ApiModelProperty("呼入号码")
-    private String call_from;
-
-    @ApiModelProperty("标识本次发送 ID")
-    private String callid;
-
-    @ApiModelProperty("结束语音通知呼叫时间")
-    private String end_calltime;
-
-    @ApiModelProperty("计费时长,单位为分钟")
-    private String fee;
-
-    @ApiModelProperty("手机号码")
-    private String mobile;
-
-    @ApiModelProperty("国家(或地区)码")
-    private String nationcode;
-
-    @ApiModelProperty("开始发起语音通知呼叫时间")
-    private String start_calltime;
-
-}

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

@@ -634,7 +634,7 @@ public class BmsEventOrderService {
             this.bigScreenService.pushRtEventFlag(dict.getLong("orgId"), dict.getLong("stationId"), dict.getStr("orderId"), "bigscreenRefresh");
         }
         for (Dict dict : pushRecords) {
-            this.bmsEventOrderService.sendSmsToMemberAndLianxiren(dict.getLong("orderId"),"工单完成");
+            //this.bmsEventOrderService.sendSmsToMemberAndLianxiren(dict.getLong("orderId"),"工单完成");
         }
         return true;
     }
@@ -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);

+ 1 - 0
src/main/java/com/care/common/service/impl/VoiceSendServiceImpl.java

@@ -56,6 +56,7 @@ public class VoiceSendServiceImpl implements VoiceSendService {
                 mySendStatus.setCallId(sendStatus.getCallId());
                 mySendStatus.setSessionContext(sendStatus.getSessionContext());
                 //存入redis
+                System.out.println("sendVoiceHappen:callId==" + sendStatus.getCallId());
                 redisUtil.hset(RedisKeyConstant.VOICE_CALLBACK_INFO, sendStatus.getCallId(), sendStatus.getSessionContext(), RedisKeyConstant.VOICE_CALLBACK_INFO_TIME);
                 mySendStatus.setSuccess(true);
             }