liding
2025-05-19 53bdb26a0ae994418e92d93aab23d6f5e7225f37
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package com.ruoyi.sales.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.sales.dto.InvoiceLedgerDto;
import com.ruoyi.sales.service.InvoiceLedgerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;
 
@RestController
@RequestMapping("/invoiceLedger")
public class InvoiceLedgerController {
 
    @Autowired
    private InvoiceLedgerService invoiceLedgerService;
 
    /**
     * 开票台账新增
     * @param invoiceLedgerDto
     * @return
     */
    @PostMapping("/saveOrUpdate")
    public AjaxResult invoiceLedgerSaveOrUpdate(@RequestBody InvoiceLedgerDto invoiceLedgerDto) {
        invoiceLedgerService.invoiceLedgerSaveOrUpdate(invoiceLedgerDto);
        return AjaxResult.success();
    }
 
    /**
     * 开票台账删除
     * @param ids
     * @return
     */
    @DeleteMapping("/del")
    public AjaxResult invoiceLedgerDel(@RequestBody List<Integer> ids) {
        invoiceLedgerService.invoiceLedgerDel(ids);
        return AjaxResult.success();
    }
 
    /**
     * 开票台账分页查询
     * @param page
     * @param invoiceLedgerDto
     * @return
     */
    @GetMapping("/page")
    public AjaxResult invoiceLedgerPage(Page page, InvoiceLedgerDto invoiceLedgerDto) {
        return AjaxResult.success(invoiceLedgerService.invoiceLedgerPage(page, invoiceLedgerDto));
    }
 
    /**
     * 开票台账文件查询
     * @param invoiceLedgerId
     * @return
     */
    @GetMapping("/fileList")
    public AjaxResult invoiceLedgerFileList(Integer invoiceLedgerId) {
        return AjaxResult.success(invoiceLedgerService.invoiceLedgerFileList(invoiceLedgerId));
    }
 
    /**
     * 开票台账文件上传
     * @param file
     * @return
     */
    @PostMapping("/uploadFile")
    public AjaxResult invoiceLedgerUploadFile(MultipartFile file) {
        try {
            return AjaxResult.success(invoiceLedgerService.invoiceLedgerUploadFile(file));
        }catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }
 
    /**
     * 开票台账导出
     * @param response
     * @param invoiceLedgerDto
     * @return
     */
    @PostMapping("/export")
    public void invoiceLedgerExport(HttpServletResponse response, InvoiceLedgerDto invoiceLedgerDto) {
        invoiceLedgerService.invoiceLedgerExport(response, invoiceLedgerDto);
    }
 
    /**
     * 开票台账详情
     * @param id
     * @return
     */
    @GetMapping("/info")
    public AjaxResult invoiceLedgerInfo(Integer id) {
        return AjaxResult.success(invoiceLedgerService.invoiceLedgerDetail(id));
    }
 
    /**
     * 文件提交
     * @param invoiceLedgerDto
     * @return
     */
    @PostMapping("/commitFile")
    public AjaxResult invoiceLedgerCommitFile(@RequestBody InvoiceLedgerDto invoiceLedgerDto) {
        try {
            invoiceLedgerService.invoiceLedgerCommitFile(invoiceLedgerDto);
            return AjaxResult.success();
        }catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }
 
    /**
     * 开票台账查询
     * @param invoiceLedgerDto
     * @return
     */
    @GetMapping("/list")
    public AjaxResult invoiceLedgerList(InvoiceLedgerDto invoiceLedgerDto) {
        return AjaxResult.success(invoiceLedgerService.invoiceLedgerList(invoiceLedgerDto));
    }
 
    /**
     * 客户销售记录
     * @param page
     * @param invoiceLedgerDto
     * @return
     */
    @GetMapping("/salesAccount")
    public AjaxResult invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto) {
        return AjaxResult.success(invoiceLedgerService.invoiceLedgerSalesAccount(page,invoiceLedgerDto));
    }
 
    /**
     * 本月开票金额
     */
    @GetMapping("/getInvoiceAmount")
    public AjaxResult getInvoiceAmount() {
        try {
            BigDecimal amount = invoiceLedgerService.getInvoiceAmount();
            return AjaxResult.success(amount != null ? amount : BigDecimal.ZERO);
        } catch (Exception e) {
            return AjaxResult.error("获取开票金额失败:" + e.getMessage());
        }
    }
 
}