|
@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.http.ParseException;
|
|
import org.apache.http.ParseException;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.core.io.FileSystemResource;
|
|
import org.springframework.core.io.FileSystemResource;
|
|
import org.springframework.http.HttpEntity;
|
|
import org.springframework.http.HttpEntity;
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
@@ -44,7 +45,13 @@ import java.util.concurrent.Executors;
|
|
@Slf4j
|
|
@Slf4j
|
|
@Service
|
|
@Service
|
|
public class MaterialUploadServiceImpl implements IMaterialUploadService {
|
|
public class MaterialUploadServiceImpl implements IMaterialUploadService {
|
|
- static ExecutorService executorService = Executors.newFixedThreadPool(3);
|
|
|
|
|
|
+ static ExecutorService executorService = Executors.newFixedThreadPool(4);
|
|
|
|
+ @Value("${oss.replace.replace-value}")
|
|
|
|
+ private String replaceValue;
|
|
|
|
+ @Value("${oss.replace.replace-old-value}")
|
|
|
|
+ private String replaceOldValue;
|
|
|
|
+ @Value("${oss.replace.download}")
|
|
|
|
+ private String downloadUrl;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -90,11 +97,14 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
|
|
if (Check.isNull(materialInfo)) {
|
|
if (Check.isNull(materialInfo)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ if (Check.isNull(materialInfo.getUrl())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
-
|
|
|
|
- String localUrl = LoadFileUtil.downLoadFromUrl(materialInfo.getUrl(), PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
|
|
|
|
|
|
+ String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
|
|
|
|
+ String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
|
|
|
|
|
|
for (int i = 0; i < accountArray.size(); i++) {
|
|
for (int i = 0; i < accountArray.size(); i++) {
|
|
Long accountId = accountArray.getLong(i);
|
|
Long accountId = accountArray.getLong(i);
|
|
@@ -141,8 +151,13 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
|
|
if (Check.isNull(materialInfo)) {
|
|
if (Check.isNull(materialInfo)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ if (Check.isNull(materialInfo.getUrl())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
try {
|
|
try {
|
|
- String localUrl = LoadFileUtil.downLoadFromUrl(materialInfo.getUrl(), PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
|
|
|
|
|
|
+ String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
|
|
|
|
+ log.info("replaceUrl:{}", url);
|
|
|
|
+ String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
|
|
FileSystemResource resource = new FileSystemResource(new File(localUrl));
|
|
FileSystemResource resource = new FileSystemResource(new File(localUrl));
|
|
Map<String, String> headerMap = new HashMap<>();
|
|
Map<String, String> headerMap = new HashMap<>();
|
|
headerMap.put("Content-Type", "multipart/form-data");
|
|
headerMap.put("Content-Type", "multipart/form-data");
|