Ejemplo n.º 1
0
  public Response getCommunityByDistance(String auth, String lonAndLat, String r) {
    Double distance = 0.0;
    if (StringUtils.isBlank(r) || !NumberUtils.isNumber(r)) {
      distance = 3.0; // 默认是3千米
    } else {
      distance = Double.valueOf(r);
    }

    List<CommunityVo> comms = commDao.getCommunityByDistance(lonAndLat, distance);

    Map<String, Object> result = new HashMap<String, Object>();

    FaultTolerant fault = new Gson().fromJson(auth, FaultTolerant.class);
    // 进行验证
    if (!"0".equals(fault.getUid())) {
      if (Auth.auth(fault) == false) {
        result.put("code", CommonErrorEnum.FAULT_FOLERANT.getCode());
        result.put("msg", CommonErrorEnum.FAULT_FOLERANT.getMessage());
        return ReturnJSON.getInstance().ret(result);
      }
    }
    result.put("code", 0);
    result.put("msg", "查询成功");
    result.put("data", comms);

    return ReturnJSON.getInstance().ret(result);
  }
Ejemplo n.º 2
0
  public Response getCommunityByName(String auth, String comm_name, String cityid) {
    List<CommunityVo> comms = commDao.getCommunityByName(comm_name, cityid);
    Map<String, Object> result = new HashMap<String, Object>();

    FaultTolerant fault = new Gson().fromJson(auth, FaultTolerant.class);
    // 进行验证
    if (!"0".equals(fault.getUid())) {
      if (Auth.auth(fault) == false) {
        result.put("code", CommonErrorEnum.FAULT_FOLERANT.getCode());
        result.put("msg", CommonErrorEnum.FAULT_FOLERANT.getMessage());
        return ReturnJSON.getInstance().ret(result);
      }
    }
    result.put("code", 0);
    result.put("msg", "查询成功");
    result.put("data", comms);

    return ReturnJSON.getInstance().ret(result);
  }