package com.yida.data.school.screen.controller;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.school.dto.screen.SchoolDashboardSaveDTO;
import com.yida.data.school.screen.service.EduSchoolDashboardDataService;
import com.yida.data.school.vo.screen.SchoolDashboardInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
 * 校园大数据仪表盘数据中心Controller
 *
 * @author ZYJ
 * @date 2023-04-19 16:42:57
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@Api(tags = "校园大数据仪表盘api")
@RequestMapping("eduSchoolDashboardData")
public class EduSchoolDashboardDataController {

    private final EduSchoolDashboardDataService eduSchoolDashboardDataService;

    @GetMapping(value = "getSchoolDashboardInfo")
    @ApiOperation(value = "获取校园大数据详细信息", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResultBean<SchoolDashboardInfoVO> getSchoolDashboardInfo() {
        return ResultBean.buildSuccess(eduSchoolDashboardDataService.getSchoolDashboardInfo(FebsUtil.getDeptId()));
    }

    @PostMapping(value = "/saveSchoolDashboard", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "保存校园大数据", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResultBean<String> saveSchoolDashboard(@RequestBody SchoolDashboardSaveDTO dto) {
        eduSchoolDashboardDataService.saveSchoolDashboard(dto);
        return ResultBean.buildSuccess();
    }
}
