| | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.purchase.dto.PaymentHistoryRecordVo; |
| | | import com.ruoyi.purchase.dto.PaymentLedgerDto; |
| | | import com.ruoyi.purchase.dto.PaymentRegistrationDto; |
| | | import com.ruoyi.purchase.mapper.*; |
| | |
| | | for (SupplierManage supplierManage : supplierManages) { |
| | | Map<String, Object> res = new HashMap<>(); |
| | | res.put("supplierName", supplierManage.getSupplierName()); |
| | | res.put("supplierId", supplierManage.getId()); |
| | | |
| | | // 应付金额计算 |
| | | BigDecimal payableAmount = BigDecimal.ZERO; |
| | |
| | | new LambdaQueryWrapper<ProductRecord>().eq(ProductRecord::getTicketRegistrationId, ticketRegistration.getId()) |
| | | ).stream() |
| | | .map(ProductRecord::getTicketsNum) |
| | | .map(BigDecimal::new) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | detail.put("voteCount", voteCount); |
| | |
| | | return paymentRegistrationMapper.paymentHistoryList(paymentRegistrationDto); |
| | | } |
| | | |
| | | /** |
| | | * 查询供应商往来记录 |
| | | * @param supplierId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PaymentHistoryRecordVo> getPaymentRecordList(Long supplierId) { |
| | | List<PaymentHistoryRecordVo> paymentRecordList = paymentRegistrationMapper.getPaymentRecordList(supplierId); |
| | | if(!CollectionUtils.isEmpty(paymentRecordList)) { |
| | | // 应付金额计算 |
| | | BigDecimal amountTotal = BigDecimal.ZERO; |
| | | for (PaymentHistoryRecordVo paymentHistoryRecordVo : paymentRecordList) { |
| | | if(paymentHistoryRecordVo.getType() == 0){ |
| | | amountTotal = amountTotal.subtract(paymentHistoryRecordVo.getCurrentPaymentAmount()); |
| | | } |
| | | if(paymentHistoryRecordVo.getType() == 1){ |
| | | amountTotal = amountTotal.add(paymentHistoryRecordVo.getInvoiceAmount()); |
| | | } |
| | | paymentHistoryRecordVo.setPayableAmount(amountTotal); |
| | | } |
| | | } |
| | | return paymentRecordList; |
| | | } |
| | | |
| | | // 批量查询采购台账(当月) |
| | | private Map<Long, List<PurchaseLedger>> batchQueryPurchaseLedgers(List<Long> supplierIds, LocalDate startDate, LocalDate endDate) { |
| | | LambdaQueryWrapper<PurchaseLedger> query = new LambdaQueryWrapper<>(); |