package com.dsk.monitor.controlelr;

import com.dsk.common.core.domain.R;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.monitor.domain.vo.*;
import com.dsk.monitor.service.MonitorService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @ClassName MonitorController
 * @Description 监控企业相关
 * @Author Dgm
 * @Date 2023/12/8 10:19
 * @Version 1.0.0
 */
@RestController
@RequestMapping("/monitor")
public class MonitorController {

    @Resource
    private MonitorService monitorService;

    /***
     *@Description: 同步推送数据入库
     *@Param:
     *@return: com.dsk.common.core.domain.R
     *@Author: Dgm
     *@date: 2023/12/9 9:29
     */
    @PostMapping(value = "push/insert")
    public R insert(@RequestBody PushMonitorInfoVo pushMonitorInfoVo) {
        return monitorService.insert(pushMonitorInfoVo);
    }

    /***
     *@Description: 监控维度下拉选择
     *@Param:
     *@return: com.dsk.common.core.domain.R
     *@Author: Dgm
     *@date: 2023/12/9 9:29
     */
    @GetMapping(value = "push/rulesSelect")
    public R rulesSelect(PushMonitorRulesSelectVo selectVo) {
        return monitorService.rulesSelect(selectVo);
    }

    /***
     *@Description: 新增修改我的规则
     *@Param:
     *@return: com.dsk.common.core.domain.R
     *@Author: Dgm
     *@date: 2023/12/9 9:29
     */
    @PostMapping(value = "push/rules/insertOrUpdate")
    public R insertRules(@RequestBody PushMonitorRulesVo rulesVo) {
        return monitorService.insertRules(rulesVo);
    }

    /***
     *@Description: 我的推送规则
     *@Param:
     *@return: com.dsk.common.core.domain.R
     *@Author: Dgm
     *@date: 2023/12/9 9:29
     */
    @PostMapping(value = "push/rulesDetail")
    public R rulesDetail(@RequestBody PushMonitorRulesDetailVo detailVo) {
        return monitorService.rulesDetail(detailVo);
    }

    /***
     *@Description: 监控动态/监控报告详情 分页
     *@Param:
     *@return: com.dsk.common.core.domain.R
     *@Author: Dgm
     *@date: 2023/12/9 9:29
     */
    @PostMapping(value = "company/dynamicPage")
    public TableDataInfo companyDynamicPage(@RequestBody PushMonitorDynamicPageVo pageVo) throws Exception{
        return monitorService.companyDynamicPage(pageVo);
    }

    /***
     *@Description: 监控报告 分页
     *@Param:
     *@return: com.dsk.common.core.domain.R
     *@Author: Dgm
     *@date: 2023/12/9 9:29
     */
    @PostMapping(value = "reportPage")
    public TableDataInfo reportPage(@RequestBody PushMonitorReportPageVo pageVo) throws Exception{
        return monitorService.reportPage(pageVo);
    }

    /***
     *@Description: 企业监控列表 分页
     *@Param:
     *@return: com.dsk.common.core.domain.R
     *@Author: Dgm
     *@date: 2023/12/9 9:29
     */
    @PostMapping(value = "system/companyPage")
    public TableDataInfo companyPage(@RequestBody PushMonitorCompanyPageVo pageVo) throws Exception{
        return monitorService.companyPage(pageVo);
    }

    /***
     *@Description: 添加企业监控列表 分页
     *@Param:
     *@return: com.dsk.common.core.domain.R
     *@Author: Dgm
     *@date: 2023/12/9 9:29
     */
    @PostMapping(value = "system/queryMonitorCompany")
    public TableDataInfo queryMonitorCompany(@RequestBody MonitorQueryMonitorCompanyPageVo pageVo) throws Exception{
        return monitorService.queryMonitorCompany(pageVo);
    }

    /***
     *@Description: 添加监控
     *@Param:
     *@return: com.dsk.common.core.domain.R
     *@Author: Dgm
     *@date: 2023/12/9 9:29
     */
    @PostMapping(value = "system/add")
    public R systemAdd(@RequestBody PushMonitorCompanyAddVo addVo) {
        return monitorService.systemAdd(addVo);
    }

    /***
     *@Description: 取消监控
     *@Param:
     *@return: com.dsk.common.core.domain.R
     *@Author: Dgm
     *@date: 2023/12/9 9:29
     */
    @PostMapping(value = "system/cancel")
    public R systemCancel(@RequestBody PushMonitorCompanyCancelVo cancelVo) throws Exception{
        return monitorService.systemCancel(cancelVo);
    }

    /***
     *@Description: 批量导入
     *@Param:
     *@return: java.lang.String
     *@Author: Dgm
     *@date: 2022/6/14 10:45
     */
    @RequestMapping("/system/import")
    public R systemImport(@RequestParam MultipartFile file, PushMonitorCompanyImportAddVo importAddVo) throws Exception{
        return monitorService.systemImport(file, importAddVo);
    }

    /***
     *@Description: 详情
     *@Param:
     *@return: java.lang.String
     *@Author: Dgm
     *@date: 2022/6/14 10:45
     */
    @RequestMapping("/system/detail")
    public R systemDetail(@RequestBody PushMonitorSystemDetailVo detailVo){
        return monitorService.systemDetail(detailVo);
    }

}
