package com.project.zcustom.controller.service;

import com.project.zcustom.controller.core.AjaxResult;
import com.project.zcustom.controller.core.BaseController;
import com.project.zcustom.domain.basics.PlatBasics;
import com.project.zcustom.domain.video.ZhhqLargeScreenUnit;
import com.project.zcustom.service.basics.IPlatAppOrgService;
import com.project.zcustom.service.basics.IPlatBasicsCompanyService;
import com.project.zcustom.service.basics.IPlatBasicsServerService;
import com.project.zcustom.service.basics.IPlatBasicsService;
import com.project.zcustom.service.video.IZhhqLargeScreenUnitService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 基础运行数据Controller
 *
 * @author change
 * @date 2024-10-21
 */
@RestController
@RequestMapping("/large/basics")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class PlatBasicsController extends BaseController {

    private final IPlatBasicsService platBasicsService;
    private final IPlatBasicsCompanyService platBasicsCompanyService;
    private final IPlatBasicsServerService platBasicsServerService;
    private final IPlatAppOrgService iPlatAppOrgService;
    private final IZhhqLargeScreenUnitService iZhhqLargeScreenUnitService;


    @RequestMapping("/getOverviewData")
    public AjaxResult getOverviewData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", platBasicsService.getOverviewData(appOrg));
    }

    @RequestMapping("/getTopTenCompany")
    public AjaxResult getTopTenCompany(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", platBasicsCompanyService.getTopTenCompany(appOrg));
    }

//    @ApiOperation("系统运行报警信息")
//    @RequestMapping("/getSystemRunErrData/{appOrg}")
//    public AjaxResult getSystemRunErrData(@PathVariable String appOrg) {
//        return AjaxResult.success("查询成功", platBasicsService.getSystemRunErrData(appOrg));
//    }
//
//    @ApiOperation("系统运行峰值情况分析")
//    @RequestMapping("/getSystemRunData/{appOrg}")
//    public AjaxResult getSystemRunData(@PathVariable String appOrg) {
//        return AjaxResult.success("查询成功", platBasicsSystemService.getSystemRunData(appOrg));
//    }

    @RequestMapping("/getServerListData")
    public AjaxResult getServerListData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", platBasicsServerService.selectServerListByAppOrg(appOrg));
    }


    @GetMapping("/testAdd")
    public AjaxResult testAdd() {
        PlatBasics platBasics = new PlatBasics();
        platBasics.setAppOrg("11111");
        return AjaxResult.success("新增成功", platBasicsService.save(platBasics));
    }

    @GetMapping("/testUnit")
    public AjaxResult testUnit() {
        ZhhqLargeScreenUnit znhqLargeScreenUnit = new ZhhqLargeScreenUnit();
        znhqLargeScreenUnit.setAppOrg("11111");
        znhqLargeScreenUnit.setName("测试");
        return AjaxResult.success("新增成功", iZhhqLargeScreenUnitService.save(znhqLargeScreenUnit));
    }

}
