whyclxw
2025-05-28 ff25fec207602b5e44679e413822d64b45fc4b21
蓄电池核容信息统计
2个文件已修改
37 ■■■■■ 已修改文件
src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataInf.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataInf.java
@@ -119,5 +119,13 @@
    @TableField(exist = false)
    private String fullName;
    @TableField(exist = false)
    private Float restCap;
    @TableField(exist = false)
    private Float restTime;
    @TableField(exist = false)
    private String precentCap;
}
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -9,6 +9,7 @@
import com.whyc.mapper.BattInfMapper;
import com.whyc.mapper.BatttestdataInfMapper;
import com.whyc.pojo.db_batt_testdata.BatttestdataInf;
import com.whyc.pojo.db_ram_db.BattRtstate;
import com.whyc.pojo.db_station.BattInf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -19,6 +20,12 @@
public class BatttestdataInfService {
    @Autowired(required = false)
    private BatttestdataInfMapper mapper;
    @Autowired(required = false)
    private BattRtstateService rtstateService;
    @Autowired(required = false)
    private BattInfService battInfService;
    //获取最后一次测试数据并计算剩余容量
@@ -41,6 +48,28 @@
    public Response getBattTinfStatistic(BattTinfStic stic) {
        PageHelper.startPage(stic.getPageNum(), stic.getPageSize());
        List<BatttestdataInf> list=mapper.getBattTinfStatistic(stic);
        if(list!=null&&list.size()>0){
            for (BatttestdataInf tinf:list) {
                //剩余容量和剩余时间计算
                int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr());
                Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest);
                tinf.setRestCap(restCap);
                tinf.setRestTime(0f);
                //获取电池组实时数据
                BattRtstate battRtstate=rtstateService.getBattRealInfo(tinf.getBattgroupId());
                //获取电池组信息
                BattInf binf=battInfService.getBinfByBattgroupId(tinf.getBattgroupId());
                //实时组端电流,剩余容量,标称容量
                if(battRtstate!=null){
                    Float restTime= BattCapFactory.getTheoryTime(battRtstate.getGroupCurr(), restCap, binf.getMoncapstd());
                    tinf.setRestTime(restTime);
                }
                //保留2位小数
                String precentCap = String.format("%.2f",(restCap/binf.getMoncapstd()*100));
                tinf.setPrecentCap(precentCap);
            }
        }
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list.size()>0,pageInfo,"蓄电池核容信息统计");
    }