user.setEmail(email);
user.setSex(Integer.parseInt(sex));
user.setMobile(mobile);
user.setTruename(truename);
userCardService.updateUser(user);
return new ModelAndView(new RedirectView("../page/management/member/list_member.jsp"));
}
long orid = 0;
long type = 0l;
if(rtUser!=null){
type = rtUser.getUsertype();
if(type==2){
Merchant or = (Merchant)userOrganizationMerchantService.getOrganizationOrMerchantByUser(rtUser);
if(or!=null){
orid = or.getID();
}
}
if(type==3){
Organization or = (Organization)userOrganizationMerchantService.getOrganizationOrMerchantByUser(rtUser);
if(or!=null){
orid = or.getID();
}
}
}
if(orid!=0){
User user = new User();
user.setEmail(email);
user.setOpener(rtUser);
user.setRegistertime(new Date());
user.setLastlogin(new Date());
user.setUsername(mobile);
user.setPassword(password);
user.setTruename(truename);
user.setSex(Integer.parseInt(sex));
user.setMobile(mobile);
user.setUsertype(User.USER_TYPE_NORMAL);
user.setParenttype(type);
user.setOrganizationid(orid);
user.setEnabled(true);
user.setLocked(false);
user.setCardEnd("0");
user.setCardStart("0");
user.setCurMaxCard("0");
// userCardService.createUser(user);
// User ru = userDao.findUserById(rtUser.getId());
// String cardStart = ru.getCardStart();
// String cardCur = ru.getCurMaxCard();
// if("0".equals(cardCur))
// {
// cardCur = cardStart;
// }else
// {
// cardCur = Long.parseLong(cardCur)+1l+"";
// }
Card card = cardDao.findCard(cardid);
if(card == null )card = cardDao.createCard(cardid);
userCardService.createUser(user,card);
// ru.setCurMaxCard(cardCur);
// userCardService.updateUser(ru);
//当开卡成功后发短信到手机
//尊敬的会员您的乐共享登录名13036780222,卡/号818800010022密/码abc123,请登录www.lgx8.com【乐共享】
String content = "尊敬的会员您的乐共享登录名"+user.getUsername()+",卡/号"+user.getCard().getId()+"密/码"+password+",请登录www.lgx8.com";
SendSms.sendSms(user.getMobile(), content);
}
return new ModelAndView(new RedirectView("../page/management/member/list_member.jsp"));
}