whyclxw
2025-06-13 fbd26bdd7e89693f86b71969a885779a9ab065a3
1.2.8/9/10电池组优秀劣化损坏统计修改
4个文件已修改
161 ■■■■ 已修改文件
src/main/java/com/whyc/controller/StatisticController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattAlmparamService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattRtdataService.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 93 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/StatisticController.java
@@ -95,7 +95,7 @@
        stic.setUid(uinf.getId());
        return battTinfService.getPwr7Statistic(stic);
    }
    @ApiOperation(value = "电池组电池性能统计(未放电,优秀,劣化,损坏)统计(1.2.8/9/10)")
    @ApiOperation(value = "电池组电池性能统计(优秀,劣化,损坏<按照容量统计>)统计(1.2.8/9/10)")
    @PostMapping("getPerformanceStatistic")
    public Response getPerformanceStatistic(@RequestBody PerformanceStic stic){
        User uinf= ActionUtil.getUser();
@@ -103,6 +103,15 @@
        return battTinfService.getPerformanceStatistic(stic);
    }
    @ApiOperation(value = "电池组电池性能统计(劣化<按照单体电压+内阻统计>)统计(1.2.9)")
    @PostMapping("getPerVolAndRes9Statistic")
    public Response getPerVolAndRes9Statistic(@RequestBody PerformanceStic stic){
        User uinf= ActionUtil.getUser();
        stic.setUid(uinf.getId());
        return battTinfService.getPerVolAndRes9Statistic(stic);
    }
    @ApiOperation(value = "站点信息统计(1.2.11)")
    @PostMapping("getStationStatistic")
src/main/java/com/whyc/service/BattAlmparamService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.BattAlarmIdEnum;
import com.whyc.dto.Real.AlmDto;
import com.whyc.dto.Response;
import com.whyc.mapper.BattAlmparamMapper;
@@ -11,6 +12,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
@Service
@@ -36,5 +38,13 @@
        return new Response().set(1,true,"修改电池告警参数");
    }
    //查询当前电池组当前单体电压或者单体内阻低于其单体电压的下下限或高于上上限判定当前电池组劣化
    public List<BattAlmparam> getAlmParamVolAndRes(Integer battgroupId) {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("battgroup_id",battgroupId);
        wrapper.in("alm_id",  Arrays.asList(BattAlarmIdEnum.ALARM_119005, BattAlarmIdEnum.ALARM_119007));
        wrapper.orderByAsc("alm_id");
        List<BattAlmparam> list = mapper.selectList(wrapper);
        return list;
    }
}
src/main/java/com/whyc/service/BattRtdataService.java
@@ -1,7 +1,10 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.constant.BattAlarmIdEnum;
import com.whyc.mapper.BattAlmparamMapper;
import com.whyc.mapper.BattRtdataMapper;
import com.whyc.pojo.db_param.BattAlmparam;
import com.whyc.pojo.db_ram_db.BattRtdata;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -12,6 +15,9 @@
public class BattRtdataService {
    @Autowired(required = false)
    private BattRtdataMapper mapper;
    @Autowired(required = false)
    private BattAlmparamService almparamService;
    //实时获取单体信息
    public List<BattRtdata> getRtdataRealInfo(Integer battgroupId) {
        QueryWrapper wrapper=new QueryWrapper();
@@ -29,4 +35,43 @@
        BattRtdata rtdata=mapper.selectOne(wrapper);
        return rtdata;
    }
    //查询当前电池组当前单体电压或者单体内阻低于其单体电压的下下限或高于上上限判定当前电池组劣化
    public int getVolAndRes(Integer battgroupId) {
        int flag=0;  //1是劣化,0是正常
        float monVolUpper=0;
        float monVolLower=0;
        float monResUpper=0;
        float monResLower=0;
        //获取电池组的单体电压和单体内阻告警阈值
        List<BattAlmparam> list=almparamService.getAlmParamVolAndRes(battgroupId);
        if(list!=null&&list.size()>0){
            for(BattAlmparam param:list){
                if(param.getAlmId()== BattAlarmIdEnum.ALARM_119005.getStateId()){
                    monVolUpper=param.getAlmLowCoe();
                    monVolLower=param.getAlmLowCoeLower();
                }
                if(param.getAlmId()== BattAlarmIdEnum.ALARM_119006.getStateId()){
                    monResUpper=param.getAlmLowCoe();
                    monResLower=param.getAlmLowCoeLower();
                }
            }
        }
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("battgroup_id",battgroupId);
        wrapper.orderByAsc("mon_num");
        List<BattRtdata> dataList=mapper.selectList(wrapper);
        if(dataList!=null&&dataList.size()>0){
            for(BattRtdata data:dataList){
                if(data.getMonVol()<monVolLower||data.getMonVol()>monVolUpper||data.getMonRes()<monResLower||data.getMonRes()>monResUpper){
                    flag=1;
                    break;
                }else{
                    flag=0;
                }
            }
        }else{
            flag=1;
        }
        return flag;
    }
}
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -11,6 +11,7 @@
import com.whyc.dto.Statistic.*;
import com.whyc.factory.BattCapFactory;
import com.whyc.mapper.BatttestdataInfMapper;
import com.whyc.pojo.db_alarm.BattalarmData;
import com.whyc.pojo.db_batt_testdata.BatttestdataId;
import com.whyc.pojo.db_batt_testdata.BatttestdataInf;
import com.whyc.pojo.db_param.AppParam;
@@ -55,6 +56,8 @@
    @Autowired(required = false)
    private PwrdevHistorydataIdService pwrHisdataIdService;
    //获取最后一次测试数据并计算剩余容量
@@ -849,37 +852,78 @@
            res.setMoncount(binf.getMoncount());
            //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
            if(stic.getPerformance()==null){
                reslist.add(res);
            }else{
                if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
                    reslist.add(res);
                }
            }
            if(tinf==null){
                res.setRealCap(0f);
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
                continue;
            }else{
                //找这次放电的最后一笔数据
                List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum());
                if(idDataList==null||idDataList.size()==0){
                    res.setRealCap(0f);
                    res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
                }else{
                    Float moncapStd=binf.getMoncapstd();
                    int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr());
                    Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
                    res.setRealCap(grouprealCap);
                    if(grouprealCap>=moncapStd*badValue){
                        res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
                    }
                    if(grouprealCap<=moncapStd*damageValue){
                        res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                    }
                    if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                        res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                    }
                }
            }
            //找这次放电的最后一笔数据
            List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum());
            if(idDataList==null||idDataList.size()==0){
            if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
                reslist.add(res);
            }
        }
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
        return new Response().setII(1,reslist.size()>0,pageInfo,"电池组电池性能统计(未放电,优秀,劣化,损坏)统计(1.2.8/9/10)");
    }
    //电池组电池性能统计(劣化<按照单体电压+内阻统计>)统计(1.2.9)
    public Response getPerVolAndRes9Statistic(PerformanceStic stic) {
        //1查询符合条件的电池组
        List<BattInf> binfList=battInfService.getPerformanceStatistic(stic);
        if(binfList==null||binfList.size()==0){
            return new Response().set(1,false,"当前用户未管理满足条件的电池组");
        }
        List<PerformanceRes> reslist=new ArrayList<>();
        for (BattInf binf:binfList) {
            PerformanceRes res=new PerformanceRes();
            res.setProvice(binf.getProvice());
            res.setCity(binf.getCity());
            res.setCountry(binf.getCountry());
            res.setStationName(binf.getStationName());
            res.setBattgroupName(binf.getBattgroupName());
            res.setProduct(binf.getProduct());
            res.setInuseYear(ActionUtil.getDateYear(new Date())-ActionUtil.getDateYear(binf.getInuseTime()));
            res.setMonvolstd(binf.getMonvolstd());
            res.setMoncapstd(binf.getMoncapstd());
            res.setMoncount(binf.getMoncount());
            //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
            if(tinf==null){
                res.setRealCap(0f);
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
                continue;
            }else{
                //找这次放电的最后一笔数据
                List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum());
                if(idDataList==null||idDataList.size()==0){
                    res.setRealCap(0f);
                }else{
                    int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr());
                    Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
                    res.setRealCap(grouprealCap);
                }
            }
            Float moncapStd=binf.getMoncapstd();
            int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr());
            Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
            res.setRealCap(grouprealCap);
            if(grouprealCap>=moncapStd*badValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
            }
            if(grouprealCap<=moncapStd*damageValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
            }
            if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
            //查询当前电池组当前单体电压或者单体内阻低于其单体电压的下下限或高于上上限判定当前电池组劣化
            int flag = rtdataService.getVolAndRes(binf.getBattgroupId());
            if(flag==1){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                reslist.add(res);
            }
        }
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
@@ -919,4 +963,5 @@
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
        return new Response().setII(1,reslist.size()>0,pageInfo,"优良电源数量统计(1.2.7)");
    }
}