static {
    try {
      List<UseSet> usl = DBUtil.getResult("hc_use_set");
      if (usl != null && usl.size() > 0) {
        UseSet us = usl.get(0);
        String key = us.getKeyStr();
        String authorizeKey = us.getAuthorizeKey();
        if (StringUtils.isNotBlank(key)) ;
        {
          String decryptKey = SecurityHelper.DecryptData(key, Constants.DEFAULT_SECURITY_KEY);
          String[] splitKeys = decryptKey.split(";", 2);
          String expiration = splitKeys[0];
          expirationDate = HsCloudDateUtil.transferStr2Date("yyyy-MM-dd", expiration);
          Date now = new Date();
          if (expirationDate.before(now)) {
            logger.error("证书失效,系统终止服务。");
            System.exit(-1);
          }
          String mac = IPMACUtil.getMacAddr();
          String ip = IPMACUtil.getLocalIP();
          String compareStringLocal = mac + ";" + ip + ";" + authorizeKey;
          String compareStringRemote = splitKeys[1];
          if (!compareStringLocal.equals(compareStringRemote)) {
            logger.error("证书有误,系统终止服务。");
            System.exit(-1);
          }
        }
      }

    } catch (Exception e) {
      logger.debug(e.getMessage(), e);
      e.printStackTrace();
      System.exit(-1);
    }
  }
  /**
   * 获取ip并更新hc_ip_detail 表中ip的object_id,status,modify_uid字段。
   *
   * @param message
   * @return
   * @throws Exception
   */
  public static String getIpAndUpdateIpStatus(String message, int type) throws Exception {
    String ipStr = null;
    try {
      // 获取zone信息,因为要根据zone去查询对应的ip
      String zone = getValue(message, "zone");
      if (StringUtils.isNotBlank(zone)) {
        StringBuilder sql = new StringBuilder();
        List<Object> ipDetailList = new ArrayList<Object>();
        if (type == 1) {
          sql.append(" where t.ip_range_id=t1.id and t1.id=t2.ip_id and t2.zone_id=t3.id ")
              .append(" and t.status = 0 and t3.code = '")
              .append(zone)
              .append("' limit 10 ");
          // 一次性取出10个ip
          ipDetailList = DBUtil.getResult("hc_ip_detail", sql.toString());

        } else if (type == 2) {
          sql.append(" where t5.status = 0 and t4.type =1 AND t3.label = 'wan' AND t.code = '")
              .append(zone)
              .append("' limit 10 ");
          // 一次性取出10个ip
          ipDetailList = DBUtil.getResult("hc_ip_detail_router", sql.toString());
        }

        if (null != ipDetailList && ipDetailList.size() >= 1) {
          Random rand = new Random(47);
          int ipNum = ipDetailList.size();
          O_IP ip = (O_IP) ipDetailList.get(rand.nextInt(ipNum)); // //一次性取出10个ip,并从中随机选择一个
          Long ipLong = ip.getIp();
          Long id = ip.getId();
          logger.info("IPID:" + id);
          ipStr = IPConvert.getStringIP(ipLong);
          logger.info("IPSTR:" + ipStr);
          String object_idStr = patternInt("obj_instance_id", message);
          logger.info("OBJECT_IDSTR" + object_idStr);
          if (StringUtils.isNotBlank(object_idStr)) {
            ip.setObject_id(Long.parseLong(object_idStr));
          }
          String operator_idStr = patternInt("operator_id", message);
          if (StringUtils.isNotBlank(operator_idStr)) {
            ip.setModify_uid(Long.parseLong(operator_idStr));
          }
          logger.info("Operator_idStr" + operator_idStr);
          ip.setModify_time(new Date());
          ip.setStatus(1);
          try {
            // 更新ip的信息到数据库
            DBUtil.save(ip, "sync_hc_ip_detail.update");
            return ipStr;
          } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new Exception(e.getMessage() + " 更新ip状态异常,ip=" + ipStr);
          }

        } else {
          throw new Exception("获取ip异常 zone=" + zone);
        }
      } else {
        throw new Exception("获取zone异常");
      }
    } catch (Exception e) {
      throw new Exception(e.getMessage());
    }
  }