package com.ruoyi.web.controller.app;

import com.ruoyi.app.DTO.EntranceReportDTO;
import com.ruoyi.app.DTO.PurchaserProduceTotalDTO;
import com.ruoyi.app.DTO.SlaughterReportDTO;
import com.ruoyi.app.domain.request.ReqEntranceReport;

import com.ruoyi.app.domain.request.ReqGetPorkSideProduceRecord;
import com.ruoyi.app.domain.request.ReqSlaughterReport;
import com.ruoyi.app.service.IDataReportService;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 数据报表Controller
 *
 * @author coede
 * @date 2025-03-31
 */
@RestController
@RequestMapping("/app/dataReport")
public class DataReportController extends BaseController {
    @Autowired
    private IDataReportService dataReportService;

    /**
     * 获取入场报表
     */
    @PreAuthorize("@ss.hasPermi('app:dataReport:getEntranceReport')")
    @GetMapping(value = "/getEntranceReport")
    public TableDataInfo getEntranceReport(ReqEntranceReport reqEntranceReport)
    {
        startPage();
        List<EntranceReportDTO> list = dataReportService.selectEntranceReport(reqEntranceReport);
        return getDataTable(list);
    }

    /**
     * 获取检查检疫无害化报表
     */
    @PreAuthorize("@ss.hasPermi('app:dataReport:getInspectionReport')")
    @GetMapping(value = "/getInspectionReport")
    public TableDataInfo getInspectionReport(ReqEntranceReport reqEntranceReport)
    {
        startPage();
        List<EntranceReportDTO> list = dataReportService.selectEntranceReport(reqEntranceReport);
        return getDataTable(list);
    }

    /**
     * 获取生产报表
     */
    @PreAuthorize("@ss.hasPermi('app:dataReport:getSlaughterReport')")
    @GetMapping(value = "/getSlaughterReport")
    public TableDataInfo getSlaughterReport(ReqSlaughterReport reqSlaughterReport)
    {
        startPage();
        List<SlaughterReportDTO> list = dataReportService.selectSlaughterReport(reqSlaughterReport);
        return getDataTable(list);
    }

    /**
     * 获取称重统计
     */
    @PreAuthorize("@ss.hasPermi('app:dataReport:getWeightReport')")
    @GetMapping(value = "/getWeightReport")
    public TableDataInfo getWeightReport(ReqGetPorkSideProduceRecord req)
    {
        startPage();
        List<PurchaserProduceTotalDTO> list = dataReportService.selectPurchaserProduceTotal(req);
        return getDataTable(list);
    }
}
