main
JH 10 months ago
parent d614fca533
commit 7b10eb03df

@ -23,7 +23,7 @@ public class JournalAddModel {
private String title;
@ApiModelProperty(value = "关联标签标签ID")
private List<String> tags;
private List<String> tag;
@ApiModelProperty(value = "发布人ID")
private String userId;

@ -12,11 +12,9 @@ import com.luoo.music.response.cms.SongVO;
import com.luoo.music.util.Constants;
import dto.UserLoginDto;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -234,7 +232,7 @@ public class CMSJournalService {
String image = param.getImage();
String suffix = image.substring(image.lastIndexOf(Constants.DOT));
String destKeySuffix = String.format("%05d/00%s", Integer.parseInt(param.getJournalNo()), suffix);
String destKey = Constants.MUSIC_RESOURCE_PREFIX + destKeySuffix;
String destKey = Constants.MUSIC_KEY_PREFIX + destKeySuffix;
int copy = s3Service.copy(Constants.BUCKET, srcKey, destKey);
if (copy > 0) {
return destKeySuffix;
@ -273,9 +271,9 @@ public class CMSJournalService {
*/
private void batchSaveJournalRelatesInfo(String journalId, JournalAddModel param) {
// 标签信息
if (!CollectionUtils.isEmpty(param.getTags())) {
if (!CollectionUtils.isEmpty(param.getTag())) {
List<JournalTag> journalTagList = new ArrayList<>();
for (String item : param.getTags()) {
for (String item : param.getTag()) {
JournalTag journalTag = new JournalTag();
journalTag.setId(String.valueOf(idWorker.nextId()));
journalTag.setJournalId(journalId);
@ -292,16 +290,18 @@ public class CMSJournalService {
int num = 0;
for (String item : param.getSongs()) {
if (idSongMap.containsKey(item)) {
num += 1;
SongInfo song = idSongMap.get(item);
JournalSong journalSong = new JournalSong();
journalSong.setId(String.valueOf(idWorker.nextId()));
journalSong.setName(song.getName());
journalSong.setAlbum(song.getAlbum());
journalSong.setArtist(song.getArtist());
journalSong.setUrl(song.getUrl());
journalSong.setImage(song.getImage());
journalSong.setSongId(item);
journalSong.setJournalNo(param.getJournalNo());
journalSong.setSongNo(num + 1);
journalSong.setSongNo(num);
journalSong.setSongId(song.getId());
journalSongList.add(journalSong);
}

@ -15,7 +15,6 @@ import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.*;
import util.IdWorker;
import javax.annotation.Resource;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.List;
@ -24,7 +23,9 @@ import java.util.List;
@Service
public class S3Service {
@Resource
@Autowired
private S3Client s3Client;
@Autowired
private IdWorker idWorker;
@ -114,9 +115,7 @@ public class S3Service {
return true;
} catch (Exception e) {
return false;
} /*finally {
s3Client.close();
}*/
}
}
/**
@ -140,9 +139,7 @@ public class S3Service {
}
} catch (Exception e) {
return -1;
} /*finally {
s3Client.close();
}*/
}
return 1;
}
@ -170,9 +167,7 @@ public class S3Service {
}
} catch (Exception e) {
return -1;
} /*finally {
s3Client.close();
}*/
}
}
/**
@ -195,9 +190,7 @@ public class S3Service {
}
} catch(Exception e) {
return -1;
} /*finally {
s3Client.close();
}*/
}
}
public void uploadAvatar(String bucket, String key, byte[] buffer) {

Loading…
Cancel
Save