| | |
| | | import com.yeshi.buwan.exception.user.LoginUserException; |
| | | import com.yeshi.buwan.exception.user.RegisterUserException; |
| | | import com.yeshi.buwan.service.inter.LoginUserService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | |
| | | @Resource |
| | | private LoginUserService loginUserService; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | |
| | | // 用户操作 |
| | | public List<UserInfo> getUserList(int system, int page) { |
| | | return userDao.list("from UserInfo u where u.system.id=? order by u.createtime desc", |
| | | (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{system + ""}); |
| | | } |
| | | |
| | | //设置昵称 |
| | | public void setNickName(Long uid, String nickName) { |
| | | LoginUser update = new LoginUser(); |
| | | update.setId(uid + ""); |
| | | update.setName(nickName); |
| | | loginUserDao.updateSelective(update); |
| | | } |
| | | |
| | | // 获取用户数量 |
| | |
| | | } |
| | | |
| | | public void updateLoginUserInfo(LoginUser lu) { |
| | | loginUserDao.update(lu); |
| | | loginUserDao.updateSelective(lu); |
| | | } |
| | | |
| | | public String getUid(String device, String system, String imei, String mac, String lat, String lng) { |
| | |
| | | |
| | | if (loginUser != null) { |
| | | loginUser.setLoginType(dto.getLoginType()); |
| | | loginUserDao.update(loginUser); |
| | | loginUserDao.updateSelective(loginUser); |
| | | } |
| | | |
| | | if (loginUserExtra != null) { |
| | | loginUserExtra.setUtdId(dto.getUtdId()); |
| | | loginUserExtraDao.updateSelective(loginUserExtra); |
| | | } |
| | | |
| | |
| | | |
| | | loginUser = new LoginUser(); |
| | | loginUser.setLoginType(LoginUser.LOGIN_TYPE_PHONE); |
| | | loginUser.setName(null); |
| | | loginUser.setName(dto.getNickName()); |
| | | loginUser.setPhone(dto.getPhone()); |
| | | |
| | | loginUserExtra = new LoginUserExtra(); |
| | |
| | | loginUser.setId(uid + ""); |
| | | |
| | | if (StringUtil.isNullOrEmpty(loginUser.getName())) { |
| | | //TODO 昵称前缀 |
| | | // systemConfigService.getConfigValueByKeyCache(""); |
| | | //设置默认用户昵称 |
| | | String nickName = "无名氏"; |
| | | String nickName = "ID_" + uid; |
| | | LoginUser update = new LoginUser(); |
| | | update.setId(uid + ""); |
| | | update.setName(nickName); |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public LoginUser getValidLoginUserByEmail(String email, String systemId) { |
| | | List<LoginUser> userList = loginUserDao.list("from LoginUser lu where lu.systemId=? and lu.email=? and lu.state=?", systemId, email, LoginUser.STATE_NORMAL); |
| | | if(userList!=null&&userList.size()>0){ |
| | | return userList.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 用户注销 |
| | | * |
| | |
| | | throw new Exception("账户已被注销"); |
| | | } |
| | | user.setState(LoginUser.STATE_UNREGISTER); |
| | | loginUserDao.update(user); |
| | | loginUserDao.updateSelective(user); |
| | | } |
| | | |
| | | // 邮箱注册 |