|
|
@@ -71,6 +71,8 @@ public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
|
|
|
|
|
|
private final LifeFansMapper lifeFansMapper;
|
|
|
|
|
|
+ private final LifeUserDynamicsMapper lifeUserDynamicsMapper;
|
|
|
+
|
|
|
private final BaseRedisService baseRedisService;
|
|
|
|
|
|
private final LifeNoticeMapper lifeNoticeMapper;
|
|
|
@@ -444,7 +446,32 @@ public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
|
|
|
public LifeUser getUserByPhone(String phoneNum) {
|
|
|
LambdaQueryWrapper<LifeUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapper.eq(LifeUser::getUserPhone, phoneNum);
|
|
|
- return this.getOne(lambdaQueryWrapper);
|
|
|
+ LifeUser user = this.getOne(lambdaQueryWrapper);
|
|
|
+ if (user != null) {
|
|
|
+ String userId = "user_" + phoneNum;
|
|
|
+ LambdaQueryWrapper<LifeFans> followWrapper = new LambdaQueryWrapper<>();
|
|
|
+ followWrapper.eq(LifeFans::getFansId, userId);
|
|
|
+ long followCount = lifeFansMapper.selectCount(followWrapper);
|
|
|
+ user.setFollowCount((int) followCount);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<LifeFans> fansWrapper = new LambdaQueryWrapper<>();
|
|
|
+ fansWrapper.eq(LifeFans::getFollowedId, userId);
|
|
|
+ long fansCount = lifeFansMapper.selectCount(fansWrapper);
|
|
|
+ user.setFansCount((int) fansCount);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<LifeUserDynamics> dynamicsWrapper = new LambdaQueryWrapper<>();
|
|
|
+ dynamicsWrapper.eq(LifeUserDynamics::getPhoneId, userId)
|
|
|
+ .eq(LifeUserDynamics::getDeleteFlag, 0);
|
|
|
+ List<LifeUserDynamics> dynamicsList = lifeUserDynamicsMapper.selectList(dynamicsWrapper);
|
|
|
+ long likeCount = 0L;
|
|
|
+ if (dynamicsList != null && !dynamicsList.isEmpty()) {
|
|
|
+ likeCount = dynamicsList.stream()
|
|
|
+ .mapToLong(d -> d.getDianzanCount() != null ? d.getDianzanCount() : 0)
|
|
|
+ .sum();
|
|
|
+ }
|
|
|
+ user.setLikeCount((int) likeCount);
|
|
|
+ }
|
|
|
+ return user;
|
|
|
}
|
|
|
|
|
|
public void liftCancelAccount(LifeUser user) {
|