|
@@ -1,11 +1,9 @@
|
|
|
package com.cdf.service.impl;
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.cdf.common.ResultCode;
|
|
|
-import com.cdf.entity.FdkkUser;
|
|
|
import com.cdf.entity.HotRelation;
|
|
|
import com.cdf.exception.BusinessException;
|
|
|
import com.cdf.httpClient.client.CdfClient;
|
|
@@ -16,7 +14,6 @@ import com.cdf.httpClient.request.FdkkUploadRequest;
|
|
|
import com.cdf.httpClient.request.SceneRequest;
|
|
|
import com.cdf.httpClient.response.FdkkResponse;
|
|
|
import com.cdf.httpClient.response.cdf.*;
|
|
|
-import com.cdf.service.IFdkkUserService;
|
|
|
import com.cdf.service.IHotRelationService;
|
|
|
import com.cdf.util.*;
|
|
|
import com.google.zxing.client.j2se.MatrixToImageWriter;
|
|
@@ -26,7 +23,6 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.web.bind.annotation.RequestHeader;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -35,15 +31,14 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
public class FdkkSceneEditService {
|
|
|
@Resource
|
|
|
- private UploadToOssUtil uploadToOssUtil;
|
|
|
- @Value("${upload.bucket}")
|
|
|
- private String bucket;
|
|
|
+ private UploadToFdkkOssUtil uploadToFdkkOssUtil;
|
|
|
+ @Resource
|
|
|
+ private UploadToCdfOssUtil uploadToCdfOssUtil;
|
|
|
@Value("${fdkk.hot-path}")
|
|
|
private String hotPath;
|
|
|
@Value("${fdkk.hot-cdf-path}")
|
|
@@ -132,7 +127,7 @@ public class FdkkSceneEditService {
|
|
|
}
|
|
|
|
|
|
public JSONArray getHotJson(String num) {
|
|
|
- String data = uploadToOssUtil.getObjectContent(bucket, String.format(hotPath, num) );
|
|
|
+ String data = uploadToFdkkOssUtil.getObjectContent(String.format(hotPath, num) );
|
|
|
if(StringUtils.isBlank(data)){
|
|
|
throw new BusinessException(ResultCode.NOT_RECORD);
|
|
|
}
|
|
@@ -141,9 +136,9 @@ public class FdkkSceneEditService {
|
|
|
}
|
|
|
|
|
|
public JSONArray getCdfHotJson(String num) {
|
|
|
- String data = uploadToOssUtil.getObjectContent(bucket, String.format(hotCdfPath, num));
|
|
|
+ String data = uploadToCdfOssUtil.getObjectContent(String.format(hotCdfPath, num));
|
|
|
if(StringUtils.isBlank(data)){
|
|
|
- data = uploadToOssUtil.getObjectContent(bucket, String.format(hotPath, num));
|
|
|
+ data = uploadToFdkkOssUtil.getObjectContent( String.format(hotPath, num));
|
|
|
}
|
|
|
if(StringUtils.isBlank(data)){
|
|
|
throw new BusinessException(ResultCode.NOT_RECORD);
|
|
@@ -158,7 +153,6 @@ public class FdkkSceneEditService {
|
|
|
throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
|
|
|
}
|
|
|
writeHotJson(fdkkHotRequest.getNum());
|
|
|
- //ReadCmdLine.callShellByExec("aws s3 sync s3://4dkankan/cdf s3://4dage-moderate2/cdf --profile user1");
|
|
|
}
|
|
|
|
|
|
public void writeHotJson(String num) throws IOException {
|
|
@@ -166,7 +160,7 @@ public class FdkkSceneEditService {
|
|
|
String path = String.format(hotLocalPath,num)+"/"+"hot.json";
|
|
|
String json = JSONUtil.toJsonStr(hotJson);
|
|
|
FileUtils.writeFile(path,json );
|
|
|
- uploadToOssUtil.upload(path,String.format(hotCdfPath, num));
|
|
|
+ uploadToCdfOssUtil.upload(path,String.format(hotCdfPath, num));
|
|
|
}
|
|
|
public FdkkResponse uploadFiles(FdkkUploadRequest fdkkUploadRequest, MultipartFile[] files, String token) throws IOException {
|
|
|
List<MultipartFile> multipartFiles = new ArrayList<>();
|