/** * 新会员注册. * * @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; }
/** * 创建组织机构. * * @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; }