package com.fs.aiob.controller;

import com.alibaba.fastjson.JSON;
import com.fs.aicall.utils.AiobApiUtils;
import com.fs.aicall.vo.*;
import com.fs.aiob.domain.AiobBaiduTask;
import com.fs.aiob.service.IAiobBaiduTaskService;
import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.domain.R;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.PubFun;
import com.fs.common.utils.poi.ExcelUtil;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 百度AI外呼任务Controller
 * 
 * @author fs
 * @date 2025-03-20
 */
@RestController
@RequestMapping("/aiob/back")
@AllArgsConstructor
public class AiobBackController extends BaseController {

    private final IAiobBaiduTaskService aiobBaiduTaskService;

    @PostMapping
    public void back(@RequestBody AiobBackVo vo){
        if(vo.getCallbackType() != null){
            if(vo.getCallbackType() == 0){
                aiobBaiduTaskService.back(JSON.parseObject(vo.getData(), AiobCalleData.class));
            }
            if(vo.getCallbackType() == 2){
                aiobBaiduTaskService.updateStatus(JSON.parseObject(vo.getData(), AiobTaskData.class));
            }
        }
    }

}
