コード例 #1
1
 public Map<String, Object> checkCommunicationStatus(UpsStatus upsStatus, AlarmRule alarmRule) {
   Map<String, Object> communicationStatusMap = new HashMap<String, Object>();
   StateEnum runState = StateEnum.good;
   StringBuffer alarmContent = new StringBuffer();
   StringBuffer alarmRuleType = new StringBuffer();
   OperationType operationType = alarmRule.getOperationType();
   Integer value = alarmRule.getValue();
   Integer minValue = alarmRule.getMinValue();
   Integer maxValue = alarmRule.getMaxValue();
   runState =
       alarmRuleService.ruleCompare(
           operationType,
           Double.parseDouble(upsStatus.getCommunicationStatus() + ""),
           value,
           minValue,
           maxValue,
           alarmRule.getState());
   if (runState != StateEnum.good) {
     alarmContent.append("").append(alarmRule.getRemark()).append("、");
     alarmRuleType.append(alarmRule.getAlarmRuleType()).append("、");
   }
   communicationStatusMap.put("runState", runState);
   communicationStatusMap.put("alarmContent", alarmContent.toString());
   communicationStatusMap.put("alarmRuleType", alarmRuleType.toString());
   return communicationStatusMap;
 }
コード例 #2
0
 public Map<String, Object> checkElectricQuantity(UpsStatus upsStatus, AlarmRule alarmRule) {
   Map<String, Object> electricQuantityMap = new HashMap<String, Object>();
   StateEnum runState = StateEnum.good;
   StringBuffer alarmContent = new StringBuffer();
   StringBuffer alarmRuleType = new StringBuffer();
   OperationType operationType = alarmRule.getOperationType();
   Integer value = alarmRule.getValue();
   Integer minValue = alarmRule.getMinValue();
   Integer maxValue = alarmRule.getMaxValue();
   runState =
       alarmRuleService.ruleCompare(
           operationType,
           upsStatus.getElectricQuantity(),
           value,
           minValue,
           maxValue,
           alarmRule.getState());
   if (runState != StateEnum.good) {
     alarmContent.append("").append(alarmRule.getRemark()).append("、");
     alarmRuleType.append(alarmRule.getAlarmRuleType()).append("、");
   }
   electricQuantityMap.put("runState", runState);
   electricQuantityMap.put("alarmContent", alarmContent.toString());
   electricQuantityMap.put("alarmRuleType", alarmRuleType.toString());
   return electricQuantityMap;
 }
コード例 #3
0
 @Override
 public Map<String, Object> checkBatteryVoltage(UpsStatus upsStatus, AlarmRule alarmRule) {
   Map<String, Object> batteryVoltageMap = new HashMap<String, Object>();
   StateEnum runState = StateEnum.good;
   StringBuffer alarmContent = new StringBuffer();
   StringBuffer alarmRuleType = new StringBuffer();
   OperationType operationType = alarmRule.getOperationType();
   Integer value = alarmRule.getValue();
   Integer minValue = alarmRule.getMinValue();
   Integer maxValue = alarmRule.getMaxValue();
   runState =
       alarmRuleService.ruleCompare(
           operationType,
           Double.parseDouble(upsStatus.getBatteryVoltage() + ""),
           value,
           minValue,
           maxValue,
           alarmRule.getState());
   if (runState == StateEnum.error) {
     alarmContent.append("").append(alarmRule.getRemark()).append("、");
     alarmRuleType.append(alarmRule.getAlarmRuleType()).append("、");
   }
   batteryVoltageMap.put("runState", runState);
   batteryVoltageMap.put("alarmContent", alarmContent.toString());
   batteryVoltageMap.put("alarmRuleType", alarmRuleType.toString());
   return batteryVoltageMap;
 }
コード例 #4
0
  @Override
  public Map<String, Object> checkOutputVoltage(UpsStatus upsStatus, AlarmRule alarmRule) {
    Map<String, Object> outputVoltageMap = new HashMap<String, Object>();
    StateEnum runState = StateEnum.good;
    StringBuffer alarmContent = new StringBuffer();
    StringBuffer alarmRuleType = new StringBuffer();
    OperationType operationType = alarmRule.getOperationType();
    Integer value = alarmRule.getValue();
    Integer minValue = alarmRule.getMinValue();
    Integer maxValue = alarmRule.getMaxValue();
    if (upsStatus.getOutputVoltage() != null) {
      String outputVoltage = upsStatus.getOutputVoltage();
      // 输出电压一
      Double outputVoltage_1 =
          Double.parseDouble(outputVoltage.substring(0, outputVoltage.indexOf("V")));
      // 判断UPS是三相电
      if (upsStatus.getUpsType() == 2 || upsStatus.getUpsType() == 3) {
        // 输出电压二
        Double outputVoltage_2 =
            Double.parseDouble(
                outputVoltage.substring(
                    outputVoltage.indexOf("/") + 1, outputVoltage.lastIndexOf("/") - 1));
        // 输出电压三
        Double outputVoltage_3 =
            Double.parseDouble(
                outputVoltage.substring(
                    outputVoltage.lastIndexOf("/") + 1, outputVoltage.length() - 1));
        runState =
            alarmRuleService.ruleCompare(
                operationType, outputVoltage_2, value, minValue, maxValue, alarmRule.getState());
        runState =
            alarmRuleService.ruleCompare(
                operationType, outputVoltage_3, value, minValue, maxValue, alarmRule.getState());
      }

      runState =
          alarmRuleService.ruleCompare(
              operationType, outputVoltage_1, value, minValue, maxValue, alarmRule.getState());
    }
    if (runState != StateEnum.good) {
      alarmContent.append("").append(alarmRule.getRemark()).append("、");
      alarmRuleType.append(alarmRule.getAlarmRuleType()).append("、");
    }
    outputVoltageMap.put("runState", runState);
    outputVoltageMap.put("alarmContent", alarmContent.toString());
    outputVoltageMap.put("alarmRuleType", alarmRuleType.toString());
    return outputVoltageMap;
  }
コード例 #5
0
  public Map<String, Object> checkLoad(UpsStatus upsStatus, AlarmRule alarmRule) {
    Map<String, Object> upsLoadMap = new HashMap<String, Object>();
    StateEnum runState = StateEnum.good;
    StringBuffer alarmContent = new StringBuffer();
    StringBuffer alarmRuleType = new StringBuffer();
    OperationType operationType = alarmRule.getOperationType();
    Integer value = alarmRule.getValue();
    Integer minValue = alarmRule.getMinValue();
    Integer maxValue = alarmRule.getMaxValue();
    if (upsStatus.getUpsLoad() != null) {
      String upsLoad = upsStatus.getUpsLoad();
      String[] upsLoads = upsLoad.split("%/");
      // 负载一
      Double upsLoad_1 = Double.parseDouble(upsLoads[0]);
      // 判断UPS是三相电
      if (upsStatus.getUpsType() == 2 || upsStatus.getUpsType() == 3) {
        // 负载二
        Double upsLoad_2 = Double.parseDouble(upsLoads[1]);
        // 负载三
        Double upsLoad_3 = Double.parseDouble(upsLoads[2]);
        runState =
            alarmRuleService.ruleCompare(
                operationType, upsLoad_2, value, minValue, maxValue, alarmRule.getState());
        runState =
            alarmRuleService.ruleCompare(
                operationType, upsLoad_3, value, minValue, maxValue, alarmRule.getState());
      }

      runState =
          alarmRuleService.ruleCompare(
              operationType, upsLoad_1, value, minValue, maxValue, alarmRule.getState());
    }
    if (runState != StateEnum.good) {
      alarmContent.append("").append(alarmRule.getRemark()).append("、");
      alarmRuleType.append(alarmRule.getAlarmRuleType()).append("、");
    }

    upsLoadMap.put("runState", runState);
    upsLoadMap.put("alarmContent", alarmContent.toString());
    upsLoadMap.put("alarmRuleType", alarmRuleType.toString());

    return upsLoadMap;
  }
コード例 #6
0
  @Override
  public Map<String, Object> checkInputVoltage(UpsStatus upsStatus, AlarmRule alarmRule) {
    Map<String, Object> inputVoltageMap = new HashMap<String, Object>();
    StateEnum runState = StateEnum.good;
    StringBuffer alarmContent = new StringBuffer();
    StringBuffer alarmRuleType = new StringBuffer();
    OperationType operationType = alarmRule.getOperationType();
    Integer value = alarmRule.getValue();
    Integer minValue = alarmRule.getMinValue();
    Integer maxValue = alarmRule.getMaxValue();
    if (upsStatus.getInputVoltage() != null) {
      String inputVoltage = upsStatus.getInputVoltage();
      String[] inputVoltages = inputVoltage.split("V/");
      // 输入电压一
      Double inputVoltage_1 = Double.parseDouble(inputVoltages[0]);
      // 判断UPS是三相电
      if (upsStatus.getUpsType() == 2 || upsStatus.getUpsType() == 3) {
        // 输入电压二
        Double inputVoltage_2 = Double.parseDouble(inputVoltages[1]);
        // 输入电压三
        Double inputVoltage_3 =
            Double.parseDouble(inputVoltages[2].substring(0, inputVoltages[2].length() - 1));
        runState =
            alarmRuleService.ruleCompare(
                operationType, inputVoltage_2, value, minValue, maxValue, alarmRule.getState());
        runState =
            alarmRuleService.ruleCompare(
                operationType, inputVoltage_3, value, minValue, maxValue, alarmRule.getState());
      }

      runState =
          alarmRuleService.ruleCompare(
              operationType, inputVoltage_1, value, minValue, maxValue, alarmRule.getState());
    }
    if (runState != StateEnum.good) {
      alarmContent.append("").append(alarmRule.getRemark()).append("、");
      alarmRuleType.append(alarmRule.getAlarmRuleType()).append("、");
    }
    inputVoltageMap.put("runState", runState);
    inputVoltageMap.put("alarmContent", alarmContent.toString());
    inputVoltageMap.put("alarmRuleType", alarmRuleType.toString());
    return inputVoltageMap;
  }