示例#1
0
 /**
  * 导入广告主
  *
  * @param vo
  * @throws Exception
  */
 public void importAdivertiser(CustomerVO vo) throws Exception {
   if (this.countBy("mobPhone", vo.getMobPhone()) > 0) {
     throw new Exception("手机号码已经存在:" + vo.getMobPhone());
   }
   vo.setCustType(Constants.CustType.CUST_ADV);
   this.register(vo);
 }
示例#2
0
  /** 更新用户信息. */
  @Transactional(readOnly = false)
  public void updateUserInfo(CustomerVO vo, Customer cust) {
    if (!cust.getMobPhone().equals(vo.getMobPhone())) {
      updateLoginName(vo, cust);
      cust.setMobPhone(vo.getMobPhone());
    }
    if (null != vo.getName()) {
      cust.setName(vo.getName());
    }
    cust.setLinkman(vo.getLinkman());
    cust.setEmail(vo.getEmail());
    cust.setQq(vo.getQq());

    getDao().save(cust);
  }
示例#3
0
  private void createUser(CustomerVO vo, Customer cust) {
    User user = new User();
    Date now = new Date();

    user.setLoginName(vo.getLoginName());

    String[] hash = Encrypts.hashPassword(vo.getPassword());
    user.setPassword(hash[0]);
    user.setSalt(hash[1]);

    user.setNickname(getNickname(vo));
    user.setSecMobile(vo.getMobPhone());

    user.setCustomer(cust);
    user.setType(UserType.MEMBER);
    user.setStatus(UserStatus.ENABLED);
    user.setCreateTime(now);

    user.setRole(getUserRole(cust)); // 创建用户角色关系

    userDao.save(user);
  }
示例#4
0
 /** 更新登录名. */
 private void updateLoginName(CustomerVO vo, Customer cust) {
   User user = userDao.findByLoginName(cust.getMobPhone());
   if (user != null) {
     userDao.updateLoginName(vo.getMobPhone(), cust.getMobPhone());
   }
 }
示例#5
0
 private String getNickname(CustomerVO vo) {
   if (StringUtils.isNotBlank(vo.getName())) return vo.getName();
   else return vo.getMobPhone();
 }