whyclxw
7 天以前 8a64c0856ead3b87a425ceb84c8ee3c70fd8cd54
电源性能下拉
1 文件已重命名
5个文件已修改
1 文件已复制
171 ■■■■ 已修改文件
src/main/java/com/whyc/constant/BattCapperformanceEnum.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/constant/PwrCapperformanceEnum.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ConditionController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattInfService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/LeaderHomeService.java 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/PowerInfService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/constant/BattCapperformanceEnum.java
File was renamed from src/main/java/com/whyc/constant/Capperformance.java
@@ -3,7 +3,7 @@
import java.util.HashMap;
import java.util.Map;
public enum Capperformance {
public enum BattCapperformanceEnum {
    BATTSTATE_1(1,"优秀"),
    BATTSTATE_2(2,"劣化"),
    BATTSTATE_3(3,"损坏"),
@@ -13,7 +13,7 @@
    private Integer stateId;
    private String stateName;
    Capperformance(Integer stateId, String stateName) {
    BattCapperformanceEnum(Integer stateId, String stateName) {
        this.stateId = stateId;
        this.stateName = stateName;
    }
@@ -30,7 +30,7 @@
        if(stateId==null){
            return "";
        }
        for (Capperformance ele : values()) {
        for (BattCapperformanceEnum ele : values()) {
            if(ele.getStateId().equals(stateId)) {
                return ele.getStateName();
            }
@@ -39,7 +39,7 @@
    }
    public static Map<Integer,String> getOpInfo() {
        Map<Integer,String> map=new HashMap<>();
        for (Capperformance logOpEnum : Capperformance.values()) {
        for (BattCapperformanceEnum logOpEnum : BattCapperformanceEnum.values()) {
            map.put(logOpEnum.getStateId(),logOpEnum.getStateName());
        }
        return map;
src/main/java/com/whyc/constant/PwrCapperformanceEnum.java
copy from src/main/java/com/whyc/constant/Capperformance.java copy to src/main/java/com/whyc/constant/PwrCapperformanceEnum.java
File was copied from src/main/java/com/whyc/constant/Capperformance.java
@@ -3,17 +3,17 @@
import java.util.HashMap;
import java.util.Map;
public enum Capperformance {
    BATTSTATE_1(1,"优秀"),
    BATTSTATE_2(2,"劣化"),
    BATTSTATE_3(3,"损坏"),
    BATTSTATE_4(4,"未放电"),
public enum PwrCapperformanceEnum {
    PWRSTATE_1(1,"优秀"),
    PWRSTATE_2(2,"一般"),
    PWRSTATE_3(3,"预警"),
    PWRSTATE_4(4,"严重"),
    ;
    private Integer stateId;
    private String stateName;
    Capperformance(Integer stateId, String stateName) {
    PwrCapperformanceEnum(Integer stateId, String stateName) {
        this.stateId = stateId;
        this.stateName = stateName;
    }
@@ -30,7 +30,7 @@
        if(stateId==null){
            return "";
        }
        for (Capperformance ele : values()) {
        for (PwrCapperformanceEnum ele : values()) {
            if(ele.getStateId().equals(stateId)) {
                return ele.getStateName();
            }
@@ -39,7 +39,7 @@
    }
    public static Map<Integer,String> getOpInfo() {
        Map<Integer,String> map=new HashMap<>();
        for (Capperformance logOpEnum : Capperformance.values()) {
        for (PwrCapperformanceEnum logOpEnum : PwrCapperformanceEnum.values()) {
            map.put(logOpEnum.getStateId(),logOpEnum.getStateName());
        }
        return map;
src/main/java/com/whyc/controller/ConditionController.java
@@ -38,6 +38,9 @@
    private PwrdevAlarmService  pwrAlmService;
    @Autowired
    private PowerInfService  pinfService;
    @Autowired
    private DeviceStateService  deviceStateService;
    @Autowired
@@ -187,6 +190,12 @@
        return binfService.getCapperformance();
    }
    @ApiOperation(value = "获取电源性能(下拉)")
    @GetMapping("getPwrCapperformance")
    public Response getPwrCapperformance(){
        return pinfService.getPwrCapperformance();
    }
    @ApiOperation(value = "获取设备工作类型(下拉)")
    @GetMapping("getDevState")
    public Response getDevState(){
src/main/java/com/whyc/service/BattInfService.java
@@ -4,8 +4,7 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
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.dto.BattDto;
import com.whyc.dto.InfoDto;
import com.whyc.dto.Param.ParamAlmDto;
@@ -450,7 +449,7 @@
    }
    //获取容量性能(下拉)
    public Response getCapperformance() {
        Map<Integer,String> map= Capperformance.getOpInfo();
        Map<Integer,String> map= BattCapperformanceEnum.getOpInfo();
        return new Response().setII(1,true,map,"获取容量性能(下拉)");
    }
    //蓄电池组对比分析界面16
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);
            }
        }
src/main/java/com/whyc/service/LeaderHomeService.java
@@ -1,7 +1,7 @@
package com.whyc.service;
import com.whyc.constant.BattSingalIdEnum;
import com.whyc.constant.Capperformance;
import com.whyc.constant.BattCapperformanceEnum;
import com.whyc.constant.DevAlarmEnum;
import com.whyc.constant.PowerAlarmEnum;
import com.whyc.dto.*;
@@ -153,14 +153,14 @@
        //本年优良劣化损坏数量
        List<BattCapInfoDto> battCapInfoList = getBattCapInfo(battInfList,yearStartTime,null);
        long battGoodCount = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_1.getStateName())).count();
        long battBadCount = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName())).count();
        long battDamageCount = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName())).count();
        long battGoodCount = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_1.getStateName())).count();
        long battBadCount = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_2.getStateName())).count();
        long battDamageCount = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_3.getStateName())).count();
        //去年优良劣化损坏数量
        List<BattCapInfoDto> battCapInfoListLastYear = getBattCapInfo(battInfList,lastYearStartTime,lastYearEndTime);
        long battGoodCountLastYear = battCapInfoListLastYear.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_1.getStateName())).count();
        long battBadCountLastYear = battCapInfoListLastYear.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName())).count();
        long battDamageCountLastYear = battCapInfoListLastYear.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName())).count();
        long battGoodCountLastYear = battCapInfoListLastYear.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_1.getStateName())).count();
        long battBadCountLastYear = battCapInfoListLastYear.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_2.getStateName())).count();
        long battDamageCountLastYear = battCapInfoListLastYear.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_3.getStateName())).count();
        map.put("battGoodCount", battGoodCount);
        map.put("battBadCount", battBadCount);
        map.put("battDamageCount", battDamageCount);
@@ -860,7 +860,7 @@
        List<NameValueIntDto> data = new ArrayList<>();
        List<NameValueListDto> data2 = new ArrayList<>();
        //筛选出 站点优良,劣化,损坏 的电池组,并按照这个字段分组
        List<BattCapInfoDto> goodList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_1.getStateName()))
        List<BattCapInfoDto> goodList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_1.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap).reversed()).collect(Collectors.toList());
        if(goodList.size()==0){
            data.add(new NameValueIntDto("优良",0));
@@ -869,7 +869,7 @@
            data.add(new NameValueIntDto("优良",goodList.size()));
            data2.add(new NameValueListDto("优良",goodList.subList(0, Math.min(goodList.size(), 2))));
        }
        List<BattCapInfoDto> badList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName()))
        List<BattCapInfoDto> badList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_2.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        if(badList.size()==0){
            data.add(new NameValueIntDto("劣化",0));
@@ -878,7 +878,7 @@
            data.add(new NameValueIntDto("劣化",badList.size()));
            data2.add(new NameValueListDto("劣化",badList.subList(0, Math.min(badList.size(), 2))));
        }
        List<BattCapInfoDto> damageList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName()))
        List<BattCapInfoDto> damageList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_3.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        if(damageList.size()==0){
            data.add(new NameValueIntDto("损坏",0));
@@ -906,9 +906,9 @@
        List<NameValueListDto<NameValueDto>> data = new ArrayList<>();
        brandMap.forEach((brand,battCapInfoListTemp)->{
            //k -品牌
            long goodCount = battCapInfoListTemp.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_1.getStateName())).count();
            long badCount = battCapInfoListTemp.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName())).count();
            long damageCount = battCapInfoListTemp.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName())).count();
            long goodCount = battCapInfoListTemp.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_1.getStateName())).count();
            long badCount = battCapInfoListTemp.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_2.getStateName())).count();
            long damageCount = battCapInfoListTemp.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_3.getStateName())).count();
            long total = goodCount  + badCount + damageCount;
            //良好,劣化,损坏的百分比.(保留0位小数)
            int goodPercent = Math.round((float) goodCount / total * 100);
@@ -925,7 +925,7 @@
        });
        //data2,优良里面最大的和最小的品牌
        List<NameValueListDto<NameValueDto>> data2 = new ArrayList<>();
        List<BattCapInfoDto> goodList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_1.getStateName()))
        List<BattCapInfoDto> goodList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_1.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        NameValueListDto<NameValueDto> goodListDto = new NameValueListDto<>();
        List<NameValueDto> goodListValue = new ArrayList<>();
@@ -947,7 +947,7 @@
        goodListDto.setValue(goodListValue);
        data2.add(goodListDto);
        //劣化里面最大的和最小的品牌
        List<BattCapInfoDto> badList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName()))
        List<BattCapInfoDto> badList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_2.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        NameValueListDto<NameValueDto> badListDto = new NameValueListDto<>();
        List<NameValueDto> badListValue = new ArrayList<>();
@@ -970,7 +970,7 @@
        data2.add(badListDto);
        //损坏里面最大的和最小的品牌
        List<BattCapInfoDto> damageList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName()))
        List<BattCapInfoDto> damageList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_3.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        NameValueListDto<NameValueDto> damageListDto = new NameValueListDto<>();
@@ -1034,9 +1034,9 @@
        List<NameValueListDto<NameValueIntDto>> data = new ArrayList<>();
        NameValueListDto<NameValueIntDto> time1Dto = new NameValueListDto<>();
        time1Dto.setName(time1+"年内");
        List<BattCapInfoDto> badListOfTime1 = time1List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName()))
        List<BattCapInfoDto> badListOfTime1 = time1List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_2.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        List<BattCapInfoDto> damageListOfTime1 = time1List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName()))
        List<BattCapInfoDto> damageListOfTime1 = time1List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_3.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        NameValueIntDto time1BadDto = new NameValueIntDto();
        time1BadDto.setName("劣化");
@@ -1048,9 +1048,9 @@
        NameValueListDto<NameValueIntDto> time12Dto = new NameValueListDto<>();
        time12Dto.setName(time1+"-"+time2+"年");
        List<BattCapInfoDto> badListOfTime12 = time12List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName()))
        List<BattCapInfoDto> badListOfTime12 = time12List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_2.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        List<BattCapInfoDto> damageListOfTime12 = time12List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName()))
        List<BattCapInfoDto> damageListOfTime12 = time12List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_3.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        NameValueIntDto time12BadDto = new NameValueIntDto();
        time12BadDto.setName("劣化");
@@ -1062,9 +1062,9 @@
        NameValueListDto<NameValueIntDto> time2Dto = new NameValueListDto<>();
        time2Dto.setName(time2+"年以上");
        List<BattCapInfoDto> badListOfTime2 = time2List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName()))
        List<BattCapInfoDto> badListOfTime2 = time2List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_2.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        List<BattCapInfoDto> damageListOfTime2 = time2List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName()))
        List<BattCapInfoDto> damageListOfTime2 = time2List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(BattCapperformanceEnum.BATTSTATE_3.getStateName()))
                .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList());
        NameValueIntDto time2BadDto = new NameValueIntDto();
        time2BadDto.setName("劣化");
@@ -1154,7 +1154,7 @@
            if (testInf == null) {
                capInfo.setRealCap(0f);
                capInfo.setCapPercentage("0");
                capInfo.setPerformance(Capperformance.BATTSTATE_4.getStateName());
                capInfo.setPerformance(BattCapperformanceEnum.BATTSTATE_4.getStateName());
                continue;
            }
            //找这次放电的最后一笔数据
@@ -1162,7 +1162,7 @@
            if (idDataList == null || idDataList.size() == 0) {
                capInfo.setRealCap(0f);
                capInfo.setCapPercentage("0");
                capInfo.setPerformance(Capperformance.BATTSTATE_4.getStateName());
                capInfo.setPerformance(BattCapperformanceEnum.BATTSTATE_4.getStateName());
                continue;
            }
            Float moncapStd = battInf.getMoncapstd();
@@ -1170,13 +1170,13 @@
            Float groupRealCap = (float) BattCapFactory.GetMonomerCap(testInf.getTestCap(), hourRate, testInf.getTestCap(), testInf.getMaxMonvol(), testInf.getMinMonvol(), testInf.getGroupVol(), BattCapFactory.CapType_Real);
            capInfo.setRealCap(groupRealCap);
            if (groupRealCap >= moncapStd * badValue) {
                capInfo.setPerformance(Capperformance.BATTSTATE_1.getStateName());
                capInfo.setPerformance(BattCapperformanceEnum.BATTSTATE_1.getStateName());
            }
            if (groupRealCap <= moncapStd * damageValue) {
                capInfo.setPerformance(Capperformance.BATTSTATE_3.getStateName());
                capInfo.setPerformance(BattCapperformanceEnum.BATTSTATE_3.getStateName());
            }
            if ((groupRealCap > moncapStd * damageValue) && (groupRealCap < moncapStd * badValue)) {
                capInfo.setPerformance(Capperformance.BATTSTATE_2.getStateName());
                capInfo.setPerformance(BattCapperformanceEnum.BATTSTATE_2.getStateName());
            }
            //保留5位小数
            String capPercentage = String.format("%.5f", (groupRealCap / battInf.getMoncapstd() * 100));
src/main/java/com/whyc/service/PowerInfService.java
@@ -4,6 +4,8 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.BattCapperformanceEnum;
import com.whyc.constant.PwrCapperformanceEnum;
import com.whyc.dto.Param.ParamAlmDto;
import com.whyc.dto.PowerDto;
import com.whyc.dto.Response;
@@ -27,6 +29,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
public class PowerInfService {
@@ -162,4 +165,9 @@
    public List<Integer> getPowerIdList(ParamAlmDto dto) {
        return mapper.getPowerIdList(dto);
    }
    //获取电源性能(下拉)
    public Response getPwrCapperformance() {
        Map<Integer,String> map= PwrCapperformanceEnum.getOpInfo();
        return new Response().setII(1,true,map,"获取电源性能(下拉)");
    }
}