| | |
| | | import com.whyc.dto.paramter.GroupTestCapPar; |
| | | import com.whyc.dto.result.GroupTestCapRes; |
| | | import com.whyc.dto.result.ReportBattTestDTO; |
| | | import com.whyc.mapper.BattParamLowMapper; |
| | | import com.whyc.mapper.BattTestDataStopMapper; |
| | | import com.whyc.mapper.BatttestdataInfMapper; |
| | | import com.whyc.pojo.BattParamLow; |
| | | import com.whyc.pojo.BattTestDataStop; |
| | | import com.whyc.pojo.Battinf; |
| | | import com.whyc.pojo.BatttestdataInf; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.*; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.MessageUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class BatttestdataInfService { |
| | |
| | | @Resource |
| | | private BattParamLowMapper battParamLowMapper; |
| | | |
| | | @Resource |
| | | AlarmParamMapper alarmParamMapper; |
| | | |
| | | @Resource |
| | | BattInfMapper binfMapper; |
| | | |
| | | @Resource |
| | | BattalarmDataMapper alarmDataMapper; |
| | | |
| | | //在线监测-历史监控-获取充放电记录 |
| | | public Response searchBattTestInfDataById(int battGroupId,int fbsDeviceId) { |
| | | public Response searchBattTestInfDataById(int battGroupId, int fbsDeviceId) { |
| | | String lang = ActionUtil.getLang(); |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("BattGroupId", battGroupId); |
| | | wrapper.eq("data_available", 1); |
| | |
| | | List<BatttestdataInf> list = mapper.selectList(wrapper); |
| | | list.stream().forEach(tinf -> { |
| | | //放电终止原因 |
| | | if ( fbsDeviceId/ 100000 == 6185) { |
| | | if (fbsDeviceId / 100000 == 6185) { |
| | | //61850设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_6185(tinf.getTestStoptype())); |
| | | } else if (fbsDeviceId / 100000 == 4016) { |
| | |
| | | } else if (fbsDeviceId / 100000 == 8059) { |
| | | //一体机设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_8059(tinf.getTestStoptype())); |
| | | } else if(fbsDeviceId / 100000 == 6087) { |
| | | } else if (fbsDeviceId / 100000 == 6087) { |
| | | //电操核容设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_6087(tinf.getTestStoptype())); |
| | | }else if(fbsDeviceId / 100000 == 4830) { |
| | | } else if (fbsDeviceId / 100000 == 4830) { |
| | | //FBO4830设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_4830(tinf.getTestStoptype())); |
| | | }else if(fbsDeviceId / 100000 == 4815) { |
| | | } else if (fbsDeviceId / 100000 == 4831) { |
| | | //FBO4831设备放电停止原因 |
| | | tinf.setTestStoptypeReason(MessageUtils.getMessageSocket(BattTestData.getStopType_4831(tinf.getTestStoptype()), lang)); |
| | | } else if (fbsDeviceId / 100000 == 4815) { |
| | | //FBO4815设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_4815(tinf.getTestStoptype())); |
| | | } else { |
| | |
| | | } |
| | | |
| | | //最后一次核容放电数据 |
| | | public Response searchBattLastHrDataById(int battGroupId, int devId) { |
| | | public Response searchBattLastHrDataById(int battGroupId, int devId, String lang) { |
| | | PageHelper.startPage(1, 1); |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("BattGroupId", battGroupId); |
| | | wrapper.eq("data_available", 1); |
| | | wrapper.eq("test_type", 3); |
| | | wrapper.eq("test_starttype", 3); |
| | | wrapper.orderByDesc("test_starttime"); |
| | | wrapper.last(" and (test_stoptype in (3, 4, 6) or (test_stoptype = 2 and test_timelong >= 7200)) ORDER BY test_starttime DESC "); |
| | | BatttestdataInf tinf = mapper.selectOne(wrapper); |
| | | List<BattTestDataStop> list = new ArrayList<BattTestDataStop>(); |
| | | if (tinf != null) { |
| | |
| | | } else if(devId / 100000 == 6087) { |
| | | //电操核容设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_6087(tinf.getTestStoptype())); |
| | | }else if(devId / 100000 == 4830) { |
| | | }else if (devId / 100000 == 4830) { |
| | | // FBO4830设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_4830(tinf.getTestStoptype())); |
| | | }else if(devId / 100000 == 4815) { |
| | | } else if (devId / 100000 == 4831) { |
| | | // FBO4830设备放电停止原因 |
| | | tinf.setTestStoptypeReason(MessageUtils.getMessageSocket(BattTestData.getStopType_4831(tinf.getTestStoptype()), lang)); |
| | | } else if (devId / 100000 == 4815) { |
| | | //FBO4815设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_4815(tinf.getTestStoptype())); |
| | | } else if (devId / 100000 == 9149) { |
| | | //FBO9149设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_9149(tinf.getTestStoptype())); |
| | | } else { |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType(tinf.getTestStarttype(), tinf.getTestStoptype())); |
| | | } |
| | |
| | | //报表分析使用 |
| | | public List<BatttestdataInf> searchByTestType(BatttestdataInf tinf){ |
| | | List<BatttestdataInf> list = mapper.searchByTestType(tinf); |
| | | float cap=0f;//实际容量 |
| | | float restcap=0f;//剩余容量 |
| | | for (BatttestdataInf binf:list) { |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(),binf.getTestCurr()); |
| | | cap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate,binf.getTestCap(), binf.getMaxMonvol(), binf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | restcap=(float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate,binf.getTestCap(), binf.getMaxMonvol(), binf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); |
| | | binf.setGroupVol(cap);; |
| | | float cap = 0f;//实际容量 |
| | | float restcap = 0f;//剩余容量 |
| | | for (BatttestdataInf binf : list) { |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), binf.getTestCurr()); |
| | | cap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, binf.getTestCap(), binf.getMaxMonvol(), binf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | restcap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, binf.getTestCap(), binf.getMaxMonvol(), binf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); |
| | | binf.setGroupVol(cap); |
| | | ; |
| | | binf.setMonVol(restcap); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | //1.4电池组性能评估(根据电池组id查询所有的放电记录求出放电总次数,最高历史容量,最低历史容量,平均容量,最新测试容量) |
| | | public List searchDischargeTest(BatttestdataInf tinf){ |
| | | List<BatttestdataInf> list = mapper.searchDischargeTest(tinf); |
| | | int sum=0;//总测试次数 |
| | | float cap=0f;//实际容量 |
| | | float allCap=0f;//总容量 |
| | | float maxCap=0f;//最高容量 |
| | | float minCap=10000f;//最低容量 |
| | | float avgCap=0f;//平均容量 |
| | | float lastCap=0f;//最近测试容量 |
| | | for (int i = 0; i <list.size() ; i++) { |
| | | public Map<String, Object> searchDischargeTest(Integer battGroupId, float monCapStd, float monVolStd, Date recordStartTime, Date recordEndTime) { |
| | | List<BatttestdataInf> list = mapper.searchDischargeTest(battGroupId, recordStartTime, recordEndTime); |
| | | List<BatttestdataInf> testList = new LinkedList<>(); |
| | | int sum = 0;//总测试次数 |
| | | float cap = 0f;//实际容量 |
| | | float allCap = 0f;//总容量 |
| | | float maxCap = 0f;//最高容量 |
| | | float minCap = 10000f;//最低容量 |
| | | float avgCap = 0f;//平均容量 |
| | | float lastCap = 0f;//最近测试容量 |
| | | for (int i = 0; i < list.size(); i++) { |
| | | BatttestdataInf binf = list.get(i); |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(),binf.getTestCurr()); |
| | | cap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate,binf.getTestCap(), binf.getMaxMonvol(), binf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | if(sum==0){ |
| | | lastCap=cap; |
| | | int hourRate = BattCapFactory.GetHourRate(monCapStd, binf.getTestCurr()); |
| | | cap = (float) BattCapFactory.GetMonomerCap(monCapStd, hourRate, binf.getTestCap(), binf.getMaxMonvol(), binf.getMinMonvol(), monVolStd, BattCapFactory.CapType_Real); |
| | | /* float testcap = binf.getTestCap(); |
| | | float maxMonvol = binf.getMaxMonvol(); |
| | | float minMonvol = binf.getMinMonvol(); |
| | | if (battGroupId == 1000145) { |
| | | System.out.println(battGroupId + " " + monCapStd + " " + hourRate + " " + testcap + " " + maxMonvol + " " + minMonvol + " " + monVolStd + " " + BattCapFactory.CapType_Real + " "); |
| | | }*/ |
| | | binf.setRealCap(cap); |
| | | testList.add(binf); |
| | | if (sum == 0) { |
| | | lastCap = cap; |
| | | } |
| | | if(maxCap<=cap){ |
| | | maxCap=cap;//最大 |
| | | if (maxCap <= cap) { |
| | | maxCap = cap;//最大 |
| | | } |
| | | if(minCap>=cap){ |
| | | minCap=cap;//最小 |
| | | if (minCap >= cap) { |
| | | minCap = cap;//最小 |
| | | } |
| | | allCap+=cap; |
| | | allCap += cap; |
| | | sum++; |
| | | } |
| | | if(sum!=0){ |
| | | avgCap=allCap/sum;//平均容量 |
| | | }else{ |
| | | avgCap=0; |
| | | minCap=0; |
| | | if (sum != 0) { |
| | | avgCap = allCap / sum;//平均容量 |
| | | } else { |
| | | avgCap = 0; |
| | | minCap = 0; |
| | | } |
| | | List list1 = new ArrayList<>(); |
| | | list1.add(tinf.getBattGroupId()); |
| | | list1.add(sum); |
| | | list1.add(maxCap); |
| | | list1.add(avgCap); |
| | | list1.add(minCap); |
| | | list1.add(lastCap); |
| | | return list1; |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("battGroupid", battGroupId); |
| | | map.put("sum", sum); |
| | | map.put("maxCap", maxCap); |
| | | map.put("avgCap", avgCap); |
| | | map.put("minCap", minCap); |
| | | map.put("lastCap", lastCap); |
| | | map.put("testList", testList); |
| | | return map; |
| | | } |
| | | |
| | | public Response searchBattLifeNow(int pageNum,int pageSize,Battinf binf){ |
| | |
| | | return new Response().setII(1, list.size() > 0 ? true : false, pageInfo, "统计时间段内设备的测试容量"); |
| | | } |
| | | |
| | | //管理员首页头部信息加入 |
| | | public int getYearAnalysis(int userId) { |
| | | //Map<String, Integer> map = new HashMap<>(); |
| | | //本年已核容放电电池组数 |
| | | int hrdisNum = mapper.getHrQuarterZC(userId); |
| | | //本年已停电放电电池组数 |
| | | //int jcdisNum = mapper.getJcQuarter(userId); |
| | | //map.put("hrdisNum", hrdisNum); |
| | | // map.put("jcdisNum", jcdisNum); |
| | | return hrdisNum; |
| | | } |
| | | |
| | | //获取本年已核容电池组 |
| | | public Response getHrYeardisBatt() { |
| | | UserInf uinf = ActionUtil.getUser(); |
| | | String userId = uinf.getUId().toString(); |
| | | List<Battinf> list = mapper.getHrYeardisBatt(userId); |
| | | return new Response().setII(1, list.size() > 0, list, "获取本年已核容电池组"); |
| | | } |
| | | |
| | | //获取实时停电放电电池组 |
| | | public Response getJcdisBatt() { |
| | | UserInf uinf = ActionUtil.getUser(); |
| | | String userId = uinf.getUId().toString(); |
| | | List<Battinf> list = mapper.getJcdisBatt(userId); |
| | | for (Battinf binf : list) { |
| | | int battgroupId = 0; |
| | | battgroupId = binfMapper.searchBattGroupId(binf.getStationId()); |
| | | binf.setBattGroupId(battgroupId); |
| | | } |
| | | return new Response().setII(1, list.size() > 0, list, "获取本年已核容电池组"); |
| | | } |
| | | |
| | | //测试信息 |
| | | @Transactional |
| | | public Response getTestdataInfAnalysis(int userId) { |
| | |
| | | } |
| | | } |
| | | |
| | | //管理员首页统计测试信息 |
| | | /*管理员首页统计测试信息 |
| | | if (testType == 3) { |
| | | // 测试类型为放电 |
| | | if (testStarttype == 3) { |
| | | 核容放电 |
| | | } else { |
| | | if (testDatatype==1) { |
| | | 停电放电 1 |
| | | } else { |
| | | 监测放电 0 |
| | | } |
| | | } |
| | | } else if (testType == 2) { |
| | | // 测试类型为充电 |
| | | if (testStarttype == 3) { |
| | | 核容充电 |
| | | } else { |
| | | 监测充电 |
| | | } |
| | | }*/ |
| | | public Map<String, Integer> analysisTestData(List<BatttestdataInf> list) { |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | int disNum = 0;//放电 |
| | | int chNum = 0;//充电 |
| | | int hrdisNum = 0;//核容放电 |
| | | int jcdisNum = 0;//监测放电 |
| | | int jcchNum = 0;//监测充电 |
| | | int dddisNum = 0;//停电放电 |
| | | int hrchNum = 0;//核容充电 |
| | | Map<Integer, List<BatttestdataInf>> listDisMap = list.stream().collect(Collectors.groupingBy(tinf -> tinf.getTestType())); |
| | | for (Integer dis : listDisMap.keySet()) { |
| | | //放电 |
| | | if (dis == 3) { |
| | | disNum = listDisMap.get(dis).size(); |
| | | } |
| | | //充电 |
| | | if (dis == 2) { |
| | | chNum = listDisMap.get(dis).size(); |
| | | if (list != null && list.size() > 0) { |
| | | for (BatttestdataInf tinf : list) { |
| | | if (tinf.getTestType() == 3) { |
| | | // 测试类型为放电 |
| | | if (tinf.getTestStarttype() == 3) { |
| | | if ((tinf.getTestStoptype() == 3 || tinf.getTestStoptype() == 4 || tinf.getTestStoptype() == 6) || |
| | | (tinf.getTestStoptype() == 2 && tinf.getTestTimelong() >= 7200)) { |
| | | hrdisNum += 1; |
| | | } |
| | | } else { |
| | | if (tinf.getTestDatatype() == 1) { |
| | | dddisNum += 1; |
| | | } |
| | | if (tinf.getTestDatatype() == 0) { |
| | | jcdisNum += 1; |
| | | } |
| | | } |
| | | } else if (tinf.getTestType() == 2) { |
| | | // 测试类型为充电 |
| | | if (tinf.getTestStarttype() == 3) { |
| | | hrchNum += 1; |
| | | } else { |
| | | jcchNum += 1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | Map<String, List<BatttestdataInf>> listMap = list.stream().collect(Collectors.groupingBy(tinf -> tinf.getTestType() + "_" + tinf.getTestStarttype())); |
| | | for (String type : listMap.keySet()) { |
| | | //核容放电 |
| | | if (type.equals("3_3")) { |
| | | hrdisNum = listMap.get(type).size(); |
| | | |
| | | } |
| | | //核容充电 |
| | | if (type.equals("2_3")) { |
| | | hrchNum = listMap.get(type).size(); |
| | | } |
| | | } |
| | | map.put("hrdisNum", hrdisNum); |
| | | map.put("hrchNum", hrchNum); |
| | | map.put("jcdisNum", disNum - hrdisNum); |
| | | map.put("jcchNum", chNum - hrchNum); |
| | | map.put("jcdisNum", jcdisNum); |
| | | map.put("dddisNum", dddisNum); |
| | | map.put("jcchNum", jcchNum); |
| | | return map; |
| | | } |
| | | |
| | |
| | | int num = mapper.getPlanStaticToday(userId); |
| | | return num; |
| | | } |
| | | |
| | | //本年度核容放电电池组(testdate_inf中test_type=3,test_startType=3) |
| | | public int getHrQuarter(int userId) { |
| | | //本年度 |
| | | int hrQuarter = mapper.getHrQuarter(userId); |
| | | return hrQuarter; |
| | | } |
| | | |
| | | /*领导层本年度已放数 仅需要统计放电正常停止的 正常停止的条件如下: |
| | | stop_type: |
| | | 2-放电时间到终止 |
| | | 3-放电容量到终止 |
| | | 4-单体电压下限到终止 |
| | | 6-组端电压下限到终止 |
| | | 并且放电时间超过2小时*/ |
| | | public int getHrQuarterZC(int userId) { |
| | | int hrQuarter = mapper.getHrQuarterZC(userId); |
| | | return hrQuarter; |
| | | } |
| | | |
| | | //蓄电池组优劣分析(用蓄电池组组后评估的统计) |
| | | public Response getGroupAnalysis(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; |
| | | //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; |
| | | //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个 |
| | | BatttestdataInf inf = mapper.getGroupAnalysisQB(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); |
| | | /*float testcap = inf.getTestCap(); |
| | | float maxMonvol = inf.getMaxMonvol(); |
| | | float minMonvol = inf.getMinMonvol(); |
| | | |
| | | if (battgroupId == 1000145) { |
| | | System.out.println(battgroupId + " " + monCapStd + " " + hourRate + " " + testcap + " " + maxMonvol + " " + minMonvol + " " + monVolstd + " " + BattCapFactory.CapType_Real + " "); |
| | | }*/ |
| | | } |
| | | //查询电池告警(劣化:内阻过高重要,电压过低重要;损坏:内阻过高紧急,电压过低紧急) |
| | | List listALmSH = alarmDataMapper.getAlm(battgroupId, 3); |
| | | List listALmLH = alarmDataMapper.getAlm(battgroupId, 2); |
| | | //先判断是否损坏 |
| | | if ((disNum != 0 && cap < capChange * monCapStd) || (listALmSH != null && listALmSH.size() > 0)) { |
| | | if (disNum == 0) { |
| | | noHrDisNum += 1; |
| | | } |
| | | changeNum = changeNum + 1; |
| | | }//在判断是否劣化 |
| | | else if ( |
| | | (disNum != 0 && cap <= capAlarm * monCapStd && cap >= capChange * monCapStd |
| | | ) |
| | | || (listALmLH != null && listALmLH.size() > 0)) { |
| | | if (disNum == 0) { |
| | | noHrDisNum += 1; |
| | | } |
| | | alarmNum = alarmNum + 1; |
| | | }//再判断是否放电正常 |
| | | else if (disNum != 0 && cap > capAlarm * monCapStd) { |
| | | if (disNum == 0) { |
| | | noHrDisNum += 1; |
| | | } |
| | | goodSum = goodSum + 1; |
| | | } else { |
| | | noHrDisNum += 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); |
| | | return new Response().setII(1, true, numMap, "蓄电池组优劣分析"); |
| | | } catch (Exception e) { |
| | | return new Response<>().set(1, false, "发生异常:" + e.getCause()); |
| | | } |
| | | } |
| | | |
| | | //获取本年已核容放电电池组最新一次数据详情 |
| | | public Response getHrYeardisBattInfo() { |
| | | int userId = Integer.parseInt(ActionUtil.getUser().getUId().toString()); |
| | | 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; |
| | | } |
| | | //1.查出符合条件的电池组(核容数据)按照时间倒叙排序 |
| | | List<BatttestdataInf> list = mapper.getGroupAnalysis(userId); |
| | | //2.分组取出每个电池组的最新一笔数据(取电池组放电数据的第一个) |
| | | List<BatttestdataInf> infoList = new ArrayList<>(); |
| | | String battGroupId = "0"; |
| | | if (list != null && list.size() > 0) { |
| | | for (BatttestdataInf inf : list) { |
| | | if (!battGroupId.equals(inf.getBattGroupId().toString())) { |
| | | int hourRate = BattCapFactory.GetHourRate(inf.getMonCapStd(), inf.getTestCurr()); |
| | | float cap = (float) BattCapFactory.GetMonomerCap(inf.getMonCapStd(), hourRate, inf.getTestCap(), inf.getMaxMonvol(), inf.getMinMonvol(), inf.getMonVolStd(), BattCapFactory.CapType_Real); |
| | | inf.setRealCap(cap); |
| | | infoList.add(inf); |
| | | battGroupId = inf.getBattGroupId().toString(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return new Response().setII(1, true, infoList, "获取本年已核容放电电池组最新一次数据详情"); |
| | | } catch (Exception e) { |
| | | return new Response<>().set(1, false, "发生异常:" + e.getCause()); |
| | | } |
| | | } |
| | | |
| | | //获取本年已核容放电电池组最新一次数据详情(正常) |
| | | public Response getHrYeardisBattInfoZC() { |
| | | int userId = Integer.parseInt(ActionUtil.getUser().getUId().toString()); |
| | | String lang = ActionUtil.getLang(); |
| | | 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; |
| | | } |
| | | //1.查出符合条件的电池组(核容数据)按照时间倒叙排序 |
| | | List<BatttestdataInf> list = mapper.getGroupAnalysisZC(userId); |
| | | //2.分组取出每个电池组的最新一笔数据(取电池组放电数据的第一个) |
| | | List<BatttestdataInf> infoList = new ArrayList<>(); |
| | | String battGroupId = "0"; |
| | | if (list != null && list.size() > 0) { |
| | | for (BatttestdataInf inf : list) { |
| | | if (!battGroupId.equals(inf.getBattGroupId().toString())) { |
| | | int hourRate = BattCapFactory.GetHourRate(inf.getMonCapStd(), inf.getTestCurr()); |
| | | float cap = (float) BattCapFactory.GetMonomerCap(inf.getMonCapStd(), hourRate, inf.getTestCap(), inf.getMaxMonvol(), inf.getMinMonvol(), inf.getMonVolStd(), BattCapFactory.CapType_Real); |
| | | inf.setRealCap(cap); |
| | | //放电终止原因 |
| | | if (inf.getFBSDeviceId() / 100000 == 6185) { |
| | | //61850设备放电停止原因 |
| | | inf.setTestStoptypeReason(BattTestData.getStopType_6185(inf.getTestStoptype())); |
| | | } else if (inf.getFBSDeviceId() / 100000 == 4016) { |
| | | //6度设备放电停止原因 |
| | | inf.setTestStoptypeReason(BattTestData.getStopType_4016(inf.getTestStoptype())); |
| | | } else if (inf.getFBSDeviceId() / 100000 == 9110) { |
| | | //假负载设备放电停止原因 |
| | | inf.setTestStoptypeReason(BattTestData.getStopType_9110(inf.getTestStoptype())); |
| | | } else if ((inf.getFBSDeviceId() / 100000 == 9120) || (inf.getFBSDeviceId() / 100000 == 9140)) { |
| | | // 逆变设备放电停止原因 |
| | | inf.setTestStoptypeReason(BattTestData.getStopType_9120(inf.getTestStoptype())); |
| | | } else if (inf.getFBSDeviceId() / 100000 == 8059) { |
| | | //一体机设备放电停止原因 |
| | | inf.setTestStoptypeReason(BattTestData.getStopType_8059(inf.getTestStoptype())); |
| | | } else if (inf.getFBSDeviceId() / 100000 == 6087) { |
| | | //电操核容设备放电停止原因 |
| | | inf.setTestStoptypeReason(BattTestData.getStopType_6087(inf.getTestStoptype())); |
| | | } else if (inf.getFBSDeviceId() / 100000 == 4830) { |
| | | //FBO4830设备放电停止原因 |
| | | inf.setTestStoptypeReason(BattTestData.getStopType_4830(inf.getTestStoptype())); |
| | | } else if (inf.getFBSDeviceId() / 100000 == 4831) { |
| | | //FBO4831设备放电停止原因 |
| | | inf.setTestStoptypeReason(MessageUtils.getMessageSocket(BattTestData.getStopType_4831(inf.getTestStoptype()), lang)); |
| | | } else if (inf.getFBSDeviceId() / 100000 == 4815) { |
| | | //FBO4815设备放电停止原因 |
| | | inf.setTestStoptypeReason(BattTestData.getStopType_4815(inf.getTestStoptype())); |
| | | } else if (inf.getFBSDeviceId() / 100000 == 9149) { |
| | | //FBO4815设备放电停止原因 |
| | | inf.setTestStoptypeReason(BattTestData.getStopType_9149(inf.getTestStoptype())); |
| | | } else { |
| | | inf.setTestStoptypeReason(BattTestData.getStopType(inf.getTestStarttype(), inf.getTestStoptype())); |
| | | } |
| | | infoList.add(inf); |
| | | battGroupId = inf.getBattGroupId().toString(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return new Response().setII(1, true, infoList, "获取本年已核容放电电池组最新一次数据详情正常"); |
| | | } catch (Exception e) { |
| | | return new Response<>().set(1, false, "发生异常:" + e.getCause()); |
| | | } |
| | | } |
| | | |
| | | //本年度上一次正常核容的放电记录编号 |
| | | public Response searchHrYear(int battGroupId) { |
| | | BatttestdataInf tinf = mapper.searchHrYear(battGroupId); |
| | | int testNumber = 0; |
| | | if (tinf != null) { |
| | | testNumber = tinf.getNum(); |
| | | } |
| | | return new Response().setII(1, true, testNumber, "本年度上一次正常核容的放电记录编号"); |
| | | } |
| | | } |