| | |
| | | map.put("total", new BigDecimal(totalOrders)); |
| | | map.put("shipRate", "0.00%"); |
| | | |
| | | // 发货率 |
| | | // 产品销售数量 |
| | | List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(new LambdaQueryWrapper<SalesLedgerProduct>() |
| | | .eq(SalesLedgerProduct::getType, 1)); |
| | | BigDecimal productQuantityTotal = CollectionUtils.isEmpty(products) ? BigDecimal.ZERO : |
| | | products.stream() |
| | | .map(SalesLedgerProduct::getQuantity) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map.put("productQuantityTotal", productQuantityTotal); |
| | | |
| | | if (CollectionUtils.isEmpty(products)) { |
| | | return AjaxResult.success(map); |
| | | } |
| | |
| | | List<String> dateList = new ArrayList<>(); |
| | | List<BigDecimal> orderCountList = new ArrayList<>(); |
| | | List<BigDecimal> salesAmountList = new ArrayList<>(); |
| | | List<BigDecimal> productQuantityList = new ArrayList<>(); |
| | | List<BigDecimal> shippingRateList = new ArrayList<>(); |
| | | |
| | | Calendar tempCalendar = Calendar.getInstance(); |
| | |
| | | if (dto != null) { |
| | | orderCountList.add(new BigDecimal(dto.getOrderCount())); |
| | | salesAmountList.add(dto.getSalesAmount() != null ? dto.getSalesAmount() : BigDecimal.ZERO); |
| | | productQuantityList.add(dto.getProductQuantity() != null ? dto.getProductQuantity() : BigDecimal.ZERO); |
| | | shippingRateList.add(new BigDecimal(String.valueOf(dto.getShipRate()))); |
| | | } else { |
| | | orderCountList.add(BigDecimal.ZERO); |
| | | salesAmountList.add(BigDecimal.ZERO); |
| | | productQuantityList.add(BigDecimal.ZERO); |
| | | shippingRateList.add(BigDecimal.ZERO); |
| | | } |
| | | |
| | |
| | | map.put("dateList", dateList); |
| | | map.put("orderCountList", orderCountList); |
| | | map.put("salesAmountList", salesAmountList); |
| | | map.put("productQuantityList", productQuantityList); |
| | | map.put("shippingRateList", shippingRateList); |
| | | return AjaxResult.success(map); |
| | | } |