|
@@ -8,9 +8,11 @@ import cn.hutool.core.exceptions.ExceptionUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.ZipUtil;
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
|
+import cn.hutool.extra.spring.SpringUtil;
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.constant.SceneDownloadProgressStatus;
|
|
import com.fdkankan.common.constant.SceneDownloadProgressStatus;
|
|
import com.fdkankan.common.constant.SceneKind;
|
|
import com.fdkankan.common.constant.SceneKind;
|
|
@@ -18,13 +20,11 @@ import com.fdkankan.common.constant.ServerCode;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.scene.bean.*;
|
|
import com.fdkankan.scene.bean.*;
|
|
-import com.fdkankan.scene.entity.ScenePlus;
|
|
|
|
-import com.fdkankan.scene.entity.ScenePlusExt;
|
|
|
|
-import com.fdkankan.scene.entity.ScenePro;
|
|
|
|
|
|
+import com.fdkankan.scene.config.FdkkLaserConfig;
|
|
|
|
+import com.fdkankan.scene.config.ServiceConfig;
|
|
|
|
+import com.fdkankan.scene.entity.*;
|
|
import com.fdkankan.scene.oss.OssUtil;
|
|
import com.fdkankan.scene.oss.OssUtil;
|
|
-import com.fdkankan.scene.service.IScenePlusExtService;
|
|
|
|
-import com.fdkankan.scene.service.IScenePlusService;
|
|
|
|
-import com.fdkankan.scene.service.ISceneProService;
|
|
|
|
|
|
+import com.fdkankan.scene.service.*;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
@@ -99,8 +99,6 @@ public class SceneDownloadHandlerServiceImpl {
|
|
private int zipNthreads;
|
|
private int zipNthreads;
|
|
@Value("${fyun.bucket:4dkankan}")
|
|
@Value("${fyun.bucket:4dkankan}")
|
|
private String bucket;
|
|
private String bucket;
|
|
- @Value("${fyun.type}")
|
|
|
|
- private String uploadType;
|
|
|
|
@Value("${download.config.resource-url}")
|
|
@Value("${download.config.resource-url}")
|
|
private String resourceUrl;
|
|
private String resourceUrl;
|
|
@Value("${download.config.public-url}")
|
|
@Value("${download.config.public-url}")
|
|
@@ -122,6 +120,8 @@ public class SceneDownloadHandlerServiceImpl {
|
|
private IScenePlusExtService scenePlusExtService;
|
|
private IScenePlusExtService scenePlusExtService;
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneProService sceneProService;
|
|
private ISceneProService sceneProService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ISceneDownloadLogService sceneDownloadLogService;
|
|
|
|
|
|
@Async("sceneDownLoadExecutror")
|
|
@Async("sceneDownLoadExecutror")
|
|
public void download(DownLoadTaskBean downLoadTaskBean){
|
|
public void download(DownLoadTaskBean downLoadTaskBean){
|
|
@@ -144,6 +144,11 @@ public class SceneDownloadHandlerServiceImpl {
|
|
log.info("场景下载结束 - num[{}] - threadName[{}] - consumeTime[{}]", num, Thread.currentThread().getName(), consumeTime);
|
|
log.info("场景下载结束 - num[{}] - threadName[{}] - consumeTime[{}]", num, Thread.currentThread().getName(), consumeTime);
|
|
|
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
|
+ sceneDownloadLogService.update(
|
|
|
|
+ new LambdaUpdateWrapper<SceneDownloadLog>()
|
|
|
|
+ .eq(SceneDownloadLog::getSceneNum,num)
|
|
|
|
+ .set(SceneDownloadLog::getStatus,2)
|
|
|
|
+ );
|
|
log.error(ExceptionUtil.stacktraceToString(e));
|
|
log.error(ExceptionUtil.stacktraceToString(e));
|
|
}finally {
|
|
}finally {
|
|
if(StrUtil.isNotEmpty(num)){
|
|
if(StrUtil.isNotEmpty(num)){
|
|
@@ -255,9 +260,10 @@ public class SceneDownloadHandlerServiceImpl {
|
|
//上传压缩包
|
|
//上传压缩包
|
|
String uploadPath = String.format(this.zipOssFormat, num);
|
|
String uploadPath = String.format(this.zipOssFormat, num);
|
|
ossUtil.uploadFile(uploadPath, zipPath, false);
|
|
ossUtil.uploadFile(uploadPath, zipPath, false);
|
|
|
|
+ ServiceConfig serviceConfig = SpringUtil.getBean(ServiceConfig.class);
|
|
|
|
|
|
//更新进度100
|
|
//更新进度100
|
|
- String url = this.publicUrl + uploadPath + "?t=" + Calendar.getInstance().getTimeInMillis();
|
|
|
|
|
|
+ String url = "/" + uploadPath + "?t=" + Calendar.getInstance().getTimeInMillis();
|
|
this.updateProgress(null, num, SceneDownloadProgressStatus.DOWNLOAD_SUCCESS.code(), url, "v4");
|
|
this.updateProgress(null, num, SceneDownloadProgressStatus.DOWNLOAD_SUCCESS.code(), url, "v4");
|
|
|
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
@@ -332,9 +338,10 @@ public class SceneDownloadHandlerServiceImpl {
|
|
//上传压缩包
|
|
//上传压缩包
|
|
String uploadPath = String.format(this.zipOssFormat, num);
|
|
String uploadPath = String.format(this.zipOssFormat, num);
|
|
ossUtil.uploadFile(uploadPath, zipPath, false);
|
|
ossUtil.uploadFile(uploadPath, zipPath, false);
|
|
|
|
+ ServiceConfig serviceConfig = SpringUtil.getBean(ServiceConfig.class);
|
|
|
|
|
|
//更新进度100
|
|
//更新进度100
|
|
- String url = this.publicUrl + uploadPath + "?t=" + Calendar.getInstance().getTimeInMillis();
|
|
|
|
|
|
+ String url = "/" + uploadPath + "?t=" + Calendar.getInstance().getTimeInMillis();
|
|
this.updateProgress(null, num, SceneDownloadProgressStatus.DOWNLOAD_SUCCESS.code(), url, "v3");
|
|
this.updateProgress(null, num, SceneDownloadProgressStatus.DOWNLOAD_SUCCESS.code(), url, "v3");
|
|
|
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
@@ -536,6 +543,7 @@ public class SceneDownloadHandlerServiceImpl {
|
|
JSONObject controls = sceneJson.getJSONObject("controls");
|
|
JSONObject controls = sceneJson.getJSONObject("controls");
|
|
controls.set("showLock", 0);
|
|
controls.set("showLock", 0);
|
|
String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
|
|
String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
|
|
|
|
+
|
|
String sceneJsonStr = sceneJson.toString().replace(this.publicUrl, "");
|
|
String sceneJsonStr = sceneJson.toString().replace(this.publicUrl, "");
|
|
FileUtil.writeUtf8String(sceneJsonStr, String.format(this.sourceLocal, num, this.wwwroot + sceneJsonPath));
|
|
FileUtil.writeUtf8String(sceneJsonStr, String.format(this.sourceLocal, num, this.wwwroot + sceneJsonPath));
|
|
}
|
|
}
|
|
@@ -544,7 +552,8 @@ public class SceneDownloadHandlerServiceImpl {
|
|
|
|
|
|
//访问密码置0
|
|
//访问密码置0
|
|
String getInfoKey = String.format("data/data%s/", num) + "getInfo.json";
|
|
String getInfoKey = String.format("data/data%s/", num) + "getInfo.json";
|
|
- String getInfoStr = getInfo.toString().replace(this.publicUrl, "");
|
|
|
|
|
|
+
|
|
|
|
+ String getInfoStr = getInfo.toString().replace(this.publicUrl , "");
|
|
FileUtil.writeUtf8String(getInfoStr, String.format(this.sourceLocal, num, this.wwwroot + getInfoKey));
|
|
FileUtil.writeUtf8String(getInfoStr, String.format(this.sourceLocal, num, this.wwwroot + getInfoKey));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -633,14 +642,15 @@ public class SceneDownloadHandlerServiceImpl {
|
|
.replace("https://spc.html","spc.html")
|
|
.replace("https://spc.html","spc.html")
|
|
.replace("https://smobile.html", "smobile.html");
|
|
.replace("https://smobile.html", "smobile.html");
|
|
|
|
|
|
- FileUtil.writeUtf8String(content, String.format(sourceLocal, num, prefix + key));
|
|
|
|
|
|
+ FileUtil.writeUtf8String(content, String.format(sourceLocal, num, prefix + key.replace(FdkkLaserConfig.getProfile(),"")));
|
|
}else{
|
|
}else{
|
|
// HttpUtil.downloadFile(url, String.format(sourceLocal, num, prefix + key));
|
|
// HttpUtil.downloadFile(url, String.format(sourceLocal, num, prefix + key));
|
|
try {
|
|
try {
|
|
- ossUtil.downloadFile(key, String.format(sourceLocal, num, prefix + key));
|
|
|
|
|
|
+
|
|
|
|
+ ossUtil.downloadFile(key,String.format(sourceLocal, num, prefix + key.replace(FdkkLaserConfig.getProfile(),"")));
|
|
// this.downloadFile(url, String.format(sourceLocal, num, prefix + key));
|
|
// this.downloadFile(url, String.format(sourceLocal, num, prefix + key));
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- log.info("下载文件报错,path:{}", String.format(sourceLocal, num, prefix + key));
|
|
|
|
|
|
+ log.info("下载文件报错,path:{}", key);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|