From 2753ad7aee272a5a5a8a0124b1feea5a1e4cc83e Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期五, 20 六月 2025 22:40:52 +0800
Subject: [PATCH] 电源告警参数返回

---
 src/main/java/com/whyc/service/BatttestdataIdService.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/whyc/service/BatttestdataIdService.java b/src/main/java/com/whyc/service/BatttestdataIdService.java
index bdc2852..e3949e4 100644
--- a/src/main/java/com/whyc/service/BatttestdataIdService.java
+++ b/src/main/java/com/whyc/service/BatttestdataIdService.java
@@ -1,8 +1,13 @@
 package com.whyc.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.whyc.dto.Response;
+import com.whyc.factory.BattCapFactory;
+import com.whyc.mapper.BatttestdataInfMapper;
 import com.whyc.mapper.CommonMapper;
 import com.whyc.pojo.db_batt_testdata.BatttestdataId;
+import com.whyc.pojo.db_batt_testdata.BatttestdataInf;
+import com.whyc.pojo.db_station.BattInf;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -16,6 +21,11 @@
     @Resource
     private CommonMapper commonMapper;
 
+    @Autowired
+    private BatttestdataInfService tinfService;
+
+    @Autowired
+    private BattInfService binfService;
     //鎵捐繖娆℃斁鐢电殑鎸囧畾鐨勪竴绗旀暟鎹�
     public List<BatttestdataId> getLastDataByBattgroupId(Integer battgroupId, Integer testRecordCount, Integer recordNum) {
         List<BatttestdataId> list=subTablePageInfoService.getLastDataByBattgroupId(battgroupId,  testRecordCount, recordNum);
@@ -29,6 +39,18 @@
             return new Response().set(1,false,battgroupId+"鐢垫睜缁勬壘涓嶅埌绗�"+testRecordCount+"娆℃斁鐢佃褰�");
         }
         List<BatttestdataId> list=subTablePageInfoService.getTinfDataWithTestRecordCount(tableName,testRecordCount,recordNum,granularity);
+        //鑾峰彇鐢垫睜缁勪俊鎭�
+        BattInf binf = binfService.getBinfByBattgroupId(battgroupId);
+        //鑾峰彇杩欎竴娆$殑鏀剧數淇℃伅
+        BatttestdataInf tinf=tinfService.getTinfByTestRecordCount(battgroupId,testRecordCount);
+        int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr());
+        for (BatttestdataId data:list) {
+            Float realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(),data.getMonVol() , tinf.getGroupVol(), BattCapFactory.CapType_Real);
+            Float restcap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest);
+            data.setRealCap(realCap);
+            data.setRestCap(restcap);
+            data.setPercentCap(String.format("%.5f",(realCap/binf.getMoncapstd()*100)));
+        }
         return new Response().setII(1,list.size()>0,list,"鑾峰彇鍘嗗彶娴嬭瘯璁板綍鏁版嵁璇︽儏");
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1