Exemplo n.º 1
0
  @RequestMapping(value = "/admin/index.html", method = RequestMethod.GET)
  public ModelAndView index() {

    ModelAndView modelAndView = new ModelAndView(index);
    ModelMap modelMap = modelAndView.getModelMap();

    List<User> users = userService.findAllUsers();
    Account account = accountService.findLatestRecord();
    int totalIncome = incomeService.getTotal();

    List<Food> dishes = foodService.findAllFoods();

    Payment todayPayment = paymentService.getPaymentOfToday();

    List<FoodType> catagorys = foodTypeService.findAllFoodTypes();
    Map<String, List<Food>> map = new HashMap<String, List<Food>>();

    for (FoodType type : catagorys) {
      List<Food> foods = foodService.findFoodByType(type.getGuid());
      if (foods.size() > 0) {
        map.put(type.getName(), foods);
      }
    }

    modelMap.put(USERS, users);

    if (account != null) {
      modelMap.put(REMAINDER, account.getRemainder());
    }

    modelMap.put(INCOMETOTAL, totalIncome);

    modelMap.put(DISHES, dishes);
    modelMap.put(CATAGORYS, map);

    if (todayPayment != null) {
      modelMap.put(TODAYCONSUME, todayPayment.getAmount());
    }

    List<String> contentPages = new ArrayList<String>();
    contentPages.add(dashboard + JSPSUFFIX);
    contentPages.add(userManage + JSPSUFFIX);
    contentPages.add(dishManage + JSPSUFFIX);
    modelMap.put(CONTENTPAGE, contentPages);

    List<StepBean> emptyStepBean = Collections.emptyList();
    modelMap.put(STEPS, emptyStepBean);

    return modelAndView;
  }
Exemplo n.º 2
0
  @RequestMapping(value = "/admin/userManage.html", method = RequestMethod.GET)
  public ModelAndView manageUser() {

    ModelAndView modelAndView = new ModelAndView(index);
    ModelMap modelMap = modelAndView.getModelMap();

    List<String> contentPages = new ArrayList<String>();

    contentPages.add(userManage + JSPSUFFIX);

    modelMap.put(CONTENTPAGE, contentPages);

    List<StepBean> steps = new ArrayList<StepBean>();
    steps.add(StepBean.UserManage);
    modelMap.put(STEPS, steps);

    List<User> users = userService.findAllUsers();
    modelMap.put(USERS, users);

    return modelAndView;
  }