/** * 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 = "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 = "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; }