Browse Source

修改散客入住和营业报表

baiyun 1 year ago
parent
commit
8ce76afb04

+ 7 - 9
ruoyi-modules/ruoyi-backstage/src/main/resources/mapper/consumption/XfConsumeDetailMapper.xml

@@ -52,17 +52,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             account_name as accountName,
             case when #{groupByTerm} then term_name else '所有机器' end as termName,
             to_char(consume_date, #{dateFormat}) as consumeDate,
-            sum(case when meal_type = '1' and consume_money > 0 then consume_money else 0 end) as zaoCanJinE,
-            sum(case when meal_type = '1' and consume_money > 0 then 1 else 0 end) as zaoCanCiShu,
-            sum(case when meal_type = '2' and consume_money > 0 then consume_money else 0 end) as wuCanJinE,
-            sum(case when meal_type = '2' and consume_money > 0 then 1 else 0 end) as wuCanCiShu,
-            sum(case when meal_type = '3' and consume_money > 0 then consume_money else 0 end) as wanCanJinE,
-            sum(case when meal_type = '3' and consume_money > 0 then 1 else 0 end) as wanCanCiShu,
-            sum(case when meal_type = '4' and consume_money > 0 then consume_money else 0 end) as xiaoYeJinE,
-            sum(case when meal_type = '4' and consume_money > 0 then 1 else 0 end) as xiaoYeCiShu,
+            sum(case when meal_type = '1'  then consume_money else 0 end) as zaoCanJinE,
+            sum(case when meal_type = '1'  then 1 else 0 end) as zaoCanCiShu,
+            sum(case when meal_type = '2'  then consume_money else 0 end) as wuCanJinE,
+            sum(case when meal_type = '2'  then 1 else 0 end) as wuCanCiShu,
+            sum(case when meal_type in('3', '4')  then consume_money else 0 end) as wanCanJinE,
+            sum(case when meal_type in('3', '4')  then 1 else 0 end) as wanCanCiShu,
             sum(case when consume_money < 0 then consume_money else 0 end) as tuiKuanJinE,
             sum(case when consume_money < 0 then 1 else 0 end) as tuiKuanCiShu,
-            sum(case when consume_money > 0 then consume_money else 0 end) as xiaoJiJinE,
+            sum(consume_money) as xiaoJiJinE,
             sum(case when  consume_money > 0 then 1 else 0 end) as xiaoJiCiShu
         from
             t_xf_consumeDetail

+ 2 - 0
ruoyi-modules/ruoyi-hotel/src/main/java/org/dromara/hotel/service/impl/KfOrderServiceImpl.java

@@ -3,6 +3,7 @@ package org.dromara.hotel.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.collection.ListUtil;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -375,6 +376,7 @@ public class KfOrderServiceImpl implements IKfOrderService {
         String roomStatus = "";
         if (bo != null) {
             // 1. 修改订单状态
+            bo.setEndTime(DateUtil.date());
             flag = updateByBo(bo);
 
             // 2. 修改房间状态

+ 5 - 5
ruoyi-modules/ruoyi-hotel/src/main/resources/mapper/hotel/business/KfOrderMapper.xml

@@ -31,9 +31,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectPageByBo" resultType="org.dromara.hotel.domain.vo.KfOrderVo">
         select
             o.id,o.guest_id,g.name as guestName,o.team_id,o.team_name,o.room_code,o.room_name,o.start_time
-            ,o.end_time, o.order_status, o.order_type,o.plan_money,o.actual_money,o.remark,g.phone,g.sex,g.id_card as
-        idCard,
-            rt.room_type_name as guestRoomType, rt.bed_number as bedQuantity, o.order_index as orderIndex
+            ,o.end_time, o.order_status, o.order_type,o.plan_money,o.actual_money,o.remark,g.phone,g.sex
+            ,g.id_card as idCard,rt.room_type_name as guestRoomType, rt.bed_number as bedQuantity
+            , o.order_index as orderIndex,o.create_time as createTime
         from t_kf_order o
             left join t_kf_guest g on o.guest_id = g.id
             left join t_pt_room r on r.room_code = o.room_code
@@ -50,8 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="bo.teamName != null and bo.teamName != ''">
                 and o.team_name like concat('%', #{bo.teamName}, '%')
             </if>
-            <if test="bo.roomName != null and bo.roomName != ''">
-                and o.room_name like concat('%', #{bo.roomName}, '%')
+            <if test="bo.roomCode != null and bo.roomCode != ''">
+                and o.room_code like concat('%', #{bo.roomCode}, '%')
             </if>
             <if test="bo.orderStatusList != null and bo.orderStatusList.length > 0">
                 and o.order_status in