package com.citygis.web.controller;

import com.citygis.common.annotation.Log;
import com.citygis.common.core.controller.BaseController;
import com.citygis.common.core.domain.AjaxResult;
import com.citygis.common.core.page.TableDataInfo;
import com.citygis.common.enums.BusinessType;
import com.citygis.web.domain.*;
import com.citygis.web.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: zyl
 * @CreateTime: 2025-01-14
 * @Description: 链路监控
 * @Version: 1.0
 */
@Api(tags = "链路监控")
@RestController
@RequestMapping("/web/link")
public class LinkController extends BaseController {

    @Resource
    ITabLog2Service tabLog2Service;

    @Resource
    ITabKafkalogService tabKafkalogService;

    @Resource
    ITabDatalogService tabDatalogService;

    @Resource
    ITabSystemSpaceService tabSystemSpaceService;

    @Resource
    ITabIpResultService tabIpResultService;

    @Log(title = "链路监控", businessType = BusinessType.SELECT)
    @ApiOperation("接口监听")
    @GetMapping("getTabLog2List")
    public TableDataInfo getTabLog2List(TabLog2 tabLog2) {
        startPage();
        return getDataTable(tabLog2Service.getTabLog2List(tabLog2));
    }

    @Log(title = "链路监控", businessType = BusinessType.SELECT)
    @ApiOperation("接口监听详情")
    @GetMapping("getTabLog2DetailListByUrl")
    public AjaxResult getTabLog2DetailListByUrl(TabLog2 tabLog2) {
        return tabLog2Service.getTabLog2DetailListByUrl(tabLog2);
    }

    @Log(title = "链路监控", businessType = BusinessType.SELECT)
    @ApiOperation("kafka监听")
    @GetMapping("getKafkaLogList")
    public TableDataInfo getKafkaLogList(TabKafkalog tabKafkalog) {
        startPage();
        return getDataTable(tabKafkalogService.getKafkaLogList(tabKafkalog));
    }

    @Log(title = "链路监控", businessType = BusinessType.SELECT)
    @ApiOperation("作业监控")
    @GetMapping("getDataLogList")
    public TableDataInfo getDataLogList(TabDatalog tabDatalog) {
        startPage();
        return getDataTable(tabDatalogService.getDataLogList(tabDatalog));
    }

    @Log(title = "链路监控", businessType = BusinessType.SELECT)
    @ApiOperation("作业监控详情")
    @GetMapping("getDatalogDetailByTableEnglishNamee")
    public AjaxResult getDatalogDetailByTableEnglishName(TabDatalog tabDatalog) {
        return tabDatalogService.getDatalogDetailByTableEnglishName(tabDatalog);
    }

    @Log(title = "链路监控", businessType = BusinessType.SELECT)
    @ApiOperation("库存容量监控")
    @GetMapping("getSpace")
    public TableDataInfo getSpace(TabSystemSpace tabSystemSpace) {
        startPage();
        return getDataTable(tabSystemSpaceService.getSpace(tabSystemSpace));
    }

    @Log(title = "链路监控", businessType = BusinessType.SELECT)
    @ApiOperation("库存容量监控详情")
    @GetMapping("getSpaceDetailByFilepath")
    public AjaxResult getSpaceDetailByFilepath(TabSystemSpace tabSystemSpace) {
        return tabSystemSpaceService.getSpaceDetailByFilepath(tabSystemSpace);
    }

    @Log(title = "心跳监测", businessType = BusinessType.SELECT)
    @ApiOperation("心跳监测")
    @GetMapping("/getTabIpResultList")
    public TableDataInfo getTabIpResultList(TabIpResult tabIpResult) {
        startPage();
        return getDataTable(tabIpResultService.getTabIpResultList(tabIpResult));
    }

    @Log(title = "心跳监测", businessType = BusinessType.SELECT)
    @ApiOperation("心跳监测详情")
    @GetMapping("/getTabIpResultDetailByIpAndPort")
    public AjaxResult getTabIpResultDetailByIpAndPort(TabIpResult tabIpResult) {
        return tabIpResultService.getTabIpResultDetailByIpAndPort(tabIpResult);
    }
}
