From b73fac862ae808bc8033cfac8cf513677ad312dd Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期三, 26 三月 2025 14:43:13 +0800
Subject: [PATCH] 转换统计金额单位为“万元”

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ScreenController.java |    4 +-
 ruoyi-system/src/main/java/com/ruoyi/system/vo/ScreenTopStaticsDataVO.java   |   12 +++---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenService.java  |   43 +++++++++++----------
 ruoyi-system/src/main/java/com/ruoyi/system/vo/ScreenRentIncomeTrendVO.java  |    4 +-
 4 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ScreenController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ScreenController.java
index d12d728..c65a613 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ScreenController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ScreenController.java
@@ -51,18 +51,18 @@
     public R<ScreenTopStaticsDataVO> getTopStaticsData() {
         return R.ok(screenService.getTopStaticsData());
     }
+
     @GetMapping("/rent-rank")
     @ApiOperation("区域租金排名")
     public R<List<ScreenRentRankVO>> rentRank() {
         return R.ok(screenService.streetRentRank());
     }
+
     @GetMapping("/rent-income-trend")
     @ApiOperation("租金收入趋势")
     public R<ScreenRentIncomeTrendVO> rentIncomeTrend() {
         return R.ok(screenService.rentIncomeTrend());
     }
-
-
 
     @GetMapping("/getTenantCountTrend")
     @ApiModelProperty(value = "租户数量趋势统计")
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 8ed736c..084db02 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
@@ -4,7 +4,6 @@
 import com.ruoyi.system.model.TBill;
 import com.ruoyi.system.model.TContract;
 import com.ruoyi.system.model.THouse;
-import com.ruoyi.system.service.ITStreetService;
 import com.ruoyi.system.service.TBillService;
 import com.ruoyi.system.service.TContractService;
 import com.ruoyi.system.service.THouseService;
@@ -16,11 +15,12 @@
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import java.util.Calendar;
-import java.util.ArrayList;
 import java.util.Objects;
 
 /**
@@ -33,7 +33,6 @@
     private final THouseService tHouseService;
     private final TContractService tContractService;
     private final TBillService tBillService;
-    private final ITStreetService tStreetService;
     /**
      * 获取顶部统计数据
      * @return
@@ -77,14 +76,14 @@
         BigDecimal totalRentOwe = currentQuarterBillList.stream()
                 .map(TBill::getOutstandingMoney)
                 .reduce(BigDecimal.ZERO, BigDecimal::add)
-                .divide(BigDecimal.valueOf(10000L), 2, BigDecimal.ROUND_HALF_UP);
+                .divide(BigDecimal.valueOf(10000L), 2, RoundingMode.HALF_UP);
         vo.setTotalRentOwe(totalRentOwe);
         //总计欠费
         List<TBill> allBillList = tBillService.lambdaQuery().le(TBill::getPayableFeesTime, last).list();
         BigDecimal totalRentOweAll = allBillList.stream()
                 .map(TBill::getOutstandingMoney)
                 .reduce(BigDecimal.ZERO, BigDecimal::add)
-                .divide(BigDecimal.valueOf(10000L), 2, BigDecimal.ROUND_HALF_UP);
+                .divide(BigDecimal.valueOf(10000L), 2, RoundingMode.HALF_UP);
         vo.setTotalRentOweAll(totalRentOweAll);
         return vo;
     }
@@ -117,31 +116,33 @@
             Map<String, Date> quarterDate = DateUtils.getQuarterDate(targetDate);
             Date quarterStart = quarterDate.get("first");
             Date quarterEnd = quarterDate.get("last");
-            
+
             // 获取该季度的账单数据
             List<TBill> quarterBills = tBillService.lambdaQuery()
-                .between(TBill::getPayableFeesTime, quarterStart, quarterEnd)
-                .list();
-            
+                    .between(TBill::getPayableFeesTime, quarterStart, quarterEnd)
+                    .list();
+
             // 计算季度租金收入总和
             BigDecimal quarterIncome = quarterBills.stream()
-                .map(TBill::getPayFeesMoney)
-                .filter(Objects::nonNull)
-                .reduce(BigDecimal.ZERO, BigDecimal::add);
-                
+                    .map(TBill::getPayFeesMoney)
+                    .filter(Objects::nonNull)
+                    .reduce(BigDecimal.ZERO, BigDecimal::add)
+                    .divide(BigDecimal.valueOf(10000L), 2, RoundingMode.HALF_UP);
+
             // 计算季度欠费总和
             BigDecimal quarterOutstanding = quarterBills.stream()
-                .map(TBill::getOutstandingMoney)
-                .filter(Objects::nonNull)
-                .reduce(BigDecimal.ZERO, BigDecimal::add);
-            
+                    .map(TBill::getOutstandingMoney)
+                    .filter(Objects::nonNull)
+                    .reduce(BigDecimal.ZERO, BigDecimal::add)
+                    .divide(BigDecimal.valueOf(10000L), 2, RoundingMode.HALF_UP);
+
             // 生成季度标签 (格式: YY-MM月)
             Calendar cal = Calendar.getInstance();
             cal.setTime(quarterEnd);
             String label = String.format("%02d-%d月",
-                cal.get(Calendar.YEAR) % 100,
-                cal.get(Calendar.MONTH) + 1);
-            
+                    cal.get(Calendar.YEAR) % 100,
+                    cal.get(Calendar.MONTH) + 1);
+
             quarterLabels.add(label);
             incomeData.add(quarterIncome);
             outstandingData.add(quarterOutstanding);  // 添加欠费数据
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/ScreenRentIncomeTrendVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/ScreenRentIncomeTrendVO.java
index b39a114..1f01605 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/ScreenRentIncomeTrendVO.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/ScreenRentIncomeTrendVO.java
@@ -18,9 +18,9 @@
     @ApiModelProperty("x轴 时间列表")
     private List<String> quarters;
 
-    @ApiModelProperty("y轴 收入列表")
+    @ApiModelProperty("y轴 收入列表(万元)")
     private List<BigDecimal> incomeData;
 
-    @ApiModelProperty("y轴 欠费列表")
+    @ApiModelProperty("y轴 欠费列表(万元)")
     private List<BigDecimal> outstandingData;
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/ScreenTopStaticsDataVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/ScreenTopStaticsDataVO.java
index 92a25d5..a76573d 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/ScreenTopStaticsDataVO.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/ScreenTopStaticsDataVO.java
@@ -20,10 +20,10 @@
     @ApiModelProperty("已出租面积")
     private Double houseRentedArea;
 
-    @ApiModelProperty("总计应收租金")
+    @ApiModelProperty("总计应收租金(万元)")
     private BigDecimal totalReceivableRent;
 
-    @ApiModelProperty("总计已收租金")
+    @ApiModelProperty("总计已收租金(万元)")
     private BigDecimal totalReceivedRent;
 
     @ApiModelProperty("本月新增租户数")
@@ -32,16 +32,16 @@
     @ApiModelProperty("总计租户数")
     private Integer totalTenantCount;
 
-    @ApiModelProperty("本季度已交租金")
+    @ApiModelProperty("本季度已交租金(万元)")
     private BigDecimal totalRentPaid;
 
-    @ApiModelProperty("本季度应交租金")
+    @ApiModelProperty("本季度应交租金(万元)")
     private BigDecimal totalRentShould;
 
-    @ApiModelProperty("本季度欠费")
+    @ApiModelProperty("本季度欠费(万元)")
     private BigDecimal totalRentOwe;
 
-    @ApiModelProperty("总计欠费")
+    @ApiModelProperty("总计欠费(万元)")
     private BigDecimal totalRentOweAll;
 }
 

--
Gitblit v1.7.1