/** * 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 = "focuslist4unregister", method = RequestMethod.POST, consumes = "application/json", produces = "application/json") public @ResponseBody GetMessagesResponse getFocusList4Unregister( @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.getFocusList4Unregister(req, modeValue.getMode(), 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 = "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; }
public static int checkParameters(SearchEnterpriseCargoRequest req) { if (BeforeAfterRequest.checkParameters(req) <= 0) { return 0; } return 1; }