| | |
| | | homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthPurchaseHaveMoney(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | |
| | | // 上月销售金额 |
| | | YearMonth lastMonth = currentMonth.minusMonths(1); |
| | | LambdaQueryWrapper<SalesLedger> lastMonthSalesWrapper = new LambdaQueryWrapper<>(); |
| | | lastMonthSalesWrapper.ge(SalesLedger::getEntryDate, lastMonth.atDay(1).atStartOfDay()) |
| | | .lt(SalesLedger::getEntryDate, lastMonth.plusMonths(1).atDay(1).atStartOfDay()); |
| | | List<SalesLedger> lastMonthSalesLedgers = salesLedgerMapper.selectList(lastMonthSalesWrapper); |
| | | if (!CollectionUtils.isEmpty(lastMonthSalesLedgers)) { |
| | | BigDecimal lastMonthContractAmount = lastMonthSalesLedgers.stream() |
| | | .map(SalesLedger::getContractAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | homeBusinessDto.setLastMonthSaleMoney(lastMonthContractAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | |
| | | // 上月采购金额 |
| | | LambdaQueryWrapper<PurchaseLedger> lastMonthPurchaseWrapper = new LambdaQueryWrapper<>(); |
| | | lastMonthPurchaseWrapper.ge(PurchaseLedger::getEntryDate, lastMonth.atDay(1).atStartOfDay()) |
| | | .lt(PurchaseLedger::getEntryDate, lastMonth.plusMonths(1).atDay(1).atStartOfDay()); |
| | | List<PurchaseLedger> lastMonthPurchaseLedgers = purchaseLedgerMapper.selectList(lastMonthPurchaseWrapper); |
| | | if (!CollectionUtils.isEmpty(lastMonthPurchaseLedgers)) { |
| | | BigDecimal lastMonthPurchaseAmount = lastMonthPurchaseLedgers.stream() |
| | | .map(PurchaseLedger::getContractAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | homeBusinessDto.setLastMonthPurchaseMoney(lastMonthPurchaseAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | |
| | | // 统计库存 |
| | | BigDecimal stockQuantityTotal = stockInventoryMapper.selectTotal(); |
| | | homeBusinessDto.setInventoryNum(stockQuantityTotal.setScale(2, RoundingMode.HALF_UP).toString()); |