whyclxw
2024-07-04 6606e1712e0a97001bb95686a85a82d43cdb065e
src/main/java/com/whyc/service/PwrdevAlarmService.java
@@ -144,6 +144,11 @@
        return  mapper.getRealTimeWithLevel1(userId);
    }
    //山西晋源特定接口
    public int getRealTimeWithLevel1JY() {
        return  mapper.getRealTimeWithLevel1JY();
    }
    //首页电源总个数
    public int getHomeAlarmNum(int uId) {
        int powerAlarmNum = mapper.getAlarmNum(uId);
@@ -345,6 +350,72 @@
        }
    }
    //山西晋源特定接口
    public Response getAcABCAnalysisJY(){
        //交流A/B/C-过压,
        //交流A/B/C-欠压,
        //交流A/B/C-缺相,
        //交流A/B/C-过流
        Map<String,Integer> resultMap = new HashMap<>();
        resultMap.put("过压",0);
        resultMap.put("欠压",0);
        resultMap.put("缺相",0);
        resultMap.put("过流",0);
        try {
            List<Integer> types = Arrays.asList(
                    AlarmConstant.acIn1_over_volA,
                    AlarmConstant.acIn1_over_volB,
                    AlarmConstant.acIn1_over_volC,
                    AlarmConstant.acIn1_under_volA,
                    AlarmConstant.acIn1_under_volB,
                    AlarmConstant.acIn1_under_volC,
                    AlarmConstant.acIn1_less_A,
                    AlarmConstant.acIn1_less_B,
                    AlarmConstant.acIn1_less_C,
                    AlarmConstant.acb1_over_currA,
                    AlarmConstant.acb1_over_currB,
                    AlarmConstant.acb1_over_currC);
            List<PwrdevAlarm> data = mapper.getAnalysisJY(types);
            for (int i = 0; i < data.size(); i++) {
                switch (data.get(i).getAlmType()) {
                    case AlarmConstant.acIn1_over_volA:
                    case AlarmConstant.acIn1_over_volB:
                    case AlarmConstant.acIn1_over_volC:
                        resultMap.put("过压", resultMap.get("过压") + data.get(i).getNum().intValue());
                        break;
                    case AlarmConstant.acIn1_under_volA:
                    case AlarmConstant.acIn1_under_volB:
                    case AlarmConstant.acIn1_under_volC:
                        resultMap.put("欠压", resultMap.get("欠压") + data.get(i).getNum().intValue());
                        break;
                    case AlarmConstant.acIn1_less_A:
                    case AlarmConstant.acIn1_less_B:
                    case AlarmConstant.acIn1_less_C:
                        resultMap.put("缺相", resultMap.get("缺相") + data.get(i).getNum().intValue());
                        break;
                    case AlarmConstant.acb1_over_currA:
                    case AlarmConstant.acb1_over_currB:
                    case AlarmConstant.acb1_over_currC:
                        resultMap.put("过流", resultMap.get("过流") + data.get(i).getNum().intValue());
                        break;
                    default:
                }
            }
            //告警机房总数和比例
            HashMap<String, Integer> map2 = new HashMap<>();
            List<Map<String, Integer>> mapList = Arrays.asList(resultMap, map2);
            return new Response<>().setII(1, true, mapList, "");
        } catch (Exception e) {
            return new Response<>().set(0, false, "发生异常:"+e.getCause());
        }
    }
    //今日实时告警
    public Response getPalmToday(int userId) {
        try {