Sfoglia il codice sorgente

调用 AccountQuery#getUserIdLong 方法

reghao 10 mesi fa
parent
commit
fe182bb6ae
14 ha cambiato i file con 38 aggiunte e 29 eliminazioni
  1. 1 1
      account/account-service/src/main/java/cn/reghao/tnb/account/app/controller/AccountResourceController.java
  2. 2 2
      content/content-service/src/main/java/cn/reghao/tnb/content/app/chat/service/ChatRecordService.java
  3. 1 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/controller/ImageQueryController.java
  4. 1 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mobile/service/AndroidService.java
  5. 1 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/controller/ContentController.java
  6. 1 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/controller/VideoQueryController.java
  7. 0 11
      content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/VideoPost.java
  8. 20 0
      content/content-service/src/test/java/cn/reghao/tnb/content/app/vod/service/VideoPostTest.java
  9. 1 1
      user/user-service/src/main/java/cn/reghao/tnb/user/app/controller/UserProfileController.java
  10. 5 5
      user/user-service/src/main/java/cn/reghao/tnb/user/app/controller/UserRelationController.java
  11. 1 1
      user/user-service/src/main/java/cn/reghao/tnb/user/app/rpc/UserServiceImpl.java
  12. 2 2
      user/user-service/src/main/java/cn/reghao/tnb/user/app/service/ContactService.java
  13. 1 1
      user/user-service/src/main/java/cn/reghao/tnb/user/app/service/CrawledUserService.java
  14. 1 1
      user/user-service/src/main/java/cn/reghao/tnb/user/app/service/UserProfileService.java

+ 1 - 1
account/account-service/src/main/java/cn/reghao/tnb/account/app/controller/AccountResourceController.java

@@ -43,7 +43,7 @@ public class AccountResourceController {
             AccountInfo accountInfo = getAccountInfo(principal);
             if (accountInfo != null) {
                 String userIdStr = accountInfo.getUserId();
-                long userId = accountQuery.getUserId(userIdStr);
+                long userId = accountQuery.getUserIdLong(userIdStr);
                 OAuthAccountInfo oAuthAccountInfo = new OAuthAccountInfo(userId, accountInfo.getScreenName());
                 return WebResult.success(oAuthAccountInfo);
             }

+ 2 - 2
content/content-service/src/main/java/cn/reghao/tnb/content/app/chat/service/ChatRecordService.java

@@ -52,7 +52,7 @@ public class ChatRecordService {
         List<ChatRecordGetRet> list = chatRecordMapper.findChatRecordGetRet(receiverId, loginUser, recordId, limit);
         list.forEach(chatRecordGetRet -> {
             try {
-                long userId1 = accountQuery.getUserId(chatRecordGetRet.getUserId());
+                long userId1 = accountQuery.getUserIdLong(chatRecordGetRet.getUserId());
                 UserInfo userInfo = contactService.getUserInfo(userId1);
                 if (userInfo != null) {
                     chatRecordGetRet.setNickname(userInfo.getScreenName());
@@ -117,7 +117,7 @@ public class ChatRecordService {
         List<ChatRecordGetRet> list =
                 chatRecordMapper.findChatRecordGetRetByMsgType(msgType, receiverId, loginUser, recordId, limit);
         list.forEach(chatRecordGetRet -> {
-            long userId = accountQuery.getUserId(chatRecordGetRet.getUserId());
+            long userId = accountQuery.getUserIdLong(chatRecordGetRet.getUserId());
             ContactDetail contactDetail = contactService.getContactDetail(userId);
             chatRecordGetRet.setNickname(contactDetail.getScreenName());
             chatRecordGetRet.setAvatar(contactDetail.getAvatarUrl());

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/controller/ImageQueryController.java

@@ -32,7 +32,7 @@ public class ImageQueryController {
     @ApiOperation(value = "获取用户的图片稿件列表", notes = "N")
     @GetMapping(value = "/user", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getUserImageAlbum(@RequestParam("userId") String userId, @RequestParam("page") int page) {
-        long userId1 = accountQuery.getUserId(userId);
+        long userId1 = accountQuery.getUserIdLong(userId);
         PageList<AlbumCard> pageList = imagePostService.getUserAlbums(userId1, page);
         return WebResult.success(pageList);
     }

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/mobile/service/AndroidService.java

@@ -122,7 +122,7 @@ public class AndroidService {
         List<String> tags = videoTagMapper.findVideoTags(videoId);
         videoDetail.setTags(tags);
         String publishByStr = videoDetail.getUserId();
-        long publishBy = accountQuery.getUserId(publishByStr);
+        long publishBy = accountQuery.getUserIdLong(publishByStr);
         UserCard userCard = userService.getUserAvatar(publishBy);
 
         VideoDetails videoDetails = new VideoDetails(videoDetail, userCard);

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/controller/ContentController.java

@@ -43,7 +43,7 @@ public class ContentController {
     @ApiOperation(value = "获取用户内容数据", notes = "N")
     @GetMapping(value = "/userdata", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getUserContentData(@RequestParam("userId") String userId) {
-        long userId1 = accountQuery.getUserId(userId);
+        long userId1 = accountQuery.getUserIdLong(userId);
         UserContentData userContentData = contentService.getUserContentData(userId1);
         return WebResult.success(userContentData);
     }

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/controller/VideoQueryController.java

@@ -60,7 +60,7 @@ public class VideoQueryController {
     @ApiOperation(value = "获取某个用户发布的视频", notes = "N")
     @GetMapping(value = "/user", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getUserVideos(@RequestParam("userId") String userId, @RequestParam("page") int page) {
-        long userId1 = accountQuery.getUserId(userId);
+        long userId1 = accountQuery.getUserIdLong(userId);
         PageList<VideoCard> pageList = videoPostQuery.getUserVideos(userId1, page);
         return WebResult.success(pageList);
     }

+ 0 - 11
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/VideoPost.java

@@ -24,17 +24,11 @@ import java.time.LocalDateTime;
 @Data
 public class VideoPost extends BaseObject<Integer> {
     private String videoId;
-    //private String videoFileId;
-    //private Integer channelId;
     private String title;
     private String description;
     private Integer categoryPid;
     private Integer categoryId;
     private int duration;
-    //@Deprecated
-    //private String quality;
-    //@Deprecated
-    //private String codec;
     private Boolean horizontal;
     private String coverUrl;
     private int scope;
@@ -45,15 +39,11 @@ public class VideoPost extends BaseObject<Integer> {
     public VideoPost(String videoId, VideoPublishSbt video, String coverUrl,
                      VideoFile videoInfo, int status, long publishAt) {
         this.videoId = videoId;
-        //this.videoFileId = video.getVideoFileId();
-        //this.channelId = video.getChannelCode();
         this.title = video.getTitle();
         this.description = video.getDescription();
         this.categoryPid = video.getCategoryPid();
         this.categoryId = video.getCategoryId();
         this.duration = videoInfo.getDuration();
-//        this.quality = videoInfo.getQuality();
-//        this.codec = codec;
         this.horizontal = videoInfo.getHorizontal();
         this.coverUrl = coverUrl;
         this.scope = video.getScope();
@@ -65,7 +55,6 @@ public class VideoPost extends BaseObject<Integer> {
     @Deprecated
     public VideoPost(CrawledVideo video, int categoryPid, int categoryId) {
         this.videoId = video.getVideoId();
-        //this.videoFileId = video.getVideoId();
         this.title = video.getTitle();
         this.description = video.getDescription();
         this.categoryPid = categoryPid;

+ 20 - 0
content/content-service/src/test/java/cn/reghao/tnb/content/app/vod/service/VideoPostTest.java

@@ -1,5 +1,6 @@
 package cn.reghao.tnb.content.app.vod.service;
 
+import cn.reghao.jutil.jdk.converter.DateTimeConverter;
 import cn.reghao.tnb.content.api.dto.VideoCard;
 import cn.reghao.tnb.content.app.ContentApplication;
 import cn.reghao.tnb.content.app.vod.db.mapper.*;
@@ -8,6 +9,7 @@ import cn.reghao.tnb.common.db.GroupCount;
 import cn.reghao.tnb.content.app.util.redis.ds.RedisHash;
 import cn.reghao.tnb.content.app.util.redis.ds.RedisSet;
 import cn.reghao.tnb.content.app.util.redis.ds.RedisSortedSet;
+import cn.reghao.tnb.content.app.vod.model.vo.BannerVideoVO;
 import cn.reghao.tnb.content.app.vod.service.rcmd.RedisKeys;
 import cn.reghao.tnb.content.app.vod.service.rcmd.UserInterestBased;
 import lombok.extern.slf4j.Slf4j;
@@ -156,4 +158,22 @@ public class VideoPostTest {
 
         System.out.println();
     }
+
+    @Autowired
+    BannerVideoMapper bannerVideoMapper;
+    @Test
+    public void getBannerVideo() {
+        List<VideoPost> list = videoPostMapper.findAll();
+        long createAt = System.currentTimeMillis();
+        List<BannerVideo> bannerVideoList = list.stream().map(videoPost -> {
+            return new BannerVideo(videoPost, createAt);
+        }).collect(Collectors.toList());
+
+        if (!bannerVideoList.isEmpty()) {
+            bannerVideoMapper.saveAll(bannerVideoList.subList(0, 100));
+        }
+
+        List<BannerVideoVO> list1 =  bannerVideoMapper.findBannerVideos();
+        System.out.println();
+    }
 }

+ 1 - 1
user/user-service/src/main/java/cn/reghao/tnb/user/app/controller/UserProfileController.java

@@ -41,7 +41,7 @@ public class UserProfileController {
     @ApiOperation(value = "获取用户资料", notes = "N")
     @GetMapping(value = "/info", produces = MediaType.APPLICATION_JSON_VALUE)
     public String getUserInfo(@RequestParam("userId") String userId) {
-        long userId1 = accountQuery.getUserId(userId);
+        long userId1 = accountQuery.getUserIdLong(userId);
         UserInfo userInfo = userProfileService.getUserInfo(userId1);
         return WebResult.success(userInfo);
     }

+ 5 - 5
user/user-service/src/main/java/cn/reghao/tnb/user/app/controller/UserRelationController.java

@@ -33,7 +33,7 @@ public class UserRelationController {
     @ApiOperation(value = "关注用户", notes = "N")
     @PostMapping("/follow/{followingId}")
     public String followUser(@PathVariable("followingId") String followingId) {
-        long followingId1 = accountQuery.getUserId(followingId);
+        long followingId1 = accountQuery.getUserIdLong(followingId);
         long loginUser = UserContext.getUser();
         userRelationService.followUser(loginUser, followingId1);
         return WebResult.success();
@@ -43,7 +43,7 @@ public class UserRelationController {
     @ApiOperation(value = "取消关注用户", notes = "N")
     @PostMapping("/unfollow/{followingId}")
     public String unfollowUser(@PathVariable("followingId") String followingId) {
-        long followingId1 = accountQuery.getUserId(followingId);
+        long followingId1 = accountQuery.getUserIdLong(followingId);
         long loginUser = UserContext.getUser();
         userRelationService.unfollowUser(loginUser, followingId1);
         return WebResult.success();
@@ -52,7 +52,7 @@ public class UserRelationController {
     @ApiOperation(value = "检查是否关注了用户", notes = "N")
     @GetMapping("/check/{userId}")
     public String check(@PathVariable("userId") String userId) {
-        long userId1 = accountQuery.getUserId(userId);
+        long userId1 = accountQuery.getUserIdLong(userId);
         long loginUser = UserContext.getUser();
         boolean followed;
         if (loginUser == -1) {
@@ -66,7 +66,7 @@ public class UserRelationController {
     @ApiOperation(value = "获取用户的关注列表", notes = "N")
     @GetMapping("/following/{userId}")
     public String getFollowing(@PathVariable("userId") String userId) {
-        long userId1 = accountQuery.getUserId(userId);
+        long userId1 = accountQuery.getUserIdLong(userId);
         List<UserCard> list = userRelationService.getFollowingCards(userId1);
         return WebResult.success(list);
     }
@@ -74,7 +74,7 @@ public class UserRelationController {
     @ApiOperation(value = "获取用户的粉丝列表", notes = "N")
     @GetMapping("/follower/{userId}")
     public String getFollower(@PathVariable("userId") String userId) {
-        long userId1 = accountQuery.getUserId(userId);
+        long userId1 = accountQuery.getUserIdLong(userId);
         List<UserCard> list = userRelationService.getFollowerCards(userId1);
         return WebResult.success(list);
     }

+ 1 - 1
user/user-service/src/main/java/cn/reghao/tnb/user/app/rpc/UserServiceImpl.java

@@ -53,7 +53,7 @@ public class UserServiceImpl implements UserService {
         return userRelationService.getFollowingCards(userId).stream()
                 .map(userCard -> {
                     String userIdStr = userCard.getUserId();
-                    return accountQuery.getUserId(userIdStr);
+                    return accountQuery.getUserIdLong(userIdStr);
                 })
                 .collect(Collectors.toList());
     }

+ 2 - 2
user/user-service/src/main/java/cn/reghao/tnb/user/app/service/ContactService.java

@@ -45,7 +45,7 @@ public class ContactService {
         AccountInfo accountInfo = accountQuery.getByMobile(mobile);
         if (accountInfo != null) {
             String userIdStr = accountInfo.getUserId();
-            long userId = accountQuery.getUserId(userIdStr);
+            long userId = accountQuery.getUserIdLong(userIdStr);
             UserInfo userInfo = userProfileService.getUserInfo(userId);
             return new SearchContactResult(userInfo);
         }
@@ -56,7 +56,7 @@ public class ContactService {
     public ContactInfoResult getContactInfoResult(long friendId) {
         AccountInfo accountInfo = accountQuery.getAccountInfo(friendId);
         String userIdStr = accountInfo.getUserId();
-        long userId = accountQuery.getUserId(userIdStr);
+        long userId = accountQuery.getUserIdLong(userIdStr);
         UserInfo userInfo = userProfileService.getUserInfo(userId);
         ContactInfoResult contactInfoResult = new ContactInfoResult(userInfo);
 

+ 1 - 1
user/user-service/src/main/java/cn/reghao/tnb/user/app/service/CrawledUserService.java

@@ -26,7 +26,7 @@ public class CrawledUserService {
         AccountInfo accountInfo = accountQuery.getByUsername(username);
         if (accountInfo != null) {
             String userIdStr = accountInfo.getUserId();
-            long userId = accountQuery.getUserId(userIdStr);
+            long userId = accountQuery.getUserIdLong(userIdStr);
             return userId;
         }
 

+ 1 - 1
user/user-service/src/main/java/cn/reghao/tnb/user/app/service/UserProfileService.java

@@ -88,7 +88,7 @@ public class UserProfileService {
         return list.stream()
                 .map(accountInfo -> {
                     String userIdStr = accountInfo.getUserId();
-                    long userId = accountQuery.getUserId(userIdStr);
+                    long userId = accountQuery.getUserIdLong(userIdStr);
                     UserProfile userProfile = userProfileMapper.findByUserId(userId);
                     if (userProfile == null) {
                         userProfile = new UserProfile(userId);