1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.ruoyi.purchase.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.purchase.dto.InvoicePurchaseReportDto;
import com.ruoyi.purchase.dto.VatDto;
import com.ruoyi.purchase.pojo.InvoicePurchase;
import com.ruoyi.purchase.service.IInvoicePurchaseService;
import com.ruoyi.waterrecord.pojo.WaterRecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
@RestController
@Api(tags = "采购报表")
@RequestMapping("/purchase/report")
@AllArgsConstructor
public class AccountingReportController {
 
    @Autowired
    private IInvoicePurchaseService invoicePurchaseService;
 
    @GetMapping("/list")
    @Log(title = "采购报表-项目利润", businessType = BusinessType.OTHER)
    public AjaxResult list(Page page, InvoicePurchaseReportDto invoicePurchaseReportDto) {
        IPage<InvoicePurchaseReportDto> result =invoicePurchaseService.listPurchaseReport(page, invoicePurchaseReportDto);
        return AjaxResult.success(result);
    }
 
    @Log(title = "采购报表-项目利润导出", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("采购报表-项目利润导出")
    public void export(HttpServletResponse response) {
        Page page = new Page(-1,-1);
        InvoicePurchaseReportDto waterRecord = new InvoicePurchaseReportDto();
        IPage<InvoicePurchaseReportDto> listPage = invoicePurchaseService.listPurchaseReport(page, waterRecord);
        ExcelUtil<InvoicePurchaseReportDto> util = new ExcelUtil<InvoicePurchaseReportDto>(InvoicePurchaseReportDto.class);
        util.exportExcel(response, listPage.getRecords() , "项目利润导出");
    }
 
    @Log(title = "采购报表-增值税比对", businessType = BusinessType.OTHER)
    @GetMapping("/listVat")
    public AjaxResult listVat(Page page,String month) {
        IPage<VatDto> result = invoicePurchaseService.listVat(page, month);
        return AjaxResult.success(result);
    }
 
    @Log(title = "采购报表-增值税比对", businessType = BusinessType.EXPORT)
    @PostMapping("/exportTwo")
    @ApiOperation("采购报表-增值税比对")
    public void exportTwo(HttpServletResponse response) {
        Page page = new Page(-1,-1);
        IPage<VatDto> result = invoicePurchaseService.listVat(page, null);
        ExcelUtil<VatDto> util = new ExcelUtil<VatDto>(VatDto.class);
        util.exportExcel(response, result.getRecords() , "增值税比对");
    }
}