| | |
| | | package com.ruoyi.purchase.controller; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.purchase.pojo.InvoicePurchase; |
| | | import com.ruoyi.purchase.service.IInvoicePurchaseService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.InvoicePurchaseDto; |
| | | import com.ruoyi.purchase.pojo.InvoicePurchase; |
| | | import com.ruoyi.purchase.service.IInvoicePurchaseService; |
| | | import com.ruoyi.sales.service.ICommonFileService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 发票信息Controller |
| | |
| | | |
| | | private IInvoicePurchaseService invoicePurchaseService; |
| | | |
| | | private ICommonFileService commonFileService; |
| | | |
| | | /** |
| | | * 查询发票信息列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(InvoicePurchase invoicePurchase) { |
| | | public TableDataInfo list(InvoicePurchaseDto invoicePurchaseDto) { |
| | | startPage(); |
| | | List<InvoicePurchase> list = invoicePurchaseService.selectInvoicePurchaseList(invoicePurchase); |
| | | List<InvoicePurchaseDto> list = invoicePurchaseService.selectInvoicePurchaseList(invoicePurchaseDto); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | @Log(title = "发票信息", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, InvoicePurchase invoicePurchase) { |
| | | List<InvoicePurchase> list = invoicePurchaseService.selectInvoicePurchaseList(invoicePurchase); |
| | | List<InvoicePurchase> list = invoicePurchaseService.selectInvoicePurchaseLists(invoicePurchase); |
| | | ExcelUtil<InvoicePurchase> util = new ExcelUtil<InvoicePurchase>(InvoicePurchase.class); |
| | | util.exportExcel(response, list, "发票信息数据"); |
| | | } |
| | | |
| | | /** |
| | | * 查询发票信息 |
| | | */ |
| | | @GetMapping("/getInvoiceById") |
| | | public InvoicePurchaseDto getInvoiceById(InvoicePurchaseDto invoicePurchaseDto) { |
| | | return invoicePurchaseService.getInvoiceById(invoicePurchaseDto); |
| | | } |
| | | |
| | | /** |
| | | * 新增修改发票信息 |
| | | */ |
| | | @Log(title = "发票信息", businessType = BusinessType.INSERT) |
| | | @PostMapping ("/addOrUpdateInvoice") |
| | | public AjaxResult addOrUpdateInvoice(@RequestBody InvoicePurchase invoicePurchase) { |
| | | return toAjax(invoicePurchaseService.addOrUpdateInvoice(invoicePurchase)); |
| | | @PostMapping("/addOrUpdateInvoice") |
| | | public AjaxResult addOrUpdateInvoice(@RequestBody InvoicePurchaseDto invoicePurchaseDto) throws IOException { |
| | | return toAjax(invoicePurchaseService.addOrUpdateInvoice(invoicePurchaseDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | return toAjax(invoicePurchaseService.delInvoice(ids)); |
| | | } |
| | | |
| | | @PostMapping("/upload") |
| | | public AjaxResult uploadFile(MultipartFile file, Long id, String type) { |
| | | try { |
| | | return AjaxResult.success(commonFileService.uploadFile(file, id, type)); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | } |