/**
   * 添加公共连接分类
   *
   * @param jsonObj 公共连接分类json数据
   * @return 0:失败 1:成功 2:重复添加
   * @throws UnsupportedEncodingException 异常
   */
  @PUT
  @Path("/add/commonlinktype")
  @Produces({MediaType.APPLICATION_JSON})
  @AuthMethod
  public JSONObject addCommonlinkType(JSONObject jsonObj) throws UnsupportedEncodingException {
    JSONObject result = new JSONObject();
    // 0表示添加失败
    result.put("result", 0);
    if (null != jsonObj) {

      CommonlinkType commonlinkType = new CommonlinkType();
      buildJSONObjectToCommonlinkType(commonlinkType, jsonObj);
      // 是否已经存在该连接
      if (hasExistCommonlinkType(commonlinkType)) {
        // 2表示存在
        return result.put("result", 2);
      }
      boolean success = commonlinkService.addCommonlinkType(commonlinkType);
      if (success) {
        // 1表示添加成功
        result.put("result", 1);
        return result;
      }
    }
    return result;
  }