|
@@ -37,27 +37,54 @@ public class VoiceCallbackController {
|
|
|
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();
|
|
|
+ if(voiceCallbackParams != null) {
|
|
|
+ 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,null);
|
|
|
+
|
|
|
+ Map<String, Object> rtn = new HashMap<>();
|
|
|
+ rtn.put("result", 0);
|
|
|
+ rtn.put("errmsg", "OK");
|
|
|
+ return rtn;
|
|
|
+ } else {
|
|
|
+ voiceCallbackParams = (Map) voicepromptCallback.get("voice_failure_callback");
|
|
|
+ if(voiceCallbackParams != null){
|
|
|
+ String callId = (String) voiceCallbackParams.get("callid");
|
|
|
+ System.out.println("callback:failure callId==" + callId);
|
|
|
+ String orderId = (String) redisUtil.hget(RedisKeyConstant.VOICE_CALLBACK_INFO, callId);
|
|
|
+ System.out.println("callback:failure orderId==" + orderId);
|
|
|
+ String mobile = (String) voiceCallbackParams.get("mobile");
|
|
|
+ System.out.println("callback:failure mobile==" + mobile);
|
|
|
+ String failureReason = (String) voiceCallbackParams.get("failure_reason");
|
|
|
+ System.out.println("callback:failure failureReason==" + failureReason);
|
|
|
+
|
|
|
+ Integer status = ContactorStatusEnum.WEI_JIE_TONG.getValue();
|
|
|
+
|
|
|
+ bmsEventOrderService.updateOrderContactStatus4Callback(Long.parseLong(orderId), mobile, status,failureReason);
|
|
|
+
|
|
|
+ Map<String, Object> rtn = new HashMap<>();
|
|
|
+ rtn.put("result", 0);
|
|
|
+ rtn.put("errmsg", "OK");
|
|
|
+ return rtn;
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- bmsEventOrderService.updateOrderContactStatus4Callback(Long.parseLong(orderId), mobile, status);
|
|
|
|
|
|
- Map<String, Object> rtn = new HashMap<>();
|
|
|
- rtn.put("result", 0);
|
|
|
- rtn.put("errmsg", "OK");
|
|
|
- return rtn;
|
|
|
} catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return null;
|