|
@@ -19,10 +19,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import static com.tzld.piaoquan.longarticle.common.constants.RedisConstant.REDIS_COOKIE_KEY;
|
|
|
|
|
@@ -41,7 +38,6 @@ public class VideoServiceImpl implements VideoService {
|
|
|
private RedisTemplate<String, Object> redisTemplate;
|
|
|
|
|
|
|
|
|
-
|
|
|
public VideoDetail publish(String ossPath, String uid, String title) {
|
|
|
String videoId = publishToPQ(ossPath, uid, title);
|
|
|
if (videoId == null) {
|
|
@@ -53,7 +49,7 @@ public class VideoServiceImpl implements VideoService {
|
|
|
private String publishToPQ(String ossPath, String uid, String title) {
|
|
|
try {
|
|
|
String cookie = (String) redisTemplate.opsForValue().get(REDIS_COOKIE_KEY);
|
|
|
- if(StringUtils.isEmpty(cookie)){
|
|
|
+ if (StringUtils.isEmpty(cookie)) {
|
|
|
cookie = "JSESSIONID=4DEA2B5173BB9A9E82DB772C0ACDBC9F; JSESSIONID=D02C334150025222A0B824A98B539B78";
|
|
|
}
|
|
|
Map<String, Object> payload = new HashMap<>();
|
|
@@ -94,6 +90,7 @@ public class VideoServiceImpl implements VideoService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private VideoDetail getPQVideoDetail(String videoId) {
|
|
|
try {
|
|
|
Map<String, Object> data = new HashMap<>();
|
|
@@ -109,11 +106,13 @@ public class VideoServiceImpl implements VideoService {
|
|
|
if (!CollectionUtils.isEmpty(data)) {
|
|
|
String id = list.get(0).getStr("id");
|
|
|
String shareImgPath = list.get(0).getStr("shareImgPath");
|
|
|
+ String coverImgPath = getCoverImgPath(shareImgPath);
|
|
|
String videoPath = list.get(0).getStr("videoPath");
|
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
|
videoDetail.setVideoId(id);
|
|
|
}
|
|
|
- videoDetail.setVideoCover(shareImgPath);
|
|
|
+ videoDetail.setShareImgPath(shareImgPath);
|
|
|
+ videoDetail.setCoverImgPath(coverImgPath);
|
|
|
videoDetail.setVideoPath(videoPath);
|
|
|
}
|
|
|
return videoDetail;
|
|
@@ -123,6 +122,20 @@ public class VideoServiceImpl implements VideoService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ private String getCoverImgPath(String shareImgPath) {
|
|
|
+ String[] split = shareImgPath.split("/");
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ for (String s : split) {
|
|
|
+ if (!s.startsWith("watermark")) {
|
|
|
+ stringBuilder.append(s).append("/");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (stringBuilder.length() > 0) {
|
|
|
+ stringBuilder.deleteCharAt(stringBuilder.length() - 1);
|
|
|
+ }
|
|
|
+ return stringBuilder.toString();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void miniProgramVideoOff(String traceId) {
|
|
|
try {
|