@WebMethod
 public ModelAndView get(int id) {
   ModelAndView mv = new ModelAndView();
   FeedBack po = dao.get(FeedBack.class, id);
   mv.data.put("feedback", JSONHelper.toJSON(po));
   return mv;
 }
示例#2
0
 @WebMethod
 public ModelAndView update(User user, String roleIds) {
   ModelAndView mv = new ModelAndView();
   if (StringUtils.isEmpty(user.name)) {
     throw new GException(PlatformExceptionType.BusinessException, "用户名不能为空");
   }
   User po = dao.get(User.class, user.id);
   po.account = user.account;
   po.name = user.name;
   //		String pwd = user.pwd.replace("*", "");
   if (StringUtils.isNotEmpty(user.pwd)) {
     po.pwd = SecurityHelper.Md5(user.pwd);
   }
   po.tel = user.tel;
   dao.saveOrUpdate(po);
   ThreadSession.getHttpSession().setAttribute(MakesiteConstant.Session_Attr_User, po);
   if (roleIds != null && roleIds.length() != 0) {
     String[] Ids = roleIds.split(",");
     dao.execute("delete from UserRole where uid=?", user.id);
     for (int i = 0; i < Ids.length; i++) {
       if (StringUtils.isEmpty(Ids[i])) {
         continue;
       }
       UserRole rg = new UserRole();
       rg.roleId = Integer.valueOf(Ids[i]);
       rg.uid = user.id;
       dao.saveOrUpdate(rg);
     }
   } else {
   }
   return mv;
 }
示例#3
0
 @WebMethod
 public ModelAndView setCommon(int ndbNo) {
   Food food = service.get(Food.class, ndbNo);
   ModelAndView mv = new ModelAndView();
   if (food != null) {
     food.common = true;
     service.saveOrUpdate(food);
   }
   //		mv.redirect="list";
   mv.data.put("msg", "set common successfully");
   return mv;
 }
示例#4
0
 // 删除扫描记录
 @WebMethod
 public ModelAndView deleteScanRecord(Integer id) {
   ModelAndView mv = new ModelAndView();
   ScanRecord po = dao.get(ScanRecord.class, id);
   if (po != null) {
     dao.delete(po);
   } else {
     throw new GException(PlatformExceptionType.BusinessException, "记录不存在或已经删除");
   }
   mv.data.put("result", "success");
   return mv;
 }
示例#5
0
  @WebMethod
  public ModelAndView delete(int id) {
    ModelAndView mv = new ModelAndView();
    User po = dao.get(User.class, id);
    if (po != null) {
      dao.delete(po);
      dao.execute("delete from UserGroup where uid=?", id);
      dao.execute("delete from UserRole where uid=?", id);
      mv.data.put("msg", "删除用户成功");
    }

    return mv;
  }
示例#6
0
 @WebMethod
 public ModelAndView modifyPwd(int uid, String oldPwd, String newPwd) {
   ModelAndView mv = new ModelAndView();
   User po = dao.get(User.class, uid);
   if (po != null) {
     if (!po.pwd.equals(SecurityHelper.Md5(oldPwd))) {
       throw new GException(PlatformExceptionType.BusinessException, "原密码不正确,请重新输入后重试");
     }
     po.pwd = SecurityHelper.Md5(newPwd);
     dao.saveOrUpdate(po);
   }
   return mv;
 }
示例#7
0
 // 批量删除扫描记录
 @WebMethod
 public ModelAndView deleteBatchScanRecord(String ids) {
   ModelAndView mv = new ModelAndView();
   if (StringUtils.isEmpty(ids)) {
     throw new GException(PlatformExceptionType.BusinessException, "参数ids不能为空");
   }
   String[] idArr = ids.split(",");
   for (String id : idArr) {
     ScanRecord po = dao.get(ScanRecord.class, Integer.valueOf(id));
     if (po != null) {
       dao.delete(po);
     }
   }
   mv.data.put("result", "success");
   return mv;
 }