whyclxw
1 天以前 add5c816a5281cf6b1df4a0988e8b3a0c2b59bee
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -316,11 +316,14 @@
            res.setDevName(binf.getDevName());
            res.setProduct(binf.getProduct());
            res.setInuseTime(binf.getInuseTime());
            res.setInuseTimeStr(ActionUtil.sdfwithday.format(binf.getInuseTime()));
            res.setMonvolstd(binf.getMonvolstd());
            res.setMoncapstd(binf.getMoncapstd());
            res.setStationId(binf.getStationId());
            res.setPowerId(binf.getPowerId());
            res.setDevId(binf.getDevId());
            res.setBattgroupId(binf.getBattgroupId());
            res.setFullName(binf.getFullName());
            //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
            if(tinf==null){
@@ -389,11 +392,97 @@
        }
        map.put("avgCap",sumCap/binfList.size());
        map.put("standCapDiff",maxCap-minCap);
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(comparelist, stic.getPageNum(), stic.getPageSize());
        return new Response().setIII(1,comparelist.size()>0,pageInfo,map,"蓄电池组对比分析界面(同一品牌同一时间)");
    }
    /*蓄电池组对比分析导出使用
     */
    public List<SticCompare15Res> exportBattCompare(BattCompareStic stic) {
        //获取核容优劣,损坏参数
        List<AppParam> paramList=appParamService.getHrParam();
        Float badValue=0f;
        Float damageValue=0f;
        if(paramList!=null){
            for (AppParam param:paramList) {
                if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){
                    badValue=param.getParamValue();
                }
                if(param.getParamNamePsx().equals("batt_mon_damage_val")){
                    damageValue=param.getParamValue();
                }
            }
        }
        //1查询符合条件的电池组
        List<BattInf> binfList=battInfService.getBattCompare15Statistic(stic);
        List<SticCompare15Res> comparelist=new ArrayList<>();
        if(binfList!=null&&binfList.size()>=0){
            for (BattInf binf:binfList) {
                SticCompare15Res res=new SticCompare15Res();
                res.setProvice(binf.getProvice());
                res.setCity(binf.getCity());
                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.setInuseTimeStr(ActionUtil.sdfwithday.format(binf.getInuseTime()));
                res.setMonvolstd(binf.getMonvolstd());
                res.setMoncapstd(binf.getMoncapstd());
                res.setStationId(binf.getStationId());
                res.setPowerId(binf.getPowerId());
                res.setDevId(binf.getDevId());
                res.setBattgroupId(binf.getBattgroupId());
                res.setFullName(binf.getFullName());
                //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
                BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
                if(tinf==null){
                    res.setRealCap(0f);
                    res.setPrecentCap("0.00000");
                    res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId()));
                    res.setStopReason("--");
                    res.setFloatGroupVol(0f);
                }else{
                    res.setStopReason(StopReasonEnum.getValue(tinf.getTestStoptype()));
                    res.setFloatGroupVol(tinf.getFloatGroupVol());
                    //找这次放电的最后一笔数据
                    List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum());
                    if(idDataList==null||idDataList.size()==0){
                        res.setRealCap(0f);
                        res.setPrecentCap("0.00000");
                        res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId()));
                        res.setFloatGroupVol(0f);
                    }else{
                        Float moncapStd=binf.getMoncapstd();
                        int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr());
                        Float grouprealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
                        //Float restCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest);
                        res.setRealCap(grouprealCap);
                        if(grouprealCap>=moncapStd*badValue){
                            res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId()));
                        }
                        if(grouprealCap<=moncapStd*damageValue){
                            res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId()));
                        }
                        if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                            res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId()));
                        }
                        //保留5位小数
                        String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100));
                        res.setPrecentCap(precentCap);
                    }
                }
                if(stic.getPerformance()==null){
                    comparelist.add(res);
                }else{
                    if(res.getCapperformance().equals(BattCapperformanceEnum.getValue(stic.getPerformance()))){
                        comparelist.add(res);
                    }
                }
            }
        }
        return comparelist;
    }
    //蓄电池组对比分析界面(不同品牌同一时间)(1.2.16)
    public Response getBattCompare16Statistic(BattCompareStic stic) {
        //获取核容优劣,损坏参数