package com.lutao.cloud.oil.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.lutao.cloud.common.core.util.MessageInfo;
import com.lutao.cloud.common.security.annotation.Inner;
import com.lutao.cloud.oil.pojo.param.BaseParam;
import com.lutao.cloud.oil.pojo.param.ProblemCheckPieParam;
import com.lutao.cloud.oil.pojo.param.ProblemRectifyStatusParam;
import com.lutao.cloud.oil.pojo.param.SecurityRiskAssessmentParam;
import com.lutao.cloud.oil.pojo.vo.*;
import com.lutao.cloud.oil.service.IBusinessSecurityRiskAssessmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 安全风险评估控制器
 *
 * @author yx
 * @date 2023/07/26
 */
@Api(value = "安全风险评估", tags = "安全风险评估")
@RestController
@RequestMapping("/security-risk-assessment")
public class SecurityRiskAssessmentController {

    @Resource
    private IBusinessSecurityRiskAssessmentService iBusinessSecurityRiskAssessmentService;

    @ApiOperation(value = "安全风险评估情况", notes = "安全风险评估情况")
    @ApiOperationSupport(order = 1)
    @PostMapping("/risk-assessment-status")
    @Inner(value = false)
    public MessageInfo<IPage<SecurityRiskAssessmentSummaryPageVO>> riskAssessmentStatus(Page page, @RequestBody SecurityRiskAssessmentParam param) {
        return iBusinessSecurityRiskAssessmentService.queryRiskAssessmentStatus(param,page);
    }

    @ApiOperation(value = "隐患和整改情况", notes = "隐患和整改情况")
    @ApiOperationSupport(order = 2)
    @PostMapping("/hidden-danger-rectify-status")
    @Inner(value = false)
    public MessageInfo<HiddenDangerRectificationVO> hiddenDangerRectifyStatus(@RequestBody BaseParam param) {
        return iBusinessSecurityRiskAssessmentService.queryHiddenDangerRectifyStatus(param);
    }

    @ApiOperation(value = "隐患整改情况-隐患问题占比", notes = "隐患整改情况-隐患问题占比")
    @PostMapping("/hidden-danger-rectify-proportion")
    @Inner(value = false)
    public MessageInfo<HiddenDangerNumberVO> hiddenDangerRectifyProportion(@RequestBody BaseParam param) {
        return iBusinessSecurityRiskAssessmentService.queryHiddenDangerRectifyProportion(param);
    }

    @ApiOperation(value = "问题隐患整改情况", notes = "问题隐患整改情况")
    @ApiOperationSupport(order = 3)
    @PostMapping("/problem-rectify-status")
    @Inner(value = false)
    public MessageInfo problemRectifyStatus(Page page, @RequestBody ProblemRectifyStatusParam param) {
        return iBusinessSecurityRiskAssessmentService.queryProblemRectifyStatus(page,param);
    }

    @ApiOperation(value = "问题隐患整改情况-分布检查-整改率")
    @ApiOperationSupport(order = 4)
    @PostMapping("/problem-check-proportion")
    @Inner(value = false)
    public MessageInfo<ProblemRectifyProportionVO> problemRectifyProportion(@RequestBody BaseParam param){

        return iBusinessSecurityRiskAssessmentService.queryProblemRectifyProportion(param);
    }

    @ApiOperation(value = "问题隐患整改情况-部级督导-风险评估分布")
    @ApiOperationSupport(order = 5)
    @PostMapping("/problem-check-risk-distribution")
    @Inner(value = false)
    public MessageInfo<SecurityRiskAssessmentTimeDistributionVO> SecurityRiskAssessmentTimeDistribution(@RequestBody BaseParam param){

        return iBusinessSecurityRiskAssessmentService.querySecurityRiskAssessmentTimeDistribution(param);
    }

    @ApiOperation(value = "评估进度-一台一策")
    @ApiOperationSupport(order = 6)
    @PostMapping("/assessment-strategy")
    @Inner(value = false)
    public MessageInfo<AssessmentReportVO> assessmentStrategy(@RequestBody BaseParam param){

        return iBusinessSecurityRiskAssessmentService.getAssessmentStrategy(param);
    }

    @ApiOperation(value = "安全风险评估饼图-new", notes = "安全风险评估饼图-new")
    @ApiOperationSupport(order = 7)
    @PostMapping("/risk-assessment-status-pie")
    @Inner(value = false)
    public MessageInfo<SecurityRiskAssessmentPieVO> riskAssessmentStatus(@RequestBody SecurityRiskAssessmentParam param) {
        return iBusinessSecurityRiskAssessmentService.queryRiskAssessmentStatusPie(param);
    }

    @ApiOperation(value = "安全风险评估柱状图", notes = "安全风险评估柱状图")
    @ApiOperationSupport(order = 8)
    @PostMapping("/risk-assessment-status-bar")
    @Inner(value = false)
    public MessageInfo<SecurityRiskAssessmentBarVO> riskAssessmentStatusBar(@RequestBody SecurityRiskAssessmentParam param) {
        return iBusinessSecurityRiskAssessmentService.queryRiskAssessmentStatusBar(param);
    }

    @ApiOperation(value = "问题隐患整改情况-环形图", notes = "问题隐患整改情况-环形图")
    @ApiOperationSupport(order = 9)
    @PostMapping("/problem-check-pie")
    @Inner(value = false)
    public MessageInfo<ProblemCheckPieVO> problemRectifyProportionPie(@RequestBody ProblemCheckPieParam param){

        return iBusinessSecurityRiskAssessmentService.queryProblemCheckPie(param);
    }
}
