| | |
| | | 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.dto.InvoiceRegistrationProductDto; |
| | | import com.ruoyi.sales.mapper.InvoiceRegistrationProductMapper; |
| | | import com.ruoyi.sales.pojo.InvoiceRegistrationProduct; |
| | | 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 |
| | |
| | | @Autowired |
| | | private InvoiceLedgerService invoiceLedgerService; |
| | | |
| | | @Autowired |
| | | private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | |
| | | /** |
| | | * 开票台账新增 |
| | | * @param invoiceLedgerDto |
| | | * @param productDto |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult invoiceLedgerAdd(@RequestBody InvoiceLedgerDto invoiceLedgerDto) { |
| | | invoiceLedgerService.invoiceLedgerAdd(invoiceLedgerDto); |
| | | @PostMapping("/saveOrUpdate") |
| | | public AjaxResult invoiceLedgerSaveOrUpdate(@RequestBody InvoiceRegistrationProductDto productDto) { |
| | | invoiceLedgerService.invoiceLedgerSaveOrUpdate(productDto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult invoiceLedgerDel(@RequestParam List<Integer> ids) { |
| | | public AjaxResult invoiceLedgerDel(@RequestBody List<Integer> 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 response |
| | | * @param invoiceRegistrationProductDto |
| | | * @return |
| | | */ |
| | | @PostMapping("/export") |
| | | public void invoiceLedgerExport(HttpServletResponse response, InvoiceRegistrationProductDto invoiceRegistrationProductDto) { |
| | | invoiceLedgerService.invoiceLedgerExport(response, invoiceRegistrationProductDto); |
| | | } |
| | | |
| | | /** |
| | | * 开票台账详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("/info") |
| | | public AjaxResult invoiceLedgerInfo(Integer id) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerDetail(id)); |
| | | } |
| | | |
| | | /** |
| | | * 文件提交 |
| | | * @param invoiceLedgerDto |
| | | * @return |
| | | */ |
| | | @GetMapping("/downloadFile") |
| | | public void invoiceLedgerDownloadFile(HttpServletResponse response, InvoiceLedgerDto invoiceLedgerDto) { |
| | | invoiceLedgerService.invoiceLedgerDownload(response, invoiceLedgerDto); |
| | | @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()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 产品开票记录查询 |
| | | * @param page |
| | | * @param registrationProductDto |
| | | * @return |
| | | */ |
| | | @GetMapping("/registrationProductPage") |
| | | public AjaxResult registrationProductPage(Page page, InvoiceRegistrationProductDto registrationProductDto) { |
| | | return AjaxResult.success(invoiceLedgerService.registrationProductPage(page,registrationProductDto)); |
| | | } |
| | | |
| | | /** |
| | | * 产品开票详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("/invoiceLedgerProductInfo") |
| | | public AjaxResult invoiceLedgerProductDetail(Integer id) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerProductDetail(id)); |
| | | } |
| | | |
| | | } |