|
|
|
@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import util.IdWorker;
|
|
|
|
@ -53,7 +54,8 @@ public class CMSJournalService {
|
|
|
|
|
private SongInfoDao songDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserClient userClient;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -376,6 +378,7 @@ public class CMSJournalService {
|
|
|
|
|
Journal journal=optional.get();
|
|
|
|
|
updateJournal(journal, param, token);
|
|
|
|
|
journalDao.save(journal);
|
|
|
|
|
redisTemplate.opsForValue().set("journal_"+id,journal);
|
|
|
|
|
if (!CollectionUtils.isEmpty(param.getTag())) {
|
|
|
|
|
journalTagDao.deleteByJournalId(id);
|
|
|
|
|
}
|
|
|
|
@ -409,13 +412,22 @@ public class CMSJournalService {
|
|
|
|
|
String tempImage=param.getImage();
|
|
|
|
|
if(!StringTools.isEmpty(tempImage)&&tempImage.contains(Constants.TEMP_KEY_PREFIX)) {
|
|
|
|
|
String srcKey=param.getImage().substring(param.getImage().indexOf(Constants.TEMP_KEY_PREFIX));
|
|
|
|
|
String image = moveJournalImage(srcKey, param);
|
|
|
|
|
if (!StringUtils.isBlank(image)) {
|
|
|
|
|
String image = copyJournalImage(srcKey, journal.getJournalNo());
|
|
|
|
|
if (null!=image) {
|
|
|
|
|
journal.setImage(image);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String copyJournalImage(String srcKey, String journalNo) {
|
|
|
|
|
String destKeySuffix = String.format("%05d/%s", Integer.parseInt(journalNo), srcKey.replace(Constants.TEMP_KEY_PREFIX, ""));
|
|
|
|
|
String destKey = Constants.MUSIC_KEY_PREFIX + destKeySuffix;
|
|
|
|
|
int copy = s3Service.copy(Constants.BUCKET, srcKey, destKey);
|
|
|
|
|
if (copy > 0) {
|
|
|
|
|
return destKeySuffix;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 删除期刊的标签、音乐信息
|
|
|
|
|
* @param journalId
|
|
|
|
|