download
This commit is contained in:
parent
b5bd70e0df
commit
167e16fb0b
@ -118,13 +118,18 @@ public abstract class AbstractMusicService<Q extends AbstractMusicReq, S extends
|
|||||||
if (CollectionUtils.isEmpty(idList)) {
|
if (CollectionUtils.isEmpty(idList)) {
|
||||||
throw new BusinessException("请选择下载内容");
|
throw new BusinessException("请选择下载内容");
|
||||||
}
|
}
|
||||||
if (!ADMIN_ID_LIST.contains(userId) && idList.size() > 100) {
|
if (!ADMIN_ID_LIST.contains(userId) && idList.size() > 10) {
|
||||||
throw new BusinessException("单次下载限制最多100首");
|
throw new BusinessException("单次下载限制最多10首");
|
||||||
}
|
}
|
||||||
ChannelEnum channelEnum = getChannelEnum();
|
ChannelEnum channelEnum = getChannelEnum();
|
||||||
ChannelClient<Q, S> channelClient = channelClientFactory.getClient(channelEnum);
|
ChannelClient<Q, S> channelClient = channelClientFactory.getClient(channelEnum);
|
||||||
String batchNo = UUID.randomUUID().toString();
|
String batchNo = UUID.randomUUID().toString();
|
||||||
idList.forEach(id -> {
|
idList.parallelStream().forEach(id -> {
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error(">>>>>>>>>>download error:{}<<<<<<<<<<", e.getMessage(), e);
|
||||||
|
}
|
||||||
MusicRecordEntity entity = channelClient.queryByPlatform(id);
|
MusicRecordEntity entity = channelClient.queryByPlatform(id);
|
||||||
if (Objects.nonNull(entity)) {
|
if (Objects.nonNull(entity)) {
|
||||||
channelClient.saveDownloadRecord(userId, batchNo, id);
|
channelClient.saveDownloadRecord(userId, batchNo, id);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user