| | |
| | | import com.yeshi.buwan.dao.user.LoginUserExtraDao; |
| | | import com.yeshi.buwan.domain.user.LoginUserExtra; |
| | | import com.yeshi.buwan.dto.user.LoginInfoDto; |
| | | import com.yeshi.buwan.dto.user.QQUserInfo; |
| | | import com.yeshi.buwan.exception.user.LoginUserException; |
| | | import com.yeshi.buwan.exception.user.RegisterUserException; |
| | | import com.yeshi.buwan.service.inter.LoginUserService; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | |
| | | import com.yeshi.buwan.dao.user.LoginUserDao; |
| | | import com.yeshi.buwan.dao.UserDao; |
| | | import com.yeshi.buwan.domain.user.LoginUser; |
| | | import com.yeshi.buwan.domain.SystemInfo; |
| | | import com.yeshi.buwan.domain.system.SystemInfo; |
| | | import com.yeshi.buwan.domain.UserData; |
| | | import com.yeshi.buwan.domain.UserInfo; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.yeshi.utils.entity.wx.WeiXinUser; |
| | | |
| | | @Service |
| | | public class UserService { |
| | |
| | | |
| | | @Resource |
| | | private LoginUserExtraDao loginUserExtraDao; |
| | | |
| | | @Resource |
| | | private LoginUserService loginUserService; |
| | | |
| | | |
| | | // 用户操作 |
| | |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | |
| | |
| | | * |
| | | * @param dto |
| | | */ |
| | | public void register(LoginInfoDto dto) throws RegisterUserException { |
| | | public LoginUser register(LoginInfoDto dto) throws RegisterUserException { |
| | | LoginUser loginUser = null; |
| | | LoginUserExtra loginUserExtra = null; |
| | | switch (dto.getLoginType()) { |
| | |
| | | loginUser.setLoginType(LoginUser.LOGIN_TYPE_QQ); |
| | | loginUser.setQqOpenId(dto.getQqUserInfo().getOpenId()); |
| | | loginUser.setName(dto.getQqUserInfo().getName()); |
| | | loginUser.setPortrait(dto.getQqUserInfo().getPortrait()); |
| | | |
| | | |
| | | loginUserExtra = new LoginUserExtra(); |
| | |
| | | loginUser.setWxUnionId(dto.getWeiXinUser().getUnionid()); |
| | | loginUser.setName(dto.getWeiXinUser().getNickname()); |
| | | loginUser.setWxOpenId(dto.getWeiXinUser().getOpenid()); |
| | | loginUser.setPortrait(dto.getWeiXinUser().getHeadimgurl()); |
| | | |
| | | |
| | | loginUserExtra = new LoginUserExtra(); |
| | |
| | | |
| | | loginUserExtra.setId(loginUser.getId()); |
| | | loginUserExtra.setCreateTime(new Date()); |
| | | loginUserExtraDao.save(loginUserExtra); |
| | | loginUserService.initExtra(loginUserExtra); |
| | | |
| | | return loginUser; |
| | | } |
| | | |
| | | public LoginUser getLoginUser(String id) { |
| | |
| | | throw new Exception("账户已被注销"); |
| | | } |
| | | user.setState(LoginUser.STATE_UNREGISTER); |
| | | loginUserDao.update(user); |
| | | loginUserDao.updateSelective(user); |
| | | } |
| | | |
| | | // 邮箱注册 |