From a067fdbf6b1374a1402096c722257575916eab99 Mon Sep 17 00:00:00 2001
From: wjli <591616088@qq.com>
Date: 星期四, 11 五月 2023 16:21:14 +0800
Subject: [PATCH] 1.首页分段显示 2.配送订单页可根据分段显示 3.后端配送率统计

---
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java |  100 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 97 insertions(+), 3 deletions(-)

diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java
index 9d7d3a8..ac9f147 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java
@@ -20,6 +20,7 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.transaction.annotation.Transactional;
@@ -208,6 +209,47 @@
         return new ResultUtil<Object>().setData(map);
     }
 
+    @RequestMapping(value = "/getTodayCount", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇浠婃棩浠诲姟缁熻淇℃伅")
+    public Result<Object> getAllNew(String sendTime) {
+        Area area = getArea(securityUtil.getCurrUser().getId());
+        if (area == null) {
+            return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾璇ヨ溅杈�");
+        }
+
+        QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>();
+        String format = getFormatDate(sendTime);
+        wrapper2.eq("area_id", area.getId());
+        wrapper2.eq("send_date", format);
+        List<OrderTask> list = iOrderTaskService.list(wrapper2);
+
+        int sum = iOrderTaskService.sum(area.getId(), format);
+
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("count", list.size());
+        map.put("sum", sum);
+        map.put("name", "");
+        map.put("sectons", null);
+        if (list.size() > 0) {
+            Area areaName = iAreaService.getById(list.get(0).getAreaId());
+            List<String> temp = new ArrayList<>();
+            List<AreaSection> areaSections = new ArrayList<>();
+            for(int i=0;i<list.size();i++){
+                if(!temp.contains(list.get(i).getAreaSectionId())){
+                    AreaSection a = iAreaSectionService.getById(list.get(i).getAreaSectionId());
+                    temp.add(a.getName());
+                    areaSections.add(a);
+                }
+            }
+            map.put("name", areaName + StringUtils.join(temp,"-"));
+            map.put("sectons",areaSections);
+            temp.clear();
+            areaSections.clear();
+            list.clear();
+        }
+        return new ResultUtil<Object>().setData(map);
+    }
+
     @RequestMapping(value = "/getTodayOrder", method = RequestMethod.GET)
     @ApiOperation(value = "鑾峰彇浠婃棩閰嶉�佷换鍔¤鎯呭垪琛�")
     public Result<List<OrderTask>> getTodayOrder(String sendTime) {
@@ -234,11 +276,12 @@
 
     @RequestMapping(value = "/getTodayOrderByHulue", method = RequestMethod.GET)
     @ApiOperation(value = "鑾峰彇浠婃棩閰嶉�佷换鍔¤鎯呭垪琛�,蹇界暐鏌愯鍗�,瀹㈡埛绔笓鐢ㄦ帴鍙�")
-    public Result<OrderListVo> getTodayOrderFromHulue(String orderId, String sendTime) {
+    public Result<OrderListVo> getTodayOrderFromHulue(String orderId, String sendTime,String areaSectionId) {
         //蹇界暐璁㈠崟
         if (!StrUtil.isEmpty(orderId)) {
             OrderTask orderTask = iOrderTaskService.getById(orderId);
-            orderTask.setSeq(1000);
+            int seq = orderTask.getSeq();
+            orderTask.setSeq(1000+seq);
             iOrderTaskService.saveOrUpdate(orderTask);
         }
         //鑾峰彇璁㈠崟鍒楄〃
@@ -255,7 +298,10 @@
         //List<OrderTask> list = iOrderTaskService.list2(wrapper2);
         wrapper2.eq("area_id", area.getId());
         wrapper2.eq("send_date", format);
-        wrapper2.orderByAsc("seq").orderByAsc("status");
+        if(!StrUtil.isEmpty(areaSectionId)){
+            wrapper2.eq("area_section_id", areaSectionId);
+        }
+        wrapper2.orderByAsc("area_section_id").orderByAsc("seq").orderByAsc("status");
         List<OrderTask> list = iOrderTaskService.list(wrapper2);
         int num = 0;
         for (OrderTask obj : list) {
@@ -285,6 +331,7 @@
             return 0+ "%";
         }
     }
+
     @RequestMapping(value = "/getOneMonthOrderPercent", method = RequestMethod.GET)
     @ApiOperation(value = "鑾峰彇鏈湀閰嶉�佺櫨鍒嗘瘮")
     public Result<String> getMonthPercent(){
@@ -351,6 +398,53 @@
         return new ResultUtil<OrderTask>().setData(orderTask);
     }
 
+    @RequestMapping(value = "/getTodayOrderDetailByAreaSection", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇褰撳墠閰嶉�佸晢鎴疯鎯�")
+    public Result<OrderTask> getTodayOrderDetail(String orderId, String sendTime,String areaSectionId) {
+        OrderTask orderTask = new OrderTask();
+        if (!StrUtil.isEmpty(orderId)) {
+            orderTask = iOrderTaskService.getById(orderId);
+            if (orderTask.getStatus() != 0) {
+                return ResultUtil.error("姝ゅ晢鎴峰凡閰嶉��");
+            }
+        } else {
+            Area area = getArea(securityUtil.getCurrUser().getId());
+            if (area == null) {
+                return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾璇ヨ溅杈�");
+            }
+
+            QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>();
+            String format = getFormatDate(sendTime);
+            wrapper2.eq("area_id", area.getId());
+            wrapper2.eq("send_date", format);
+            wrapper2.eq("status", 0);
+            if(!StrUtil.isEmpty(areaSectionId)){
+                wrapper2.eq("area_section_Id", areaSectionId);
+            }
+            //wrapper2.orderByAsc("seq");
+
+            PageVo page = new PageVo();
+            page.setSort("seq");
+            page.setOrder("asc");
+            page.setPageSize(1);
+            page.setPageNumber(0);
+            List<OrderTask> list = iOrderTaskService.page(PageUtil.initMpPage(page), wrapper2).getRecords();
+            //List<OrderTask> list = iOrderTaskService.list(wrapper2);
+            if (list.size() > 0) {
+                orderTask = list.get(0);
+            } else {
+                return new ResultUtil<OrderTask>().setData(null);
+            }
+        }
+
+        orderTask.setCustomer(iCustomerService.getById(orderTask.getCustomerId()));
+        QueryWrapper<OrderDetail> wrapper3 = new QueryWrapper<OrderDetail>();
+        wrapper3.eq("order_id", orderTask.getId());
+        orderTask.setOrderDetails(iOrderDetailService.list(wrapper3));
+
+        return new ResultUtil<OrderTask>().setData(orderTask);
+    }
+
     @RequestMapping(value = "/getTodayOtherInfo", method = RequestMethod.GET)
     @ApiOperation(value = "鑾峰彇鍏跺畠淇℃伅")
     public Result<Object> getTodayOtherInfo(String sendTime) {

--
Gitblit v1.9.1