package com.dayou.controller;

import com.dayou.annotation.IgnoreAuth;
import com.dayou.vo.ProductionFundVO;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RestController;
import com.dayou.controller.BaseController;
import com.dayou.service.IProductionFundService;
import com.dayou.entity.ProductionFund;
import com.dayou.common.RestResponse;
import org.springframework.web.bind.annotation.*;
import com.dayou.utils.ConvertUtil;
import com.dayou.utils.HttpKit;
import com.dayou.exception.ErrorCode;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.http.MediaType;
import org.springframework.web.multipart.MultipartFile;
/**
 * 业务产品收款表
 *
 * @author wucl
 * @since 2023-12-08
 */
@RestController
@RequestMapping("productionFund")
@Slf4j
public class ProductionFundController extends BaseController {
    @Autowired
    private IProductionFundService productionFundService;

    /**
    * 业务产品收款表列表
    */
    @GetMapping("")
    public RestResponse<Page<ProductionFund>> page(ProductionFund productionFund, Page page){
        Page<ProductionFund> pages=productionFundService.selectPage(page,productionFund);
        return RestResponse.data(pages);
    }

    /**
     * 业务产品收款表详情
     */
    @GetMapping("/{id}")
    public RestResponse<ProductionFund> detail(@PathVariable Long id){
        ProductionFund xProductionFund =productionFundService.detail(id);
        return RestResponse.data(xProductionFund);
     }

    /**
     * 业务产品收款表新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody ProductionFund productionFund) {
        Boolean ret = productionFundService.add(productionFund);
        return RestResponse.data(ret);
    }

    /**
     * 业务产品收款表更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody ProductionFund productionFund) {
        Boolean ret = productionFundService.update(productionFund);
        return RestResponse.data(ret);
    }

    /**
     * 业务产品收款表删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = productionFundService.delete(id);
        return RestResponse.data(ret);
    }


    /**
     * 检查产品实收款
     * @param productionFundVO
     * @return
     */
    @PostMapping("/checkFund")
    public RestResponse<ProductionFundVO> checkFund(@RequestBody ProductionFundVO productionFundVO){
        ProductionFundVO pf = productionFundService.checkFund(productionFundVO);
        return RestResponse.data(pf);
    }

}

