From a4ed0c4cb332c78eed9a72d153df01da0803cff1 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期四, 03 四月 2025 21:00:12 +0800
Subject: [PATCH] bug修改

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenService.java |   38 +++++++++-----------------------------
 1 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenService.java
index 1e3f955..12d5ea6 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenService.java
@@ -1,6 +1,5 @@
 package com.ruoyi.system.service.impl;
 
-import com.ruoyi.common.enums.BillTypeEnum;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.system.model.TBill;
@@ -41,6 +40,9 @@
      */
     public ScreenTopStaticsDataVO getTopStaticsData() {
         String businessDeptId = SecurityUtils.getBusinessDeptId();
+        Map<String, Date> quarterDate = DateUtils.getQuarterDate(new Date());
+        Date first = quarterDate.get("first");
+        Date last = quarterDate.get("last");
         ScreenTopStaticsDataVO vo = new ScreenTopStaticsDataVO();
         //房屋总面积
         List<THouse> houseList = tHouseService.lambdaQuery()
@@ -51,16 +53,10 @@
                 .reduce(0D, Double::sum);
         vo.setHouseTotalArea(totalArea);
         //已出租面积
-        Double totalRentedArea = houseList.stream()
-                .filter(item -> !item.getLeaseStatus().equals("1"))
-                .map(item -> Double.parseDouble(item.getHouseArea()))
-                .reduce(0D, Double::sum);
+        Double totalRentedArea =  tHouseService.getRentedArea(businessDeptId);
         vo.setHouseRentedArea(totalRentedArea);
         //总计应收租金
-        List<TBill> billList = tBillService.lambdaQuery()
-                .eq(!businessDeptId.equals("0"), TBill::getBusinessDeptId, businessDeptId)
-                .eq(TBill::getBillType, BillTypeEnum.Zujin.getCode())
-                .list();
+        List<TBill> billList = tBillService.getJiFuBillList(businessDeptId);
         BigDecimal totalReceivableRent = billList.stream()
                 .filter(item -> !item.getPayFeesStatus().equals("5"))
                 .map(TBill::getPayableFeesMoney)
@@ -78,6 +74,7 @@
         vo.setNewTenantCount(newTenantCount);
         //总计租户数 系统租户列表里有生效合同绑定的租户总数。
         List<TContract> tContracts = tContractService.lambdaQuery()
+                .eq(TContract::getPayType,2) //季付
                 .in(TContract::getStatus, "4", "5", "6", "7", "8", "9")
                 .eq(!businessDeptId.equals("0"), TContract::getBusinessDeptId, businessDeptId)
                 .list();
@@ -86,15 +83,7 @@
                 .distinct()
                 .count();
         vo.setTotalTenantCount((int) count);
-        Map<String, Date> quarterDate = DateUtils.getQuarterDate(new Date());
-        Date first = quarterDate.get("first");
-        Date last = quarterDate.get("last");
-        List<TBill> currentQuarterBillList = tBillService.lambdaQuery()
-                .eq(!businessDeptId.equals("0"), TBill::getBusinessDeptId, businessDeptId)
-                .between(TBill::getPayableFeesTime, first, last)
-                .eq(TBill::getBillType, BillTypeEnum.Zujin.getCode())
-                .ne(TBill::getPayFeesStatus, 5)
-                .list();
+        List<TBill> currentQuarterBillList = tBillService.getJiFuBillListByTime(businessDeptId, first, last);
         //本季度已交租金
         BigDecimal totalRentPaid = currentQuarterBillList.stream()
                 .map(TBill::getPayFeesMoney)
@@ -115,12 +104,7 @@
                 .divide(BigDecimal.valueOf(10000L), 2, RoundingMode.HALF_UP);
         vo.setTotalRentOwe(totalRentOwe);
         //总计欠费
-        List<TBill> allBillList = tBillService.lambdaQuery()
-                .eq(TBill::getBillType, BillTypeEnum.Zujin.getCode())
-                .eq(!businessDeptId.equals("0"), TBill::getBusinessDeptId, businessDeptId)
-                //.le(TBill::getPayableFeesTime, last)
-                .list();
-        BigDecimal totalRentOweAll = allBillList.stream()
+        BigDecimal totalRentOweAll = billList.stream()
                 .map(TBill::getOutstandingMoney)
                 .reduce(BigDecimal.ZERO, BigDecimal::add)
                 .divide(BigDecimal.valueOf(10000L), 2, RoundingMode.HALF_UP);
@@ -159,11 +143,7 @@
             Date quarterEnd = quarterDate.get("last");
 
             // 获取该季度的账单数据
-            List<TBill> quarterBills = tBillService.lambdaQuery()
-                    .between(TBill::getPayableFeesTime, quarterStart, quarterEnd)
-                    .eq(TBill::getBillType, BillTypeEnum.Zujin.getCode())
-                    .eq(!businessDeptId.equals("0"), TBill::getBusinessDeptId, businessDeptId)
-                    .list();
+            List<TBill> quarterBills = tBillService.getJiFuBillListByTime(businessDeptId, quarterStart, quarterEnd);
 
             // 计算季度租金收入总和
             BigDecimal quarterIncome = quarterBills.stream()

--
Gitblit v1.7.1