Example #1
0
  /**
   * 新会员注册.
   *
   * @param vo
   */
  @Transactional(readOnly = false)
  public Customer register(CustomerVO vo) {
    Date now = new Date();
    // 创建客户信息 和 关联账户信息
    Customer cust = BeanMapper.map(vo, Customer.class);
    cust.setCreateTime(now);
    cust.setModifyTime(now);
    cust.setStatus(CustStatus.NORMAL);
    cust.setCredit(0);
    cust.setCustLevel(custLevelDao.findOne("VIP1"));
    cust.setCertStatus(Constants.CertStatus.NULL);

    // 创建客户账户
    Account account = createAccount(cust);
    cust.setAccount(account);
    getDao().save(cust);

    // 创建用户信息
    createUser(vo, cust);

    // 奖励
    //		updateCredit(cust);

    return cust;
  }
Example #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);
  }
Example #3
0
  /**
   * 创建组织机构.
   *
   * @param vo
   */
  @Transactional(readOnly = false)
  public Customer createOrganization(CustomerVO vo) {
    Date now = new Date();
    // 创建客户信息
    Customer org = BeanMapper.map(vo, Customer.class);
    org.setCreateBy(UserContext.getSystemUser().getId());
    org.setCreateTime(now);
    org.setModifyBy(org.getCreateBy());
    org.setModifyTime(now);

    org.setCredit(0);
    org.setStatus(CustStatus.NORMAL);
    org.setCustType(CustType.CUST_ORG);
    org.setCustProperty(CustProperty.CUST_C);

    getDao().save(org);

    // 创建登录账号
    createUser(vo, org);

    return org;
  }