Esempio n. 1
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);
  }
Esempio n. 2
0
  /**
   * 修改组织机构
   *
   * @param customer
   */
  @Transactional(readOnly = false)
  public void updateOrganization(CustomerVO vo) {
    Customer customer = customerDao.findOne(vo.getId());
    customer.setMobPhone(vo.getLoginName());
    customer.setName(vo.getName());
    customer.setOrgSummary(vo.getOrgSummary());
    customer.setOrgType(vo.getOrgType());
    Date now = new Date();
    customer.setModifyBy(UserContext.getCurrent().getId());
    customer.setModifyTime(now);
    save(customer);

    User user = userDao.findByCustomerId(customer.getId());
    user.setLoginName(vo.getLoginName());
    user.setNickname(customer.getName());
    String[] hash = Encrypts.hashPassword(vo.getLoginName());
    user.setPassword(hash[0]);
    user.setSalt(hash[1]);
    userDao.save(user);
  }