From a768dc3daa04d35fedfbe75c0a59b9b2545b85c4 Mon Sep 17 00:00:00 2001
From: gongzuming <gongzuming>
Date: 星期四, 19 九月 2024 16:59:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master-v2'

---
 src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java |   97 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 81 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java b/src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java
index 2af2b28..a2bf006 100644
--- a/src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java
+++ b/src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java
@@ -4,11 +4,13 @@
 import com.mzl.flower.base.BaseController;
 import com.mzl.flower.base.R;
 import com.mzl.flower.base.ReturnDataDTO;
+import com.mzl.flower.config.exception.ValidationException;
 import com.mzl.flower.constant.Constants;
 import com.mzl.flower.dto.request.payment.*;
 import com.mzl.flower.dto.response.flower.StationStatisticDTO;
 import com.mzl.flower.dto.response.payment.*;
 import com.mzl.flower.service.payment.DeliveryOrderService;
+import io.micrometer.core.instrument.util.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -35,20 +37,31 @@
 
     @GetMapping("/station/list")
     @ApiOperation(value = "查询我的集货站列表")
-    public ResponseEntity<ReturnDataDTO<List<StationStatisticDTO>>> statisticStationList(String name){
-        LocalDateTime now = LocalDateTime.now();
-        LocalDateTime towAm = LocalDate.now().atTime(2, 0, 0);
-        LocalDateTime fivePm = LocalDate.now().atTime(17, 0, 0);
+    public ResponseEntity<ReturnDataDTO<List<StationStatisticDTO>>> statisticStationList(String name
+            , String status, String date){
+        /*if(StringUtils.isEmpty(date)){
+            throw new ValidationException("请选择日期");
+        }*/
         LocalDateTime startDate;
         LocalDateTime endDate;
-        if(now.isAfter(towAm)){
-            startDate = fivePm.plusDays(-1);
-            endDate = fivePm;
+        LocalDate localDate = deliveryOrderService.parseLocalDate(date);
+        if(localDate != null){
+            endDate = localDate.atTime(17, 0, 0);
+            startDate = endDate.plusDays(-1);
         } else {
-            startDate = fivePm.plusDays(-2);
-            endDate = fivePm.plusDays(-1);
+            LocalDateTime now = LocalDateTime.now();
+            LocalDateTime towAm = LocalDate.now().atTime(2, 0, 0);
+            LocalDateTime fivePm = LocalDate.now().atTime(17, 0, 0);
+            if(now.isAfter(towAm)){
+                startDate = fivePm.plusDays(-1);
+                endDate = fivePm;
+            } else {
+                startDate = fivePm.plusDays(-2);
+                endDate = fivePm.plusDays(-1);
+            }
         }
-        return returnData(R.SUCCESS.getCode(), deliveryOrderService.statisticStationList(name,startDate,endDate));
+
+        return returnData(R.SUCCESS.getCode(), deliveryOrderService.statisticStationList(name, startDate, endDate, status));
     }
 
 
@@ -131,11 +144,29 @@
         return returnData(R.SUCCESS.getCode(), deliveryOrderService.getDeliveryOrderItem(id));
     }
 
+    @PostMapping("/list/items/views")
+    @ApiOperation(value = "获取商品详情列表")
+    public ResponseEntity<ReturnDataDTO<List<DeliveryOrderItemDTO>>> getDeliveryOrderItem(@RequestBody PostQueryDTO dto){
+        return returnData(R.SUCCESS.getCode(), deliveryOrderService.getDeliveryOrderItems(dto));
+    }
+
     //////////////////////////////////////////////////////////新接口
     @GetMapping("/check/list")
     @ApiOperation(value = "查询集货站供应商配送列表")
     public ResponseEntity<ReturnDataDTO<Page<DeliveryOrderList4CheckDTO>>> selectSupplierDoList4Check(Page page
             , DeliveryOrderStationQueryDTO dto){
+        String date = dto.getDate();
+        if(StringUtils.isEmpty(date)){
+            throw new ValidationException("请选择日期");
+        }
+        LocalDate localDate = deliveryOrderService.parseLocalDate(date);
+        if(localDate != null){
+            LocalDateTime end = localDate.atTime(17, 0, 0);
+            LocalDateTime begin = end.plusDays(-1);
+            dto.setStartDate(begin);
+            dto.setEndDate(end);
+        }
+
         return returnData(R.SUCCESS.getCode(), deliveryOrderService.selectSupplierDoList4Check(page, dto));
     }
 
@@ -179,6 +210,18 @@
     @ApiOperation(value = "查询供应商配送单列表")
     public ResponseEntity<ReturnDataDTO<Page<DeliveryOrder4CheckDTO>>> selectSupplierDoInfo4Check(Page page
             , DeliveryOrderInfoSpQueryDTO dto){
+        String date = dto.getDate();
+        if(StringUtils.isEmpty(date)){
+            throw new ValidationException("请选择日期");
+        }
+        LocalDate localDate = deliveryOrderService.parseLocalDate(date);
+        if(localDate != null){
+            LocalDateTime end = localDate.atTime(17, 0, 0);
+            LocalDateTime begin = end.plusDays(-1);
+            dto.setStartDate(begin);
+            dto.setEndDate(end);
+        }
+
         return returnData(R.SUCCESS.getCode(), deliveryOrderService.selectSupplierDoInfo4Check(page, dto));
     }
 
@@ -228,14 +271,14 @@
     @ApiOperation(value = "补货操作详情")
     public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getReplaceCheck(String orderItemId){
         return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId
-                , Constants.CHECK_TYPE.replace.name()));
+                , Constants.CHECK_TYPE.replace.name(), false));
     }
 
     @GetMapping("/check/info/lack")
     @ApiOperation(value = "缺货操作详情")
     public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getLackCheck(String orderItemId){
         return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId
-                , Constants.CHECK_TYPE.lack.name()));
+                , Constants.CHECK_TYPE.lack.name(), false));
     }
 
     @PostMapping("/check/info/do/reduce")
@@ -304,11 +347,34 @@
     }
 
     @GetMapping("/check/list/complete")
-    @ApiOperation(value = "一键质检(只能完成当天的,且必须点一下才会修改订单状态)")
+    @ApiOperation(value = "一键质检")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "供应商id", required = true, dataType = "Long", paramType = "query")
+            @ApiImplicitParam(name = "id", value = "供应商id", required = true, dataType = "Long", paramType = "query"),
+            @ApiImplicitParam(name = "date", value = "日期(yyyy-MM-dd)", required = true, dataType = "String", paramType = "query"),
     })
-    public ResponseEntity<ReturnDataDTO> completeCheck(Long id) {
+    public ResponseEntity<ReturnDataDTO> completeCheck(Long id, String date) {
+        if(StringUtils.isEmpty(date)){
+            throw new ValidationException("请选择日期");
+        }
+        LocalDateTime startDate = null;
+        LocalDateTime endDate = null;
+        LocalDate localDate = deliveryOrderService.parseLocalDate(date);
+        if(localDate != null){
+            endDate = localDate.atTime(17, 0, 0);
+            startDate = endDate.plusDays(-1);
+        }
+
+        List<String> orderIds = deliveryOrderService.completeSupplierCheck(id, startDate, endDate);
+        deliveryOrderService.checkOrdersStatus(orderIds);
+        return returnData(R.SUCCESS.getCode(), null);
+    }
+
+    @GetMapping("/check/list/complete/today")
+    @ApiOperation(value = "一键质检(今日)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "供应商id", required = true, dataType = "Long", paramType = "query"),
+    })
+    public ResponseEntity<ReturnDataDTO> completeCheckToday(Long id) {
         LocalDateTime now = LocalDateTime.now();
         LocalDateTime towAm = LocalDate.now().atTime(2, 0, 0);
         LocalDateTime fivePm = LocalDate.now().atTime(17, 0, 0);
@@ -321,7 +387,6 @@
             startDate = fivePm.plusDays(-2);
             endDate = fivePm.plusDays(-1);
         }
-
         List<String> orderIds = deliveryOrderService.completeSupplierCheck(id, startDate, endDate);
         deliveryOrderService.checkOrdersStatus(orderIds);
         return returnData(R.SUCCESS.getCode(), null);

--
Gitblit v1.9.3