| | |
| | | BigDecimal noInvoiceAmountTotal = salesLedgerProducts.stream().map(SalesLedgerProduct::getNoInvoiceAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | homeBusinessDto.setMonthSaleMoney(contractAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthSaleHaveMoney(noInvoiceAmountTotal.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthSaleMoney(contractAmount.setScale(3, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthSaleHaveMoney(noInvoiceAmountTotal.setScale(3, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | // 创建LambdaQueryWrapper |
| | | LambdaQueryWrapper<PurchaseLedger> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthPurchaseHaveMoney(unReceiptPaymentAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(3, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthPurchaseHaveMoney(unReceiptPaymentAmount.setScale(3, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | // 统计库存 |
| | | BigDecimal stockQuantityTotal = stockInventoryMapper.selectTotal(); |
| | | homeBusinessDto.setInventoryNum(stockQuantityTotal.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setInventoryNum(stockQuantityTotal.setScale(3, RoundingMode.HALF_UP).toString()); |
| | | |
| | | // 获取当天入库数量 |
| | | BigDecimal bigDecimal = stockInventoryMapper.selectTotalByDate(LocalDate.now()); |
| | | homeBusinessDto.setTodayInventoryNum(bigDecimal.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setTodayInventoryNum(bigDecimal.setScale(3, RoundingMode.HALF_UP).toString()); |
| | | return homeBusinessDto; |
| | | } |
| | | |
| | |
| | | analysisCustomerContractAmountsDto.setChain(chain); |
| | | |
| | | Map<String, BigDecimal> collect = salesLedgers.stream() |
| | | .collect(Collectors.groupingBy(SalesLedger::getCustomerName, Collectors.reducing(BigDecimal.ZERO, |
| | | SalesLedger::getContractAmount, BigDecimal::add))); |
| | | .collect(Collectors.groupingBy( |
| | | salesLedger -> StringUtils.isBlank(salesLedger.getCustomerName()) ? "未分配客户" : salesLedger.getCustomerName(), |
| | | Collectors.reducing(BigDecimal.ZERO, |
| | | salesLedger -> Objects.nonNull(salesLedger.getContractAmount()) |
| | | ? salesLedger.getContractAmount() : BigDecimal.ZERO, |
| | | BigDecimal::add))); |
| | | List<MapDto> mapDtos = new ArrayList<>(); |
| | | collect.forEach((k, v) -> { |
| | | MapDto mapDto = new MapDto(); |
| | |
| | | public ProductionTurnoverDto workInProcessTurnover() { |
| | | ProductionTurnoverDto productionTurnoverDto = new ProductionTurnoverDto(); |
| | | ProductWorkOrderDto workOrder = new ProductWorkOrderDto(); |
| | | workOrder.setPlanStartTime(LocalDate.now().minusMonths(1)); |
| | | workOrder.setPlanEndTime(LocalDate.now()); |
| | | workOrder.setPlanStartTime(LocalDateTime.now().minusMonths(1)); |
| | | workOrder.setPlanEndTime(LocalDateTime.now()); |
| | | List<ProductWorkOrderDto> productWorkOrders = productWorkOrderMapper |
| | | .pageProductWorkOrder(new Page<>(1, -1), workOrder).getRecords(); |
| | | long sum = productWorkOrders.stream() |
| | |
| | | @Override |
| | | public List<MapDto> processOutputAnalysis(Integer type) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate startDate; |
| | | LocalDate endDate = today; |
| | | LocalDateTime startDate; |
| | | LocalDateTime endDate = today.atTime(23, 59, 59); |
| | | |
| | | switch (type) { |
| | | case 1: // 周 |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | startDate = today.with(DayOfWeek.MONDAY).atStartOfDay(); |
| | | break; |
| | | case 2: // 月 |
| | | startDate = today.withDayOfMonth(1); |
| | | startDate = today.withDayOfMonth(1).atStartOfDay(); |
| | | break; |
| | | case 3: // 季度 |
| | | int currentMonth = today.getMonthValue(); |
| | | int startMonth = ((currentMonth - 1) / 3) * 3 + 1; |
| | | startDate = LocalDate.of(today.getYear(), startMonth, 1); |
| | | startDate = LocalDate.of(today.getYear(), startMonth, 1).atStartOfDay(); |
| | | break; |
| | | default: |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | startDate = today.with(DayOfWeek.MONDAY).atStartOfDay(); |
| | | break; |
| | | } |
| | | |