昨天 d096516873552404eac98ee7c1d37490af9e8340
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -61,6 +61,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
@@ -497,9 +498,20 @@
    @Override
    public ProductionProgressDto productionProgress() {
        LocalDateTime now = LocalDateTime.now();
        LocalDateTime startOfMonth = now
                .with(TemporalAdjusters.firstDayOfMonth())
                .with(LocalTime.MIN);
        LocalDateTime endOfMonth = now
                .with(TemporalAdjusters.lastDayOfMonth())
                .with(LocalTime.MAX);
        ProductionProgressDto productionProgressDto = new ProductionProgressDto();
        List<ProductionProgressOrderDto> orderDetails = productionOrderMapper.selectProgressOrders(
                LocalDateTime.now().minusMonths(1), LocalDateTime.now());
        List<ProductionProgressOrderDto> orderDetails = productionOrderMapper
                .selectProgressOrders(startOfMonth, endOfMonth);
        productionProgressDto.setCompletedOrderDetails(orderDetails);
        long totalCount = orderDetails.size();
        long count = orderDetails.stream().filter(
@@ -543,15 +555,22 @@
                .collect(Collectors.groupingBy(ProductionTaskStatisticsDto::getProcessName));
        List<String> strings = new ArrayList<>();
        List<Long> processQuantityDetails = new ArrayList<>();
        List<String> processColors = new ArrayList<>();
        map.entrySet().stream().forEach(entry -> {
            String key = entry.getKey();
            long completeSum = entry.getValue().stream().map(ProductionTaskStatisticsDto::getCompleteQuantity)
                    .mapToLong(BigDecimal::longValue).sum();
            strings.add(key);
            processQuantityDetails.add(completeSum);
            processColors.add(entry.getValue().stream()
                    .map(ProductionTaskStatisticsDto::getProcessColor)
                    .filter(Objects::nonNull)
                    .findFirst()
                    .orElse(null));
        });
        productionTurnoverDto.setProcessDetails(strings);
        productionTurnoverDto.setProcessQuantityDetails(processQuantityDetails);
        productionTurnoverDto.setProcessColors(processColors);
        return productionTurnoverDto;
    }
@@ -1433,11 +1452,19 @@
            return new ArrayList<>();
        }
        Map<String, String> processColorMap = new HashMap<>();
        list.forEach(item -> {
            if (item.getProcessName() != null && item.getProcessColor() != null) {
                processColorMap.putIfAbsent(item.getProcessName(), item.getProcessColor());
            }
        });
        List<MapDto> result = new ArrayList<>();
        processOutputMap.forEach((name, value) -> {
            MapDto dto = new MapDto();
            dto.setName(name);
            dto.setValue(value.stripTrailingZeros().toPlainString());
            dto.setColor(processColorMap.get(name));
            BigDecimal rate = value
                    .divide(total, 4, RoundingMode.HALF_UP)
@@ -1625,16 +1652,16 @@
    @Override
    public List<MapDto> orderCount() {
        LocalDate now = LocalDate.now();
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String currentStart = now.withDayOfMonth(1).atStartOfDay()
                .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        String currentEnd = now.atTime(LocalTime.MAX).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        LocalDateTime startDateTime = now.with(TemporalAdjusters.firstDayOfMonth()).atStartOfDay();
        LocalDateTime endDateTime = now.with(TemporalAdjusters.lastDayOfMonth()).atTime(LocalTime.MAX);
        LocalDate lastMonthDate = now.minusMonths(1);
        String lastStart = lastMonthDate.withDayOfMonth(1).atStartOfDay()
                .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        String lastEnd = lastMonthDate.withDayOfMonth(lastMonthDate.lengthOfMonth()).atTime(LocalTime.MAX)
                .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        String currentStart = startDateTime.format(dateTimeFormatter);
        String currentEnd = endDateTime.format(dateTimeFormatter);
        String lastStart = startDateTime.minusMonths(1).format(dateTimeFormatter);
        String lastEnd = endDateTime.format(dateTimeFormatter);
        int currentCreated = productionOrderMapper.countCreated(currentStart, currentEnd);
        int lastCreated = productionOrderMapper.countCreated(lastStart, lastEnd);