|
|
@@ -2,12 +2,15 @@ package cn.reghao.tnb.user.app.rpc;
|
|
|
|
|
|
import cn.reghao.jutil.jdk.db.PageList;
|
|
|
import cn.reghao.tnb.account.api.dto.AccountAvatar;
|
|
|
+import cn.reghao.tnb.account.api.dto.AccountInfo;
|
|
|
import cn.reghao.tnb.account.api.iface.AccountQuery;
|
|
|
import cn.reghao.tnb.content.api.iface.UserContentService;
|
|
|
import cn.reghao.tnb.user.api.dto.UserInfo;
|
|
|
import cn.reghao.tnb.user.api.dto.UserSearch;
|
|
|
import cn.reghao.tnb.user.api.dto.VipPlanInfo;
|
|
|
import cn.reghao.tnb.user.api.iface.AdminUserService;
|
|
|
+import cn.reghao.tnb.user.app.db.mapper.UserProfileMapper;
|
|
|
+import cn.reghao.tnb.user.app.model.po.UserProfile;
|
|
|
import cn.reghao.tnb.user.app.model.po.VipPlan;
|
|
|
import cn.reghao.tnb.user.app.service.UserVipService;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
@@ -29,9 +32,12 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|
|
@DubboReference(check = false, retries = 0, timeout = 30_000)
|
|
|
private UserContentService userContentService;
|
|
|
private final UserVipService userVipService;
|
|
|
+ private final UserProfileMapper userProfileMapper;
|
|
|
+ private int pageSize = 100;
|
|
|
|
|
|
- public AdminUserServiceImpl(UserVipService userVipService) {
|
|
|
+ public AdminUserServiceImpl(UserVipService userVipService, UserProfileMapper userProfileMapper) {
|
|
|
this.userVipService = userVipService;
|
|
|
+ this.userProfileMapper = userProfileMapper;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -39,6 +45,36 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|
|
return PageList.empty();
|
|
|
}
|
|
|
|
|
|
+ public PageList<UserInfo> getUserList(int nextId) {
|
|
|
+ int total = userProfileMapper.countAll();
|
|
|
+ List<UserProfile> userProfileList = userProfileMapper.findAllById(pageSize, nextId);
|
|
|
+ List<UserInfo> list = userProfileList.stream().map(this::getUserInfo).collect(Collectors.toList());
|
|
|
+ if (!userProfileList.isEmpty()) {
|
|
|
+ nextId = userProfileList.get(userProfileList.size()-1).getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ return PageList.pageList(""+nextId, list);
|
|
|
+ }
|
|
|
+
|
|
|
+ private UserInfo getUserInfo(UserProfile userProfile) {
|
|
|
+ long userId = userProfile.getUserId();
|
|
|
+ AccountInfo accountInfo = accountQuery.getAccountInfo(userId);
|
|
|
+ int gender = userProfile.getGender();
|
|
|
+ String signature = userProfile.getSignature();
|
|
|
+ int following = userProfile.getFollowing();
|
|
|
+ int follower = userProfile.getFollower();
|
|
|
+ boolean vip = userVipService.isVip(userId);
|
|
|
+ String userIdStr = accountQuery.getUserIdStr(userId);
|
|
|
+ UserInfo userInfo = new UserInfo(accountInfo, userIdStr, gender, signature, following, follower, vip);
|
|
|
+ String username = accountInfo.getUsername();
|
|
|
+ if (username.startsWith("bilibili_")) {
|
|
|
+ long biliUserId = Long.parseLong(username.replace("bilibili_", ""));
|
|
|
+ userInfo.setBiliUserId(biliUserId);
|
|
|
+ }
|
|
|
+
|
|
|
+ return userInfo;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<AccountAvatar> getPublishUsers(int publishType) {
|
|
|
List<Long> userIds = userContentService.getContentUser(publishType);
|