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.util.List; @RestController @RequestMapping("/invoiceLedger") public class InvoiceLedgerController { @Autowired private InvoiceLedgerService invoiceLedgerService; /** * 开票台账新增 * @param invoiceLedgerDto * @return */ @PostMapping("/add") public AjaxResult invoiceLedgerAdd(@RequestBody InvoiceLedgerDto invoiceLedgerDto) { invoiceLedgerService.invoiceLedgerAdd(invoiceLedgerDto); return AjaxResult.success(); } /** * 开票台账删除 * @param ids * @return */ @DeleteMapping("/del") public AjaxResult invoiceLedgerDel(@RequestParam List ids) { invoiceLedgerService.invoiceLedgerDel(ids); return AjaxResult.success(); } /** * 开票台账修改 * @param invoiceLedgerDto * @return */ @PostMapping("/update") public AjaxResult invoiceLedgerUpdate(@RequestBody InvoiceLedgerDto invoiceLedgerDto) { invoiceLedgerService.invoiceLedgerUpdate(invoiceLedgerDto); 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 */ @GetMapping("/downloadFile") public void invoiceLedgerDownloadFile(HttpServletResponse response, InvoiceLedgerDto invoiceLedgerDto) { invoiceLedgerService.invoiceLedgerDownload(response, invoiceLedgerDto); } }