LIVE_YE před 10 měsíci
rodič
revize
595c3b76db

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/StatisticsController.java

@@ -37,4 +37,13 @@ public class StatisticsController {
         return clockRecordService.kqdc();
     }
 
+    /**
+     * APP首页统计预约和订餐
+     */
+    @GetMapping(value = "/app/yydc")
+    public AjaxResult yydc()
+    {
+        return bomanReservatService.yydc();
+    }
+
 }

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IBomanReservatService.java

@@ -65,4 +65,5 @@ public interface IBomanReservatService
 
     AjaxResult weekAppointment();
 
+    AjaxResult yydc();
 }

+ 68 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanReservatServiceImpl.java

@@ -4,6 +4,8 @@ import java.util.*;
 
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.domain.OrderFood;
+import com.ruoyi.system.mapper.OrderFoodMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.BomanReservatMapper;
@@ -21,6 +23,8 @@ public class BomanReservatServiceImpl implements IBomanReservatService
 {
     @Autowired
     private BomanReservatMapper bomanReservatMapper;
+    @Autowired
+    private OrderFoodMapper orderFoodMapper;
 
     /**
      * 查询预约
@@ -133,7 +137,7 @@ public class BomanReservatServiceImpl implements IBomanReservatService
         if(lastList!=null && lastList.size()>0){
             yy = lastList.size();
         }
-        //周一到周日的访客人数
+        //周一到周日的预约人数
         List<String> yyList = new ArrayList<>();
         //周一到周日的到访人数
         List<String> fkList = new ArrayList<>();
@@ -163,4 +167,67 @@ public class BomanReservatServiceImpl implements IBomanReservatService
         return AjaxResult.success(resultMap);
     }
 
+    @Override
+    public AjaxResult yydc() {
+        Map<String, Object> resultMap = new HashMap<>();
+        //获取当前日期
+        String day = DateUtils.getDate();
+
+        BomanReservat bomanReservat = new BomanReservat();
+        bomanReservat.setVisitTime(day);
+        List<BomanReservat> lastList = bomanReservatMapper.selectBomanReservatTimeList(bomanReservat);
+        //本月来访数
+        int bylf = 0;
+        //本月预约数
+        int byyy = 0;
+        //今日来访
+        int jrlf = 0;
+        //今日预约
+        int jryy = 0;
+        if(lastList!=null && lastList.size()>0){
+            byyy = lastList.size();
+            for (BomanReservat reservat : lastList) {
+                if("2".equals(reservat.getVisitStatus())){
+                    bylf++;
+                    if(day.equals(reservat.getVisitTime())){
+                        jrlf++;
+                    }
+                }
+                if(day.equals(reservat.getVisitTime())){
+                    jryy++;
+                }
+            }
+        }
+
+        //订餐统计
+        OrderFood orderFood = new OrderFood();
+        orderFood.setOrderFoodTime(DateUtils.parseDate(day));
+        List<OrderFood> orderFoods = orderFoodMapper.selectOrderFoodList(orderFood);
+        //订餐总人数
+        int dczs = 0;
+        //订餐午餐人数
+        int dcwc = 0;
+        //订餐晚餐人数
+        int dcDinner = 0;
+        if(orderFoods!=null && orderFoods.size()>0){
+            dczs = orderFoods.size();
+            for (OrderFood food : orderFoods) {
+                if("1".equals(food.getOrderFoodType())){
+                    dcwc++;
+                }
+                if("2".equals(food.getOrderFoodType())){
+                    dcDinner++;
+                }
+            }
+        }
+        resultMap.put("bylf",bylf);
+        resultMap.put("byyy",byyy);
+        resultMap.put("jrlf",jrlf);
+        resultMap.put("jryy",jryy);
+        resultMap.put("dczs",dczs);
+        resultMap.put("dcwc",dcwc);
+        resultMap.put("dcDinner",dcDinner);
+        return AjaxResult.success(resultMap);
+    }
+
 }

+ 5 - 0
ruoyi-system/src/main/resources/mapper/system/BomanReservatMapper.xml

@@ -71,6 +71,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectBomanReservatVo"/>
         <where>
             <if test="visitStatus != null  and visitStatus != ''"> and visit_status = #{visitStatus}</if>
+
+            <if test="visitDate != null  and visitDate != ''">
+                AND date_format(visit_date,'%y%m') = date_format(#{visitDate},'%y%m')
+            </if>
+
             <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
                 AND visit_date &gt;= #{startTime}
             </if>