Browse Source

调整基本费用暂不计入统计中

fuyuchuan 5 ngày trước cách đây
mục cha
commit
22133760a6

+ 8 - 8
fiveep-service/src/main/java/com/bizmatics/service/impl/HtAnalogDataServiceImpl.java

@@ -1612,6 +1612,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
                         BigDecimal sameMonthElectricity = getTotal(sameDayLastMonthList);
                         BigDecimal sameYearElectricity = getTotal(sameDayLastYearList);
 
+                        // 基本费用
                         BigDecimal dayBasic = getBasicExpenses(dayList, cfg, siteId, dayElectricity);
                         BigDecimal monthBasic = getBasicExpenses(monthList, cfg, siteId, monthElectricity);
                         BigDecimal yearBasic = getBasicExpenses(yearList, cfg, siteId, yearElectricity);
@@ -1620,13 +1621,13 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
                         BigDecimal sameYearBasic = getBasicExpenses(sameDayLastYearList, cfg, siteId, sameYearElectricity);
 
                         // 3. 费用汇总
-                        BigDecimal dayCost = calculateTotalCost(calculateTimeFee(siteId, today, 1)).add(dayBasic);
-                        BigDecimal monthCost = calculateTotalCost(calculateTimeFee(siteId, today, 2)).add(monthBasic);
-                        BigDecimal yearCost = calculateTotalCost(calculateTimeFee(siteId, today, 3)).add(yearBasic);
+                        BigDecimal dayCost = calculateTotalCost(calculateTimeFee(siteId, today, 1));//.add(dayBasic);
+                        BigDecimal monthCost = calculateTotalCost(calculateTimeFee(siteId, today, 2));
+                        BigDecimal yearCost = calculateTotalCost(calculateTimeFee(siteId, today, 3));
 
-                        BigDecimal yesterdayCost = calculateTotalCost(calculateTimeFee(siteId, yesterday1, 1)).add(sameDayBasic);
-                        BigDecimal sameMonthCost = calculateTotalCost(calculateTimeFee(siteId, lastMonth, 22)).add(sameMonthBasic);
-                        BigDecimal sameYearCost = calculateTotalCost(calculateTimeFee(siteId, lastYear, 33)).add(sameYearBasic);
+                        BigDecimal yesterdayCost = calculateTotalCost(calculateTimeFee(siteId, yesterday1, 1));//.add(sameDayBasic);
+                        BigDecimal sameMonthCost = calculateTotalCost(calculateTimeFee(siteId, lastMonth, 22));
+                        BigDecimal sameYearCost = calculateTotalCost(calculateTimeFee(siteId, lastYear, 33));
 
                         // 4. 设置值
                         vo.setTodayCost(dayCost);
@@ -1646,7 +1647,6 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
                                 ? monthCost.subtract(sameMonthCost)
                                 .divide(sameMonthCost, 2, RoundingMode.HALF_UP)
                                 : BigDecimal.ZERO);
-
                         // 年环比
                         vo.setYearCostRingRatio(sameYearCost.compareTo(BigDecimal.ZERO) != 0
                                 ? yearCost.subtract(sameYearCost)
@@ -2458,7 +2458,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
                                     SiteElectricityRecord::getTotalCost,
                                     BigDecimal::add)));
 
-            result =  timeKeys.stream()
+            result = timeKeys.stream()
                     .map(t -> monthMap.getOrDefault(YearMonth.from(t), null))
                     .collect(Collectors.toList());
         }

+ 3 - 1
fiveep-service/src/main/java/com/bizmatics/service/job/SiteDailyElectricityCostTask.java

@@ -34,7 +34,7 @@ public class SiteDailyElectricityCostTask implements ApplicationRunner {
     /** 应用启动后立即执行一次 */
     @Override
     public void run(ApplicationArguments args) {
-        log.info("项目启动,立即执行一次电费日结...");
+        log.info("立即执行一次日电费记录");
         // calculateDailyElectricityCost();
     }
 
@@ -42,6 +42,8 @@ public class SiteDailyElectricityCostTask implements ApplicationRunner {
     @Scheduled(cron = "0 5 0 * * ?")
     public void calculateDailyElectricityCost() {
         LocalDate yesterday = LocalDate.now().minusDays(1);
+        // LocalDate yesterday = LocalDate.now();
+        // LocalDate yesterday = LocalDate.parse("2025-07-19");
         log.info("开始计算{}的用电费用", yesterday);
 
         try {