package com.fjhx.applet.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.applet.service.FabricStatisticsService;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;
import java.util.Map;

/**
 * 面料统计
 */
@RestController
@RequestMapping("/applet")
public class FabricStatisticsController {

    @Autowired
    private FabricStatisticsService fabricStatisticsService;

    /**
     * RFID版本的面料汇总详情(汇总)
     *
     * @param
     * @return
     */
    @PostMapping("/selectFabricStatisticsDetails")
    public R selectFabricDetails() {
        Map<String, Object> map = fabricStatisticsService.selectFabricDetails();
        return R.success(map);
    }

    /**
     * RFID版本的面料汇总详情(物料属性详情)
     *
     * @param condition
     * @return
     */
    @PostMapping("/selectFabricTypeDetails")
    public R selectFabricTypeDetails(@RequestBody Map<String, Object> condition) {
        List<Map<String, Object>> maps = fabricStatisticsService.selectFabricTypeDetails(condition);
        return R.success(maps);
    }

    /**
     * RFID版本的 面料入库汇总详情（汇总）
     *
     * @param condition
     * @return
     */
    @PostMapping("/selectFabricWDetails")
    public R selectFabricWDetails(@RequestBody Map<String, Object> condition) {
        Map<String, Object> map = fabricStatisticsService.selectFabricWDetails(condition);
        return R.success(map);
    }

    /**
     * RFID版本的面料入库汇总详情（物料属性详情）
     *
     * @param condition
     * @return
     */
    @PostMapping("/selectFabricWTypeDetails")
    public R selectFabricWTypeDetails(@RequestBody Map<String, Object> condition) {
        List<Map<String, Object>> map = fabricStatisticsService.selectFabricWTypeDetails(condition);
        return R.success(map);
    }

    /**
     * RFID版本的面料出库汇总详情
     *
     * @param condition
     * @return
     */
    @PostMapping("/selectFabricEWDetails")
    public R selectFabricEWDetails(@RequestBody Map<String, String> condition) {
        List<Map<String, Object>> map = fabricStatisticsService.selectFabricEWDetails(condition);
        return R.success(map);
    }

    /**
     * RFID版本的面料汇总
     *
     * @param condition
     * @return
     */
    @PostMapping("/selectFabricStatistics")
    public R selectFabricStatistics(@RequestBody Map<String, Object> condition) {
        Map<String, Object> map = fabricStatisticsService.selectFabricStatistics(condition);
        return R.success(map);
    }

    /**
     * RFID版本的面料出库汇总
     *
     * @param condition
     * @return
     */
    @PostMapping("/selectFabricEW")
    public R selectFabricEW(@RequestBody Map<String, Object> condition) {
        Map<String, Object> map = fabricStatisticsService.selectFabricEW(condition);
        return R.success(map);
    }

    /**
     * RFID版本的面料入库汇总
     *
     * @param condition
     * @return
     */
    @PostMapping("/selectFabricW")
    public R selectFabricW(@RequestBody Map<String, Object> condition) {
        Map<String, Object> map = fabricStatisticsService.selectFabricW(condition);
        return R.success(map);
    }

    /**
     * 审批数量
     */
    @PostMapping("/flowNum")
    public R flowNum(@RequestBody Map<String, String> condition) {
        List<Map<String, Object>> map = fabricStatisticsService.flowNum(condition);
        return R.success(map);
    }

    /**
     * 审批分页
     */
    @PostMapping("/flowPage")
    public R flowPage(@RequestBody Map<String, String> condition) {
        Page<Map<String, Object>> map = fabricStatisticsService.flowPage(condition);
        return R.success(map);
    }

    /**
     * 获取ApproveType
     */
    @PostMapping("/getApproveType")
    public R getApproveType(@RequestBody Map<String, String> condition) {
        Integer result = fabricStatisticsService.getApproveType(condition);
        return R.data(result);
    }

}
