@LoginRequired @RequestMapping(value = "/profile/settings/baby", method = RequestMethod.POST) @ResponseBody public ResultView<BabyView> updateBabySettings(@RequestBody BabyView babyParams) { long userId = HehuaRequestContext.getUserId(); return babyService.updateBaby(userId, babyParams); }
@LoginRequired @RequestMapping(value = "/profile/settings/nickname", method = RequestMethod.POST) @ResponseBody public Object updateNickname(@RequestBody UpdateNicknameForm updateNicknameForm) throws InvalidNicknameException, NickNameAlreadyExistException, NickNameIllegalException { long userId = HehuaRequestContext.getUserId(); String result = userService.updateNickname(userId, updateNicknameForm.getNickname()); JSONObject jsonObject = new JSONObject(); jsonObject.put("nickname", result); return ResponseRender.renderResponse(jsonObject); }
@LoginRequired @RequestMapping(value = "/profile", method = RequestMethod.GET) @ResponseBody public JSONObject getProfile() { long userId = HehuaRequestContext.getUserId(); User user = userManager.getUserById(userId); Baby baby = babyService.getBabyByUidxUid(userId); Address defaultAddress = addressService.getDefaultAddress(userId); Map<Integer, Integer> statuesMap = orderService.getStatusesMap(userId); int unpays = Objects.firstNonNull(statuesMap.get(OrdersModel.STATUS_NEW), 0); int unrececives = Objects.firstNonNull(statuesMap.get(OrdersModel.STATUS_DELIVERIED), 0); return ResponseRender.renderResponse( profileRender.renderProfile(user, baby, defaultAddress, unpays, unrececives)); }
@RequestMapping(value = "/flash/item/list/v2", method = RequestMethod.GET) @ResponseBody public JSONObject getFlashList( @RequestParam(value = "offset", required = false, defaultValue = "0") Integer offset, @RequestParam(value = "limit", required = false, defaultValue = "21") Integer limit, @RequestParam(value = "babystatus", required = false, defaultValue = "0") int babyStatus, @RequestParam(value = "gender", required = false, defaultValue = "0") int gender, @RequestParam(value = "edc", required = false) String edc, @RequestParam(value = "birthday", required = false) String birthday, @RequestParam(value = "isset", required = false, defaultValue = "true") boolean isset) { JSONObject jo = itemServiceApiV2Proxy.getFlashList(isset, babyStatus, gender, edc, birthday, offset, limit); UserAccessInfo userAccessInfo = HehuaRequestContext.getUserAccessInfo(); userAccessInfo.setEvent("snap"); int status = jo.containsKey("data") ? 0 : -1; userAccessInfo.setStatus(status); userAccessInfo.setPreganancy(babyStatus); userAccessInfo.setBabyGender(gender); userAccessInfo.setBabyBirthday(birthday); userAccessInfo.setEdc(edc); flumeEventLogger.info(userAccessInfo.toString()); return jo; }