示例#1
0
  @Action(
      value = "updateUserbyuserstate",
      results = {@Result(name = "json", type = "json")})
  public String updateUserbyuserstate() {
    if (Validate.StrNotNull(this.getUserid())) {
      UserT user = new UserT();
      user = this.getUsertService().findById(this.getUserid());
      if (user != null) {
        if (user.getUserstate().equals("0")) {
          this.setSucflag(false);
          return "json";
        } else {
          user.setUserstate(this.getUserstate());
          this.getUsertService().updateUserstate(user);

          this.setSucflag(true);
          return "json";
        }
      }
      this.setSucflag(false);
      return "json";
    }
    this.setSucflag(false);
    return "json";
  }
示例#2
0
 /**
  * 修改管理员密码,判断数据库是否存在
  *
  * @return
  */
 public boolean CheckUser() {
   this.CheckLogin();
   if (!this.isSlogin()) {
     MD5Code md5 = new MD5Code();
     UserT user = new UserT();
     user.setUsername(this.getUsername().trim());
     user.setPassword(md5.getMD5ofStr(this.getPassword().trim()));
     UserT userlist = this.getUsertService().usert(user);
     if (userlist != null) {
       return true;
     } else {
       return false;
     }
   }
   return true;
 }
  /**
   * 用户中心获取用户收货地址
   *
   * @return
   * @throws IOException
   * @throws TemplateException
   */
  @Action(
      value = "GetUserDeliverAddressForUserCenter",
      results = {
        @Result(
            name = "success",
            type = "freemarker",
            location = "/WEB-INF/theme/default/shop/deliveraddress.ftl"),
        @Result(name = "input", type = "redirect", location = "/html/default/shop/user/login.html")
      })
  public String GetUserDeliverAddressForUserCenter() throws TemplateException, IOException {
    UserT user = (UserT) ActionContext.getContext().getSession().get(BaseTools.USER_SESSION_KEY);
    if (user != null) {
      List<DeliverAddressT> list =
          this.getDeliverAddressTService().findDeliverAddressByuserid(user.getUserid());
      // 路径获取
      ActionContext.getContext()
          .put(FreeMarkervariable.BASEPATH, this.getDataCollectionTAction().getBasePath());
      // 获取收货地址
      ActionContext.getContext().put("deliveraddress", list);
      // 获取导航数据
      ActionContext.getContext()
          .put(
              FreeMarkervariable.SITENAVIGATIONLIST,
              this.getDataCollectionTAction().findSiteNavigation());
      // 获取商城基本数据
      ActionContext.getContext()
          .put(
              FreeMarkervariable.JSHOPBASICINFO,
              this.getDataCollectionTAction().findJshopbasicInfo());
      // 获取页脚分类数据
      ActionContext.getContext()
          .put(
              FreeMarkervariable.FOOTCATEGORY,
              this.getDataCollectionTAction().findFooterCateogyrT());
      // 获取页脚文章数据
      ActionContext.getContext()
          .put(
              FreeMarkervariable.FOOTERATRICLE,
              this.getDataCollectionTAction().findFooterArticle());
      return SUCCESS;

    } else {
      return INPUT;
    }
  }
示例#4
0
 /**
  * 更改管理员密码
  *
  * @return
  */
 @Action(
     value = "UpdateUserMember",
     results = {@Result(name = "json", type = "json")})
 public String UpdateUserMember() {
   this.CheckLogin();
   if (!this.isSlogin()) {
     if (this.CheckUser()) {
       MD5Code md5 = new MD5Code();
       UserT user = new UserT();
       user.setUserid(this.getUserid().trim());
       user.setUsername(this.getUsername().trim());
       user.setPassword(md5.getMD5ofStr(this.getNewpassword().trim()));
       this.getUsertService().updateUserMember(user);
       return "json";
     }
   }
   return "json";
 }
示例#5
0
 /**
  * 发送激活邮件
  *
  * @param user
  * @throws MessagingException
  * @throws IOException
  * @throws TemplateException
  * @throws javax.mail.MessagingException
  */
 @Action(
     value = "sendeMail",
     results = {@Result(name = "json", type = "json")})
 public String sendeMail()
     throws MessagingException, IOException, TemplateException, javax.mail.MessagingException {
   this.findUserById();
   if (beanlist.getUserstate().equals("1")) {
     this.setSlogin(false);
     return "json";
   } else {
     sendSystemEmail.sendTextMail(beanlist);
     this.setSlogin(true);
     return "json";
   }
 }
示例#6
0
  /**
   * 增加商品到购物车
   *
   * @return
   */
  @Action(
      value = "addGroupCart",
      results = {@Result(name = "json", type = "json")})
  public String addGroupCart() {
    UserT user = (UserT) ActionContext.getContext().getSession().get(StaticKey.MEMBER_SESSION_KEY);
    if (user != null) {

      GoodsGroupT ggt = this.GetGoodsGroupTForGroupCart();
      GroupCartT gct = new GroupCartT();
      gct.setId(this.getSerial().Serialid(serial.GROUPCARTINFO));
      gct.setCartid(this.getSerial().Serialid(serial.GROUPCART));
      gct.setOrderid(null);
      gct.setGoodsid(ggt.getGroupid());
      gct.setUserid(user.getUserid());
      gct.setUsername(user.getUsername());
      gct.setUsersetnum("0");
      gct.setNeedquantity(1);
      gct.setPrice(ggt.getMemberprice());
      gct.setGroupprice(ggt.getGroupprice());
      gct.setChangeprice(0.0);
      gct.setPoints(ggt.getSendpoint());
      gct.setSubtotal(this.getNeedquantity() * ggt.getGroupprice());
      gct.setAddtime(BaseTools.systemtime());
      gct.setQuantity(ggt.getSalequantity());
      gct.setPicture(ggt.getPictureurl());
      gct.setWeight("0");
      gct.setState("1");
      gct.setHtmlpath(ggt.getHtmlpath());
      gct.setProductid("0");
      gct.setGoodsname(ggt.getGoodsname());
      this.getGroupCartService().save(gct);
      this.setSucflag(true);
      return "json";
    }
    return "json";
  }
示例#7
0
 /**
  * 管理员登陆
  *
  * @return
  * @throws Exception
  */
 @SuppressWarnings("unchecked")
 @Action(
     value = "adminlogin",
     results = {
       @Result(
           name = "success",
           type = "redirect",
           location = "/jshop/admin/adminindex.jsp?session=${param}"),
       @Result(
           name = "input",
           type = "redirect",
           location = "/jshop/admin/adminlogin.jsp?msg=${param}")
     })
 public String adminlogin() throws Exception {
   MD5Code md5 = new MD5Code();
   UserT user = new UserT();
   user.setUsername(this.getUsername().trim());
   user.setPassword(md5.getMD5ofStr(this.getPassword().trim()));
   user.setState("3"); // 超级管理员
   user = this.getUsertService().login(user);
   if (user != null) {
     ActionContext.getContext()
         .getSession()
         .put(BaseTools.BACK_USER_SESSION_KEY, user.getUserid());
     ActionContext.getContext()
         .getSession()
         .put(BaseTools.BACK_USER_NAME_SESSION_KEY, user.getUsername());
     this.setParam(md5.getMD5ofStr(user.getUserid()));
     ActionContext.getContext().getSession().put(BaseTools.BACK_SESSION_KEY, param);
     // 获取默认主题
     this.getInitTAction().InitDefaultThemeT();
     // 收集权限信息并放入内存
     List<FunctionM> userfunctionlist =
         this.getUserRoleMAction().findUserRoleFunctionList(user.getUserid());
     // List<FunctionM>allfunctionlist=this.getUserRoleMAction().findAllFunctionM();
     ActionContext.getContext().getSession().put(BaseTools.USERROLEFUNCTION, userfunctionlist);
     // ActionContext.getContext().getSession().put(BaseTools.ALLROLEFUNCTION, allfunctionlist);
     return SUCCESS;
   }
   this.setParam("1");
   return INPUT;
 }
示例#8
0
 /**
  * 管理员更新用户信息,不包含密码等安全信息
  *
  * @return
  */
 @Action(
     value = "UpdateUserTunpwd",
     results = {@Result(name = "json", type = "json")})
 public String UpdateUserTunpwd() {
   this.CheckLogin();
   if (!this.isSlogin()) {
     UserT user = new UserT();
     user.setUserid(this.getUserid());
     user.setUsername(this.getUsername().trim());
     user.setEmail(this.getEmail().trim());
     user.setPoints(Double.parseDouble(this.getPoints().trim()));
     user.setUserstate(this.getUserstate());
     user.setGrade(this.getGrade());
     user.setGradename(this.getGradename());
     user.setState(this.getState());
     if (this.getGrade().equals("0")) {
       user.setGradetime(null);
     } else {
       user.setGradetime(BaseTools.systemtime());
     }
     if (this.getUsertService().updateUserTunpwd(user) > 0) {
       this.setSucflag(true);
       return "json";
     }
   }
   this.setSucflag(false);
   return "json";
 }
示例#9
0
 /**
  * 管理员增加用户
  *
  * @return
  */
 @Action(
     value = "adminregister",
     results = {@Result(name = "json", type = "json")})
 public String adminregister() {
   MD5Code md5 = new MD5Code();
   UserT u = new UserT();
   u.setUsername(this.getUsername().trim());
   u.setEmail(this.getEmail().trim());
   u = this.getUsertService().checkUserByUsername(u);
   if (u != null) {
     this.setMsg("4"); // 表示用户已经存在
     return "json";
   } else {
     u = new UserT();
     u.setUsername(this.getUsername().trim());
     u.setEmail(this.getEmail().trim());
     u = this.getUsertService().checkUserByEmail(u);
     if (u != null) {
       this.setMsg("5"); // 表示用户邮箱存在
       return "json";
     }
     UserT user = new UserT();
     user.setUserid(this.getSerial().Serialid(Serial.USER));
     user.setUid(md5.getMD5ofStr(user.getUserid()));
     user.setUsername(this.getUsername().trim());
     user.setRealname(null);
     user.setEmail(this.getEmail().trim());
     user.setTelno(null);
     user.setMobile(null);
     user.setQuestion(null);
     user.setAnswer(null);
     user.setPassword(md5.getMD5ofStr("111111")); // 默认密码6个1
     user.setUserstate(this.getUserstate());
     user.setPoints(Double.parseDouble(this.getPoints().trim()));
     user.setPostingcount(0);
     user.setSex(null);
     user.setRegisttime(BaseTools.systemtime());
     user.setDisablebegin(null);
     user.setDisableend(null);
     user.setSection(null);
     user.setPosition(null);
     user.setGroupid(null);
     user.setParttime1(null);
     user.setParttime2(null);
     user.setParttime3(null);
     user.setParttime4(null);
     user.setParttime5(null);
     user.setParttime6(null);
     user.setHobby(null);
     user.setQq(null);
     user.setMsn(null);
     user.setOthercontract(null);
     user.setAddress(null);
     user.setPostcode(null);
     user.setBirthday(null);
     user.setGrade(this.getGrade());
     user.setGradename(this.getGradename().trim());
     if (this.getGrade().equals("0")) {
       user.setGradetime(null);
     } else {
       user.setGradetime(BaseTools.systemtime());
     }
     user.setState(this.getState());
     user.setRolemid("0");
     user.setRolemname("");
     if (this.getUsertService().save(user) > 0) {
       // 重新获取后台登录时保存的加密session key
       this.setParam(
           ActionContext.getContext().getSession().get(BaseTools.BACK_SESSION_KEY).toString());
       this.setSucflag(true);
       return "json";
     }
     this.setSucflag(false);
     return "json";
   }
 }
示例#10
0
 /**
  * 查询所有用户
  *
  * @return
  */
 @SuppressWarnings("unchecked")
 @Action(
     value = "findAllUsert",
     results = {@Result(name = "json", type = "json")})
 public String findAllUsert() {
   int currentPage = page;
   int lineSize = rp;
   String queryString = "from UserT order by " + sortname + " " + sortorder + " ";
   if (Validate.StrNotNull(sortname) && Validate.StrNotNull(sortorder)) {
     List<UserT> list = this.getUsertService().sortAllUsert(currentPage, lineSize, queryString);
     if (list != null) {
       total = this.getUsertService().countfindAllUsert();
       rows.clear();
       for (Iterator it = list.iterator(); it.hasNext(); ) {
         UserT u = (UserT) it.next();
         if ("0".equals(u.getSex())) {
           u.setSex("女");
         }
         if ("1".equals(u.getSex())) {
           u.setSex("男");
         }
         if ("1".equals(u.getState())) {
           u.setState("普通用户");
         }
         if ("2".equals(u.getState())) {
           u.setState("管理员");
         }
         if ("3".equals(u.getState())) {
           u.setState("超级管理员");
         }
         if ("4".equals(u.getState())) {
           u.setState("手机用户");
         }
         if ("0".equals(u.getUserstate())) {
           u.setUserstate("未激活");
         }
         if ("1".equals(u.getUserstate())) {
           u.setUserstate("激活");
         }
         if ("2".equals(u.getUserstate())) {
           u.setUserstate("禁止访问");
         }
         if ("3".equals(u.getUserstate())) {
           u.setUserstate("禁止发帖");
         }
         if (u.getGradetime() != null) {
           this.setGradetime(BaseTools.formateDbDate(u.getGradetime()));
         } else {
           this.setGradetime("");
         }
         Map cellMap = new HashMap();
         cellMap.put("id", u.getUserid());
         cellMap.put(
             "cell",
             new Object[] {
               u.getUsername(),
               u.getRealname(),
               u.getEmail(),
               u.getSex(),
               u.getPoints(),
               u.getQq(),
               u.getMsn(),
               u.getGradename(),
               u.getUserstate(),
               u.getGradetime(),
               BaseTools.formateDbDate(u.getRegisttime())
             });
         rows.add(cellMap);
       }
       return "json";
     }
   }
   this.setTotal(0);
   rows.clear();
   return "json";
 }