Exemplo n.º 1
0
  /** 新增附属庄户 */
  @Override
  public boolean addNewSubAccount(SubAccountBean subAccountBean, HttpSession session) {
    String userId = (String) session.getAttribute(Constant.USER_ID);
    SubAccount sub_account = new SubAccount();
    BeanUtils.copyProperties(subAccountBean, sub_account);
    sub_account.setUsername(
        subAccountBean.getHostAccountName().trim() + "-" + subAccountBean.getUsername());
    sub_account.setPassword(Encrypt.MD5(subAccountBean.getPassword()));
    sub_account.setId(IdCreator.createSubAccountId());
    sub_account.setHostAccountId(userId);
    sub_account.setRelDate(new Date());
    sub_account.setStatus("正常");
    subAccountDao.save(sub_account);

    // 保存userinfo表
    Userinfo userInfo = new Userinfo();
    userInfo.setUsername(
        subAccountBean.getHostAccountName().trim() + "-" + subAccountBean.getUsername());
    // userInfo.setPhone(phone);
    userInfo.setId(sub_account.getId());
    userInfo.setPassword(Encrypt.MD5(subAccountBean.getPassword())); // 未加密
    userInfo.setStatus("未验证");
    userInfo.setEmailStatus("未绑定");
    userInfo.setPhoneStatus("已绑定");
    userInfo.setSecurityQuestionStatus("未设置");
    // userInfo.setPrivilege(privilege);
    userInfo.setStatus("未验证");
    userInfo.setUserKind(3); // 默认作为企业用户
    userInfo.setHeadIcon("未设置"); // add by RussWest0 at 2015年6月2日,下午11:56:49
    userinfoDao.save(userInfo); // 保存实体
    return true;
  }
Exemplo n.º 2
0
  /** 新增常用地址 */
  @Override
  public boolean insertAddress(HttpSession session, Address address) {

    String userId = (String) session.getAttribute(Constant.USER_ID);
    address.setId(IdCreator.createAddressId());
    address.setRelDate(new Date());
    address.setClientId(userId);
    addressDao.save(address);
    return true;
  }