From 615f6f7dbdd68b6ee8bbced785d8094ae4455482 Mon Sep 17 00:00:00 2001
From: Cui Zhi Feng <7426394+wuxixiaocui@user.noreply.gitee.com>
Date: 星期五, 13 九月 2024 09:17:45 +0800
Subject: [PATCH] 一键质检

---
 src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java b/src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java
index 2a11914..341ef37 100644
--- a/src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java
+++ b/src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java
@@ -34,6 +34,7 @@
 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;
@@ -179,6 +180,8 @@
     }
 
     public Page<DeliveryOrderStatisticsDTO> selectSupplierDoStatistics(Page page){
+
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
         LocalDate theDay = parseLocalDate("2024-08-03");
 
         long current = page.getCurrent();
@@ -187,7 +190,7 @@
         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);
 
@@ -207,6 +210,7 @@
                     , fivePm.plusDays(-1), fivePm);
 
             DeliveryOrderStatisticsDTO dto = new DeliveryOrderStatisticsDTO();
+            dto.setId(endDate.format(formatter));
             dto.setDate(endDate);
             dto.setNum(0);
             dto.setPrice(new BigDecimal(0));
@@ -219,11 +223,31 @@
         }
 
         page.setRecords(ls);
+
+
+        // 获取当前日期
+        LocalDate today = LocalDate.now();
+        // 计算当前日期与给定日期的天数差
+        long daysBetween = ChronoUnit.DAYS.between(theDay, today);
+        page.setTotal(daysBetween);
+
         return page;
     }
 
     public List<DeliveryOrderItemListDTO> getDeliveryOrderItems(String id) {
         return deliveryOrderItemMapper.selectDoItemList(id);
+    }
+
+    public List<DeliveryOrderItemDTO> getSupplierDeliveryOrderItems(String ids){
+        List<String> idList = splitParam(ids);
+        List<DeliveryOrderItemDTO> ls = new ArrayList<>();
+        if(idList != null && idList.size() > 0){
+            for(String id : idList){
+                ls.add(getSupplierDeliveryOrderItem(id));
+            }
+        }
+
+        return ls;
     }
 
     public DeliveryOrderItemDTO getSupplierDeliveryOrderItem(String id) {
@@ -370,6 +394,10 @@
         );
         if (count == 0) {
             Order o = orderMapper.selectById(orderId);
+            if(!Constants.ORDER_STATUS_BACKEND.COLLECTION.name().equals(o.getStatus())){
+                log.warn("非待集货状态,不可设置待发货");
+                return;
+            }
             o.setStatusBackend(Constants.ORDER_STATUS_BACKEND.SEND.name());
             o.update(SecurityUtils.getUserId());
             orderMapper.updateById(o);

--
Gitblit v1.9.3