/* * (non-Javadoc) * @see com.opensymphony.xwork2.ActionSupport#execute() */ @Override @Action( results = { @Result(name = "success", location = "/WEB-INF/content/success.jsp"), @Result(name = "fail", location = "/WEB-INF/content/register.jsp") }) public String execute() { HttpServletRequest request = ServletActionContext.getRequest(); String ccode = (String) request.getSession().getAttribute(SystemVariables.VALIDATE_CODE); log.debug(">>>from session ccode:" + ccode); if (vcode == null || !ccode.equals(vcode)) { return "fail"; } boolean exist = enterpriseService.exist(email); if (exist) { return "fail"; } Enterprise ent = new Enterprise(); ent.setUserType(userType); ent.setSex(sex == 0); ent.setAccount(email); ent.setEmail(email); ent.setNickname(nickname); ent.setAddress(address); ent.setLinkman(linkman); ent.setName(name); ent.setMobilePhone(mobilePhone); if (userType == Enterprise.USER_TYPE_PERSON) { ent.setName(nickname); } // 拼音 String pinyin = ent.getNamePinyinByName(); String firstPinyin = ent.getNameFirstPinyinByName(); ent.setNamePinyin(pinyin); ent.setNameFirstPinyin(firstPinyin); ent.setPassword(EncryptUtil.md5(password)); enterpriseService.insert(ent); entInfo = new EntInfo(); entInfo.setEnterprise(ent); entInfo.setIndexImgUrl("/member/images/banner1.jpg"); entInfoService.insert(entInfo); enterpriseId = ent.getId(); log.debug(">>>用户注册:" + ent); request.getSession().setAttribute(SystemVariables.ENTERPRISE_USER, ent); request.getSession().setAttribute(SystemVariables.ENTERPRISE_USER_ID, ent.getId()); return SUCCESS; }