whyclxw
2025-06-05 8315e45f60c80d6ca07ee0a8834ba47c595d0346
蓄电池组对比分析界面统计15,16,17
4个文件已修改
107 ■■■■■ 已修改文件
src/main/java/com/whyc/dto/Statistic/SticCompare15Res.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/Statistic/SticCompare16Res.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/Statistic/SticCompare17Res.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/Statistic/SticCompare15Res.java
@@ -13,6 +13,7 @@
    private String country;
    private String stationName;
    private String battgroupName;
    private String devName;
    private String product;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date inuseTime;
src/main/java/com/whyc/dto/Statistic/SticCompare16Res.java
@@ -12,6 +12,7 @@
    private String country;
    private String stationName;
    private String battgroupName;
    private String devName;
    private String product;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date inuseTime;
src/main/java/com/whyc/dto/Statistic/SticCompare17Res.java
@@ -12,6 +12,7 @@
    private String country;
    private String stationName;
    private String battgroupName;
    private String devName;
    private String product;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date inuseTime;
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -264,6 +264,7 @@
            res.setCountry(binf.getCountry());
            res.setStationName(binf.getStationName());
            res.setBattgroupName(binf.getBattgroupName());
            res.setDevName(binf.getDevName());
            res.setProduct(binf.getProduct());
            res.setInuseTime(binf.getInuseTime());
            res.setMonvolstd(binf.getMonvolstd());
@@ -308,7 +309,7 @@
                }
            }
            res.setMonNums(monNums);
            if(stic.getPerformance()==0){
            if(stic.getPerformance()==null){
                reslist.add(res);
            }else{
                if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
@@ -351,6 +352,7 @@
            res.setCountry(binf.getCountry());
            res.setStationName(binf.getStationName());
            res.setBattgroupName(binf.getBattgroupName());
            res.setDevName(binf.getDevName());
            res.setProduct(binf.getProduct());
            res.setInuseTime(binf.getInuseTime());
            res.setMonvolstd(binf.getMonvolstd());
@@ -420,66 +422,86 @@
        }
        List<SticCompare17Res> reslist=new ArrayList<>();
        for (BattInf binf:binfList) {
            SticCompare17Res res=new SticCompare17Res();
            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.setInuseTime(binf.getInuseTime());
            res.setMonvolstd(binf.getMonvolstd());
            //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
            /*if(tinf==null){
                res.setMonrealCap(0f);
                res.setMonprecentCap("0");
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
            if(tinf==null){
                //不存在放电记录则默认为实际预估容量全为0
                setSticCompare17Res(binf,reslist,stic.getPerformance());
                continue;
            }
            //找这次放电的最后一笔数据
            List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum());
            if(idDataList==null||idDataList.size()==0){
                res.setRealCap(0f);
                res.setPrecentCap("0");
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                //不存在放电记录则默认为实际预估容量全为0
                setSticCompare17Res(binf,reslist,stic.getPerformance());
                continue;
            }
            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);
            //Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest);
            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()));
            }
            //保留5位小数
            String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100));
            res.setPrecentCap(precentCap);
            List<Integer> monNums=new ArrayList<>();
            for (BatttestdataId data:idDataList) {//求单体的 实际容量,最小值就是单体的单体电压
                SticCompare17Res res=new SticCompare17Res();
                res.setProvice(binf.getProvice());
                res.setCity(binf.getCity());
                res.setCountry(binf.getCountry());
                res.setStationName(binf.getStationName());
                res.setDevName(binf.getDevName());
                res.setBattgroupName(binf.getBattgroupName());
                res.setProduct(binf.getProduct());
                res.setInuseTime(binf.getInuseTime());
                res.setMonvolstd(binf.getMonvolstd());
                res.setMonNum(data.getMonNum());
                Float monrealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
                res.setMonrealCap(monrealCap);
                //保留5位小数
                String monprecentCap = String.format("%.5f",(monrealCap/binf.getMoncapstd()*100));
                res.setMonprecentCap(monprecentCap);
                if(monrealCap>=moncapStd*badValue){
                    res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
                }
                if (monrealCap <= moncapStd * damageValue) {//损坏的
                    monNums.add(data.getMonNum());
                    res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                }
            }
            res.setMonNums(monNums);
            if(stic.getPerformance()==0){
                reslist.add(res);
            }else{
                if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
                if((monrealCap>moncapStd*damageValue)&&(monrealCap<moncapStd*badValue)){
                    res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                }
                if(stic.getPerformance()==null){
                    reslist.add(res);
                }else{
                    if(res.getMoncapperformance().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,"蓄电池组对比分析界面(同一品牌同一时间)");
    }
    //不存在放电记录则默认为实际预估容量全为0
    private void setSticCompare17Res( BattInf binf, List<SticCompare17Res> reslist,Integer performance) {
        for (int i=0;i<binf.getMoncount();i++){
            SticCompare17Res res=new SticCompare17Res();
            res.setProvice(binf.getProvice());
            res.setCity(binf.getCity());
            res.setCountry(binf.getCountry());
            res.setStationName(binf.getStationName());
            res.setDevName(binf.getDevName());
            res.setBattgroupName(binf.getBattgroupName());
            res.setProduct(binf.getProduct());
            res.setInuseTime(binf.getInuseTime());
            res.setMonvolstd(binf.getMonvolstd());
            res.setMonNum(i+1);
            res.setMonrealCap(0f);
            res.setMonprecentCap("0");
            res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
            if(performance==null){
                reslist.add(res);
            }else{
                if(res.getMoncapperformance().equals(Capperformance.getValue(performance))){
                    reslist.add(res);
                }
            }
            reslist.add(res);
        }
    }
}