Пример #1
0
  @RequestMapping("/achatDetail/{userid}")
  public String achatDetail(@PathVariable int userid, Model model, Achat ac) {
    ac.setCreate_user(userid + "");
    List<Achat> list = achatService.findAll(ac);
    for (Achat a : list) {
      String category_id = a.getCategory_id();
      Category c = categoryService.get(Integer.parseInt(category_id));
      a.setCategory_name(c.getName());
      String state = a.getState();
      a.setState(StringUtil.getState(state));
      String uid = a.getCreate_user();
      a.setCreate_username(userService.get(Integer.parseInt(uid)).getUsername());
      String sid = a.getSupport_id();
      if (sid != null) {
        a.setSupport_name(userService.get(Integer.parseInt(sid)).getUsername());
      } else {
        a.setSupport_name("暂无供应商报价");
      }
    }

    String start_date = ac.getStart_date();
    String end_date = ac.getEnd_date();
    if (start_date != null && end_date != null) {
      model.addAttribute("start_date", start_date);
      model.addAttribute("end_date", end_date);
    }

    model.addAttribute("achatlist", list);
    return "/front/user/achatDetail";
  }
Пример #2
0
 @RequestMapping("/showUser/{id}")
 public String showUserInfo(Model model, @PathVariable int id) {
   LOGGER.info("查询用户" + id);
   User user = userService.get(id);
   model.addAttribute("user", user);
   /** 基于Idea上传的测试 */
   return "/user/showUser";
 }
Пример #3
0
 /**
  * @Description: 删除方法
  *
  * @param @param ids
  * @param @param response
  * @param @throws IOException
  * @return void
  * @throws
  * @author work
  * @date 2016年4月11日 下午10:16:53
  */
 @RequestMapping("/delete")
 public void delete(String ids, HttpServletResponse response) throws IOException {
   String[] str_ids = ids.split(",");
   for (String id : str_ids) {
     userService.delete(Integer.parseInt(id));
     response.getWriter().print("true");
   }
 }
Пример #4
0
  /**
   * @Description: TODO
   *
   * @param @param user
   * @param @param response
   * @param @param page 第几页
   * @param @param rows 一页显示多少条
   * @return void
   * @throws
   * @author work
   * @date 2016年4月11日 上午12:58:32
   */
  @RequestMapping("/getUserList")
  public void getUserList(
      @ModelAttribute User user, String type, HttpServletResponse response, int page, int rows) {
    response.setCharacterEncoding("utf-8");
    if ("1".equals(type)) {
      user.setRole_id("2");
    } else if ("2".equals(type)) {
      int id = user.getId();
      if (id != 0) {
        User u = userService.get(id);
        String province = u.getProvince();
        if (province != null) {
          user.setProvince(province);
        }
      }
      user.setRole_id("3");
    } else {
      user.setRole_id("4");
    }
    Page<User> users = userService.findByParams(user, page, rows);
    for (User u : users.getRows()) {
      Date date = u.getLogin_date();
      String parseDate = "";

      if (date != null) {
        SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        parseDate = sm.format(date);
        u.setParseDate(parseDate);
      }
      String role_id = u.getRole_id();
      String role_name = "";
      if (role_id != null) {
        role_name = roleService.get(Integer.parseInt(role_id)).getRole_name();
      }
      u.setRole_name(role_name);
    }

    String json = JSON.toJSONString(users);
    System.out.println(json);
    try {
      response.getWriter().print(json);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Пример #5
0
 /**
  * @Description: 修改
  *
  * @param @param user
  * @param @param response
  * @return void
  * @throws
  * @author work
  * @date 2016年4月11日 下午8:14:50
  */
 @RequestMapping("/edit")
 public void edit(User user, HttpServletResponse response) {
   try {
     userService.update(user);
     response.getWriter().print("true");
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Пример #6
0
 /**
  * @Description: 前台页面用户详情设置
  *
  * @param @param id
  * @param @param model
  * @param @return
  * @return String
  * @throws
  * @author work
  * @date 2016年4月12日 下午7:28:14
  */
 @RequestMapping("/frontUserSet/{id}")
 public String frontUserSet(@PathVariable int id, Model model) {
   User user = userService.get(id);
   model.addAttribute("currentUser", user);
   return "/front/user/userSet";
 }