package com.ruoyi.screen.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.screen.domain.response.*;
import com.ruoyi.screen.service.ZongzhiScreenSaftyService;
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;
import java.util.List;

/**
 * 太仓综治网络安全大屏接口
 */
@RestController
@RequestMapping("/zongzhi/saftyscreen")
@Api(tags = " 太仓综治网络安全大屏接口")
public class ZongzhiScreenSaftyController {
    @Resource
    private ZongzhiScreenSaftyService zongzhiScreenSaftyService;


    /**
     * 数据来源
     */
    @ApiOperation(value = "数据来源", response = ZongzhiSourceResponse.class)
    @GetMapping("/source")
    private AjaxResult getSource() {

        return AjaxResult.success(zongzhiScreenSaftyService.getSource());
    }


    /**
     * 安全检测数据统计
     */
    @ApiOperation(value = "安全检测数据统计", response = ZongzhiSafetyCountResponse.class)
    @GetMapping("/safety")
    private AjaxResult getSafety() {
        ZongzhiSafetyCountResponse zongzhiSafetyCountResponse = new ZongzhiSafetyCountResponse();
        List<ZongzhiSafetyResponse> getSafetyList = zongzhiScreenSaftyService.getsafety();
        //求和
        int sum = getSafetyList.stream().mapToInt(ZongzhiSafetyResponse::getCount).sum();
        zongzhiSafetyCountResponse.setList(getSafetyList);
        zongzhiSafetyCountResponse.setSum(sum);
        return AjaxResult.success(zongzhiSafetyCountResponse);
    }


    /**
     * 安全检测数据列表
     */
    @ApiOperation(value = "安全检测数据列表", response = ZongzhiSafetyListResponse.class)
    @GetMapping("/safetylist")
    private AjaxResult getSafetyList() {
        return AjaxResult.success(zongzhiScreenSaftyService.getSafetyList());
    }


    /**
     * 安全检测监管对象
     */
    @ApiOperation(value = "安全检测监管对象", response = ZongzhiSuperviseResponse.class)
    @GetMapping("/supervise")
    private AjaxResult getSupervise() {
        return AjaxResult.success(zongzhiScreenSaftyService.getsupervise());
    }




    /**
     * 各地区攻击次数
     */
    @ApiOperation(value = "各地区攻击次数", response = ZongzhiAttackResponse.class)
    @GetMapping("/attack")
    private AjaxResult getAttack() {
        return AjaxResult.success(zongzhiScreenSaftyService.getAttack());
    }


    /**
     * 受攻击情况Top5及分布情况
     */
    @ApiOperation(value = "受攻击情况Top5及分布情况", response = ZongzhiUnAttackResponse.class)
    @GetMapping("/unattack")
    private AjaxResult getUnAttackTop() {
        return AjaxResult.success(zongzhiScreenSaftyService.getUnAttackTop());
    }



    /**
     * 安全隐患
     */
    @ApiOperation(value = "安全隐患", response = ZongzhiSafetyHazardResponse.class)
    @GetMapping("/safetyhazard")
    private AjaxResult getSafetyHazard() {
        return AjaxResult.success(zongzhiScreenSaftyService.getSafetyHazard());
    }



    /**
     * 隐患处置最新隐患
     */
    @ApiOperation(value = "隐患处置最新隐患", response = ZongzhiHazardDisposalResponse.class)
    @GetMapping("/hazarddisposal")
    private AjaxResult getHazardDisposal() {
        return AjaxResult.success(zongzhiScreenSaftyService.getHazardDisposal());
    }


    /**
     * 隐患处置通报处置
     */
    @ApiOperation(value = "隐患处置通报处置", response = ZongzhiNotificationResponse.class)
    @GetMapping("/notification ")
    private AjaxResult getNotification() {
        return AjaxResult.success(zongzhiScreenSaftyService.getNotification());
    }



    /**
     * 通报统计属地通报
     */
    @ApiOperation(value = "通报统计属地通报", response = ZongzhiTbAreaResponse.class)
    @GetMapping("/tbarea")
    private AjaxResult getTbArea() {
        return AjaxResult.success(zongzhiScreenSaftyService.getTbArea());
    }

    /**
     * 通报统计部门通报
     */
    @ApiOperation(value = "通报统计部门通报", response = ZongzhiTbDeptResponse.class)
    @GetMapping("/tbdept")
    private AjaxResult getTbDept() {
        return AjaxResult.success(zongzhiScreenSaftyService.getTbDept());
    }




    /**
     * 通报完成情况
     */
    @ApiOperation(value = "通报完成情况", response = ZongzhiTbDeptCompleteResponse.class)
    @GetMapping("/tbcomplete")
    private AjaxResult getTbCompletet() {
        return AjaxResult.success(zongzhiScreenSaftyService.getTbDeptComplet());
    }
}
