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.ReceivableExcel;
import com.ruoyi.reportManagement.excel.Payable;
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/receivable")
public class ReceivableShippingController extends BaseController {
    @Autowired
    private ITFeeService tFeeService;

    /**
     * 查询应收总账列表
     */
    @PreAuthorize("@ss.hasPermi('warehouseBusiness:profit:list')")
    @GetMapping("/list")
    public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
        startPage();
        tWareHouseFees.setfDc("D");
        List<ReceivableExcel> list = tFeeService.receivable(tWareHouseFees);
        return getDataTable(list);
    }

    /**
     * 导出应收总账
     */
    @Log(title = "应收总账", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TWareHouseFees tWareHouseFees) throws Exception {
        tWareHouseFees.setfDc("D");
        List<ReceivableExcel> list = tFeeService.receivable(tWareHouseFees);
        ExcelUtil<ReceivableExcel> util = new ExcelUtil<ReceivableExcel>(ReceivableExcel.class);
        return util.exportExcel(list, "应收总账");
    }
}
