コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * 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;
 }