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