| | |
| | | import com.whyc.mapper.PowerAlarmMapper; |
| | | import com.whyc.mapper.PowerInfoMapper; |
| | | import com.whyc.pojo.PowerAlarm; |
| | | import com.whyc.util.MathUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | |
| | | * @return |
| | | * @param userId |
| | | */ |
| | | public Response<Map> getAcABCAnalysis(int userId){ |
| | | public Response<List> getAcABCAnalysis(int userId){ |
| | | |
| | | //交流A/B/C-过压, |
| | | //交流A/B/C-欠压, |
| | |
| | | |
| | | } |
| | | |
| | | return new Response<Map>().set(1,resultMap); |
| | | //告警机房总数和比例 |
| | | HashMap<String, Integer> map2 = new HashMap<>(); |
| | | |
| | | //int alarmStationCount = mapper.getAlarmStationCountSpec(userId,types); |
| | | //int stationCount = infoMapper.getStationCount(userId); |
| | | |
| | | //map2.put("告警机房总数",alarmStationCount); |
| | | //map2.put("告警机房数比例",(int)MathUtil.divide(alarmStationCount,stationCount,2)); |
| | | |
| | | List<Map<String, Integer>> mapList = Arrays.asList(resultMap, map2); |
| | | return new Response<List>().set(1,mapList); |
| | | } |
| | | |
| | | public Response<Map> getRectifierAnalysis(int userId){ |
| | |
| | | //整流器-交流异常, |
| | | //整流器-过压 |
| | | Map<String,Integer> resultMap = new HashMap<>(); |
| | | resultMap.put("总故障",0); |
| | | resultMap.put("欠压",0); |
| | | resultMap.put("过流",0); |
| | | resultMap.put("交流异常",0); |
| | | resultMap.put("过压",0); |
| | | resultMap.put("整流器总故障",0); |
| | | resultMap.put("整流器欠压",0); |
| | | resultMap.put("整流器过流",0); |
| | | resultMap.put("整流器交流异常",0); |
| | | resultMap.put("整流器过压",0); |
| | | |
| | | List<Integer> types = Arrays.asList( |
| | | AlarmConstant.acdcMod1_err, |
| | |
| | | case AlarmConstant.acdcMod14_err: |
| | | case AlarmConstant.acdcMod15_err: |
| | | case AlarmConstant.acdcMod16_err: |
| | | resultMap.put("总故障",data.get(i).getNum().intValue()); |
| | | resultMap.put("整流器总故障",resultMap.get("整流器总故障")+data.get(i).getNum().intValue()); |
| | | break; |
| | | case AlarmConstant.acdcMod1_underVol: |
| | | case AlarmConstant.acdcMod2_underVol: |
| | |
| | | case AlarmConstant.acdcMod14_underVol: |
| | | case AlarmConstant.acdcMod15_underVol: |
| | | case AlarmConstant.acdcMod16_underVol: |
| | | resultMap.put("欠压",data.get(i).getNum().intValue()); |
| | | resultMap.put("整流器欠压",resultMap.get("整流器欠压")+data.get(i).getNum().intValue()); |
| | | break; |
| | | case AlarmConstant.acdcMod1_overCurr: |
| | | case AlarmConstant.acdcMod2_overCurr: |
| | |
| | | case AlarmConstant.acdcMod14_overCurr: |
| | | case AlarmConstant.acdcMod15_overCurr: |
| | | case AlarmConstant.acdcMod16_overCurr: |
| | | resultMap.put("过流",data.get(i).getNum().intValue()); |
| | | resultMap.put("整流器过流",resultMap.get("整流器过流")+data.get(i).getNum().intValue()); |
| | | break; |
| | | case AlarmConstant.acdcMod1_acErr: |
| | | case AlarmConstant.acdcMod2_acErr: |
| | |
| | | case AlarmConstant.acdcMod14_acErr: |
| | | case AlarmConstant.acdcMod15_acErr: |
| | | case AlarmConstant.acdcMod16_acErr: |
| | | resultMap.put("交流异常",data.get(i).getNum().intValue()); |
| | | resultMap.put("整流器交流异常",resultMap.get("整流器交流异常")+data.get(i).getNum().intValue()); |
| | | break; |
| | | case AlarmConstant.acdcMod1_overVol: |
| | | case AlarmConstant.acdcMod2_overVol: |
| | |
| | | case AlarmConstant.acdcMod14_overVol: |
| | | case AlarmConstant.acdcMod15_overVol: |
| | | case AlarmConstant.acdcMod16_overVol: |
| | | resultMap.put("过压",data.get(i).getNum().intValue()); |
| | | resultMap.put("整流器过压",resultMap.get("整流器过压")+data.get(i).getNum().intValue()); |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unexpected value: " + data.get(i)); |
| | |
| | | //状态-直流电压异常, |
| | | //状态-负载熔断, |
| | | //状态-直流过流 |
| | | Map<String,Integer> resultMap = new HashMap<>(); |
| | | Map<String,Object> resultMap = new HashMap<>(); |
| | | resultMap.put("交流停电",0); |
| | | resultMap.put("直流电压异常",0); |
| | | resultMap.put("负载熔断",0); |
| | |
| | | break; |
| | | case AlarmConstant.dcOut_over_vol: |
| | | case AlarmConstant.dcOut_under_vol: |
| | | resultMap.put("直流电压异常",resultMap.get("直流电压异常")+data.get(i).getNum().intValue()); |
| | | resultMap.put("直流电压异常",(Integer)resultMap.get("直流电压异常")+data.get(i).getNum().intValue()); |
| | | break; |
| | | case AlarmConstant.loader_fuse: |
| | | resultMap.put("负载熔断",data.get(i).getNum().intValue()); |
| | |
| | | |
| | | } |
| | | |
| | | /*======获取电源告警机房数和比例======*/ |
| | | /*//告警机房数 |
| | | int alarmStationCount = mapper.getAlarmStationCount(userId); |
| | | //总机房数 |
| | | int stationCount = infoMapper.getStationCount(userId); |
| | | //比例 |
| | | String alarmStationRate = (String) MathUtil.divide(alarmStationCount, stationCount,3); |
| | | resultMap.put("告警机房数",alarmStationCount); |
| | | resultMap.put("告警机房比例",alarmStationRate);*/ |
| | | |
| | | return new Response<Map>().set(1,resultMap); |
| | | } |
| | | |