|
@@ -11,9 +11,11 @@ import cn.hutool.http.HttpUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
|
+import com.fdkankan.common.util.DateExtUtil;
|
|
import com.fdkankan.common.util.DateUtil;
|
|
import com.fdkankan.common.util.DateUtil;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.contro.bean.SyncLaserResultBean;
|
|
import com.fdkankan.contro.bean.SyncLaserResultBean;
|
|
@@ -21,7 +23,6 @@ import com.fdkankan.contro.constant.UserEditDataType;
|
|
import com.fdkankan.contro.entity.*;
|
|
import com.fdkankan.contro.entity.*;
|
|
import com.fdkankan.contro.mq.service.IBuildSceneService;
|
|
import com.fdkankan.contro.mq.service.IBuildSceneService;
|
|
import com.fdkankan.contro.service.*;
|
|
import com.fdkankan.contro.service.*;
|
|
-import com.fdkankan.contro.util.HttpUtilExt;
|
|
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
@@ -55,7 +56,6 @@ import java.io.IOException;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.Map.Entry;
|
|
import java.util.Map.Entry;
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -166,21 +166,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
boolean success = false;
|
|
boolean success = false;
|
|
String num = message.getSceneNum();
|
|
String num = message.getSceneNum();
|
|
String batchIds = (String) message.getExt().get("batchId");
|
|
String batchIds = (String) message.getExt().get("batchId");
|
|
- String threeCamType = (String) message.getExt().get("threeCamType");
|
|
|
|
- String filename = (String)message.getExt().get("filename");
|
|
|
|
try {
|
|
try {
|
|
|
|
|
|
- //如果场景原始资源上传批次id不为空,则需要下载批次文件上传到oss目录
|
|
|
|
- if(StrUtil.isNotEmpty(batchIds)){
|
|
|
|
- for (String batchId : batchIds.split(",")) {
|
|
|
|
- if(StrUtil.isNotEmpty(threeCamType) && "yzl".equals(threeCamType)){
|
|
|
|
- this.downloadOrigFile4Yzl(batchId, message.getPath());
|
|
|
|
- }else{
|
|
|
|
- this.downloadOrigFile(batchId, message.getPath());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
//重新计算时需要删除文件夹,否知使用缓存
|
|
//重新计算时需要删除文件夹,否知使用缓存
|
|
if(new File(message.getPath() + File.separator + "results").exists()){
|
|
if(new File(message.getPath() + File.separator + "results").exists()){
|
|
FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
|
|
FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
|
|
@@ -314,6 +301,17 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
reason = "前置处理异常";
|
|
reason = "前置处理异常";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(StrUtil.isNotEmpty(batchIds)){
|
|
|
|
+ List<OrigFileUploadBatch> list = origFileUploadBatchService.list(new LambdaQueryWrapper<OrigFileUploadBatch>().in(OrigFileUploadBatch::getBatchId, batchIds));
|
|
|
|
+ for (OrigFileUploadBatch origFileUploadBatch : list) {
|
|
|
|
+ if(origFileUploadBatch.getCreateTime().before(DateExtUtil.offsetDay(new Date(), -1))){//一天之内重试,超过一天就认为此批次没有可用价值,置为异常状态
|
|
|
|
+ origFileUploadBatch.setStatus(-1);
|
|
|
|
+ origFileUploadBatch.setUpdateTime(new Date());
|
|
|
|
+ origFileUploadBatchService.updateById(origFileUploadBatch);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
jmgaService.updateSceneFailAndZipLog(num, reason);
|
|
jmgaService.updateSceneFailAndZipLog(num, reason);
|
|
|
|
|
|
this.sendFailToLaser(num);
|
|
this.sendFailToLaser(num);
|
|
@@ -341,84 +339,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- private void downloadOrigFile(String batchId, String dataSource){
|
|
|
|
- if(StrUtil.isEmpty(batchId)){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<OrigFileUpload> fileList = origFileUploadService.getByBatchId(batchId);
|
|
|
|
- if(CollUtil.isEmpty(fileList)){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- String homePath = "/oss/4dkankan/" + SceneUtil.getHomePath(dataSource);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- for (OrigFileUpload origFileUpload : fileList) {
|
|
|
|
- int times = 0;
|
|
|
|
- String filePath = homePath.concat(origFileUpload.getFileName());
|
|
|
|
- log.info("开始下载原始文件, url:{}, filePath:{}", origFileUpload.getFileUrl(), filePath);
|
|
|
|
- do{
|
|
|
|
- try {
|
|
|
|
- ++times;
|
|
|
|
- HttpUtil.downloadFile(origFileUpload.getFileUrl(), new File(filePath), 3 * 60 * 1000);
|
|
|
|
- if(FileUtil.exist(filePath)){
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.info("原始文件第{}次下载失败,fileUrl:{}, filePath:{}", times, origFileUpload.getFileUrl(), filePath);
|
|
|
|
- }
|
|
|
|
- }while (times < 3);
|
|
|
|
- log.info("下载原始文件结束, url:{}, filePath:{}", origFileUpload.getFileUrl(), filePath);
|
|
|
|
-// if(!FileUtil.exist(filePath)){
|
|
|
|
-// throw new RuntimeException("原始文件下载失败,fileUrl:" + origFileUpload.getFileUrl() + ", filePath:" + filePath);
|
|
|
|
-// }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void downloadOrigFile4Yzl(String batchId, String dataSource){
|
|
|
|
- if(StrUtil.isEmpty(batchId)){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- OrigFileUpload sceneUpData = origFileUploadService.getByBatchIdAndFileName(batchId, "scene_up_data.txt");
|
|
|
|
- String sceneUpDataPath = dataSource + "/" + "scene_up_data.txt";
|
|
|
|
- HttpUtilExt.downloadFileAndCheck(sceneUpData.getFileUrl(), sceneUpDataPath, 60000);
|
|
|
|
- String sceneUpDataStr = FileUtil.readUtf8String(sceneUpDataPath);
|
|
|
|
- JSONArray fileJsonArray = JSON.parseArray(sceneUpDataStr);
|
|
|
|
- Map<String, String> fileMap = fileJsonArray.stream().collect(Collectors.toMap(v -> ((JSONObject) v).getString("fileName"), v -> ((JSONObject) v).getString("filePath")));
|
|
|
|
-
|
|
|
|
- List<OrigFileUpload> fileList = origFileUploadService.getByBatchId(batchId);
|
|
|
|
- if(CollUtil.isEmpty(fileList)){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- String homePath = "/oss/4dkankan/" + SceneUtil.getHomePath(dataSource);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- for (OrigFileUpload origFileUpload : fileList) {
|
|
|
|
- String relativeFilePath = fileMap.get(origFileUpload.getFileName());
|
|
|
|
- if(StrUtil.isEmpty(relativeFilePath)){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- int times = 0;
|
|
|
|
- String filePath = homePath.concat(relativeFilePath);
|
|
|
|
- log.info("开始下载原始文件, url:{}, filePath:{}", origFileUpload.getFileUrl(), filePath);
|
|
|
|
- do{
|
|
|
|
- try {
|
|
|
|
- ++times;
|
|
|
|
- HttpUtil.downloadFile(origFileUpload.getFileUrl(), new File(filePath), 3 * 60 * 1000);
|
|
|
|
- if(FileUtil.exist(filePath)){
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.info("原始文件第{}次下载失败,fileUrl:{}, filePath:{}", times, origFileUpload.getFileUrl(), filePath);
|
|
|
|
- }
|
|
|
|
- }while (times < 4);
|
|
|
|
- log.info("下载原始文件结束, url:{}, filePath:{}", origFileUpload.getFileUrl(), filePath);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private String getOssPath(String path) {
|
|
private String getOssPath(String path) {
|
|
String ossPath = ConstantFilePath.OSS_PREFIX
|
|
String ossPath = ConstantFilePath.OSS_PREFIX
|
|
+ path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
+ path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|