| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.sales.dto.SalesQuotationDto; |
| | | import com.ruoyi.sales.service.SalesQuotationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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 javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/sales/quotation") |
| | | @AllArgsConstructor |
| | | @Tag(name = "销售报价管理") |
| | | public class SalesQuotationController { |
| | | @Autowired |
| | | private SalesQuotationService salesQuotationService; |
| | | 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>(SalesQuotationDto.class); |
| | | util.exportExcel(response, listPage.getRecords() , "销售报价"); |
| | | 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)); |
| | | } |
| | | } |