/**
  * Accepts a POST request with an XML message parameter
  *
  * @param message serialized Message object
  * @return a string with the result of the POST
  */
 @RequestMapping(
     value = "focuslist",
     method = RequestMethod.POST,
     consumes = "application/json",
     produces = "application/json")
 public @ResponseBody GetMessagesResponse getFocusList(
     @RequestBody BeforeAfterRequest req,
     HttpServletResponse response,
     HttpServletRequest request) {
   GetMessagesResponse rp = new GetMessagesResponse();
   rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
   String strId = SecurityContextHolder.getContext().getAuthentication().getName();
   long userId =
       Cookie.checkCommonUser(
           strId, response, request, SecurityContextHolder.getContext().getAuthentication());
   if (BeforeAfterRequest.checkParameters(req) <= 0) {
     return rp;
   }
   try {
     int count = req.getCount();
     req.setCount(count + 1);
     BeforeAfterRequest.BeforeAfterModeValue modeValue = BeforeAfterRequest.calcModeValue(req);
     List<Object> list = positionRequestBo.getFocusList(req, modeValue.getMode(), userId);
     rp.setAll(Cookie.calcIsAll(list, count));
     //    		Cookie.calcBeforeAfter(rp, count, list, modeValue.getMode(), modeValue.getValue());
     //    		ArrayList<DoctorItem> metaList = (ArrayList)list;
     rp.setList(list);
     rp.setResult(Cookie.RESPONSE_SUCCESS);
     return rp;
   } catch (Exception e) {
     e.printStackTrace();
     rp.setResult(Cookie.RESPONSE_SERVER_QUERY_ERROR);
   }
   return rp;
 }
 /**
  * Accepts a POST request with an XML message parameter
  *
  * @param message serialized Message object
  * @return a string with the result of the POST
  */
 @RequestMapping(
     value = "getpricelist",
     method = RequestMethod.POST,
     consumes = "application/json",
     produces = "application/json")
 public @ResponseBody GetMessagesResponse getPriceList(
     @RequestBody PriceListRequest req, HttpServletResponse response, HttpServletRequest request) {
   GetMessagesResponse rp = new GetMessagesResponse();
   rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
   String strId = SecurityContextHolder.getContext().getAuthentication().getName();
   long userId =
       Cookie.checkCommonUser(
           strId, response, request, SecurityContextHolder.getContext().getAuthentication());
   if (PriceListRequest.checkParameters(req) <= 0) {
     return rp;
   }
   try {
     int count = req.getCount();
     req.setCount(count + 1);
     List<Object> list = priceListBo.getPriceList(req, userId);
     // userBo.updateLoginLogs(userId);
     rp.setAll(Cookie.calcIsAll(list, count));
     rp.setList(list);
     rp.setResult(Cookie.RESPONSE_SUCCESS);
     return rp;
   } catch (Exception e) {
     e.printStackTrace();
     rp.setResult(Cookie.RESPONSE_SERVER_QUERY_ERROR);
   }
   return rp;
 }
 /**
  * Accepts a POST request with an XML message parameter
  *
  * @param message serialized Message object
  * @return a string with the result of the POST
  */
 @RequestMapping(
     value = "gettracksbyorderid",
     method = RequestMethod.POST,
     consumes = "application/json",
     produces = "application/json")
 public @ResponseBody GetMessagesResponse getTracksByOrderId(
     @RequestBody IdRequest req, HttpServletResponse response, HttpServletRequest request) {
   GetMessagesResponse rp = new GetMessagesResponse();
   rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
   String strId = SecurityContextHolder.getContext().getAuthentication().getName();
   Cookie.checkAdminUser(strId);
   if (IdRequest.checkParameters(req) <= 0) {
     return rp;
   }
   try {
     Order order = orderBo.findById(req.getId());
     IdBeforeAfterRequest posReq = new IdBeforeAfterRequest();
     posReq.setBefore(order.getCreateTime());
     posReq.setAfter(
         order.getDeliverTime() > 0 ? order.getDeliverTime() : order.getCreateTime() * 2);
     posReq.setCount(500);
     List<Object> list = positionRequestBo.getTracks(posReq, order.getTruckUserId());
     rp.setList(list);
     rp.setResult(Cookie.RESPONSE_SUCCESS);
     return rp;
   } catch (Exception e) {
     e.printStackTrace();
     rp.setResult(Cookie.RESPONSE_SERVER_QUERY_ERROR);
   }
   return rp;
 }
 /**
  * 车库中精准定位为司机发定位短信 Accepts a POST request with an XML message parameter
  *
  * @param message serialized Message object
  * @return a string with the result of the POST
  */
 @RequestMapping(
     value = "sendpossms",
     method = RequestMethod.POST,
     consumes = "application/json",
     produces = "application/json")
 public @ResponseBody ResultResponse sendPosSms(
     @RequestBody IdRequest req, HttpServletResponse response, HttpServletRequest request) {
   ResultResponse rp = new ResultResponse();
   rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
   String strId = SecurityContextHolder.getContext().getAuthentication().getName();
   Cookie.checkCommonUser(
       strId, response, request, SecurityContextHolder.getContext().getAuthentication());
   try {
     User user = userBo.findById(req.getId());
     if (user != null) {
       int smsLocate = PositionHelper.checkAvailable(user.getTelephone().toString());
       positionBo.updateSmsLocateState(smsLocate, req.getId());
     } else {
       UnregisterUser unUser = unregisterUserBo.findById(req.getId());
       if (unUser != null) {
         int smsLocate = PositionHelper.checkAvailable(unUser.getTelephone().toString());
         if (smsLocate != unUser.getSmsLocate()) {
           unregisterUserBo.updateSmsLocateState(smsLocate, req.getId());
         }
       }
     }
     rp.setResult(Cookie.RESPONSE_SUCCESS);
   } catch (Exception e) {
     e.printStackTrace();
     rp.setResult(Cookie.RESPONSE_SERVER_QUERY_ERROR);
   }
   return rp;
 }
 /**
  * Accepts a POST request with an XML message parameter
  *
  * @param message serialized Message object
  * @return a string with the result of the POST
  */
 @RequestMapping(
     value = "nickname",
     method = RequestMethod.POST,
     consumes = "application/json",
     produces = "application/json")
 public @ResponseBody ResultResponse nickName(
     @RequestBody NickNameRequest req, HttpServletResponse response, HttpServletRequest request) {
   ResultResponse rp = new ResultResponse();
   rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
   String strId = SecurityContextHolder.getContext().getAuthentication().getName();
   long userId =
       Cookie.checkCommonUser(
           strId, response, request, SecurityContextHolder.getContext().getAuthentication());
   if (NickNameRequest.checkParameters(req) <= 0) {
     return rp;
   }
   try {
     rp.setResult(positionRequestBo.addNickName(userId, req.getUserId(), req.getNickName()));
     return rp;
   } catch (Exception e) {
     e.printStackTrace();
     rp.setResult(Cookie.RESPONSE_SERVER_QUERY_ERROR);
   }
   return rp;
 }
 /**
  * Accepts a POST request with an XML message parameter
  *
  * @param message serialized Message object
  * @return a string with the result of the POST
  */
 @RequestMapping(
     value = "gettracks",
     method = RequestMethod.POST,
     consumes = "application/json",
     produces = "application/json")
 public @ResponseBody GetTrackResponse getTracks(
     @RequestBody IdBeforeAfterRequest req,
     HttpServletResponse response,
     HttpServletRequest request) {
   GetTrackResponse rp = new GetTrackResponse();
   rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
   String strId = SecurityContextHolder.getContext().getAuthentication().getName();
   long userId =
       Cookie.checkCommonUser(
           strId, response, request, SecurityContextHolder.getContext().getAuthentication());
   if (BeforeAfterRequest.checkParameters(req) <= 0) {
     return rp;
   }
   try {
     User user = userBo.findById(req.getId());
     Profile profile = profileBo.findById(req.getId());
     if (user == null || profile == null) {
       rp.setResult(Cookie.RESPONSE_SUCCESS);
       return rp;
     }
     DriverInfo info = new DriverInfo(profile, user);
     rp.setInfo(info);
     int count = req.getCount();
     req.setCount(count + 1);
     List<Object> list = positionRequestBo.getTracks(req, userId);
     rp.setAll(Cookie.calcIsAll(list, count));
     rp.setList(list);
     rp.setResult(Cookie.RESPONSE_SUCCESS);
     return rp;
   } catch (Exception e) {
     e.printStackTrace();
     rp.setResult(Cookie.RESPONSE_SERVER_QUERY_ERROR);
   }
   return rp;
 }
  /**
   * Accepts a POST request with an XML message parameter
   *
   * @param message serialized Message object
   * @return a string with the result of the POST
   */
  @RequestMapping(
      value = "addcarandprice",
      method = RequestMethod.POST,
      consumes = "application/json",
      produces = "application/json")
  public @ResponseBody ResultResponse addCarAndPrice(
      @RequestBody AddCarAndPriceRequest req,
      HttpServletResponse response,
      HttpServletRequest request) {
    ResultResponse rp = new ResultResponse();
    rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
    String strId = SecurityContextHolder.getContext().getAuthentication().getName();
    long userId =
        Cookie.checkCommonUser(
            strId, response, request, SecurityContextHolder.getContext().getAuthentication());
    // LogUtil.i("test:", "userId =" + userId + "price:"+req.getPrice());
    if (0 >= AddCarAndPriceRequest.checkParameters(req)) {
      return rp;
    }
    if (!priceRequestBo.isPriceValid(req)) {
      rp.setResult(Cookie.RESPONSE_USE_ERROR_MSG);
      rp.setErrorMsg("所输价格不合理,请重新录入");
      return rp;
    }
    Long driverId = req.getDriverUserId();

    PositionRequest pos = positionRequestBo.findById(userId, driverId);
    // 不在我的车场内,先添加到车场
    if (pos == null || pos.getType() < 0) {
      int size = positionRequestBo.getRemainFocusSize(userId);
      if (size <= 0) {
        rp.setResult(Cookie.RESPONSE_TOO_MUCH);
        return rp;
      }
      ProcessPositionRequest processPositionRequest = new ProcessPositionRequest(driverId);
      rp = positionRequestBo.askPosition(processPositionRequest, userId, 1, 1);
      if (rp.getResult() <= 0) {
        return rp;
      }
    }
    // 添加或更新价格
    rp = priceRequestBo.updatePrice(req, userId);
    return rp;
  }
 /**
  * Accepts a POST request with an XML message parameter
  *
  * @param message serialized Message object
  * @return a string with the result of the POST
  */
 @RequestMapping(
     value = "search",
     method = RequestMethod.POST,
     consumes = "application/json",
     produces = "application/json")
 public @ResponseBody AskPositionResponse searchPosition(
     @RequestBody TelephoneRequest req, HttpServletResponse response, HttpServletRequest request) {
   AskPositionResponse rp = new AskPositionResponse();
   rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
   String strId = SecurityContextHolder.getContext().getAuthentication().getName();
   long userId =
       Cookie.checkCommonUser(
           strId, response, request, SecurityContextHolder.getContext().getAuthentication());
   if (TelephoneRequest.checkParameters(req) <= 0) {
     return rp;
   }
   rp = positionRequestBo.searchPosition(req, userId);
   return rp;
 }
 /**
  * Accepts a POST request with an XML message parameter
  *
  * @param message serialized Message object
  * @return a string with the result of the POST
  */
 @RequestMapping(
     value = "deletefans",
     method = RequestMethod.POST,
     consumes = "application/json",
     produces = "application/json")
 public @ResponseBody ResultResponse deleteFansPosition(
     @RequestBody ProcessPositionRequest req,
     HttpServletResponse response,
     HttpServletRequest request) {
   ResultResponse rp = new ResultResponse(Cookie.RESPONSE_BAD_REQUEST);
   String strId = SecurityContextHolder.getContext().getAuthentication().getName();
   long userId =
       Cookie.checkCommonUser(
           strId, response, request, SecurityContextHolder.getContext().getAuthentication());
   if (ProcessPositionRequest.checkParameters(req, userId) <= 0) {
     return rp;
   }
   rp.setResult(
       positionRequestBo.deletePosition(req.getUserId(), Constant.TYPE_POSITION_DELETED, userId));
   return rp;
 }
  /**
   * 在车库中加未注册好友
   *
   * @param message serialized Message object
   * @return a string with the result of the POST
   */
  @RequestMapping(
      value = "asksingleunregisteruser",
      method = RequestMethod.POST,
      consumes = "application/json",
      produces = "application/json")
  public @ResponseBody SmsLocateResponse askSingleUnregisterUser(
      @RequestBody AskSingleUserRequest req, // TelephoneRequest req,
      HttpServletResponse response,
      HttpServletRequest request) {
    SmsLocateResponse rp = new SmsLocateResponse();
    rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
    String strId = SecurityContextHolder.getContext().getAuthentication().getName();
    long userId =
        Cookie.checkCommonUser(
            strId, response, request, SecurityContextHolder.getContext().getAuthentication());
    if (AskSingleUserRequest.checkParameters(req) <= 0) {
      return rp;
    }
    //		String truckName = "";
    //		if(req.getName() != null && !req.getName().equals("")) {
    //			truckName = req.getName();
    //			truckName = String.valueOf(truckName.charAt(0));
    //		}
    //		req.setName(truckName);
    //		Profile profile = profileBo.findById(userId);

    rp = unregisterUserBo.askSingleUnregisterUser(req, userId, 1);
    if (rp.getResult() == Cookie.RESPONSE_SUCCESS) {
      //			String name = profile.getUserName();
      //			name = name.length() > 1 ? name.substring(0, 1) : name;
      //			String cargoName = profile.getCompanyName() + name;
      //			CurrentStatusManager.addInviteSmsCount(1);
      //			asyncProcess.sendSms(req.getTelephone(), String.format(Constant.ASK_POSITION_SMS_CONTENT,
      // name, cargoName));
    }
    return rp;
  }
  /**
   * Accepts a POST request with an XML message parameter
   *
   * @param message serialized Message object
   * @return a string with the result of the POST
   */
  @RequestMapping(
      value = "postpos",
      method = RequestMethod.POST,
      consumes = "application/json",
      produces = "application/json")
  public @ResponseBody ResultResponse postPosition(
      @RequestBody PostPositionRequest req,
      HttpServletResponse response,
      HttpServletRequest request) {
    ResultResponse rp = new ResultResponse(Cookie.RESPONSE_BAD_REQUEST);
    String strId = SecurityContextHolder.getContext().getAuthentication().getName();
    long userId =
        Cookie.checkCommonUser402(
            strId, response, request, SecurityContextHolder.getContext().getAuthentication());

    if (PostPositionRequest.checkParameters(req) <= 0) {
      return rp;
    }
    if (req.getLon() < 0.1 && req.getLat() < 0.1) {
      rp.setResult(Cookie.RESPONSE_SUCCESS);
      return rp;
    }
    City city = cityBo.findById(req.getCityId());
    if (city == null || city.getId() <= 0) {
      rp.setResult(Cookie.RESPONSE_SUCCESS);
      return rp;
    }
    int id = 0;
    if (city.getDeep() == Constant.DEEP_CITY) {
      id = city.getId();
    } else if (city.getDeep() == Constant.DEEP_DISTRICT) {
      id = city.getParentId();
    }
    req.setCityId(id);
    Position pos = positionBo.createIfNull(userId);
    if ((req.getCityId() > 0 && pos.getLastEffectCity() != req.getCityId())
        || (req.getCityId() <= 0
            && PositionHelper.distFrom(req.getLat(), req.getLon(), pos.getLat(), pos.getLon())
                > 30000)) {
      PositionLog log =
          new PositionLog(
              null,
              userId,
              pos.getLastPositionTime(),
              pos.getLastEffectLon(),
              pos.getLastEffectLat(),
              pos.getLastEffectCity());
      positionLogBo.save(log);
    }
    pos.setLastEffectCity(pos.getCity());
    pos.setLastEffectLat(pos.getLat());
    pos.setLastEffectLon(pos.getLon());
    pos.setCity(req.getCityId());
    pos.setLon(req.getLon());
    pos.setLat(req.getLat());
    pos.setPositionTime(System.currentTimeMillis());
    pos.setLastPositionTime(System.currentTimeMillis());
    pos.setUpdateTime(System.currentTimeMillis());
    positionBo.update(pos);
    User user = userBo.findById(userId);
    if (user != null && user.getInstallPlace() <= 0) {
      user.setInstallPlace(req.getCityId());
      user.setUpdateTime(System.currentTimeMillis());
      userBo.update(user);
    }
    rp.setResult(Cookie.RESPONSE_SUCCESS);
    return rp;
  }
  /**
   * 根据orderId获得运营商定位 Accepts a POST request with an XML message parameter
   *
   * @param message serialized Message object
   * @return a string with the result of the POST
   */
  @RequestMapping(
      value = "getsmsposbyorderid",
      method = RequestMethod.POST,
      consumes = "application/json",
      produces = "application/json")
  public @ResponseBody PositionResponse getSmsPosByOrderId(
      @RequestBody IdRequest req, HttpServletResponse response, HttpServletRequest request) {
    PositionResponse rp = new PositionResponse();
    rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
    String strId = SecurityContextHolder.getContext().getAuthentication().getName();
    long userId =
        Cookie.checkCommonUser(
            strId, response, request, SecurityContextHolder.getContext().getAuthentication());
    try {
      Order order = orderBo.findById(req.getId());
      if (order == null) {
        return rp;
      }
      if (System.currentTimeMillis() > order.getExpireTime()) {
        rp.setResult(Cookie.RESPONSE_TIMEOUT);
        return rp;
      }
      if (!order.getCargoUserId().equals(userId)) {
        rp.setResult(Cookie.RESPONSE_PERMISSION_DENIED);
        return rp;
      }
      User user = userBo.findById(order.getTruckUserId());
      if (user != null) {
        Position position = positionBo.createIfNull(order.getTruckUserId());
        rp.setCarrier(PositionHelper.CHINA_MOBILE);
        //				rp.setCarrier(PositionHelper.validateMobile(user.getTelephone().toString()));
        if (position.getPositionTime() < (System.currentTimeMillis() - TimeUtils.ONE_MINUTE * 15)) {
          PositionInfo info = positionBo.getSmsLocation(1, userId, user.getTelephone(), user);
          rp.setLat(info.getLat());
          rp.setLon(info.getLon());
          rp.setSmsLocate(info.getType());
          rp.setPositionTime(System.currentTimeMillis());
          rp.setSmsLocateReplyNumber(
              PositionHelper.getLocateReplyNumber(user.getTelephone().toString()));
          rp.setResult(Cookie.RESPONSE_SUCCESS);
          return rp;
        } else {
          rp.setLat(position.getLat());
          rp.setLon(position.getLon());
          rp.setPositionTime(System.currentTimeMillis());
          rp.setResult(Cookie.RESPONSE_SUCCESS);
          return rp;
        }
      } else {
        rp.setIsRegister(0);
        UnregisterUser unregisterUser = unregisterUserBo.findById(order.getTruckUserId());
        if (unregisterUser != null) {
          rp.setCarrier(PositionHelper.CHINA_MOBILE);
          //
          //	rp.setCarrier(PositionHelper.validateMobile(unregisterUser.getTelephone().toString()));
          if (unregisterUser.getPositionTime()
              < (System.currentTimeMillis() - TimeUtils.ONE_MINUTE * 15)) {
            PositionInfo info = unregisterUserBo.getSmsLocation(unregisterUser, 1, userId);
            rp.setLat(info.getLat());
            rp.setLon(info.getLon());
            rp.setSmsLocate(info.getType());
            rp.setPositionTime(System.currentTimeMillis());
            rp.setSmsLocateReplyNumber(
                PositionHelper.getLocateReplyNumber(unregisterUser.getTelephone().toString()));
            rp.setResult(Cookie.RESPONSE_SUCCESS);
            return rp;
          } else {
            rp.setLat(unregisterUser.getLat());
            rp.setLon(unregisterUser.getLon());
            rp.setPositionTime(System.currentTimeMillis());
            rp.setResult(Cookie.RESPONSE_SUCCESS);
          }
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
      rp.setResult(Cookie.RESPONSE_SERVER_QUERY_ERROR);
    }
    return rp;
  }
  /**
   * 根据用户id获得运营商定位 Accepts a POST request with an XML message parameter
   *
   * @param message serialized Message object
   * @return a string with the result of the POST
   */
  @RequestMapping(
      value = "getsmspos",
      method = RequestMethod.POST,
      consumes = "application/json",
      produces = "application/json")
  public @ResponseBody GetSmsLocateResponse getSmsPos(
      @RequestBody IdTypeRequest req, HttpServletResponse response, HttpServletRequest request) {
    GetSmsLocateResponse rp = new GetSmsLocateResponse();
    rp.setResult(Cookie.RESPONSE_BAD_REQUEST);
    String strId = SecurityContextHolder.getContext().getAuthentication().getName();
    long userId =
        Cookie.checkCommonUser(
            strId, response, request, SecurityContextHolder.getContext().getAuthentication());
    try {
      Profile profile = profileBo.findById(userId);
      if (profile.getMemberLocateCount() <= 0) {
        rp.setResult(Cookie.RESPONSE_NOT_ENOUGH);
        return rp;
      }
      rp.setCount(profile.getMemberLocateCount());
      User user = userBo.findById(req.getId());
      if (user != null) {
        //				int carrier = PositionHelper.validateMobile(user.getTelephone().toString());
        Position pos = positionBo.createIfNull(req.getId());
        rp.setCarrier(PositionHelper.CHINA_MOBILE);
        if (pos.getPositionTime() < (System.currentTimeMillis() - TimeUtils.ONE_MINUTE * 5)) {
          PositionInfo info =
              positionBo.getSmsLocation(req.getType(), userId, user.getTelephone(), user);
          rp.setLat(info.getLat());
          rp.setLon(info.getLon());
          rp.setSmsLocate(info.getType());
          rp.setPositionTime(System.currentTimeMillis());
          rp.setSmsLocateReplyNumber(
              PositionHelper.getLocateReplyNumber(user.getTelephone().toString()));
          if (info.getType() == Constant.SMS_LOCATE_SUCCESS) {
            profileBo.detractMemberLocateCount(userId);
            rp.setCount(profile.getMemberLocateCount() - 1);
          }
          rp.setResult(Cookie.RESPONSE_SUCCESS);
          return rp;
        } else {
          rp.setLat(pos.getLat());
          rp.setLon(pos.getLon());
          rp.setPositionTime(System.currentTimeMillis());
          rp.setResult(Cookie.RESPONSE_SUCCESS);
          profileBo.detractMemberLocateCount(userId);
          rp.setCount(profile.getMemberLocateCount() - 1);
          return rp;
        }
      } else {
        UnregisterUser unregisterUser = unregisterUserBo.findById(req.getId());
        //				int carrier = PositionHelper.validateMobile(unregisterUser.getTelephone().toString());
        rp.setCarrier(PositionHelper.CHINA_MOBILE);
        if (unregisterUser != null) {
          rp.setCount(profile.getMemberLocateCount());
          if (unregisterUser.getPositionTime()
              < (System.currentTimeMillis() - TimeUtils.ONE_MINUTE * 5)) {
            PositionInfo info =
                unregisterUserBo.getSmsLocation(unregisterUser, req.getType(), userId);
            rp.setLat(info.getLat());
            rp.setLon(info.getLon());
            rp.setSmsLocate(info.getType());
            rp.setPositionTime(System.currentTimeMillis());
            rp.setSmsLocateReplyNumber(
                PositionHelper.getLocateReplyNumber(unregisterUser.getTelephone().toString()));
            if (info.getType() == Constant.SMS_LOCATE_SUCCESS) {
              profileBo.detractMemberLocateCount(userId);
              rp.setCount(profile.getMemberLocateCount() - 1);
            }
            rp.setResult(Cookie.RESPONSE_SUCCESS);
            return rp;
          } else {
            rp.setLat(unregisterUser.getLat());
            rp.setLon(unregisterUser.getLon());
            rp.setPositionTime(System.currentTimeMillis());
            rp.setResult(Cookie.RESPONSE_SUCCESS);
            profileBo.detractMemberLocateCount(userId);
            rp.setCount(profile.getMemberLocateCount() - 1);
          }
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
      rp.setResult(Cookie.RESPONSE_SERVER_QUERY_ERROR);
    }
    return rp;
  }