package com.bonus.sgzb.largeScreen.controller;

import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.largeScreen.domain.PageResultVo;
import com.bonus.sgzb.largeScreen.domain.ParamsDto;
import com.bonus.sgzb.largeScreen.service.ILargeScreenService;
import lombok.extern.slf4j.Slf4j;
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 10488
 * 大屏
 */
@RestController
@RequestMapping("/base/largeScreen/home/")
@Slf4j
public class LargeScreenController extends BaseController {

    @Resource(name = "ILargeScreenService")
    private ILargeScreenService service;

    @Log(title = "领料数据", businessType = BusinessType.QUERY)
    @PostMapping("getMaterialReqData")
    public AjaxResult getMaterialReqData() {
        return service.getMaterialReqData();
    }

    /**
     * 宁夏大屏二级页面
     * @param dto
     * @return
     */
    @Log(title = "领料数据详情", businessType = BusinessType.QUERY)
    @PostMapping("getMaterialReqData/details")
    public AjaxResult getMaterialReqDetailData(@RequestBody ParamsDto dto) {
        try {
            PageResultVo data = service.getMaterialReqDetailData(dto);
            return AjaxResult.success(data);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }

    @Log(title = "退料数据", businessType = BusinessType.QUERY)
    @PostMapping("getMaterialReturnData")
    public AjaxResult getMaterialReturnData() {
        return service.getMaterialReturnData();
    }

    /**
     * 宁夏大屏二级页面
     * @param dto
     * @return
     */
    @Log(title = "退料数据详情", businessType = BusinessType.QUERY)
    @PostMapping("getMaterialReturnData/details")
    public AjaxResult getMaterialReturnDetailData(@RequestBody ParamsDto dto) {
        try {
            PageResultVo data = service.getMaterialReturnDetailData(dto);
            return AjaxResult.success(data);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }

    @Log(title = "设备分布图",businessType = BusinessType.QUERY)
    @PostMapping("getEquipmentDisByMap")
    public AjaxResult getEquipmentDisByMap(ParamsDto dto) {
        return service.getEquipmentDisByMap(dto);
    }

    @Log(title = "施工机具/安全工器具总保有量",businessType = BusinessType.QUERY)
    @PostMapping("getTotalOwnership")
    public AjaxResult getTotalOwnership() {
        return service.getTotalOwnership();
    }

    /**
     * 宁夏大屏二级页面
     * @param dto
     * @return
     */
    @Log(title = "施工机具/安全工器具总保有量详情",businessType = BusinessType.QUERY)
    @PostMapping("getTotalOwnership/details")
    public AjaxResult getTotalOwnerDetailsShip(@RequestBody ParamsDto dto) {
        try {
            PageResultVo data = service.getTotalOwnerDetailsShip(dto);
            return AjaxResult.success(data);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }

    @Log(title = "各公司机具保有量",businessType = BusinessType.QUERY)
    @PostMapping("getTotalOwnershipByCompany")
    public AjaxResult getTotalOwnershipByCompany() {
        return service.getTotalOwnershipByCompany();
    }

    @Log(title = "当月报废分析", businessType = BusinessType.QUERY)
    @PostMapping("getScrapAnalysisByMonth")
    public AjaxResult getScrapAnalysisByMonth(ParamsDto dto) {
        return service.getScrapAnalysisByMonth(dto);
    }

    /**
     * 宁夏大屏二级页面
     * @param dto
     * @return
     */
    @Log(title = "当月报废分析详情", businessType = BusinessType.QUERY)
    @PostMapping("getScrapAnalysisByMonth/details")
    public AjaxResult getScrapAnalysisDetailByMonth(@RequestBody ParamsDto dto) {
        try {
            PageResultVo data = service.getScrapAnalysisDetailByMonth(dto);
            return AjaxResult.success(data);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }

    @Log(title = "新购验收入库分析",businessType = BusinessType.QUERY)
    @PostMapping("getAcceptanceStorage")
    public AjaxResult getAcceptanceStorage(ParamsDto dto) {
        return service.getAcceptanceStorage(dto);
    }

    /**
     * 宁夏大屏二级页面
     * @param dto
     * @return
     */
    @Log(title = "新购验收入库分析详情",businessType = BusinessType.QUERY)
    @PostMapping("getAcceptanceStorage/details")
    public AjaxResult getAcceptanceDetailStorage(@RequestBody ParamsDto dto) {
        try {
            PageResultVo data = service.getAcceptanceDetailStorage(dto);
            return AjaxResult.success(data);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }

    @Log(title = "当月领料分析", businessType = BusinessType.QUERY)
    @PostMapping("getPickingAnalysisByMonth")
    public AjaxResult getPickingAnalysisByMonth(ParamsDto dto) {
        return service.getPickingAnalysisByMonth(dto);
    }

    /**
     * 宁夏大屏二级页面
     * @param dto
     * @return
     */
    @Log(title = "当月领料分析详情", businessType = BusinessType.QUERY)
    @PostMapping("getPickingAnalysisByMonth/details")
    public AjaxResult getPickingAnalysisDetailByMonth(@RequestBody ParamsDto dto) {
        try {
            PageResultVo data = service.getPickingAnalysisDetailByMonth(dto);
            return AjaxResult.success(data);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }

    @Log(title = "当月退料分析", businessType = BusinessType.QUERY)
    @PostMapping("getMaterialReturnByMonth")
    public AjaxResult getMaterialReturnByMonth(ParamsDto dto) {
        return service.getMaterialReturnByMonth(dto);
    }

    /**
     * 宁夏大屏二级页面
     * @param dto
     * @return
     */
    @Log(title = "当月退料分析详情", businessType = BusinessType.QUERY)
    @PostMapping("getMaterialReturnByMonth/details")
    public AjaxResult getMaterialReturnDetailByMonth(@RequestBody ParamsDto dto) {
        try {
            PageResultVo data = service.getMaterialReturnDetailByMonth(dto);
            return AjaxResult.success(data);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }

    @Log(title = "当月维修分析", businessType = BusinessType.QUERY)
    @PostMapping("getMaintenanceByMonth")
    public AjaxResult getMaintenanceByMonth(ParamsDto dto) {
        return service.getMaintenanceByMonth(dto);
    }

    @Log(title = "当月维修分析详情列表", businessType = BusinessType.QUERY)
    @PostMapping("getMaintenanceByMonth/chart")
    public AjaxResult getMaintenanceChartByMonth(@RequestBody ParamsDto dto) {
        return service.getMaintenanceChartByMonth(dto);
    }

    /**
     * 宁夏大屏二级页面
     * @param dto
     * @return
     */
    @Log(title = "当月维修分析详情", businessType = BusinessType.QUERY)
    @PostMapping("getMaintenanceByMonth/details")
    public AjaxResult getMaintenanceDetailByMonth(@RequestBody ParamsDto dto) {
        try {
            PageResultVo data = service.getMaintenanceDetailByMonth(dto);
            return AjaxResult.success(data);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }

    @Log(title = "当月车辆使用", businessType = BusinessType.QUERY)
    @PostMapping("getCarUseByMonth")
    public AjaxResult getCarUseByMonth() {
        return service.getCarUseByMonth();
    }

    @Log(title = "检修预警", businessType = BusinessType.QUERY)
    @PostMapping("getMaintenanceWarning")
    public AjaxResult getMaintenanceWarning() {
        return service.getMaintenanceWarning();
    }
}
