7 天以前 11214e3074266a23fe61e8eebbce647fdb7305ef
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
package com.ruoyi.sales.controller;
 
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.sales.dto.SalesQuotationDto;
import com.ruoyi.sales.pojo.SalesQuotationImportLog;
import com.ruoyi.sales.pojo.SalesQuotationPriceHistory;
import com.ruoyi.sales.service.SalesQuotationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import java.util.List;
 
@RestController
@RequestMapping("/sales/quotation")
@AllArgsConstructor
@Tag(name = "销售报价管理")
public class SalesQuotationController {
    private final SalesQuotationService salesQuotationService;
 
    @GetMapping("/list")
    @Operation(summary = "分页查询报价单列表")
    public AjaxResult getList(Page page, SalesQuotationDto salesQuotationDto) {
        return AjaxResult.success(salesQuotationService.listPage(page, salesQuotationDto));
    }
 
    @PostMapping("/export")
    @Operation(summary = "导出报价单")
    public void export(HttpServletResponse response) {
        Page page = new Page(-1,-1);
        SalesQuotationDto afterSalesService = new SalesQuotationDto();
        IPage<SalesQuotationDto> listPage = salesQuotationService.listPage(page, afterSalesService);
        ExcelUtil<SalesQuotationDto> util = new ExcelUtil<>(SalesQuotationDto.class);
        util.exportExcel(response, listPage.getRecords(), "销售报价");
    }
 
    @PostMapping("/add")
    @Operation(summary = "新增报价单")
    public AjaxResult add(@RequestBody SalesQuotationDto salesQuotationDto) {
        return AjaxResult.success(salesQuotationService.add(salesQuotationDto));
    }
 
    @PostMapping("/update")
    @Operation(summary = "修改报价单")
    public AjaxResult update(@RequestBody SalesQuotationDto salesQuotationDto) {
        return AjaxResult.success(salesQuotationService.edit(salesQuotationDto));
    }
 
    @DeleteMapping("/delete")
    @Operation(summary = "删除报价单")
    public AjaxResult delete(@RequestBody Long id) {
        return AjaxResult.success(salesQuotationService.delete(id));
    }
 
    @GetMapping("/downloadTemplate")
    @Operation(summary = "下载报价导入模板")
    public void downloadTemplate(HttpServletResponse response) {
        salesQuotationService.downloadTemplate(response);
    }
 
    @PostMapping("/import")
    @Operation(summary = "导入报价单")
    public R<SalesQuotationImportLog> importQuotation(@RequestParam("file") MultipartFile file) {
        return R.ok(salesQuotationService.importQuotation(file));
    }
 
    @GetMapping("/importLog/list")
    @Operation(summary = "查询导入记录列表")
    public R<IPage<SalesQuotationImportLog>> listImportLog(Page page) {
        return R.ok(salesQuotationService.listImportLog(page));
    }
 
    @GetMapping("/priceHistory/list")
    @Operation(summary = "查询降价历史记录")
    public R<List<SalesQuotationPriceHistory>> listPriceHistory(@RequestParam("quotationProductId") Long quotationProductId) {
        return R.ok(salesQuotationService.listPriceHistory(quotationProductId));
    }
}