示例#1
0
 public String addRequest(RequestVO request) throws SeeWorldException {
   String senderId = request.getSender_id();
   String recieverId = request.getReciever_id();
   if (senderId.equals(recieverId)) {
     return SELF;
   }
   params.clear();
   params.put(IRequestDAO.RECEIVER, recieverId);
   params.put(IRequestDAO.SENDER, senderId);
   if (requestDao.getCount(params) > 0) {
     return S_REQUEST;
   }
   params.clear();
   params.put(IRequestDAO.SENDER, recieverId);
   params.put(IRequestDAO.RECEIVER, senderId);
   if (requestDao.getCount(params) > 0) {
     return R_REQUEST;
   }
   if (friendLogic.areFriends(new FriendVO(recieverId, senderId))) {
     return FRIEND;
   }
   Request instance = new Request();
   User reciever = userDao.findById(recieverId);
   User sender = userDao.findById(senderId);
   instance.setSender(sender);
   instance.setReciever(reciever);
   requestDao.save(instance);
   RequestVO requestVo = new RequestVO(instance);
   requestJson = JSONObject.fromObject(requestVo);
   return SUCCESS;
 }
示例#2
0
 public void showRequestList(RequestVO request) throws SeeWorldException {
   String reciever_id = request.getReciever_id();
   User reciever = userDao.findById(reciever_id);
   List<Request> list =
       requestDao.findByProperty(
           "from Request as model where model.reciever=? order by model.addTime desc", reciever);
   requestSum = list.size();
   if (requestSum > 0) {
     requestList = new JSONArray();
     requestList.addAll(vOPOTransformator.transferRequestToVOList(list));
   }
 }