Esempio n. 1
0
 // ---------------HISTORY-----------------//
 @RequestMapping(value = "/api/viphistory", method = RequestMethod.POST)
 public void addVipHistory(
     @RequestBody String body, HttpServletRequest request, HttpServletResponse response) {
   EmenuContext context = newContext(request);
   VipHistory vipHistory = JsonUtils.fromJson(body, VipHistory.class);
   vipLogic.addVipHistory(context, vipHistory);
   sendSuccess(response, HttpServletResponse.SC_CREATED);
 }
Esempio n. 2
0
 @RequestMapping(value = "/api/vips/{id:[\\d]+}", method = RequestMethod.DELETE)
 public void delete(
     @PathVariable(value = "id") int vipid,
     HttpServletRequest request,
     HttpServletResponse response) {
   EmenuContext context = newContext(request);
   vipLogic.delete(context, vipid);
 }
Esempio n. 3
0
 @RequestMapping(value = "/api/vips/{id:[\\d]+}/recharge", method = RequestMethod.PUT)
 public double recharge(
     @PathVariable(value = "id") int vipid,
     @RequestParam(value = "money") double money,
     HttpServletRequest req,
     HttpServletResponse resp) {
   EmenuContext context = newContext(req);
   return vipLogic.recharge(context, vipid, money);
 }
Esempio n. 4
0
 @RequestMapping(value = "/api/vips", method = RequestMethod.POST)
 public @ResponseBody Vip add(
     @RequestBody String body, HttpServletRequest request, HttpServletResponse response) {
   EmenuContext context = newContext(request);
   Vip vip = JsonUtils.fromJson(body, Vip.class);
   vip = vipLogic.add(context, vip);
   sendSuccess(response, HttpServletResponse.SC_CREATED);
   return vip;
 }
Esempio n. 5
0
 @RequestMapping(value = "/api/vips/{id:[\\d]+}", method = RequestMethod.PUT)
 public @ResponseBody Vip update(
     @PathVariable(value = "id") int vipid,
     @RequestBody String body,
     HttpServletRequest request,
     HttpServletResponse response) {
   EmenuContext context = newContext(request);
   Vip vip = JsonUtils.fromJson(body, Vip.class);
   if (vip.getId() != vipid) {
     sendError(response, HttpServletResponse.SC_BAD_REQUEST);
     return null;
   }
   return vipLogic.update(context, vip);
 }
Esempio n. 6
0
 @RequestMapping(value = "/api/public/vip-names", method = RequestMethod.GET)
 public @ResponseBody List<String> getVipNames(HttpServletRequest request) {
   EmenuContext context = newContext(request);
   return vipLogic.listVipNames(context);
 }
Esempio n. 7
0
 @RequestMapping(value = "/api/vips/{id:[\\d]+}", method = RequestMethod.GET)
 public @ResponseBody Vip get(
     @PathVariable(value = "id") int id, HttpServletRequest req, HttpServletResponse response) {
   EmenuContext context = newContext(req);
   return vipLogic.get(context, id);
 }
Esempio n. 8
0
 @RequestMapping(value = "/api/vips", method = RequestMethod.GET)
 public @ResponseBody List<Vip> getAll(HttpServletRequest request) {
   EmenuContext context = newContext(request);
   return vipLogic.getAll(context);
 }