package com.ruoyi.web.controller.shipping.statement;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.finance.domain.TWareHouseFees;
import com.ruoyi.finance.service.ITFeeService;
import com.ruoyi.finance.shipping.ProfitExcel;
import com.ruoyi.reportManagement.excel.Profit;
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;
import java.util.Map;

/**
 * 利润统计
 */
@RestController
@RequestMapping("/shipping/profit")
public class ProfitShippingController extends BaseController {
    @Autowired
    private ITFeeService tFeeService;
    /**
     * 查询利润列表
     */
    //@PreAuthorize("@ss.hasPermi('warehouseBusiness:profit:list')")
    @GetMapping("/list")
    public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
        startPage();
        List<ProfitExcel> list = tFeeService.profit(tWareHouseFees);
        return getDataTable(list);
    }

    /**
     * 导出利润统计
     */
    @Log(title = "库存总账", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TWareHouseFees tWareHouseFees) throws Exception {
        List<ProfitExcel> list = tFeeService.profit(tWareHouseFees);
        ExcelUtil<ProfitExcel> util = new ExcelUtil<ProfitExcel>(ProfitExcel.class);
        return util.exportExcel(list, "利润总账");
    }
}
