main
wangqing 8 months ago
parent 17763e8dfc
commit 9746d3511b

@ -244,8 +244,8 @@ public class CommentController extends BaseController {
UserInfo commentUserInfo = userInfoService.findById(comment.getUserId());
comment.setNickName(commentUserInfo.getNickName());
comment.setAvatar(getAvatar(commentUserInfo));
if(StringUtils.isNotEmpty(comment.getReplyToUserId())){
UserInfo replyToUserInfo = userInfoService.findById(comment.getReplyToUserId());
@ -253,6 +253,9 @@ public class CommentController extends BaseController {
}
CommentResp commentResp = new CommentResp();
BeanUtils.copyProperties(comment,commentResp);
if (null != commentUserInfo) {
comment.setNickName(commentUserInfo.getNickName());
comment.setAvatar(getAvatar(commentUserInfo));
if (StringUtils.isNotEmpty(commentUserInfo.getBadges())){
Set<Integer> badgeSet = new HashSet<>();
Arrays.stream(commentUserInfo.getBadges().split(",")).forEach(b->{
@ -261,12 +264,17 @@ public class CommentController extends BaseController {
});
commentResp.setBadgeList(new ArrayList<>(badgeSet));
}
}
if(comment.getCommentCount()>0){
Comment topComment = commentService.findByParentId(comment.get_id(),1,1).getContent().get(0);
UserInfo topCommentUserInfo = userInfoService.findById(topComment.getUserId());
if(null != topCommentUserInfo) {
topComment.setNickName(topCommentUserInfo.getNickName());
topComment.setAvatar(getAvatar(topCommentUserInfo));
}
if(StringUtils.isNotEmpty(topComment.getReplyToUserId())){
UserInfo topReplyUserInfo = userInfoService.findById(topComment.getReplyToUserId());
topComment.setReplyToNickname(topReplyUserInfo.getNickName());

@ -40,7 +40,8 @@ public class Constants {
public static final String TOKEN_ROLE_ADMIN_USER = "admin";
// public static final String TOKEN_ROLE_TOURIST="tourist";
public static final String RESOURCE_PREFIX = "http://cdn1.indie.cn:19000/indie/";
// public static final String RESOURCE_PREFIX = "http://cdn1.indie.cn:19000/indie/";
public static final String RESOURCE_PREFIX = "https://cdn2.indie.cn/indie/";
public static final String MUSIC_RESOURCE_PREFIX = RESOURCE_PREFIX + "music/";
public static final String SONG_RESOURCE_PREFIX = RESOURCE_PREFIX + "song/";

@ -78,13 +78,13 @@ public class JournalController {
UserLoginDto user = jwtUtil.getUserLoginDto(authorization);
updateQuery(user,queryReq);
List<JournalRespDTO> pageList=journalService.queryJournalByPage(queryReq);
pageList = pageList.stream().map(journalRespDTO -> randomCDN(journalRespDTO)).collect(Collectors.toList());
// pageList = pageList.stream().map(journalRespDTO -> randomCDN(journalRespDTO)).collect(Collectors.toList());
Set<String> journalCollectSet = getJournalCollectSet(user);
updateCollectStatus(pageList,journalCollectSet);
return Result.success(new PageResult<JournalRespDTO>(Long.valueOf(pageList.size()), pageList));
}
private JournalRespDTO randomCDN(JournalRespDTO journalRespDTO) {
private JournalRespDTO randomCDN1(JournalRespDTO journalRespDTO) {
// Random random = new Random();
// int randomNum = random.nextInt(2)+1;
@ -145,7 +145,7 @@ public class JournalController {
Set<String> journalCollectSet = getMyCollectSet(user.getUserId(),queryReq.getUserId(),objectIds);
List<JournalRespDTO> list = pageList.stream().map(a -> JournalMapper.getJournalRespDTO(a, journalCollectSet))
.collect(Collectors.toList());
list = list.stream().map(journalRespDTO -> randomCDN(journalRespDTO)).collect(Collectors.toList());
// list = list.stream().map(journalRespDTO -> randomCDN(journalRespDTO)).collect(Collectors.toList());
return Result.success(new PageResult<JournalRespDTO>(Long.valueOf(list.size()), list));
}
@ -237,7 +237,7 @@ public class JournalController {
boolean isCollect=null == user ? false:userCollectInfoService.isCollect(user.getUserId(),id, CollectTypeEnum.JOURNAL);
journalRespDTO.setHaveCollect(isCollect);
journalRespDTO = randomCDN(journalRespDTO);
// journalRespDTO = randomCDN(journalRespDTO);
return Result.success(journalRespDTO);
}
@ -257,7 +257,7 @@ public class JournalController {
}
boolean isCollect=null == user ? false:userCollectInfoService.isCollect(user.getUserId(),journalRespDTO.getId(), CollectTypeEnum.JOURNAL);
journalRespDTO.setHaveCollect(isCollect);
journalRespDTO = randomCDN(journalRespDTO);
// journalRespDTO = randomCDN(journalRespDTO);
return Result.success(journalRespDTO);
}
private boolean isLatest10(String journalNo) {
@ -289,7 +289,7 @@ public class JournalController {
: userCollectInfoService.getCollectSet(user.getUserId(),ids, CollectTypeEnum.JOURNAL);
List<JournalRespDTO> list = journals.stream().map(a -> JournalMapper.getJournalRespDTO(a, journalCollectSet))
.collect(Collectors.toList());
list = list.stream().map(journalRespDTO -> randomCDN(journalRespDTO)).collect(Collectors.toList());
// list = list.stream().map(journalRespDTO -> randomCDN(journalRespDTO)).collect(Collectors.toList());
return Result.success(list);
}

@ -69,14 +69,14 @@ public class SongController {
return Result.unauthorized(null);
}
List<SongRespDTO> results = journalSongService.findByJournalNo(journalNo);
results = results.stream().map(songRespDTO -> randomCDN(songRespDTO)).collect(Collectors.toList());
// results = results.stream().map(songRespDTO -> randomCDN(songRespDTO)).collect(Collectors.toList());
Set<String> songCollectSet = getSongCollectSet(results,user);
updateCollectStatus(results,songCollectSet);
return Result.success(results);
}
private SongRespDTO randomCDN(SongRespDTO s){
private SongRespDTO randomCDN1(SongRespDTO s){
Random random = new Random();
int rate = random.nextInt(100);
// int randomNum = random.nextInt(2)+1;
@ -103,7 +103,7 @@ public class SongController {
@GlobalInterceptor
public Result<List<SongRespDTO>> getByJournalId(@PathVariable String journalId) {
List<SongRespDTO> list = journalSongService.findByJournalId(journalId);
list = list.stream().map(songRespDTO -> randomCDN(songRespDTO)).collect(Collectors.toList());
// list = list.stream().map(songRespDTO -> randomCDN(songRespDTO)).collect(Collectors.toList());
return Result.success(list);
}
@ -144,7 +144,7 @@ public class SongController {
Set<String> songCollectSet = getMyCollectSet(loginUserId,queryUserId,objectIds,isJouranlSource);
List<SongRespDTO> results = songs.stream().map(s -> SongMapper.getSongRespDTO(s, songCollectSet))
.collect(Collectors.toList());
results = results.stream().map(songRespDTO -> randomCDN(songRespDTO)).collect(Collectors.toList());
// results = results.stream().map(songRespDTO -> randomCDN(songRespDTO)).collect(Collectors.toList());
return Result.success(new PageResult<SongRespDTO>(Long.valueOf(results.size()), results));
}
@ -182,7 +182,7 @@ public class SongController {
List<SongRespDTO> results = songs.stream().map(s -> SongMapper.getSongRespDTO(s, songCollectSet))
.collect(Collectors.toList());
results = results.stream().map(songRespDTO -> randomCDN(songRespDTO)).collect(Collectors.toList());
// results = results.stream().map(songRespDTO -> randomCDN(songRespDTO)).collect(Collectors.toList());
return Result.success(results);
}
@ -199,7 +199,7 @@ public class SongController {
SongRespDTO songRespDTO=SongMapper.getSongRespDTO(song);
boolean isCollect=null == user ? false:userCollectInfoService.isCollect(user.getUserId(),id, CollectTypeEnum.SONG);
songRespDTO.setHaveCollect(isCollect);
songRespDTO = randomCDN(songRespDTO);
// songRespDTO = randomCDN(songRespDTO);
return Result.success(songRespDTO);
}
}

@ -45,8 +45,8 @@ public class ArticleRespDTO implements Serializable {
@ApiModelProperty(value = "是否允许评论 否0 是1")
private String allowCommit;
@ApiModelProperty(value = "是否自动推送 否:false 是true")
private Boolean autoPush;
@ApiModelProperty(value = "是否自动推送 否:0 是1")
private String autoPush;
@ApiModelProperty(value = "总评论数,大于99显示99+")
private Long totalCommentReply;
@ -74,7 +74,7 @@ public class ArticleRespDTO implements Serializable {
response.setIsScheduled(article.getIsScheduled());
response.setPubTime(article.getPubTime().format(DateTimeFormatter.ISO_DATE_TIME));
response.setAllowCommit(article.getAllowCommit());
response.setAutoPush("1".equals(article.getAutoPush())?true:false);
response.setAutoPush(article.getAutoPush());
return response;
}

@ -13,16 +13,21 @@ public class Constants {
public static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 期刊封面前缀
public static final String MUSIC_RESOURCE_PREFIX="http://cdn1.indie.cn:19000/indie/music/";
// public static final String MUSIC_RESOURCE_PREFIX="http://cdn1.indie.cn:19000/indie/music/";
public static final String MUSIC_RESOURCE_PREFIX="https://cdn2.indie.cn/indie/music/";
// 歌曲文件、封面、歌词前缀
public static final String SONG_RESOURCE_PREFIX="http://cdn1.indie.cn:19000/indie/song/";
public static final String ARTICLE_RESOURCE_PREFIX="http://cdn1.indie.cn:19000/indie/article/";
// public static final String SONG_RESOURCE_PREFIX="http://cdn1.indie.cn:19000/indie/song/";
public static final String SONG_RESOURCE_PREFIX="https://cdn2.indie.cn/indie/song/";
// public static final String ARTICLE_RESOURCE_PREFIX="http://cdn1.indie.cn:19000/indie/article/";
public static final String ARTICLE_RESOURCE_PREFIX="https://cdn2.indie.cn/indie/article/";
public static final String Advertisement_RESOURCE_PREFIX="http://cdn1.indie.cn:19000/indie/ad/";
// public static final String Advertisement_RESOURCE_PREFIX="http://cdn1.indie.cn:19000/indie/ad/";
public static final String Advertisement_RESOURCE_PREFIX="https://cdn2.indie.cn/indie/ad/";
public static final String BUCKET = "indie";
public static final String RESOURCE_PREFIX="http://cdn1.indie.cn:19000/indie/";
// public static final String RESOURCE_PREFIX="http://cdn1.indie.cn:19000/indie/";
public static final String RESOURCE_PREFIX="https://cdn2.indie.cn/indie/";
public static final String MUSIC_KEY_PREFIX = "music/";
public static final String SONG_KEY_PREFIX = "song/";
public static final String TEMP_KEY_PREFIX = "temp/";

Loading…
Cancel
Save