| | |
| | | import com.whyc.dto.result.ReportBattTestDTO; |
| | | 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; |
| | | |
| | |
| | | |
| | | //在线监测-历史监控-获取充放电记录 |
| | | public Response searchBattTestInfDataById(int battGroupId, int fbsDeviceId) { |
| | | String lang = ActionUtil.getLang(); |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("BattGroupId", battGroupId); |
| | | wrapper.eq("data_available", 1); |
| | |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_4830(tinf.getTestStoptype())); |
| | | } else if (fbsDeviceId / 100000 == 4831) { |
| | | //FBO4831设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_4831(tinf.getTestStoptype())); |
| | | tinf.setTestStoptypeReason(MessageUtils.getMessageSocket(BattTestData.getStopType_4831(tinf.getTestStoptype()), lang)); |
| | | } else if (fbsDeviceId / 100000 == 4815) { |
| | | //FBO4815设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_4815(tinf.getTestStoptype())); |
| | |
| | | } |
| | | |
| | | //最后一次核容放电数据 |
| | | 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); |
| | |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_4830(tinf.getTestStoptype())); |
| | | } else if (devId / 100000 == 4831) { |
| | | // FBO4830设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_4831(tinf.getTestStoptype())); |
| | | tinf.setTestStoptypeReason(MessageUtils.getMessageSocket(BattTestData.getStopType_4831(tinf.getTestStoptype()), lang)); |
| | | } else if (devId / 100000 == 4815) { |
| | | //FBO4815设备放电停止原因 |
| | | tinf.setTestStoptypeReason(BattTestData.getStopType_4815(tinf.getTestStoptype())); |
| | |
| | | //1.4电池组性能评估(根据电池组id查询所有的放电记录求出放电总次数,最高历史容量,最低历史容量,平均容量,最新测试容量) |
| | | public List searchDischargeTest(BatttestdataInf tinf){ |
| | | List<BatttestdataInf> list = mapper.searchDischargeTest(tinf); |
| | | List<BatttestdataInf> testList = new LinkedList<>(); |
| | | int sum=0;//总测试次数 |
| | | float cap=0f;//实际容量 |
| | | float allCap=0f;//总容量 |
| | |
| | | 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); |
| | | binf.setRealCap(cap); |
| | | testList.add(binf); |
| | | if(sum==0){ |
| | | lastCap=cap; |
| | | } |
| | |
| | | list1.add(avgCap); |
| | | list1.add(minCap); |
| | | list1.add(lastCap); |
| | | list1.add(testList); |
| | | return list1; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //管理员首页头部信息加入 |
| | | public Map<String, Integer> getYearAnalysis(int userId) { |
| | | //本年 |
| | | List<BatttestdataInf> listYear = mapper.selectYear(userId); |
| | | Map<String, Integer> map = analysisTestData(listYear); |
| | | return map; |
| | | public int getYearAnalysis(int userId) { |
| | | //Map<String, Integer> map = new HashMap<>(); |
| | | //本年已核容放电电池组数 |
| | | int hrdisNum = mapper.getHrQuarter(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, "获取本年已核容电池组"); |
| | | } |
| | | |
| | | //测试信息 |
| | |
| | | return hrQuarter; |
| | | } |
| | | |
| | | /*领导层本年度已放数 仅需要统计放电正常停止的 正常停止的条件如下: |
| | | stop_type: |
| | | 2-放电时间到终止 |
| | | 3-放电容量到终止 |
| | | 4-单体电压下限到终止 |
| | | 6-组端电压下限到终止*/ |
| | | public int getHrQuarterZC(int userId) { |
| | | int hrQuarter = mapper.getHrQuarterZC(userId); |
| | | return hrQuarter; |
| | | } |
| | | |
| | | //蓄电池组优劣分析(用蓄电池组组后评估的统计) |
| | | public Response getGroupAnalysis(int userId) { |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | //获取本年已核容放电电池组最新一次数据详情 |
| | | 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()); |
| | | } |
| | | } |
| | | } |