whyclxw
7 天以前 8a64c0856ead3b87a425ceb84c8ee3c70fd8cd54
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -3,15 +3,13 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.Capperformance;
import com.whyc.constant.PowerAlarmEnum;
import com.whyc.constant.BattCapperformanceEnum;
import com.whyc.constant.StopReasonEnum;
import com.whyc.dto.Real.TestDataDto;
import com.whyc.dto.Response;
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;
@@ -22,7 +20,6 @@
import com.whyc.pojo.db_user.Baojigroup;
import com.whyc.util.ActionUtil;
import com.whyc.util.PageInfoUtils;
import com.whyc.util.ThreadLocalUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -305,7 +302,7 @@
            if(tinf==null){
                res.setRealCap(0f);
                res.setPrecentCap("0");
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId()));
                continue;
            }
            //找这次放电的最后一笔数据
@@ -313,7 +310,7 @@
            if(idDataList==null||idDataList.size()==0){
                res.setRealCap(0f);
                res.setPrecentCap("0");
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId()));
                continue;
            }
            Float moncapStd=binf.getMoncapstd();
@@ -322,13 +319,13 @@
            //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()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId()));
            }
            if(grouprealCap<=moncapStd*damageValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId()));
            }
            if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId()));
            }
            //保留5位小数
            String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100));
@@ -344,7 +341,7 @@
            if(stic.getPerformance()==null){
                reslist.add(res);
            }else{
                if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
                if(res.getCapperformance().equals(BattCapperformanceEnum.getValue(stic.getPerformance()))){
                    reslist.add(res);
                }
            }
@@ -398,7 +395,7 @@
            if(tinf==null){
                res.setRealCap(0f);
                res.setPrecentCap("0");
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId()));
                res.setStopReason("--");
                continue;
            }
@@ -409,13 +406,13 @@
            //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()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId()));
            }
            if(grouprealCap<=moncapStd*damageValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId()));
            }
            if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId()));
            }
            //保留5位小数
            String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100));
@@ -425,7 +422,7 @@
            if(stic.getPerformance()==null){
                reslist.add(res);
            }else{
                if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
                if(res.getCapperformance().equals(BattCapperformanceEnum.getValue(stic.getPerformance()))){
                    reslist.add(res);
                }
            }
@@ -496,18 +493,18 @@
                String monprecentCap = String.format("%.5f",(monrealCap/binf.getMoncapstd()*100));
                res.setMonprecentCap(monprecentCap);
                if(monrealCap>=moncapStd*badValue){
                    res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
                    res.setMoncapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId()));
                }
                if (monrealCap <= moncapStd * damageValue) {//损坏的
                    res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                    res.setMoncapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId()));
                }
                if((monrealCap>moncapStd*damageValue)&&(monrealCap<moncapStd*badValue)){
                    res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                    res.setMoncapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId()));
                }
                if(stic.getPerformance()==null){
                    reslist.add(res);
                }else{
                    if(res.getMoncapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
                    if(res.getMoncapperformance().equals(BattCapperformanceEnum.getValue(stic.getPerformance()))){
                        reslist.add(res);
                    }
                }
@@ -536,11 +533,11 @@
            res.setMonNum(i+1);
            res.setMonrealCap(0f);
            res.setMonprecentCap("0");
            res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
            res.setMoncapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId()));
            if(performance==null){
                reslist.add(res);
            }else{
                if(res.getMoncapperformance().equals(Capperformance.getValue(performance))){
                if(res.getMoncapperformance().equals(BattCapperformanceEnum.getValue(performance))){
                    reslist.add(res);
                }
            }
@@ -697,19 +694,19 @@
            res.setRealCap(grouprealCap);
            //res.setDisChargeType(1);
            if(grouprealCap>=moncapStd*badValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
                int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
                xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()),value+1);
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId()));
                int value=xnmap.get(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId()));
                xnmap.put(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId()),value+1);
            }
            if(grouprealCap<=moncapStd*damageValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()),value+1);
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId()));
                int value=xnmap.get(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId()));
                xnmap.put(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId()),value+1);
            }
            if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()),value+1);
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId()));
                int value=xnmap.get(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId()));
                xnmap.put(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId()),value+1);
            }
            reslist.add(res);
        }
@@ -859,30 +856,30 @@
            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
            if(tinf==null){
                res.setRealCap(0f);
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId()));
            }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()));
                    res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.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()));
                        res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId()));
                    }
                    if(grouprealCap<=moncapStd*damageValue){
                        res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                        res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId()));
                    }
                    if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                        res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                        res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId()));
                    }
                }
            }
            if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
            if(res.getCapperformance().equals(BattCapperformanceEnum.getValue(stic.getPerformance()))){
                reslist.add(res);
            }
        }
@@ -931,7 +928,7 @@
            //查询当前电池组当前单体电压或者单体内阻低于其单体电压的下下限或高于上上限判定当前电池组劣化
            int flag = rtdataService.getVolAndRes(binf.getBattgroupId());
            if(flag==1){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId()));
                reslist.add(res);
            }
        }