package com.ruoyi.phone.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.phone.api.PhoneApi;
import com.ruoyi.phone.domain.PhoneCallBackSHVO;
import com.ruoyi.phone.domain.PhoneCallReqYQVO;
import com.ruoyi.phone.domain.PhoneCallResultYQVO;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 三汇电话流程回调 Controller。
*
*
URL 与模块化前完全一致
* 原实现放在 {@code ruoyi-admin} 的 {@code ServicePhoneController}
* ({@code /smartor/shphone/getFirstQues}、{@code /smartor/shphone/processResust}),
* 归属电话模块后整体搬到这里,路径不变,三汇平台无需改回调地址。
* 剩下那个 {@code /smartor/shphone/addOutboundInstance}(外呼实例配置)依赖 smartor 的
* {@code IServicePhoneService},不属于电话会话链路,仍留在 ruoyi-admin。
*
* @author ls
* @date 2026-08-26
*/
@Slf4j
@Api(description = "三汇电话流程服务")
@RestController
@RequestMapping("/smartor/shphone")
public class ShPhoneController extends BaseController {
@Autowired
private PhoneApi phoneApi;
@ApiOperation("根据电话号码,获取首个问题")
@PostMapping("/getFirstQues")
public Map getFirstQues(@RequestBody PhoneCallReqYQVO phoneCallReqYQVO) {
log.info("根据电话号码,获取首个问题?{}", phoneCallReqYQVO);
PhoneCallBackSHVO phoneCallBackSHVO = phoneApi.getFirstQues(phoneCallReqYQVO);
return success(phoneCallBackSHVO);
}
@ApiOperation("三汇 ASR 结果处理")
@PostMapping("/processResust")
public Map processResust(@RequestBody PhoneCallResultYQVO resultYQVO) {
log.info("三汇 ASR 结果处理 (三汇)?{}", resultYQVO);
PhoneCallBackSHVO phoneCallBackSHVO = phoneApi.processResust(resultYQVO);
return success(phoneCallBackSHVO);
}
}