From 97cf3094ce37ee629ca6b948a9317a7ed1796c18 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期六, 07 九月 2024 17:56:29 +0800
Subject: [PATCH] 修改

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDataStatisticsController.java |   51 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDataStatisticsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDataStatisticsController.java
index 3bbf0a1..890755b 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDataStatisticsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDataStatisticsController.java
@@ -6,8 +6,11 @@
 import com.ruoyi.system.query.TDataStatisticsQuery;
 import com.ruoyi.system.service.TOrderMealService;
 import com.ruoyi.system.service.TOrderSaleService;
+import com.ruoyi.system.vo.OrderTrendsVO;
+import com.ruoyi.system.vo.PersonnelStatisticsVO;
 import com.ruoyi.system.vo.SalesRankingVO;
 import com.ruoyi.system.vo.SalesVolumeVO;
+import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -24,6 +27,7 @@
  * @author xiaochen
  * @since 2024-08-27
  */
+@Api(tags = "营业数据统计")
 @RestController
 @RequestMapping("/t-data-statistics")
 public class TDataStatisticsController {
@@ -129,7 +133,7 @@
 
     @ApiOperation( value = "下单趋势")
     @PostMapping(value = "/orderingTrends")
-    public AjaxResult<List<SalesRankingVO>> orderingTrends(@RequestBody TDataStatisticsQuery query) {
+    public AjaxResult<List<OrderTrendsVO>> orderingTrends(@RequestBody TDataStatisticsQuery query) {
         Integer roleType = tokenService.getLoginUser().getRoleType();
         Long objectId = tokenService.getLoginUser().getObjectId();
         query.setShopId(objectId);
@@ -162,13 +166,50 @@
         }
         query.setStartTime(startTime);
         query.setEndTime(endTime);
-        List<SalesRankingVO> salesRankingVOS;
+        List<OrderTrendsVO> orderTrendsVOS;
         if(roleType == 2){
-            salesRankingVOS = orderMealService.salesRanking(query);
+            orderTrendsVOS = orderMealService.orderingTrends(query);
         }else{
-            salesRankingVOS = orderSaleService.salesRanking(query);
+            orderTrendsVOS = orderSaleService.orderingTrends(query);
         }
-        return AjaxResult.success(salesRankingVOS);
+        return AjaxResult.success(orderTrendsVOS);
+    }
+
+    @ApiOperation( value = "接待人数统计")
+    @PostMapping(value = "/personnelStatistics")
+    public AjaxResult<List<PersonnelStatisticsVO>> personnelStatistics(@RequestBody TDataStatisticsQuery query) {
+        Long objectId = tokenService.getLoginUser().getObjectId();
+        query.setShopId(objectId);
+        if(Objects.isNull(query.getTimeType())){
+            query.setTimeType(1);
+        }
+        LocalDateTime startTime = null;
+        LocalDateTime endTime = null;
+        switch (query.getTimeType()){
+            case 1:
+                // 今日
+                startTime = LocalDateTime.MIN;
+                endTime = LocalDateTime.MAX;
+                break;
+            case 2:
+                // 昨日
+                startTime = LocalDateTime.now().minusDays(1);
+                endTime = LocalDateTime.now().minusDays(1);
+                break;
+            case 3:
+                // 近7天
+                startTime = LocalDateTime.now().minusDays(7);
+                endTime = LocalDateTime.now();
+                break;
+            case 4:
+                // 近30天
+                startTime = LocalDateTime.now().minusDays(30);
+                endTime = LocalDateTime.now();
+                break;
+        }
+        query.setStartTime(startTime);
+        query.setEndTime(endTime);
+        return AjaxResult.success(orderMealService.personnelStatistics(query));
     }
 
 

--
Gitblit v1.7.1