| | |
| | | package com.ruoyi.cwgl.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.cwgl.domain.ReceivableBillCustomerSummary; |
| | | import com.ruoyi.cwgl.domain.vo.ReceivableBillAccountAnalysisVo; |
| | | import com.ruoyi.cwgl.domain.vo.ReceivableBillAgingAnalysisVo; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import com.ruoyi.cwgl.domain.InvoiceManage; |
| | | import com.ruoyi.cwgl.domain.ReceivableBillManagement; |
| | | import com.ruoyi.cwgl.domain.ReceivableInvoiceBusiness; |
| | | import com.ruoyi.cwgl.service.IInvoiceManageService; |
| | | import com.ruoyi.cwgl.service.IReceivableBillManagementService; |
| | | import com.ruoyi.cwgl.service.IReceivableInvoiceBusinessService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | |
| | |
| | | { |
| | | @Autowired |
| | | private IReceivableBillManagementService receivableBillManagementService; |
| | | |
| | | @Autowired |
| | | private IInvoiceManageService invoiceManageService; |
| | | |
| | | @Autowired |
| | | private IReceivableInvoiceBusinessService receivableInvoiceBusinessService; |
| | | |
| | | |
| | | |
| | |
| | | public AjaxResult edit(@RequestBody ReceivableBillManagement receivableBillManagement) |
| | | { |
| | | return toAjax(receivableBillManagementService.updateReceivableBillManagement(receivableBillManagement)); |
| | | } /** |
| | | * 修改应收账单管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:edit')") |
| | | @PutMapping("aging") |
| | | public AjaxResult aging(@RequestBody ReceivableBillManagement receivableBillManagement) |
| | | { |
| | | return toAjax(receivableBillManagementService.aging(receivableBillManagement)); |
| | | } |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:edit')") |
| | | @PutMapping("account") |
| | | public AjaxResult account(@RequestBody ReceivableBillManagement receivableBillManagement) |
| | | { |
| | | return toAjax(receivableBillManagementService.account(receivableBillManagement)); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | return toAjax(receivableBillManagementService.deleteReceivableBillManagementByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 作废应收账单管理记录 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:void')") |
| | | @Log(title = "应收账单管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/void/{id}") |
| | | public AjaxResult voidReceivableBill(@PathVariable("id") Integer id) |
| | | { |
| | | return toAjax(receivableBillManagementService.voidReceivableBillManagement(id)); |
| | | } |
| | | |
| | | /** |
| | | * 应收账单申请开票 |
| | | * @param invoiceManage 发票管理对象 |
| | | * @param id 应收账单ID |
| | | * @return 结果 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:invoice')") |
| | | @Log(title = "应收账单管理", businessType = BusinessType.OTHER) |
| | | @PostMapping("/invoice/{id}") |
| | | public AjaxResult applyReceivableInvoice(@RequestBody InvoiceManage invoiceManage, @PathVariable("id") Integer id) |
| | | { |
| | | return invoiceManageService.applyReceivableInvoice(invoiceManage, id); |
| | | } |
| | | |
| | | /** |
| | | * 查询应收账单已开票金额 |
| | | * @param id 应收账单ID |
| | | * @return 已开票金额 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:query')") |
| | | @GetMapping("/invoice/amount/{id}") |
| | | public AjaxResult getReceivableInvoicedAmount(@PathVariable("id") Integer id) |
| | | { |
| | | // 查询receivable_invoice_business表中status为1的记录 |
| | | ReceivableInvoiceBusiness query = new ReceivableInvoiceBusiness(); |
| | | query.setHeadId(id); |
| | | query.setStatus(1); |
| | | List<ReceivableInvoiceBusiness> invoices = receivableInvoiceBusinessService.selectReceivableInvoiceBusinessList(query); |
| | | |
| | | // 计算已开票金额 |
| | | BigDecimal invoicedAmount = invoices.stream() |
| | | .map(ReceivableInvoiceBusiness::getInvoicingAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | return AjaxResult.success(invoicedAmount); |
| | | } |
| | | |
| | | /** |
| | | * 查询应收账单客户汇总列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:list')") |
| | | @GetMapping("/customerSummary") |
| | | public TableDataInfo customerSummary(ReceivableBillManagement receivableBillManagement) |
| | | { |
| | | List<ReceivableBillCustomerSummary> list = receivableBillManagementService.selectReceivableBillCustomerSummaryList(receivableBillManagement); |
| | | return getDataTable(list); |
| | | } |
| | | /** |
| | | * 导出应收账单管理列表 |
| | | * @param receivableBillManagement 查询条件对象 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:export')") |
| | | @GetMapping("/customerSummary/export") |
| | | public AjaxResult customerSummaryExport(ReceivableBillManagement receivableBillManagement,String exportKey) |
| | | { |
| | | receivableBillManagementService.customerSummaryExport(receivableBillManagement,exportKey); |
| | | return AjaxResult.success("导出请求成功,请稍后点击下载...!"); |
| | | } |
| | | |
| | | /** |
| | | * 查询应收账单账龄分析列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:list')") |
| | | @GetMapping("/agingAnalysis") |
| | | public TableDataInfo agingAnalysis(ReceivableBillManagement receivableBillManagement) |
| | | { |
| | | startPage(); |
| | | List<ReceivableBillAgingAnalysisVo> list = receivableBillManagementService.selectReceivableBillAgingAnalysisList(receivableBillManagement); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:export')") |
| | | @GetMapping("/agingAnalysis/export") |
| | | public AjaxResult agingAnalysisExport(ReceivableBillManagement receivableBillManagement,String exportKey) |
| | | { |
| | | receivableBillManagementService.agingAnalysisExport(receivableBillManagement,exportKey); |
| | | return AjaxResult.success("导出请求成功,请稍后点击下载...!"); |
| | | } |
| | | /** |
| | | * 查询应收账单账款分析列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:list')") |
| | | @GetMapping("/accountAnalysis") |
| | | public TableDataInfo accountAnalysis(ReceivableBillManagement receivableBillManagement) |
| | | { |
| | | startPage(); |
| | | List<ReceivableBillAccountAnalysisVo> list = receivableBillManagementService.selectReceivableBillAccountAnalysisList(receivableBillManagement); |
| | | return getDataTable(list); |
| | | } |
| | | @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:export')") |
| | | @GetMapping("/accountAnalysis/export") |
| | | public AjaxResult accountAnalysisExport(ReceivableBillManagement receivableBillManagement,String exportKey) |
| | | { |
| | | receivableBillManagementService.accountAnalysisExport(receivableBillManagement,exportKey); |
| | | return AjaxResult.success("导出请求成功,请稍后点击下载...!"); |
| | | } |
| | | |
| | | } |