| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.constant.AlarmConstant; |
| | | import com.whyc.constant.BatteryConstant; |
| | | import com.whyc.constant.DeviceConstant; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class BatteryAlarmService { |
| | |
| | | //容量低告警机房占比 |
| | | //String capLowStationRateStr = (String) MathUtil.divide(stationNum,totalStationNum,3); |
| | | |
| | | resultMap.put("低告警数",alarmLow); |
| | | resultMap.put("高告警数",alarmHigh); |
| | | resultMap.put("单体容量低告警",alarmLow); |
| | | resultMap.put("单体容量高告警",alarmHigh); |
| | | //resultMap.put("告警总数",totalAlarmNum); |
| | | //resultMap.put("告警占比",capLowRateStr); |
| | | |
| | |
| | | List<Integer> alarmSignalIds = Arrays.asList( |
| | | AlarmConstant.ALM_SIGNAL_ID_OnlineVolHigh,AlarmConstant.ALM_SIGNAL_ID_OnlineVolLow, |
| | | AlarmConstant.ALM_SIGNAL_ID_GroupVolHigh,AlarmConstant.ALM_SIGNAL_ID_GroupVolLow); |
| | | String mapName1 = "高告警数量"; |
| | | String mapName2 = "低告警数量"; |
| | | String mapName1 = "高告警"; |
| | | String mapName2 = "低告警"; |
| | | |
| | | Map<String, Map> doubleAnalysis = getDoubleAnalysis(userId, alarmIds, alarmSignalIds, alarmNames, mapName1, mapName2); |
| | | |
| | |
| | | public Response<Map> getBTSEquipStatus(int userId) { |
| | | |
| | | Response<Map> response = new Response(); |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | try { |
| | | Map<String, Integer> resultMap = new HashMap<>(); |
| | | resultMap.put("在线浮充数量",0); |
| | | resultMap.put("预充电数量",0); |
| | | resultMap.put("核容测试数量",0); |
| | | resultMap.put("内阻测试数量",0); |
| | | resultMap.put("通讯故障数量",0); |
| | | /*try { |
| | | List<FBS9100State> statusList = fbs9100StateMapper.getStatus(userId); |
| | | for (int i = 0; i < statusList.size(); i++) { |
| | | switch (statusList.get(i).getWorkState()){ |
| | |
| | | e.printStackTrace(); |
| | | response.setCode(0); |
| | | return response; |
| | | }*/ |
| | | QueryWrapper<FBS9100State> wrapper = Wrappers.query(); |
| | | wrapper.select("record_datetime","dev_workstate"); |
| | | List<FBS9100State> fbs9100StateList = fbs9100StateMapper.selectList(wrapper); |
| | | //首先查看是否通讯故障,时间大于1分钟为通讯故障 |
| | | for (int i = 0; i < fbs9100StateList.size(); i++) { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.MINUTE,-1); |
| | | Date time = instance.getTime(); |
| | | if(time.compareTo(fbs9100StateList.get(i).getRecordDatetime())>0){ |
| | | resultMap.put("通讯故障数量",resultMap.get("通讯故障数量")+1); |
| | | }else{ |
| | | switch (fbs9100StateList.get(i).getDevWorkState()){ |
| | | case DeviceConstant.DEV_ONLINE_CHARGE: |
| | | resultMap.put("在线浮充数量",resultMap.get("在线浮充数量")+1); |
| | | break; |
| | | case DeviceConstant.DEV_PRE_CHARGE: |
| | | resultMap.put("预充电数量",resultMap.get("预充电数量")+1); |
| | | break; |
| | | case DeviceConstant.DEV_NUCLEAR_CAP: |
| | | resultMap.put("核容数量",resultMap.get("核容测试数量")+1); |
| | | break; |
| | | case DeviceConstant.DEV_RES_TEST: |
| | | resultMap.put("内阻测试数量",resultMap.get("内阻测试数量")+1); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return response; |
| | | |
| | | return new Response<Map>().set(1,resultMap); |
| | | } |
| | | |
| | | |
| | |
| | | //放电电流低告警机房占比 |
| | | //String disChargeLowStationRateStr = (String) MathUtil.divide(disChargeStationNum,totalStationNum,3); |
| | | |
| | | resultMap.put("低告警数量", dischargeLowAlarmNum); //低告警数量 alm_signal_id:DisChargeCurr 7 high; 8 low |
| | | resultMap.put("高告警数量", dischargeHighAlarmNum); //低告警数量 alm_signal_id:DisChargeCurr 7 high; 8 low |
| | | resultMap.put("放电电流低告警", dischargeLowAlarmNum); //低告警数量 alm_signal_id:DisChargeCurr 7 high; 8 low |
| | | resultMap.put("放电电流高告警", dischargeHighAlarmNum); //低告警数量 alm_signal_id:DisChargeCurr 7 high; 8 low |
| | | //resultMap.put("告警机房总数", disChargeStationNum); //告警机房总数 |
| | | //resultMap.put("告警机房数比例", disChargeLowRateStr); //告警机房数比例 |
| | | //resultMap.put("告警总数", totalAlarmNum); //告警总数 |
| | |
| | | //放电电流高告警机房占比 |
| | | //String dischargeStationRateStr = (String) MathUtil.divide(dischargeTotalAlarmStations,totalStationNum,3); |
| | | |
| | | disCharge.put("高告警数量",dischargeHighAlarmsNum); //高告警数量 alm_signal_id:ChargeCurrHigh 5 high; 6 low |
| | | disCharge.put("低告警数量",dischargeLowAlarmsNum); |
| | | disCharge.put("放电电流高告警",dischargeHighAlarmsNum); //高告警数量 alm_signal_id:ChargeCurrHigh 5 high; 6 low |
| | | disCharge.put("放电电流低告警",dischargeLowAlarmsNum); |
| | | //disCharge.put("告警总数",totalStationAlarmNum); //告警总数 |
| | | //disCharge.put("告警总数比例", dischargeRateStr); //告警总数比例 |
| | | //disCharge.put("告警机房总数", dischargeTotalAlarmStations); //告警机房总数 |
| | |
| | | //放电电流高告警机房占比 |
| | | //String chargeStationRateStr = (String) MathUtil.divide(chargeTotalAlarmStations,totalStationNum,3); |
| | | |
| | | reCharge.put("高告警数量", chargeHighAlarmsNum); //高告警数量 |
| | | reCharge.put("低告警数量", chargeLowAlarmsNum); //高告警数量 |
| | | reCharge.put("充电电流高告警", chargeHighAlarmsNum); //高告警数量 |
| | | reCharge.put("充电电流低告警", chargeLowAlarmsNum); //高告警数量 |
| | | //reCharge.put("告警总数", totalStationAlarmNum); //告警总数 |
| | | //reCharge.put("告警总数比例", chargeRateStr); //告警总数比例 |
| | | //reCharge.put("告警机房总数", chargeTotalAlarmStations); //告警机房总数 |
| | |
| | | //String volStationRateStr = (String) MathUtil.divide(volTotalAlarmStations,totalStationNum,3); |
| | | |
| | | |
| | | monVolMap.put("高告警数量", volHighAlarmsNum); //高告警数量 alm_signal_id 9 |
| | | monVolMap.put("低告警数量", volLowAlarmsNum); //低告警数量 alm_signal_id 10 |
| | | monVolMap.put("单体电压高告警", volHighAlarmsNum); //高告警数量 alm_signal_id 9 |
| | | monVolMap.put("单体电压低告警", volLowAlarmsNum); //低告警数量 alm_signal_id 10 |
| | | //monVolMap.put("告警总数", volTotalAlarmNum); //告警总数 |
| | | //monVolMap.put("告警总数比例", volRateStr); //告警总数比例 |
| | | //monVolMap.put("告警机房总数", volTotalAlarmStations); //告警机房总数 |
| | |
| | | //内阻告警机房占比 |
| | | //String resStationRateStr = (String) MathUtil.divide(resTotalAlarmStations,totalStationNum,3); |
| | | |
| | | monResMap.put("高告警数量", resHighAlarmsNum); //高告警数量 alm_signal_id 13 |
| | | monResMap.put("低告警数量", resLowAlarmsNum); //低告警数量 alm_signal_id 14 |
| | | monResMap.put("单体内阻高告警", resHighAlarmsNum); //高告警数量 alm_signal_id 13 |
| | | monResMap.put("单体内阻低告警", resLowAlarmsNum); //低告警数量 alm_signal_id 14 |
| | | //monResMap.put("告警总数", resTotalAlarmNum); //告警总数 |
| | | //monResMap.put("告警总数比例", resRateStr); //告警总数比例 |
| | | //monResMap.put("告警机房总数", resTotalAlarmStations); //告警机房总数 |
| | |
| | | //温度告警机房占比 |
| | | //String tempStationRateStr = (String) MathUtil.divide(tempTotalAlarmStations,totalStationNum,3); |
| | | |
| | | monTemMap.put("高告警数量", tempHighAlarmsNum); //高告警数量 alm_signal_id 13 |
| | | monTemMap.put("低告警数量", tempLowAlarmsNum); //低告警数量 alm_signal_id 14 |
| | | monTemMap.put("单体温度高告警", tempHighAlarmsNum); //高告警数量 alm_signal_id 13 |
| | | monTemMap.put("单体温度低告警", tempLowAlarmsNum); //低告警数量 alm_signal_id 14 |
| | | //monTemMap.put("告警总数", tempTotalAlarmNum); //告警总数 |
| | | //monTemMap.put("告警总数比例", tempRateStr); //告警总数比例 |
| | | //monTemMap.put("告警机房总数", tempTotalAlarmStations); //告警机房总数 |
| | |
| | | for (int i = 0; i < alarmIds.size(); i++) { |
| | | Map<String, Object> resMap = new HashMap<>(); |
| | | //告警1数量 |
| | | Integer alarmNum = mapper.getAlarmHighLow(userId,alarmSignalIds.get(i)); |
| | | Integer alarmNum = mapper.getAlarmHighLow(userId,alarmSignalIds.get(i*2)); |
| | | //告警2数量 |
| | | Integer alarmNum2 = mapper.getAlarmHighLow(userId,alarmSignalIds.get(i)+1); |
| | | Integer alarmNum2 = mapper.getAlarmHighLow(userId,alarmSignalIds.get(i*2)+1); |
| | | |
| | | //告警总数 |
| | | //Integer totalAlarmNum =alarmNum+alarmNum2; |
| | |
| | | //告警机房占比 |
| | | //String stationRate = (String) MathUtil.divide(alarmStationNum,totalStationNum,3); |
| | | |
| | | resMap.put(mapName1,alarmNum); //告警1数量 |
| | | resMap.put(mapName2,alarmNum2); //告警2数量 |
| | | resMap.put(alarmNames.get(i)+mapName1,alarmNum); //告警1数量 |
| | | resMap.put(alarmNames.get(i)+mapName2,alarmNum2); //告警2数量 |
| | | //resMap.put("告警总数", totalAlarmNum); //告警总数 |
| | | //resMap.put("告警总数比例", rate); //告警总数比例 |
| | | //resMap.put("告警机房总数", alarmStationNum); //告警机房总数 |