| | |
| | | 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.PayableBillManagement; |
| | | import com.ruoyi.cwgl.domain.PayableInvoiceBusiness; |
| | | import com.ruoyi.cwgl.service.IInvoiceManageService; |
| | | import com.ruoyi.cwgl.service.IPayableBillManagementService; |
| | | import com.ruoyi.cwgl.service.IPayableInvoiceBusinessService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | |
| | |
| | | { |
| | | @Autowired |
| | | private IPayableBillManagementService payableBillManagementService; |
| | | |
| | | @Autowired |
| | | private IInvoiceManageService invoiceManageService; |
| | | |
| | | @Autowired |
| | | private IPayableInvoiceBusinessService payableInvoiceBusinessService; |
| | | |
| | | |
| | | |
| | |
| | | { |
| | | return toAjax(payableBillManagementService.voidPayableBillManagement(id)); |
| | | } |
| | | |
| | | /** |
| | | * 应付账单申请开票 |
| | | * @param invoiceManage 发票管理对象 |
| | | * @param id 应付账单ID |
| | | * @return 结果 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('cwgl:payableBillManagement:invoice')") |
| | | @Log(title = "应付账单管理", businessType = BusinessType.OTHER) |
| | | @PostMapping("/invoice/{id}") |
| | | public AjaxResult applyPayableInvoice(@RequestBody InvoiceManage invoiceManage, @PathVariable("id") Integer id) |
| | | { |
| | | return invoiceManageService.applyPayableInvoice(invoiceManage, id); |
| | | } |
| | | |
| | | /** |
| | | * 查询应付账单已开票金额 |
| | | * @param id 应付账单ID |
| | | * @return 已开票金额 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('cwgl:payableBillManagement:query')") |
| | | @GetMapping("/invoice/amount/{id}") |
| | | public AjaxResult getPayableInvoicedAmount(@PathVariable("id") Integer id) |
| | | { |
| | | // 查询payable_invoice_business表中status为1的记录 |
| | | PayableInvoiceBusiness query = new PayableInvoiceBusiness(); |
| | | query.setHeadId(id); |
| | | query.setStatus(1); |
| | | List<PayableInvoiceBusiness> invoices = payableInvoiceBusinessService.selectPayableInvoiceBusinessList(query); |
| | | |
| | | // 计算已开票金额 |
| | | BigDecimal invoicedAmount = invoices.stream() |
| | | .map(PayableInvoiceBusiness::getInvoicingAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | return AjaxResult.success(invoicedAmount); |
| | | } |
| | | } |