|
@@ -0,0 +1,59 @@
|
|
|
+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 io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author: lilt
|
|
|
+ * @Date: 2021/5/26
|
|
|
+ * @Desc:
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@Api(value = "VoiceCallbackController", tags = { "语音通知回调接口" })
|
|
|
+@Slf4j
|
|
|
+@RequestMapping("/bms")
|
|
|
+public class VoiceCallbackController {
|
|
|
+ @Resource
|
|
|
+ private RedisUtil redisUtil;
|
|
|
+ @Autowired
|
|
|
+ private BmsEventOrderService bmsEventOrderService;
|
|
|
+
|
|
|
+ @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);
|
|
|
+
|
|
|
+ Map<String,Object> rtn = new HashMap<>();
|
|
|
+ rtn.put("result",0);
|
|
|
+ rtn.put("errmsg","OK");
|
|
|
+ return rtn;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|