| | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | } |
| | | |
| | | public Page<DeliveryOrderStatisticsDTO> selectSupplierDoStatistics(Page page){ |
| | | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); |
| | | LocalDate theDay = parseLocalDate("2024-08-03"); |
| | | |
| | | long current = page.getCurrent(); |
| | |
| | | current = current == 0 ? 1 : current; |
| | | |
| | | long endDays = (current - 1) * size; |
| | | long beginDays = endDays + size; |
| | | long beginDays = endDays + size-1; |
| | | LocalDate beginDate = now.plusDays(-beginDays); |
| | | LocalDate endDate = now.plusDays(-endDays); |
| | | |
| | |
| | | , fivePm.plusDays(-1), fivePm); |
| | | |
| | | DeliveryOrderStatisticsDTO dto = new DeliveryOrderStatisticsDTO(); |
| | | dto.setId(endDate.format(formatter)); |
| | | dto.setDate(endDate); |
| | | dto.setNum(0); |
| | | dto.setPrice(new BigDecimal(0)); |
| | |
| | | } |
| | | |
| | | page.setRecords(ls); |
| | | |
| | | |
| | | // 获取当前日期 |
| | | LocalDate today = LocalDate.now(); |
| | | // 计算当前日期与给定日期的天数差 |
| | | long daysBetween = ChronoUnit.DAYS.between(theDay, today); |
| | | page.setTotal(daysBetween); |
| | | |
| | | return page; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | Integer orderCountToday = deliveryOrderMapper.selectCount(new QueryWrapper<DeliveryOrder>() |
| | | .eq("deleted", 0) |
| | | .eq("supplier_id", supplierId) |
| | | .gt("create_time", startDate) |
| | | .le("create_time", endDate)); |
| | | dto.setOrderCountToday(orderCountToday == null ? 0 : orderCountToday); |
| | | |
| | | Integer orderCountYesterday = deliveryOrderMapper.selectCount(new QueryWrapper<DeliveryOrder>() |
| | | .eq("deleted", 0) |
| | | .eq("supplier_id", supplierId) |
| | | .gt("create_time", startDate.plusDays(-1)) |
| | | .le("create_time", endDate.plusDays(-1))); |
| | |
| | | |
| | | LocalDateTime ffPm = LocalDate.now().withDayOfMonth(1).atTime(17, 0, 0).plusDays(-1); |
| | | Integer orderCountMonth = deliveryOrderMapper.selectCount(new QueryWrapper<DeliveryOrder>() |
| | | .eq("deleted", 0) |
| | | .eq("supplier_id", supplierId) |
| | | .gt("create_time", ffPm)); |
| | | dto.setOrderCountMonth(orderCountMonth == null ? 0 : orderCountMonth); |
| | | |
| | | BigDecimal salesRate = new BigDecimal(0); |
| | | Integer orderTotal = deliveryOrderMapper.selectCount(new QueryWrapper<DeliveryOrder>() |
| | | .eq("supplier_id", supplierId)); |
| | | .eq("deleted", 0) |
| | | .eq("supplier_id", supplierId) |
| | | ); |
| | | Integer salesCount = orderItemSalesMapper.getSupplierSalesCount(supplierId); |
| | | if (orderTotal != null && orderTotal > 0) { |
| | | BigDecimal rate = new BigDecimal(salesCount).divide(new BigDecimal(orderTotal), 2, RoundingMode.HALF_UP); |