Ver código fonte

Merge branch 'feature-俊波要求上传额外文件' into test

dengsixing 10 meses atrás
pai
commit
1fb95feff2

+ 6 - 1
src/main/java/com/fdkankan/contro/mq/listener/UpdateSceneStatusListener.java

@@ -4,6 +4,7 @@ import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
@@ -25,6 +26,8 @@ public class UpdateSceneStatusListener {
 
     @Autowired
     private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ICommonService commonService;
 
     /**
      * 更新场景status.json状态
@@ -43,12 +46,14 @@ public class UpdateSceneStatusListener {
         Integer status = (Integer)map.get("status");
         String statusJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num).concat("status.json");
         try {
-
             String fileContent = fYunFileService.getFileContent(statusJsonPath);
             JSONObject jsonObject = JSON.parseObject(fileContent);
             jsonObject.put("status", status);
             FileUtil.writeUtf8String(jsonObject.toJSONString(),ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json");
             fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJsonPath);
+            if(status == 1){
+                commonService.sendEmail(num, "standar");
+            }
         }catch (Exception e){
             log.error("更新场景的的status.json状态, content:{}", msg, e);
         }finally {

+ 16 - 20
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -300,6 +300,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             //上传全景图俯视图
             this.uploadFloorCad(path, sceneCode, uploadFiles);
 
+            this.uploadFreespace(sceneCode, path, uploadFiles);
+
             log.info("开始上传场景计算结果数据,num:{}", sceneCode);
             //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
             fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
@@ -409,8 +411,10 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             scenePlusExtService.updateById(scenePlusExt);
 
             //国际环境需要发邮件通知
-            if("eur".equals(env)){
-                commonService.sendEmail(sceneCode, "V4");
+            if("eur".equals(env) &&
+                    !scenePlus.getSceneSource().equals(SceneSource.JG.code()) &&
+                    !scenePlus.getSceneSource().equals(SceneSource.SG.code())){
+                commonService.sendEmail(sceneCode, "standar");
             }
 
             wbService.sendMq(sceneCode, CommonSuccessStatus.SUCCESS.code());
@@ -429,24 +433,16 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         }
     }
 
-//    private void cachePanorama(String dataSource, String num){
-//        String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
-//        //将全景图缓存到缓存目录
-//        List<String> imagesList = FileUtil.listFileNames(dataSource + "/caches/images");
-//        //先清除旧的全景图
-//        cn.hutool.core.io.FileUtil.del(cachedImagesPath);
-//        String visionPath = dataSource + "/results/vision.txt";
-//        List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
-//        imagesList.stream().forEach(fileName -> {
-//            if (panoramaImageList.contains(fileName)) {
-//                String srcPath = dataSource + "/caches/images/" + fileName;
-//                String targetPath = cachedImagesPath + fileName;
-//                log.info("源文件:{}, 目标文件:{}", srcPath, targetPath);
-//                cn.hutool.core.io.FileUtil.copy(srcPath, targetPath, true);
-//            }
-//        });
-//    }
-
+    void uploadFreespace(String num, String path, Map<String, String> map){
+        String plyPath = path + "/result/laserData/cover/final_freespace.ply";
+        String pngPath = path + "/result/laserData/cover/final_freespace.png";
+        if(FileUtil.exist(plyPath)){
+            map.put(plyPath, String.format(UploadFilePath.IMG_VIEW_PATH, num) + FileUtil.getName(plyPath));
+        }
+        if(FileUtil.exist(pngPath)){
+            map.put(pngPath, String.format(UploadFilePath.IMG_VIEW_PATH, num) + FileUtil.getName(pngPath));
+        }
+    }
 
 
     private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){

+ 1 - 1
src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java

@@ -309,7 +309,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
 
             //国际环境需要发邮件通知
             if("eur".equals(env)){
-                commonService.sendEmail(sceneCode, "V3");
+                commonService.sendEmail(sceneCode, "standar");
             }
 
         }catch (Exception e){

+ 6 - 3
src/main/java/com/fdkankan/contro/service/impl/CommonServiceImpl.java

@@ -60,7 +60,7 @@ import java.util.stream.Collectors;
 @RefreshScope
 public class CommonServiceImpl implements ICommonService {
 
-    @Value("${main.laserUrlP:#{null}}")
+    @Value("${main.laserUrl:#{null}}")
     private String laserUrl;
 
     @Value("${env:gn}")
@@ -257,6 +257,7 @@ public class CommonServiceImpl implements ICommonService {
             Long userId = null;
             String websize = "";
             String title = "";
+            Integer sceneSource = null;
             ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
             if(Objects.isNull(scenePlus)){
                 ScenePro scenePro = sceneProService.getByNum(num);
@@ -266,11 +267,13 @@ public class CommonServiceImpl implements ICommonService {
                 userId = scenePro.getUserId();
                 websize = scenePro.getWebSite();
                 title = scenePro.getSceneName();
+                sceneSource = scenePro.getSceneSource();
             }else{
                 userId = scenePlus.getUserId();
                 ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
                 websize = scenePlusExt.getWebSite();
                 title = scenePlus.getTitle();
+                sceneSource = scenePlus.getSceneSource();
             }
 
             if(Objects.isNull(userId)){
@@ -288,8 +291,8 @@ public class CommonServiceImpl implements ICommonService {
                 helpLink = helpLinkZh;
             }
             websize += "&lang=" + lang;
-            if(("V4".equals(type) || "V3".equals(type))
-                    && (scenePlus.getSceneSource() == SceneSource.JG.code() || scenePlus.getSceneSource() == SceneSource.SG.code())){
+            if(("standar".equals(type))
+                    && (sceneSource == SceneSource.JG.code() || sceneSource == SceneSource.SG.code())){
                 websize = String.format(laserUrl, num, lang);
             }