use of com.ch999.haha.admin.document.redis.UserInfoBO in project haha by hahafreeasair666.
the class UserComponent method userRegister.
/**
* 用户注册
* @param registerVO
* @return
*/
public Integer userRegister(RegisterVO registerVO) {
if (!registerVO.getPwd1().equals(registerVO.getPwd2())) {
return null;
}
UserInfo userInfo = new UserInfo();
userInfo.setUsername(registerVO.getUserName());
userInfo.setMobile(registerVO.getMobile());
userInfo.setPwd(registerVO.getPwd1());
userInfoService.insert(userInfo);
// 注册的时候就给用户一个初始信用积分
UserInfoBO userInfoBO = new UserInfoBO(userInfo.getId(), userInfo);
userInfoBORepository.save(userInfoBO);
return userInfo.getId();
}
use of com.ch999.haha.admin.document.redis.UserInfoBO in project haha by hahafreeasair666.
the class UserComponent method getLoginUser.
/**
* 获取当前用户信息
*
* @return
*/
public UserInfoBO getLoginUser() {
Integer userId = getUserId();
if (userId == -1) {
return new UserInfoBO();
} else {
UserInfoBO one = userInfoBORepository.findOne(userId);
if (one == null) {
UserInfo userInfo = userInfoService.selectById(userId);
UserInfoBO userInfoBO = new UserInfoBO(userId, userInfo);
userInfoBORepository.save(userInfoBO);
return userInfo != null ? userInfoBO : new UserInfoBO();
} else {
return one;
}
}
}
use of com.ch999.haha.admin.document.redis.UserInfoBO in project haha by hahafreeasair666.
the class UserInfoServiceImpl method getUserCenterInfo.
@Override
public OtherCenterVO getUserCenterInfo(Integer userId, Integer loginUserId) {
OtherCenterVO userCenterVO = new OtherCenterVO();
UserCenterInfoCountVO userInfoCount = getUserInfoCount(userId);
userCenterVO.setUserId(userId);
userCenterVO.setFollows(userInfoCount.getFollow());
userCenterVO.setFans(userInfoCount.getFans());
UserInfoBO one = userInfoBORepository.findOne(userId);
if (one == null) {
return null;
}
userCenterVO.setAvatar(one.getUserInfo().getPicPath());
userCenterVO.setDescription(one.getUserInfo().getAutograph());
userCenterVO.setMyCredit(one.getCreditInfo().get("creditNum") != null ? (int) one.getCreditInfo().get("creditNum") : 0);
userCenterVO.setUserName(one.getUserInfo().getUsername());
// 组装是否已关注信息
if (loginUserId != null) {
Wrapper<UserFans> wrapper = new EntityWrapper<>();
wrapper.eq("userid1", loginUserId);
wrapper.eq("userid2", userId);
if (userFansService.selectCount(wrapper) == 0 && !userId.equals(loginUserId)) {
userCenterVO.setIsCanFollow(true);
} else {
userCenterVO.setIsCanFollow(false);
}
} else {
userCenterVO.setIsCanFollow(true);
}
return userCenterVO;
}
Aggregations