| | |
| | | return new Response<>().set(1, false, "发生异常:" + e.getCause()); |
| | | } |
| | | } |
| | | |
| | | //蓄电池组优劣分析(用蓄电池组组后评估的统计) |
| | | public Response getGroupAnalysis2(int userId) { |
| | | try { |
| | | //0.查询劣化(告警)和损坏(更换)的阈值 |
| | | QueryWrapper<AlarmParam> alarmWrapper = new QueryWrapper(); |
| | | alarmWrapper.and(wrapper -> { |
| | | return wrapper.eq("alm_name", "Batt_Alarm_Type_CapAlarm").or().eq("alm_name", "Batt_Alarm_Type_CapChange"); |
| | | }); |
| | | alarmWrapper.orderByAsc("alm_id"); |
| | | List<AlarmParam> paramList = alarmParamMapper.selectList(alarmWrapper); |
| | | float capAlarm = 0f; |
| | | float capChange = 0f; |
| | | if (paramList != null && paramList.size() > 0) { |
| | | capAlarm = paramList.get(0).getAlmLowCoe();//劣化参数0.8 |
| | | capChange = paramList.get(1).getAlmLowCoe();//损坏参数0.6 |
| | | } else { |
| | | capAlarm = 0.8f; |
| | | capChange = 0.6f; |
| | | } |
| | | //小于capAlarm |
| | | int alarmNum = 0; |
| | | //小于capChange |
| | | int changeNum = 0; |
| | | //放电正常 |
| | | int goodSum = 0; |
| | | //未正常 |
| | | int noHrDisNum = 0; |
| | | //实际容量 |
| | | float cap = 0f; |
| | | //去年的数据---------------- |
| | | //小于capAlarm |
| | | int oldalarmNum = 0; |
| | | //小于capChange |
| | | int oldchangeNum = 0; |
| | | //放电正常 |
| | | int oldgoodSum = 0; |
| | | //未正常 |
| | | int oldnoHrDisNum = 0; |
| | | //实际容量去年 |
| | | float oldcap = 0f; |
| | | //0.查询所有的电池组 |
| | | List<Battinf> binfList = binfMapper.getBinfList(userId); |
| | | if (binfList != null && binfList.size() > 0) { |
| | | for (Battinf binf : binfList) { |
| | | int battgroupId = binf.getBattGroupId(); |
| | | float monCapStd = binf.getMonCapStd(); |
| | | float monVolstd = binf.getMonVolStd(); |
| | | //放电次数 |
| | | int disNum = 0; |
| | | int olddisNum = 0; |
| | | //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个(本年度) |
| | | BatttestdataInf inf = mapper.getGroupAnalysisQB(battgroupId); |
| | | //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个(上一年度) |
| | | BatttestdataInf oldinf = mapper.getGroupAnalysisQBOld(battgroupId); |
| | | if (inf != null) { |
| | | disNum=1; |
| | | int hourRate = BattCapFactory.GetHourRate(monCapStd, inf.getTestCurr()); |
| | | cap = (float) BattCapFactory.GetMonomerCap(monCapStd, hourRate, inf.getTestCap(), inf.getMaxMonvol(), inf.getMinMonvol(), monVolstd, BattCapFactory.CapType_Real); |
| | | } |
| | | if(oldinf!=null){ |
| | | olddisNum=1; |
| | | int oldhourRate = BattCapFactory.GetHourRate(monCapStd, oldinf.getTestCurr()); |
| | | oldcap = (float) BattCapFactory.GetMonomerCap(monCapStd, oldhourRate, oldinf.getTestCap(), oldinf.getMaxMonvol(), oldinf.getMinMonvol(), monVolstd, BattCapFactory.CapType_Real); |
| | | } |
| | | //查询电池告警内阻告警 |
| | | List listALmRes = alarmDataMapper.getAlm2(battgroupId); |
| | | //未放电:本年度未放电,且无内阻告警<13,14>(预告警(重要),告警(紧急))-----本年度 |
| | | if( (disNum==0)&&(listALmRes.size()<=0) ){ |
| | | noHrDisNum+=1; |
| | | } |
| | | //优秀:本年度已放电,且容量健康,无内阻告警(预告警(重要),告警(紧急)) |
| | | if( (disNum>0)&&(cap > capAlarm * monCapStd)&&(listALmRes.size()<=0)){ |
| | | goodSum+=1; |
| | | } |
| | | /*劣化:本年度未放电,内阻告警(预告警(重要),告警(紧急)) |
| | | *容量小于劣化阈值,大于损坏阈值,内阻告警(预告警,告警) |
| | | * 容量小于劣化阈值,内阻正常 |
| | | * 容量正常,内阻告警(预告警,告警) |
| | | */ |
| | | if (((disNum==0)&&(listALmRes.size()>0)) |
| | | ||((disNum>0)&&(cap <= capAlarm * monCapStd && cap >= capChange * monCapStd)&&(listALmRes.size()>0)) |
| | | ||((disNum>0)&&(cap <= capAlarm * monCapStd)&&(listALmRes.size()<=0)) |
| | | ||(disNum>0)&&(cap > capAlarm * monCapStd)&&(listALmRes.size()>0)){ |
| | | alarmNum+=1; |
| | | } |
| | | //损坏:容量低,内阻告警 |
| | | if((disNum!=0)&&(cap< capChange * monCapStd)&&(listALmRes.size()>0)){ |
| | | changeNum+=1; |
| | | } |
| | | |
| | | //未放电:本年度未放电,且无内阻告警<13,14>(预告警(重要),告警(紧急))-----其他年度 |
| | | if( (olddisNum==0)&&(listALmRes.size()<=0) ){ |
| | | oldnoHrDisNum+=1; |
| | | } |
| | | //优秀:本年度已放电,且容量健康,无内阻告警(预告警(重要),告警(紧急)) |
| | | if( (olddisNum>0)&&(oldcap > capAlarm * monCapStd)&&(listALmRes.size()<=0)){ |
| | | oldgoodSum+=1; |
| | | } |
| | | /*劣化:本年度未放电,内阻告警(预告警(重要),告警(紧急)) |
| | | *容量小于劣化阈值,大于损坏阈值,内阻告警(预告警,告警) |
| | | * 容量小于劣化阈值,内阻正常 |
| | | * 容量正常,内阻告警(预告警,告警) |
| | | */ |
| | | if (((olddisNum==0)&&(listALmRes.size()>0)) |
| | | ||((olddisNum>0)&&(oldcap <= capAlarm * monCapStd && oldcap >= capChange * monCapStd)&&(listALmRes.size()>0)) |
| | | ||((olddisNum>0)&&(oldcap <= capAlarm * monCapStd)&&(listALmRes.size()<=0)) |
| | | ||(olddisNum>0)&&(oldcap > capAlarm * monCapStd)&&(listALmRes.size()>0)){ |
| | | oldalarmNum+=1; |
| | | } |
| | | //损坏:容量低,内阻告警 |
| | | if((olddisNum!=0)&&(oldcap< capChange * monCapStd)&&(listALmRes.size()>0)){ |
| | | oldchangeNum+=1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | Map<String, Integer> numMap = new HashMap<>(); |
| | | numMap.put("alarmNum", alarmNum); |
| | | numMap.put("changeNum", changeNum); |
| | | //总电池组(分类) |
| | | int groupNum = binfMapper.geGroupCount(userId); |
| | | numMap.put("groupNum", groupNum); |
| | | /*//已放电电池组数 |
| | | int inDischargeNum = binfMapper.searchInDischarge(userId);*/ |
| | | //蓄电池优良(已经放电数-告警数) |
| | | numMap.put("goodSum", goodSum); |
| | | /*本年度已核容放电电池组(testdate_inf中test_type=3,test_startType=3) |
| | | int hrDisNum = testInfService.getHrQuarter(userId); |
| | | * 修改为:领导层本年度已放数 仅需要统计放电正常停止的 正常停止的条件如下: |
| | | stop_type: |
| | | 2-放电时间到终止并且放电时间超过2小时 |
| | | 3-放电容量到终止 |
| | | 4-单体电压下限到终止 |
| | | 6-组端电压下限到终止*/ |
| | | //int hrDisNum = mapper.getHrQuarterZC(userId); |
| | | numMap.put("noHrDisNum", noHrDisNum); |
| | | //去年----------------------------统计 |
| | | Map<String, Integer> oldnumMap = new HashMap<>(); |
| | | oldnumMap.put("alarmNum", oldalarmNum); |
| | | oldnumMap.put("changeNum", oldchangeNum); |
| | | //总电池组(分类) |
| | | oldnumMap.put("groupNum", groupNum); |
| | | //蓄电池优良(已经放电数-告警数) |
| | | oldnumMap.put("goodSum", oldgoodSum); |
| | | /*本年度已核容放电电池组(testdate_inf中test_type=3,test_startType=3) |
| | | int hrDisNum = testInfService.getHrQuarter(userId); |
| | | * 修改为:领导层本年度已放数 仅需要统计放电正常停止的 正常停止的条件如下: |
| | | stop_type: |
| | | 2-放电时间到终止并且放电时间超过2小时 |
| | | 3-放电容量到终止 |
| | | 4-单体电压下限到终止 |
| | | 6-组端电压下限到终止*/ |
| | | oldnumMap.put("noHrDisNum", oldnoHrDisNum); |
| | | |
| | | return new Response().setIII(1, true, numMap,oldnumMap, "蓄电池组优劣分析"); |
| | | } catch (Exception e) { |
| | | return new Response<>().set(1, false, "发生异常:" + e.getCause()); |
| | | } |
| | | } |
| | | //获取本年已核容放电电池组最新一次数据详情 |
| | | public Response getHrYeardisBattInfo() { |
| | | int userId = Integer.parseInt(ActionUtil.getUser().getUId().toString()); |