Bladeren bron

Merge branch 'master' of http://49.4.53.36:3000/hotel/hotel-saas-backend

覃浩 2 jaren geleden
bovenliggende
commit
16a1ae11e5

+ 94 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/finance/controller/SummaryController.java

@@ -28,6 +28,8 @@ import org.jeecg.modules.business.service.IBusRoomsLivingOrderService;
 import org.jeecg.modules.business.service.IBusWaiterService;
 import org.jeecg.modules.finance.service.ISummaryService;
 import org.jeecg.modules.finance.vo.OrderFeeVo;
+import org.jeecg.modules.finance.vo.PayTypeStatVo;
+import org.jeecg.modules.finance.vo.RoomStatVo;
 import org.jeecg.modules.fw.dto.RoomCleanDto;
 import org.jeecg.modules.fw.entity.FwRoomClean;
 import org.jeecg.modules.fw.service.IFwRoomCleanService;
@@ -168,7 +170,97 @@ public class SummaryController {
 	public Result<List<HashMap<String, Object>>> getDayShouRuStatList(@RequestParam String hotelId, @RequestParam(name = "startTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime startTime,
 											  @RequestParam(name = "endTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime endTime,
 											  @RequestParam(name = "section", defaultValue = "1") Integer section) {
-		List<HashMap<String, Object>> pageList = summaryService.dayShouRuStatList(hotelId, startTime, endTime, section);
-		return Result.OK(pageList);
+		List<HashMap<String, Object>> list = summaryService.dayShouRuStatList(hotelId, startTime, endTime, section);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按收款方式收入统计列表", notes = "按收款方式收入统计列表")
+	@GetMapping(value = "/payMethodStatList")
+	public Result<List<HashMap<String, Object>>> getPayMethodStatList(@RequestParam String hotelId, @RequestParam(name = "startTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime startTime,
+																	  @RequestParam(name = "endTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime endTime) {
+		List<HashMap<String, Object>> list = summaryService.payMethodStatList(hotelId, startTime, endTime);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按房型收入统计列表", notes = "按房型收入统计列表")
+	@GetMapping(value = "/layoutStatList")
+	public Result<List<HashMap<String, Object>>> getLayoutStatList(@RequestParam String hotelId, @RequestParam(name = "startTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime startTime,
+																	  @RequestParam(name = "endTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime endTime) {
+		List<HashMap<String, Object>> list = summaryService.layoutStatList(hotelId, startTime, endTime);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按费项收入统计列表", notes = "按费项收入统计列表")
+	@GetMapping(value = "/subjectTypeStatList")
+	public Result<List<HashMap<String, Object>>> getSubjectTypeStatList(@RequestParam String hotelId, @RequestParam(name = "startTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime startTime,
+																   @RequestParam(name = "endTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime endTime) {
+		List<HashMap<String, Object>> list = summaryService.subjectTypeStatList(hotelId, startTime, endTime);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按来源各项统计列表", notes = "按来源各项统计列表")
+	@GetMapping(value = "/livingSourceStatList")
+	public Result<List<HashMap<String, Object>>> getLivingSourceStatList(@RequestParam String hotelId, @RequestParam(name = "startTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime startTime,
+																		@RequestParam(name = "endTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime endTime) {
+		List<HashMap<String, Object>> list = summaryService.livingSourceStatList(hotelId, startTime, endTime);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按客型各项统计列表", notes = "按客型各项统计列表")
+	@GetMapping(value = "/customerTypeStatList")
+	public Result<List<HashMap<String, Object>>> getCustomerTypeStatList(@RequestParam String hotelId, @RequestParam(name = "startTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime startTime,
+																		 @RequestParam(name = "endTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime endTime) {
+		List<HashMap<String, Object>> list = summaryService.customerTypeStatList(hotelId, startTime, endTime);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按入住类型各项统计列表", notes = "按入住类型各项统计列表")
+	@GetMapping(value = "/livingTypeStatList")
+	public Result<List<HashMap<String, Object>>> getLivingTypeStatList(@RequestParam String hotelId, @RequestParam(name = "startTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime startTime,
+																		 @RequestParam(name = "endTime", required = true) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime endTime) {
+		List<HashMap<String, Object>> list = summaryService.livingTypeStatList(hotelId, startTime, endTime);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按房间统计当日收入明细列表", notes = "按房间统计当日收入明细列表")
+	@GetMapping(value = "/roomStatDetailList")
+	public Result<List<RoomStatVo>> getRoomStatDetailList(@RequestParam String hotelId) {
+		List<RoomStatVo> list = summaryService.roomStatList(hotelId);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按时间统计当日收入明细列表", notes = "按时间统计当日收入明细列表")
+	@GetMapping(value = "/dayOrderFeeList")
+	public Result<List<HashMap<String,Object>>> getDayOrderFeeList(@RequestParam String hotelId) {
+		List<HashMap<String, Object>> list = summaryService.dayOrderFeeList(hotelId);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按收款方式统计当日收入明细列表", notes = "按收款方式统计当日收入明细列表")
+	@GetMapping(value = "/dayPayTypeList")
+	public Result<List<PayTypeStatVo>> getDayPayTypeList(@RequestParam String hotelId) {
+		List<PayTypeStatVo> list = summaryService.dayPayTypeList(hotelId);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按事项统计当日支出明细列表", notes = "按事项统计当日支出明细列表")
+	@GetMapping(value = "/dayMatterExpendDetailList")
+	public Result<List<HashMap<String,Object>>> getDayMatterExpendDetailList(@RequestParam String hotelId) {
+		List<HashMap<String, Object>>  list = summaryService.dayMatterExpendDetailList(hotelId);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按时间统计当日支出明细列表", notes = "按时间统计当日支出明细列表")
+	@GetMapping(value = "/dayExpendOrderFeeList")
+	public Result<List<HashMap<String,Object>>> getDayExpendOrderFeeList(@RequestParam String hotelId) {
+		List<HashMap<String, Object>>  list = summaryService.dayExpendOrderFeeList(hotelId);
+		return Result.OK(list);
+	}
+
+	@ApiOperation(value = "按退款方式统计当日支出明细列表", notes = "按退款方式统计当日支出明细列表")
+	@GetMapping(value = "/dayPayTypeExpendList")
+	public Result<List<PayTypeStatVo>> getDayPayTypeExpendList(@RequestParam String hotelId) {
+		List<PayTypeStatVo>  list = summaryService.dayPayTypeExpendList(hotelId);
+		return Result.OK(list);
 	}
 }

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

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.jeecg.modules.business.entity.BusRoomPayType;
+import org.jeecg.modules.finance.vo.RoomStatVo;
 import org.jeecg.modules.kc.entity.KcDepositoryInGoods;
 import org.jeecg.modules.pos.entity.PosOrderGoodsPayment;
 
@@ -393,4 +394,342 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
             "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);
 
+    /**
+     * 按收款方式收入统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @Select("<script>select name,sum(room_money) as room_money,sum(other_money) as other_money from \n" +
+            "(SELECT 'pos' as type, max(a.name) as name\n" +
+            ",0 AS room_money,\n" +
+            "sum(ifnull(b.pay_money,0)) as other_money\n" +
+            "FROM bus_room_pay_type_info a\n" +
+            "\tLEFT JOIN  pos_order_goods_payment b\n" +
+            "\tON a.id=b.payment_method\n" +
+            "<if test='startTime != null'> and b.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and b.create_time &lt;= #{endTime} </if>" +
+            "where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and a.hotel_id = '${hotelId}' </if>" +
+            "GROUP BY a.id\t\n" +
+            "UNION ALL\n" +
+            "SELECT '客房' as type,max(a.name) as name,\n" +
+            "sum(ifnull((case b.subject_type when 1 then b.money when 2 then b.money when 3 then b.money when 5 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" +
+            "\tbus_room_pay_type_info a\n" +
+            "\tLEFT JOIN bus_order_fee b\n" +
+            "\tON a.id=b.pay_type and b.fee_type=2 and b.preferential_status=2\n" +
+            "<if test='startTime != null'> and b.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and b.create_time &lt;= #{endTime} </if>" +
+            "where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and a.hotel_id = '${hotelId}' </if>" +
+            "GROUP BY a.id)t\n" +
+            "group by name</script>")
+    public List<HashMap<String, Object>> payMethodStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+
+    /**
+     * 按房型收入统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @Select("<script>SELECT max(a.name) as name\n" +
+            ",ifnull(max(t2.rz_count),0) AS rz_count\n" +
+            ",ifnull(max(t3.room_count),0) AS room_count\n" +
+            ",sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money else 0 end),0)) AS room_money\n" +
+            ",sum(ifnull((case t.subject_type when 6 then t.money when 7 then t.money else 0 end),0)) AS other_money\n" +
+            ",sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money when 6 then t.money when 7 then t.money else 0 end),0)) AS sum_money\n" +
+            ",round( sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money else 0 end),0))/ifnull(max(t3.room_count),0),2) AS room_average_price\n" +
+            "FROM ces_room_layout a\n" +
+            "LEFT JOIN (select room.layout_id,b.money,b.subject_type,b.room_id from ces_rooms room\n" +
+            "LEFT JOIN  bus_order_fee b ON room.id=b.room_id and b.fee_type=2 and b.preferential_status=2" +
+            "<if test='startTime != null'> and b.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and b.create_time &lt;= #{endTime} </if>" +
+            ") t\n" +
+            "ON t.layout_id=a.id\n" +
+            "LEFT JOIN (\n" +
+            "select layout_id,count(0) rz_count from(\n" +
+            "select max(room.layout_id) as layout_id from ces_rooms room\n" +
+            "LEFT JOIN  bus_order_fee b ON room.id=b.room_id and b.fee_type=2 and b.preferential_status=2\n" +
+            "<if test='startTime != null'> and b.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and b.create_time &lt;= #{endTime} </if>" +
+            "group by b.living_order_id) tmp group by layout_id) t2\n" +
+            "ON t2.layout_id=a.id\n" +
+            "LEFT JOIN (\n" +
+            "select layout_id,count(0) as room_count from ces_rooms room\n" +
+            "group by room.layout_id) t3\n" +
+            "ON t3.layout_id=a.id\n" +
+            "where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and a.hotel_id = '${hotelId}' </if>" +
+            "GROUP BY a.id\t</script>")
+    public List<HashMap<String, Object>> layoutStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+
+    /**
+     * 按费项收入统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @Select("<script>select '点餐' as name"+
+            "<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>" +
+            "            from bus_room_pay_type_info pty\n" +
+            "            left join pos_order_goods_payment ogp on pty.id=ogp.payment_method\n" +
+            "<if test='startTime != null'> and ogp.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and ogp.create_time &lt;= #{endTime} </if>" +
+            "            where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and pty.hotel_id = '${hotelId}' </if>" +
+            "            UNION ALL\n" +
+            "            select max(t.name) as name,SUM(case of.pay_type when '1633765326418755585' then of.money else 0 end) as '微信'\n" +
+            "            ,SUM(case of.pay_type when '1645358935063744514' then of.money else 0 end) as '现金'\n" +
+            "\t\t\t\t\t\tfrom(select id,name from (select 1 as id,'押金' as name \n" +
+            "\t\t\t\t\t\tunion select 2 as id,'预收房费' as name \n" +
+            "\t\t\t\t\t\tunion select 3 as id,'每日房费' as name\n" +
+            "\t\t\t\t\t\tunion select 5 as id,'结账收款' as name\n" +
+            "\t\t\t\t\t\tunion select 6 as id,'商品' as name\n" +
+            "\t\t\t\t\t  union select 7 as id,'点餐' as name)tmp) t\n" +
+            "            left join bus_order_fee of on of.subject_type=t.id\n" +
+            "            and of.fee_type=2 and of.preferential_status=2\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and of.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>" +
+            "            group by t.id</script>")
+    public List<HashMap<String, Object>> subjectTypeStatList(@Param("hotelId") String hotelId, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+
+    /**
+     * 按来源各项统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @Select("<script>SELECT max(a.item_text) as name\n" +
+            "            ,ifnull(max(t2.rz_count),0) AS rz_count\n" +
+            "            ,sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money else 0 end),0)) AS room_money\n" +
+            "            ,sum(ifnull((case t.subject_type when 6 then t.money when 7 then t.money else 0 end),0)) AS other_money\n" +
+            "            ,sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money when 6 then t.money when 7 then t.money else 0 end),0)) AS sum_money\n" +
+            "            ,round( sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money else 0 end),0))/ifnull(max(t2.rz_count),0),2) AS room_average_price\n" +
+            "\t\t\t\t\t\tfrom bus_dict_item_info a\n" +
+            "            LEFT JOIN (select room.customer_source,b.money,b.subject_type,b.room_id from bus_rooms_living_order room\n" +
+            "            LEFT JOIN  bus_order_fee b ON room.id=b.living_order_id and b.fee_type=2 and b.preferential_status=2 where 1=1 \n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and room.hotel_id = '${hotelId}' </if>" +
+            "<if test='startTime != null'> and room.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and room.create_time &lt;= #{endTime} </if>" +
+            "            ) t\n" +
+            "            ON t.customer_source=a.id\n" +
+            "            LEFT JOIN (\n" +
+            "            select customer_source,count(0) as rz_count from bus_rooms_living_order where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
+            "<if test='startTime != null'> and create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and create_time &lt;= #{endTime} </if>" +
+            "            group by customer_source) t2\n" +
+            "            ON t2.customer_source=a.id\n" +
+            "            where 1=1 and a.dict_id='1639538915239743490'\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and of.hotel_id = '${hotelId}' </if>" +
+            "            GROUP BY a.id</script>")
+    public List<HashMap<String, Object>> livingSourceStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+
+    /**
+     * 按客型各项统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @Select("<script>SELECT max(a.name) as name\n" +
+            "            ,ifnull(max(t2.rz_count),0) AS rz_count\n" +
+            "            ,sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money else 0 end),0)) AS room_money\n" +
+            "            ,sum(ifnull((case t.subject_type when 6 then t.money when 7 then t.money else 0 end),0)) AS other_money\n" +
+            "            ,sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money when 6 then t.money when 7 then t.money else 0 end),0)) AS sum_money\n" +
+            "            ,round(sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money else 0 end),0))/ifnull(max(t2.rz_count),0),2) AS room_average_price\n" +
+            "\t\t\t\t\t\tfrom (\n" +
+            "\t\t\t\t\t\tselect 1 as id,'散客' as name\n" +
+            "\t\t\t\t\t\tunion select 2 as id,'会员' as name\n" +
+            "\t\t\t\t\t\tunion select 3 as id,'协议单位' as name\n" +
+            "\t\t\t\t\t\tunion select 4 as id,'中介' as name\n" +
+            "\t\t\t\t\t\t) a\n" +
+            "            LEFT JOIN (select room.customer_type,b.money,b.subject_type,b.room_id from bus_rooms_living_order room\n" +
+            "            INNER JOIN  bus_order_fee b ON room.id=b.living_order_id and b.fee_type=2 and b.preferential_status=2 \n" +
+            "\t\t\t\t\t\twhere 1=1'\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and room.hotel_id = '${hotelId}' </if>" +
+            "<if test='startTime != null'> and room.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and room.create_time &lt;= #{endTime} </if>" +
+            "            ) t\n" +
+            "            ON t.customer_type=a.id\n" +
+            "            LEFT JOIN (\n" +
+            "            select customer_type,count(0) as rz_count from bus_rooms_living_order\n" +
+            "\t\t\t\t\t\twhere 1=1'\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and of.hotel_id = '${hotelId}' </if>" +
+            "            group by customer_type) t2\n" +
+            "            ON t2.customer_type=a.id\n" +
+            "            GROUP BY a.id</script>")
+    public List<HashMap<String, Object>> customerTypeStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+
+    /**
+     * 按入住类型各项统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @Select("<script>SELECT max(a.name) as name\n" +
+            "            ,ifnull(max(t2.rz_count),0) AS rz_count\n" +
+            "            ,sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money else 0 end),0)) AS room_money\n" +
+            "            ,sum(ifnull((case t.subject_type when 6 then t.money when 7 then t.money else 0 end),0)) AS other_money\n" +
+            "            ,sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money when 6 then t.money when 7 then t.money else 0 end),0)) AS sum_money\n" +
+            "            ,round(sum(ifnull((case t.subject_type when 1 then t.money when 2 then t.money when 3 then t.money when 5 then t.money else 0 end),0))/ifnull(max(t2.rz_count),0),2) AS room_average_price\n" +
+            "\t\t\t\t\t\tfrom (\n" +
+            "\t\t\t\t\t\tselect 1 as id,'全天' as name\n" +
+            "\t\t\t\t\t\tunion select 2 as id,'钟点房' as name"+
+            "\t\t\t\t\t\t) a\n" +
+            "            LEFT JOIN (select room.customer_type,b.money,b.subject_type,b.room_id from bus_rooms_living_order room\n" +
+            "            INNER JOIN  bus_order_fee b ON room.id=b.living_order_id and b.fee_type=2 and b.preferential_status=2 \n" +
+            "\t\t\t\t\t\twhere 1=1'\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and room.hotel_id = '${hotelId}' </if>" +
+            "<if test='startTime != null'> and room.create_time &gt;= #{startTime} </if>" +
+            "<if test='endTime != null'> and room.create_time &lt;= #{endTime} </if>" +
+            "            ) t\n" +
+            "            ON t.living_type=a.id\n" +
+            "            LEFT JOIN (\n" +
+            "            select living_type,count(0) as rz_count from bus_rooms_living_order\n" +
+            "\t\t\t\t\t\twhere 1=1'\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and of.hotel_id = '${hotelId}' </if>" +
+            "            group by living_type) t2\n" +
+            "            ON t2.living_type=a.id\n" +
+            "            GROUP BY a.id</script>")
+    public List<HashMap<String, Object>> livingTypeStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
+
+    /**
+     * 按房间统计当日收入列表
+     * @param hotelId
+     * @return
+     */
+    @Select("<script>select b.room_id,room.name as room_name from bus_order_fee b\n" +
+            "left join ces_rooms room\n" +
+            "on b.room_id=room.id\n" +
+            "where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and b.hotel_id = '${hotelId}' </if>" +
+            "and b.fee_type=2 and b.preferential_status=2 and b.subject_type!=4\n" +
+            "-- and b.subject_type!=5\n" +
+            "and datediff(b.create_time,now())=0\n" +
+            "group by b.room_id</script>")
+    public List<RoomStatVo> roomStatList(@Param("hotelId") String hotelId);
+
+    /**
+     * 按房间统计当日收入明细列表
+     * @param roomId
+     * @return
+     */
+    @Select("<script>select b.create_time,b.money,\n" +
+            "case b.subject_type when 1 then '押金' when 2 then '预收房费' when 3 then '每日房费'  when 5 then '结账收款'  when 6 then '商品' when 7 then '点餐' else '其他' end as subject_type_name,\n" +
+            "p.name as pay_name from bus_order_fee b\n" +
+            "left join bus_room_pay_type_info p\n" +
+            "on b.pay_type=p.id\n" +
+            "where 1=1\n" +
+            "and b.fee_type=2 and b.preferential_status=2 and subject_type!=4\n" +
+            "and datediff(b.create_time,now())=0\n" +
+            "<if test='roomId != null and roomId !=\"\"'> and b.roomId = '${roomId}' </if>" +
+            "</script>")
+    public List<HashMap<String, Object>> roomStatDeatilList(@Param("roomId") String roomId);
+
+    /**
+     * 按时间统计当日收入明细列表
+     * @param hotelId
+     * @return
+     */
+    @Select("<script>select b.create_time,b.money,room.name as room_name,\n" +
+            "case b.subject_type when 1 then '押金' when 2 then '预收房费' when 3 then '每日房费'  when 5 then '结账收款'  when 6 then '商品' when 7 then '点餐' else '其他' end as subject_type_name,\n" +
+            "p.name as pay_name from bus_order_fee b\n" +
+            "left join bus_room_pay_type_info p\n" +
+            "on b.pay_type=p.id\n" +
+            "left join ces_rooms room\n" +
+            "on b.room_id=room.id\n" +
+            "where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and b.hotel_id = '${hotelId}' </if>" +
+            "and b.fee_type=2 and b.preferential_status=2 and subject_type!=4\n" +
+            "and datediff(b.create_time,now())=0" +
+            "UNION ALL\n" +
+            "select b.create_time,b.pay_money as money,'--' as room_name,'点餐' as subject_type_name,p.name as pay_name from pos_order_goods_payment b\n" +
+            "left join bus_room_pay_type_info p\n" +
+            "on b.payment_method=p.id\n" +
+            "where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and b.hotel_id = '${hotelId}' </if>" +
+            "and datediff(b.create_time,now())=0</script>")
+    public List<HashMap<String, Object>> dayOrderFeeList(@Param("hotelId") String hotelId);
+
+    /**
+     * 按收款方式统计当日收入明细列表
+     * @param payType
+     * @return
+     */
+    @Select("<script>select b.create_time,b.money,\n" +
+            "case b.subject_type when 1 then '押金' when 2 then '预收房费' when 3 then '每日房费'  when 5 then '结账收款'  when 6 then '商品' when 7 then '点餐' else '其他' end as subject_type_name,\n" +
+            "room.name as room_name from bus_order_fee b\n" +
+            "left join ces_rooms room\n" +
+            "on b.room_id=room.id\n" +
+            "where 1=1\n" +
+            "and b.fee_type=2 and b.preferential_status=2 and subject_type!=4\n" +
+            "and datediff(b.create_time,now())=0\n" +
+            "<if test='payType != null and payType !=\"\"'> and b.pay_type = '${payType}' </if>" +
+            "</script>")
+    public List<HashMap<String, Object>> dayPayTypeDetailList(@Param("payType") String payType);
+
+    /**
+     * 按事项统计当日支出明细列表
+     * @param hotelId
+     * @return
+     */
+    @Select("<script>select p.create_time,room.name as room_name,p.money,pt.name as pay_name from bus_order_fee p\n" +
+            "left join ces_rooms room\n" +
+            "on room.id=p.room_id\n" +
+            "left join bus_room_pay_type_info pt\n" +
+            "on p.pay_type=pt.id\n" +
+            "where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and p.hotel_id = '${hotelId}' </if>" +
+            "and p.fee_type=2 and p.preferential_status=2 and p.subject_type=5\n" +
+            "and p.custorer_order_remark='结账退款'\n" +
+            "and datediff(p.create_time,now())=0</script>")
+    public List<HashMap<String, Object>> dayMatterExpendDetailList(@Param("hotelId") String hotelId);
+
+    /**
+     * 按时间统计当日支出明细列表
+     * @param hotelId
+     * @return
+     */
+    @Select("<script>select b.create_time,b.money,room.name as room_name,\n" +
+            "case b.subject_type when 1 then '押金' when 2 then '预收房费' when 3 then '每日房费'  when 5 then '结账退款'  when 6 then '商品' when 7 then '点餐' else '其他' end as subject_type_name,\n" +
+            "p.name as pay_name from bus_order_fee b\n" +
+            "left join bus_room_pay_type_info p\n" +
+            "on b.pay_type=p.id\n" +
+            "left join ces_rooms room\n" +
+            "on b.room_id=room.id\n" +
+            "where 1=1\n" +
+            "<if test='hotelId != null and hotelId !=\"\"'> and b.hotel_id = '${hotelId}' </if>" +
+            "and b.fee_type=2 and b.preferential_status=2 and p.subject_type=5\n" +
+            "and b.custorer_order_remark='结账退款'\n" +
+            "and datediff(b.create_time,now())=0</script>")
+    public List<HashMap<String, Object>> dayExpendOrderFeeList(@Param("hotelId") String hotelId);
+
+    /**
+     * 按退款方式统计当日支出明细列表
+     * @param payType
+     * @return
+     */
+    @Select("<script>select b.create_time,b.money,\n" +
+            "case b.subject_type when 1 then '押金' when 2 then '预收房费' when 3 then '每日房费'  when 5 then '结账退款'  when 6 then '商品' when 7 then '点餐' else '其他' end as subject_type_name,\n" +
+            "room.name as room_name from bus_order_fee b\n" +
+            "left join ces_rooms room\n" +
+            "on b.room_id=room.id\n" +
+            "where 1=1\n" +
+            "and b.fee_type=2 and b.preferential_status=2 and p.subject_type=5\n" +
+            "and b.custorer_order_remark='结账退款'\n" +
+            "and datediff(b.create_time,now())=0\n" +
+            "<if test='payType != null and payType !=\"\"'> and b.pay_type = '${payType}' </if>" +
+            "</script>")
+    public List<HashMap<String, Object>> dayPayTypeExpendDetailList(@Param("payType") String payType);
 }

+ 97 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/finance/service/ISummaryService.java

@@ -2,6 +2,8 @@ package org.jeecg.modules.finance.service;
 
 import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.modules.finance.vo.PayTypeStatVo;
+import org.jeecg.modules.finance.vo.RoomStatVo;
 import org.jeecg.modules.fw.entity.FwRoomRepair;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.pos.entity.PosOrderGoodsPayment;
@@ -47,4 +49,99 @@ public interface ISummaryService extends IService<PosOrderGoodsPayment> {
      * @return
      */
     public List<HashMap<String, Object>> dayShouRuStatList(String hotelId, DateTime startTime, DateTime endTime, Integer section);
+
+    /**
+     * 按收款方式收入统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> payMethodStatList(String hotelId, DateTime startTime, DateTime endTime);
+
+    /**
+     * 按房型收入统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> layoutStatList(String hotelId, DateTime startTime, DateTime endTime);
+    /**
+     * 按费项收入统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> subjectTypeStatList(String hotelId,  DateTime startTime, DateTime endTime);
+
+    /**
+     * 按来源各项统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> livingSourceStatList( String hotelId, DateTime startTime,DateTime endTime);
+
+    /**
+     * 按客型各项统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> customerTypeStatList(String hotelId,  DateTime startTime,  DateTime endTime);
+
+    /**
+     * 按入住类型各项统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> livingTypeStatList(String hotelId,  DateTime startTime,  DateTime endTime);
+
+    /**
+     * 按房间统计当日收入明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<RoomStatVo> roomStatList(String hotelId);
+
+    /**
+     * 按时间统计当日收入明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<HashMap<String, Object>> dayOrderFeeList(String hotelId);
+
+    /**
+     * 按收款方式统计当日收入明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<PayTypeStatVo> dayPayTypeList(String hotelId);
+
+    /**
+     * 按事项统计当日支出明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<HashMap<String, Object>> dayMatterExpendDetailList(String hotelId);
+
+    /**
+     * 按时间统计当日支出明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<HashMap<String, Object>> dayExpendOrderFeeList(String hotelId);
+
+    /**
+     * 按退款方式统计当日支出明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<PayTypeStatVo> dayPayTypeExpendList(String hotelId);
 }

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

@@ -4,12 +4,16 @@ import cn.hutool.core.date.DateTime;
 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.commons.lang3.ObjectUtils;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 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;
 import org.jeecg.modules.finance.service.ISummaryService;
+import org.jeecg.modules.finance.vo.PayTypeStatVo;
+import org.jeecg.modules.finance.vo.RoomStatVo;
 import org.jeecg.modules.fw.entity.FwRoomRepair;
 import org.jeecg.modules.fw.mapper.FwRoomRepairMapper;
 import org.jeecg.modules.fw.service.IFwRoomRepairService;
@@ -128,4 +132,161 @@ public class SummaryServiceImpl extends ServiceImpl<SummaryMapper, PosOrderGoods
         }
         return null;
     }
+
+    /**
+     * 按收款方式收入统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> payMethodStatList(String hotelId, DateTime startTime, DateTime endTime){
+        return summaryMapper.payMethodStatList(hotelId, startTime, endTime);
+    }
+
+    /**
+     * 按房型收入统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> layoutStatList(String hotelId, DateTime startTime, DateTime endTime){
+        return summaryMapper.layoutStatList(hotelId, startTime, endTime);
+    }
+
+    /**
+     * 按费项收入统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> subjectTypeStatList(String hotelId, DateTime startTime, DateTime endTime){
+        LambdaQueryWrapper<BusRoomPayType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(BusRoomPayType::getHotelId, hotelId);
+        List<BusRoomPayType> busRoomPayTypes = busRoomPayTypeService.list(lambdaQueryWrapper);
+        return summaryMapper.subjectTypeStatList(hotelId, busRoomPayTypes,startTime, endTime);
+    }
+
+    /**
+     * 按来源各项统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> livingSourceStatList( String hotelId, DateTime startTime,DateTime endTime)
+    {
+        return summaryMapper.livingSourceStatList(hotelId,startTime, endTime);
+    }
+
+    /**
+     * 按客型各项统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> customerTypeStatList(String hotelId,  DateTime startTime,  DateTime endTime) {
+        return summaryMapper.customerTypeStatList(hotelId, startTime, endTime);
+    }
+
+    /**
+     * 按入住类型各项统计列表
+     * @param hotelId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public List<HashMap<String, Object>> livingTypeStatList(String hotelId,  DateTime startTime,  DateTime endTime) {
+        return summaryMapper.livingTypeStatList(hotelId, startTime, endTime);
+    }
+
+    /**
+     * 按房间统计当日收入明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<RoomStatVo> roomStatList(String hotelId) {
+        List<RoomStatVo> list = summaryMapper.roomStatList(hotelId);
+        if (ObjectUtils.isNotEmpty(list)) {
+            for (RoomStatVo roomStatVo : list) {
+                List<HashMap<String, Object>> detailList = summaryMapper.roomStatDeatilList(roomStatVo.getRoomId());
+                roomStatVo.setDetailList(detailList);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 按时间统计当日收入明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<HashMap<String, Object>> dayOrderFeeList(String hotelId){
+        return summaryMapper.dayOrderFeeList(hotelId);
+    }
+
+    /**
+     * 按收款方式统计当日收入明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<PayTypeStatVo> dayPayTypeList(String hotelId) {
+        List<PayTypeStatVo> list = new ArrayList<>();
+        LambdaQueryWrapper<BusRoomPayType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(BusRoomPayType::getHotelId, hotelId);
+        List<BusRoomPayType> busRoomPayTypes = busRoomPayTypeService.list(lambdaQueryWrapper);
+        if (ObjectUtils.isNotEmpty(busRoomPayTypes)) {
+            for (BusRoomPayType busRoomPayType : busRoomPayTypes) {
+                PayTypeStatVo vo = new PayTypeStatVo();
+                List<HashMap<String, Object>> detailList = summaryMapper.dayPayTypeDetailList(busRoomPayType.getId());
+                vo.setPayTypeName(busRoomPayType.getName());
+                vo.setDetailList(detailList);
+                list.add(vo);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 按事项统计当日支出明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<HashMap<String, Object>> dayMatterExpendDetailList(String hotelId) {
+        return summaryMapper.dayMatterExpendDetailList(hotelId);
+    }
+
+    /**
+     * 按时间统计当日支出明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<HashMap<String, Object>> dayExpendOrderFeeList(String hotelId) {
+        return summaryMapper.dayExpendOrderFeeList(hotelId);
+    }
+
+    /**
+     * 按退款方式统计当日支出明细列表
+     * @param hotelId
+     * @return
+     */
+    public List<PayTypeStatVo> dayPayTypeExpendList(String hotelId) {
+        List<PayTypeStatVo> list = new ArrayList<>();
+        LambdaQueryWrapper<BusRoomPayType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(BusRoomPayType::getHotelId, hotelId);
+        List<BusRoomPayType> busRoomPayTypes = busRoomPayTypeService.list(lambdaQueryWrapper);
+        if (ObjectUtils.isNotEmpty(busRoomPayTypes)) {
+            for (BusRoomPayType busRoomPayType : busRoomPayTypes) {
+                PayTypeStatVo vo = new PayTypeStatVo();
+                List<HashMap<String, Object>> detailList = summaryMapper.dayPayTypeExpendDetailList(busRoomPayType.getId());
+                vo.setPayTypeName(busRoomPayType.getName());
+                vo.setDetailList(detailList);
+                list.add(vo);
+            }
+        }
+        return list;
+    }
 }

+ 14 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/finance/vo/PayTypeStatVo.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.finance.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+
+@Data
+public class PayTypeStatVo {
+    private String payTypeName;
+    private BigDecimal amount;
+    private List<HashMap<String, Object>> detailList;
+}

+ 15 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/finance/vo/RoomStatVo.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.finance.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+
+@Data
+public class RoomStatVo {
+    private String roomId;
+    private String roomName;
+    private BigDecimal amount;
+    private List<HashMap<String, Object>> detailList;
+}