Quellcode durchsuchen

按季度/年收入汇总统计

gqx vor 2 Jahren
Ursprung
Commit
e833f09ba2

+ 161 - 51
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/finance/mapper/SummaryMapper.java

@@ -20,10 +20,11 @@ import java.util.List;
  * @Date:   2023-04-19
  * @Version: V1.0
  */
-public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
+public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
 
     /**
      * 收款汇总统计全部
+     *
      * @param page
      * @param busRoomPayTypes
      * @param hotelId
@@ -32,35 +33,36 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
      * @return
      */
     @Select("<script>select max(h.name) as hotel_name,'POS' as department\n" +
-            "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>"+
+            "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>" +
             "SUM(case ogp.payment_method when '${item.id}' then ogp.pay_money else 0 end) as '${item.name}'\n" +
-            "</foreach>"+
+            "</foreach>" +
             "from bus_hotel_info h\n" +
             "inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
             "left join pos_order_goods_payment ogp on pty.id=ogp.payment_method\n" +
             "where 1=1" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>"+
-            "<if test='startTime != null'> and ogp.create_time &gt;= #{startTime} </if>"+
-            "<if test='endTime != null'> and ogp.create_time &lt;= #{endTime} </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>" +
+            "<if test='startTime != null'> and ogp.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and ogp.create_time &lt;= #{endTime} </if>" +
             "group by h.id\n" +
             "UNION ALL\n" +
             "select max(h.name) as hotel_name,'客房' as department\n" +
-            "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>"+
+            "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>" +
             "SUM(case of.pay_type when '${item.id}' then of.money else 0 end) as '${item.name}'\n" +
-            "</foreach>"+
+            "</foreach>" +
             "from bus_hotel_info h\n" +
             "inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
             "left join bus_order_fee of on pty.id=of.pay_type\n" +
             "where of.fee_type=2 and of.preferential_status=2" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>"+
-            "<if test='startTime != null'> and of.create_time &gt;= #{startTime} </if>"+
-            "<if test='endTime != null'> and of.create_time &lt;= #{endTime} </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>" +
+            "<if test='startTime != null'> and of.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and of.create_time &lt;= #{endTime} </if>" +
             "group by h.id</script>")
-    public List<HashMap<String,Object>> pageList(Page<HashMap<String,Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+    public List<HashMap<String, Object>> pageList(Page<HashMap<String, Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
 
 
     /**
      * 收款汇总统计POS
+     *
      * @param page
      * @param busRoomPayTypes
      * @param hotelId
@@ -69,21 +71,22 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
      * @return
      */
     @Select("<script>select max(h.name) as hotel_name,'POS' as department\n" +
-            "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>"+
+            "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>" +
             "SUM(case ogp.payment_method when '${item.id}' then ogp.pay_money else 0 end) as '${item.name}'\n" +
-            "</foreach>"+
+            "</foreach>" +
             "from bus_hotel_info h\n" +
             "inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
             "left join pos_order_goods_payment ogp on pty.id=ogp.payment_method\n" +
             "where 1=1" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>"+
-            "<if test='startTime != null'> and ogp.create_time &gt;= #{startTime} </if>"+
-            "<if test='endTime != null'> and ogp.create_time &lt;= #{endTime} </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>" +
+            "<if test='startTime != null'> and ogp.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and ogp.create_time &lt;= #{endTime} </if>" +
             "group by h.id</script>")
-    public List<HashMap<String,Object>> posPageList(Page<HashMap<String,Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+    public List<HashMap<String, Object>> posPageList(Page<HashMap<String, Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
 
     /**
      * 收款汇总统计全部
+     *
      * @param page
      * @param busRoomPayTypes
      * @param hotelId
@@ -92,22 +95,23 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
      * @return
      */
     @Select("<script>select max(h.name) as hotel_name,'客房' as department\n" +
-            "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>"+
+            "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>" +
             "SUM(case of.pay_type when '${item.id}' then of.money else 0 end) as '${item.name}'\n" +
-            "</foreach>"+
+            "</foreach>" +
             "from bus_hotel_info h\n" +
             "inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
             "left join bus_order_fee of on pty.id=of.pay_type\n" +
             "where of.fee_type=2 and of.preferential_status=2" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>"+
-            "<if test='startTime != null'> and of.create_time &gt;= #{startTime} </if>"+
-            "<if test='endTime != null'> and of.create_time &lt;= #{endTime} </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>" +
+            "<if test='startTime != null'> and of.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and of.create_time &lt;= #{endTime} </if>" +
             "group by h.id</script>")
-    public List<HashMap<String,Object>> roomPageList(Page<HashMap<String,Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+    public List<HashMap<String, Object>> roomPageList(Page<HashMap<String, Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
 
 
     /**
      * 收退款明细列表
+     *
      * @param page
      * @param hotelId
      * @param startTime
@@ -119,9 +123,9 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
             "from pos_order_goods_payment ogp \n" +
             "left join bus_room_pay_type_info pty on pty.id=ogp.payment_method\n" +
             "where 1=1" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and ogp.hotel_id = #{hotelId} </if>"+
-            "<if test='startTime != null'> and ogp.create_time &gt;= #{startTime} </if>"+
-            "<if test='endTime != null'> and ogp.create_time &lt;= #{endTime} </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and ogp.hotel_id = #{hotelId} </if>" +
+            "<if test='startTime != null'> and ogp.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and ogp.create_time &lt;= #{endTime} </if>" +
             "UNION ALL\n" +
             "select '住客' as department,pty.name as payment_method_name,\n" +
             "case when of.money>=0 then '收款' else '退款' end as fee_type,\n" +
@@ -132,15 +136,16 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
             "left join ces_rooms r on r.id=of.room_id\n" +
             "left join bus_customer c on c.id=rlo.contact_id\n" +
             "where of.fee_type=2 and of.preferential_status=2" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and pty.hotel_id = #{hotelId} </if>"+
-            "<if test='startTime != null'> and of.create_time &gt;= #{startTime} </if>"+
-            "<if test='endTime != null'> and of.create_time &lt;= #{endTime} </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and pty.hotel_id = #{hotelId} </if>" +
+            "<if test='startTime != null'> and of.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and of.create_time &lt;= #{endTime} </if>" +
             "</script>")
-    public List<HashMap<String,Object>> financePage(Page<HashMap<String,Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+    public List<HashMap<String, Object>> financePage(Page<HashMap<String, Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
 
 
     /**
      * POS收退款明细列表
+     *
      * @param page
      * @param hotelId
      * @param startTime
@@ -152,14 +157,15 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
             "from pos_order_goods_payment ogp \n" +
             "left join bus_room_pay_type_info pty on pty.id=ogp.payment_method\n" +
             "where 1=1" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and ogp.hotel_id = #{hotelId} </if>"+
-            "<if test='startTime != null'> and ogp.create_time &gt;= #{startTime} </if>"+
-            "<if test='endTime != null'> and ogp.create_time &lt;= #{endTime} </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and ogp.hotel_id = #{hotelId} </if>" +
+            "<if test='startTime != null'> and ogp.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and ogp.create_time &lt;= #{endTime} </if>" +
             "</script>")
-    public List<HashMap<String,Object>> postFinancePage(Page<HashMap<String,Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+    public List<HashMap<String, Object>> postFinancePage(Page<HashMap<String, Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
 
     /**
      * 住客收退款明细列表
+     *
      * @param page
      * @param hotelId
      * @param startTime
@@ -175,14 +181,15 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
             "left join ces_rooms r on r.id=of.room_id\n" +
             "left join bus_customer c on c.id=rlo.contact_id\n" +
             "where of.fee_type=2 and of.preferential_status=2" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and pty.hotel_id = #{hotelId} </if>"+
-            "<if test='startTime != null'> and of.create_time &gt;= #{startTime} </if>"+
-            "<if test='endTime != null'> and of.create_time &lt;= #{endTime} </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and pty.hotel_id = #{hotelId} </if>" +
+            "<if test='startTime != null'> and of.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and of.create_time &lt;= #{endTime} </if>" +
             "</script>")
-    public List<HashMap<String,Object>> roomFinancePage(Page<HashMap<String,Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+    public List<HashMap<String, Object>> roomFinancePage(Page<HashMap<String, Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
 
     /**
      * 按时间每天收入统计列表
+     *
      * @param hotelId
      * @param startTime
      * @param endTime
@@ -205,7 +212,7 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
             "\t) a\n" +
             "\tLEFT JOIN \n" +
             "\t( SELECT id,create_time,pay_money FROM pos_order_goods_payment where 1=1" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = #{hotelId} </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = #{hotelId} </if>" +
             ") b\n" +
             "\tON a.time =date(b.create_time)\n" +
             "GROUP BY a.time\t\n" +
@@ -226,15 +233,16 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
             "\t) a\n" +
             "\tLEFT JOIN \n" +
             "\t( SELECT * FROM bus_order_fee where fee_type=1 and preferential_status=2" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = #{hotelId} </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = #{hotelId} </if>" +
             ") b\n" +
             "\tON a.time =date(b.create_time)\n" +
             "GROUP BY a.time)t\n" +
             "group by time\t</script>")
-    public List<HashMap<String,Object>> dayShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+    public List<HashMap<String, Object>> dayShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
 
     /**
      * 按时间每月收入统计列表
+     *
      * @param hotelId
      * @param startTime
      * @param endTime
@@ -249,15 +257,15 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
             "\tselect DATE_FORMAT(time, '%Y-%m' ) as time from\n" +
             "\t(select adddate('${startTime}',INTERVAL  t0.i MONTH ) AS time from\n" +
             "\t (select 0 i " +
-            "<foreach item='item' index='index' collection='months' open=' union ' separator=' union ' close=' '>"+
-            " select ${item}"+
-            "</foreach>"+
+            "<foreach item='item' index='index' collection='months' open=' union ' separator=' union ' close=' '>" +
+            " select ${item}" +
+            "</foreach>" +
             ") t0) v\n" +
             "\tORDER BY time\n" +
             "\t) a\n" +
             "\tLEFT JOIN \n" +
             "\t( SELECT id,create_time,pay_money FROM pos_order_goods_payment where 1=1" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
             ") b\n" +
             "\tON a.time =DATE_FORMAT(b.create_time, '%Y-%m' )\n" +
             "GROUP BY a.time\t\n" +
@@ -269,18 +277,120 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment>  {
             "\tselect DATE_FORMAT(time, '%Y-%m' ) as time from\n" +
             "\t(select adddate('${startTime}',INTERVAL  t0.i MONTH ) AS time from\n" +
             "\t (select 0 i " +
-            "<foreach item='item' index='index' collection='months' open=' union ' separator=' union ' close=' '>"+
-            " select ${item}"+
-            "</foreach>"+
+            "<foreach item='item' index='index' collection='months' open=' union ' separator=' union ' close=' '>" +
+            " select ${item}" +
+            "</foreach>" +
             ") t0) v\n" +
             "\tORDER BY time\n" +
             "\t) a\n" +
             "\tLEFT JOIN \n" +
             "\t( SELECT * FROM bus_order_fee where fee_type=1 and preferential_status=2\n" +
-            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>"+
+            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
             "\t) b ON a.time =DATE_FORMAT(b.create_time, '%Y-%m' )\n" +
             "GROUP BY a.time)t\n" +
             "group by time\t</script>")
-    public List<HashMap<String,Object>> monthShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime, @Param("months") List<Integer> months);
+    public List<HashMap<String, Object>> monthShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime, @Param("months") List<Integer> months);
+
+    /**
+     * 按时间每季度收入统计列表
+     *
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @param quarters
+     * @return
+     */
+    @Select("<script>select time,sum(room_money) as room_money,sum(other_money) as other_money from \n" +
+            "(SELECT 'pos' as type, a.time\n" +
+            ",0 AS room_money,\n" +
+            "sum(ifnull(b.pay_money,0)) as other_money\n" +
+            "FROM (\n" +
+            "\tselect concat(DATE_FORMAT(time, '%Y' ),'年-',QUARTER(time),'季度') as time from\n" +
+            "\t(select adddate('${startTime}',INTERVAL  t0.i*3 MONTH ) AS time from\n" +
+            "\t (select 0 i " +
+            "<foreach item='item' index='index' collection='quarters' open=' union ' separator=' union ' close=' '>" +
+            " select ${item}" +
+            "</foreach>" +
+            ") t0) v\n" +
+            "\tORDER BY time\n" +
+            "\t) a\n" +
+            "\tLEFT JOIN \n" +
+            "\t( SELECT id,create_time,pay_money FROM pos_order_goods_payment where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
+            " ) b" +
+            "\tON a.time =concat(DATE_FORMAT(b.create_time, '%Y' ),'年-',QUARTER(b.create_time),'季度')\n" +
+            "GROUP BY a.time\t\n" +
+            "UNION ALL\n" +
+            "SELECT '客房' as type, a.time,\n" +
+            "sum(ifnull((case b.subject_type when 1 then b.money when 2 then b.money when 3 then b.money else 0 end),0)) AS room_money,\n" +
+            "sum(ifnull((case b.subject_type when 6 then b.money when 7 then b.money else 0 end),0)) AS other_money\n" +
+            "FROM (\n" +
+            "\tselect concat(DATE_FORMAT(time, '%Y' ),'年-',QUARTER(time),'季度') as time from\n" +
+            "\t(select adddate('${startTime}',INTERVAL  t0.i*3 MONTH ) AS time from\n" +
+            "\t (select 0 i " +
+            "<foreach item='item' index='index' collection='quarters' open=' union ' separator=' union ' close=' '>" +
+            " select ${item}" +
+            "</foreach>" +
+            ") t0) v\n" +
+            "\tORDER BY time\n" +
+            "\t) a\n" +
+            "\tLEFT JOIN \n" +
+            "\t( SELECT * FROM bus_order_fee where fee_type=1 and preferential_status=2\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
+            " ) b ON a.time =concat(DATE_FORMAT(b.create_time, '%Y' ),'年-',QUARTER(b.create_time),'季度')\n" +
+            "GROUP BY a.time)t\n" +
+            "group by time</script>")
+    public List<HashMap<String, Object>> quarterShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime, @Param("quarters") List<Integer> quarters);
+
+    /**
+     * 按时间每年收入统计列表
+     *
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @param years
+     * @return
+     */
+    @Select("<script>select time,sum(room_money) as room_money,sum(other_money) as other_money from \n" +
+            "(SELECT 'pos' as type, a.time\n" +
+            ",0 AS room_money,\n" +
+            "sum(ifnull(b.pay_money,0)) as other_money\n" +
+            "FROM (\n" +
+            "\tselect concat(DATE_FORMAT(time, '%Y' ),'年') as time from\n" +
+            "\t(select adddate('${startTime}',INTERVAL  t0.i YEAR ) AS time from\n" +
+            "\t (select 0 i " +
+            "<foreach item='item' index='index' collection='years' open=' union ' separator=' union ' close=' '>" +
+            " select ${item}" +
+            "</foreach>" +
+            ") t0) v\n" +
+            "\tORDER BY time\n" +
+            "\t) a\n" +
+            "\tLEFT JOIN \n" +
+            "\t( SELECT id,create_time,pay_money FROM pos_order_goods_payment where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
+            " ) b" +
+            "\tON a.time =concat(DATE_FORMAT(b.create_time, '%Y' ),'年')\n" +
+            "GROUP BY a.time\t\n" +
+            "UNION ALL\n" +
+            "SELECT '客房' as type, a.time,\n" +
+            "sum(ifnull((case b.subject_type when 1 then b.money when 2 then b.money when 3 then b.money else 0 end),0)) AS room_money,\n" +
+            "sum(ifnull((case b.subject_type when 6 then b.money when 7 then b.money else 0 end),0)) AS other_money\n" +
+            "FROM (\n" +
+            "\tselect concat(DATE_FORMAT(time, '%Y' ),'年') as time from\n" +
+            "\t(select adddate('${startTime}',INTERVAL  t0.i YEAR) AS time from\n" +
+            "\t (select 0 i " +
+            "<foreach item='item' index='index' collection='years' open=' union ' separator=' union ' close=' '>" +
+            " select ${item}" +
+            "</foreach>" +
+            ") t0) v\n" +
+            "\tORDER BY time\n" +
+            "\t) a\n" +
+            "\tLEFT JOIN \n" +
+            "\t( SELECT * FROM bus_order_fee where fee_type=1 and preferential_status=2\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
+            " ) b ON a.time =concat(DATE_FORMAT(b.create_time, '%Y' ),'年')\n" +
+            "GROUP BY a.time)t\n" +
+            "group by time</script>")
+    public List<HashMap<String, Object>> yearShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime, @Param("years") List<Integer> years);
 
 }

+ 22 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/finance/service/impl/SummaryServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.modules.business.entity.BusRoomPayType;
 import org.jeecg.modules.business.service.IBusRoomPayTypeService;
 import org.jeecg.modules.finance.mapper.SummaryMapper;
@@ -98,13 +99,32 @@ public class SummaryServiceImpl extends ServiceImpl<SummaryMapper, PosOrderGoods
             return summaryMapper.dayShouRuStatList(hotelId, startTime, endTime);
         } else if (section.equals(2)) {
             ArrayList<Integer> months = new ArrayList<Integer>();
-            Temporal temporal1 =LocalDate.parse(startTime.toDateStr());
-            Temporal temporal2 =LocalDate.parse(endTime.toDateStr());
+            Temporal temporal1 = LocalDate.parse(startTime.toDateStr());
+            Temporal temporal2 = LocalDate.parse(endTime.toDateStr());
             long sum = ChronoUnit.MONTHS.between(temporal1, temporal2);
             for (Integer i = 1; i <= sum; i++) {
                 months.add(i);
             }
             return summaryMapper.monthShouRuStatList(hotelId, startTime, endTime, months);
+        } else if (section.equals(3)) {
+            ArrayList<Integer> quarters = new ArrayList<Integer>();
+            Temporal temporal1 = LocalDate.parse(startTime.toDateStr());
+            Temporal temporal2 = LocalDate.parse(endTime.toDateStr());
+            long sum = ChronoUnit.MONTHS.between(temporal1, temporal2) / 3;
+            for (Integer i = 1; i <= sum; i++) {
+                quarters.add(i);
+            }
+            return summaryMapper.quarterShouRuStatList(hotelId, startTime, endTime, quarters);
+        } else if (section.equals(4)) {
+            ArrayList<Integer> years = new ArrayList<Integer>();
+            Temporal temporal1 = LocalDate.parse(startTime.toDateStr());
+            Temporal temporal2 = LocalDate.parse(endTime.toDateStr());
+            long sum = ChronoUnit.MONTHS.between(temporal1, temporal2) / 12;
+            for (Integer i = 1; i <= sum; i++) {
+                years.add(i);
+            }
+//            throw  new JeecgBootException(""+sum);
+            return summaryMapper.yearShouRuStatList(hotelId, startTime, endTime, years);
         }
         return null;
     }