/*
 * Copyright [2022] [https://www.xiaonuo.vip]
 *
 * Snowy采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：
 *
 * 1.请不要删除和修改根目录下的LICENSE文件。
 * 2.请不要删除和修改Snowy源码头部的版权声明。
 * 3.本项目代码可免费商业使用，商业使用请保留源码和相关描述文件的项目出处，作者声明等。
 * 4.分发源码时候，请注明软件出处 https://www.xiaonuo.vip
 * 5.不可二次分发开源参与同类竞品，如有想法可联系团队xiaonuobase@qq.com商议合作。
 * 6.若您的项目无法满足以上几点，需要更多功能代码，获取Snowy商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package vip.xiaonuo.modular.feed.feedingfat.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.common.annotation.CommonLog;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.common.pojo.CommonValidList;
import vip.xiaonuo.modular.feed.feedingfat.entity.FeedingFat;
import vip.xiaonuo.modular.feed.feedingfat.param.*;
import vip.xiaonuo.modular.feed.feedingfat.service.FeedingFatService;
import vip.xiaonuo.modular.feed.feedingfat.vo.*;
import vip.xiaonuo.modular.feed.feedinglist.vo.FeedingListVo2;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
import java.util.Map;

/**
 * 精准饲喂母猪采食控制器
 *
 * @author wang
 * @date  2023/12/28 09:22
 */
@Api(tags = "精准饲喂母猪采食控制器")
@ApiSupport(author = "SNOWY_TEAM", order = 1)
@RestController
@Validated
public class FeedingFatController {

    @Resource
    private FeedingFatService feedingFatService;

    /**
     * 肥猪采食
     *
     * @author wang
     * @date  2023/12/27 15:34
     */
    @ApiOperationSupport(order = 1)
    @ApiOperation("肥猪采食")
    @PostMapping("/feed/feedinglist/listFat")
    public CommonResult<FeedingFatVo> listFat(@RequestBody @Valid FeedingFatAddParam feedingFatAddParam) {
        return CommonResult.data(feedingFatService.listFat(feedingFatAddParam));
    }

    /**
     * 肥猪采食
     *
     * @author wang
     * @date  2023/12/27 15:34
     */
    @ApiOperationSupport(order = 2)
    @ApiOperation("获取料塔曲线")
    @PostMapping("/feed/feedinglist/fatPage")
    public CommonResult<IPage<FeedingFatVo>> fatPage(@RequestBody @Valid FeedingFatPageParam feedingFatPageParam) {
        return CommonResult.data(feedingFatService.fatPage(feedingFatPageParam));
    }


    /**
     * 采食曲线
     *
     * @author wang
     * @date  2023/12/27 15:34
     */
    @ApiOperationSupport(order = 3)
    @ApiOperation("采食曲线")
    @PostMapping("/feed/feedinglist/listDetail")
    public CommonResult<List<FeedingFatVo2>> listDetail(@RequestBody @Valid FeedingFatEditParam feedingFatEditParam) {
        return CommonResult.data(feedingFatService.listDetail(feedingFatEditParam));
    }

    /**
     * 采食曲线
     *
     * @author wang
     * @date  2023/12/27 15:34
     */
    @ApiOperationSupport(order = 4)
    @ApiOperation("精准饲喂全场监测")
    @PostMapping("/feed/feedinglist/listFatMove")
    public CommonResult<FeedingFatMoveVo> listFatMove(@RequestBody @Valid FeedingFatMoveParam feedingFatEditParam) {
        return CommonResult.data(feedingFatService.listFatMove(feedingFatEditParam));
    }


    /**
     * 采食曲线
     *
     * @author wang
     * @date  2023/12/27 15:34
     */
    @ApiOperationSupport(order = 5)
    @ApiOperation("精准饲喂移动端栋舍")
    @PostMapping("/feed/feedinglist/listFatByUnitId")
    public CommonResult<FeedingFatMoveVo2> listFatByUnitId(@RequestBody @Valid FeedingFatMove2Param fatMove2Param) {
        return CommonResult.data(feedingFatService.listFatByUnitId(fatMove2Param));
    }

    /**
     * 采食曲线
     *
     * @author wang
     * @date  2023/12/27 15:34
     */
    @ApiOperationSupport(order = 6)
    @ApiOperation("大屏全场近7天用料")
    @PostMapping("/feed/feedinglist/listFatSeven")
    public CommonResult<List<FeedingFatVo2>> listFatSeven(@RequestBody @Valid FeedingFatMoveParam fatMoveParam) {
        return CommonResult.data(feedingFatService.feedingDay(fatMoveParam));
    }


    /**
     * 采食曲线
     *
     * @author wang
     * @date  2023/12/27 15:34
     */
    @ApiOperationSupport(order = 7)
    @ApiOperation("大屏母猪采食饮水")
    @PostMapping("/feed/feedinglist/feedScreen")
    public CommonResult<List<FeedingFatScreenVo>> feedScreen(@RequestBody @Valid FeedingFatScreenParam fatScreenParam) {
        return CommonResult.data(feedingFatService.feedScreen(fatScreenParam));
    }

    /**
     * 采食曲线
     *
     * @author wang
     * @date  2023/12/27 15:34
     */
    @ApiOperationSupport(order = 8)
    @ApiOperation("大屏母猪采食饮水")
    @PostMapping("/feed/feedinglist/feedFat")
    public CommonResult<List<FeedingFatScreenVo>> feedFatScreen(@RequestBody @Valid FeedingFatScreenParam fatScreenParam) {
        return CommonResult.data(feedingFatService.feedFatScreen(fatScreenParam));
    }
}
