package com.aucma.report.controller;

import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.report.service.IQualityReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 质量报表Controller
 *
 * @author Yinq
 * @date 2023-11-21
 */
@RestController
@RequestMapping("/report/qualityReport")
public class QualityReportController extends BaseController {
    @Autowired
    private IQualityReportService qualityReportService;


    /**
     * 质量缺陷统计分析
     * @param hashMap
     * @return
     */
    @GetMapping("/qualityDefectsStatisticalAnalysisList")
    public AjaxResult qualityDefectsStatisticalAnalysisList(@RequestParam(required = false) Map hashMap) {
        List<HashMap<String, Object>> list = qualityReportService.qualityDefectsStatisticalAnalysisList(hashMap);
        return success(list);
    }

    /**
     * 少错件报表
     * @param hashMap
     * @return
     */
    @GetMapping("/fewerMistakesReportList")
    public AjaxResult fewerMistakesReportList(@RequestParam(required = false) Map hashMap) {
        List<HashMap<String, Object>> list = qualityReportService.fewerMistakesReportList(hashMap);
        return success(list);
    }


    /**
     * 质量问题前80报表
     * @param hashMap
     * @return
     */
    @GetMapping("/qualityIssuesReportList")
    public AjaxResult qualityIssuesReportList(@RequestParam(required = false) Map hashMap) {
        List<HashMap<String, Object>> list = qualityReportService.qualityIssuesReportList(hashMap);
        return success(list);
    }

    /**
     * 产品追溯报表
     * @param hashMap
     * @return
     */
    @GetMapping("/productTraceabilityReportList")
    public AjaxResult productTraceabilityReportList(@RequestParam(required = false) Map hashMap) {
        List<HashMap<String, Object>> list = qualityReportService.productTraceabilityReportList(hashMap);
        return success(list);
    }


    /**
     * 测温记录报表
     * @param hashMap
     * @return
     */
    @GetMapping("/temperatureRecordReportList")
    public AjaxResult temperatureRecordReportList(@RequestParam(required = false) Map hashMap) {
        List<HashMap<String, Object>> list = qualityReportService.temperatureRecordReportList(hashMap);
        return success(list);
    }

    /**
     * 灌注记录报表
     * @param hashMap
     * @return
     */
    @GetMapping("/pourRecordReportList")
    public AjaxResult pourRecordReportList(@RequestParam(required = false) Map hashMap) {
        List<HashMap<String, Object>> list = qualityReportService.pourRecordReportList(hashMap);
        return success(list);
    }
}
