|
@@ -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;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|